@spectrum-web-components/shared 1.12.3 → 1.12.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/shared",
3
- "version": "1.12.3",
3
+ "version": "1.12.4",
4
4
  "description": "",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Adobe",
@@ -75,6 +75,10 @@
75
75
  "./src/reparent-children.js": {
76
76
  "development": "./src/reparent-children.dev.js",
77
77
  "default": "./src/reparent-children.js"
78
+ },
79
+ "./src/walk-ancestors.js": {
80
+ "development": "./src/walk-ancestors.dev.js",
81
+ "default": "./src/walk-ancestors.js"
78
82
  }
79
83
  },
80
84
  "main": "./src/index.js",
@@ -96,7 +100,7 @@
96
100
  "types": "./src/index.d.ts",
97
101
  "dependencies": {
98
102
  "@lit-labs/observers": "2.0.2",
99
- "@spectrum-web-components/base": "1.12.3",
103
+ "@spectrum-web-components/base": "1.12.4",
100
104
  "focus-visible": "5.2.1"
101
105
  },
102
106
  "keywords": [
package/src/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './platform.js';
21
21
  export * from './reparent-children.js';
22
22
  export * from './get-label-from-slot.js';
23
23
  export * from './random-id.js';
24
+ export * from './walk-ancestors.js';
package/src/index.dev.js CHANGED
@@ -11,4 +11,5 @@ export * from "./platform.dev.js";
11
11
  export * from "./reparent-children.dev.js";
12
12
  export * from "./get-label-from-slot.dev.js";
13
13
  export * from "./random-id.dev.js";
14
+ export * from "./walk-ancestors.dev.js";
14
15
  //# sourceMappingURL=index.dev.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["index.ts"],
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
- "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;",
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'\nexport * from './walk-ancestors.dev.js'\n"],
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;AACd,cAAc;",
6
6
  "names": []
7
7
  }
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";export*from"./first-focusable-in.js";export*from"./focus-visible.js";export*from"./focusable.js";export*from"./focusable-selectors.js";export*from"./get-active-element.js";export*from"./like-anchor.js";export*from"./observe-slot-presence.js";export*from"./observe-slot-text.js";export*from"./platform.js";export*from"./reparent-children.js";export*from"./get-label-from-slot.js";export*from"./random-id.js";
1
+ "use strict";export*from"./first-focusable-in.js";export*from"./focus-visible.js";export*from"./focusable.js";export*from"./focusable-selectors.js";export*from"./get-active-element.js";export*from"./like-anchor.js";export*from"./observe-slot-presence.js";export*from"./observe-slot-text.js";export*from"./platform.js";export*from"./reparent-children.js";export*from"./get-label-from-slot.js";export*from"./random-id.js";export*from"./walk-ancestors.js";
2
2
  //# sourceMappingURL=index.js.map
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 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
- "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",
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';\nexport * from './walk-ancestors.js';\n"],
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,iBACd,WAAc",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2026 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ /**
13
+ * Walks up the composed ("flat") tree from `start`, yielding each ancestor
14
+ * element in turn. Crosses shadow-root boundaries via `getRootNode().host`,
15
+ * and resolves a slotted node's ancestor via `assignedSlot` *before*
16
+ * `parentElement` — per the CSS flat-tree, a slotted node's inherited
17
+ * properties (e.g. `direction`) flow from the `<slot>` it's rendered
18
+ * through, not from its light-DOM parent, so `parentElement` alone would
19
+ * walk the wrong branch for a slotted element.
20
+ */
21
+ export declare function walkAncestors(start: Element): Generator<Element>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ export function* walkAncestors(start) {
3
+ let node = start;
4
+ for (; ; ) {
5
+ const next = node.assignedSlot || node.parentElement || node.getRootNode().host || null;
6
+ if (!next) {
7
+ break;
8
+ }
9
+ yield next;
10
+ node = next;
11
+ }
12
+ }
13
+ //# sourceMappingURL=walk-ancestors.dev.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["walk-ancestors.ts"],
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/**\n * Walks up the composed (\"flat\") tree from `start`, yielding each ancestor\n * element in turn. Crosses shadow-root boundaries via `getRootNode().host`,\n * and resolves a slotted node's ancestor via `assignedSlot` *before*\n * `parentElement` \u2014 per the CSS flat-tree, a slotted node's inherited\n * properties (e.g. `direction`) flow from the `<slot>` it's rendered\n * through, not from its light-DOM parent, so `parentElement` alone would\n * walk the wrong branch for a slotted element.\n */\nexport function* walkAncestors(start: Element): Generator<Element> {\n let node: Element = start;\n for (;;) {\n const next: Element | null =\n node.assignedSlot ||\n node.parentElement ||\n (node.getRootNode() as ShadowRoot).host ||\n null;\n if (!next) {\n break;\n }\n yield next;\n node = next;\n }\n}\n"],
5
+ "mappings": ";AAqBO,iBAAU,cAAc,OAAoC;AACjE,MAAI,OAAgB;AACpB,aAAS;AACP,UAAM,OACJ,KAAK,gBACL,KAAK,iBACJ,KAAK,YAAY,EAAiB,QACnC;AACF,QAAI,CAAC,MAAM;AACT;AAAA,IACF;AACA,UAAM;AACN,WAAO;AAAA,EACT;AACF;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";export function*walkAncestors(n){let e=n;for(;;){const t=e.assignedSlot||e.parentElement||e.getRootNode().host||null;if(!t)break;yield t,e=t}}
2
+ //# sourceMappingURL=walk-ancestors.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["walk-ancestors.ts"],
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/**\n * Walks up the composed (\"flat\") tree from `start`, yielding each ancestor\n * element in turn. Crosses shadow-root boundaries via `getRootNode().host`,\n * and resolves a slotted node's ancestor via `assignedSlot` *before*\n * `parentElement` \u2014 per the CSS flat-tree, a slotted node's inherited\n * properties (e.g. `direction`) flow from the `<slot>` it's rendered\n * through, not from its light-DOM parent, so `parentElement` alone would\n * walk the wrong branch for a slotted element.\n */\nexport function* walkAncestors(start: Element): Generator<Element> {\n let node: Element = start;\n for (;;) {\n const next: Element | null =\n node.assignedSlot ||\n node.parentElement ||\n (node.getRootNode() as ShadowRoot).host ||\n null;\n if (!next) {\n break;\n }\n yield next;\n node = next;\n }\n}\n"],
5
+ "mappings": "aAqBO,gBAAU,cAAcA,EAAoC,CACjE,IAAIC,EAAgBD,EACpB,OAAS,CACP,MAAME,EACJD,EAAK,cACLA,EAAK,eACJA,EAAK,YAAY,EAAiB,MACnC,KACF,GAAI,CAACC,EACH,MAEF,MAAMA,EACND,EAAOC,CACT,CACF",
6
+ "names": ["start", "node", "next"]
7
+ }