@m3e/core 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a11y.js +5 -2
- package/dist/a11y.js.map +1 -1
- package/dist/a11y.min.js +7 -7
- package/dist/a11y.min.js.map +1 -1
- package/dist/custom-elements.json +508 -215
- package/dist/index.js +143 -2
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +9 -10
- package/dist/index.min.js.map +1 -1
- package/dist/src/a11y/FocusTrapElement.d.ts.map +1 -1
- package/dist/src/shared/controllers/ScrollLockController.d.ts +16 -0
- package/dist/src/shared/controllers/ScrollLockController.d.ts.map +1 -0
- package/dist/src/shared/controllers/index.d.ts +1 -0
- package/dist/src/shared/controllers/index.d.ts.map +1 -1
- package/dist/src/shared/converters/index.d.ts +2 -0
- package/dist/src/shared/converters/index.d.ts.map +1 -0
- package/dist/src/shared/converters/spaceSeparatedStringConverter.d.ts +4 -0
- package/dist/src/shared/converters/spaceSeparatedStringConverter.d.ts.map +1 -0
- package/dist/src/shared/index.d.ts +1 -0
- package/dist/src/shared/index.d.ts.map +1 -1
- package/dist/src/shared/utils/VelocityTracker.d.ts +22 -0
- package/dist/src/shared/utils/VelocityTracker.d.ts.map +1 -0
- package/dist/src/shared/utils/computeCssSize.d.ts +8 -0
- package/dist/src/shared/utils/computeCssSize.d.ts.map +1 -0
- package/dist/src/shared/utils/focusWhenReady.d.ts.map +1 -1
- package/dist/src/shared/utils/index.d.ts +2 -0
- package/dist/src/shared/utils/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/a11y.min.js
CHANGED
|
@@ -13,12 +13,12 @@ import{isServer as t,html as e,css as i,LitElement as s}from"lit";function r(t,e
|
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2019 Google LLC
|
|
15
15
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
-
*/let v=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==p)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(f&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=m.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&m.set(e,t))}return t}toString(){return this.cssText}};const g=(t,e)=>{if(f)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),s=u.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}},
|
|
16
|
+
*/let v=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==p)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(f&&void 0===t){const i=void 0!==e&&1===e.length;i&&(t=m.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&m.set(e,t))}return t}toString(){return this.cssText}};const g=(t,e)=>{if(f)t.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(const i of e){const e=document.createElement("style"),s=u.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=i.cssText,t.appendChild(e)}},w=f?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return(t=>new v("string"==typeof t?t:t+"",void 0,p))(e)})(t):t,{is:y,defineProperty:b,getOwnPropertyDescriptor:E,getOwnPropertyNames:S,getOwnPropertySymbols:A,getPrototypeOf:P}=Object,k=globalThis,$=k.trustedTypes,_=$?$.emptyScript:"",I=k.reactiveElementPolyfillSupport,C=(t,e)=>t,M={toAttribute(t,e){switch(e){case Boolean:t=t?_:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},D=(t,e)=>!y(t,e),T={attribute:!0,type:String,converter:M,reflect:!1,useDefault:!1,hasChanged:D};
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
19
19
|
* Copyright 2017 Google LLC
|
|
20
20
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
21
|
-
*/Symbol.metadata??=Symbol("metadata"),k.litPropertyMetadata??=new WeakMap;class
|
|
21
|
+
*/Symbol.metadata??=Symbol("metadata"),k.litPropertyMetadata??=new WeakMap;class N extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=T){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){const i=Symbol(),s=this.getPropertyDescriptor(t,i,e);void 0!==s&&b(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){const{get:s,set:r}=E(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const n=s?.call(this);r?.call(this,e),this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??T}static _$Ei(){if(this.hasOwnProperty(C("elementProperties")))return;const t=P(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(C("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(C("properties"))){const t=this.properties,e=[...S(t),...A(t)];for(const i of e)this.createProperty(i,t[i])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,i]of e)this.elementProperties.set(t,i)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const i=this._$Eu(t,e);void 0!==i&&this._$Eh.set(i,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(w(t))}else void 0!==t&&e.push(w(t));return e}static _$Eu(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return g(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){const i=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,i);if(void 0!==s&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:M).toAttribute(e,i.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const i=this.constructor,s=i._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=i.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:M;this._$Em=s;const n=r.fromAttribute(e,t.type);this[s]=n??this._$Ej?.get(s)??n,this._$Em=null}}requestUpdate(t,e,i){if(void 0!==t){const s=this.constructor,r=this[t];if(i??=s.getPropertyOptions(t),!((i.hasChanged??D)(r,e)||i.useDefault&&i.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,i))))return;this.C(t,e,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:s,wrapped:r},n){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),!0!==r||void 0!==n)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,i]of t){const{wrapped:t}=i,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,i,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(t=>this._$ET(t,this[t])),this._$EM()}updated(t){}firstUpdated(t){}}N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[C("elementProperties")]=new Map,N[C("finalized")]=new Map,I?.({ReactiveElement:N}),(k.reactiveElementVersions??=[]).push("2.1.1");
|
|
22
22
|
/**
|
|
23
23
|
* @license
|
|
24
24
|
* Copyright 2017 Google LLC
|
|
@@ -29,7 +29,7 @@ const U={attribute:!0,type:String,converter:M,reflect:!1,hasChanged:D},O=(t=U,e,
|
|
|
29
29
|
* @license
|
|
30
30
|
* Copyright 2017 Google LLC
|
|
31
31
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
-
*/function R(t,...e){return"object"==typeof t&&null!==t&&e.every(e=>e in t)}var F,L,W,j,K,B,
|
|
32
|
+
*/function R(t,...e){return"object"==typeof t&&null!==t&&e.every(e=>e in t)}var F,L,W,j,K,H,B,z,q,Z,G,J,Q;class V{constructor(){F.set(this,new Array),L.set(this,null),W.set(this,void 0)}get items(){return n(this,F,"f")}get activeItem(){return n(this,L,"f")}setItems(t){const e=this.items.filter(e=>!t.includes(e)),i=t.filter(t=>!this.items.includes(t));return o(this,F,t,"f"),this.activeItem&&!this.items.includes(this.activeItem)&&this.updateActiveItem(null),{added:i,removed:e}}setActiveItem(t){this.activeItem!==t&&(this.updateActiveItem(t),n(this,W,"f")?.call(this))}updateActiveItem(t){o(this,L,t??null,"f")}onActiveItemChange(t){return o(this,W,t,"f"),this}}F=new WeakMap,L=new WeakMap,W=new WeakMap;const X=Symbol("typeaheadLabel");function Y(t){return R(t,X)}class tt{constructor(t){j.add(this),K.set(this,void 0),H.set(this,-1),B.set(this,void 0),z.set(this,void 0),q.set(this,new Array),Z.set(this,-1),G.set(this,[]),o(this,K,t.debounceInterval??200,"f"),o(this,B,t.callback,"f"),o(this,z,t.skipPredicate,"f")}get isTyping(){return n(this,q,"f").length>0}setItems(t){o(this,G,t,"f")}setSelectedIndex(t){o(this,Z,t,"f")}reset(){n(this,q,"f").length=0}onKeyDown(t){if(t.key&&1===t.key.length)n(this,j,"m",J).call(this,t.key);else{const e=c(t);(e>=h.A&&e<=h.Z||e>=h.Zero&&e<=h.Nine)&&n(this,j,"m",J).call(this,String.fromCharCode(e))}}}
|
|
33
33
|
/**
|
|
34
34
|
* Adapted from Angular Material CDK KeyManager
|
|
35
35
|
* Source: https://github.com/angular/components/blob/main/src/cdk/a11y/key-manager/list-key-manager.ts
|
|
@@ -38,7 +38,7 @@ const U={attribute:!0,type:String,converter:M,reflect:!1,hasChanged:D},O=(t=U,e,
|
|
|
38
38
|
* Copyright (c) 2025 Google LLC
|
|
39
39
|
* See LICENSE file in the project root for full license text.
|
|
40
40
|
*/
|
|
41
|
-
var et,it,st,rt,nt,ot,at,ht,ct,lt,dt,ut,ft,pt,mt,vt;K=new WeakMap,
|
|
41
|
+
var et,it,st,rt,nt,ot,at,ht,ct,lt,dt,ut,ft,pt,mt,vt;K=new WeakMap,H=new WeakMap,B=new WeakMap,z=new WeakMap,q=new WeakMap,Z=new WeakMap,G=new WeakMap,j=new WeakSet,J=function(t){n(this,q,"f").push(t.toLocaleUpperCase()),clearTimeout(n(this,H,"f")),o(this,H,setTimeout(()=>n(this,j,"m",Q).call(this),n(this,K,"f")),"f")},Q=function(){const t=n(this,q,"f").join("");for(let e=1;e<n(this,G,"f").length+1;e++){const i=(n(this,Z,"f")+e)%n(this,G,"f").length,s=n(this,G,"f")[i],r=s[X]?.().toLocaleUpperCase().trim();if(!n(this,z,"f")?.call(this,s)&&0===r?.indexOf(t)){n(this,B,"f").call(this,s);break}}this.reset()};class gt extends V{constructor(){super(...arguments),et.add(this),it.set(this,void 0),this.wrap=!1,this.homeAndEnd=!1,this.pageUpAndDown=!1,this.pageDelta=10,this.vertical=!1,this.allowedModifiers=[],this.skipPredicate=t=>R(t,"disabled")&&t.disabled,this.directionality="ltr"}setItems(t){return n(this,it,"f")?.setItems(t),super.setItems(t)}updateActiveItem(t){super.updateActiveItem(t),n(this,it,"f")&&n(this,it,"f").setSelectedIndex(t?this.items.indexOf(t):-1)}withHomeAndEnd(t=!0){return this.homeAndEnd=t,this}withPageUpAndDown(t=!0,e=10){return this.pageUpAndDown=t,this.pageDelta=e,this}withWrap(t=!0){return this.wrap=t,this}withVerticalOrientation(t=!0){return this.vertical=t,this}withAllowedModifiers(...t){return this.allowedModifiers=t,this}withTypeahead(t=!0){return o(this,it,t?new tt({callback:t=>this.setActiveItem(t)}):void 0,"f"),this}withSkipPredicate(t){return this.skipPredicate=t,this}withDirectionality(t){return this.directionality=t,this}onKeyDown(t){if(t.defaultPrevented)return;const e=d(t,...this.allowedModifiers);switch(t.key){case"Left":case"ArrowLeft":if(e&&!this.vertical){t.preventDefault();const e="ltr"===this.directionality?n(this,et,"m",ot).call(this):n(this,et,"m",nt).call(this);e&&this.setActiveItem(e)}break;case"Up":case"ArrowUp":if(e){t.preventDefault();const e="ltr"===this.directionality?n(this,et,"m",ot).call(this):n(this,et,"m",nt).call(this);e&&this.setActiveItem(e)}break;case"Right":case"ArrowRight":if(e&&!this.vertical){t.preventDefault();const e="ltr"===this.directionality?n(this,et,"m",nt).call(this):n(this,et,"m",ot).call(this);e&&this.setActiveItem(e)}break;case"Down":case"ArrowDown":if(e){t.preventDefault();const e="ltr"===this.directionality?n(this,et,"m",nt).call(this):n(this,et,"m",ot).call(this);e&&this.setActiveItem(e)}break;case"Home":if(e&&this.homeAndEnd){t.preventDefault();const e=n(this,et,"m",st).call(this);e&&this.setActiveItem(e)}break;case"End":if(e&&this.homeAndEnd){t.preventDefault();const e=n(this,et,"m",rt).call(this);e&&this.setActiveItem(e)}break;case"PageUp":if(e&&this.pageUpAndDown){t.preventDefault();const e=("ltr"===this.directionality?n(this,et,"m",at):n(this,et,"m",ht))(this.activeItem?Math.max(0,this.items.indexOf(this.activeItem)-this.pageDelta):0);e&&this.setActiveItem(e)}break;case"PageDown":if(e&&this.pageUpAndDown){t.preventDefault();const e=("ltr"===this.directionality?n(this,et,"m",ht):n(this,et,"m",at))(this.activeItem?Math.min(this.items.length-1,this.items.indexOf(this.activeItem)+this.pageDelta):this.items.length-1);e&&this.setActiveItem(e)}break;default:(e||l(t,"shift"))&&n(this,it,"f")?.onKeyDown(t)}}}it=new WeakMap,et=new WeakSet,st=function(){for(let t=0;t<this.items.length&&this.items[t]!==this.activeItem;t++){const e=this.items[t];if(!this.skipPredicate(e))return e}return null},rt=function(){for(let t=this.items.length-1;t>=0&&this.items[t]!==this.activeItem;t--){const e=this.items[t];if(!this.skipPredicate(e))return e}return null},nt=function(){for(let t=0;t<this.items.length;t++)if(this.items[t]===this.activeItem){for(let e=t+1;e<this.items.length;e++){const t=this.items[e];if(!this.skipPredicate(t))return t}break}return this.wrap?n(this,et,"m",st).call(this):null},ot=function(){for(let t=0;t<this.items.length;t++)if(this.items[t]===this.activeItem){for(let e=t-1;e>=0;e--){const t=this.items[e];if(!this.skipPredicate(t))return t}break}return this.wrap?n(this,et,"m",rt).call(this):null},at=function(t){for(let e=t;e>=0;e--){const t=this.items[e];if(!this.skipPredicate(t))return t}return null},ht=function(t){for(let e=t;e<this.items.length;e++){const t=this.items[e];if(!this.skipPredicate(t))return t}return null};class wt extends gt{constructor(){super(...arguments),ct.set(this,void 0)}setActiveItem(t){super.setActiveItem(t),t?.focus(n(this,ct,"f"))}withOptions(t){return o(this,ct,t,"f"),this}}function yt(t){return R(t,"checked")}function bt(t){return yt(t)&&t.checked||R(t,"selected")&&t.selected}function Et(t,e){yt(t)?t.checked=e:t.selected=e}ct=new WeakMap;class St extends wt{constructor(){super(...arguments),lt.set(this,!1)}updateActiveItem(t){if(super.updateActiveItem(t),!n(this,lt,"f")){t?.setAttribute("tabindex","0");for(const e of this.items)e!==t&&e.hasAttribute("tabindex")&&e.setAttribute("tabindex","-1")}}setItems(t){const e=super.setItems(t);if(!n(this,lt,"f"))for(const t of e.added)t===this.activeItem||this.skipPredicate(t)||t.setAttribute("tabindex","-1");return e}disableRovingTabIndex(t=!0){if(t!==n(this,lt,"f")){o(this,lt,t,"f");for(const t of this.items)this.skipPredicate(t)||t?.setAttribute("tabindex",n(this,lt,"f")||t===this.activeItem?"0":"-1")}return this}}lt=new WeakMap;class At extends St{constructor(){super(...arguments),dt.set(this,!1)}get disabled(){return n(this,dt,"f")}set disabled(t){o(this,dt,t,"f"),this.items.forEach(e=>e.disabled=t)}setItems(t){this.disabled&&t.forEach(t=>t.disabled=!0);const{added:e,removed:i}=super.setItems(t);if((e.length>0||i.length>0)&&(this.activeItem||this.updateActiveItem(e.find(t=>!this.skipPredicate(t))??null),this.activeItem&&(this.activeItem.disabled||!bt(this.activeItem)))){const t=e.find(t=>!this.skipPredicate(t)&&bt(t));t&&this.updateActiveItem(t)}return{added:e,removed:i}}}dt=new WeakMap;const Pt=Symbol("selectionManager");class kt extends At{constructor(){super(...arguments),ut.add(this),ft.set(this,void 0),pt.set(this,new Array),mt.set(this,!1)}get multi(){return n(this,mt,"f")}set multi(t){o(this,mt,t,"f"),n(this,ut,"m",vt).call(this,!0)}get selectedItems(){return n(this,pt,"f")}notifySelectionChange(t){this.items.includes(t)&&(bt(t)?this.select(t):this.deselect(t))}deselect(t){if(this.items.includes(t)){bt(t)&&Et(t,!1);const e=n(this,pt,"f").indexOf(t);e>=0&&(n(this,pt,"f").splice(e,1),n(this,ft,"f")?.call(this))}}select(t,e=!0){if(!t||this.items.includes(t)){if(!this.multi){for(const e of n(this,pt,"f"))e!==t&&Et(e,!1);n(this,pt,"f").length=0}t&&(n(this,pt,"f").push(t),bt(t)||Et(t,!0)),e&&this.updateActiveItem(t),n(this,ft,"f")?.call(this)}}setItems(t){const{added:e,removed:i}=super.setItems(t);return o(this,pt,n(this,pt,"f").filter(t=>!i.includes(t)),"f"),n(this,pt,"f").push(...e.filter(t=>bt(t))),n(this,ut,"m",vt).call(this),n(this,ft,"f")?.call(this),{added:e,removed:i}}onSelectedItemsChange(t){return o(this,ft,t,"f"),this}}
|
|
42
42
|
/**
|
|
43
43
|
* Adapted from Angular Material CDK AriaDescriber
|
|
44
44
|
* Source: https://github.com/angular/components/blob/main/src/cdk/a11y/aria-describer/aria-reference.ts
|
|
@@ -55,7 +55,7 @@ function $t(t,e){return t.getAttribute(e)?.match(/\S+/g)??[]}function _t(t,e,i){
|
|
|
55
55
|
* @license MIT
|
|
56
56
|
* Copyright (c) 2025 Google LLC
|
|
57
57
|
* See LICENSE file in the project root for full license text.
|
|
58
|
-
*/var Mt,Dt,Nt,
|
|
58
|
+
*/var Mt,Dt,Tt,Nt,Ut,Ot,xt,Rt,Ft,Lt,Wt,jt,Kt;ft=new WeakMap,pt=new WeakMap,mt=new WeakMap,ut=new WeakSet,vt=function(t=!1){if(!this.multi&&n(this,pt,"f").length>1){for(let t=1;t<n(this,pt,"f").length;t++)Et(n(this,pt,"f")[t],!1);n(this,pt,"f").length=1,t&&n(this,ft,"f")?.call(this)}};class Ht{static describe(e,i,s="tooltip"){if(t)return;const r=e.getRootNode();if(!(r instanceof ShadowRoot||r instanceof Document))return;let o=n(this,Mt,"f",Tt).get(r);o||(o={containerElement:n(this,Mt,"m",Nt).call(this),messageRegistry:new Map},(r instanceof Document?r.body:r).appendChild(o.containerElement),n(this,Mt,"f",Tt).set(r,o));const a=`${s}:${i}`;let h=o.messageRegistry.get(a);h||(h={messageElement:n(this,Mt,"m",Ut).call(this,i,s),count:0},o.containerElement.appendChild(h.messageElement),o.messageRegistry.set(a,h)),h.count++,_t(e,"aria-describedby",h.messageElement.id)}static removeDescription(e,i,s="tooltip"){if(t)return;const r=e.getRootNode(),o=n(this,Mt,"f",Tt).get(r);if(!o)return;const a=`${s}:${i}`,h=o.messageRegistry.get(a);h&&(h.count--,It(e,"aria-describedby",h.messageElement.id),h.count<=0&&(h.messageElement.remove(),o.messageRegistry.delete(a)),0==o.messageRegistry.size&&(o.containerElement?.remove(),n(this,Mt,"f",Tt).delete(r)))}}Mt=Ht,Nt=function(){const t=document.createElement("div");return t.classList.add("m3e-describedby-message-container"),Ct(t.style),t},Ut=function(t,e){var i,s;const r=document.createElement("span");return r.id=`m3e-describedby-message-${o(this,Mt,(s=n(this,Mt,"f",Dt),i=s++,s),"f",Dt),i}`,r.role=e,r.ariaAtomic="true",r.innerText=t.trim(),r},Dt={value:0},Tt={value:new Map},globalThis.M3eAriaDescriber=Ht;class Bt{static isFocusable(t,e){return t.matches(":is(button,input,select,textarea,object,:is(a,area)[href],[tabindex],[contenteditable=true]):not(:disabled,[disabled])")?!n(this,Ot,"m",xt).call(this,e):!(!t.localName.includes("-")||!t.matches(":not(:disabled,[disabled])")||"true"===t.getAttribute("aria-disabled"))&&(!!t.shadowRoot?.delegatesFocus&&!n(this,Ot,"m",xt).call(this,e))}static findInteractiveElements(t){const e=new Array,i=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT);for(let t=i.nextNode();t;t=i.nextNode()){const t=i.currentNode;this.isFocusable(t)&&e.push(t)}return e}}Ot=Bt,xt=function(t){return t?.some(t=>t.matches(":is([aria-hidden='true'],:disabled,[disabled])"))??!1},globalThis.M3eInteractivityChecker=Bt;let zt=class extends(function(t,e=!0){class i extends t{constructor(){super(...arguments),this.disabled=!1}update(t){super.update(t),t.has("disabled")&&this.role&&"none"!==this.role&&"presentation"!==this.role&&(this.ariaDisabled=this.disabled?"true":null)}}return r([x({type:Boolean,reflect:e})],i.prototype,"disabled",void 0),i}(s)){constructor(){super(...arguments),Rt.add(this)}render(){const t=e`<div class="trap" .inert="${this.disabled}" tabindex="0" aria-hidden="true" @focus="${n(this,Rt,"m",Ft)}"></div>`;return e`${t}<slot></slot>${t}`}};
|
|
59
59
|
/**
|
|
60
60
|
* Adapted from Angular Material CDK Live Announcer
|
|
61
61
|
* Source: https://github.com/angular/components/blob/main/src/cdk/a11y/live-announcer/live-announcer.ts
|
|
@@ -64,11 +64,11 @@ function $t(t,e){return t.getAttribute(e)?.match(/\S+/g)??[]}function _t(t,e,i){
|
|
|
64
64
|
* Copyright (c) 2025 Google LLC
|
|
65
65
|
* See LICENSE file in the project root for full license text.
|
|
66
66
|
*/
|
|
67
|
-
var qt,Zt,Gt,Jt,Qt,Vt,Xt;Rt=new WeakSet,Ft=function(t){const[
|
|
67
|
+
var qt,Zt,Gt,Jt,Qt,Vt,Xt;Rt=new WeakSet,Ft=function(t){function e(t,e){return t===e||t instanceof HTMLElement&&null!==t.shadowRoot&&t.shadowRoot.contains(e)}const[i,s]=n(this,Rt,"m",Lt).call(this),r=t?.target===this._firstTrap,o=e(t.relatedTarget,i),a=e(t.relatedTarget,s),h=!o&&!a;!r&&a||r&&h?i?.focus():(r&&o||!r&&h)&&s?.focus()},Lt=function(){let t=null,e=null;return n(this,Rt,"m",Wt).call(this,this,[],(i,s)=>{Bt.isFocusable(i,s)&&i instanceof HTMLElement&&i.tabIndex>=0&&(t=t??i,e=i)}),[t,e]},Wt=function t(e,i,s){i=[...i,e];for(const r of e.childNodes){if(r.nodeType!==Node.ELEMENT_NODE)continue;const e=r;s(e,i),e.shadowRoot?n(this,Rt,"m",jt).call(this,e,i,s):e instanceof HTMLSlotElement?n(this,Rt,"m",Kt).call(this,e,i,s):e.hasChildNodes()&&n(this,Rt,"m",t).call(this,e,i,s)}},jt=function(t,e,i){for(const s of t.shadowRoot?.childNodes??[]){if(s.nodeType!==Node.ELEMENT_NODE)continue;const t=s;i(t,e),t.hasChildNodes()&&n(this,Rt,"m",Wt).call(this,t,e,i)}},Kt=function(t,e,i){for(const s of t.assignedElements())i(s,e),s.hasChildNodes()&&n(this,Rt,"m",Wt).call(this,s,e,i)},zt.styles=i`:host { display: contents; } .trap { outline: none; }`,r([
|
|
68
68
|
/**
|
|
69
69
|
* @license
|
|
70
70
|
* Copyright 2017 Google LLC
|
|
71
71
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
72
72
|
*/
|
|
73
|
-
function(t){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}(".trap")],zt.prototype,"_firstTrap",void 0),zt=r([(t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("m3e-focus-trap")],zt);class Yt{static announce(e,...i){if(t)return Promise.resolve();let s,r;o(this,qt,n(this,qt,"f",Gt)??n(this,qt,"m",Xt).call(this),"f",Gt),1===i.length&&"number"==typeof i[0]?r=i[0]:[s,r]=i,this.clear(),clearTimeout(n(this,qt,"f",Jt)),n(this,qt,"f",Gt).setAttribute("aria-live",s??"polite");for(const t of document.querySelectorAll("m3e-dialog"))_t(t,"aria-owns",n(this,qt,"f",Gt).id);return o(this,qt,n(this,qt,"f",Qt)??new Promise(t=>o(this,qt,t,"f",Vt)),"f",Qt),clearTimeout(n(this,qt,"f",Jt)),o(this,qt,setTimeout(()=>{n(this,qt,"f",Gt)&&(n(this,qt,"f",Gt).textContent=e,void 0!==r&&o(this,qt,setTimeout(()=>this.clear(),r),"f",Jt),n(this,qt,"f",Vt)?.call(this),o(this,qt,o(this,qt,void 0,"f",Vt),"f",Qt))},100),"f",Jt),n(this,qt,"f",Qt)}static clear(){n(this,qt,"f",Gt)&&(n(this,qt,"f",Gt).textContent="")}}qt=Yt,Xt=function(){var t,e;const i=document.getElementsByClassName("m3e-live-announcer");for(let t=0;t<i.length;t++)i[t].remove();const s=document.createElement("div");return s.classList.add("m3e-live-announcer"),s.setAttribute("aria-atomic","true"),s.setAttribute("aria-live","polite"),s.id=`m3e-live-announcer-${o(this,qt,(e=n(this,qt,"f",Zt),t=e++,e),"f",Zt),t}`,Ct(s.style),document.body.append(s),s},Zt={value:0},Gt={value:void 0},Jt={value:void 0},Qt={value:void 0},Vt={value:void 0},globalThis.M3eLiveAnnouncer=Yt;export{
|
|
73
|
+
function(t){return(e,i,s)=>((t,e,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof e&&Object.defineProperty(t,e,i),i))(e,i,{get(){return(e=>e.renderRoot?.querySelector(t)??null)(this)}})}(".trap")],zt.prototype,"_firstTrap",void 0),zt=r([(t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}):customElements.define(t,e)})("m3e-focus-trap")],zt);class Yt{static announce(e,...i){if(t)return Promise.resolve();let s,r;o(this,qt,n(this,qt,"f",Gt)??n(this,qt,"m",Xt).call(this),"f",Gt),1===i.length&&"number"==typeof i[0]?r=i[0]:[s,r]=i,this.clear(),clearTimeout(n(this,qt,"f",Jt)),n(this,qt,"f",Gt).setAttribute("aria-live",s??"polite");for(const t of document.querySelectorAll("m3e-dialog"))_t(t,"aria-owns",n(this,qt,"f",Gt).id);return o(this,qt,n(this,qt,"f",Qt)??new Promise(t=>o(this,qt,t,"f",Vt)),"f",Qt),clearTimeout(n(this,qt,"f",Jt)),o(this,qt,setTimeout(()=>{n(this,qt,"f",Gt)&&(n(this,qt,"f",Gt).textContent=e,void 0!==r&&o(this,qt,setTimeout(()=>this.clear(),r),"f",Jt),n(this,qt,"f",Vt)?.call(this),o(this,qt,o(this,qt,void 0,"f",Vt),"f",Qt))},100),"f",Jt),n(this,qt,"f",Qt)}static clear(){n(this,qt,"f",Gt)&&(n(this,qt,"f",Gt).textContent="")}}qt=Yt,Xt=function(){var t,e;const i=document.getElementsByClassName("m3e-live-announcer");for(let t=0;t<i.length;t++)i[t].remove();const s=document.createElement("div");return s.classList.add("m3e-live-announcer"),s.setAttribute("aria-atomic","true"),s.setAttribute("aria-live","polite"),s.id=`m3e-live-announcer-${o(this,qt,(e=n(this,qt,"f",Zt),t=e++,e),"f",Zt),t}`,Ct(s.style),document.body.append(s),s},Zt={value:0},Gt={value:void 0},Jt={value:void 0},Qt={value:void 0},Vt={value:void 0},globalThis.M3eLiveAnnouncer=Yt;export{wt as FocusKeyManager,h as KeyCode,gt as ListKeyManager,V as ListManager,Ht as M3eAriaDescriber,zt as M3eFocusTrapElement,Bt as M3eInteractivityChecker,Yt as M3eLiveAnnouncer,a as ModifierKeys,At as RadioKeyManager,St as RovingTabIndexManager,kt as SelectionManager,tt as Typeahead,_t as addAriaReferencedId,$t as getAriaReferenceIds,c as getKeyCode,l as hasModifierKey,d as isModifierAllowed,Y as isTypeaheadItem,It as removeAriaReferencedId,Pt as selectionManager,X as typeaheadLabel};
|
|
74
74
|
//# sourceMappingURL=a11y.min.js.map
|