@spectrum-web-components/shared 1.12.0-next.20260218162159 → 1.12.0-testing.20260223092154
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/package.json +3 -3
- package/src/first-focusable-in.d.ts +1 -1
- package/src/first-focusable-in.dev.js.map +1 -1
- package/src/first-focusable-in.js.map +1 -1
- package/src/focus-visible.d.ts +1 -1
- package/src/focus-visible.dev.js +14 -2
- package/src/focus-visible.dev.js.map +3 -3
- package/src/focus-visible.js +1 -1
- package/src/focus-visible.js.map +2 -2
- package/src/focusable-selectors.d.ts +1 -1
- package/src/focusable-selectors.dev.js.map +1 -1
- package/src/focusable-selectors.js.map +1 -1
- package/src/focusable.d.ts +2 -1
- package/src/focusable.dev.js +2 -3
- package/src/focusable.dev.js.map +2 -2
- package/src/focusable.js +1 -1
- package/src/focusable.js.map +2 -2
- package/src/get-active-element.d.ts +1 -1
- package/src/get-active-element.dev.js.map +1 -1
- package/src/get-active-element.js.map +1 -1
- package/src/get-deep-element-from-point.d.ts +1 -1
- package/src/get-deep-element-from-point.dev.js.map +1 -1
- package/src/get-deep-element-from-point.js.map +1 -1
- package/src/get-label-from-slot.d.ts +1 -1
- package/src/get-label-from-slot.dev.js.map +1 -1
- package/src/get-label-from-slot.js.map +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.dev.js.map +1 -1
- package/src/index.js.map +1 -1
- package/src/like-anchor.d.ts +1 -1
- package/src/like-anchor.dev.js.map +1 -1
- package/src/like-anchor.js.map +1 -1
- package/src/observe-slot-presence.d.ts +1 -1
- package/src/observe-slot-presence.dev.js.map +1 -1
- package/src/observe-slot-presence.js.map +1 -1
- package/src/observe-slot-text.d.ts +1 -1
- package/src/observe-slot-text.dev.js.map +1 -1
- package/src/observe-slot-text.js.map +1 -1
- package/src/platform.d.ts +1 -1
- package/src/platform.dev.js.map +1 -1
- package/src/platform.js.map +1 -1
- package/src/random-id.d.ts +1 -1
- package/src/random-id.dev.js.map +1 -1
- package/src/random-id.js.map +1 -1
- package/src/reparent-children.dev.js.map +1 -1
- package/src/reparent-children.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spectrum-web-components/shared",
|
|
3
|
-
"version": "1.12.0-
|
|
3
|
+
"version": "1.12.0-testing.20260223092154",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Adobe",
|
|
@@ -96,8 +96,8 @@
|
|
|
96
96
|
"types": "./src/index.d.ts",
|
|
97
97
|
"dependencies": {
|
|
98
98
|
"@lit-labs/observers": "2.0.2",
|
|
99
|
-
"@spectrum-web-components/base": "1.12.0-
|
|
100
|
-
"@spectrum-web-components/core": "0.0.5-
|
|
99
|
+
"@spectrum-web-components/base": "1.12.0-testing.20260223092154",
|
|
100
|
+
"@spectrum-web-components/core": "0.0.5-testing.20260223092154",
|
|
101
101
|
"focus-visible": "5.2.1"
|
|
102
102
|
},
|
|
103
103
|
"keywords": [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["first-focusable-in.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { SpectrumElement } from '@spectrum-web-components/base';\n\nimport { userFocusableSelector } from './focusable-selectors.dev.js'\n\nexport const firstFocusableIn = (\n root: HTMLElement | ShadowRoot\n): SpectrumElement | null => {\n const firstFocusable = root.querySelector(\n userFocusableSelector\n ) as SpectrumElement;\n return firstFocusable;\n};\n\nexport const firstFocusableSlottedIn = (\n root: HTMLSlotElement\n): SpectrumElement | null => {\n const firstFocusable = root\n .assignedElements()\n .find((element) =>\n element.matches(userFocusableSelector)\n ) as SpectrumElement;\n return firstFocusable;\n};\n"],
|
|
5
5
|
"mappings": ";AAcA,SAAS,6BAA6B;AAE/B,aAAM,mBAAmB,CAC9B,SAC2B;AAC3B,QAAM,iBAAiB,KAAK;AAAA,IAC1B;AAAA,EACF;AACA,SAAO;AACT;AAEO,aAAM,0BAA0B,CACrC,SAC2B;AAC3B,QAAM,iBAAiB,KACpB,iBAAiB,EACjB;AAAA,IAAK,CAAC,YACL,QAAQ,QAAQ,qBAAqB;AAAA,EACvC;AACF,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["first-focusable-in.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport type { SpectrumElement } from '@spectrum-web-components/base';\n\nimport { userFocusableSelector } from './focusable-selectors.js';\n\nexport const firstFocusableIn = (\n root: HTMLElement | ShadowRoot\n): SpectrumElement | null => {\n const firstFocusable = root.querySelector(\n userFocusableSelector\n ) as SpectrumElement;\n return firstFocusable;\n};\n\nexport const firstFocusableSlottedIn = (\n root: HTMLSlotElement\n): SpectrumElement | null => {\n const firstFocusable = root\n .assignedElements()\n .find((element) =>\n element.matches(userFocusableSelector)\n ) as SpectrumElement;\n return firstFocusable;\n};\n"],
|
|
5
5
|
"mappings": "aAcA,OAAS,yBAAAA,MAA6B,2BAE/B,aAAM,iBACXC,GAEuBA,EAAK,cAC1BD,CACF,EAIW,wBACXC,GAEuBA,EACpB,iBAAiB,EACjB,KAAMC,GACLA,EAAQ,QAAQF,CAAqB,CACvC",
|
|
6
6
|
"names": ["userFocusableSelector", "root", "element"]
|
|
7
7
|
}
|
package/src/focus-visible.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
package/src/focus-visible.dev.js
CHANGED
|
@@ -3,6 +3,16 @@ let hasFocusVisible = true;
|
|
|
3
3
|
try {
|
|
4
4
|
document.body.querySelector(":focus-visible");
|
|
5
5
|
} catch (error) {
|
|
6
|
+
if (true) {
|
|
7
|
+
window.__swc.warn(
|
|
8
|
+
void 0,
|
|
9
|
+
`The :focus-visible polyfill is not supported in this browser.`,
|
|
10
|
+
"https://github.com/WICG/focus-visible/pull/196",
|
|
11
|
+
{
|
|
12
|
+
issues: [error instanceof Error ? error.message : "Unknown error"]
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
}
|
|
6
16
|
hasFocusVisible = false;
|
|
7
17
|
import("focus-visible");
|
|
8
18
|
}
|
|
@@ -51,7 +61,8 @@ export const FocusVisiblePolyfillMixin = (SuperClass) => {
|
|
|
51
61
|
// Attempt to coordinate with the polyfill when connected to the
|
|
52
62
|
// document:
|
|
53
63
|
connectedCallback() {
|
|
54
|
-
|
|
64
|
+
var _a2;
|
|
65
|
+
(_a2 = super.connectedCallback) == null ? void 0 : _a2.call(this);
|
|
55
66
|
if (!hasFocusVisible) {
|
|
56
67
|
requestAnimationFrame(() => {
|
|
57
68
|
if (this[$endPolyfillCoordination] == null) {
|
|
@@ -61,7 +72,8 @@ export const FocusVisiblePolyfillMixin = (SuperClass) => {
|
|
|
61
72
|
}
|
|
62
73
|
}
|
|
63
74
|
disconnectedCallback() {
|
|
64
|
-
|
|
75
|
+
var _a2;
|
|
76
|
+
(_a2 = super.disconnectedCallback) == null ? void 0 : _a2.call(this);
|
|
65
77
|
if (!hasFocusVisible) {
|
|
66
78
|
requestAnimationFrame(() => {
|
|
67
79
|
if (this[$endPolyfillCoordination] != null) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["focus-visible.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
5
|
-
"mappings": ";AAkCA,IAAI,kBAAkB;AAEtB,IAAI;AACF,WAAS,KAAK,cAAc,gBAAgB;AAC9C,SAAS,OAAO;AACd,oBAAkB;AAGlB,SAAO,eAAe;AACxB;AAcO,aAAM,4BAA4B,CAGvC,eACM;
|
|
6
|
-
"names": []
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\ndeclare global {\n interface Window {\n applyFocusVisiblePolyfill?: (scope: Document | ShadowRoot) => void;\n }\n}\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\ninterface OptionalLifecycleCallbacks {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n manageAutoFocus?(): void;\n}\n\ntype MixableBaseClass = HTMLElement & OptionalLifecycleCallbacks;\n\ntype EndPolyfillCoordinationCallback = () => void;\n\nlet hasFocusVisible = true;\n\ntry {\n document.body.querySelector(':focus-visible');\n} catch (error) {\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n undefined,\n `The :focus-visible polyfill is not supported in this browser.`,\n 'https://github.com/WICG/focus-visible/pull/196',\n {\n issues: [error instanceof Error ? error.message : 'Unknown error'],\n }\n );\n }\n hasFocusVisible = false;\n\n // @ts-ignore\n import('focus-visible');\n}\n\n/**\n * This mixin function is designed to be applied to a class that inherits\n * from HTMLElement. It makes it easy for a custom element to coordinate with\n * the :focus-visible polyfill.\n *\n * NOTE(cdata): The code here was adapted from an example proposed with the\n * introduction of ShadowDOM support in the :focus-visible polyfill.\n *\n * @see https://github.com/WICG/focus-visible/pull/196\n * @param {Function} SuperClass The base class implementation to decorate with\n * implementation that coordinates with the :focus-visible polyfill\n */\nexport const FocusVisiblePolyfillMixin = <\n T extends Constructor<MixableBaseClass>,\n>(\n SuperClass: T\n): T => {\n const coordinateWithPolyfill = (\n instance: MixableBaseClass\n ): EndPolyfillCoordinationCallback => {\n // If there is no shadow root, there is no need to coordinate with\n // the polyfill. If we already coordinated with the polyfill, we can\n // skip subsequent invokcations:\n if (\n instance.shadowRoot == null ||\n instance.hasAttribute('data-js-focus-visible')\n ) {\n return () => {};\n }\n\n // The polyfill might already be loaded. If so, we can apply it to\n // the shadow root immediately:\n if (self.applyFocusVisiblePolyfill) {\n self.applyFocusVisiblePolyfill(instance.shadowRoot);\n\n if (instance.manageAutoFocus) {\n instance.manageAutoFocus();\n }\n } else {\n const coordinationHandler = (): void => {\n if (self.applyFocusVisiblePolyfill && instance.shadowRoot) {\n self.applyFocusVisiblePolyfill(instance.shadowRoot);\n }\n\n if (instance.manageAutoFocus) {\n instance.manageAutoFocus();\n }\n };\n // Otherwise, wait for the polyfill to be loaded lazily. It might\n // never be loaded, but if it is then we can apply it to the\n // shadow root at the appropriate time by waiting for the ready\n // event:\n self.addEventListener(\n 'focus-visible-polyfill-ready',\n coordinationHandler,\n { once: true }\n );\n\n return () => {\n self.removeEventListener(\n 'focus-visible-polyfill-ready',\n coordinationHandler\n );\n };\n }\n\n return () => {};\n };\n\n const $endPolyfillCoordination = Symbol('endPolyfillCoordination');\n\n // IE11 doesn't natively support custom elements or JavaScript class\n // syntax The mixin implementation assumes that the user will take the\n // appropriate steps to support both:\n class FocusVisibleCoordinator extends SuperClass {\n private [$endPolyfillCoordination]: EndPolyfillCoordinationCallback | null =\n null;\n\n // Attempt to coordinate with the polyfill when connected to the\n // document:\n override connectedCallback(): void {\n super.connectedCallback?.();\n if (!hasFocusVisible) {\n requestAnimationFrame(() => {\n if (this[$endPolyfillCoordination] == null) {\n this[$endPolyfillCoordination] = coordinateWithPolyfill(this);\n }\n });\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback?.();\n // It's important to remove the polyfill event listener when we\n // disconnect, otherwise we will leak the whole element via window:\n if (!hasFocusVisible) {\n requestAnimationFrame(() => {\n if (this[$endPolyfillCoordination] != null) {\n this[$endPolyfillCoordination]!();\n this[$endPolyfillCoordination] = null;\n }\n });\n }\n }\n }\n\n return FocusVisibleCoordinator;\n};\n"],
|
|
5
|
+
"mappings": ";AAkCA,IAAI,kBAAkB;AAEtB,IAAI;AACF,WAAS,KAAK,cAAc,gBAAgB;AAC9C,SAAS,OAAO;AACd,MAAI,MAAqB;AACvB,WAAO,MAAM;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MAC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IAES,uBAA6B;AAlJ1C,UAAAA;AAmJM,OAAAA,MAAA,MAAM,yBAAN,gBAAAA,IAAA;AAGA,UAAI,CAAC,iBAAiB;AACpB,8BAAsB,MAAM;AAC1B,cAAI,KAAK,wBAAwB,KAAK,MAAM;AAC1C,iBAAK,wBAAwB,EAAG;AAChC,iBAAK,wBAAwB,IAAI;AAAA,UACnC;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": ["_a"]
|
|
7
7
|
}
|
package/src/focus-visible.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";let
|
|
1
|
+
"use strict";let s=!0;try{document.body.querySelector(":focus-visible")}catch(a){s=!1,import("focus-visible")}export const FocusVisiblePolyfillMixin=a=>{var t,n;const r=o=>{if(o.shadowRoot==null||o.hasAttribute("data-js-focus-visible"))return()=>{};if(self.applyFocusVisiblePolyfill)self.applyFocusVisiblePolyfill(o.shadowRoot),o.manageAutoFocus&&o.manageAutoFocus();else{const i=()=>{self.applyFocusVisiblePolyfill&&o.shadowRoot&&self.applyFocusVisiblePolyfill(o.shadowRoot),o.manageAutoFocus&&o.manageAutoFocus()};return self.addEventListener("focus-visible-polyfill-ready",i,{once:!0}),()=>{self.removeEventListener("focus-visible-polyfill-ready",i)}}return()=>{}},l=Symbol("endPolyfillCoordination");class c extends(n=a,t=l,n){constructor(){super(...arguments);this[t]=null}connectedCallback(){var e;(e=super.connectedCallback)==null||e.call(this),s||requestAnimationFrame(()=>{this[l]==null&&(this[l]=r(this))})}disconnectedCallback(){var e;(e=super.disconnectedCallback)==null||e.call(this),s||requestAnimationFrame(()=>{this[l]!=null&&(this[l](),this[l]=null)})}}return c};
|
|
2
2
|
//# sourceMappingURL=focus-visible.js.map
|
package/src/focus-visible.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["focus-visible.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
5
|
-
"mappings": "aAkCA,IAAIA,EAAkB,GAEtB,GAAI,CACF,SAAS,KAAK,cAAc,gBAAgB,CAC9C,OAASC,EAAO,
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\ndeclare global {\n interface Window {\n applyFocusVisiblePolyfill?: (scope: Document | ShadowRoot) => void;\n }\n}\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\ninterface OptionalLifecycleCallbacks {\n connectedCallback?(): void;\n disconnectedCallback?(): void;\n manageAutoFocus?(): void;\n}\n\ntype MixableBaseClass = HTMLElement & OptionalLifecycleCallbacks;\n\ntype EndPolyfillCoordinationCallback = () => void;\n\nlet hasFocusVisible = true;\n\ntry {\n document.body.querySelector(':focus-visible');\n} catch (error) {\n if (window.__swc?.DEBUG) {\n window.__swc.warn(\n undefined,\n `The :focus-visible polyfill is not supported in this browser.`,\n 'https://github.com/WICG/focus-visible/pull/196',\n {\n issues: [error instanceof Error ? error.message : 'Unknown error'],\n }\n );\n }\n hasFocusVisible = false;\n\n // @ts-ignore\n import('focus-visible');\n}\n\n/**\n * This mixin function is designed to be applied to a class that inherits\n * from HTMLElement. It makes it easy for a custom element to coordinate with\n * the :focus-visible polyfill.\n *\n * NOTE(cdata): The code here was adapted from an example proposed with the\n * introduction of ShadowDOM support in the :focus-visible polyfill.\n *\n * @see https://github.com/WICG/focus-visible/pull/196\n * @param {Function} SuperClass The base class implementation to decorate with\n * implementation that coordinates with the :focus-visible polyfill\n */\nexport const FocusVisiblePolyfillMixin = <\n T extends Constructor<MixableBaseClass>,\n>(\n SuperClass: T\n): T => {\n const coordinateWithPolyfill = (\n instance: MixableBaseClass\n ): EndPolyfillCoordinationCallback => {\n // If there is no shadow root, there is no need to coordinate with\n // the polyfill. If we already coordinated with the polyfill, we can\n // skip subsequent invokcations:\n if (\n instance.shadowRoot == null ||\n instance.hasAttribute('data-js-focus-visible')\n ) {\n return () => {};\n }\n\n // The polyfill might already be loaded. If so, we can apply it to\n // the shadow root immediately:\n if (self.applyFocusVisiblePolyfill) {\n self.applyFocusVisiblePolyfill(instance.shadowRoot);\n\n if (instance.manageAutoFocus) {\n instance.manageAutoFocus();\n }\n } else {\n const coordinationHandler = (): void => {\n if (self.applyFocusVisiblePolyfill && instance.shadowRoot) {\n self.applyFocusVisiblePolyfill(instance.shadowRoot);\n }\n\n if (instance.manageAutoFocus) {\n instance.manageAutoFocus();\n }\n };\n // Otherwise, wait for the polyfill to be loaded lazily. It might\n // never be loaded, but if it is then we can apply it to the\n // shadow root at the appropriate time by waiting for the ready\n // event:\n self.addEventListener(\n 'focus-visible-polyfill-ready',\n coordinationHandler,\n { once: true }\n );\n\n return () => {\n self.removeEventListener(\n 'focus-visible-polyfill-ready',\n coordinationHandler\n );\n };\n }\n\n return () => {};\n };\n\n const $endPolyfillCoordination = Symbol('endPolyfillCoordination');\n\n // IE11 doesn't natively support custom elements or JavaScript class\n // syntax The mixin implementation assumes that the user will take the\n // appropriate steps to support both:\n class FocusVisibleCoordinator extends SuperClass {\n private [$endPolyfillCoordination]: EndPolyfillCoordinationCallback | null =\n null;\n\n // Attempt to coordinate with the polyfill when connected to the\n // document:\n override connectedCallback(): void {\n super.connectedCallback?.();\n if (!hasFocusVisible) {\n requestAnimationFrame(() => {\n if (this[$endPolyfillCoordination] == null) {\n this[$endPolyfillCoordination] = coordinateWithPolyfill(this);\n }\n });\n }\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback?.();\n // It's important to remove the polyfill event listener when we\n // disconnect, otherwise we will leak the whole element via window:\n if (!hasFocusVisible) {\n requestAnimationFrame(() => {\n if (this[$endPolyfillCoordination] != null) {\n this[$endPolyfillCoordination]!();\n this[$endPolyfillCoordination] = null;\n }\n });\n }\n }\n }\n\n return FocusVisibleCoordinator;\n};\n"],
|
|
5
|
+
"mappings": "aAkCA,IAAIA,EAAkB,GAEtB,GAAI,CACF,SAAS,KAAK,cAAc,gBAAgB,CAC9C,OAASC,EAAO,CAWdD,EAAkB,GAGlB,OAAO,eAAe,CACxB,CAcO,aAAM,0BAGXE,GACM,CAvER,IAAAC,EAAAC,EAwEE,MAAMC,EACJC,GACoC,CAIpC,GACEA,EAAS,YAAc,MACvBA,EAAS,aAAa,uBAAuB,EAE7C,MAAO,IAAM,CAAC,EAKhB,GAAI,KAAK,0BACP,KAAK,0BAA0BA,EAAS,UAAU,EAE9CA,EAAS,iBACXA,EAAS,gBAAgB,MAEtB,CACL,MAAMC,EAAsB,IAAY,CAClC,KAAK,2BAA6BD,EAAS,YAC7C,KAAK,0BAA0BA,EAAS,UAAU,EAGhDA,EAAS,iBACXA,EAAS,gBAAgB,CAE7B,EAKA,YAAK,iBACH,+BACAC,EACA,CAAE,KAAM,EAAK,CACf,EAEO,IAAM,CACX,KAAK,oBACH,+BACAA,CACF,CACF,CACF,CAEA,MAAO,IAAM,CAAC,CAChB,EAEMC,EAA2B,OAAO,yBAAyB,EAKjE,MAAMC,UAAgCL,EAAAF,EAC3BC,EAAAK,EAD2BJ,EAAW,CAAjD,kCACE,KAASD,GACP,KAIO,mBAA0B,CAvIvC,IAAAA,GAwIMA,EAAA,MAAM,oBAAN,MAAAA,EAAA,WACKH,GACH,sBAAsB,IAAM,CACtB,KAAKQ,CAAwB,GAAK,OACpC,KAAKA,CAAwB,EAAIH,EAAuB,IAAI,EAEhE,CAAC,CAEL,CAES,sBAA6B,CAlJ1C,IAAAF,GAmJMA,EAAA,MAAM,uBAAN,MAAAA,EAAA,WAGKH,GACH,sBAAsB,IAAM,CACtB,KAAKQ,CAAwB,GAAK,OACpC,KAAKA,CAAwB,EAAG,EAChC,KAAKA,CAAwB,EAAI,KAErC,CAAC,CAEL,CACF,CAEA,OAAOC,CACT",
|
|
6
6
|
"names": ["hasFocusVisible", "error", "SuperClass", "_a", "_b", "coordinateWithPolyfill", "instance", "coordinationHandler", "$endPolyfillCoordination", "FocusVisibleCoordinator"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["focusable-selectors.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Inspired from https://github.com/focus-trap/tabbable/blob/8acf516c29da42c928753950210b07ac32efc724/src/index.js#L6\nconst focusables = [\n 'input:not([inert])',\n 'select:not([inert])',\n 'textarea:not([inert])',\n 'a[href]:not([inert])',\n 'button:not([inert])',\n 'label:not([inert])',\n '[tabindex]:not([inert])',\n 'audio[controls]:not([inert])',\n 'video[controls]:not([inert])',\n '[contenteditable]:not([contenteditable=\"false\"]):not([inert])',\n 'details>summary:first-of-type:not([inert])',\n 'details:not([inert])',\n '[focusable]:not([focusable=\"false\"])', // custom dev use-case\n];\n\nconst userFocuable = ':not([tabindex=\"-1\"])';\n\nexport const userFocusableSelector =\n focusables.join(`${userFocuable}, `) + userFocuable;\n\nexport const focusableSelector = focusables.join(', ');\n"],
|
|
5
5
|
"mappings": ";AAaA,MAAM,aAAa;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AACF;AAEA,MAAM,eAAe;AAEd,aAAM,wBACX,WAAW,KAAK,GAAG,YAAY,IAAI,IAAI;AAElC,aAAM,oBAAoB,WAAW,KAAK,IAAI;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["focusable-selectors.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// Inspired from https://github.com/focus-trap/tabbable/blob/8acf516c29da42c928753950210b07ac32efc724/src/index.js#L6\nconst focusables = [\n 'input:not([inert])',\n 'select:not([inert])',\n 'textarea:not([inert])',\n 'a[href]:not([inert])',\n 'button:not([inert])',\n 'label:not([inert])',\n '[tabindex]:not([inert])',\n 'audio[controls]:not([inert])',\n 'video[controls]:not([inert])',\n '[contenteditable]:not([contenteditable=\"false\"]):not([inert])',\n 'details>summary:first-of-type:not([inert])',\n 'details:not([inert])',\n '[focusable]:not([focusable=\"false\"])', // custom dev use-case\n];\n\nconst userFocuable = ':not([tabindex=\"-1\"])';\n\nexport const userFocusableSelector =\n focusables.join(`${userFocuable}, `) + userFocuable;\n\nexport const focusableSelector = focusables.join(', ');\n"],
|
|
5
5
|
"mappings": "aAaA,MAAMA,EAAa,CACjB,qBACA,sBACA,wBACA,uBACA,sBACA,qBACA,0BACA,+BACA,+BACA,gEACA,6CACA,uBACA,sCACF,EAEMC,EAAe,wBAEd,aAAM,sBACXD,EAAW,KAAK,GAAGC,CAAY,IAAI,EAAIA,EAE5B,kBAAoBD,EAAW,KAAK,IAAI",
|
|
6
6
|
"names": ["focusables", "userFocuable"]
|
|
7
7
|
}
|
package/src/focusable.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -27,6 +27,7 @@ export declare class Focusable extends Focusable_base {
|
|
|
27
27
|
disabled: boolean;
|
|
28
28
|
/**
|
|
29
29
|
* When this control is rendered, focus it automatically
|
|
30
|
+
*
|
|
30
31
|
* @private
|
|
31
32
|
*/
|
|
32
33
|
autofocus: boolean;
|
package/src/focusable.dev.js
CHANGED
|
@@ -222,11 +222,10 @@ export class Focusable extends FocusVisiblePolyfillMixin(SpectrumElement) {
|
|
|
222
222
|
connectedCallback() {
|
|
223
223
|
super.connectedCallback();
|
|
224
224
|
if (this.autofocus) {
|
|
225
|
-
this.autofocusReady =
|
|
225
|
+
this.autofocusReady = (async () => {
|
|
226
226
|
await nextFrame();
|
|
227
227
|
await nextFrame();
|
|
228
|
-
|
|
229
|
-
});
|
|
228
|
+
})();
|
|
230
229
|
this.updateComplete.then(() => {
|
|
231
230
|
this.manageAutoFocus();
|
|
232
231
|
});
|
package/src/focusable.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["focusable.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAWA,SAAyB,uBAAuB;AAChD,SAAS,gBAAgB;AAEzB,SAAS,iCAAiC;AAI1C,SAAS,YAA2B;AAClC,SAAO,IAAI,QAAQ,CAAC,QAAQ,sBAAsB,MAAM,IAAI,CAAC,CAAC;AAChE;AAQO,aAAM,kBAAkB,0BAA0B,eAAe,EAAE;AAAA,EAAnE;AAAA;AAKL,SAAO,WAAW;
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues, SpectrumElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { FocusVisiblePolyfillMixin } from './focus-visible.dev.js'\n\ntype DisableableElement = HTMLElement & { disabled?: boolean };\n\nfunction nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\n/**\n * Focusable base class handles tabindex setting into shadowed elements automatically.\n *\n * This implementation is based heavily on the aybolit delegate-focus-mixin at\n * https://github.com/web-padawan/aybolit/blob/master/packages/core/src/mixins/delegate-focus-mixin.js\n */\nexport class Focusable extends FocusVisiblePolyfillMixin(SpectrumElement) {\n /**\n * Disable this control. It will not receive focus or events\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * When this control is rendered, focus it automatically\n *\n * @private\n */\n @property({ type: Boolean })\n public override autofocus = false;\n\n /**\n * The tab index to apply to this control. See general documentation about\n * the tabindex HTML property\n *\n * @private\n */\n @property({ type: Number })\n public override get tabIndex(): number {\n if (this.focusElement === this) {\n const tabindex = this.hasAttribute('tabindex')\n ? Number(this.getAttribute('tabindex'))\n : NaN;\n return !isNaN(tabindex) ? tabindex : -1;\n }\n const tabIndexAttribute = parseFloat(\n this.hasAttribute('tabindex')\n ? (this.getAttribute('tabindex') as string) || '0'\n : '0'\n );\n // When `disabled` tabindex is -1.\n // When host tabindex -1, use that as the cache.\n if (this.disabled || tabIndexAttribute < 0) {\n return -1;\n }\n // When `focusElement` isn't available yet,\n // use host tabindex as the cache.\n if (!this.focusElement) {\n return tabIndexAttribute;\n }\n // All other times, use the tabindex of `focusElement`\n // as the cache for this value.\n // return this.focusElement.tabIndex;\n return this._tabIndex;\n }\n public override set tabIndex(tabIndex: number) {\n // Flipping `manipulatingTabindex` to true before a change\n // allows for that change NOT to effect the cached value of tabindex\n if (this.manipulatingTabindex) {\n this.manipulatingTabindex = false;\n return;\n }\n\n if (this.focusElement === this) {\n if (this.disabled) {\n this._tabIndex = tabIndex;\n } else if (tabIndex !== this._tabIndex) {\n this._tabIndex = tabIndex;\n const tabindex = '' + tabIndex;\n this.manipulatingTabindex = true;\n this.setAttribute('tabindex', tabindex);\n }\n return;\n }\n\n if (tabIndex === -1) {\n this.addEventListener(\n 'pointerdown',\n this.onPointerdownManagementOfTabIndex\n );\n } else {\n // All code paths are about to address the host tabindex without side effect.\n this.manipulatingTabindex = true;\n this.removeEventListener(\n 'pointerdown',\n this.onPointerdownManagementOfTabIndex\n );\n }\n\n if (tabIndex === -1 || this.disabled) {\n this.manipulatingTabindex = true;\n this.setAttribute('tabindex', '-1');\n this.removeAttribute('focusable');\n\n if (this.selfManageFocusElement) {\n return;\n }\n\n if (tabIndex !== -1) {\n this._tabIndex = tabIndex;\n this.manageFocusElementTabindex(tabIndex);\n } else {\n this.focusElement?.removeAttribute('tabindex');\n }\n return;\n }\n\n this.setAttribute('focusable', '');\n if (this.hasAttribute('tabindex')) {\n this.removeAttribute('tabindex');\n } else {\n // You can't remove an attribute that isn't there,\n // manually end the `manipulatingTabindex` guard.\n this.manipulatingTabindex = false;\n }\n\n this._tabIndex = tabIndex;\n this.manageFocusElementTabindex(tabIndex);\n }\n private _tabIndex = 0;\n\n private onPointerdownManagementOfTabIndex(): void {\n if (this.tabIndex === -1) {\n setTimeout(() => {\n // Ensure this happens _after_ WebKit attempts to focus the :host.\n this.tabIndex = 0;\n this.focus({ preventScroll: true });\n this.tabIndex = -1;\n });\n }\n }\n\n private async manageFocusElementTabindex(tabIndex: number): Promise<void> {\n if (!this.focusElement) {\n // allow setting these values to be async when needed.\n await this.updateComplete;\n }\n if (tabIndex === null) {\n this.focusElement.removeAttribute('tabindex');\n } else {\n if (this.focusElement !== this) {\n this.focusElement.tabIndex = tabIndex;\n }\n }\n }\n\n private manipulatingTabindex = false;\n\n /**\n * @private\n */\n public get focusElement(): DisableableElement {\n throw new Error('Must implement focusElement getter!');\n }\n\n /**\n * @public\n * @returns {boolean} whether the component should manage its focusElement tab-index or not\n * Needed for action-menu to be supported in action-group in an accessible way\n */\n public get selfManageFocusElement(): boolean {\n return false;\n }\n\n public override focus(options?: FocusOptions): void {\n if (this.disabled || !this.focusElement) {\n return;\n }\n\n if (this.focusElement !== this) {\n this.focusElement.focus(options);\n } else {\n HTMLElement.prototype.focus.apply(this, [options]);\n }\n }\n\n public override blur(): void {\n const focusElement = this.focusElement || this;\n if (focusElement !== this) {\n focusElement.blur();\n } else {\n HTMLElement.prototype.blur.apply(this);\n }\n }\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n\n const focusElement = this.focusElement || this;\n if (focusElement !== this) {\n focusElement.click();\n } else {\n HTMLElement.prototype.click.apply(this);\n }\n }\n\n protected manageAutoFocus(): void {\n if (this.autofocus) {\n /**\n * Trick :focus-visible polyfill into thinking keyboard based focus\n *\n * @private\n **/\n this.dispatchEvent(\n new KeyboardEvent('keydown', {\n code: 'Tab',\n })\n );\n this.focusElement.focus();\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (\n !this.hasAttribute('tabindex') ||\n this.getAttribute('tabindex') !== '-1'\n ) {\n this.setAttribute('focusable', '');\n }\n }\n\n protected override update(changedProperties: PropertyValues): void {\n if (changedProperties.has('disabled')) {\n this.handleDisabledChanged(\n this.disabled,\n changedProperties.get('disabled') as boolean\n );\n }\n\n super.update(changedProperties);\n }\n\n protected override updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('disabled') && this.disabled) {\n this.blur();\n }\n }\n\n private async handleDisabledChanged(\n disabled: boolean,\n oldDisabled: boolean\n ): Promise<void> {\n const canSetDisabled = (): boolean =>\n this.focusElement !== this &&\n typeof this.focusElement.disabled !== 'undefined';\n if (disabled) {\n this.manipulatingTabindex = true;\n this.setAttribute('tabindex', '-1');\n await this.updateComplete;\n if (canSetDisabled()) {\n this.focusElement.disabled = true;\n } else {\n this.setAttribute('aria-disabled', 'true');\n }\n } else if (oldDisabled) {\n this.manipulatingTabindex = true;\n if (this.focusElement === this) {\n this.setAttribute('tabindex', '' + this._tabIndex);\n } else {\n this.removeAttribute('tabindex');\n }\n await this.updateComplete;\n if (canSetDisabled()) {\n this.focusElement.disabled = false;\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n }\n\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.autofocusReady;\n return complete;\n }\n\n private autofocusReady = Promise.resolve();\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (this.autofocus) {\n // If at connect time the [autofocus] content is placed within\n // content that needs to be \"hidden\" by default, it would need to wait\n // two rAFs for animations to be triggered on that content in\n // order for the [autofocus] to become \"visible\" and have its\n // focus() capabilities enabled.\n //\n // Await this with `getUpdateComplete` so that the element cannot\n // become \"ready\" until `manageFocus` has occurred.\n this.autofocusReady = (async () => {\n await nextFrame();\n await nextFrame();\n })();\n this.updateComplete.then(() => {\n this.manageAutoFocus();\n });\n }\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;AAWA,SAAyB,uBAAuB;AAChD,SAAS,gBAAgB;AAEzB,SAAS,iCAAiC;AAI1C,SAAS,YAA2B;AAClC,SAAO,IAAI,QAAQ,CAAC,QAAQ,sBAAsB,MAAM,IAAI,CAAC,CAAC;AAChE;AAQO,aAAM,kBAAkB,0BAA0B,eAAe,EAAE;AAAA,EAAnE;AAAA;AAKL,SAAO,WAAW;AAQlB,SAAgB,YAAY;AAoG5B,SAAQ,YAAY;AA2BpB,SAAQ,uBAAuB;AAuI/B,SAAQ,iBAAiB,QAAQ,QAAQ;AAAA;AAAA,EA7PzC,IAAoB,WAAmB;AACrC,QAAI,KAAK,iBAAiB,MAAM;AAC9B,YAAM,WAAW,KAAK,aAAa,UAAU,IACzC,OAAO,KAAK,aAAa,UAAU,CAAC,IACpC;AACJ,aAAO,CAAC,MAAM,QAAQ,IAAI,WAAW;AAAA,IACvC;AACA,UAAM,oBAAoB;AAAA,MACxB,KAAK,aAAa,UAAU,IACvB,KAAK,aAAa,UAAU,KAAgB,MAC7C;AAAA,IACN;AAGA,QAAI,KAAK,YAAY,oBAAoB,GAAG;AAC1C,aAAO;AAAA,IACT;AAGA,QAAI,CAAC,KAAK,cAAc;AACtB,aAAO;AAAA,IACT;AAIA,WAAO,KAAK;AAAA,EACd;AAAA,EACA,IAAoB,SAAS,UAAkB;AA7EjD;AAgFI,QAAI,KAAK,sBAAsB;AAC7B,WAAK,uBAAuB;AAC5B;AAAA,IACF;AAEA,QAAI,KAAK,iBAAiB,MAAM;AAC9B,UAAI,KAAK,UAAU;AACjB,aAAK,YAAY;AAAA,MACnB,WAAW,aAAa,KAA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B;AAAA,MACvB,CAAC;AAAA,IACH;AAAA,EACF;AACF;AApSS;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAJ/B,UAKJ;AAQS;AAAA,EADf,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GAZhB,UAaK;AASI;AAAA,EADnB,SAAS,EAAE,MAAM,OAAO,CAAC;AAAA,GArBf,UAsBS;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/focusable.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var n=(s,a,e,t)=>{for(var i=t>1?void 0:t?b(a,e):a,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(t?r(a,e,i):r(i))||i);return t&&i&&d(a,e,i),i};import{SpectrumElement as h}from"@spectrum-web-components/base";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import{FocusVisiblePolyfillMixin as
|
|
1
|
+
"use strict";var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var n=(s,a,e,t)=>{for(var i=t>1?void 0:t?b(a,e):a,o=s.length-1,r;o>=0;o--)(r=s[o])&&(i=(t?r(a,e,i):r(i))||i);return t&&i&&d(a,e,i),i};import{SpectrumElement as h}from"@spectrum-web-components/base";import{property as l}from"@spectrum-web-components/base/src/decorators.js";import{FocusVisiblePolyfillMixin as f}from"./focus-visible.js";function u(){return new Promise(s=>requestAnimationFrame(()=>s()))}export class Focusable extends f(h){constructor(){super(...arguments);this.disabled=!1;this.autofocus=!1;this._tabIndex=0;this.manipulatingTabindex=!1;this.autofocusReady=Promise.resolve()}get tabIndex(){if(this.focusElement===this){const t=this.hasAttribute("tabindex")?Number(this.getAttribute("tabindex")):NaN;return isNaN(t)?-1:t}const e=parseFloat(this.hasAttribute("tabindex")&&this.getAttribute("tabindex")||"0");return this.disabled||e<0?-1:this.focusElement?this._tabIndex:e}set tabIndex(e){var t;if(this.manipulatingTabindex){this.manipulatingTabindex=!1;return}if(this.focusElement===this){if(this.disabled)this._tabIndex=e;else if(e!==this._tabIndex){this._tabIndex=e;const i=""+e;this.manipulatingTabindex=!0,this.setAttribute("tabindex",i)}return}if(e===-1?this.addEventListener("pointerdown",this.onPointerdownManagementOfTabIndex):(this.manipulatingTabindex=!0,this.removeEventListener("pointerdown",this.onPointerdownManagementOfTabIndex)),e===-1||this.disabled){if(this.manipulatingTabindex=!0,this.setAttribute("tabindex","-1"),this.removeAttribute("focusable"),this.selfManageFocusElement)return;e!==-1?(this._tabIndex=e,this.manageFocusElementTabindex(e)):(t=this.focusElement)==null||t.removeAttribute("tabindex");return}this.setAttribute("focusable",""),this.hasAttribute("tabindex")?this.removeAttribute("tabindex"):this.manipulatingTabindex=!1,this._tabIndex=e,this.manageFocusElementTabindex(e)}onPointerdownManagementOfTabIndex(){this.tabIndex===-1&&setTimeout(()=>{this.tabIndex=0,this.focus({preventScroll:!0}),this.tabIndex=-1})}async manageFocusElementTabindex(e){this.focusElement||await this.updateComplete,e===null?this.focusElement.removeAttribute("tabindex"):this.focusElement!==this&&(this.focusElement.tabIndex=e)}get focusElement(){throw new Error("Must implement focusElement getter!")}get selfManageFocusElement(){return!1}focus(e){this.disabled||!this.focusElement||(this.focusElement!==this?this.focusElement.focus(e):HTMLElement.prototype.focus.apply(this,[e]))}blur(){const e=this.focusElement||this;e!==this?e.blur():HTMLElement.prototype.blur.apply(this)}click(){if(this.disabled)return;const e=this.focusElement||this;e!==this?e.click():HTMLElement.prototype.click.apply(this)}manageAutoFocus(){this.autofocus&&(this.dispatchEvent(new KeyboardEvent("keydown",{code:"Tab"})),this.focusElement.focus())}firstUpdated(e){super.firstUpdated(e),(!this.hasAttribute("tabindex")||this.getAttribute("tabindex")!=="-1")&&this.setAttribute("focusable","")}update(e){e.has("disabled")&&this.handleDisabledChanged(this.disabled,e.get("disabled")),super.update(e)}updated(e){super.updated(e),e.has("disabled")&&this.disabled&&this.blur()}async handleDisabledChanged(e,t){const i=()=>this.focusElement!==this&&typeof this.focusElement.disabled!="undefined";e?(this.manipulatingTabindex=!0,this.setAttribute("tabindex","-1"),await this.updateComplete,i()?this.focusElement.disabled=!0:this.setAttribute("aria-disabled","true")):t&&(this.manipulatingTabindex=!0,this.focusElement===this?this.setAttribute("tabindex",""+this._tabIndex):this.removeAttribute("tabindex"),await this.updateComplete,i()?this.focusElement.disabled=!1:this.removeAttribute("aria-disabled"))}async getUpdateComplete(){const e=await super.getUpdateComplete();return await this.autofocusReady,e}connectedCallback(){super.connectedCallback(),this.autofocus&&(this.autofocusReady=(async()=>{await u(),await u()})(),this.updateComplete.then(()=>{this.manageAutoFocus()}))}}n([l({type:Boolean,reflect:!0})],Focusable.prototype,"disabled",2),n([l({type:Boolean})],Focusable.prototype,"autofocus",2),n([l({type:Number})],Focusable.prototype,"tabIndex",1);
|
|
2
2
|
//# sourceMappingURL=focusable.js.map
|
package/src/focusable.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["focusable.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
5
|
-
"mappings": "qNAWA,OAAyB,mBAAAA,MAAuB,gCAChD,OAAS,YAAAC,MAAgB,kDAEzB,OAAS,6BAAAC,MAAiC,qBAI1C,SAASC,GAA2B,CAClC,OAAO,IAAI,QAASC,GAAQ,sBAAsB,IAAMA,EAAI,CAAC,CAAC,CAChE,CAQO,aAAM,kBAAkBF,EAA0BF,CAAe,CAAE,CAAnE,kCAKL,KAAO,SAAW,
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { PropertyValues, SpectrumElement } from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { FocusVisiblePolyfillMixin } from './focus-visible.js';\n\ntype DisableableElement = HTMLElement & { disabled?: boolean };\n\nfunction nextFrame(): Promise<void> {\n return new Promise((res) => requestAnimationFrame(() => res()));\n}\n\n/**\n * Focusable base class handles tabindex setting into shadowed elements automatically.\n *\n * This implementation is based heavily on the aybolit delegate-focus-mixin at\n * https://github.com/web-padawan/aybolit/blob/master/packages/core/src/mixins/delegate-focus-mixin.js\n */\nexport class Focusable extends FocusVisiblePolyfillMixin(SpectrumElement) {\n /**\n * Disable this control. It will not receive focus or events\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * When this control is rendered, focus it automatically\n *\n * @private\n */\n @property({ type: Boolean })\n public override autofocus = false;\n\n /**\n * The tab index to apply to this control. See general documentation about\n * the tabindex HTML property\n *\n * @private\n */\n @property({ type: Number })\n public override get tabIndex(): number {\n if (this.focusElement === this) {\n const tabindex = this.hasAttribute('tabindex')\n ? Number(this.getAttribute('tabindex'))\n : NaN;\n return !isNaN(tabindex) ? tabindex : -1;\n }\n const tabIndexAttribute = parseFloat(\n this.hasAttribute('tabindex')\n ? (this.getAttribute('tabindex') as string) || '0'\n : '0'\n );\n // When `disabled` tabindex is -1.\n // When host tabindex -1, use that as the cache.\n if (this.disabled || tabIndexAttribute < 0) {\n return -1;\n }\n // When `focusElement` isn't available yet,\n // use host tabindex as the cache.\n if (!this.focusElement) {\n return tabIndexAttribute;\n }\n // All other times, use the tabindex of `focusElement`\n // as the cache for this value.\n // return this.focusElement.tabIndex;\n return this._tabIndex;\n }\n public override set tabIndex(tabIndex: number) {\n // Flipping `manipulatingTabindex` to true before a change\n // allows for that change NOT to effect the cached value of tabindex\n if (this.manipulatingTabindex) {\n this.manipulatingTabindex = false;\n return;\n }\n\n if (this.focusElement === this) {\n if (this.disabled) {\n this._tabIndex = tabIndex;\n } else if (tabIndex !== this._tabIndex) {\n this._tabIndex = tabIndex;\n const tabindex = '' + tabIndex;\n this.manipulatingTabindex = true;\n this.setAttribute('tabindex', tabindex);\n }\n return;\n }\n\n if (tabIndex === -1) {\n this.addEventListener(\n 'pointerdown',\n this.onPointerdownManagementOfTabIndex\n );\n } else {\n // All code paths are about to address the host tabindex without side effect.\n this.manipulatingTabindex = true;\n this.removeEventListener(\n 'pointerdown',\n this.onPointerdownManagementOfTabIndex\n );\n }\n\n if (tabIndex === -1 || this.disabled) {\n this.manipulatingTabindex = true;\n this.setAttribute('tabindex', '-1');\n this.removeAttribute('focusable');\n\n if (this.selfManageFocusElement) {\n return;\n }\n\n if (tabIndex !== -1) {\n this._tabIndex = tabIndex;\n this.manageFocusElementTabindex(tabIndex);\n } else {\n this.focusElement?.removeAttribute('tabindex');\n }\n return;\n }\n\n this.setAttribute('focusable', '');\n if (this.hasAttribute('tabindex')) {\n this.removeAttribute('tabindex');\n } else {\n // You can't remove an attribute that isn't there,\n // manually end the `manipulatingTabindex` guard.\n this.manipulatingTabindex = false;\n }\n\n this._tabIndex = tabIndex;\n this.manageFocusElementTabindex(tabIndex);\n }\n private _tabIndex = 0;\n\n private onPointerdownManagementOfTabIndex(): void {\n if (this.tabIndex === -1) {\n setTimeout(() => {\n // Ensure this happens _after_ WebKit attempts to focus the :host.\n this.tabIndex = 0;\n this.focus({ preventScroll: true });\n this.tabIndex = -1;\n });\n }\n }\n\n private async manageFocusElementTabindex(tabIndex: number): Promise<void> {\n if (!this.focusElement) {\n // allow setting these values to be async when needed.\n await this.updateComplete;\n }\n if (tabIndex === null) {\n this.focusElement.removeAttribute('tabindex');\n } else {\n if (this.focusElement !== this) {\n this.focusElement.tabIndex = tabIndex;\n }\n }\n }\n\n private manipulatingTabindex = false;\n\n /**\n * @private\n */\n public get focusElement(): DisableableElement {\n throw new Error('Must implement focusElement getter!');\n }\n\n /**\n * @public\n * @returns {boolean} whether the component should manage its focusElement tab-index or not\n * Needed for action-menu to be supported in action-group in an accessible way\n */\n public get selfManageFocusElement(): boolean {\n return false;\n }\n\n public override focus(options?: FocusOptions): void {\n if (this.disabled || !this.focusElement) {\n return;\n }\n\n if (this.focusElement !== this) {\n this.focusElement.focus(options);\n } else {\n HTMLElement.prototype.focus.apply(this, [options]);\n }\n }\n\n public override blur(): void {\n const focusElement = this.focusElement || this;\n if (focusElement !== this) {\n focusElement.blur();\n } else {\n HTMLElement.prototype.blur.apply(this);\n }\n }\n\n public override click(): void {\n if (this.disabled) {\n return;\n }\n\n const focusElement = this.focusElement || this;\n if (focusElement !== this) {\n focusElement.click();\n } else {\n HTMLElement.prototype.click.apply(this);\n }\n }\n\n protected manageAutoFocus(): void {\n if (this.autofocus) {\n /**\n * Trick :focus-visible polyfill into thinking keyboard based focus\n *\n * @private\n **/\n this.dispatchEvent(\n new KeyboardEvent('keydown', {\n code: 'Tab',\n })\n );\n this.focusElement.focus();\n }\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (\n !this.hasAttribute('tabindex') ||\n this.getAttribute('tabindex') !== '-1'\n ) {\n this.setAttribute('focusable', '');\n }\n }\n\n protected override update(changedProperties: PropertyValues): void {\n if (changedProperties.has('disabled')) {\n this.handleDisabledChanged(\n this.disabled,\n changedProperties.get('disabled') as boolean\n );\n }\n\n super.update(changedProperties);\n }\n\n protected override updated(changedProperties: PropertyValues): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('disabled') && this.disabled) {\n this.blur();\n }\n }\n\n private async handleDisabledChanged(\n disabled: boolean,\n oldDisabled: boolean\n ): Promise<void> {\n const canSetDisabled = (): boolean =>\n this.focusElement !== this &&\n typeof this.focusElement.disabled !== 'undefined';\n if (disabled) {\n this.manipulatingTabindex = true;\n this.setAttribute('tabindex', '-1');\n await this.updateComplete;\n if (canSetDisabled()) {\n this.focusElement.disabled = true;\n } else {\n this.setAttribute('aria-disabled', 'true');\n }\n } else if (oldDisabled) {\n this.manipulatingTabindex = true;\n if (this.focusElement === this) {\n this.setAttribute('tabindex', '' + this._tabIndex);\n } else {\n this.removeAttribute('tabindex');\n }\n await this.updateComplete;\n if (canSetDisabled()) {\n this.focusElement.disabled = false;\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n }\n\n protected override async getUpdateComplete(): Promise<boolean> {\n const complete = (await super.getUpdateComplete()) as boolean;\n await this.autofocusReady;\n return complete;\n }\n\n private autofocusReady = Promise.resolve();\n\n public override connectedCallback(): void {\n super.connectedCallback();\n if (this.autofocus) {\n // If at connect time the [autofocus] content is placed within\n // content that needs to be \"hidden\" by default, it would need to wait\n // two rAFs for animations to be triggered on that content in\n // order for the [autofocus] to become \"visible\" and have its\n // focus() capabilities enabled.\n //\n // Await this with `getUpdateComplete` so that the element cannot\n // become \"ready\" until `manageFocus` has occurred.\n this.autofocusReady = (async () => {\n await nextFrame();\n await nextFrame();\n })();\n this.updateComplete.then(() => {\n this.manageAutoFocus();\n });\n }\n }\n}\n"],
|
|
5
|
+
"mappings": "qNAWA,OAAyB,mBAAAA,MAAuB,gCAChD,OAAS,YAAAC,MAAgB,kDAEzB,OAAS,6BAAAC,MAAiC,qBAI1C,SAASC,GAA2B,CAClC,OAAO,IAAI,QAASC,GAAQ,sBAAsB,IAAMA,EAAI,CAAC,CAAC,CAChE,CAQO,aAAM,kBAAkBF,EAA0BF,CAAe,CAAE,CAAnE,kCAKL,KAAO,SAAW,GAQlB,KAAgB,UAAY,GAoG5B,KAAQ,UAAY,EA2BpB,KAAQ,qBAAuB,GAuI/B,KAAQ,eAAiB,QAAQ,QAAQ,EA7PzC,IAAoB,UAAmB,CACrC,GAAI,KAAK,eAAiB,KAAM,CAC9B,MAAMK,EAAW,KAAK,aAAa,UAAU,EACzC,OAAO,KAAK,aAAa,UAAU,CAAC,EACpC,IACJ,OAAQ,MAAMA,CAAQ,EAAe,GAAXA,CAC5B,CACA,MAAMC,EAAoB,WACxB,K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a,WAAY,IAAI,EAClC,MAAM,KAAK,eACPE,EAAe,EACjB,KAAK,aAAa,SAAW,GAE7B,KAAK,aAAa,gBAAiB,MAAM,GAElCD,IACT,KAAK,qBAAuB,GACxB,KAAK,eAAiB,KACxB,KAAK,aAAa,WAAY,GAAK,KAAK,SAAS,EAEjD,KAAK,gBAAgB,UAAU,EAEjC,MAAM,KAAK,eACPC,EAAe,EACjB,KAAK,aAAa,SAAW,GAE7B,KAAK,gBAAgB,eAAe,EAG1C,CAEA,MAAyB,mBAAsC,CAC7D,MAAMC,EAAY,MAAM,MAAM,kBAAkB,EAChD,aAAM,KAAK,eACJA,CACT,CAIgB,mBAA0B,CACxC,MAAM,kBAAkB,EACpB,KAAK,YASP,KAAK,gBAAkB,SAAY,CACjC,MAAMb,EAAU,EAChB,MAAMA,EAAU,CAClB,GAAG,EACH,KAAK,eAAe,KAAK,IAAM,CAC7B,KAAK,gBAAgB,CACvB,CAAC,EAEL,CACF,CApSSc,EAAA,CADNhB,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAJ/B,UAKJ,wBAQSgB,EAAA,CADfhB,EAAS,CAAE,KAAM,OAAQ,CAAC,GAZhB,UAaK,yBASIgB,EAAA,CADnBhB,EAAS,CAAE,KAAM,MAAO,CAAC,GArBf,UAsBS",
|
|
6
6
|
"names": ["SpectrumElement", "property", "FocusVisiblePolyfillMixin", "nextFrame", "res", "tabindex", "tabIndexAttribute", "tabIndex", "_a", "options", "focusElement", "changes", "changedProperties", "disabled", "oldDisabled", "canSetDisabled", "complete", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-active-element.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/* c8 ignore next 3 */\nexport const getActiveElement = (el: Node): Element | null => {\n return (el.getRootNode() as Document).activeElement;\n};\n"],
|
|
5
5
|
"mappings": ";AAaO,aAAM,mBAAmB,CAAC,OAA6B;AAC5D,SAAQ,GAAG,YAAY,EAAe;AACxC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-active-element.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/* c8 ignore next 3 */\nexport const getActiveElement = (el: Node): Element | null => {\n return (el.getRootNode() as Document).activeElement;\n};\n"],
|
|
5
5
|
"mappings": "aAaO,aAAM,iBAAoBA,GACvBA,EAAG,YAAY,EAAe",
|
|
6
6
|
"names": ["el"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-deep-element-from-point.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport const getDeepElementFromPoint = (\n x: number,\n y: number\n): Element | null => {\n let target = document.elementFromPoint(x, y);\n while (target?.shadowRoot) {\n const innerTarget = (\n target.shadowRoot as unknown as {\n elementFromPoint: (x: number, y: number) => Element | null;\n }\n ).elementFromPoint(x, y);\n if (!innerTarget || innerTarget === target) {\n break;\n }\n target = innerTarget;\n }\n return target;\n};\n"],
|
|
5
5
|
"mappings": ";AAYO,aAAM,0BAA0B,CACrC,GACA,MACmB;AACnB,MAAI,SAAS,SAAS,iBAAiB,GAAG,CAAC;AAC3C,SAAO,iCAAQ,YAAY;AACzB,UAAM,cACJ,OAAO,WAGP,iBAAiB,GAAG,CAAC;AACvB,QAAI,CAAC,eAAe,gBAAgB,QAAQ;AAC1C;AAAA,IACF;AACA,aAAS;AAAA,EACX;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-deep-element-from-point.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport const getDeepElementFromPoint = (\n x: number,\n y: number\n): Element | null => {\n let target = document.elementFromPoint(x, y);\n while (target?.shadowRoot) {\n const innerTarget = (\n target.shadowRoot as unknown as {\n elementFromPoint: (x: number, y: number) => Element | null;\n }\n ).elementFromPoint(x, y);\n if (!innerTarget || innerTarget === target) {\n break;\n }\n target = innerTarget;\n }\n return target;\n};\n"],
|
|
5
5
|
"mappings": "aAYO,aAAM,wBAA0B,CACrCA,EACAC,IACmB,CACnB,IAAIC,EAAS,SAAS,iBAAiBF,EAAGC,CAAC,EAC3C,KAAOC,GAAA,MAAAA,EAAQ,YAAY,CACzB,MAAMC,EACJD,EAAO,WAGP,iBAAiBF,EAAGC,CAAC,EACvB,GAAI,CAACE,GAAeA,IAAgBD,EAClC,MAEFA,EAASC,CACX,CACA,OAAOD,CACT",
|
|
6
6
|
"names": ["x", "y", "target", "innerTarget"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-label-from-slot.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport { getLabelFromSlot } from '@spectrum-web-components/core/utils/get-label-from-slot.js';\n"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-label-from-slot.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport { getLabelFromSlot } from '@spectrum-web-components/core/utils/get-label-from-slot.js';\n"],
|
|
5
5
|
"mappings": "aAWA,OAAS,qBAAwB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
package/src/index.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport * from './first-focusable-in.dev.js'\nexport * from './focus-visible.dev.js'\nexport * from './focusable.dev.js'\nexport * from './focusable-selectors.dev.js'\nexport * from './get-active-element.dev.js'\nexport * from './like-anchor.dev.js'\nexport * from './observe-slot-presence.dev.js'\nexport * from './observe-slot-text.dev.js'\nexport * from './platform.dev.js'\nexport * from './reparent-children.dev.js'\nexport * from './get-label-from-slot.dev.js'\nexport * from './random-id.dev.js'\n"],
|
|
5
5
|
"mappings": ";AAWA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport * from './first-focusable-in.js';\nexport * from './focus-visible.js';\nexport * from './focusable.js';\nexport * from './focusable-selectors.js';\nexport * from './get-active-element.js';\nexport * from './like-anchor.js';\nexport * from './observe-slot-presence.js';\nexport * from './observe-slot-text.js';\nexport * from './platform.js';\nexport * from './reparent-children.js';\nexport * from './get-label-from-slot.js';\nexport * from './random-id.js';\n"],
|
|
5
5
|
"mappings": "aAWA,WAAc,0BACd,WAAc,qBACd,WAAc,iBACd,WAAc,2BACd,WAAc,0BACd,WAAc,mBACd,WAAc,6BACd,WAAc,yBACd,WAAc,gBACd,WAAc,yBACd,WAAc,2BACd,WAAc",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/like-anchor.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["like-anchor.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n html,\n ReactiveElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\ntype RenderAnchorOptions = {\n id: string;\n className?: string;\n ariaHidden?: boolean;\n anchorContent?: TemplateResult | TemplateResult[];\n labelledby?: string;\n tabindex?: -1 | 0;\n};\n\nexport interface LikeAnchorInterface {\n download?: string;\n label?: string;\n href?: string;\n rel?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n renderAnchor(options: RenderAnchorOptions): TemplateResult;\n}\n\nexport function LikeAnchor<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<LikeAnchorInterface> {\n class LikeAnchorElement extends constructor {\n /**\n * Causes the browser to treat the linked URL as a download.\n */\n @property()\n public download?: string;\n\n /**\n * An accessible label that describes the component.\n * It will be applied to aria-label, but not visually rendered.\n */\n @property()\n public label?: string;\n\n /**\n * The URL that the hyperlink points to.\n */\n @property()\n public href?: string;\n\n /**\n * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).\n */\n @property()\n public target?: '_blank' | '_parent' | '_self' | '_top';\n\n /**\n * How much of the referrer to send when following the link.\n */\n @property()\n public referrerpolicy?:\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'same-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n\n /**\n * The relationship of the linked URL as space-separated link types.\n */\n @property()\n public rel?: string;\n\n public renderAnchor({\n id,\n className,\n ariaHidden,\n labelledby,\n tabindex,\n // prettier-ignore\n anchorContent = html`<slot></slot>`,\n }: RenderAnchorOptions): TemplateResult {\n // prettier-ignore\n return html\n `<a\n id=${id}\n class=${ifDefined(className)}\n href=${ifDefined(this.href)}\n download=${ifDefined(this.download)}\n target=${ifDefined(this.target)}\n aria-label=${ifDefined(this.label)}\n aria-labelledby=${ifDefined(labelledby)}\n aria-hidden=${ifDefined(ariaHidden ? 'true' : undefined)}\n tabindex=${ifDefined(tabindex)}\n referrerpolicy=${ifDefined(this.referrerpolicy)}\n rel=${ifDefined(this.rel)}\n >${anchorContent}</a>`;\n }\n }\n return LikeAnchorElement;\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;AAWA;AAAA,EACE;AAAA,OAGK;AACP,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AA0BnB,gBAAS,WACd,aACsC;AAAA,EACtC,MAAM,0BAA0B,YAAY;AAAA,IA8CnC,aAAa;AAAA,MAClB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAEA,gBAAgB;AAAA,IAClB,GAAwC;AAEtC,aAAO;AAAA,yBAEY,EAAE;AAAA,4BACC,UAAU,SAAS,CAAC;AAAA,2BACrB,UAAU,KAAK,IAAI,CAAC;AAAA,+BAChB,UAAU,KAAK,QAAQ,CAAC;AAAA,6BAC1B,UAAU,KAAK,MAAM,CAAC;AAAA,iCAClB,UAAU,KAAK,KAAK,CAAC;AAAA,sCAChB,UAAU,UAAU,CAAC;AAAA,kCACzB,UAAU,aAAa,SAAS,MAAS,CAAC;AAAA,+BAC7C,UAAU,QAAQ,CAAC;AAAA,qCACb,UAAU,KAAK,cAAc,CAAC;AAAA,0BACzC,UAAU,KAAK,GAAG,CAAC;AAAA,mBAC1B,aAAa;AAAA,IAC5B;AAAA,EACF;AAlES;AAAA,IADN,SAAS;AAAA,KAJN,kBAKG;AAOA;AAAA,IADN,SAAS;AAAA,KAXN,kBAYG;AAMA;AAAA,IADN,SAAS;AAAA,KAjBN,kBAkBG;AAMA;AAAA,IADN,SAAS;AAAA,KAvBN,kBAwBG;AAMA;AAAA,IADN,SAAS;AAAA,KA7BN,kBA8BG;AAcA;AAAA,IADN,SAAS;AAAA,KA3CN,kBA4CG;AA4BT,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/like-anchor.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["like-anchor.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n html,\n ReactiveElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\nimport { ifDefined } from '@spectrum-web-components/base/src/directives.js';\n\ntype Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\ntype RenderAnchorOptions = {\n id: string;\n className?: string;\n ariaHidden?: boolean;\n anchorContent?: TemplateResult | TemplateResult[];\n labelledby?: string;\n tabindex?: -1 | 0;\n};\n\nexport interface LikeAnchorInterface {\n download?: string;\n label?: string;\n href?: string;\n rel?: string;\n target?: '_blank' | '_parent' | '_self' | '_top';\n renderAnchor(options: RenderAnchorOptions): TemplateResult;\n}\n\nexport function LikeAnchor<T extends Constructor<ReactiveElement>>(\n constructor: T\n): T & Constructor<LikeAnchorInterface> {\n class LikeAnchorElement extends constructor {\n /**\n * Causes the browser to treat the linked URL as a download.\n */\n @property()\n public download?: string;\n\n /**\n * An accessible label that describes the component.\n * It will be applied to aria-label, but not visually rendered.\n */\n @property()\n public label?: string;\n\n /**\n * The URL that the hyperlink points to.\n */\n @property()\n public href?: string;\n\n /**\n * Where to display the linked URL, as the name for a browsing context (a tab, window, or <iframe>).\n */\n @property()\n public target?: '_blank' | '_parent' | '_self' | '_top';\n\n /**\n * How much of the referrer to send when following the link.\n */\n @property()\n public referrerpolicy?:\n | 'no-referrer'\n | 'no-referrer-when-downgrade'\n | 'origin'\n | 'origin-when-cross-origin'\n | 'same-origin'\n | 'strict-origin'\n | 'strict-origin-when-cross-origin'\n | 'unsafe-url';\n\n /**\n * The relationship of the linked URL as space-separated link types.\n */\n @property()\n public rel?: string;\n\n public renderAnchor({\n id,\n className,\n ariaHidden,\n labelledby,\n tabindex,\n // prettier-ignore\n anchorContent = html`<slot></slot>`,\n }: RenderAnchorOptions): TemplateResult {\n // prettier-ignore\n return html\n `<a\n id=${id}\n class=${ifDefined(className)}\n href=${ifDefined(this.href)}\n download=${ifDefined(this.download)}\n target=${ifDefined(this.target)}\n aria-label=${ifDefined(this.label)}\n aria-labelledby=${ifDefined(labelledby)}\n aria-hidden=${ifDefined(ariaHidden ? 'true' : undefined)}\n tabindex=${ifDefined(tabindex)}\n referrerpolicy=${ifDefined(this.referrerpolicy)}\n rel=${ifDefined(this.rel)}\n >${anchorContent}</a>`;\n }\n }\n return LikeAnchorElement;\n}\n"],
|
|
5
5
|
"mappings": "qNAWA,OACE,QAAAA,MAGK,gCACP,OAAS,YAAAC,MAAgB,kDACzB,OAAS,aAAAC,MAAiB,kDA0BnB,gBAAS,WACdC,EACsC,CACtC,MAAMC,UAA0BD,CAAY,CA8CnC,aAAa,CAClB,GAAAE,EACA,UAAAC,EACA,WAAAC,EACA,WAAAC,EACA,SAAAC,EAEA,cAAAC,EAAgBV,gBAClB,EAAwC,CAEtC,OAAOA;AAAA,yBAEYK,CAAE;AAAA,4BACCH,EAAUI,CAAS,CAAC;AAAA,2BACrBJ,EAAU,KAAK,IAAI,CAAC;AAAA,+BAChBA,EAAU,KAAK,QAAQ,CAAC;AAAA,6BAC1BA,EAAU,KAAK,MAAM,CAAC;AAAA,iCAClBA,EAAU,KAAK,KAAK,CAAC;AAAA,sCAChBA,EAAUM,CAAU,CAAC;AAAA,kCACzBN,EAAUK,EAAa,OAAS,MAAS,CAAC;AAAA,+BAC7CL,EAAUO,CAAQ,CAAC;AAAA,qCACbP,EAAU,KAAK,cAAc,CAAC;AAAA,0BACzCA,EAAU,KAAK,GAAG,CAAC;AAAA,mBAC1BQ,CAAa,MAC5B,CACF,CAlES,OAAAC,EAAA,CADNV,EAAS,GAJNG,EAKG,wBAOAO,EAAA,CADNV,EAAS,GAXNG,EAYG,qBAMAO,EAAA,CADNV,EAAS,GAjBNG,EAkBG,oBAMAO,EAAA,CADNV,EAAS,GAvBNG,EAwBG,sBAMAO,EAAA,CADNV,EAAS,GA7BNG,EA8BG,8BAcAO,EAAA,CADNV,EAAS,GA3CNG,EA4CG,mBA4BFA,CACT",
|
|
6
6
|
"names": ["html", "property", "ifDefined", "constructor", "LikeAnchorElement", "id", "className", "ariaHidden", "labelledby", "tabindex", "anchorContent", "__decorateClass"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["observe-slot-presence.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport { ObserveSlotPresence } from '@spectrum-web-components/core/mixins/observe-slot-presence.js';\nexport type { SlotPresenceObservingInterface } from '@spectrum-web-components/core/mixins/observe-slot-presence.js';\n"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,2BAA2B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["observe-slot-presence.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport { ObserveSlotPresence } from '@spectrum-web-components/core/mixins/observe-slot-presence.js';\nexport type { SlotPresenceObservingInterface } from '@spectrum-web-components/core/mixins/observe-slot-presence.js';\n"],
|
|
5
5
|
"mappings": "aAWA,OAAS,wBAA2B",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["observe-slot-text.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport { ObserveSlotText } from '@spectrum-web-components/core/mixins/observe-slot-text.js';\nexport type { SlotTextObservingInterface } from '@spectrum-web-components/core/mixins/observe-slot-text.js';\n"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,uBAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["observe-slot-text.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nexport { ObserveSlotText } from '@spectrum-web-components/core/mixins/observe-slot-text.js';\nexport type { SlotTextObservingInterface } from '@spectrum-web-components/core/mixins/observe-slot-text.js';\n"],
|
|
5
5
|
"mappings": "aAWA,OAAS,oBAAuB",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/platform.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
package/src/platform.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["platform.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction testUserAgent(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.userAgent)\n : false;\n}\n\nfunction testPlatform(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.platform)\n : false;\n}\n\n/* c8 ignore next 3 */\nexport function isMac(): boolean {\n return testPlatform(/^Mac/);\n}\n\nexport function isIPhone(): boolean {\n return testPlatform(/^iPhone/);\n}\n\nexport function isIPad(): boolean {\n return (\n testPlatform(/^iPad/) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1)\n );\n}\n\nexport function isIOS(): boolean {\n return isIPhone() || isIPad();\n}\n\n/* c8 ignore next 3 */\nexport function isAppleDevice(): boolean {\n return isMac() || isIOS();\n}\n\n/* c8 ignore next 3 */\nexport function isWebKit(): boolean {\n return testUserAgent(/AppleWebKit/) && !isChrome();\n}\n\n/* c8 ignore next 3 */\nexport function isChrome(): boolean {\n return testUserAgent(/Chrome/);\n}\n\nexport function isFirefox(): boolean {\n return testUserAgent(/Firefox/) && !isSeamonkey();\n}\n\nexport function isSeamonkey(): boolean {\n return testUserAgent(/Seamonkey/);\n}\n\nexport function isAndroid(): boolean {\n return testUserAgent(/Android/);\n}\n"],
|
|
5
5
|
"mappings": ";AAYA,SAAS,cAAc,IAAqB;AAC1C,SAAO,OAAO,WAAW,eAAe,OAAO,aAAa,OACxD,GAAG,KAAK,OAAO,UAAU,SAAS,IAClC;AACN;AAEA,SAAS,aAAa,IAAqB;AACzC,SAAO,OAAO,WAAW,eAAe,OAAO,aAAa,OACxD,GAAG,KAAK,OAAO,UAAU,QAAQ,IACjC;AACN;AAGO,gBAAS,QAAiB;AAC/B,SAAO,aAAa,MAAM;AAC5B;AAEO,gBAAS,WAAoB;AAClC,SAAO,aAAa,SAAS;AAC/B;AAEO,gBAAS,SAAkB;AAChC,SACE,aAAa,OAAO;AAAA,EAEnB,MAAM,KAAK,UAAU,iBAAiB;AAE3C;AAEO,gBAAS,QAAiB;AAC/B,SAAO,SAAS,KAAK,OAAO;AAC9B;AAGO,gBAAS,gBAAyB;AACvC,SAAO,MAAM,KAAK,MAAM;AAC1B;AAGO,gBAAS,WAAoB;AAClC,SAAO,cAAc,aAAa,KAAK,CAAC,SAAS;AACnD;AAGO,gBAAS,WAAoB;AAClC,SAAO,cAAc,QAAQ;AAC/B;AAEO,gBAAS,YAAqB;AACnC,SAAO,cAAc,SAAS,KAAK,CAAC,YAAY;AAClD;AAEO,gBAAS,cAAuB;AACrC,SAAO,cAAc,WAAW;AAClC;AAEO,gBAAS,YAAqB;AACnC,SAAO,cAAc,SAAS;AAChC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/platform.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["platform.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nfunction testUserAgent(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.userAgent)\n : false;\n}\n\nfunction testPlatform(re: RegExp): boolean {\n return typeof window !== 'undefined' && window.navigator != null\n ? re.test(window.navigator.platform)\n : false;\n}\n\n/* c8 ignore next 3 */\nexport function isMac(): boolean {\n return testPlatform(/^Mac/);\n}\n\nexport function isIPhone(): boolean {\n return testPlatform(/^iPhone/);\n}\n\nexport function isIPad(): boolean {\n return (\n testPlatform(/^iPad/) ||\n // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.\n (isMac() && navigator.maxTouchPoints > 1)\n );\n}\n\nexport function isIOS(): boolean {\n return isIPhone() || isIPad();\n}\n\n/* c8 ignore next 3 */\nexport function isAppleDevice(): boolean {\n return isMac() || isIOS();\n}\n\n/* c8 ignore next 3 */\nexport function isWebKit(): boolean {\n return testUserAgent(/AppleWebKit/) && !isChrome();\n}\n\n/* c8 ignore next 3 */\nexport function isChrome(): boolean {\n return testUserAgent(/Chrome/);\n}\n\nexport function isFirefox(): boolean {\n return testUserAgent(/Firefox/) && !isSeamonkey();\n}\n\nexport function isSeamonkey(): boolean {\n return testUserAgent(/Seamonkey/);\n}\n\nexport function isAndroid(): boolean {\n return testUserAgent(/Android/);\n}\n"],
|
|
5
5
|
"mappings": "aAYA,SAASA,EAAcC,EAAqB,CAC1C,OAAO,OAAO,QAAW,aAAe,OAAO,WAAa,KACxDA,EAAG,KAAK,OAAO,UAAU,SAAS,EAClC,EACN,CAEA,SAASC,EAAaD,EAAqB,CACzC,OAAO,OAAO,QAAW,aAAe,OAAO,WAAa,KACxDA,EAAG,KAAK,OAAO,UAAU,QAAQ,EACjC,EACN,CAGO,gBAAS,OAAiB,CAC/B,OAAOC,EAAa,MAAM,CAC5B,CAEO,gBAAS,UAAoB,CAClC,OAAOA,EAAa,SAAS,CAC/B,CAEO,gBAAS,QAAkB,CAChC,OACEA,EAAa,OAAO,GAEnB,MAAM,GAAK,UAAU,eAAiB,CAE3C,CAEO,gBAAS,OAAiB,CAC/B,OAAO,SAAS,GAAK,OAAO,CAC9B,CAGO,gBAAS,eAAyB,CACvC,OAAO,MAAM,GAAK,MAAM,CAC1B,CAGO,gBAAS,UAAoB,CAClC,OAAOF,EAAc,aAAa,GAAK,CAAC,SAAS,CACnD,CAGO,gBAAS,UAAoB,CAClC,OAAOA,EAAc,QAAQ,CAC/B,CAEO,gBAAS,WAAqB,CACnC,OAAOA,EAAc,SAAS,GAAK,CAAC,YAAY,CAClD,CAEO,gBAAS,aAAuB,CACrC,OAAOA,EAAc,WAAW,CAClC,CAEO,gBAAS,WAAqB,CACnC,OAAOA,EAAc,SAAS,CAChC",
|
|
6
6
|
"names": ["testUserAgent", "re", "testPlatform"]
|
|
7
7
|
}
|
package/src/random-id.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2026 Adobe. All rights reserved.
|
|
3
3
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
4
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
5
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
package/src/random-id.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["random-id.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// This gnarly-looking implementation returns the equivalent of crypto.randomUUID().slice(0, 8).\n// It uses getRandomValues() in order to be compatible with HTTP contexts.\nexport function randomID(): string {\n return Array.from(crypto.getRandomValues(new Uint8Array(4)), (b) =>\n `0${(b & 0xff).toString(16)}`.slice(-2)\n ).join('');\n}\n"],
|
|
5
5
|
"mappings": ";AAcO,gBAAS,WAAmB;AACjC,SAAO,MAAM;AAAA,IAAK,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC;AAAA,IAAG,CAAC,MAC5D,KAAK,IAAI,KAAM,SAAS,EAAE,CAAC,GAAG,MAAM,EAAE;AAAA,EACxC,EAAE,KAAK,EAAE;AACX;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/random-id.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["random-id.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n// This gnarly-looking implementation returns the equivalent of crypto.randomUUID().slice(0, 8).\n// It uses getRandomValues() in order to be compatible with HTTP contexts.\nexport function randomID(): string {\n return Array.from(crypto.getRandomValues(new Uint8Array(4)), (b) =>\n `0${(b & 0xff).toString(16)}`.slice(-2)\n ).join('');\n}\n"],
|
|
5
5
|
"mappings": "aAcO,gBAAS,UAAmB,CACjC,OAAO,MAAM,KAAK,OAAO,gBAAgB,IAAI,WAAW,CAAC,CAAC,EAAIA,GAC5D,KAAKA,EAAI,KAAM,SAAS,EAAE,CAAC,GAAG,MAAM,EAAE,CACxC,EAAE,KAAK,EAAE,CACX",
|
|
6
6
|
"names": ["b"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["reparent-children.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nfunction restoreChildren<T extends Element>(\n placeholderItems: Comment[],\n srcElements: T[],\n cleanupCallbacks: ((el: T) => void)[] = []\n): T[] {\n for (let index = 0; index < srcElements.length; ++index) {\n const srcElement = srcElements[index];\n const placeholderItem = placeholderItems[index];\n const parentElement =\n placeholderItem.parentElement || placeholderItem.getRootNode();\n if (cleanupCallbacks[index]) {\n cleanupCallbacks[index](srcElement);\n }\n if (parentElement && parentElement !== placeholderItem) {\n parentElement.replaceChild(srcElement, placeholderItem);\n }\n delete placeholderItems[index];\n }\n return srcElements;\n}\n\nexport const reparentChildren = <T extends Element>(\n srcElements: T[],\n destination: Element,\n {\n position,\n prepareCallback,\n }: {\n position: InsertPosition;\n prepareCallback?: (el: T) => ((el: T) => void) | void;\n } = { position: 'beforeend' }\n): (() => T[]) => {\n let { length } = srcElements;\n if (length === 0) {\n return () => srcElements;\n }\n\n let step = 1;\n let index = 0;\n\n if (position === 'afterbegin' || position === 'afterend') {\n step = -1;\n index = length - 1;\n }\n\n const placeholderItems = new Array<Comment>(length);\n const cleanupCallbacks = new Array<(el: T) => void>(length);\n const placeholderTemplate: Comment = document.createComment(\n 'placeholder for reparented element'\n );\n\n do {\n const srcElement = srcElements[index];\n if (prepareCallback) {\n cleanupCallbacks[index] = prepareCallback(srcElement) as (el: T) => void;\n }\n placeholderItems[index] = placeholderTemplate.cloneNode() as Comment;\n\n const parentElement = srcElement.parentElement || srcElement.getRootNode();\n if (parentElement && parentElement !== srcElement) {\n parentElement.replaceChild(placeholderItems[index], srcElement);\n }\n destination.insertAdjacentElement(position, srcElement);\n\n index += step;\n } while (--length > 0);\n\n return function (): T[] {\n return restoreChildren<T>(placeholderItems, srcElements, cleanupCallbacks);\n };\n};\n"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,gBACP,kBACA,aACA,mBAAwC,CAAC,GACpC;AACL,WAAS,QAAQ,GAAG,QAAQ,YAAY,QAAQ,EAAE,OAAO;AACvD,UAAM,aAAa,YAAY,KAAK;AACpC,UAAM,kBAAkB,iBAAiB,KAAK;AAC9C,UAAM,gBACJ,gBAAgB,iBAAiB,gBAAgB,YAAY;AAC/D,QAAI,iBAAiB,KAAK,GAAG;AAC3B,uBAAiB,KA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copyright 2026 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nfunction restoreChildren<T extends Element>(\n placeholderItems: Comment[],\n srcElements: T[],\n cleanupCallbacks: ((el: T) => void)[] = []\n): T[] {\n for (let index = 0; index < srcElements.length; ++index) {\n const srcElement = srcElements[index];\n const placeholderItem = placeholderItems[index];\n const parentElement =\n placeholderItem.parentElement || placeholderItem.getRootNode();\n if (cleanupCallbacks[index]) {\n cleanupCallbacks[index](srcElement);\n }\n if (parentElement && parentElement !== placeholderItem) {\n parentElement.replaceChild(srcElement, placeholderItem);\n }\n delete placeholderItems[index];\n }\n return srcElements;\n}\n\nexport const reparentChildren = <T extends Element>(\n srcElements: T[],\n destination: Element,\n {\n position,\n prepareCallback,\n }: {\n position: InsertPosition;\n prepareCallback?: (el: T) => ((el: T) => void) | void;\n } = { position: 'beforeend' }\n): (() => T[]) => {\n let { length } = srcElements;\n if (length === 0) {\n return () => srcElements;\n }\n\n let step = 1;\n let index = 0;\n\n if (position === 'afterbegin' || position === 'afterend') {\n step = -1;\n index = length - 1;\n }\n\n const placeholderItems = new Array<Comment>(length);\n const cleanupCallbacks = new Array<(el: T) => void>(length);\n const placeholderTemplate: Comment = document.createComment(\n 'placeholder for reparented element'\n );\n\n do {\n const srcElement = srcElements[index];\n if (prepareCallback) {\n cleanupCallbacks[index] = prepareCallback(srcElement) as (el: T) => void;\n }\n placeholderItems[index] = placeholderTemplate.cloneNode() as Comment;\n\n const parentElement = srcElement.parentElement || srcElement.getRootNode();\n if (parentElement && parentElement !== srcElement) {\n parentElement.replaceChild(placeholderItems[index], srcElement);\n }\n destination.insertAdjacentElement(position, srcElement);\n\n index += step;\n } while (--length > 0);\n\n return function (): T[] {\n return restoreChildren<T>(placeholderItems, srcElements, cleanupCallbacks);\n };\n};\n"],
|
|
5
5
|
"mappings": "aAWA,SAASA,EACPC,EACAC,EACAC,EAAwC,CAAC,EACpC,CACL,QAASC,EAAQ,EAAGA,EAAQF,EAAY,OAAQ,EAAEE,EAAO,CACvD,MAAMC,EAAaH,EAAYE,CAAK,EAC9BE,EAAkBL,EAAiBG,CAAK,EACxCG,EACJD,EAAgB,eAAiBA,EAAgB,YAAY,EAC3DH,EAAiBC,CAAK,GACxBD,EAAiBC,CAAK,EAAEC,CAAU,EAEhCE,GAAiBA,IAAkBD,GACrCC,EAAc,aAAaF,EAAYC,CAAe,EAExD,OAAOL,EAAiBG,CAAK,CAC/B,CACA,OAAOF,CACT,CAEO,aAAM,iBAAmB,CAC9BA,EACAM,EACA,CACE,SAAAC,EACA,gBAAAC,CACF,EAGI,CAAE,SAAU,WAAY,IACZ,CAChB,GAAI,CAAE,OAAAC,CAAO,EAAIT,EACjB,GAAIS,IAAW,EACb,MAAO,IAAMT,EAGf,IAAIU,EAAO,EACPR,EAAQ,GAERK,IAAa,cAAgBA,IAAa,cAC5CG,EAAO,GACPR,EAAQO,EAAS,GAGnB,MAAMV,EAAmB,IAAI,MAAeU,CAAM,EAC5CR,EAAmB,IAAI,MAAuBQ,CAAM,EACpDE,EAA+B,SAAS,cAC5C,oCACF,EAEA,EAAG,CACD,MAAMR,EAAaH,EAAYE,CAAK,EAChCM,IACFP,EAAiBC,CAAK,EAAIM,EAAgBL,CAAU,GAEtDJ,EAAiBG,CAAK,EAAIS,EAAoB,UAAU,EAExD,MAAMN,EAAgBF,EAAW,eAAiBA,EAAW,YAAY,EACrEE,GAAiBA,IAAkBF,GACrCE,EAAc,aAAaN,EAAiBG,CAAK,EAAGC,CAAU,EAEhEG,EAAY,sBAAsBC,EAAUJ,CAAU,EAEtDD,GAASQ,CACX,OAAS,EAAED,EAAS,GAEpB,OAAO,UAAiB,CACtB,OAAOX,EAAmBC,EAAkBC,EAAaC,CAAgB,CAC3E,CACF",
|
|
6
6
|
"names": ["restoreChildren", "placeholderItems", "srcElements", "cleanupCallbacks", "index", "srcElement", "placeholderItem", "parentElement", "destination", "position", "prepareCallback", "length", "step", "placeholderTemplate"]
|
|
7
7
|
}
|