@fusion.dev/helix-core 0.146.0 → 0.148.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 +3129 -282
- package/dist/controllers/aria-forward-controller/aria-forward-controller.js +5 -3
- package/dist/controllers/chart-pointer-controller/chart-pointer-controller.d.ts +6 -0
- package/dist/controllers/chart-pointer-controller/chart-pointer-controller.js +13 -0
- package/dist/controllers/children-controller/children-controller.d.ts +28 -0
- package/dist/controllers/children-controller/children-controller.js +18 -0
- package/dist/controllers/copy-controller/copy-controller.d.ts +4 -1
- package/dist/controllers/copy-controller/copy-controller.js +2 -1
- package/dist/controllers/countdown-controller/countdown-controller.d.ts +19 -2
- package/dist/controllers/countdown-controller/countdown-controller.js +30 -3
- package/dist/controllers/floating-controller/floating-controller.d.ts +12 -1
- package/dist/controllers/floating-controller/floating-controller.js +2 -1
- package/dist/controllers/keyboard-navigation-controller/keyboard-navigation-controller.d.ts +30 -0
- package/dist/controllers/keyboard-navigation-controller/keyboard-navigation-controller.js +8 -0
- package/dist/controllers/open-phase-controller/open-phase-controller.d.ts +10 -0
- package/dist/controllers/open-phase-controller/open-phase-controller.js +7 -4
- package/dist/controllers/option-window-controller/option-window-controller.d.ts +96 -0
- package/dist/controllers/option-window-controller/option-window-controller.js +81 -0
- package/dist/controllers/popover-controller/popover-controller.js +1 -1
- package/dist/controllers/source-controller/source-controller.js +2 -0
- package/dist/controllers/swipe-controller/swipe-controller.d.ts +10 -1
- package/dist/controllers/swipe-controller/swipe-controller.js +1 -1
- package/dist/controllers/virtualize-controller/virtualize-controller.js +8 -6
- package/dist/events/band.d.ts +13 -0
- package/dist/events/band.js +11 -0
- package/dist/events/details.d.ts +5 -0
- package/dist/events/events.d.ts +4 -2
- package/dist/events/events.js +3 -1
- package/dist/events/names.d.ts +3 -0
- package/dist/events/names.js +13 -88
- package/dist/helix-element/helix-element.d.ts +14 -5
- package/dist/helix-element/helix-element.js +13 -45
- package/dist/helix-element/react-bridge.d.ts +13 -0
- package/dist/helix-element/react-bridge.js +1 -1
- package/dist/index.d.ts +40 -17
- package/dist/index.js +38 -15
- package/dist/mixins/mixin-chart-source/mixin-chart-source.d.ts +12 -0
- package/dist/mixins/mixin-chart-source/mixin-chart-source.js +4 -0
- package/dist/mixins/mixin-dismissible/mixin-dismissible.js +25 -4
- package/dist/mixins/mixin-picker-feedback/mixin-picker-feedback.d.ts +42 -0
- package/dist/mixins/mixin-picker-feedback/mixin-picker-feedback.js +46 -0
- package/dist/mixins/mixin-picker-field/mixin-picker-field.d.ts +2 -11
- package/dist/mixins/mixin-picker-field/mixin-picker-field.js +1 -6
- package/dist/mixins/mixin-segmented-field/mixin-segmented-field.d.ts +1 -1
- package/dist/mixins/mixin-segmented-field/mixin-segmented-field.js +10 -6
- package/dist/mixins/mixin-viewport/mixin-viewport.js +8 -7
- package/dist/utils/assign-slots/assign-slots.d.ts +18 -0
- package/dist/utils/assign-slots/assign-slots.js +14 -0
- package/dist/utils/audit-name/audit-name.d.ts +7 -2
- package/dist/utils/audit-name/audit-name.js +12 -3
- package/dist/utils/audit-source/audit-source-off.d.ts +10 -0
- package/dist/utils/audit-source/audit-source-off.js +1 -0
- package/dist/utils/audit-source/audit-source.d.ts +19 -0
- package/dist/utils/audit-source/audit-source.js +27 -0
- package/dist/utils/autofill-select/autofill-select.d.ts +40 -0
- package/dist/utils/autofill-select/autofill-select.js +14 -0
- package/dist/utils/call-listener/call-listener.d.ts +16 -0
- package/dist/utils/call-listener/call-listener.js +17 -0
- package/dist/utils/center-in-view/center-in-view.d.ts +18 -0
- package/dist/utils/center-in-view/center-in-view.js +14 -0
- package/dist/utils/chord/chord.d.ts +14 -0
- package/dist/utils/chord/chord.js +1 -0
- package/dist/utils/chord/key-names.d.ts +30 -0
- package/dist/utils/chord/key-names.js +52 -0
- package/dist/utils/clamp/clamp.d.ts +7 -0
- package/dist/utils/clamp/clamp.js +1 -0
- package/dist/utils/column-step/column-step.d.ts +13 -0
- package/dist/utils/column-step/column-step.js +9 -0
- package/dist/utils/css-color/css-color.js +1 -1
- package/dist/utils/data-options/data-options.d.ts +60 -0
- package/dist/utils/data-options/data-options.js +46 -0
- package/dist/utils/draw-tooltip/draw-tooltip.d.ts +7 -2
- package/dist/utils/draw-tooltip/draw-tooltip.js +1 -1
- package/dist/utils/draw-tooltip/spoken-reading.d.ts +3 -2
- package/dist/utils/draw-tooltip/spoken-reading.js +3 -2
- package/dist/utils/elapsed-time/elapsed-time.d.ts +1 -1
- package/dist/utils/elapsed-time/elapsed-time.js +2 -5
- package/dist/utils/export-parts/export-parts.d.ts +14 -0
- package/dist/utils/export-parts/export-parts.js +1 -0
- package/dist/utils/fill-template/fill-template.d.ts +9 -0
- package/dist/utils/fill-template/fill-template.js +3 -0
- package/dist/utils/filter-marks/filter-marks.d.ts +36 -0
- package/dist/utils/filter-marks/filter-marks.js +41 -0
- package/dist/utils/focus-target/focus-target.d.ts +12 -0
- package/dist/utils/focus-target/focus-target.js +9 -0
- package/dist/utils/focusable-elements/focusable-elements.d.ts +17 -0
- package/dist/utils/focusable-elements/focusable-elements.js +8 -0
- package/dist/utils/grid-move/grid-move.d.ts +56 -0
- package/dist/utils/grid-move/grid-move.js +28 -0
- package/dist/utils/host-words/host-words.d.ts +16 -0
- package/dist/utils/host-words/host-words.js +13 -0
- package/dist/utils/load-more/load-more.d.ts +25 -0
- package/dist/utils/load-more/load-more.js +1 -0
- package/dist/utils/locale-of/locale-of.d.ts +18 -0
- package/dist/utils/locale-of/locale-of.js +26 -0
- package/dist/utils/nearest/nearest.d.ts +9 -0
- package/dist/utils/nearest/nearest.js +9 -0
- package/dist/utils/number-format/number-format.d.ts +16 -0
- package/dist/utils/number-format/number-format.js +5 -0
- package/dist/utils/own-rule/own-rule.d.ts +16 -0
- package/dist/utils/own-rule/own-rule.js +7 -0
- package/dist/utils/platform/platform.d.ts +8 -0
- package/dist/utils/platform/platform.js +1 -0
- package/dist/utils/read-series/read-series.d.ts +14 -0
- package/dist/utils/read-series/read-series.js +15 -0
- package/dist/utils/relative-time/relative-time.d.ts +8 -0
- package/dist/utils/relative-time/relative-time.js +5 -2
- package/dist/utils/report-render/report-render.js +2 -14
- package/dist/utils/report-runtime/report-runtime.d.ts +11 -1
- package/dist/utils/report-runtime/report-runtime.js +2 -14
- package/dist/utils/report-usage/report-usage.js +2 -14
- package/dist/utils/report-values/report-values.d.ts +16 -4
- package/dist/utils/report-values/report-values.js +2 -2
- package/dist/utils/request-change/request-change.d.ts +11 -0
- package/dist/utils/request-change/request-change.js +10 -0
- package/dist/utils/scroll-item-into-view/scroll-item-into-view.d.ts +50 -0
- package/dist/utils/scroll-item-into-view/scroll-item-into-view.js +14 -3
- package/dist/utils/slot-filled/slot-filled.d.ts +8 -0
- package/dist/utils/slot-filled/slot-filled.js +1 -0
- package/dist/utils/slotted-glyph/slotted-glyph.d.ts +33 -0
- package/dist/utils/slotted-glyph/slotted-glyph.js +27 -0
- package/dist/utils/toolbar-around/toolbar-around.d.ts +18 -0
- package/dist/utils/toolbar-around/toolbar-around.js +5 -0
- package/dist/utils/typeahead/typeahead.d.ts +8 -0
- package/dist/utils/typeahead/typeahead.js +1 -0
- package/dist/utils/verdict-flags/verdict-flags.d.ts +13 -0
- package/dist/utils/verdict-flags/verdict-flags.js +6 -0
- package/dist/utils/written-list/written-list.d.ts +31 -0
- package/dist/utils/written-list/written-list.js +16 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -4
|
@@ -7,4 +7,54 @@ export interface ScrollItemOptions {
|
|
|
7
7
|
/** Whether to animate. Ignored where the reader asked for less motion. */
|
|
8
8
|
smooth?: boolean;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* The nearest ancestor that actually scrolls, crossing shadow boundaries.
|
|
12
|
+
*
|
|
13
|
+
* **Not `item.offsetParent`**, which is the nearest *positioned* ancestor and
|
|
14
|
+
* has nothing whatever to do with overflow. The two coincide often enough to
|
|
15
|
+
* look right, because a scroller frequently is positioned, and they come apart
|
|
16
|
+
* exactly where it matters: put anything `position: relative` between the item
|
|
17
|
+
* and the box that scrolls, and the util scrolls the thing in between, which
|
|
18
|
+
* does not scroll, and reports nothing.
|
|
19
|
+
*
|
|
20
|
+
* The walk crosses shadow boundaries through the host, because the item is
|
|
21
|
+
* almost always in one and `parentElement` is null at the root. Without that
|
|
22
|
+
* step, a component whose scroller is its own `[part]` would find nothing.
|
|
23
|
+
*
|
|
24
|
+
* It stops before the document. Scrolling the page is the one thing this whole
|
|
25
|
+
* util exists not to do, so finding nothing inside the component and returning
|
|
26
|
+
* null is the honest answer: the caller no-ops rather than taking the address
|
|
27
|
+
* bar with it.
|
|
28
|
+
*/
|
|
29
|
+
export declare const scrollingAncestor: (item: HTMLElement, options?: ScrollerOptions) => HTMLElement | null;
|
|
30
|
+
/** What `scrollRoom` takes off a box that scrolls. */
|
|
31
|
+
export interface ScrollRoomOptions {
|
|
32
|
+
/**
|
|
33
|
+
* How much of the box its own content covers while it scrolls, a sticky row
|
|
34
|
+
* of headings, in pixels. Defaults to `0`.
|
|
35
|
+
*/
|
|
36
|
+
covered?: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* How much of a list a reader sees at once, for Page Up and Page Down: the
|
|
40
|
+
* box's own height where it scrolls, less what covers it, and the window's
|
|
41
|
+
* where it does not and the page scrolls instead.
|
|
42
|
+
*
|
|
43
|
+
* **A pixel of slack**, since a box whose content rounds to one pixel more
|
|
44
|
+
* than its height does not scroll, and was paging by the window's height.
|
|
45
|
+
*/
|
|
46
|
+
export declare const scrollRoom: (box: Element | null | undefined, { covered }?: ScrollRoomOptions) => number;
|
|
47
|
+
/** Where `scrollingAncestor` looks, and what it takes for a scroller. */
|
|
48
|
+
export interface ScrollerOptions {
|
|
49
|
+
/** The axis whose overflow counts, or either where absent. */
|
|
50
|
+
readonly axis?: 'x' | 'y';
|
|
51
|
+
/**
|
|
52
|
+
* Only a box whose content is larger than it, along `axis`: one that can
|
|
53
|
+
* scroll now, rather than one that would once it fills. Outline asks this of
|
|
54
|
+
* the box its links and its sections scroll in.
|
|
55
|
+
*/
|
|
56
|
+
readonly overflowing?: boolean;
|
|
57
|
+
/** Where the walk stops, unread: the document's body where absent. */
|
|
58
|
+
readonly stop?: Element | null;
|
|
59
|
+
}
|
|
10
60
|
export declare const scrollItemIntoView: (item: HTMLElement, options?: ScrollItemOptions) => void;
|
|
@@ -1,15 +1,26 @@
|
|
|
1
|
-
const scrollingAncestor = (item) => {
|
|
2
|
-
const stop = item.ownerDocument.body;
|
|
1
|
+
export const scrollingAncestor = (item, options = {}) => {
|
|
2
|
+
const { axis, overflowing = false, stop = item.ownerDocument.body } = options;
|
|
3
3
|
let node = climb(item);
|
|
4
4
|
while (node && node !== stop) {
|
|
5
5
|
const style = getComputedStyle(node);
|
|
6
|
-
|
|
6
|
+
const overflow = axis === 'x'
|
|
7
|
+
? style.overflowX
|
|
8
|
+
: axis === 'y'
|
|
9
|
+
? style.overflowY
|
|
10
|
+
: `${style.overflowX} ${style.overflowY}`;
|
|
11
|
+
if (/\b(auto|scroll|overlay)\b/.test(overflow) && (!overflowing || overflows(node, axis))) {
|
|
7
12
|
return node;
|
|
8
13
|
}
|
|
9
14
|
node = climb(node);
|
|
10
15
|
}
|
|
11
16
|
return null;
|
|
12
17
|
};
|
|
18
|
+
export const scrollRoom = (box, { covered = 0 } = {}) => box && box.scrollHeight > box.clientHeight + 1 ? box.clientHeight - covered : window.innerHeight;
|
|
19
|
+
const overflows = (node, axis) => {
|
|
20
|
+
const tall = node.scrollHeight > node.clientHeight;
|
|
21
|
+
const wide = node.scrollWidth > node.clientWidth;
|
|
22
|
+
return axis === 'x' ? wide : axis === 'y' ? tall : tall || wide;
|
|
23
|
+
};
|
|
13
24
|
const climb = (node) => {
|
|
14
25
|
if (node.parentElement) {
|
|
15
26
|
return node.parentElement;
|
|
@@ -22,3 +22,11 @@
|
|
|
22
22
|
* anything", and a slot showing its fallback does render.
|
|
23
23
|
*/
|
|
24
24
|
export declare const slotFilled: (slot: HTMLSlotElement | null | undefined) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The slot of a name in a shadow root, or its default slot for `''`.
|
|
27
|
+
*
|
|
28
|
+
* `slot[name=""]` matches nothing, since the default slot has no `name`
|
|
29
|
+
* attribute at all, which is the one thing every hand-written lookup had to
|
|
30
|
+
* remember.
|
|
31
|
+
*/
|
|
32
|
+
export declare const slotNamed: (root: ParentNode | null | undefined, name: string) => HTMLSlotElement | null;
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
export const slotFilled = (slot) => (slot?.assignedNodes({ flatten: true }) ?? []).some((node) => node.nodeType === Node.ELEMENT_NODE || node.textContent?.trim() !== '');
|
|
2
|
+
export const slotNamed = (root, name) => root?.querySelector?.(name === '' ? 'slot:not([name])' : `slot[name="${name}"]`) ?? null;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A glyph a consumer slots once and a component draws in many places: the
|
|
3
|
+
* marks of a rating, the remove icon on every row of a file list.
|
|
4
|
+
*
|
|
5
|
+
* A slotted element can be assigned to one slot only, so a component that
|
|
6
|
+
* draws it in several places draws copies. **One copy per place, kept**, so a
|
|
7
|
+
* render does not make them again: a drag renders on every pointer move, and
|
|
8
|
+
* handing Lit a fresh node each time swaps every copy on every frame.
|
|
9
|
+
*/
|
|
10
|
+
export declare class SlottedGlyph {
|
|
11
|
+
/** The copies made so far, by the place each is drawn in. */
|
|
12
|
+
private readonly copies;
|
|
13
|
+
/** The element slotted last, which every copy is made from. */
|
|
14
|
+
private source;
|
|
15
|
+
/** Whether a glyph is slotted, so the component draws copies of it. */
|
|
16
|
+
get slotted(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Reads the slot after a `slotchange`: the first element assigned to it,
|
|
19
|
+
* through any slot it is forwarded by. The copies made of the last one go.
|
|
20
|
+
*/
|
|
21
|
+
read(slot: HTMLSlotElement): void;
|
|
22
|
+
/**
|
|
23
|
+
* Takes `source` as the glyph, or none, as `read` does from a slot: the
|
|
24
|
+
* copies made of the last one go. For the first render, which reads the
|
|
25
|
+
* host's children before any `slotchange` answers.
|
|
26
|
+
*/
|
|
27
|
+
take(source: Element | undefined): void;
|
|
28
|
+
/**
|
|
29
|
+
* The copy for one place, made the first time it is asked for and the same
|
|
30
|
+
* node after, or `undefined` while nothing is slotted.
|
|
31
|
+
*/
|
|
32
|
+
copyFor(place: number | string): Node | undefined;
|
|
33
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export class SlottedGlyph {
|
|
2
|
+
constructor() {
|
|
3
|
+
this.copies = new Map();
|
|
4
|
+
}
|
|
5
|
+
get slotted() {
|
|
6
|
+
return this.source !== undefined;
|
|
7
|
+
}
|
|
8
|
+
read(slot) {
|
|
9
|
+
this.take(slot.assignedElements({ flatten: true })[0]);
|
|
10
|
+
}
|
|
11
|
+
take(source) {
|
|
12
|
+
this.source = source;
|
|
13
|
+
this.copies.clear();
|
|
14
|
+
}
|
|
15
|
+
copyFor(place) {
|
|
16
|
+
if (!this.source) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
const key = String(place);
|
|
20
|
+
let copy = this.copies.get(key);
|
|
21
|
+
if (!copy) {
|
|
22
|
+
copy = this.source.cloneNode(true);
|
|
23
|
+
this.copies.set(key, copy);
|
|
24
|
+
}
|
|
25
|
+
return copy;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The toolbar an element sits in, or `null`.
|
|
3
|
+
*
|
|
4
|
+
* Read from the parent up, so a toolbar is never its own. One answer for every
|
|
5
|
+
* family that changes inside a toolbar: Toolbar becomes a group of the outer
|
|
6
|
+
* one, a multiple Toggle Group becomes a group, and Divider turns across the
|
|
7
|
+
* toolbar's axis. By tag and by role, since a family other than Toolbar cannot
|
|
8
|
+
* import Toolbar's class; Toolbar adds its own class for a third tag.
|
|
9
|
+
*
|
|
10
|
+
* `closest` stops at a shadow root, which is what a slotted child wants: its
|
|
11
|
+
* toolbar is its light-DOM parent or above.
|
|
12
|
+
*/
|
|
13
|
+
export declare const toolbarAround: (element: Element) => Element | null;
|
|
14
|
+
/**
|
|
15
|
+
* The axis a toolbar runs along: its own `orientation`, else the page's
|
|
16
|
+
* `aria-orientation`, else horizontal, which is the role's default.
|
|
17
|
+
*/
|
|
18
|
+
export declare const toolbarAxis: (toolbar: Element) => 'horizontal' | 'vertical';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const TOOLBAR = '[role="toolbar"], helix-toolbar, helix-headless-toolbar';
|
|
2
|
+
export const toolbarAround = (element) => element.parentElement?.closest(TOOLBAR) ?? null;
|
|
3
|
+
export const toolbarAxis = (toolbar) => (toolbar.getAttribute('orientation') ?? toolbar.getAttribute('aria-orientation')) === 'vertical'
|
|
4
|
+
? 'vertical'
|
|
5
|
+
: 'horizontal';
|
|
@@ -65,3 +65,11 @@ export interface TypeaheadBy<Item> {
|
|
|
65
65
|
* `TypeaheadBy`.
|
|
66
66
|
*/
|
|
67
67
|
export declare const typeaheadBy: <Item>(words: (item: Item) => string) => TypeaheadBy<Item>;
|
|
68
|
+
/**
|
|
69
|
+
* Turns on typeahead for a set whose items carry their own `words`, as List's
|
|
70
|
+
* rows, Tag Group's tags and Drilldown's items do. An item with none is
|
|
71
|
+
* passed over.
|
|
72
|
+
*/
|
|
73
|
+
export declare const typeaheadByWords: () => TypeaheadBy<{
|
|
74
|
+
readonly words?: string;
|
|
75
|
+
}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a picker field finds wrong: a message, reported as `badInput`, or the
|
|
3
|
+
* validity flag to set and its message. Empty means nothing is wrong.
|
|
4
|
+
*/
|
|
5
|
+
export type PickerVerdict = string | readonly [flag: keyof ValidityStateFlags, message: string];
|
|
6
|
+
/**
|
|
7
|
+
* A verdict as the flags and the message `setValidity` takes, or `null` where
|
|
8
|
+
* there is nothing wrong.
|
|
9
|
+
*
|
|
10
|
+
* Shared by `MixinPickerField` and `MixinSegmentedField`, the two shapes a
|
|
11
|
+
* date, time or color field takes, which report the same verdicts.
|
|
12
|
+
*/
|
|
13
|
+
export declare const verdictFlags: (verdict: PickerVerdict) => [flags: ValidityStateFlags, message: string] | null;
|
|
@@ -71,6 +71,37 @@ export declare const toggleValue: (list: readonly string[], value: string, order
|
|
|
71
71
|
* follows.
|
|
72
72
|
*/
|
|
73
73
|
export declare const toggleEvery: (chosen: Iterable<string>, values: readonly string[], order?: readonly string[]) => string[];
|
|
74
|
+
/**
|
|
75
|
+
* What a select-all box shows for `values`: checked when every one is
|
|
76
|
+
* chosen, mixed when some are, and neither for none or an empty set.
|
|
77
|
+
*
|
|
78
|
+
* Checkbox Group's select-all box and the header boxes of Table and Data
|
|
79
|
+
* Table each worked this out. A set that does not count its disabled boxes
|
|
80
|
+
* passes only the enabled values.
|
|
81
|
+
*/
|
|
82
|
+
export declare const everyState: (chosen: Iterable<string>, values: readonly string[]) => {
|
|
83
|
+
checked: boolean;
|
|
84
|
+
indeterminate: boolean;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* `keys` in the order the rows are, which is `order`: the keys of the whole
|
|
88
|
+
* set. A key the set does not hold, a selected row a search has hidden say,
|
|
89
|
+
* keeps its place after them in the order it was given.
|
|
90
|
+
*
|
|
91
|
+
* So a selection reads in row order whatever order its rows were chosen in:
|
|
92
|
+
* Data Table's, and Table's and Virtual List's, which wrote it in press order
|
|
93
|
+
* or wrote this again.
|
|
94
|
+
*/
|
|
95
|
+
export declare const inRowOrder: (keys: Iterable<string>, order: readonly string[]) => string[];
|
|
96
|
+
/**
|
|
97
|
+
* Where a Shift range runs from, as an index into `keys`: the row last chosen
|
|
98
|
+
* while it is among them, and otherwise the row the reader is on, `from`,
|
|
99
|
+
* which becomes the one to run from.
|
|
100
|
+
*/
|
|
101
|
+
export declare const anchorAt: (keys: readonly string[], anchorKey: string | undefined, from: number) => {
|
|
102
|
+
anchor: number;
|
|
103
|
+
anchorKey: string | undefined;
|
|
104
|
+
};
|
|
74
105
|
/** How many items a set lets a reader select: Tag Group's and List's `selection-mode`. */
|
|
75
106
|
export type SelectionMode = 'multiple' | 'none' | 'single';
|
|
76
107
|
/**
|
|
@@ -25,6 +25,22 @@ export const toggleEvery = (chosen, values, order) => {
|
|
|
25
25
|
}
|
|
26
26
|
return order ? order.filter((value) => next.has(value)) : [...next];
|
|
27
27
|
};
|
|
28
|
+
export const everyState = (chosen, values) => {
|
|
29
|
+
const held = new Set(chosen);
|
|
30
|
+
const count = values.filter((value) => held.has(value)).length;
|
|
31
|
+
const checked = values.length > 0 && count === values.length;
|
|
32
|
+
return { checked, indeterminate: count > 0 && !checked };
|
|
33
|
+
};
|
|
34
|
+
export const inRowOrder = (keys, order) => {
|
|
35
|
+
const wanted = new Set(keys);
|
|
36
|
+
const placed = order.filter((key) => wanted.has(key));
|
|
37
|
+
const seen = new Set(placed);
|
|
38
|
+
return [...placed, ...[...wanted].filter((key) => !seen.has(key))];
|
|
39
|
+
};
|
|
40
|
+
export const anchorAt = (keys, anchorKey, from) => {
|
|
41
|
+
const anchor = anchorKey === undefined ? -1 : keys.indexOf(anchorKey);
|
|
42
|
+
return anchor < 0 ? { anchor: from, anchorKey: keys[from] } : { anchor, anchorKey };
|
|
43
|
+
};
|
|
28
44
|
export const pressedValue = (mode, value, pressed) => {
|
|
29
45
|
const now = commaList(value);
|
|
30
46
|
if (mode === 'single') {
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.148.0';
|
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.148.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.148.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@fusion.dev/helix-cem": "0.
|
|
41
|
-
"@fusion.dev/helix-testing": "0.
|
|
40
|
+
"@fusion.dev/helix-cem": "0.148.0",
|
|
41
|
+
"@fusion.dev/helix-testing": "0.148.0",
|
|
42
42
|
"@lit-labs/ssr": "^4.1.0",
|
|
43
43
|
"lit": "^3.2.1"
|
|
44
44
|
},
|
|
@@ -54,6 +54,17 @@
|
|
|
54
54
|
"development": "./dist/utils/audit-name/audit-name.js",
|
|
55
55
|
"helix-development": "./dist/utils/audit-name/audit-name.js",
|
|
56
56
|
"default": "./dist/utils/audit-name/audit-name-off.js"
|
|
57
|
+
},
|
|
58
|
+
"#audit-source": {
|
|
59
|
+
"helix-source": {
|
|
60
|
+
"development": "./src/utils/audit-source/audit-source.ts",
|
|
61
|
+
"helix-development": "./src/utils/audit-source/audit-source.ts",
|
|
62
|
+
"default": "./src/utils/audit-source/audit-source-off.ts"
|
|
63
|
+
},
|
|
64
|
+
"types": "./dist/utils/audit-source/audit-source.d.ts",
|
|
65
|
+
"development": "./dist/utils/audit-source/audit-source.js",
|
|
66
|
+
"helix-development": "./dist/utils/audit-source/audit-source.js",
|
|
67
|
+
"default": "./dist/utils/audit-source/audit-source-off.js"
|
|
57
68
|
}
|
|
58
69
|
},
|
|
59
70
|
"keywords": [
|