a11y-elements 0.7.0 → 1.0.1
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/README.md +112 -72
- package/dist/a11y.css +28 -1
- package/dist/browser/all.js +43 -43
- package/dist/browser/{chunk-XWWLU5PH.js → chunk-23IEROGQ.js} +6 -5
- package/dist/browser/chunk-23IEROGQ.js.map +1 -0
- package/dist/browser/{chunk-PTU2DM52.js → chunk-4V5TTMP4.js} +18 -9
- package/dist/browser/chunk-4V5TTMP4.js.map +1 -0
- package/dist/browser/chunk-6AIK32FI.js +115 -0
- package/dist/browser/chunk-6AIK32FI.js.map +1 -0
- package/dist/browser/{chunk-QT3RDF3H.js → chunk-6AJBXOCZ.js} +6 -5
- package/dist/browser/chunk-6AJBXOCZ.js.map +1 -0
- package/dist/browser/{chunk-K24OBXOZ.js → chunk-6JAOKGVI.js} +11 -8
- package/dist/browser/chunk-6JAOKGVI.js.map +1 -0
- package/dist/browser/{chunk-4JFOUSU7.js → chunk-6NOUML5M.js} +17 -12
- package/dist/browser/chunk-6NOUML5M.js.map +1 -0
- package/dist/browser/{chunk-VZZ6PGGW.js → chunk-7CL7TH7I.js} +3 -3
- package/dist/browser/{chunk-S3G36NHT.js → chunk-7GCUNMAO.js} +30 -6
- package/dist/browser/chunk-7GCUNMAO.js.map +1 -0
- package/dist/browser/{chunk-O6WGSOHI.js → chunk-7YZP3GGZ.js} +4 -4
- package/dist/browser/{chunk-HF2UHDNK.js → chunk-AHF64455.js} +3 -3
- package/dist/browser/{chunk-ANCRYRXA.js → chunk-CJJN2J7X.js} +17 -16
- package/dist/browser/chunk-CJJN2J7X.js.map +1 -0
- package/dist/browser/{chunk-GJIJX2MO.js → chunk-D6ES5GYW.js} +3 -3
- package/dist/browser/{chunk-BLDP54O5.js → chunk-DCFJ364K.js} +3 -3
- package/dist/browser/{chunk-XNWCI66X.js → chunk-ED3UMYMY.js} +55 -6
- package/dist/browser/chunk-ED3UMYMY.js.map +1 -0
- package/dist/browser/{chunk-X3FGPMOG.js → chunk-EMXZKQ32.js} +14 -11
- package/dist/browser/chunk-EMXZKQ32.js.map +1 -0
- package/dist/browser/{chunk-73Y3YTSE.js → chunk-F5VLI6QP.js} +15 -9
- package/dist/browser/chunk-F5VLI6QP.js.map +1 -0
- package/dist/browser/{chunk-R3ESHCSH.js → chunk-FNILKXCO.js} +55 -29
- package/dist/browser/chunk-FNILKXCO.js.map +1 -0
- package/dist/browser/{chunk-6G3UL7FH.js → chunk-GA3VPLST.js} +3 -3
- package/dist/browser/chunk-GJIRWFLA.js +147 -0
- package/dist/browser/chunk-GJIRWFLA.js.map +1 -0
- package/dist/browser/{chunk-5SFYIGMT.js → chunk-GKCQ6PNB.js} +3 -3
- package/dist/browser/{chunk-DFQ4O2RT.js → chunk-HG7FJAXE.js} +15 -8
- package/dist/browser/chunk-HG7FJAXE.js.map +1 -0
- package/dist/browser/{chunk-EOI2JDNP.js → chunk-IHMGZOLZ.js} +12 -9
- package/dist/browser/chunk-IHMGZOLZ.js.map +1 -0
- package/dist/browser/{chunk-NEQKRAIP.js → chunk-ISUDKKRI.js} +4 -3
- package/dist/browser/chunk-ISUDKKRI.js.map +1 -0
- package/dist/browser/{chunk-IP2X2FJW.js → chunk-JFZTJO7H.js} +10 -7
- package/dist/browser/chunk-JFZTJO7H.js.map +1 -0
- package/dist/browser/{chunk-CKFVCVMO.js → chunk-JTFESZPQ.js} +16 -14
- package/dist/browser/chunk-JTFESZPQ.js.map +1 -0
- package/dist/browser/{chunk-PWR4UC47.js → chunk-KVUJT6BC.js} +59 -22
- package/dist/browser/chunk-KVUJT6BC.js.map +1 -0
- package/dist/browser/{chunk-H23YF56K.js → chunk-LIZBBXUV.js} +4 -4
- package/dist/browser/{chunk-K4P65IHJ.js → chunk-LVKKZ4XP.js} +27 -26
- package/dist/browser/chunk-LVKKZ4XP.js.map +1 -0
- package/dist/browser/{chunk-GEGVADVM.js → chunk-MIBUA46B.js} +11 -6
- package/dist/browser/chunk-MIBUA46B.js.map +1 -0
- package/dist/browser/{chunk-2E2MNSPU.js → chunk-MKDICSZ3.js} +6 -6
- package/dist/browser/{chunk-F47DDMFE.js → chunk-MNWKDM3I.js} +22 -2
- package/dist/browser/chunk-MNWKDM3I.js.map +1 -0
- package/dist/browser/{chunk-F4AVN6JZ.js → chunk-NBWKCBIZ.js} +2 -2
- package/dist/browser/{chunk-6AYXOLXI.js → chunk-NJSZSBR5.js} +7 -6
- package/dist/browser/chunk-NJSZSBR5.js.map +1 -0
- package/dist/browser/{chunk-JZJW3GXR.js → chunk-NLRXEMHB.js} +32 -19
- package/dist/browser/chunk-NLRXEMHB.js.map +1 -0
- package/dist/browser/{chunk-IAXHGJ62.js → chunk-NT7DOWM7.js} +3 -3
- package/dist/browser/{chunk-DO53LTZ7.js → chunk-O235WSRL.js} +40 -12
- package/dist/browser/chunk-O235WSRL.js.map +1 -0
- package/dist/browser/{chunk-3IYYFR25.js → chunk-ORDVOV7E.js} +11 -6
- package/dist/browser/chunk-ORDVOV7E.js.map +1 -0
- package/dist/browser/{chunk-GFNWEW7C.js → chunk-P42G35OU.js} +11 -7
- package/dist/browser/chunk-P42G35OU.js.map +1 -0
- package/dist/browser/{chunk-4KU26VOY.js → chunk-Q4TMA3P7.js} +6 -2
- package/dist/browser/chunk-Q4TMA3P7.js.map +1 -0
- package/dist/browser/{chunk-7NNZKO4M.js → chunk-SRWD5UK6.js} +2 -2
- package/dist/browser/{chunk-VAMC6L65.js → chunk-TPVVWXTY.js} +12 -7
- package/dist/browser/chunk-TPVVWXTY.js.map +1 -0
- package/dist/browser/{chunk-P22R5WMV.js → chunk-UFLTXMN2.js} +7 -6
- package/dist/browser/chunk-UFLTXMN2.js.map +1 -0
- package/dist/browser/{chunk-ACNPSWNA.js → chunk-WDPW7UKG.js} +6 -5
- package/dist/browser/chunk-WDPW7UKG.js.map +1 -0
- package/dist/browser/components/anchor/define.js +3 -3
- package/dist/browser/components/avatar/define.js +3 -3
- package/dist/browser/components/card-link/define.js +4 -4
- package/dist/browser/components/checkbox/define.js +3 -3
- package/dist/browser/components/checkbox-group/define.js +3 -3
- package/dist/browser/components/file-input/define.js +5 -5
- package/dist/browser/components/focusable/define.js +2 -2
- package/dist/browser/components/input/define.js +5 -5
- package/dist/browser/components/label/define.js +3 -3
- package/dist/browser/components/picture/define.js +3 -3
- package/dist/browser/components/progress/define.js +4 -4
- package/dist/browser/components/radio-group/define.js +3 -3
- package/dist/browser/components/select/define.js +3 -3
- package/dist/browser/components/skeleton/define.js +3 -3
- package/dist/browser/components/spinner/define.js +3 -3
- package/dist/browser/components/switch/define.js +3 -3
- package/dist/browser/components/tabs/define.js +4 -4
- package/dist/browser/components/textarea/define.js +5 -5
- package/dist/browser/components/visually-hidden/define.js +2 -2
- package/dist/browser/overlays/blocking-loader/define.js +7 -7
- package/dist/browser/overlays/context-menu/define.js +8 -8
- package/dist/browser/overlays/drawer/define.js +8 -8
- package/dist/browser/overlays/dropdown/define.js +9 -9
- package/dist/browser/overlays/emergency-dialog/define.js +8 -8
- package/dist/browser/overlays/floating/define.js +6 -6
- package/dist/browser/overlays/modal/define.js +9 -9
- package/dist/browser/overlays/notification-banner/define.js +5 -5
- package/dist/browser/overlays/popover/define.js +8 -8
- package/dist/browser/overlays/snackbar/define.js +5 -5
- package/dist/browser/overlays/tooltip/define.js +8 -8
- package/dist/components/anchor/anchor.element.d.ts +2 -0
- package/dist/components/anchor/anchor.element.js +12 -6
- package/dist/components/anchor/anchor.element.js.map +1 -1
- package/dist/components/card-link/card-link.element.js +2 -1
- package/dist/components/card-link/card-link.element.js.map +1 -1
- package/dist/components/checkbox/checkbox.element.d.ts +2 -0
- package/dist/components/checkbox/checkbox.element.js +11 -3
- package/dist/components/checkbox/checkbox.element.js.map +1 -1
- package/dist/components/checkbox-group/checkbox-group.element.js +17 -9
- package/dist/components/checkbox-group/checkbox-group.element.js.map +1 -1
- package/dist/components/file-input/file-input.element.js +13 -12
- package/dist/components/file-input/file-input.element.js.map +1 -1
- package/dist/components/focusable/focusable.element.js +5 -1
- package/dist/components/focusable/focusable.element.js.map +1 -1
- package/dist/components/label/label.element.js +2 -1
- package/dist/components/label/label.element.js.map +1 -1
- package/dist/components/picture/picture.element.js +12 -5
- package/dist/components/picture/picture.element.js.map +1 -1
- package/dist/components/progress/progress.element.d.ts +2 -0
- package/dist/components/progress/progress.element.js +8 -2
- package/dist/components/progress/progress.element.js.map +1 -1
- package/dist/components/radio-group/radio-group.element.js +9 -3
- package/dist/components/radio-group/radio-group.element.js.map +1 -1
- package/dist/components/select/select.element.js +3 -2
- package/dist/components/select/select.element.js.map +1 -1
- package/dist/components/switch/switch.element.js +3 -2
- package/dist/components/switch/switch.element.js.map +1 -1
- package/dist/components/tabs/tabs.element.d.ts +2 -0
- package/dist/components/tabs/tabs.element.js +13 -3
- package/dist/components/tabs/tabs.element.js.map +1 -1
- package/dist/core/a11y-element.d.ts +1 -0
- package/dist/core/a11y-element.js +5 -3
- package/dist/core/a11y-element.js.map +1 -1
- package/dist/core/a11y-field-element.js +3 -1
- package/dist/core/a11y-field-element.js.map +1 -1
- package/dist/core/a11y-overlay-element.js +10 -6
- package/dist/core/a11y-overlay-element.js.map +1 -1
- package/dist/core/builtin.d.ts +9 -0
- package/dist/core/builtin.js +17 -0
- package/dist/core/builtin.js.map +1 -0
- package/dist/core/dom.js +6 -4
- package/dist/core/dom.js.map +1 -1
- package/dist/core/field.js +5 -4
- package/dist/core/field.js.map +1 -1
- package/dist/core/focus-trap.d.ts +13 -1
- package/dist/core/focus-trap.js +71 -33
- package/dist/core/focus-trap.js.map +1 -1
- package/dist/core/ids.js +2 -1
- package/dist/core/ids.js.map +1 -1
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/overlay-registry.d.ts +25 -3
- package/dist/core/overlay-registry.js +105 -22
- package/dist/core/overlay-registry.js.map +1 -1
- package/dist/core/safe-dom.d.ts +20 -0
- package/dist/core/safe-dom.js +55 -0
- package/dist/core/safe-dom.js.map +1 -0
- package/dist/core/sanitize.d.ts +1 -7
- package/dist/core/sanitize.js +81 -16
- package/dist/core/sanitize.js.map +1 -1
- package/dist/core/strings.js +3 -2
- package/dist/core/strings.js.map +1 -1
- package/dist/core/template.d.ts +3 -1
- package/dist/core/template.js +5 -3
- package/dist/core/template.js.map +1 -1
- package/dist/core/transition.d.ts +8 -2
- package/dist/core/transition.js +34 -4
- package/dist/core/transition.js.map +1 -1
- package/dist/overlays/context-menu/context-menu.element.js +2 -1
- package/dist/overlays/context-menu/context-menu.element.js.map +1 -1
- package/dist/overlays/core/a11y-anchored-overlay-element.js +33 -15
- package/dist/overlays/core/a11y-anchored-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-menu-overlay-element.d.ts +9 -0
- package/dist/overlays/core/a11y-menu-overlay-element.js +40 -9
- package/dist/overlays/core/a11y-menu-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-modal-overlay-element.js +10 -7
- package/dist/overlays/core/a11y-modal-overlay-element.js.map +1 -1
- package/dist/overlays/core/a11y-passive-overlay-element.d.ts +18 -1
- package/dist/overlays/core/a11y-passive-overlay-element.js +39 -2
- package/dist/overlays/core/a11y-passive-overlay-element.js.map +1 -1
- package/dist/overlays/dropdown/dropdown.element.d.ts +1 -0
- package/dist/overlays/dropdown/dropdown.element.js +9 -2
- package/dist/overlays/dropdown/dropdown.element.js.map +1 -1
- package/dist/overlays/floating/floating.element.js +22 -21
- package/dist/overlays/floating/floating.element.js.map +1 -1
- package/dist/overlays/modal/confirm-dialog.js +7 -3
- package/dist/overlays/modal/confirm-dialog.js.map +1 -1
- package/dist/overlays/notification-banner/define.js +4 -3
- package/dist/overlays/notification-banner/define.js.map +1 -1
- package/dist/overlays/notification-banner/notification-banner.element.d.ts +4 -4
- package/dist/overlays/notification-banner/notification-banner.element.js +14 -8
- package/dist/overlays/notification-banner/notification-banner.element.js.map +1 -1
- package/dist/overlays/snackbar/define.js +4 -3
- package/dist/overlays/snackbar/define.js.map +1 -1
- package/dist/overlays/snackbar/snackbar.element.d.ts +18 -0
- package/dist/overlays/snackbar/snackbar.element.js +52 -6
- package/dist/overlays/snackbar/snackbar.element.js.map +1 -1
- package/package.json +2 -1
- package/dist/browser/chunk-23I2KVFV.js +0 -85
- package/dist/browser/chunk-23I2KVFV.js.map +0 -1
- package/dist/browser/chunk-3IYYFR25.js.map +0 -1
- package/dist/browser/chunk-4JFOUSU7.js.map +0 -1
- package/dist/browser/chunk-4KU26VOY.js.map +0 -1
- package/dist/browser/chunk-6AYXOLXI.js.map +0 -1
- package/dist/browser/chunk-73Y3YTSE.js.map +0 -1
- package/dist/browser/chunk-ACNPSWNA.js.map +0 -1
- package/dist/browser/chunk-ANCRYRXA.js.map +0 -1
- package/dist/browser/chunk-CKFVCVMO.js.map +0 -1
- package/dist/browser/chunk-DFQ4O2RT.js.map +0 -1
- package/dist/browser/chunk-DO53LTZ7.js.map +0 -1
- package/dist/browser/chunk-EOI2JDNP.js.map +0 -1
- package/dist/browser/chunk-F47DDMFE.js.map +0 -1
- package/dist/browser/chunk-GEGVADVM.js.map +0 -1
- package/dist/browser/chunk-GFNWEW7C.js.map +0 -1
- package/dist/browser/chunk-HMJBQAFR.js +0 -80
- package/dist/browser/chunk-HMJBQAFR.js.map +0 -1
- package/dist/browser/chunk-IP2X2FJW.js.map +0 -1
- package/dist/browser/chunk-JZJW3GXR.js.map +0 -1
- package/dist/browser/chunk-K24OBXOZ.js.map +0 -1
- package/dist/browser/chunk-K4P65IHJ.js.map +0 -1
- package/dist/browser/chunk-NEQKRAIP.js.map +0 -1
- package/dist/browser/chunk-P22R5WMV.js.map +0 -1
- package/dist/browser/chunk-PTU2DM52.js.map +0 -1
- package/dist/browser/chunk-PWR4UC47.js.map +0 -1
- package/dist/browser/chunk-QT3RDF3H.js.map +0 -1
- package/dist/browser/chunk-R3ESHCSH.js.map +0 -1
- package/dist/browser/chunk-S3G36NHT.js.map +0 -1
- package/dist/browser/chunk-VAMC6L65.js.map +0 -1
- package/dist/browser/chunk-X3FGPMOG.js.map +0 -1
- package/dist/browser/chunk-XNWCI66X.js.map +0 -1
- package/dist/browser/chunk-XWWLU5PH.js.map +0 -1
- /package/dist/browser/{chunk-VZZ6PGGW.js.map → chunk-7CL7TH7I.js.map} +0 -0
- /package/dist/browser/{chunk-O6WGSOHI.js.map → chunk-7YZP3GGZ.js.map} +0 -0
- /package/dist/browser/{chunk-HF2UHDNK.js.map → chunk-AHF64455.js.map} +0 -0
- /package/dist/browser/{chunk-GJIJX2MO.js.map → chunk-D6ES5GYW.js.map} +0 -0
- /package/dist/browser/{chunk-BLDP54O5.js.map → chunk-DCFJ364K.js.map} +0 -0
- /package/dist/browser/{chunk-6G3UL7FH.js.map → chunk-GA3VPLST.js.map} +0 -0
- /package/dist/browser/{chunk-5SFYIGMT.js.map → chunk-GKCQ6PNB.js.map} +0 -0
- /package/dist/browser/{chunk-H23YF56K.js.map → chunk-LIZBBXUV.js.map} +0 -0
- /package/dist/browser/{chunk-2E2MNSPU.js.map → chunk-MKDICSZ3.js.map} +0 -0
- /package/dist/browser/{chunk-F4AVN6JZ.js.map → chunk-NBWKCBIZ.js.map} +0 -0
- /package/dist/browser/{chunk-IAXHGJ62.js.map → chunk-NT7DOWM7.js.map} +0 -0
- /package/dist/browser/{chunk-7NNZKO4M.js.map → chunk-SRWD5UK6.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/define-element.ts","../../src/core/builtin.ts","../../src/core/safe-dom.ts","../../src/core/strings.ts","../../src/core/a11y-element.ts"],"sourcesContent":["/**\n * Registers `ctor` as `tag` unless that tag is already taken — by an earlier\n * import of the same entry, or by another bundle on the page that shares this\n * element (a standalone `define.js` and the all-in-one entry, say).\n */\nexport function defineElement(tag: string, ctor: CustomElementConstructor): void {\n if (!customElements.get(tag)) customElements.define(tag, ctor);\n}\n","/**\n * Internal (not re-exported): the property descriptor `target` inherits for\n * `name`, read from its prototype chain and never from the instance itself,\n * so a `[LegacyOverrideBuiltIns]` named property (an exotic own property of a\n * `<form>` or `Document`) can't shadow it. The most-derived prototype wins, as\n * in a normal property read; resolved on each call, so it follows whichever\n * DOM is current (jsdom, linkedom, happy-dom).\n */\nexport function builtIn(target: object, name: PropertyKey): PropertyDescriptor | undefined {\n for (let proto = Object.getPrototypeOf(target); proto; proto = Object.getPrototypeOf(proto)) {\n const desc = Object.getOwnPropertyDescriptor(proto, name);\n if (desc) return desc;\n }\n return undefined;\n}\n","import { builtIn } from './builtin.js';\n\n/**\n * Clobbering-proof DOM reads.\n *\n * `<form>` and `Document` are `[LegacyOverrideBuiltIns]`: a named descendant\n * shadows a built-in of the same name. `<form><input name=\"parentNode\">`\n * makes `form.parentNode` return the input, and once `<img name=\"createElement\">`\n * is in the page, `document.createElement` is that image. Markup inserted\n * with `raw()` (or a form whose field names come from data) can do this.\n *\n * `prop()`/`call()` read such a target's property through its prototype\n * chain instead; for every other node they read it normally, so stubs on an\n * instance (as in tests) keep working. `doc` is the page's `document` read\n * the same way. The lookup happens on each call, never captured once, so it\n * follows the current realm (jsdom tests, SSR shims).\n */\n\n/** `Symbol.toStringTag` lives on the prototype, so a named control can't fake it; works across realms too. */\nconst OVERRIDES_BUILTINS = /^\\[object (?:HTMLFormElement|(?:HTML|XML)?Document)\\]$/;\n\nfunction overridesBuiltIns(target: unknown): boolean {\n return OVERRIDES_BUILTINS.test(Object.prototype.toString.call(target));\n}\n\n/** `target[name]`, never a named descendant shadowing it. */\nexport function prop<T extends object, K extends keyof T>(target: T, name: K): T[K] {\n if (!overridesBuiltIns(target)) return target[name];\n const desc = builtIn(target, name);\n return (desc?.get ? desc.get.call(target) : desc?.value) as T[K];\n}\n\ntype Method<T, K extends keyof T> = T[K] extends (...args: infer A) => infer R ? (...args: A) => R : never;\n\n/** `target[name](...args)`, never a named descendant shadowing the method. */\nexport function call<T extends object, K extends keyof T>(\n target: T,\n name: K,\n ...args: Parameters<Method<T, K>>\n): ReturnType<Method<T, K>> {\n return (prop(target, name) as (...a: unknown[]) => ReturnType<Method<T, K>>).apply(target, args);\n}\n\n/** The page's `document`, every member read through `Document`'s prototype. */\nexport const doc = {\n get body(): HTMLElement {\n return prop(document, 'body');\n },\n get activeElement(): Element | null {\n return prop(document, 'activeElement');\n },\n get documentElement(): HTMLElement {\n return prop(document, 'documentElement');\n },\n get readyState(): DocumentReadyState {\n return prop(document, 'readyState');\n },\n createElement: ((tag: string, options?: ElementCreationOptions) =>\n call(document, 'createElement', tag, options)) as Document['createElement'],\n createComment: (data: string): Comment => call(document, 'createComment', data),\n getElementById: (id: string): HTMLElement | null => call(document, 'getElementById', id),\n querySelector: ((selectors: string) => call(document, 'querySelector', selectors)) as Document['querySelector'],\n addEventListener: ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) =>\n call(document, 'addEventListener', type, listener, options)) as Document['addEventListener'],\n removeEventListener: ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) =>\n call(document, 'removeEventListener', type, listener, options)) as Document['removeEventListener'],\n dispatchEvent: (event: Event): boolean => call(document, 'dispatchEvent', event),\n};\n","import { doc } from './safe-dom.js';\n\n/**\n * The library's built-in, user-facing strings — text that ends up in\n * accessible names and announcements — so a consumer can translate them.\n *\n * Precedence, per element: an instance attribute (e.g. `close-label`) wins,\n * then whatever `setStrings()` set, then these English defaults.\n */\nexport interface A11yStrings {\n /** Appended to a new-tab link's accessible name by `<a11y-anchor>`. */\n opensInNewTab: string;\n /** `<a11y-anchor>`'s same-page jump announcement; `{name}` is the target's name. */\n navigatedTo: string;\n /** The close button of `<a11y-modal>`, `<a11y-drawer>` and `<a11y-emergency-dialog>`. */\n closeDialog: string;\n /** Default confirm button of `confirmDialog()`. */\n confirm: string;\n /** Default cancel button of `confirmDialog()`. */\n cancel: string;\n /** The close button of each `<a11y-notification-banner>` item. */\n dismiss: string;\n /** Default label of `<a11y-spinner>` and `<a11y-blocking-loader>`. */\n loading: string;\n /** Default accessible name of `<a11y-progress>`. */\n progress: string;\n /** Last-resort accessible name of `<a11y-avatar>`. */\n avatar: string;\n /** Visible text of an `<a11y-counter>`; `{count}` is the current length, `{max}` the `maxlength`. */\n characterCount: string;\n /** What an `<a11y-counter>` announces near the limit; `{count}` is the number of characters left. */\n charactersRemaining: string;\n /** `charactersRemaining` when exactly one character is left. */\n characterRemaining: string;\n /** The generated \"Select all\" checkbox of `<a11y-checkbox-group select-all>`. */\n selectAll: string;\n /** The browse button of `<a11y-file-input>`. */\n browseFiles: string;\n /** The drag & drop prompt next to `<a11y-file-input>`'s browse button. */\n dropFiles: string;\n /** Accessible name of `<a11y-file-input>`'s list of selected files. */\n selectedFiles: string;\n /** Visible text of each remove button of `<a11y-file-input>`. */\n remove: string;\n /** Accessible name of each remove button of `<a11y-file-input>`; `{name}` is the file name. */\n removeFile: string;\n /** Announced when `<a11y-file-input>` adds one file; `{name}` is its name. */\n fileAdded: string;\n /** Announced when `<a11y-file-input>` adds several files; `{count}` is how many. */\n filesAdded: string;\n /** Announced when `<a11y-file-input>` removes a file; `{name}` is its name. */\n fileRemoved: string;\n /** Shown and announced for a file `accept` rules out; `{name}` is its name. */\n fileTypeRejected: string;\n /** Shown and announced for a file over `max-size`; `{name}`, `{maxSize}`. */\n fileSizeRejected: string;\n /** Shown and announced for a file past `max-files`; `{name}`, `{max}`. */\n fileCountRejected: string;\n}\n\nexport const DEFAULT_STRINGS: Readonly<A11yStrings> = Object.freeze({\n opensInNewTab: '(opens in new tab)',\n navigatedTo: 'Navigated to {name}',\n closeDialog: 'Close dialog',\n confirm: 'OK',\n cancel: 'Cancel',\n dismiss: 'Dismiss',\n loading: 'Loading',\n progress: 'Progress',\n avatar: 'Avatar',\n characterCount: '{count} / {max}',\n charactersRemaining: '{count} characters remaining',\n characterRemaining: '{count} character remaining',\n selectAll: 'Select all',\n browseFiles: 'Browse files',\n dropFiles: 'or drop files here',\n selectedFiles: 'Selected files',\n remove: 'Remove',\n removeFile: 'Remove {name}',\n fileAdded: '{name} added',\n filesAdded: '{count} files added',\n fileRemoved: '{name} removed',\n fileTypeRejected: '{name} wasn’t added: this type of file isn’t allowed',\n fileSizeRejected: '{name} wasn’t added: it’s larger than {maxSize}',\n fileCountRejected: '{name} wasn’t added: too many files (maximum {max})',\n});\n\n/** Dispatched on `document` whenever `setStrings()`/`resetStrings()` runs, so mounted elements can relabel themselves. */\nexport const STRINGS_CHANGE_EVENT = 'a11y-strings-change';\n\n/**\n * Page-wide, on `globalThis` for the same reason as the overlay registry:\n * each standalone `dist/browser/**\\/define.js` bundle inlines its own copy of\n * this module, and `setStrings()` called through one bundle must reach the\n * elements every other bundle defined.\n */\nconst STRINGS_KEY = Symbol.for('a11y-elements/strings');\nconst store = globalThis as unknown as Record<symbol, A11yStrings | undefined>;\nconst strings: A11yStrings = (store[STRINGS_KEY] ??= { ...DEFAULT_STRINGS });\n// A store created by an older bundle on the same page predates newer keys.\nfor (const [key, value] of Object.entries(DEFAULT_STRINGS) as [keyof A11yStrings, string][]) strings[key] ??= value;\n\n/** Overrides some or all built-in strings, page-wide. Elements already on the page update right away. */\nexport function setStrings(partial: Partial<A11yStrings>): void {\n for (const [key, value] of Object.entries(partial) as [keyof A11yStrings, string | undefined][]) {\n if (Object.hasOwn(DEFAULT_STRINGS, key) && typeof value === 'string') strings[key] = value;\n }\n doc.dispatchEvent(new Event(STRINGS_CHANGE_EVENT));\n}\n\n/** Restores every built-in string to its English default. */\nexport function resetStrings(): void {\n Object.assign(strings, DEFAULT_STRINGS);\n doc.dispatchEvent(new Event(STRINGS_CHANGE_EVENT));\n}\n\nexport function getString(key: keyof A11yStrings): string {\n return strings[key];\n}\n\n/** Replaces each `{key}` placeholder with `values[key]`; placeholders without a value (own keys only, so `{constructor}` stays as is) are left as is. */\nexport function formatString(template: string, values: Record<string, string>): string {\n return template.replace(/\\{(\\w+)\\}/g, (match, key: string) => (Object.hasOwn(values, key) ? values[key]! : match));\n}\n","import { STRINGS_CHANGE_EVENT } from './strings.js';\nimport { doc } from './safe-dom.js';\n\ntype Listener = [target: EventTarget, type: string, handler: EventListener, options?: AddEventListenerOptions | boolean];\n\n/**\n * Base class for every element in this library. Light DOM only — elements\n * render real child markup styled by the consumer's own CSS, not a shadow\n * root.\n *\n * Lifecycle mirrors the old `onBeforeRender -> render template ->\n * onAfterRender` pipeline this library used to run through a proprietary\n * framework, just mapped onto native custom-element callbacks:\n *\n * connectedCallback -> first update()\n * attributeChangedCallback -> update() for any observed attribute change\n * disconnectedCallback -> remove all tracked listeners, then onDisconnect()\n * setStrings() -> onStringsChange(), for subclasses that define it\n *\n * Subclasses list attributes to watch via `static observedAttributes` and\n * implement `render()` to return the element's children as nodes (or `null`\n * to keep the consumer's own children as they are). Attribute/\n * property setters that need to reflect into the DOM should just mutate the\n * attribute — `attributeChangedCallback` re-renders synchronously while\n * connected, so state and DOM never drift out of sync across a render.\n */\nexport abstract class A11yElement extends HTMLElement {\n protected _connected = false;\n private _listeners: Listener[] = [];\n private _updating = false;\n /** CSS vars `setCssVar()` currently owns → the consumer's inline value it replaced ('' if none). */\n private _cssVarOwned = new Map<string, string>();\n /** The `document` listener `_watchStrings()` added, if any — outside `listen()`, whose listeners every render clears. */\n private _stringsListener: EventListener | null = null;\n\n connectedCallback(): void {\n this._initConnect();\n this._connected = true;\n this.update();\n }\n\n disconnectedCallback(): void {\n this._connected = false;\n this._cleanupListeners();\n if (this._stringsListener) doc.removeEventListener(STRINGS_CHANGE_EVENT, this._stringsListener);\n this._stringsListener = null;\n this.onDisconnect?.();\n }\n\n /**\n * Connect-time setup shared by every base class. Every `connectedCallback`\n * override that doesn't call super must call this itself, before setting\n * `_connected` (so replayed setters only write attributes, and the normal\n * connect path then acts on them).\n */\n protected _initConnect(): void {\n this._upgradeProperties();\n this._watchStrings();\n }\n\n /**\n * A property set on the element before its class was defined (e.g.\n * `el.open = true` before a lazy-loaded bundle runs) is an own property\n * that shadows the class accessor. Replay each one through the setter.\n */\n private _upgradeProperties(): void {\n for (let proto = Object.getPrototypeOf(this); proto && proto !== HTMLElement.prototype; proto = Object.getPrototypeOf(proto)) {\n for (const name of Object.getOwnPropertyNames(proto)) {\n if (!Object.prototype.hasOwnProperty.call(this, name) || !Object.getOwnPropertyDescriptor(proto, name)?.set) continue;\n const self = this as unknown as Record<string, unknown>;\n const value = self[name];\n delete self[name];\n self[name] = value;\n }\n }\n }\n\n /** Subscribes `onStringsChange()` (when defined) to `setStrings()` until disconnect. */\n private _watchStrings(): void {\n if (!this.onStringsChange || this._stringsListener) return;\n this._stringsListener = () => {\n if (this._connected) this.onStringsChange?.();\n };\n doc.addEventListener(STRINGS_CHANGE_EVENT, this._stringsListener);\n }\n\n attributeChangedCallback(_name: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue === newValue || !this._connected) return;\n this.update();\n }\n\n protected update(): void {\n // Re-entrancy guard: a listener/hook that itself mutates an observed\n // attribute during render must not trigger a nested render.\n if (this._updating) return;\n this._updating = true;\n try {\n this._cleanupListeners();\n this.onBeforeRender?.();\n const rendered = this.render();\n if (rendered !== null) {\n const nodes = Array.isArray(rendered) ? rendered : [rendered as Node];\n // The same nodes already in place stay put: no removal for focus or assistive tech to lose track of.\n if (!sameChildren(this, nodes)) this.replaceChildren(...nodes);\n }\n this.onAfterRender?.();\n } finally {\n this._updating = false;\n }\n }\n\n /**\n * Returns the nodes that replace the children on every render (build them\n * with `h()`), or `null` to leave the children untouched. Returning the\n * same nodes as last time keeps them in place, so an element can create its\n * nodes once and only patch their attributes and text on each render.\n */\n protected abstract render(): Node | readonly Node[] | null;\n\n /** Runs before `render()`. Typical use: set root-level classes/ARIA/CSS custom properties. */\n protected onBeforeRender?(): void;\n\n /** Runs after `render()` replaces the children. Typical use: query into fresh markup, wire listeners, set DOM-only properties. */\n protected onAfterRender?(): void;\n\n /** Runs once, after listener cleanup, when the element leaves the DOM. */\n protected onDisconnect?(): void;\n\n /** Runs after `setStrings()`/`resetStrings()` while connected. Define it to re-apply any built-in string this element shows. */\n protected onStringsChange?(): void;\n\n /**\n * Adds a listener and tracks it for automatic removal on the next render\n * and on disconnect — the direct replacement for the old framework's\n * `[el, type, handler]` cleanup-array convention.\n */\n protected listen(\n target: EventTarget,\n type: string,\n handler: EventListener,\n options?: AddEventListenerOptions | boolean,\n ): void {\n target.addEventListener(type, handler, options);\n this._listeners.push([target, type, handler, options]);\n }\n\n private _cleanupListeners(): void {\n for (const [target, type, handler, options] of this._listeners) {\n target.removeEventListener(type, handler, options);\n }\n this._listeners = [];\n }\n\n /** Dispatches a bubbling CustomEvent from this element. */\n protected emit<T = unknown>(type: string, detail?: T): boolean {\n return this.dispatchEvent(new CustomEvent<T>(type, { bubbles: true, detail: detail as T }));\n }\n\n // --- small attribute-reflection helpers, shared across components ---\n\n protected stringAttr(name: string, fallback = ''): string {\n return this.getAttribute(name) ?? fallback;\n }\n\n protected optionalStringAttr(name: string): string | undefined {\n return this.getAttribute(name) ?? undefined;\n }\n\n protected boolAttr(name: string): boolean {\n return this.hasAttribute(name);\n }\n\n /** The attribute as a number; `fallback` when it's missing, empty/blank (`Number('')` would be 0) or not a number. */\n protected numberAttr(name: string, fallback: number): number {\n const value = this.getAttribute(name);\n if (value == null || value.trim() === '') return fallback;\n const parsed = Number(value);\n return Number.isNaN(parsed) ? fallback : parsed;\n }\n\n protected setBoolAttr(name: string, value: boolean): void {\n if (value) this.setAttribute(name, '');\n else this.removeAttribute(name);\n }\n\n /**\n * Sets a CSS custom property on this element while `value` is truthy. When\n * it isn't, only a property this method set itself is undone — restored to\n * the consumer's own inline value from before (or removed if there was\n * none) — so a consumer's `style=\"--a11y-…: …\"` survives when the matching\n * attribute is absent.\n */\n protected setCssVar(name: string, value: string | null | undefined): void {\n if (value) {\n if (!this._cssVarOwned.has(name)) this._cssVarOwned.set(name, this.style.getPropertyValue(name));\n this.style.setProperty(name, value);\n return;\n }\n if (!this._cssVarOwned.has(name)) return;\n const previous = this._cssVarOwned.get(name)!;\n this._cssVarOwned.delete(name);\n if (previous) this.style.setProperty(name, previous);\n else this.style.removeProperty(name);\n }\n}\n\nfunction sameChildren(parent: Node, nodes: readonly Node[]): boolean {\n const current = parent.childNodes;\n return current.length === nodes.length && nodes.every((node, i) => current[i] === node);\n}\n"],"mappings":";AAKO,SAAS,cAAc,KAAa,MAAsC;AAC/E,MAAI,CAAC,eAAe,IAAI,GAAG,EAAG,gBAAe,OAAO,KAAK,IAAI;AAC/D;;;ACCO,SAAS,QAAQ,QAAgB,MAAmD;AACzF,WAAS,QAAQ,OAAO,eAAe,MAAM,GAAG,OAAO,QAAQ,OAAO,eAAe,KAAK,GAAG;AAC3F,UAAM,OAAO,OAAO,yBAAyB,OAAO,IAAI;AACxD,QAAI,KAAM,QAAO;AAAA,EACnB;AACA,SAAO;AACT;;;ACKA,IAAM,qBAAqB;AAE3B,SAAS,kBAAkB,QAA0B;AACnD,SAAO,mBAAmB,KAAK,OAAO,UAAU,SAAS,KAAK,MAAM,CAAC;AACvE;AAGO,SAAS,KAA0C,QAAW,MAAe;AAClF,MAAI,CAAC,kBAAkB,MAAM,EAAG,QAAO,OAAO,IAAI;AAClD,QAAM,OAAO,QAAQ,QAAQ,IAAI;AACjC,SAAQ,MAAM,MAAM,KAAK,IAAI,KAAK,MAAM,IAAI,MAAM;AACpD;AAKO,SAAS,KACd,QACA,SACG,MACuB;AAC1B,SAAQ,KAAK,QAAQ,IAAI,EAAoD,MAAM,QAAQ,IAAI;AACjG;AAGO,IAAM,MAAM;AAAA,EACjB,IAAI,OAAoB;AACtB,WAAO,KAAK,UAAU,MAAM;AAAA,EAC9B;AAAA,EACA,IAAI,gBAAgC;AAClC,WAAO,KAAK,UAAU,eAAe;AAAA,EACvC;AAAA,EACA,IAAI,kBAA+B;AACjC,WAAO,KAAK,UAAU,iBAAiB;AAAA,EACzC;AAAA,EACA,IAAI,aAAiC;AACnC,WAAO,KAAK,UAAU,YAAY;AAAA,EACpC;AAAA,EACA,gBAAgB,CAAC,KAAa,YAC5B,KAAK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AM,UAAU,OAAO;AACvB,SAAO,QAAQ,WAAW,MAAM,UAAU,MAAM,MAAM,CAAC,MAAM,MAAM,QAAQ,CAAC,MAAM,IAAI;AACxF;","names":[]}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yPassiveOverlayElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7GCUNMAO.js";
|
|
4
4
|
import {
|
|
5
5
|
h
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KVUJT6BC.js";
|
|
7
7
|
import {
|
|
8
8
|
defineElement,
|
|
9
|
+
doc,
|
|
9
10
|
getString
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-ED3UMYMY.js";
|
|
11
12
|
|
|
12
13
|
// src/overlays/notification-banner/notification-banner.element.ts
|
|
13
14
|
var NotificationBannerElement = class extends A11yPassiveOverlayElement {
|
|
@@ -37,12 +38,13 @@ var NotificationBannerElement = class extends A11yPassiveOverlayElement {
|
|
|
37
38
|
super.connectedCallback();
|
|
38
39
|
this.classList.add("a11y-notification-banner-region");
|
|
39
40
|
if (!this._topContainer) {
|
|
40
|
-
this._topContainer =
|
|
41
|
+
this._topContainer = doc.createElement("div");
|
|
41
42
|
this._topContainer.className = "a11y-notification-banner-region__top";
|
|
42
|
-
this._bottomContainer =
|
|
43
|
+
this._bottomContainer = doc.createElement("div");
|
|
43
44
|
this._bottomContainer.className = "a11y-notification-banner-region__bottom";
|
|
44
45
|
this.append(this._topContainer, this._bottomContainer);
|
|
45
46
|
}
|
|
47
|
+
this._drainQueue();
|
|
46
48
|
}
|
|
47
49
|
show(message, options = {}) {
|
|
48
50
|
if (options.maxStack) this.setMaxStack(options.maxStack);
|
|
@@ -70,7 +72,7 @@ var NotificationBannerElement = class extends A11yPassiveOverlayElement {
|
|
|
70
72
|
const type = item.type ?? "info";
|
|
71
73
|
const position = item.position ?? "top";
|
|
72
74
|
const container = position === "top" ? this._topContainer : this._bottomContainer;
|
|
73
|
-
const el =
|
|
75
|
+
const el = doc.createElement("div");
|
|
74
76
|
el.className = `a11y-notification-banner a11y-notification-banner--${type}`;
|
|
75
77
|
el.setAttribute("role", type === "error" ? "alert" : "status");
|
|
76
78
|
el.setAttribute("aria-live", type === "error" ? "assertive" : "polite");
|
|
@@ -87,10 +89,11 @@ var NotificationBannerElement = class extends A11yPassiveOverlayElement {
|
|
|
87
89
|
const entry = { el, onClose: item.onClose };
|
|
88
90
|
this._active.push(entry);
|
|
89
91
|
const dismiss = () => {
|
|
92
|
+
if (!this._active.includes(entry)) return;
|
|
90
93
|
el.remove();
|
|
91
94
|
this._active = this._active.filter((a) => a !== entry);
|
|
92
|
-
item.onClose?.();
|
|
93
95
|
this._onItemDismissed();
|
|
96
|
+
item.onClose?.();
|
|
94
97
|
};
|
|
95
98
|
if (item.actionText && item.onAction) {
|
|
96
99
|
const actionBtn = el.querySelector(".a11y-notification-banner__action");
|
|
@@ -107,11 +110,11 @@ var NotificationBannerElement = class extends A11yPassiveOverlayElement {
|
|
|
107
110
|
defineElement("a11y-notification-banner", NotificationBannerElement);
|
|
108
111
|
var cachedRegion = null;
|
|
109
112
|
function getRegion() {
|
|
110
|
-
const existing =
|
|
113
|
+
const existing = doc.querySelector("a11y-notification-banner");
|
|
111
114
|
if (existing) return existing;
|
|
112
115
|
if (!cachedRegion || !cachedRegion.isConnected) {
|
|
113
|
-
cachedRegion =
|
|
114
|
-
|
|
116
|
+
cachedRegion = doc.createElement("a11y-notification-banner");
|
|
117
|
+
doc.body.appendChild(cachedRegion);
|
|
115
118
|
}
|
|
116
119
|
return cachedRegion;
|
|
117
120
|
}
|
|
@@ -123,4 +126,4 @@ export {
|
|
|
123
126
|
NotificationBannerElement,
|
|
124
127
|
showNotificationBanner
|
|
125
128
|
};
|
|
126
|
-
//# sourceMappingURL=chunk-
|
|
129
|
+
//# sourceMappingURL=chunk-EMXZKQ32.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/overlays/notification-banner/notification-banner.element.ts","../../src/overlays/notification-banner/define.ts"],"sourcesContent":["import { A11yPassiveOverlayElement, type PassiveOverlayItem } from '../core/a11y-passive-overlay-element.js';\nimport { getString } from '../../core/strings.js';\nimport { h, type Content } from '../../core/dom.js';\nimport { doc } from '../../core/safe-dom.js';\n\nexport type NotificationBannerType = 'info' | 'success' | 'error' | 'warning';\n\nexport interface NotificationBannerOptions {\n type?: NotificationBannerType;\n position?: 'top' | 'bottom';\n actionText?: string;\n onAction?: () => void;\n onClose?: () => void;\n /** Sets the concurrency limit for this and all future items — sticky on the shared region, same as the `max-stack` attribute. */\n maxStack?: number;\n}\n\ninterface NotificationBannerItem extends PassiveOverlayItem {\n type?: NotificationBannerType;\n onClose?: () => void;\n}\n\n/**\n * A persistent banner region (unlike `<a11y-snackbar>`, items never\n * auto-dismiss — they stay until the user dismisses them or `dismissAll()`\n * is called). Place one `<a11y-notification-banner>` in your page, then\n * call `.show(message, options)` on it — or use the `showNotificationBanner()`\n * convenience export, which finds-or-creates one automatically.\n *\n * `dismissAll()` is the framework-agnostic replacement for the old\n * `Lifecycle.onViewUnmount` auto-wiring (which assumed a specific SPA-router\n * service) — if you want banners cleared on navigation, call it yourself\n * from your own router's navigation hook. Unlike `<a11y-snackbar>` (whose\n * toasts finish their own timers regardless of navigation while the region\n * stays in the page), this asymmetry is intentional, not an oversight — a\n * banner is scoped to the page that raised it, a toast isn't.\n *\n * Each item's close button is named by `dismiss-label=\"…\"`, else\n * `setStrings({ dismiss })`.\n */\nexport class NotificationBannerElement extends A11yPassiveOverlayElement<NotificationBannerItem> {\n private _topContainer!: HTMLElement;\n private _bottomContainer!: HTMLElement;\n private _active: Array<{ el: HTMLElement; onClose?: () => void }> = [];\n\n static override get observedAttributes(): string[] {\n return [...super.observedAttributes, 'dismiss-label'];\n }\n\n /** The accessible name of each item's close button. */\n get dismissLabel(): string {\n return this.stringAttr('dismiss-label', getString('dismiss'));\n }\n\n override attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n super.attributeChangedCallback(name, oldValue, newValue);\n if (name === 'dismiss-label' && oldValue !== newValue) this._relabelDismissButtons();\n }\n\n protected override onStringsChange(): void {\n this._relabelDismissButtons();\n }\n\n private _relabelDismissButtons(): void {\n for (const { el } of this._active) {\n el.querySelector('.a11y-notification-banner__close')?.setAttribute('aria-label', this.dismissLabel);\n }\n }\n\n override connectedCallback(): void {\n super.connectedCallback();\n this.classList.add('a11y-notification-banner-region');\n if (!this._topContainer) {\n this._topContainer = doc.createElement('div');\n this._topContainer.className = 'a11y-notification-banner-region__top';\n this._bottomContainer = doc.createElement('div');\n this._bottomContainer.className = 'a11y-notification-banner-region__bottom';\n this.append(this._topContainer, this._bottomContainer);\n }\n this._drainQueue();\n }\n\n show(message: Content, options: NotificationBannerOptions = {}): void {\n if (options.maxStack) this.setMaxStack(options.maxStack);\n this.enqueue({\n message,\n type: options.type,\n position: options.position,\n actionText: options.actionText,\n onAction: options.onAction,\n onClose: options.onClose,\n });\n }\n\n /** Force-dismisses every showing/queued item. Queued items never shown are dropped silently (no onClose); active ones get their onClose called. */\n dismissAll(): void {\n this._queue = [];\n const toClose = this._active;\n this._active = [];\n this._activeCount = 0;\n toClose.forEach(({ el, onClose }) => {\n el.remove();\n onClose?.();\n });\n }\n\n protected _showItem(item: NotificationBannerItem): void {\n const type = item.type ?? 'info';\n const position = item.position ?? 'top';\n const container = position === 'top' ? this._topContainer : this._bottomContainer;\n\n const el = doc.createElement('div');\n el.className = `a11y-notification-banner a11y-notification-banner--${type}`;\n el.setAttribute('role', type === 'error' ? 'alert' : 'status');\n el.setAttribute('aria-live', type === 'error' ? 'assertive' : 'polite');\n el.append(\n h('span', { class: 'a11y-notification-banner__message' }, item.message),\n h(\n 'span',\n { class: 'a11y-notification-banner__actions' },\n item.actionText ? h('button', { type: 'button', class: 'a11y-notification-banner__action' }, item.actionText) : null,\n h('button', { type: 'button', class: 'a11y-notification-banner__close', 'aria-label': this.dismissLabel }, '\\u00d7'),\n ),\n );\n\n container.appendChild(el);\n\n const entry = { el, onClose: item.onClose };\n this._active.push(entry);\n\n const dismiss = (): void => {\n // Already gone: e.g. `onAction` called `dismissAll()`, which closed it and reset the count.\n if (!this._active.includes(entry)) return;\n el.remove();\n this._active = this._active.filter((a) => a !== entry);\n // Count it out before `onClose` runs: a `dismissAll()` from there resets the count itself.\n this._onItemDismissed();\n item.onClose?.();\n };\n\n if (item.actionText && item.onAction) {\n const actionBtn = el.querySelector<HTMLButtonElement>('.a11y-notification-banner__action');\n actionBtn?.addEventListener('click', () => {\n item.onAction?.();\n dismiss();\n });\n }\n\n el.querySelector<HTMLButtonElement>('.a11y-notification-banner__close')?.addEventListener('click', dismiss);\n }\n}\n","import { defineElement } from '../../core/define-element.js';\nimport type { Content } from '../../core/dom.js';\nimport { NotificationBannerElement, type NotificationBannerOptions } from './notification-banner.element.js';\nimport { doc } from '../../core/safe-dom.js';\n\ndefineElement('a11y-notification-banner', NotificationBannerElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-notification-banner': NotificationBannerElement;\n }\n}\n\nexport { NotificationBannerElement, type NotificationBannerOptions };\n\nlet cachedRegion: NotificationBannerElement | null = null;\n\nfunction getRegion(): NotificationBannerElement {\n const existing = doc.querySelector<NotificationBannerElement>('a11y-notification-banner');\n if (existing) return existing;\n if (!cachedRegion || !cachedRegion.isConnected) {\n cachedRegion = doc.createElement('a11y-notification-banner') as NotificationBannerElement;\n doc.body.appendChild(cachedRegion);\n }\n return cachedRegion;\n}\n\n/**\n * Convenience: finds (or creates) an `<a11y-notification-banner>` region and\n * shows a banner in it. Skip this entirely and call `.show()` on your own\n * `<a11y-notification-banner>` element directly if you want explicit control\n * over where it lives in the DOM.\n */\nexport function showNotificationBanner(message: Content, options: NotificationBannerOptions = {}): void {\n getRegion().show(message, options);\n}\n\nexport * from '../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;;;AAwCO,IAAM,4BAAN,cAAwC,0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AACzC,aAAK,WAAW;AAChB,gBAAQ;AAAA,MACV,CAAC;AAAA,IACH;AAEA,OAAG,cAAiC,kCAAkC,GAAG,iBAAiB,SAAS,OAAO;AAAA,EAC5G;AACF;;;ACjJA,cAAc,4BAA4B,yBAAyB;AAUnE,IAAI,eAAiD;AAErD,SAAS,YAAuC;AAC9C,QAAM,WAAW,IAAI,cAAyC,0BAA0B;AACxF,MAAI,SAAU,QAAO;AACrB,MAAI,CAAC,gBAAgB,CAAC,aAAa,aAAa;AAC9C,mBAAe,IAAI,cAAc,0BAA0B;AAC3D,QAAI,KAAK,YAAY,YAAY;AAAA,EACnC;AACA,SAAO;AACT;AAQO,SAAS,uBAAuB,SAAkB,UAAqC,CAAC,GAAS;AACtG,YAAU,EAAE,KAAK,SAAS,OAAO;AACnC;","names":[]}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
A11yWrapperElement
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NBWKCBIZ.js";
|
|
4
4
|
import {
|
|
5
5
|
syncAttr,
|
|
6
6
|
syncClass,
|
|
7
7
|
syncText
|
|
8
8
|
} from "./chunk-FAEA66RR.js";
|
|
9
9
|
import {
|
|
10
|
-
defineElement
|
|
11
|
-
|
|
10
|
+
defineElement,
|
|
11
|
+
doc
|
|
12
|
+
} from "./chunk-ED3UMYMY.js";
|
|
12
13
|
|
|
13
14
|
// src/components/picture/picture.element.ts
|
|
14
15
|
var GENERATED = "data-a11y-generated";
|
|
@@ -100,7 +101,12 @@ var PictureElement = class extends A11yWrapperElement {
|
|
|
100
101
|
if (generated) this._syncGenerated();
|
|
101
102
|
else this._removeGenerated();
|
|
102
103
|
const img = generated ? this.querySelector(`:scope > picture[${GENERATED}] > img`) : this.querySelector("img");
|
|
103
|
-
if (!img)
|
|
104
|
+
if (!img) {
|
|
105
|
+
syncClass(this, "a11y-picture", false);
|
|
106
|
+
syncAttr(this, "role", null);
|
|
107
|
+
syncAttr(this, "aria-hidden", null);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
104
110
|
syncClass(this, "a11y-picture", true);
|
|
105
111
|
syncAttr(this, "role", "figure");
|
|
106
112
|
const caption = generated ? this.querySelector(`:scope > figcaption[${GENERATED}]`) : this.querySelector("figcaption");
|
|
@@ -112,16 +118,16 @@ var PictureElement = class extends A11yWrapperElement {
|
|
|
112
118
|
_syncGenerated() {
|
|
113
119
|
let picture = this.querySelector(`:scope > picture[${GENERATED}]`);
|
|
114
120
|
if (!picture) {
|
|
115
|
-
picture =
|
|
121
|
+
picture = doc.createElement("picture");
|
|
116
122
|
picture.setAttribute(GENERATED, "");
|
|
117
|
-
picture.append(
|
|
123
|
+
picture.append(doc.createElement("img"));
|
|
118
124
|
this.prepend(picture);
|
|
119
125
|
}
|
|
120
126
|
const img = picture.querySelector(":scope > img");
|
|
121
127
|
const sources = this.sources.filter((source) => source.src);
|
|
122
128
|
let elements = [...picture.querySelectorAll(":scope > source")];
|
|
123
129
|
while (elements.length < sources.length) {
|
|
124
|
-
const source =
|
|
130
|
+
const source = doc.createElement("source");
|
|
125
131
|
img.before(source);
|
|
126
132
|
elements.push(source);
|
|
127
133
|
}
|
|
@@ -151,7 +157,7 @@ var PictureElement = class extends A11yWrapperElement {
|
|
|
151
157
|
return;
|
|
152
158
|
}
|
|
153
159
|
if (!caption) {
|
|
154
|
-
caption =
|
|
160
|
+
caption = doc.createElement("figcaption");
|
|
155
161
|
caption.setAttribute(GENERATED, "");
|
|
156
162
|
}
|
|
157
163
|
if (caption.previousElementSibling !== picture) picture.after(caption);
|
|
@@ -186,4 +192,4 @@ defineElement("a11y-picture", PictureElement);
|
|
|
186
192
|
export {
|
|
187
193
|
PictureElement
|
|
188
194
|
};
|
|
189
|
-
//# sourceMappingURL=chunk-
|
|
195
|
+
//# sourceMappingURL=chunk-F5VLI6QP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/picture/picture.element.ts","../../src/components/picture/define.ts"],"sourcesContent":["import { A11yWrapperElement } from '../../core/a11y-wrapper-element.js';\nimport { syncAttr, syncClass, syncText } from '../../core/dom-sync.js';\nimport { doc } from '../../core/safe-dom.js';\n\n/** Marks the markup this element builds itself (in generated mode), so it never mixes it up with the consumer's. */\nconst GENERATED = 'data-a11y-generated';\n\n/** One `<source>` of a generated `<picture>`. */\nexport interface PictureSource {\n /** A URL, or a full srcset (`s.avif 1x, s@2x.avif 2x`). */\n src: string;\n /** The MIME type (`image/avif`), so the browser skips formats it can't decode. */\n type?: string;\n media?: string;\n sizes?: string;\n}\n\n/** Everything a generated picture needs, in one object — see `PictureElement.image`. */\nexport interface PictureImage {\n /** Tried in order: put the most efficient format first. */\n sources?: PictureSource[];\n /** The `<img>` src, used when no source's type is supported. */\n fallback: string;\n alt: string;\n caption?: string;\n width?: number;\n height?: number;\n loading?: 'lazy' | 'eager';\n}\n\n/**\n * An accessible figure around a picture: `role=\"figure\"`, and hidden from\n * assistive tech (`aria-hidden`) when the image is decorative — an empty\n * `alt` and no caption.\n *\n * The picture is either authored by the consumer — native HTML already\n * handles format and responsive selection through real `<source>` children:\n *\n * ```html\n * <a11y-picture>\n * <picture>\n * <source srcset=\"hero.webp\" type=\"image/webp\">\n * <img src=\"hero.jpg\" alt=\"Sunset over the Rockies\" loading=\"lazy\" decoding=\"async\">\n * </picture>\n * <figcaption>Sunset over the Rockies</figcaption>\n * </a11y-picture>\n * ```\n *\n * …or generated from attributes/properties, as soon as there's a `src` (the\n * fallback image). The browser uses the first source whose `type` it\n * supports, else the fallback:\n *\n * ```html\n * <a11y-picture src=\"s.jpg\" alt=\"S illustration\" sources=\"s.avif image/avif, s.webp image/webp\"></a11y-picture>\n * ```\n *\n * ```js\n * el.image = { sources: [{ src: 's.avif', type: 'image/avif' }], fallback: 's.jpg', alt: 'S illustration' };\n * ```\n *\n * Use one or the other: in generated mode, authored children are ignored.\n */\nexport class PictureElement extends A11yWrapperElement {\n static get observedAttributes(): string[] {\n return ['src', 'alt', 'sources', 'caption', 'width', 'height', 'loading', 'sizes'];\n }\n\n /** Sources set as a property; `null` falls back to the `sources` attribute. */\n private _sources: PictureSource[] | null = null;\n /** The `sources` attribute value last parsed, and the result — parsed (and warned about) once per value. */\n private _parsed: [value: string | null, sources: PictureSource[]] = [null, []];\n private _warnedAlt = false;\n\n /** The fallback image. Setting it switches to generated mode. */\n get src(): string {\n return this.stringAttr('src');\n }\n\n set src(value: string) {\n this._setOptionalAttr('src', value);\n }\n\n get alt(): string {\n return this.stringAttr('alt');\n }\n\n set alt(value: string) {\n // `''` is meaningful (decorative), so only null/undefined remove it.\n if (value == null) this.removeAttribute('alt');\n else this.setAttribute('alt', value);\n }\n\n get caption(): string {\n return this.stringAttr('caption');\n }\n\n set caption(value: string) {\n this._setOptionalAttr('caption', value);\n }\n\n get width(): number | undefined {\n return this._optionalNumber('width');\n }\n\n set width(value: number | undefined) {\n this._setOptionalAttr('width', value);\n }\n\n get height(): number | undefined {\n return this._optionalNumber('height');\n }\n\n set height(value: number | undefined) {\n this._setOptionalAttr('height', value);\n }\n\n get loading(): 'lazy' | 'eager' {\n return this.getAttribute('loading') === 'eager' ? 'eager' : 'lazy';\n }\n\n set loading(value: 'lazy' | 'eager') {\n this._setOptionalAttr('loading', value);\n }\n\n /** Set as a property, or parsed from the `sources` attribute (`url type` pairs, comma-separated). */\n get sources(): PictureSource[] {\n if (this._sources) return this._sources;\n const value = this.getAttribute('sources');\n if (this._parsed[0] !== value) this._parsed = [value, parseSources(value)];\n return this._parsed[1];\n }\n\n /** Overrides the `sources` attribute until it changes. Needed for srcset descriptors, `media` or `sizes`. */\n set sources(value: PictureSource[]) {\n this._sources = value ? value.map((source) => ({ ...source })) : null;\n if (this._connected) this._sync();\n }\n\n /** Sets the whole picture at once — sources, fallback, alt and the optional fields — in one sync. */\n set image(image: PictureImage) {\n this._sources = (image.sources ?? []).map((source) => ({ ...source }));\n const connected = this._connected;\n this._connected = false; // one sync at the end, not one per attribute\n try {\n this.src = image.fallback;\n this.alt = image.alt;\n this.caption = image.caption ?? '';\n this.width = image.width;\n this.height = image.height;\n this.loading = image.loading ?? 'lazy';\n } finally {\n this._connected = connected;\n }\n if (connected) this._sync();\n }\n\n override attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {\n if (name === 'sources' && oldValue !== newValue) this._sources = null; // the attribute set last wins\n super.attributeChangedCallback(name, oldValue, newValue);\n }\n\n protected override observerInit(): MutationObserverInit {\n return { childList: true, subtree: true, attributes: true, attributeFilter: ['alt'] };\n }\n\n protected override _sync(): void {\n const generated = this.hasAttribute('src');\n if (generated) this._syncGenerated();\n else this._removeGenerated();\n\n const img = generated\n ? this.querySelector<HTMLImageElement>(`:scope > picture[${GENERATED}] > img`)\n : this.querySelector('img');\n if (!img) {\n // The image went away (src removed, authored <img> taken out): drop what it set, so\n // aria-hidden can't hide whatever is put in here later.\n syncClass(this, 'a11y-picture', false);\n syncAttr(this, 'role', null);\n syncAttr(this, 'aria-hidden', null);\n return;\n }\n\n // Guarded writes: this runs inside a MutationObserver callback watching\n // this subtree, and setAttribute/classList.add queue a mutation record\n // even when the value is unchanged — unguarded, that retriggers the\n // observer forever. The attributeFilter above already keeps this element's\n // own writes (role/class/aria-hidden) out of scope, but staying guarded\n // here too means that isn't load-bearing for correctness.\n syncClass(this, 'a11y-picture', true);\n syncAttr(this, 'role', 'figure');\n\n const caption = generated ? this.querySelector(`:scope > figcaption[${GENERATED}]`) : this.querySelector('figcaption');\n const hasCaption = !!caption?.textContent?.trim();\n const isDecorative = img.getAttribute('alt') === '' && !hasCaption;\n\n syncAttr(this, 'aria-hidden', isDecorative ? 'true' : null);\n }\n\n /** Builds `<picture>` (sources, then the fallback `<img>`) and the caption from this element's attributes/properties. */\n private _syncGenerated(): void {\n let picture = this.querySelector<HTMLPictureElement>(`:scope > picture[${GENERATED}]`);\n if (!picture) {\n picture = doc.createElement('picture');\n picture.setAttribute(GENERATED, '');\n picture.append(doc.createElement('img'));\n this.prepend(picture);\n }\n const img = picture.querySelector<HTMLImageElement>(':scope > img')!;\n\n const sources = this.sources.filter((source) => source.src);\n let elements = [...picture.querySelectorAll<HTMLSourceElement>(':scope > source')];\n // Add or remove only the difference, so unchanged sources aren't reloaded.\n while (elements.length < sources.length) {\n const source = doc.createElement('source');\n img.before(source);\n elements.push(source);\n }\n for (const extra of elements.splice(sources.length)) extra.remove();\n sources.forEach((source, i) => {\n const el = elements[i]!;\n syncAttr(el, 'srcset', source.src);\n syncAttr(el, 'type', source.type || null);\n syncAttr(el, 'media', source.media || null);\n syncAttr(el, 'sizes', source.sizes || null);\n });\n\n // Sizes first: the browser picks from srcset/src with them already known.\n syncAttr(img, 'sizes', this.getAttribute('sizes'));\n syncAttr(img, 'width', this.getAttribute('width'));\n syncAttr(img, 'height', this.getAttribute('height'));\n syncAttr(img, 'loading', this.loading);\n syncAttr(img, 'decoding', 'async');\n syncAttr(img, 'alt', this.getAttribute('alt') ?? '');\n syncAttr(img, 'src', this.src);\n if (!this.hasAttribute('alt') && !this._warnedAlt) {\n this._warnedAlt = true;\n console.warn('<a11y-picture> has no alt — describe the image, or set alt=\"\" if it is decorative.');\n }\n\n let caption = this.querySelector<HTMLElement>(`:scope > figcaption[${GENERATED}]`);\n const text = this.caption.trim();\n if (!text) {\n caption?.remove();\n return;\n }\n if (!caption) {\n caption = doc.createElement('figcaption');\n caption.setAttribute(GENERATED, '');\n }\n if (caption.previousElementSibling !== picture) picture.after(caption);\n syncText(caption, text);\n }\n\n private _removeGenerated(): void {\n for (const el of this.querySelectorAll(`:scope > [${GENERATED}]`)) el.remove();\n }\n\n private _setOptionalAttr(name: string, value: string | number | null | undefined): void {\n if (value == null || value === '') this.removeAttribute(name);\n else this.setAttribute(name, String(value));\n }\n\n private _optionalNumber(name: string): number | undefined {\n const value = Number(this.getAttribute(name) ?? NaN);\n return Number.isNaN(value) ? undefined : value;\n }\n}\n\n/** `\"s.avif image/avif, s.webp image/webp\"` → sources. Entries that aren't `url type` are skipped, with a warning. */\nfunction parseSources(value: string | null): PictureSource[] {\n if (!value) return [];\n const sources: PictureSource[] = [];\n for (const entry of value.split(',').map((part) => part.trim()).filter(Boolean)) {\n const match = entry.match(/^(\\S+)\\s+([\\w-]+\\/[\\w.+-]+)$/);\n if (match) sources.push({ src: match[1]!, type: match[2]! });\n else console.warn(`<a11y-picture> ignored the source \"${entry}\": write \"url type\", e.g. \"hero.avif image/avif\".`);\n }\n return sources;\n}\n","import { defineElement } from '../../core/define-element.js';\nimport { PictureElement } from './picture.element.js';\n\ndefineElement('a11y-picture', PictureElement);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'a11y-picture': PictureElement;\n }\n}\n\nexport { PictureElement };\nexport type { PictureImage, PictureSource } from './picture.element.js';\nexport * from '../../core/zero-build-exports.js';\n"],"mappings":";;;;;;;;;;;;;;AAKA,IAAM,YAAY;AAyDX,IAAM,iBAAN,cAA6B,mBAAmB;AAAA,EACrD,WAAW,qBAA+B;AACxC,WAAO,CAAC,OAAO,OAAO,WAAW,WAAW,SAAS,UAAU,WAAW,OAAO;AAAA,EACnF;AAAA;AAAA,EAGQ,WAAmC;AAAA;AAAA,EAEnC,UAA4D,CAAC,MAAM,CAAC,CAAC;AAAA,EACrE,aAAa;AAAA;AAAA,EAGrB,IAAI,MAAc;AAChB,WAAO,KAAK,WAAW,KAAK;AAAA,EAC9B;AAAA,EAEA,IAAI,IAAI,OAAe;AACrB,SAAK,iBAAiB,OAAO,KAAK;AAAA,EACpC;AAAA,EAEA,IAAI,MAAc;AAChB,WAAO,KAAK,WAAW,KAAK;AAAA,EAC9B;AAAA,EAEA,IAAI,IAAI,OAAe;AAErB,QAAI,SAAS,KAAM,MAAK,gBAAgB,KAAK;AAAA,QACxC,MAAK,aAAa,OAAO,KAAK;AAAA,EACrC;AAAA,EAEA,IAAI,UAAkB;AACpB,WAAO,KAAK,WAAW,SAAS;AAAA,EAClC;AAAA,EAEA,IAAI,QAAQ,OAAe;AACzB,SAAK,iBAAiB,WAAW,KA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
|
"[tabindex]"
|
|
15
21
|
].join(", ");
|
|
16
22
|
function isTabbable(el) {
|
|
17
|
-
if (Number(el
|
|
18
|
-
if (el
|
|
19
|
-
if (typeof el
|
|
23
|
+
if (Number(call(el, "getAttribute", "tabindex")) < 0) return false;
|
|
24
|
+
if (call(el, "closest", "[hidden], [inert]")) return false;
|
|
25
|
+
if (typeof prop(el, "checkVisibility") === "function") return call(el, "checkVisibility", { visibilityProperty: true });
|
|
20
26
|
return true;
|
|
21
27
|
}
|
|
22
28
|
function queryFocusable(root) {
|
|
23
29
|
const found = [];
|
|
24
|
-
for (const el of Array.from(root
|
|
25
|
-
if (el
|
|
26
|
-
|
|
30
|
+
for (const el of Array.from(call(root, "querySelectorAll", "*"))) {
|
|
31
|
+
if (call(el, "matches", FOCUSABLE_SELECTOR)) found.push(el);
|
|
32
|
+
const shadow = prop(el, "shadowRoot");
|
|
33
|
+
if (shadow) found.push(...queryFocusable(shadow));
|
|
27
34
|
}
|
|
28
35
|
return found;
|
|
29
36
|
}
|
|
30
37
|
function deepActiveElement() {
|
|
31
|
-
let active =
|
|
32
|
-
while (active
|
|
38
|
+
let active = doc.activeElement;
|
|
39
|
+
while (active) {
|
|
40
|
+
const inner = prop(active, "shadowRoot")?.activeElement;
|
|
41
|
+
if (!inner) break;
|
|
42
|
+
active = inner;
|
|
43
|
+
}
|
|
33
44
|
return active;
|
|
34
45
|
}
|
|
35
46
|
function isNamedRadio(el) {
|
|
@@ -51,23 +62,26 @@ var pointerStore = globalThis;
|
|
|
51
62
|
var pointerState = pointerStore[POINTER_KEY] ??= { lastPressed: null, listening: false };
|
|
52
63
|
if (!pointerState.listening && typeof document !== "undefined") {
|
|
53
64
|
pointerState.listening = true;
|
|
54
|
-
|
|
65
|
+
doc.addEventListener(
|
|
55
66
|
"pointerdown",
|
|
56
67
|
(event) => {
|
|
57
68
|
const target = event.target instanceof Element ? event.target : null;
|
|
58
|
-
pointerState.lastPressed = target
|
|
69
|
+
pointerState.lastPressed = target ? call(target, "closest", FOCUSABLE_SELECTOR) : null;
|
|
59
70
|
},
|
|
60
71
|
true
|
|
61
72
|
);
|
|
62
73
|
}
|
|
63
74
|
function focusReturnTarget() {
|
|
64
|
-
const active =
|
|
65
|
-
if (active && active !==
|
|
75
|
+
const active = doc.activeElement;
|
|
76
|
+
if (active && active !== doc.body && active !== doc.documentElement) return active;
|
|
66
77
|
const pressed = pointerState.lastPressed;
|
|
67
78
|
return pressed?.isConnected ? pressed : active;
|
|
68
79
|
}
|
|
80
|
+
function retargetFocusReturn(container, target) {
|
|
81
|
+
for (const trap of activeTraps) trap._retargetReturnFrom?.(container, target);
|
|
82
|
+
}
|
|
69
83
|
function focusFromKeyboard(el) {
|
|
70
|
-
el
|
|
84
|
+
call(el, "focus", { focusVisible: true });
|
|
71
85
|
}
|
|
72
86
|
var STACK_KEY = /* @__PURE__ */ Symbol.for("a11y-elements/focus-trap-stack");
|
|
73
87
|
var stackStore = globalThis;
|
|
@@ -100,44 +114,51 @@ var FocusTrapHelper = class {
|
|
|
100
114
|
_resolveInertTarget() {
|
|
101
115
|
const target = this._options.inertTarget;
|
|
102
116
|
if (!target) return null;
|
|
103
|
-
return typeof target === "string" ?
|
|
117
|
+
return typeof target === "string" ? doc.querySelector(target) : target;
|
|
104
118
|
}
|
|
105
119
|
_resolveInitialFocus() {
|
|
106
120
|
const option = this._options.initialFocus;
|
|
107
121
|
const el = typeof option === "function" ? option() : option;
|
|
108
|
-
if (!el || !this._container
|
|
109
|
-
return el
|
|
122
|
+
if (!el || !call(this._container, "contains", el)) return null;
|
|
123
|
+
return call(el, "matches", FOCUSABLE_SELECTOR) && isTabbable(el) ? el : null;
|
|
110
124
|
}
|
|
111
125
|
activate() {
|
|
112
126
|
if (this._isActive) return;
|
|
113
127
|
this._previousActiveElement = focusReturnTarget();
|
|
128
|
+
activeTraps.push(this);
|
|
114
129
|
this._focusableElements = this._getFocusableElements();
|
|
115
130
|
if (this._focusableElements.length > 0) {
|
|
116
131
|
this._firstFocusableElement = this._focusableElements[0] ?? null;
|
|
117
|
-
|
|
132
|
+
const first = this._resolveInitialFocus() ?? this._firstFocusableElement;
|
|
133
|
+
if (first) call(first, "focus");
|
|
118
134
|
} else {
|
|
119
|
-
this._container
|
|
120
|
-
this._container
|
|
135
|
+
call(this._container, "setAttribute", "tabindex", "-1");
|
|
136
|
+
call(this._container, "focus");
|
|
121
137
|
this._firstFocusableElement = this._container;
|
|
122
138
|
}
|
|
123
|
-
|
|
124
|
-
activeTraps.push(this);
|
|
139
|
+
doc.addEventListener("keydown", this._boundKeyDown);
|
|
125
140
|
this._inertTarget = this._resolveInertTarget();
|
|
126
141
|
if (this._inertTarget) this._inertTarget.inert = true;
|
|
127
142
|
this._isActive = true;
|
|
128
143
|
}
|
|
129
|
-
|
|
144
|
+
/** `returnFocus: false` skips giving focus back, e.g. when the user already moved it elsewhere. */
|
|
145
|
+
deactivate({ returnFocus = true } = {}) {
|
|
130
146
|
if (!this._isActive) return;
|
|
131
|
-
|
|
147
|
+
doc.removeEventListener("keydown", this._boundKeyDown);
|
|
132
148
|
const index = activeTraps.indexOf(this);
|
|
149
|
+
const wasTop = index === activeTraps.length - 1;
|
|
133
150
|
if (index !== -1) activeTraps.splice(index, 1);
|
|
134
151
|
if (this._inertTarget) this._inertTarget.inert = false;
|
|
135
152
|
this._inertTarget = null;
|
|
136
|
-
if (this._container
|
|
137
|
-
this._container
|
|
153
|
+
if (call(this._container, "getAttribute", "tabindex") === "-1") {
|
|
154
|
+
call(this._container, "removeAttribute", "tabindex");
|
|
138
155
|
}
|
|
139
|
-
if (
|
|
140
|
-
|
|
156
|
+
if (!wasTop && index !== -1) {
|
|
157
|
+
const above = activeTraps[index];
|
|
158
|
+
const aboveTarget = above?._previousActiveElement;
|
|
159
|
+
if (above && (!aboveTarget || call(this._container, "contains", aboveTarget))) above._previousActiveElement = this._previousActiveElement;
|
|
160
|
+
} else if (returnFocus && this._options.returnFocusOnDeactivate && this._previousActiveElement && prop(this._previousActiveElement, "focus")) {
|
|
161
|
+
call(this._previousActiveElement, "focus");
|
|
141
162
|
}
|
|
142
163
|
this._focusableElements = null;
|
|
143
164
|
this._firstFocusableElement = null;
|
|
@@ -148,6 +169,10 @@ var FocusTrapHelper = class {
|
|
|
148
169
|
const option = this._options.escapeDeactivates;
|
|
149
170
|
return typeof option === "function" ? option() : option !== false;
|
|
150
171
|
}
|
|
172
|
+
/** @internal — see `retargetFocusReturn()`. */
|
|
173
|
+
_retargetReturnFrom(container, target) {
|
|
174
|
+
if (this._previousActiveElement && call(container, "contains", this._previousActiveElement)) this._previousActiveElement = target;
|
|
175
|
+
}
|
|
151
176
|
getIsActive() {
|
|
152
177
|
return this._isActive;
|
|
153
178
|
}
|
|
@@ -168,7 +193,7 @@ var FocusTrapHelper = class {
|
|
|
168
193
|
_ownsEvent(event) {
|
|
169
194
|
if (activeTraps[activeTraps.length - 1] !== this) return false;
|
|
170
195
|
const target = event.target;
|
|
171
|
-
return !target || target === document || target ===
|
|
196
|
+
return !target || target === document || target === doc.body || target === doc.documentElement || call(this._container, "contains", target);
|
|
172
197
|
}
|
|
173
198
|
_handleKeyDown(event) {
|
|
174
199
|
if (!this._ownsEvent(event)) return;
|
|
@@ -215,7 +240,8 @@ var FocusTrapHelper = class {
|
|
|
215
240
|
|
|
216
241
|
export {
|
|
217
242
|
focusReturnTarget,
|
|
243
|
+
retargetFocusReturn,
|
|
218
244
|
focusFromKeyboard,
|
|
219
245
|
FocusTrapHelper
|
|
220
246
|
};
|
|
221
|
-
//# sourceMappingURL=chunk-
|
|
247
|
+
//# sourceMappingURL=chunk-FNILKXCO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/core/focus-trap.ts"],"sourcesContent":["import { call, doc, prop } from './safe-dom.js';\n\ntype KeyboardEventHandler = (event: KeyboardEvent) => void;\n\n/** Everything that can be a Tab stop; `isTabbable()` then drops what's hidden or has a negative `tabindex`. */\nconst FOCUSABLE_SELECTOR = [\n 'a[href]',\n 'area[href]',\n 'button:not(:disabled)',\n 'input:not(:disabled):not([type=\"hidden\"])',\n 'select:not(:disabled)',\n 'textarea:not(:disabled)',\n 'details > summary:first-of-type',\n 'iframe',\n 'audio[controls]',\n 'video[controls]',\n '[contenteditable]:not([contenteditable=\"false\"])',\n '[tabindex]',\n].join(', ');\n\nexport interface IFocusTrapOptions {\n /** Whether Escape calls `onDeactivate`; a function is asked on each press. Default `true`. */\n escapeDeactivates?: boolean | (() => boolean);\n returnFocusOnDeactivate?: boolean;\n onDeactivate?: () => void;\n /**\n * An element (or selector resolving to one) to mark `inert` while the trap\n * is active, so assistive tech can't reach content behind the trap.\n * Defaults to `null` (no side effect) — the old implementation hardcoded\n * `document.querySelector('#app')`, which assumed every consumer had a\n * single a11y-shell element with that exact id. A library meant to be\n * dropped into arbitrary HTML can't assume that, so this is opt-in.\n */\n inertTarget?: HTMLElement | string | null;\n /**\n * Where focus goes on `activate()`, instead of the first focusable element:\n * an element, or a function returning one (called on activation). Ignored\n * when it's outside the container or can't take focus.\n */\n initialFocus?: HTMLElement | (() => HTMLElement | null) | null;\n}\n\nexport interface IFocusTrapHelperParams {\n container: HTMLElement;\n options?: IFocusTrapOptions;\n}\n\n/**\n * Whether a selector-matched element can actually take focus right now:\n * not inside a `hidden`/`inert` subtree, and (where the browser supports\n * `checkVisibility()`) actually rendered — `display: none`, `visibility:\n * hidden` or a collapsed `<details>` would otherwise become a Tab stop\n * that silently swallows the key press.\n */\nfunction isTabbable(el: HTMLElement): boolean {\n // A negative tabindex takes even a native control out of the Tab order.\n // Read through `call()`/`prop()`: `el` can be a <form> (e.g. in `raw()` content) whose controls shadow these.\n if (Number(call(el, 'getAttribute', 'tabindex')) < 0) return false;\n if (call(el, 'closest', '[hidden], [inert]')) return false;\n if (typeof prop(el, 'checkVisibility') === 'function') return call(el, 'checkVisibility', { visibilityProperty: true });\n return true;\n}\n\n/**\n * Every selector-matched element under `root` in tree order, including those\n * inside open shadow roots (at their host's position) — a trap that drives\n * every Tab press itself would otherwise skip a third-party web component's\n * own controls. Closed shadow roots can't be seen into.\n */\nfunction queryFocusable(root: ParentNode): HTMLElement[] {\n const found: HTMLElement[] = [];\n for (const el of Array.from(call(root, 'querySelectorAll', '*') as NodeListOf<HTMLElement>)) {\n if (call(el, 'matches', FOCUSABLE_SELECTOR)) found.push(el);\n const shadow = prop(el, 'shadowRoot');\n if (shadow) found.push(...queryFocusable(shadow));\n }\n return found;\n}\n\n/** The focused element itself, not the shadow host `document.activeElement` stops at. */\nfunction deepActiveElement(): HTMLElement | null {\n let active = doc.activeElement;\n while (active) {\n const inner = prop(active, 'shadowRoot')?.activeElement;\n if (!inner) break;\n active = inner;\n }\n return active as HTMLElement | null;\n}\n\nfunction isNamedRadio(el: Element | null): el is HTMLInputElement {\n return el instanceof HTMLInputElement && el.type === 'radio' && el.name !== '';\n}\n\n/**\n * Native Tab treats radios sharing a `name` (in the same form) as a single stop:\n * the checked one, else the first one. Arrow keys move inside the group. Without\n * this, a trap would stop on every radio of a group (e.g. 48 in a theme list).\n * `elements` are already tabbable, so a disabled or hidden radio is never a stop.\n */\nfunction collapseRadioGroups(elements: HTMLElement[]): HTMLElement[] {\n const stops = new Map<HTMLFormElement | null, Map<string, HTMLInputElement>>();\n for (const el of elements) {\n if (!isNamedRadio(el)) continue;\n let byName = stops.get(el.form);\n if (!byName) stops.set(el.form, (byName = new Map()));\n const stop = byName.get(el.name);\n if (!stop || (el.checked && !stop.checked)) byName.set(el.name, el);\n }\n return elements.filter((el) => !isNamedRadio(el) || stops.get(el.form)?.get(el.name) === el);\n}\n\ninterface PointerState {\n /** The focusable element (or its closest focusable ancestor) the pointer last pressed. */\n lastPressed: HTMLElement | null;\n listening: boolean;\n}\n\n/**\n * Safari (and Firefox on macOS) don't focus a button or link on click, so an\n * overlay opened from a click sees `document.activeElement === <body>` and\n * would have nowhere to return focus. One capture-phase `pointerdown`\n * listener, shared page-wide like the trap stack below, remembers the\n * focusable element that was pressed instead.\n */\nconst POINTER_KEY = Symbol.for('a11y-elements/last-pressed');\nconst pointerStore = globalThis as unknown as Record<symbol, PointerState | undefined>;\nconst pointerState: PointerState = (pointerStore[POINTER_KEY] ??= { lastPressed: null, listening: false });\nif (!pointerState.listening && typeof document !== 'undefined') {\n pointerState.listening = true;\n doc.addEventListener(\n 'pointerdown',\n (event) => {\n const target = event.target instanceof Element ? event.target : null;\n pointerState.lastPressed = target ? (call(target, 'closest', FOCUSABLE_SELECTOR) as HTMLElement | null) : null;\n },\n true,\n );\n}\n\n/**\n * Where focus should go back to when an overlay that's opening now closes:\n * the focused element, or — when that's just `<body>` because the browser\n * didn't focus a clicked trigger — the element that was last pressed.\n */\nexport function focusReturnTarget(): HTMLElement | null {\n const active = doc.activeElement as HTMLElement | null;\n if (active && active !== doc.body && active !== doc.documentElement) return active;\n const pressed = pointerState.lastPressed;\n return pressed?.isConnected ? pressed : active;\n}\n\n/**\n * Points every active trap that would return focus into `container` (which is\n * closing) at `target` instead. E.g. a modal opened from a menu item would\n * otherwise give focus back to that item, hidden by then, and lose it to\n * `<body>`; the menu hands over its own trigger.\n */\nexport function retargetFocusReturn(container: Element, target: HTMLElement): void {\n // `?.`: the stack is shared page-wide, and a trap from an older bundle may lack the method.\n for (const trap of activeTraps) trap._retargetReturnFrom?.(container, target);\n}\n\n/**\n * Moves focus in response to a key press, asking for a visible focus ring.\n * WebKit copies `:focus-visible` from the previously focused element for\n * script-driven focus, and a `preventDefault()`ed key press doesn't turn it\n * on — so in an overlay opened by a mouse click, every Tab/Arrow press would\n * move focus without ever showing where it went.\n */\nexport function focusFromKeyboard(el: HTMLElement): void {\n call(el, 'focus', { focusVisible: true } as FocusOptions); // TS 5.9's lib.dom lacks `focusVisible`\n}\n\n/**\n * Page-wide stack of active traps, on `globalThis` for the same reason as\n * `overlay-registry.ts`' state: each standalone browser bundle inlines its\n * own copy of this module. Only the top trap handles keys, so stacked\n * overlays (a modal opened from a modal) don't both react to one Escape.\n */\nconst STACK_KEY = Symbol.for('a11y-elements/focus-trap-stack');\nconst stackStore = globalThis as unknown as Record<symbol, FocusTrapHelper[] | undefined>;\nconst activeTraps: FocusTrapHelper[] = (stackStore[STACK_KEY] ??= []);\n\nexport class FocusTrapHelper {\n private _container: HTMLElement;\n private _previousActiveElement: HTMLElement | null = null;\n private _focusableElements: HTMLElement[] | null = null;\n private _firstFocusableElement: HTMLElement | null = null;\n private _boundKeyDown: KeyboardEventHandler;\n private _options: IFocusTrapOptions;\n private _inertTarget: HTMLElement | null = null;\n private _isActive = false;\n\n constructor({ container, options = {} }: IFocusTrapHelperParams) {\n this._container = container;\n this._options = {\n escapeDeactivates: options.escapeDeactivates ?? true,\n returnFocusOnDeactivate: options.returnFocusOnDeactivate ?? true,\n onDeactivate: options.onDeactivate,\n inertTarget: options.inertTarget ?? null,\n initialFocus: options.initialFocus ?? null,\n };\n this._boundKeyDown = this._handleKeyDown.bind(this);\n }\n\n private _getFocusableElements(): HTMLElement[] {\n return collapseRadioGroups(\n queryFocusable(this._container).filter(isTabbable),\n );\n }\n\n private _resolveInertTarget(): HTMLElement | null {\n const target = this._options.inertTarget;\n if (!target) return null;\n return typeof target === 'string' ? doc.querySelector<HTMLElement>(target) : target;\n }\n\n private _resolveInitialFocus(): HTMLElement | null {\n const option = this._options.initialFocus;\n const el = typeof option === 'function' ? option() : option;\n if (!el || !call(this._container, 'contains', el)) return null;\n return call(el, 'matches', FOCUSABLE_SELECTOR) && isTabbable(el) ? el : null;\n }\n\n public activate(): void {\n if (this._isActive) return;\n\n this._previousActiveElement = focusReturnTarget();\n // On the stack before focus moves: moving it can close whatever had it (a menu losing focus),\n // and that close may retarget where this trap returns focus (see `retargetFocusReturn()`).\n activeTraps.push(this);\n this._focusableElements = this._getFocusableElements();\n\n if (this._focusableElements.length > 0) {\n this._firstFocusableElement = this._focusableElements[0] ?? null;\n const first = this._resolveInitialFocus() ?? this._firstFocusableElement;\n if (first) call(first, 'focus');\n } else {\n call(this._container, 'setAttribute', 'tabindex', '-1');\n call(this._container, 'focus');\n this._firstFocusableElement = this._container;\n }\n\n // On `document`, not the container: clicking non-focusable content inside\n // the trap (text, padding) moves focus to <body>, and a container\n // listener would then never see Escape/Tab again.\n doc.addEventListener('keydown', this._boundKeyDown);\n\n this._inertTarget = this._resolveInertTarget();\n if (this._inertTarget) this._inertTarget.inert = true;\n\n this._isActive = true;\n }\n\n /** `returnFocus: false` skips giving focus back, e.g. when the user already moved it elsewhere. */\n public deactivate({ returnFocus = true }: { returnFocus?: boolean } = {}): void {\n if (!this._isActive) return;\n\n doc.removeEventListener('keydown', this._boundKeyDown);\n const index = activeTraps.indexOf(this);\n const wasTop = index === activeTraps.length - 1;\n if (index !== -1) activeTraps.splice(index, 1);\n\n if (this._inertTarget) this._inertTarget.inert = false;\n this._inertTarget = null;\n\n if (call(this._container, 'getAttribute', 'tabindex') === '-1') {\n call(this._container, 'removeAttribute', 'tabindex');\n }\n\n if (!wasTop && index !== -1) {\n // A trap above this one is still active (e.g. modal A closed while modal B, opened from it,\n // stays open): focus must not leave B. Where B would return to probably lives in this\n // container and is about to go, so B returns to where this trap would have instead.\n const above = activeTraps[index];\n const aboveTarget = above?._previousActiveElement;\n if (above && (!aboveTarget || call(this._container, 'contains', aboveTarget))) above._previousActiveElement = this._previousActiveElement;\n } else if (returnFocus && this._options.returnFocusOnDeactivate && this._previousActiveElement && prop(this._previousActiveElement, 'focus')) {\n call(this._previousActiveElement, 'focus');\n }\n\n this._focusableElements = null;\n this._firstFocusableElement = null;\n this._previousActiveElement = null;\n\n this._isActive = false;\n }\n\n private _escapeDeactivates(): boolean {\n const option = this._options.escapeDeactivates;\n return typeof option === 'function' ? option() : option !== false;\n }\n\n /** @internal — see `retargetFocusReturn()`. */\n public _retargetReturnFrom(container: Element, target: HTMLElement): void {\n if (this._previousActiveElement && call(container, 'contains', this._previousActiveElement)) this._previousActiveElement = target;\n }\n\n public getIsActive(): boolean {\n return this._isActive;\n }\n\n public updateFocusableElements(): void {\n if (!this._isActive) return;\n\n this._focusableElements = this._getFocusableElements();\n\n if (this._focusableElements.length > 0) {\n this._firstFocusableElement = this._focusableElements[0] ?? null;\n }\n }\n\n /**\n * Whether this trap should handle `event`: it must be the topmost trap, and\n * the key press must come from inside it — or from <body>/<html>, where\n * focus lands after a click on non-focusable content inside the trap. A key\n * press from elsewhere (e.g. a non-trapping dropdown opened above a modal)\n * is left alone.\n */\n private _ownsEvent(event: KeyboardEvent): boolean {\n if (activeTraps[activeTraps.length - 1] !== this) return false;\n const target = event.target as Node | null;\n return (\n !target ||\n target === document ||\n target === doc.body ||\n target === doc.documentElement ||\n call(this._container, 'contains', target)\n );\n }\n\n private _handleKeyDown(event: KeyboardEvent): void {\n if (!this._ownsEvent(event)) return;\n switch (event.key) {\n case 'Tab':\n this._handleTabKey(event);\n break;\n case 'Escape':\n // Already handled — by an overlay above this one, or a widget inside it (e.g. a combobox closing its list).\n if (!event.defaultPrevented && this._escapeDeactivates()) {\n event.preventDefault();\n this._options.onDeactivate?.();\n }\n break;\n }\n }\n\n /**\n * Drives every Tab/Shift+Tab press manually instead of only intercepting\n * at the first/last boundary and otherwise trusting the browser's native\n * tab order to match `_focusableElements`' DOM order. Safari on macOS, by\n * default, excludes buttons/links from the native Tab order entirely (only\n * text inputs get native tab stops) — so a boundary-only trap can let\n * focus silently escape once native Tab skips past what this class thinks\n * is the last focusable element. Owning every Tab press removes that\n * dependency on any browser's native tab-stop behavior altogether.\n */\n private _handleTabKey(event: KeyboardEvent): void {\n // Re-queried on every press, so content added/removed/shown/hidden\n // inside the trap after activation is always reachable (and nothing\n // stale is).\n this.updateFocusableElements();\n if (!this._focusableElements || this._focusableElements.length === 0) {\n event.preventDefault(); // nothing to move to — keep focus on the container rather than letting it escape\n return;\n }\n\n event.preventDefault();\n\n const elements = this._focusableElements;\n const active = deepActiveElement();\n let currentIndex = active ? elements.indexOf(active) : -1;\n // A focused radio that isn't its group's stop (e.g. focused from script) stands for its group\n if (currentIndex === -1 && isNamedRadio(active)) {\n currentIndex = elements.findIndex((el) => isNamedRadio(el) && el.name === active.name && el.form === active.form);\n }\n\n const nextIndex = event.shiftKey\n ? currentIndex <= 0\n ? elements.length - 1\n : currentIndex - 1\n : currentIndex === -1 || currentIndex === elements.length - 1\n ? 0\n : currentIndex + 1;\n\n const next = elements[nextIndex];\n if (next) focusFromKeyboard(next);\n }\n}\n"],"mappings":";;;;;;;AAKA,IAAM,qBAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,IAAI;AAoCX,SAAS,WAAW,IAA0B;AAG5C,MAAI,OAAO,KAAK,IAAI,gBAAgB,UAAU,CAAC,IAAI,EAAG,QAAO;AAC7D,MAAI,KAAK,IAAI,WAAW,mBAAmB,EAAG,QAAO;AACrD,MAAI,OAAO,KAAK,IAAI,iBAAiB,MAAM,WAAY,QAAO,KAAK,IAAI,mBAAmB,EAAE,oBAAoB,KAAK,CAAC;AACtH,SAAO;AACT;AAQA,SAAS,eAAe,MAAiC;AACvD,QAAM,QAAuB,CAAC;AAC9B,aAAW,MAAM,MAAM,KAAK,KAAK,MAAM,oBAAoB,GAAG,CAA4B,GAAG;AAC3F,QAAI,KAAK,IAAI,WAAW,kBAAkB,EAAG,OAAM,KAAK,EAAE;AAC1D,UAAM,SAAS,KAAK,IAAI,YAAY;AACpC,QAAI,OAAQ,OAAM,KAAK,GAAG,eAAe,MAAM,CAAC;AAAA,EAClD;AACA,SAAO;AACT;AAGA,SAAS,oBAAwC;AAC/C,MAAI,SAAS,IAAI;AACjB,SAAO,QAAQ;AACb,UAAM,QAAQ,KAAK,QAAQ,YAAY,GAAG;AAC1C,QAAI,CAAC,MAAO;AACZ,aAAS;AAAA,EACX;AACA,SAAO;AACT;AAEA,SAAS,aAAa,IAA4C;AAChE,SAAO,cAAc,oBAAoB,GAAG,SAAS,WAAW,GAAG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,wBAAwB;AAC7B,QAAI,CAAC,KAAK,sBAAsB,KAAK,mBAAmB,WAAW,GAAG;AACpE,YAAM,eAAe;AACrB;AAAA,IACF;AAEA,UAAM,eAAe;AAErB,UAAM,WAAW,KAAK;AACtB,UAAM,SAAS,kBAAkB;AACjC,QAAI,eAAe,SAAS,SAAS,QAAQ,MAAM,IAAI;AAEvD,QAAI,iBAAiB,MAAM,aAAa,MAAM,GAAG;AAC/C,qBAAe,SAAS,UAAU,CAAC,OAAO,aAAa,EAAE,KAAK,GAAG,SAAS,OAAO,QAAQ,GAAG,SAAS,OAAO,IAAI;AAAA,IAClH;AAEA,UAAM,YAAY,MAAM,WACpB,gBAAgB,IACd,SAAS,SAAS,IAClB,eAAe,IACjB,iBAAiB,MAAM,iBAAiB,SAAS,SAAS,IACxD,IACA,eAAe;AAErB,UAAM,OAAO,SAAS,SAAS;AAC/B,QAAI,KAAM,mBAAkB,IAAI;AAAA,EAClC;AACF;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
h
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KVUJT6BC.js";
|
|
4
4
|
import {
|
|
5
5
|
A11yElement,
|
|
6
6
|
defineElement
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ED3UMYMY.js";
|
|
8
8
|
|
|
9
9
|
// src/components/skeleton/skeleton.element.ts
|
|
10
10
|
var SkeletonElement = class extends A11yElement {
|
|
@@ -47,4 +47,4 @@ defineElement("a11y-skeleton", SkeletonElement);
|
|
|
47
47
|
export {
|
|
48
48
|
SkeletonElement
|
|
49
49
|
};
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
50
|
+
//# sourceMappingURL=chunk-GA3VPLST.js.map
|