ReactMaterial3/dist/delegate-BXi1gVeU.mjs

116 lines
2.5 KiB
JavaScript

import "./class-map-CwiboTfb.mjs";
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const d = [
"role",
"ariaAtomic",
"ariaAutoComplete",
"ariaBusy",
"ariaChecked",
"ariaColCount",
"ariaColIndex",
"ariaColSpan",
"ariaCurrent",
"ariaDisabled",
"ariaExpanded",
"ariaHasPopup",
"ariaHidden",
"ariaInvalid",
"ariaKeyShortcuts",
"ariaLabel",
"ariaLevel",
"ariaLive",
"ariaModal",
"ariaMultiLine",
"ariaMultiSelectable",
"ariaOrientation",
"ariaPlaceholder",
"ariaPosInSet",
"ariaPressed",
"ariaReadOnly",
"ariaRequired",
"ariaRoleDescription",
"ariaRowCount",
"ariaRowIndex",
"ariaRowSpan",
"ariaSelected",
"ariaSetSize",
"ariaSort",
"ariaValueMax",
"ariaValueMin",
"ariaValueNow",
"ariaValueText"
], A = d.map(b);
function n(e) {
return A.includes(e);
}
function b(e) {
return e.replace("aria", "aria-").replace(/Elements?/g, "").toLowerCase();
}
/**
* @license
* Copyright 2023 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
const s = Symbol("privateIgnoreAttributeChangesFor");
function g(e) {
var r;
class a extends e {
constructor() {
super(...arguments), this[r] = /* @__PURE__ */ new Set();
}
attributeChangedCallback(t, i, o) {
if (!n(t)) {
super.attributeChangedCallback(t, i, o);
return;
}
if (this[s].has(t))
return;
this[s].add(t), this.removeAttribute(t), this[s].delete(t);
const c = p(t);
o === null ? delete this.dataset[c] : this.dataset[c] = o, this.requestUpdate(p(t), i);
}
getAttribute(t) {
return n(t) ? super.getAttribute(l(t)) : super.getAttribute(t);
}
removeAttribute(t) {
super.removeAttribute(t), n(t) && (super.removeAttribute(l(t)), this.requestUpdate());
}
}
return r = s, h(a), a;
}
function h(e) {
for (const r of d) {
const a = b(r), u = l(a), t = p(a);
e.createProperty(r, {
attribute: a,
noAccessor: !0
}), e.createProperty(Symbol(u), {
attribute: u,
noAccessor: !0
}), Object.defineProperty(e.prototype, r, {
configurable: !0,
enumerable: !0,
get() {
return this.dataset[t] ?? null;
},
set(i) {
const o = this.dataset[t] ?? null;
i !== o && (i === null ? delete this.dataset[t] : this.dataset[t] = i, this.requestUpdate(r, o));
}
});
}
}
function l(e) {
return `data-${e}`;
}
function p(e) {
return e.replace(/-\w/, (r) => r[1].toUpperCase());
}
export {
g as m
};