UNPKG

@sandlada/mdc

Version:

@sandlada/mdc is an open source component library that follows the Material Design 3 design specifications.

8 lines 1.34 kB
import"../../node_modules/lit/index.js";import{AriaProperties as e,ariaPropertyToAttribute as t,isARIAAttribute as n}from"./aria.js"; /** * @license * Copyright 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ const r=Symbol(`privateIgnoreAttributeChangesFor`);function i(e){class t extends e{constructor(...e){super(...e),this[r]=new Set}attributeChangedCallback(e,t,i){if(!n(e)){super.attributeChangedCallback(e,t,i);return}if(this[r].has(e))return;this[r].add(e),this.removeAttribute(e),this[r].delete(e);let a=s(e);i===null?delete this.dataset[a]:this.dataset[a]=i,this.requestUpdate(s(e),t)}getAttribute(e){return n(e)?super.getAttribute(o(e)):super.getAttribute(e)}removeAttribute(e){super.removeAttribute(e),n(e)&&(super.removeAttribute(o(e)),this.requestUpdate())}}return a(t),t}function a(n){for(let r of e){let e=t(r),i=o(e),a=s(e);n.createProperty(r,{attribute:e,noAccessor:!0}),n.createProperty(Symbol(i),{attribute:i,noAccessor:!0}),Object.defineProperty(n.prototype,r,{configurable:!0,enumerable:!0,get(){return this.dataset[a]??null},set(e){let t=this.dataset[a]??null;e!==t&&(e===null?delete this.dataset[a]:this.dataset[a]=e,this.requestUpdate(r,t))}})}}function o(e){return`data-${e}`}function s(e){return e.replace(/-\w/,e=>e[1].toUpperCase())}export{i as mixinDelegatesAria}; //# sourceMappingURL=delegate.js.map