@spectrum-web-components/shared 1.9.0 → 1.9.1-nightly.20251028214328
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/CHANGELOG.md +636 -0
- package/README.md +161 -42
- package/package.json +111 -111
- package/src/get-label-from-slot.d.ts +1 -1
- package/src/get-label-from-slot.dev.js +1 -15
- package/src/get-label-from-slot.dev.js.map +2 -2
- package/src/get-label-from-slot.js +1 -1
- package/src/get-label-from-slot.js.map +3 -3
- package/src/observe-slot-presence.d.ts +1 -12
- package/src/observe-slot-presence.dev.js +1 -61
- package/src/observe-slot-presence.dev.js.map +2 -2
- package/src/observe-slot-presence.js +1 -1
- package/src/observe-slot-presence.js.map +3 -3
- package/src/observe-slot-text.d.ts +1 -11
- package/src/observe-slot-text.dev.js +1 -93
- package/src/observe-slot-text.dev.js.map +2 -2
- package/src/observe-slot-text.js +1 -1
- package/src/observe-slot-text.js.map +3 -3
- package/test/focusable.test.js +23 -0
- package/test/focusable.test.js.map +7 -0
- package/test/observe-slot-presence.test.js +28 -0
- package/test/observe-slot-presence.test.js.map +7 -0
- package/test/observe-slot-text.test.js +25 -0
- package/test/observe-slot-text.test.js.map +7 -0
- package/test/random-id.test.js +25 -0
- package/test/random-id.test.js.map +7 -0
- package/test/reparent-children.test.js +254 -0
- package/test/reparent-children.test.js.map +7 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
##
|
|
1
|
+
## Overview
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `@spectrum-web-components/shared` package provides essential base classes, mixins, and utilities that support developing Spectrum Web Components. This package contains foundational tools for focus management, slot observation, accessibility enhancements, and other common functionality used across the component library.
|
|
4
4
|
|
|
5
5
|
### Usage
|
|
6
6
|
|
|
@@ -8,121 +8,222 @@ Shared mixins, tools, etc. that support developing Spectrum Web Components.
|
|
|
8
8
|
[](https://bundlephobia.com/result?p=@spectrum-web-components/shared)
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
|
|
11
|
+
yarn add @spectrum-web-components/shared
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Individual base classes and
|
|
14
|
+
Individual base classes, mixins, and utilities can be imported as follows:
|
|
15
15
|
|
|
16
16
|
```javascript
|
|
17
17
|
import {
|
|
18
18
|
Focusable,
|
|
19
19
|
FocusVisiblePolyfillMixin,
|
|
20
20
|
getActiveElement,
|
|
21
|
+
getDeepElementFromPoint,
|
|
21
22
|
LikeAnchor,
|
|
23
|
+
ObserveSlotPresence,
|
|
22
24
|
ObserveSlotText,
|
|
23
25
|
} from '@spectrum-web-components/shared';
|
|
24
26
|
```
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
#### Exported Classes, Mixins, and Utilities
|
|
29
|
+
|
|
30
|
+
<div style="margin-block-end: 2rem">
|
|
31
|
+
<sp-table>
|
|
32
|
+
<sp-table-head>
|
|
33
|
+
<sp-table-head-cell>Export</sp-table-head-cell>
|
|
34
|
+
<sp-table-head-cell>Type</sp-table-head-cell>
|
|
35
|
+
<sp-table-head-cell>Description</sp-table-head-cell>
|
|
36
|
+
</sp-table-head>
|
|
37
|
+
<sp-table-body>
|
|
38
|
+
<sp-table-row>
|
|
39
|
+
<sp-table-cell><code>getActiveElement()</code></sp-table-cell>
|
|
40
|
+
<sp-table-cell>Utility</sp-table-cell>
|
|
41
|
+
<sp-table-cell>Find the active element, including shadow DOM</sp-table-cell>
|
|
42
|
+
</sp-table-row>
|
|
43
|
+
<sp-table-row>
|
|
44
|
+
<sp-table-cell><code>getDeepElementFromPoint()</code></sp-table-cell>
|
|
45
|
+
<sp-table-cell>Utility</sp-table-cell>
|
|
46
|
+
<sp-table-cell>Deepest element at coordinates</sp-table-cell>
|
|
47
|
+
</sp-table-row>
|
|
48
|
+
<sp-table-row>
|
|
49
|
+
<sp-table-cell><code>Focusable</code></sp-table-cell>
|
|
50
|
+
<sp-table-cell>Base class</sp-table-cell>
|
|
51
|
+
<sp-table-cell>Focus management for custom elements</sp-table-cell>
|
|
52
|
+
</sp-table-row>
|
|
53
|
+
<sp-table-row>
|
|
54
|
+
<sp-table-cell><code>LikeAnchor</code></sp-table-cell>
|
|
55
|
+
<sp-table-cell>Mixin</sp-table-cell>
|
|
56
|
+
<sp-table-cell>Anchor-like properties and rendering</sp-table-cell>
|
|
57
|
+
</sp-table-row>
|
|
58
|
+
<sp-table-row>
|
|
59
|
+
<sp-table-cell><code>FocusVisiblePolyfillMixin</code></sp-table-cell>
|
|
60
|
+
<sp-table-cell>Mixin</sp-table-cell>
|
|
61
|
+
<sp-table-cell>Polyfill for :focus-visible support</sp-table-cell>
|
|
62
|
+
</sp-table-row>
|
|
63
|
+
<sp-table-row>
|
|
64
|
+
<sp-table-cell><code>ObserveSlotPresence</code></sp-table-cell>
|
|
65
|
+
<sp-table-cell>Mixin</sp-table-cell>
|
|
66
|
+
<sp-table-cell>Observe presence of slotted content</sp-table-cell>
|
|
67
|
+
</sp-table-row>
|
|
68
|
+
<sp-table-row>
|
|
69
|
+
<sp-table-cell><code>ObserveSlotText</code></sp-table-cell>
|
|
70
|
+
<sp-table-cell>Mixin</sp-table-cell>
|
|
71
|
+
<sp-table-cell>Observe text changes in slots</sp-table-cell>
|
|
72
|
+
</sp-table-row>
|
|
73
|
+
</sp-table-body>
|
|
74
|
+
</sp-table>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
### Utilities
|
|
78
|
+
|
|
79
|
+
#### getDeepElementFromPoint
|
|
80
|
+
|
|
81
|
+
The `getDeepElementFromPoint` method allows you to obtain the deepest possible element at given coordinates on the current page. The method will step into any available `shadowRoot`s until it reaches the first element with no `shadowRoot` or no children available at the given coordinates.
|
|
82
|
+
|
|
83
|
+
**When to use:** Use this when you need to find the actual target element at specific coordinates, especially when working with shadow DOM where `document.elementFromPoint()` might not give you the deepest element.
|
|
27
84
|
|
|
28
|
-
|
|
85
|
+
```javascript
|
|
86
|
+
import { getDeepElementFromPoint } from '@spectrum-web-components/shared';
|
|
87
|
+
|
|
88
|
+
const element = getDeepElementFromPoint(x, y);
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
#### getActiveElement
|
|
92
|
+
|
|
93
|
+
Use this helper to find an `activeElement` in your component.
|
|
94
|
+
|
|
95
|
+
**When to use:** Use this when you need to determine which element currently has focus, especially in components with shadow DOM where `document.activeElement` might not give you the correct element.
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
import { getActiveElement } from '@spectrum-web-components/shared';
|
|
99
|
+
|
|
100
|
+
const activeEl = getActiveElement(this);
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Base classes
|
|
104
|
+
|
|
105
|
+
#### Focusable
|
|
29
106
|
|
|
30
|
-
|
|
107
|
+
The `Focusable` subclass of `SpectrumElement` adds helper methods and lifecycle coverage to support passing focus to a container element inside of a custom element. The `Focusable` base class handles `tabindex` setting into shadowed elements automatically and is based heavily on the [aybolit delegate-focus-mixin](https://github.com/web-padawan/aybolit/blob/master/packages/core/src/mixins/delegate-focus-mixin.js).
|
|
31
108
|
|
|
32
|
-
|
|
109
|
+
**When to use:** Use this base class when creating custom elements that need to delegate focus to an internal element (like a button or input) while maintaining proper tabindex management and accessibility.
|
|
33
110
|
|
|
34
111
|
```javascript
|
|
35
112
|
import { Focusable } from '@spectrum-web-components/shared';
|
|
36
|
-
import { html } from '
|
|
113
|
+
import { html, TemplateResult } from '@spectrum-web-components/base';
|
|
37
114
|
|
|
38
115
|
class FocusableButton extends Focusable {
|
|
39
|
-
public static override get styles(): CSSResultArray {
|
|
40
|
-
return [...super.styles];
|
|
41
|
-
}
|
|
42
116
|
public get focusElement(): HTMLElement {
|
|
43
117
|
return this.shadowRoot.querySelector('#button') as HTMLElement;
|
|
44
118
|
}
|
|
45
119
|
|
|
46
120
|
protected override render(): TemplateResult {
|
|
47
121
|
return html`
|
|
48
|
-
<button
|
|
49
|
-
|
|
50
|
-
>
|
|
51
|
-
Focus for this button is being managed by the focusable base class.
|
|
122
|
+
<button id="button">
|
|
123
|
+
Focus for this button is being managed by the `Focusable` base class.
|
|
52
124
|
</button>
|
|
53
125
|
`;
|
|
54
126
|
}
|
|
55
127
|
}
|
|
56
128
|
```
|
|
57
129
|
|
|
58
|
-
###
|
|
130
|
+
### Mixins
|
|
131
|
+
|
|
132
|
+
#### LikeAnchor
|
|
59
133
|
|
|
60
|
-
|
|
134
|
+
Mix `download`, `label`, `href`, `target`, `rel`, and `referrerpolicy` properties into your element to allow it to act more like an `HTMLAnchorElement`. It also provides a `renderAnchor` method for rendering anchor elements.
|
|
61
135
|
|
|
62
|
-
|
|
136
|
+
**When to use:** Use this mixin when creating custom elements that need to behave like links or buttons with link-like functionality, such as action buttons that can navigate to URLs.
|
|
63
137
|
|
|
64
|
-
|
|
138
|
+
```javascript
|
|
139
|
+
import { LikeAnchor } from '@spectrum-web-components/shared';
|
|
140
|
+
import { ReactiveElement, html, TemplateResult } from '@spectrum-web-components/base';
|
|
141
|
+
|
|
142
|
+
class MyLinkElement extends LikeAnchor(ReactiveElement) {
|
|
143
|
+
protected render(): TemplateResult {
|
|
144
|
+
return this.renderAnchor({
|
|
145
|
+
id: 'my-anchor',
|
|
146
|
+
className: 'my-link',
|
|
147
|
+
anchorContent: html`<slot></slot>`,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
65
152
|
|
|
66
|
-
|
|
153
|
+
#### FocusVisiblePolyfillMixin
|
|
67
154
|
|
|
68
|
-
|
|
155
|
+
This mixin coordinates with the focus-visible polyfill to ensure proper behavior across browsers. [Learn more about the polyfill that powers this](https://www.npmjs.com/package/focus-visible).
|
|
69
156
|
|
|
70
|
-
|
|
157
|
+
**When to use:** Use this mixin when you need to leverage `:focus-visible`-based selectors in your CSS.
|
|
158
|
+
|
|
159
|
+
```javascript
|
|
160
|
+
import { FocusVisiblePolyfillMixin } from '@spectrum-web-components/shared';
|
|
161
|
+
|
|
162
|
+
class MyElement extends FocusVisiblePolyfillMixin(HTMLElement) {
|
|
163
|
+
// Your element now supports `:focus-visible` selectors and coordinates with the polyfill
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### ObserveSlotPresence
|
|
71
168
|
|
|
72
169
|
When working with styles that are driven by the conditional presence of `<slot>`s in a component's shadow DOM, you will need to track whether light DOM that is meant for that slot exists. Use the `ObserveSlotPresence` mixin to target specific light DOM to observe the presence of and trigger `this.requestUpdate()` calls when content fulfilling that selector comes in and out of availability.
|
|
73
170
|
|
|
171
|
+
**When to use:** Use this mixin when you need to conditionally render UI or apply styles based on whether specific slotted content is present. Common use cases include showing/hiding labels, icons, or wrapper elements.
|
|
172
|
+
|
|
74
173
|
```javascript
|
|
75
174
|
import { ObserveSlotPresence } from '@spectrum-web-components/shared';
|
|
76
|
-
import {
|
|
77
|
-
|
|
78
|
-
|
|
175
|
+
import { ReactiveElement, html, TemplateResult } from '@spectrum-web-components/base';
|
|
176
|
+
|
|
177
|
+
class ObserveSlotPresenceElement extends ObserveSlotPresence(
|
|
178
|
+
ReactiveElement,
|
|
179
|
+
'[slot="conditional-slot"]'
|
|
180
|
+
) {
|
|
181
|
+
// Translate the mixin properties into locally understandable language
|
|
79
182
|
protected get hasConditionalSlotContent() {
|
|
80
183
|
return this.slotContentIsPresent;
|
|
81
184
|
}
|
|
185
|
+
|
|
82
186
|
protected override render(): TemplateResult {
|
|
83
187
|
return html`
|
|
84
|
-
<button
|
|
85
|
-
id="button"
|
|
86
|
-
>
|
|
188
|
+
<button id="button">
|
|
87
189
|
${this.hasConditionalSlotContent
|
|
88
|
-
? html
|
|
89
|
-
<slot
|
|
90
|
-
name="conditional-slot"
|
|
91
|
-
></slot>
|
|
92
|
-
`
|
|
190
|
+
? html`<slot name="conditional-slot"></slot>`
|
|
93
191
|
: html``
|
|
94
192
|
}
|
|
95
193
|
</button>
|
|
96
194
|
`;
|
|
97
195
|
}
|
|
196
|
+
|
|
98
197
|
protected updated(): void {
|
|
99
198
|
console.log(this.slotContentIsPresent); // => true when <observing-slot-presence-element><div slot="conditional-slot"></div></observing-slot-presence-element>
|
|
100
199
|
}
|
|
101
200
|
}
|
|
201
|
+
|
|
102
202
|
customElements.define('observing-slot-presence-element', ObserveSlotPresenceElement);
|
|
103
203
|
```
|
|
104
204
|
|
|
105
|
-
|
|
205
|
+
#### ObserveSlotText
|
|
106
206
|
|
|
107
|
-
When working with `<slot>`s and their `slotchange` event, you will have the opportunity to capture when the nodes and/or elements in your element are added or removed. However, if the `textContent` of a text node changes, you will not receive the `slotchange` event because the slot hasn't actually received new nodes and/or elements in the exchange. When working with a lit-html binding `<your-element>${text}</your-element>` that means you will not receive a `slotchange` event when the value of `text` goes from `text = ''` to `text = 'something'` or the other way. In these cases the `ObserveSlotText` can be
|
|
207
|
+
When working with `<slot>`s and their `slotchange` event, you will have the opportunity to capture when the nodes and/or elements in your element are added or removed. However, if the `textContent` of a text node changes, you will not receive the `slotchange` event because the slot hasn't actually received new nodes and/or elements in the exchange. When working with a lit-html binding `<your-element>${text}</your-element>` that means you will not receive a `slotchange` event when the value of `text` goes from `text = ''` to `text = 'something'` or the other way. In these cases the `ObserveSlotText` can be leveraged to apply a mutation observer onto your element that tracks `characterData` mutations so that you can respond as desired.
|
|
208
|
+
|
|
209
|
+
**When to use:** Use this mixin when you need to detect changes in text content within slots, especially for dynamic text that changes after the initial render. Useful for components that need to react to text content changes for layout or styling purposes.
|
|
108
210
|
|
|
109
211
|
```javascript
|
|
110
212
|
import { ObserveSlotText } from '@spectrum-web-components/shared';
|
|
111
|
-
import {
|
|
213
|
+
import { ReactiveElement, html, TemplateResult } from '@spectrum-web-components/base';
|
|
112
214
|
|
|
113
|
-
class ObserveSlotTextElement extends ObserveSlotText(
|
|
215
|
+
class ObserveSlotTextElement extends ObserveSlotText(ReactiveElement) {
|
|
114
216
|
protected override render(): TemplateResult {
|
|
115
217
|
return html`
|
|
116
|
-
<button
|
|
117
|
-
id="button"
|
|
118
|
-
>
|
|
218
|
+
<button id="button">
|
|
119
219
|
<slot
|
|
120
220
|
id="observing-slot"
|
|
121
|
-
@slotchange=${this.
|
|
221
|
+
@slotchange=${this.manageTextObservedSlot}
|
|
122
222
|
></slot>
|
|
123
223
|
</button>
|
|
124
224
|
`;
|
|
125
225
|
}
|
|
226
|
+
|
|
126
227
|
protected updated(): void {
|
|
127
228
|
console.log(this.slotHasContent); // => true when <observing-slot-text-element>Text</observing-slot-text-element>
|
|
128
229
|
}
|
|
@@ -130,3 +231,21 @@ class ObserveSlotTextElement extends ObserveSlotText(LitElement, '#observing-slo
|
|
|
130
231
|
|
|
131
232
|
customElements.define('observing-slot-text-element', ObserveSlotTextElement);
|
|
132
233
|
```
|
|
234
|
+
|
|
235
|
+
For named slots, you can supply the name of the slot as the second argument:
|
|
236
|
+
|
|
237
|
+
```javascript
|
|
238
|
+
class ObserveSlotTextElement extends ObserveSlotText(ReactiveElement, 'button-label') {
|
|
239
|
+
protected override render(): TemplateResult {
|
|
240
|
+
return html`
|
|
241
|
+
<button id="button">
|
|
242
|
+
<slot
|
|
243
|
+
name="button-label"
|
|
244
|
+
@slotchange=${this.manageObservedSlot}
|
|
245
|
+
@slotchange=${this.manageTextObservedSlot}
|
|
246
|
+
></slot>
|
|
247
|
+
</button>
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
package/package.json
CHANGED
|
@@ -1,118 +1,118 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
"name": "@spectrum-web-components/shared",
|
|
3
|
+
"version": "1.9.1-nightly.20251028214328",
|
|
4
|
+
"publishConfig": {
|
|
5
|
+
"access": "public"
|
|
6
|
+
},
|
|
7
|
+
"description": "",
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/adobe/spectrum-web-components.git",
|
|
12
|
+
"directory": "1st-gen/tools/shared"
|
|
13
|
+
},
|
|
14
|
+
"author": "Adobe",
|
|
15
|
+
"homepage": "https://opensource.adobe.com/spectrum-web-components/tools/shared",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/adobe/spectrum-web-components/issues"
|
|
18
|
+
},
|
|
19
|
+
"main": "./src/index.js",
|
|
20
|
+
"module": "./src/index.js",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"development": "./src/index.dev.js",
|
|
25
|
+
"default": "./src/index.js"
|
|
6
26
|
},
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"url": "https://github.com/adobe/spectrum-web-components.git",
|
|
12
|
-
"directory": "tools/shared"
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
"./src/first-focusable-in.js": {
|
|
29
|
+
"development": "./src/first-focusable-in.dev.js",
|
|
30
|
+
"default": "./src/first-focusable-in.js"
|
|
13
31
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"url": "https://github.com/adobe/spectrum-web-components/issues"
|
|
32
|
+
"./src/focus-visible.js": {
|
|
33
|
+
"development": "./src/focus-visible.dev.js",
|
|
34
|
+
"default": "./src/focus-visible.js"
|
|
18
35
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"exports": {
|
|
23
|
-
".": {
|
|
24
|
-
"development": "./src/index.dev.js",
|
|
25
|
-
"default": "./src/index.js"
|
|
26
|
-
},
|
|
27
|
-
"./package.json": "./package.json",
|
|
28
|
-
"./src/first-focusable-in.js": {
|
|
29
|
-
"development": "./src/first-focusable-in.dev.js",
|
|
30
|
-
"default": "./src/first-focusable-in.js"
|
|
31
|
-
},
|
|
32
|
-
"./src/focus-visible.js": {
|
|
33
|
-
"development": "./src/focus-visible.dev.js",
|
|
34
|
-
"default": "./src/focus-visible.js"
|
|
35
|
-
},
|
|
36
|
-
"./src/focusable-selectors.js": {
|
|
37
|
-
"development": "./src/focusable-selectors.dev.js",
|
|
38
|
-
"default": "./src/focusable-selectors.js"
|
|
39
|
-
},
|
|
40
|
-
"./src/focusable.js": {
|
|
41
|
-
"development": "./src/focusable.dev.js",
|
|
42
|
-
"default": "./src/focusable.js"
|
|
43
|
-
},
|
|
44
|
-
"./src/get-active-element.js": {
|
|
45
|
-
"development": "./src/get-active-element.dev.js",
|
|
46
|
-
"default": "./src/get-active-element.js"
|
|
47
|
-
},
|
|
48
|
-
"./src/get-deep-element-from-point.js": {
|
|
49
|
-
"development": "./src/get-deep-element-from-point.dev.js",
|
|
50
|
-
"default": "./src/get-deep-element-from-point.js"
|
|
51
|
-
},
|
|
52
|
-
"./src/get-label-from-slot.js": {
|
|
53
|
-
"development": "./src/get-label-from-slot.dev.js",
|
|
54
|
-
"default": "./src/get-label-from-slot.js"
|
|
55
|
-
},
|
|
56
|
-
"./src/index.js": {
|
|
57
|
-
"development": "./src/index.dev.js",
|
|
58
|
-
"default": "./src/index.js"
|
|
59
|
-
},
|
|
60
|
-
"./src/like-anchor.js": {
|
|
61
|
-
"development": "./src/like-anchor.dev.js",
|
|
62
|
-
"default": "./src/like-anchor.js"
|
|
63
|
-
},
|
|
64
|
-
"./src/observe-slot-presence.js": {
|
|
65
|
-
"development": "./src/observe-slot-presence.dev.js",
|
|
66
|
-
"default": "./src/observe-slot-presence.js"
|
|
67
|
-
},
|
|
68
|
-
"./src/observe-slot-text.js": {
|
|
69
|
-
"development": "./src/observe-slot-text.dev.js",
|
|
70
|
-
"default": "./src/observe-slot-text.js"
|
|
71
|
-
},
|
|
72
|
-
"./src/platform.js": {
|
|
73
|
-
"development": "./src/platform.dev.js",
|
|
74
|
-
"default": "./src/platform.js"
|
|
75
|
-
},
|
|
76
|
-
"./src/random-id.js": {
|
|
77
|
-
"development": "./src/random-id.dev.js",
|
|
78
|
-
"default": "./src/random-id.js"
|
|
79
|
-
},
|
|
80
|
-
"./src/reparent-children.js": {
|
|
81
|
-
"development": "./src/reparent-children.dev.js",
|
|
82
|
-
"default": "./src/reparent-children.js"
|
|
83
|
-
}
|
|
36
|
+
"./src/focusable-selectors.js": {
|
|
37
|
+
"development": "./src/focusable-selectors.dev.js",
|
|
38
|
+
"default": "./src/focusable-selectors.js"
|
|
84
39
|
},
|
|
85
|
-
"
|
|
86
|
-
|
|
40
|
+
"./src/focusable.js": {
|
|
41
|
+
"development": "./src/focusable.dev.js",
|
|
42
|
+
"default": "./src/focusable.js"
|
|
87
43
|
},
|
|
88
|
-
"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
"**/*.js.map",
|
|
92
|
-
"custom-elements.json",
|
|
93
|
-
"!stories/",
|
|
94
|
-
"!test/"
|
|
95
|
-
],
|
|
96
|
-
"keywords": [
|
|
97
|
-
"design-system",
|
|
98
|
-
"spectrum",
|
|
99
|
-
"adobe",
|
|
100
|
-
"adobe-spectrum",
|
|
101
|
-
"web components",
|
|
102
|
-
"web-components",
|
|
103
|
-
"lit-element",
|
|
104
|
-
"lit-html",
|
|
105
|
-
"component",
|
|
106
|
-
"css"
|
|
107
|
-
],
|
|
108
|
-
"dependencies": {
|
|
109
|
-
"@lit-labs/observers": "2.0.2",
|
|
110
|
-
"@spectrum-web-components/base": "1.9.0",
|
|
111
|
-
"focus-visible": "5.2.1"
|
|
44
|
+
"./src/get-active-element.js": {
|
|
45
|
+
"development": "./src/get-active-element.dev.js",
|
|
46
|
+
"default": "./src/get-active-element.js"
|
|
112
47
|
},
|
|
113
|
-
"
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
48
|
+
"./src/get-deep-element-from-point.js": {
|
|
49
|
+
"development": "./src/get-deep-element-from-point.dev.js",
|
|
50
|
+
"default": "./src/get-deep-element-from-point.js"
|
|
51
|
+
},
|
|
52
|
+
"./src/get-label-from-slot.js": {
|
|
53
|
+
"development": "./src/get-label-from-slot.dev.js",
|
|
54
|
+
"default": "./src/get-label-from-slot.js"
|
|
55
|
+
},
|
|
56
|
+
"./src/index.js": {
|
|
57
|
+
"development": "./src/index.dev.js",
|
|
58
|
+
"default": "./src/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./src/like-anchor.js": {
|
|
61
|
+
"development": "./src/like-anchor.dev.js",
|
|
62
|
+
"default": "./src/like-anchor.js"
|
|
63
|
+
},
|
|
64
|
+
"./src/observe-slot-presence.js": {
|
|
65
|
+
"development": "./src/observe-slot-presence.dev.js",
|
|
66
|
+
"default": "./src/observe-slot-presence.js"
|
|
67
|
+
},
|
|
68
|
+
"./src/observe-slot-text.js": {
|
|
69
|
+
"development": "./src/observe-slot-text.dev.js",
|
|
70
|
+
"default": "./src/observe-slot-text.js"
|
|
71
|
+
},
|
|
72
|
+
"./src/platform.js": {
|
|
73
|
+
"development": "./src/platform.dev.js",
|
|
74
|
+
"default": "./src/platform.js"
|
|
75
|
+
},
|
|
76
|
+
"./src/random-id.js": {
|
|
77
|
+
"development": "./src/random-id.dev.js",
|
|
78
|
+
"default": "./src/random-id.js"
|
|
79
|
+
},
|
|
80
|
+
"./src/reparent-children.js": {
|
|
81
|
+
"development": "./src/reparent-children.dev.js",
|
|
82
|
+
"default": "./src/reparent-children.js"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"scripts": {
|
|
86
|
+
"test": "echo \"Error: run tests from mono-repo root.\" && exit 1"
|
|
87
|
+
},
|
|
88
|
+
"files": [
|
|
89
|
+
"**/*.d.ts",
|
|
90
|
+
"**/*.js",
|
|
91
|
+
"**/*.js.map",
|
|
92
|
+
"custom-elements.json",
|
|
93
|
+
"!stories/",
|
|
94
|
+
"!test/"
|
|
95
|
+
],
|
|
96
|
+
"keywords": [
|
|
97
|
+
"design-system",
|
|
98
|
+
"spectrum",
|
|
99
|
+
"adobe",
|
|
100
|
+
"adobe-spectrum",
|
|
101
|
+
"web components",
|
|
102
|
+
"web-components",
|
|
103
|
+
"lit-element",
|
|
104
|
+
"lit-html",
|
|
105
|
+
"component",
|
|
106
|
+
"css"
|
|
107
|
+
],
|
|
108
|
+
"dependencies": {
|
|
109
|
+
"@lit-labs/observers": "2.0.2",
|
|
110
|
+
"@spectrum-web-components/base": "1.9.1-nightly.20251028214328",
|
|
111
|
+
"focus-visible": "5.2.1"
|
|
112
|
+
},
|
|
113
|
+
"types": "./src/index.d.ts",
|
|
114
|
+
"customElements": "custom-elements.json",
|
|
115
|
+
"sideEffects": [
|
|
116
|
+
"./**/*.dev.js"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
@@ -9,4 +9,4 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export * from '@spectrum-web-components/core/shared/get-label-from-slot.js';
|
|
@@ -1,17 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
export
|
|
3
|
-
if (label) return null;
|
|
4
|
-
const textContent = slotEl.assignedNodes().reduce((accumulator, node) => {
|
|
5
|
-
if (node.textContent) {
|
|
6
|
-
return accumulator + node.textContent;
|
|
7
|
-
} else {
|
|
8
|
-
return accumulator;
|
|
9
|
-
}
|
|
10
|
-
}, "");
|
|
11
|
-
if (textContent) {
|
|
12
|
-
return textContent.trim();
|
|
13
|
-
} else {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
};
|
|
2
|
+
export * from "@spectrum-web-components/core/shared/get-label-from-slot.js";
|
|
17
3
|
//# sourceMappingURL=get-label-from-slot.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-label-from-slot.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2025 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 */\
|
|
5
|
-
"mappings": ";
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 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 '@spectrum-web-components/core/shared/get-label-from-slot.js';\n"],
|
|
5
|
+
"mappings": ";AAWA,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";export
|
|
1
|
+
"use strict";export*from"@spectrum-web-components/core/shared/get-label-from-slot.js";
|
|
2
2
|
//# sourceMappingURL=get-label-from-slot.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["get-label-from-slot.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Copyright 2025 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 */\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": [
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 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 '@spectrum-web-components/core/shared/get-label-from-slot.js';\n"],
|
|
5
|
+
"mappings": "aAWA,WAAc",
|
|
6
|
+
"names": []
|
|
7
7
|
}
|
|
@@ -9,15 +9,4 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
type Constructor<T = Record<string, unknown>> = {
|
|
14
|
-
new (...args: any[]): T;
|
|
15
|
-
prototype: T;
|
|
16
|
-
};
|
|
17
|
-
export interface SlotPresenceObservingInterface {
|
|
18
|
-
slotContentIsPresent: boolean;
|
|
19
|
-
getSlotContentPresence(selector: string): boolean;
|
|
20
|
-
managePresenceObservedSlot(): void;
|
|
21
|
-
}
|
|
22
|
-
export declare function ObserveSlotPresence<T extends Constructor<ReactiveElement>>(constructor: T, lightDomSelector: string | string[]): T & Constructor<SlotPresenceObservingInterface>;
|
|
23
|
-
export {};
|
|
12
|
+
export * from '@spectrum-web-components/core/shared/observe-slot-presence.js';
|