@fusion.dev/helix-core 0.103.3 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +1384 -150
- package/dist/controllers/arrival-controller/arrival-controller.d.ts +43 -0
- package/dist/controllers/arrival-controller/arrival-controller.js +35 -0
- package/dist/controllers/cue-controller/cue-controller.d.ts +8 -0
- package/dist/controllers/cue-controller/cue-controller.js +4 -1
- package/dist/controllers/keyboard-navigation-controller/keyboard-navigation-controller.js +4 -0
- package/dist/controllers/remote-playback-controller/remote-playback-controller.d.ts +15 -0
- package/dist/controllers/remote-playback-controller/remote-playback-controller.js +19 -3
- package/dist/events/events.d.ts +236 -0
- package/dist/events/events.js +144 -0
- package/dist/helix-form-element/helix-form-element.d.ts +9 -0
- package/dist/helix-form-element/helix-form-element.js +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +6 -1
- package/dist/mixins/mixin-collection/mixin-collection.d.ts +6 -0
- package/dist/mixins/mixin-collection/mixin-collection.js +5 -1
- package/dist/mixins/mixin-controller-open/mixin-controller-open.js +3 -3
- package/dist/mixins/mixin-controller-value/mixin-controller-value.d.ts +1 -1
- package/dist/mixins/mixin-controller-value/mixin-controller-value.js +2 -1
- package/dist/mixins/mixin-field/mixin-field.d.ts +11 -0
- package/dist/mixins/mixin-field/mixin-field.js +25 -3
- package/dist/mixins/mixin-picker-field/mixin-picker-field.d.ts +8 -0
- package/dist/mixins/mixin-picker-field/mixin-picker-field.js +22 -2
- package/dist/mixins/mixin-tokens/mixin-tokens.js +0 -1
- package/dist/mixins/mixin-viewport/mixin-viewport.d.ts +17 -5
- package/dist/mixins/mixin-viewport/mixin-viewport.js +68 -21
- package/dist/utils/fill-template/fill-template.d.ts +13 -0
- package/dist/utils/fill-template/fill-template.js +1 -0
- package/dist/utils/key-claimed/key-claimed.d.ts +18 -0
- package/dist/utils/key-claimed/key-claimed.js +14 -0
- package/dist/utils/report-values/report-values.d.ts +21 -0
- package/dist/utils/report-values/report-values.js +11 -0
- package/dist/utils/slotted-words/slotted-words.d.ts +11 -0
- package/dist/utils/slotted-words/slotted-words.js +5 -0
- package/dist/utils/tell-disclosure/tell-disclosure.d.ts +3 -1
- package/dist/utils/tell-disclosure/tell-disclosure.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const CARETLESS = new Set(['button', 'checkbox', 'color', 'file', 'image', 'reset', 'submit']);
|
|
2
|
+
export const keyClaimed = (event) => {
|
|
3
|
+
if (event.defaultPrevented) {
|
|
4
|
+
return true;
|
|
5
|
+
}
|
|
6
|
+
const inner = event.composedPath()[0];
|
|
7
|
+
if (!(inner instanceof HTMLElement)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
if (inner.isContentEditable || inner.localName === 'textarea' || inner.localName === 'select') {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
return inner.localName === 'input' && !CARETLESS.has(inner.type);
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reports a control's answer to its form: one entry for each value, the way a
|
|
3
|
+
* native `<select multiple>` and a row of checkboxes send theirs.
|
|
4
|
+
*
|
|
5
|
+
* **Several answers are several entries, not one joined string.** A server
|
|
6
|
+
* reading `tags=a,b` has to know to split it on a convention this library
|
|
7
|
+
* chose, and one reading `tags=a&tags=b` reads it the way it reads every
|
|
8
|
+
* other multi-valued control on the platform. Listbox, Select and Combobox
|
|
9
|
+
* sent the first and Date Picker the second, so what a server received for the
|
|
10
|
+
* same answer depended on which control asked for it.
|
|
11
|
+
*
|
|
12
|
+
* **The joined string is the state**, which is what the browser hands back to
|
|
13
|
+
* `formStateRestoreCallback` and what `value` holds, so a restored control
|
|
14
|
+
* reads the shape it wrote.
|
|
15
|
+
*
|
|
16
|
+
* **Nothing without a `name`.** A plain string is skipped by the form when its
|
|
17
|
+
* control has no name, but `FormData` carries its own names and its entries
|
|
18
|
+
* are appended whatever the element is called, so an unnamed control would
|
|
19
|
+
* submit empty-named values.
|
|
20
|
+
*/
|
|
21
|
+
export declare const reportValues: (internals: ElementInternals, name: string, values: readonly string[]) => void;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const reportValues = (internals, name, values) => {
|
|
2
|
+
if (name === '' || values.length === 0) {
|
|
3
|
+
internals.setFormValue(null);
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
const data = new FormData();
|
|
7
|
+
for (const value of values) {
|
|
8
|
+
data.append(name, value);
|
|
9
|
+
}
|
|
10
|
+
internals.setFormValue(data, values.join(','));
|
|
11
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The words a host's children say in the named slots, `''` being the default
|
|
3
|
+
* one, in the order they are written.
|
|
4
|
+
*
|
|
5
|
+
* For a component that says what the page put in it, which is the page's own
|
|
6
|
+
* text and not anything this library wrote: an empty state's heading and
|
|
7
|
+
* message, a banner's message. Text nodes count toward the default slot, as
|
|
8
|
+
* they are assigned to it. Nothing on a server, whose element has no children
|
|
9
|
+
* to read.
|
|
10
|
+
*/
|
|
11
|
+
export declare const slottedWords: (host: Element, slots: readonly string[]) => string;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export const slottedWords = (host, slots) => [...(host.childNodes ?? [])]
|
|
2
|
+
.filter((node) => (node instanceof Element ? slots.includes(node.slot) : slots.includes('')))
|
|
3
|
+
.map((node) => node.textContent?.replace(/\s+/g, ' ').trim() ?? '')
|
|
4
|
+
.filter(Boolean)
|
|
5
|
+
.join(' ');
|
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
* `<button slot="trigger">` has no shadow root to keep the state out of the
|
|
44
44
|
* markup and no property to take it, and a consumer cannot mirror it themselves
|
|
45
45
|
* because the open state belongs to the component. Saying so once is the same
|
|
46
|
-
* answer `Tooltip` gives about the link it will not write for them
|
|
46
|
+
* answer `Tooltip` gives about the link it will not write for them, and not at
|
|
47
|
+
* all to a trigger that already carries `aria-expanded`, which is a consumer
|
|
48
|
+
* mirroring the state from the component's `toggle` event.
|
|
47
49
|
*/
|
|
48
50
|
export declare const tellDisclosure: (trigger: Element | null | undefined, open: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-core",
|
|
3
3
|
"description": "Helix element primitives: base classes, mixins, decorators, utilities.",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.104.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/dom": "^1.8.0",
|
|
37
|
-
"@fusion.dev/helix-icons": "0.
|
|
37
|
+
"@fusion.dev/helix-icons": "0.104.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@fusion.dev/helix-cem": "0.
|
|
41
|
-
"@fusion.dev/helix-testing": "0.
|
|
40
|
+
"@fusion.dev/helix-cem": "0.104.0",
|
|
41
|
+
"@fusion.dev/helix-testing": "0.104.0",
|
|
42
42
|
"@lit-labs/ssr": "^4.1.0",
|
|
43
43
|
"lit": "^3.2.1"
|
|
44
44
|
},
|