@fusion.dev/helix-headless 0.148.0 → 0.149.1
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 +6966 -1798
- package/dist/announcement/root/announcement-root.d.ts +5 -0
- package/dist/announcement/root/announcement-root.js +5 -2
- package/dist/area-chart/root/area-chart-root.d.ts +11 -0
- package/dist/area-chart/root/area-chart-root.js +20 -7
- package/dist/avatar/group/avatar-group.d.ts +10 -2
- package/dist/avatar/group/avatar-group.js +10 -5
- package/dist/badge/count.d.ts +6 -1
- package/dist/badge/count.js +3 -3
- package/dist/badge/root/badge-root.d.ts +6 -2
- package/dist/badge/root/badge-root.js +3 -3
- package/dist/bar-chart/root/bar-chart-root.d.ts +13 -1
- package/dist/bar-chart/root/bar-chart-root.js +17 -4
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +8 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +5 -2
- package/dist/button/root/button-root.d.ts +10 -1
- package/dist/button/root/button-root.js +3 -2
- package/dist/button-group/root/button-group-root.d.ts +3 -0
- package/dist/button-group/root/button-group-root.js +2 -2
- package/dist/callout/root/callout-root.d.ts +16 -2
- package/dist/callout/root/callout-root.js +16 -4
- package/dist/canvas/describe.d.ts +10 -0
- package/dist/canvas/describe.js +9 -0
- package/dist/canvas/neighbor.d.ts +17 -0
- package/dist/canvas/neighbor.js +1 -0
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.d.ts +65 -8
- package/dist/canvas/root/canvas-root.js +115 -49
- package/dist/carousel/root/carousel-root.d.ts +5 -0
- package/dist/carousel/root/carousel-root.js +16 -5
- package/dist/chat/composer/chat-composer.d.ts +5 -0
- package/dist/chat/composer/chat-composer.js +4 -1
- package/dist/chat/message/chat-message.d.ts +9 -5
- package/dist/chat/message/chat-message.js +8 -4
- package/dist/chat/naming.js +2 -2
- package/dist/chat/root/chat-root.d.ts +27 -1
- package/dist/chat/root/chat-root.js +37 -9
- package/dist/checkbox/root/checkbox-root.d.ts +11 -0
- package/dist/checkbox/root/checkbox-root.js +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +11 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +11 -3
- package/dist/code-block/root/code-block-root.d.ts +12 -2
- package/dist/code-block/root/code-block-root.js +12 -2
- package/dist/color-input/root/color-input-root.d.ts +13 -0
- package/dist/color-input/root/color-input-root.js +18 -5
- package/dist/color-picker/root/color-picker-root.d.ts +19 -3
- package/dist/color-picker/root/color-picker-root.js +47 -13
- package/dist/combobox/root/combobox-root.d.ts +36 -7
- package/dist/combobox/root/combobox-root.js +37 -12
- package/dist/command/root/command-root.d.ts +15 -6
- package/dist/command/root/command-root.js +9 -4
- package/dist/copy-button/root/copy-button-root.d.ts +5 -0
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/root/data-table-root.d.ts +171 -29
- package/dist/data-table/root/data-table-root.js +268 -118
- package/dist/date-input/root/date-input-root.d.ts +32 -9
- package/dist/date-input/root/date-input-root.js +66 -44
- package/dist/date-picker/root/date-picker-root.d.ts +38 -15
- package/dist/date-picker/root/date-picker-root.js +52 -33
- package/dist/dialog/root/dialog-root.d.ts +12 -1
- package/dist/dialog/root/dialog-root.js +11 -4
- package/dist/donut-chart/root/donut-chart-root.d.ts +5 -0
- package/dist/donut-chart/root/donut-chart-root.js +8 -5
- package/dist/drawer/root/drawer-root.d.ts +12 -1
- package/dist/drawer/root/drawer-root.js +9 -2
- package/dist/drilldown/root/drilldown-root.d.ts +5 -0
- package/dist/drilldown/root/drilldown-root.js +4 -1
- package/dist/element-events.generated.js +25 -3
- package/dist/file-input/root/file-input-root.d.ts +18 -3
- package/dist/file-input/root/file-input-root.js +34 -17
- package/dist/filter-input/chip/filter-chip.d.ts +13 -0
- package/dist/filter-input/chip/filter-chip.js +6 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +3 -1
- package/dist/filter-input/root/filter-input-root.d.ts +20 -3
- package/dist/filter-input/root/filter-input-root.js +8 -4
- package/dist/format-date/root/format-date-root.d.ts +20 -2
- package/dist/format-date/root/format-date-root.js +5 -2
- package/dist/graph/root/graph-model.d.ts +11 -0
- package/dist/graph/root/graph-model.js +4 -0
- package/dist/graph/root/graph-root.d.ts +78 -9
- package/dist/graph/root/graph-root.js +124 -27
- package/dist/heatmap/root/heatmap-root.d.ts +25 -4
- package/dist/heatmap/root/heatmap-root.js +27 -7
- package/dist/icon-button/root/icon-button-root.d.ts +5 -0
- package/dist/icon-button/root/icon-button-root.js +1 -0
- package/dist/input/root/input-root.d.ts +5 -0
- package/dist/input/root/input-root.js +4 -1
- package/dist/lightbox/root/lightbox-root.d.ts +14 -4
- package/dist/lightbox/root/lightbox-root.js +25 -7
- package/dist/line-chart/root/line-chart-root.d.ts +5 -0
- package/dist/line-chart/root/line-chart-root.js +4 -2
- package/dist/list/item/list-item.d.ts +32 -0
- package/dist/list/item/list-item.js +34 -7
- package/dist/list/root/list-root.d.ts +87 -0
- package/dist/list/root/list-root.js +112 -2
- package/dist/listbox/reorder/index.d.ts +1 -0
- package/dist/listbox/reorder/index.js +4 -0
- package/dist/listbox/reorder/listbox-reorder.d.ts +83 -0
- package/dist/listbox/reorder/listbox-reorder.js +151 -0
- package/dist/listbox/root/listbox-root.d.ts +68 -11
- package/dist/listbox/root/listbox-root.js +41 -9
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/loader/root/loader-root.js +3 -1
- package/dist/map/area/map-area.d.ts +5 -0
- package/dist/map/area/map-area.js +3 -1
- package/dist/map/buildings/map-buildings.d.ts +5 -0
- package/dist/map/buildings/map-buildings.js +3 -1
- package/dist/map/contours/map-contours.d.ts +5 -0
- package/dist/map/contours/map-contours.js +3 -1
- package/dist/map/landcover/map-landcover.d.ts +5 -0
- package/dist/map/landcover/map-landcover.js +3 -1
- package/dist/map/marker/map-marker.d.ts +16 -1
- package/dist/map/marker/map-marker.js +13 -5
- package/dist/map/points/map-points.d.ts +5 -0
- package/dist/map/points/map-points.js +6 -4
- package/dist/map/position/map-position.d.ts +5 -0
- package/dist/map/position/map-position.js +3 -1
- package/dist/map/raster/map-raster.d.ts +5 -0
- package/dist/map/raster/map-raster.js +3 -1
- package/dist/map/root/map-root.d.ts +33 -14
- package/dist/map/root/map-root.js +59 -22
- package/dist/map/route/map-route.d.ts +5 -0
- package/dist/map/route/map-route.js +3 -1
- package/dist/map/terrain/map-terrain.d.ts +5 -0
- package/dist/map/terrain/map-terrain.js +3 -1
- package/dist/menu/root/menu-root.d.ts +5 -0
- package/dist/menu/root/menu-root.js +3 -1
- package/dist/meter/root/meter-root.d.ts +16 -3
- package/dist/meter/root/meter-root.js +12 -5
- package/dist/navigation/root/navigation-root.d.ts +5 -0
- package/dist/navigation/root/navigation-root.js +3 -1
- package/dist/notifications/notification/notification.d.ts +5 -0
- package/dist/notifications/notification/notification.js +3 -1
- package/dist/notifications/root/notifications-root.d.ts +8 -0
- package/dist/notifications/root/notifications-root.js +10 -2
- package/dist/number-input/root/number-input-root.d.ts +21 -8
- package/dist/number-input/root/number-input-root.js +26 -11
- package/dist/object-inspector/root/object-inspector-root.d.ts +51 -12
- package/dist/object-inspector/root/object-inspector-root.js +21 -20
- package/dist/outline/root/outline-root.d.ts +5 -0
- package/dist/outline/root/outline-root.js +3 -1
- package/dist/pagination/root/pagination-root.d.ts +7 -1
- package/dist/pagination/root/pagination-root.js +16 -7
- package/dist/pagination/size/pagination-size.d.ts +7 -3
- package/dist/pagination/size/pagination-size.js +4 -2
- package/dist/pagination/summary/pagination-summary.d.ts +8 -6
- package/dist/pagination/summary/pagination-summary.js +4 -9
- package/dist/pin-input/code.d.ts +6 -6
- package/dist/pin-input/code.js +1 -5
- package/dist/pin-input/root/pin-input-root.d.ts +9 -3
- package/dist/pin-input/root/pin-input-root.js +6 -2
- package/dist/popover/root/popover-root.d.ts +12 -2
- package/dist/popover/root/popover-root.js +10 -4
- package/dist/progress/root/progress-root.d.ts +7 -2
- package/dist/progress/root/progress-root.js +5 -2
- package/dist/qr-code/name.d.ts +3 -2
- package/dist/qr-code/name.js +2 -2
- package/dist/qr-code/root/qr-code-root.d.ts +12 -2
- package/dist/qr-code/root/qr-code-root.js +9 -2
- package/dist/radio/group/radio-group.d.ts +11 -0
- package/dist/radio/group/radio-group.js +8 -2
- package/dist/rating/root/rating-root.d.ts +12 -1
- package/dist/rating/root/rating-root.js +10 -3
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +20 -2
- package/dist/scatter-chart/root/scatter-chart-root.js +20 -5
- package/dist/select/root/select-root.d.ts +11 -0
- package/dist/select/root/select-root.js +13 -3
- package/dist/skip-link/root/skip-link-root.d.ts +5 -0
- package/dist/skip-link/root/skip-link-root.js +3 -1
- package/dist/slider/root/slider-root.d.ts +7 -2
- package/dist/slider/root/slider-root.js +11 -5
- package/dist/sparkline/readings.d.ts +15 -5
- package/dist/sparkline/readings.js +3 -3
- package/dist/sparkline/root/sparkline-root.d.ts +9 -4
- package/dist/sparkline/root/sparkline-root.js +9 -3
- package/dist/speed-dial/root/speed-dial-root.d.ts +5 -0
- package/dist/speed-dial/root/speed-dial-root.js +4 -1
- package/dist/splitter/root/splitter-root.d.ts +6 -1
- package/dist/splitter/root/splitter-root.js +9 -4
- package/dist/steps/root/steps-root.d.ts +9 -2
- package/dist/steps/root/steps-root.js +6 -3
- package/dist/steps/step/step.d.ts +12 -0
- package/dist/steps/step/step.js +11 -2
- package/dist/switch/root/switch-root.d.ts +11 -0
- package/dist/switch/root/switch-root.js +8 -2
- package/dist/table/column/table-column.d.ts +11 -4
- package/dist/table/column/table-column.js +15 -10
- package/dist/table/grid-controller.d.ts +8 -3
- package/dist/table/grid-controller.js +17 -11
- package/dist/table/root/table-root.d.ts +107 -5
- package/dist/table/root/table-root.js +122 -20
- package/dist/table/row/table-row.d.ts +42 -0
- package/dist/table/row/table-row.js +40 -1
- package/dist/tabs/root/tabs-root.d.ts +5 -0
- package/dist/tabs/root/tabs-root.js +3 -1
- package/dist/tag/group/tag-group.d.ts +5 -0
- package/dist/tag/group/tag-group.js +3 -1
- package/dist/tag/root/tag-root.d.ts +14 -1
- package/dist/tag/root/tag-root.js +11 -8
- package/dist/textarea/root/textarea-root.d.ts +5 -0
- package/dist/textarea/root/textarea-root.js +3 -1
- package/dist/time-input/root/time-input-root.d.ts +14 -7
- package/dist/time-input/root/time-input-root.js +43 -32
- package/dist/time-picker/root/time-picker-root.d.ts +15 -7
- package/dist/time-picker/root/time-picker-root.js +25 -12
- package/dist/toast/item/toast-item.d.ts +7 -0
- package/dist/toast/item/toast-item.js +1 -0
- package/dist/toast/root/toast-root.d.ts +9 -1
- package/dist/toast/root/toast-root.js +5 -4
- package/dist/toolbar/root/toolbar-root.d.ts +5 -0
- package/dist/toolbar/root/toolbar-root.js +5 -2
- package/dist/tooltip/root/tooltip-root.d.ts +27 -17
- package/dist/tour/root/tour-root.d.ts +8 -2
- package/dist/tour/root/tour-root.js +4 -2
- package/dist/tour/stop/tour-stop.d.ts +5 -0
- package/dist/tour/stop/tour-stop.js +6 -1
- package/dist/tree/grip.d.ts +5 -0
- package/dist/tree/grip.js +1 -0
- package/dist/tree/item/tree-item.d.ts +24 -0
- package/dist/tree/item/tree-item.js +27 -5
- package/dist/tree/root/tree-root.d.ts +66 -1
- package/dist/tree/root/tree-root.js +77 -5
- package/dist/trend/root/trend-root.d.ts +20 -4
- package/dist/trend/root/trend-root.js +20 -5
- package/dist/video/root/video-root.d.ts +12 -3
- package/dist/video/root/video-root.js +41 -14
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +5 -0
- package/dist/video-playlist/root/video-playlist-root.js +3 -1
- package/dist/virtual-list/root/virtual-list-root.d.ts +19 -3
- package/dist/virtual-list/root/virtual-list-root.js +5 -2
- package/lint.json +1 -1
- package/package.json +9 -8
- package/types/jsx.d.ts +4014 -1862
- package/types/vue.d.ts +1266 -624
- package/types/words.d.ts +3280 -0
- package/dist/toast/hotkey.d.ts +0 -22
- package/dist/toast/hotkey.js +0 -23
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { CSSResult, ReactiveController } from 'lit';
|
|
2
|
+
import type { HelixHeadlessListbox } from '../root/listbox-root.js';
|
|
3
|
+
/**
|
|
4
|
+
* Moves the options of a `reorderable` listbox, by pointer and by keyboard,
|
|
5
|
+
* and says each move in the list's live region.
|
|
6
|
+
*
|
|
7
|
+
* **Its own entry**, `@fusion.dev/helix-headless/listbox/reorder`, so a list
|
|
8
|
+
* that never moves options carries none of this. Importing the entry gives
|
|
9
|
+
* every listbox one, and `reorderable` turns it on.
|
|
10
|
+
*
|
|
11
|
+
* - **Alt with Up or Down** moves the highlighted option a place at once, and
|
|
12
|
+
* Alt with Home or End to either end, as the APG's rearrangeable listbox
|
|
13
|
+
* does. The highlight stays on the option.
|
|
14
|
+
* - **A pointer** drags a whole option, with no grip: a press that travels is
|
|
15
|
+
* a drag, and one that does not is still a press that chooses it. The list
|
|
16
|
+
* scrolls near an edge.
|
|
17
|
+
* - **The page moves the options.** A drop sends `helix-before-reorder` and
|
|
18
|
+
* then `helix-reorder` with every value in the new order. An option in a
|
|
19
|
+
* group moves within its group, and a list of `items` moves its records.
|
|
20
|
+
*
|
|
21
|
+
* It marks the option being dragged with `:state(dragging)` and the one the
|
|
22
|
+
* drop indicator is beside with `:state(drop-before)` or `:state(drop-after)`.
|
|
23
|
+
* While a pointer drags an option, a copy of it follows the pointer as the
|
|
24
|
+
* list's `drag-preview` part. The styled tier's entry draws those through two
|
|
25
|
+
* sheets it hands in, which this adopts while the list reorders: one into
|
|
26
|
+
* each option, and one into the list.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ListboxReorderController implements ReactiveController {
|
|
29
|
+
private readonly host;
|
|
30
|
+
/** The sheet each option adopts while the list reorders, from the styled tier. */
|
|
31
|
+
sheet: CSSResult | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The sheet the list adopts while it reorders, from the styled tier, which
|
|
34
|
+
* draws the `drag-preview` part.
|
|
35
|
+
*/
|
|
36
|
+
listSheet: CSSResult | undefined;
|
|
37
|
+
/** The options marked last, so a mark that moves is taken off where it was. */
|
|
38
|
+
private marked;
|
|
39
|
+
private readonly reorder;
|
|
40
|
+
constructor(host: HelixHeadlessListbox, sheet?: CSSResult, listSheet?: CSSResult);
|
|
41
|
+
/**
|
|
42
|
+
* Marks where each option stands once the list has drawn: after the update,
|
|
43
|
+
* because a list of `items` draws its options in its own last step, and
|
|
44
|
+
* reuses each element for another record as it scrolls.
|
|
45
|
+
*/
|
|
46
|
+
hostUpdated(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Draws the list's `drag-preview` part at the end of its shadow root while
|
|
49
|
+
* it reorders, and takes it away after. The list's own template has none to
|
|
50
|
+
* draw, and the controller fills this one while a pointer drags an option.
|
|
51
|
+
*/
|
|
52
|
+
private drawPreview;
|
|
53
|
+
/** The options the list draws now: its elements, or the records it drew of `items`. */
|
|
54
|
+
private get drawn();
|
|
55
|
+
/** The option an event passed through. */
|
|
56
|
+
private optionOf;
|
|
57
|
+
/** The drawn option that stands for a value. */
|
|
58
|
+
private optionFor;
|
|
59
|
+
/**
|
|
60
|
+
* The values an option moves among: every record of `items`, or the options
|
|
61
|
+
* beside it, which in a list of groups are the options of its group.
|
|
62
|
+
*/
|
|
63
|
+
private keysAround;
|
|
64
|
+
/** Puts each option's state in a move on it, and the styled tier's sheets. */
|
|
65
|
+
private mark;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Gives every listbox of a class a `ListboxReorderController`, and the class
|
|
69
|
+
* the words it says, as properties that read and write their attributes:
|
|
70
|
+
* `movedLabel`, `canceledLabel`, `droppedLabel`, and `pickedUpLabel`.
|
|
71
|
+
*
|
|
72
|
+
* The entries call it for their own tier's class: the headless entry for
|
|
73
|
+
* `HelixHeadlessListbox`, and the styled one for `HelixListbox`, with the
|
|
74
|
+
* sheet that draws a move on an option and the sheet that draws the list's
|
|
75
|
+
* `drag-preview` part. A class that has registered keeps the list of what
|
|
76
|
+
* it was given when it did, so each is given its own.
|
|
77
|
+
*
|
|
78
|
+
* **Lists already on the page are given one too.** A page that imports the
|
|
79
|
+
* list and then this entry has its lists upgraded, and built, before this
|
|
80
|
+
* runs, so the ones in the document and its open shadow roots are found and
|
|
81
|
+
* given theirs, and every list built after gets one as it is built.
|
|
82
|
+
*/
|
|
83
|
+
export declare const reorderListbox: (element: typeof HelixHeadlessListbox, sheet?: CSSResult, listSheet?: CSSResult) => void;
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { ReorderController } from '@fusion.dev/helix-core';
|
|
2
|
+
const WORDS = {
|
|
3
|
+
canceledLabel: ['canceled-label', 'Canceled'],
|
|
4
|
+
droppedLabel: ['dropped-label', 'Dropped'],
|
|
5
|
+
movedLabel: ['moved-label', '{name} moved to position {position} of {count}'],
|
|
6
|
+
pickedUpLabel: ['picked-up-label', 'Picked up {name}'],
|
|
7
|
+
};
|
|
8
|
+
const MOVES = ['dragging', 'drop-after', 'drop-before'];
|
|
9
|
+
const keyOfItem = (item) => String(typeof item === 'object' ? item.value : item);
|
|
10
|
+
export class ListboxReorderController {
|
|
11
|
+
constructor(host, sheet, listSheet) {
|
|
12
|
+
this.marked = new Set();
|
|
13
|
+
this.host = host;
|
|
14
|
+
this.sheet = sheet;
|
|
15
|
+
this.listSheet = listSheet;
|
|
16
|
+
host.addController(this);
|
|
17
|
+
this.reorder = new ReorderController(host, {
|
|
18
|
+
axis: 'block',
|
|
19
|
+
box: (key) => this.optionFor(key)?.getBoundingClientRect(),
|
|
20
|
+
current: () => {
|
|
21
|
+
const active = this.drawn.find((option) => option.active);
|
|
22
|
+
return active && !active.disabled ? active.value : undefined;
|
|
23
|
+
},
|
|
24
|
+
enabled: () => host.reorderable && host.filter === '' && host.layout !== 'grid' && !host.isDisabled,
|
|
25
|
+
grip: (event) => {
|
|
26
|
+
const option = this.optionOf(event);
|
|
27
|
+
return option && !option.disabled ? { element: option, key: option.value } : undefined;
|
|
28
|
+
},
|
|
29
|
+
holds: false,
|
|
30
|
+
keys: (key) => this.keysAround(key),
|
|
31
|
+
name: (key) => this.optionFor(key)?.text || key,
|
|
32
|
+
preview: (key) => this.optionFor(key),
|
|
33
|
+
scroller: () => host.renderRoot?.querySelector('[part="items"]') ?? null,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
hostUpdated() {
|
|
37
|
+
queueMicrotask(() => this.mark());
|
|
38
|
+
}
|
|
39
|
+
drawPreview(on) {
|
|
40
|
+
const root = this.host.renderRoot;
|
|
41
|
+
const drawn = root?.querySelector('[part="drag-preview"]');
|
|
42
|
+
if (on && root && !drawn) {
|
|
43
|
+
const preview = document.createElement('div');
|
|
44
|
+
for (const [name, value] of [
|
|
45
|
+
['part', 'drag-preview'],
|
|
46
|
+
['popover', 'manual'],
|
|
47
|
+
['aria-hidden', 'true'],
|
|
48
|
+
['inert', ''],
|
|
49
|
+
]) {
|
|
50
|
+
preview.setAttribute(name, value);
|
|
51
|
+
}
|
|
52
|
+
root.append(preview);
|
|
53
|
+
}
|
|
54
|
+
else if (!on) {
|
|
55
|
+
drawn?.remove();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
get drawn() {
|
|
59
|
+
const host = this.host;
|
|
60
|
+
return (host.items
|
|
61
|
+
? [...(host.renderRoot?.querySelector('[data-rows]')?.children ?? [])]
|
|
62
|
+
: host.options);
|
|
63
|
+
}
|
|
64
|
+
optionOf(event) {
|
|
65
|
+
const drawn = this.drawn;
|
|
66
|
+
return event.composedPath().find((node) => drawn.includes(node));
|
|
67
|
+
}
|
|
68
|
+
optionFor(key) {
|
|
69
|
+
return this.drawn.find((option) => option.value === key);
|
|
70
|
+
}
|
|
71
|
+
keysAround(key) {
|
|
72
|
+
const { items, options } = this.host;
|
|
73
|
+
if (items) {
|
|
74
|
+
return items.map(keyOfItem);
|
|
75
|
+
}
|
|
76
|
+
const parent = options.find((option) => option.value === key)?.parentElement;
|
|
77
|
+
return options.filter((option) => option.parentElement === parent).map((one) => one.value);
|
|
78
|
+
}
|
|
79
|
+
mark() {
|
|
80
|
+
const on = this.host.reorderable;
|
|
81
|
+
adopt(this.host, this.listSheet, on);
|
|
82
|
+
this.drawPreview(on);
|
|
83
|
+
const drawn = this.drawn;
|
|
84
|
+
const marked = new Set();
|
|
85
|
+
for (const option of drawn) {
|
|
86
|
+
const move = on ? this.reorder.moveOf(option.value) : undefined;
|
|
87
|
+
if (move || this.marked.has(option)) {
|
|
88
|
+
for (const state of MOVES) {
|
|
89
|
+
option.toggleState(state, state === move);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (move) {
|
|
93
|
+
marked.add(option);
|
|
94
|
+
}
|
|
95
|
+
adopt(option, this.sheet, on);
|
|
96
|
+
}
|
|
97
|
+
for (const option of this.marked) {
|
|
98
|
+
if (!drawn.includes(option)) {
|
|
99
|
+
for (const state of MOVES) {
|
|
100
|
+
option.toggleState(state, false);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
this.marked = marked;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const adopt = (element, given, on) => {
|
|
108
|
+
const root = element.shadowRoot;
|
|
109
|
+
const sheet = given?.styleSheet;
|
|
110
|
+
if (!root || !sheet || root.adoptedStyleSheets.includes(sheet) === on) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
root.adoptedStyleSheets = on
|
|
114
|
+
? [...root.adoptedStyleSheets, sheet]
|
|
115
|
+
: root.adoptedStyleSheets.filter((one) => one !== sheet);
|
|
116
|
+
};
|
|
117
|
+
const given = new WeakMap();
|
|
118
|
+
const attach = (list, sheet, listSheet) => {
|
|
119
|
+
const controller = given.get(list) ?? new ListboxReorderController(list);
|
|
120
|
+
given.set(list, controller);
|
|
121
|
+
controller.sheet ??= sheet;
|
|
122
|
+
controller.listSheet ??= listSheet;
|
|
123
|
+
};
|
|
124
|
+
const onPage = (of, root = document) => [...root.querySelectorAll('*')].flatMap((node) => [
|
|
125
|
+
...(node instanceof of ? [node] : []),
|
|
126
|
+
...(node.shadowRoot ? onPage(of, node.shadowRoot) : []),
|
|
127
|
+
]);
|
|
128
|
+
export const reorderListbox = (element, sheet, listSheet) => {
|
|
129
|
+
element.addInitializer((host) => attach(host, sheet, listSheet));
|
|
130
|
+
if (typeof document !== 'undefined') {
|
|
131
|
+
for (const list of onPage(element)) {
|
|
132
|
+
attach(list, sheet, listSheet);
|
|
133
|
+
list.requestUpdate();
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const proto = element.prototype;
|
|
137
|
+
for (const [name, [attribute, fallback]] of Object.entries(WORDS)) {
|
|
138
|
+
if (name in proto) {
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
Object.defineProperty(proto, name, {
|
|
142
|
+
configurable: true,
|
|
143
|
+
get() {
|
|
144
|
+
return this.getAttribute(attribute) ?? fallback;
|
|
145
|
+
},
|
|
146
|
+
set(next) {
|
|
147
|
+
this.setAttribute(attribute, next);
|
|
148
|
+
},
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
@@ -38,6 +38,7 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
38
38
|
* | Shift with Home or End | With `multiple`, adds every option from the highlight to that end. In a filter field, hold Control as well. |
|
|
39
39
|
* | Control or Command with A | With `multiple`, chooses every option, or none where all are chosen. In a filter field, selects the text. |
|
|
40
40
|
* | Escape | In a filter field, clears the filter. |
|
|
41
|
+
* | Alt with Up or Down | In a `reorderable` list, moves the highlighted option a place. Alt with Home or End moves it to either end. |
|
|
41
42
|
*
|
|
42
43
|
* **ARIA.** The `items` part is the `listbox`, named by the label and
|
|
43
44
|
* described by the hint and the message, with `aria-multiselectable` under
|
|
@@ -53,6 +54,26 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
53
54
|
* left, such as "3 results", from `result-label` and `results-label`. A filter
|
|
54
55
|
* that leaves none says `empty-text`.
|
|
55
56
|
*
|
|
57
|
+
* **Moving options** is a separate import, `@fusion.dev/helix/listbox/reorder`,
|
|
58
|
+
* so a list that never moves options carries none of its code. With it
|
|
59
|
+
* imported, `reorderable` lets a reader move options:
|
|
60
|
+
*
|
|
61
|
+
* - Alt with Up or Down moves the highlighted option a place, and Alt with
|
|
62
|
+
* Home or End moves it to either end, as the APG's rearrangeable listbox
|
|
63
|
+
* does. The highlight stays on it.
|
|
64
|
+
* - A pointer drags an option, with a drop indicator, and the list scrolls near
|
|
65
|
+
* an edge. A press that does not travel still chooses the option.
|
|
66
|
+
* - A drop sends `helix-before-reorder`, which you can refuse, and then
|
|
67
|
+
* `helix-reorder`, whose `keys` hold every value in the new order. **You
|
|
68
|
+
* move the options**, or set `items` in the new order: the list moves no
|
|
69
|
+
* element of yours.
|
|
70
|
+
* - The list says each move in its `live` region. The words are the
|
|
71
|
+
* `moved-label`, `canceled-label`, `dropped-label`, and `picked-up-label`
|
|
72
|
+
* attributes, which the import reads.
|
|
73
|
+
* - An option in a group moves within its group. Options do not move while a
|
|
74
|
+
* filter narrows the list, under `layout="grid"`, or while the list is
|
|
75
|
+
* disabled.
|
|
76
|
+
*
|
|
56
77
|
* @since 0.1.0
|
|
57
78
|
* @status stable
|
|
58
79
|
* @category forms
|
|
@@ -71,8 +92,10 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
71
92
|
*
|
|
72
93
|
* @event {Event} change - Fired after the value changes.
|
|
73
94
|
* @event {HelixBeforeChangeEvent} helix-before-change - Fired when the value is about to change, and cancelable.
|
|
95
|
+
* @event {HelixBeforeReorderEvent} helix-before-reorder - Fired when an option is dropped at a new place, in a `reorderable` list with `@fusion.dev/helix/listbox/reorder` imported, with every value in the new order. Cancelable: cancel it to keep the option where it is.
|
|
74
96
|
* @event {HelixFilterEvent} helix-filter - Fired before the list is filtered, and cancelable.
|
|
75
97
|
* @event {HelixLoadMoreEvent} helix-load-more - Fired once the list is scrolled within a screen of its end, once for each number of options, and not while `loading` is set. Add the next page of options and set `loading` while you fetch it.
|
|
98
|
+
* @event {HelixReorderEvent} helix-reorder - Fired after `helix-before-reorder` when nobody canceled it. Move your options, or your `items`, to the order in `keys`. Cancelable: cancel it to say the move did not happen.
|
|
76
99
|
* @event {Event} input - Fired after the value changes.
|
|
77
100
|
*
|
|
78
101
|
* @csspart empty - The text shown when the list has no options to show, or the filter hides every one. `:state(no-results)` is set for the second.
|
|
@@ -83,7 +106,7 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
83
106
|
* @csspart hint - Help under the list.
|
|
84
107
|
* @csspart items - The list of options.
|
|
85
108
|
* @csspart label - The label above the list.
|
|
86
|
-
* @csspart live - A copy of the empty and loading text,
|
|
109
|
+
* @csspart live - A copy of the empty and loading text, how many options a filter left, and each move in a `reorderable` list, in a region that screen readers announce when it changes. Visually hidden in the styled tier.
|
|
87
110
|
* @csspart loading - The text shown while the options load.
|
|
88
111
|
* @csspart search - The region that holds the filter field.
|
|
89
112
|
* @csspart search-field - The filter field.
|
|
@@ -95,6 +118,11 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
95
118
|
* @cssstate no-results - A filter hid every option of a list that has some.
|
|
96
119
|
*/
|
|
97
120
|
export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
121
|
+
/**
|
|
122
|
+
* The key this family's words are registered under, its styled tag:
|
|
123
|
+
* `registerWords('de', { 'helix-listbox': { filterLabel: 'Filtern' } })`.
|
|
124
|
+
*/
|
|
125
|
+
static words: string;
|
|
98
126
|
protected readonly aria: AriaForwardController;
|
|
99
127
|
/**
|
|
100
128
|
* What a browser's autofill may choose, as a platform token such as
|
|
@@ -211,6 +239,9 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
211
239
|
manual: boolean;
|
|
212
240
|
/**
|
|
213
241
|
* Whether more than one option can be chosen.
|
|
242
|
+
*
|
|
243
|
+
* A press then toggles the option pressed, and Shift with a press adds every
|
|
244
|
+
* option from the one last chosen to it, as React Aria's list does.
|
|
214
245
|
*/
|
|
215
246
|
multiple: boolean;
|
|
216
247
|
/**
|
|
@@ -221,17 +252,27 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
221
252
|
*/
|
|
222
253
|
noResultsText?: string;
|
|
223
254
|
/**
|
|
224
|
-
*
|
|
225
|
-
*
|
|
255
|
+
* Lets a reader move options, once `@fusion.dev/helix/listbox/reorder` (or
|
|
256
|
+
* `@fusion.dev/helix-headless/listbox/reorder`) is imported: Alt with an
|
|
257
|
+
* arrow moves the highlighted option, and a pointer drags one. The list
|
|
258
|
+
* moves no option itself: you move your options, or your `items`, on
|
|
259
|
+
* `helix-reorder`. Without that import it does nothing, so a list that never
|
|
260
|
+
* moves options carries none of the code.
|
|
226
261
|
*/
|
|
227
|
-
|
|
262
|
+
reorderable: boolean;
|
|
228
263
|
/**
|
|
229
|
-
* What a screen reader hears when a filter leaves
|
|
230
|
-
*
|
|
264
|
+
* What a screen reader hears when a filter leaves one option, where
|
|
265
|
+
* `results-label` should not say it. `{count}` is the count.
|
|
231
266
|
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
|
|
267
|
+
* @deprecated Write every form in `results-label`, as `{count, plural, one
|
|
268
|
+
* {# result} other {# results}}`. Removed in the next major version.
|
|
269
|
+
*/
|
|
270
|
+
resultLabel?: string;
|
|
271
|
+
/**
|
|
272
|
+
* What a screen reader hears when a filter narrows the list. `{count}` is
|
|
273
|
+
* how many options are left, written in the locale, and each language
|
|
274
|
+
* writes the forms it has: `{count, plural, one {# wynik} few {# wyniki}
|
|
275
|
+
* many {# wyników} other {# wyniku}}`.
|
|
235
276
|
*/
|
|
236
277
|
resultsLabel: string;
|
|
237
278
|
/**
|
|
@@ -239,6 +280,12 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
239
280
|
* filter field, on Apple devices. `{name}` is the option's words.
|
|
240
281
|
*/
|
|
241
282
|
selectedLabel: string;
|
|
283
|
+
/**
|
|
284
|
+
* The message reported when the field is required and no option is chosen.
|
|
285
|
+
* Absent, or empty, is this sentence, or the words registered for the page's
|
|
286
|
+
* locale.
|
|
287
|
+
*/
|
|
288
|
+
valueMissingMessage: string;
|
|
242
289
|
/**
|
|
243
290
|
* Which option the keyboard is on, which is not what is chosen.
|
|
244
291
|
*/
|
|
@@ -248,8 +295,16 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
248
295
|
* it back on the first match.
|
|
249
296
|
*/
|
|
250
297
|
private parked;
|
|
251
|
-
/**
|
|
298
|
+
/**
|
|
299
|
+
* The option last chosen, which Shift with Space or with a press extends
|
|
300
|
+
* from.
|
|
301
|
+
*/
|
|
252
302
|
private anchor;
|
|
303
|
+
/**
|
|
304
|
+
* Whether Shift was held for the press being handled, read off the click on
|
|
305
|
+
* its way down to the option, which is where React Aria extends a range.
|
|
306
|
+
*/
|
|
307
|
+
private shifted;
|
|
253
308
|
/** The letters typed at the list, which move the highlight to a match. */
|
|
254
309
|
private readonly typeahead;
|
|
255
310
|
/**
|
|
@@ -404,7 +459,8 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
404
459
|
private readonly handleSelection;
|
|
405
460
|
/**
|
|
406
461
|
* Adds every option a reader can reach from the one last chosen to `to`,
|
|
407
|
-
* APG's Shift with Space
|
|
462
|
+
* APG's Shift with Space and React Aria's Shift with a press. With none
|
|
463
|
+
* chosen yet, it adds `to` alone and the next range starts there.
|
|
408
464
|
*/
|
|
409
465
|
private extend;
|
|
410
466
|
/**
|
|
@@ -421,6 +477,7 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
421
477
|
* a combobox or a command palette chose the highlighted option and closed the
|
|
422
478
|
* panel, so a query of two words could not be typed.
|
|
423
479
|
*/
|
|
480
|
+
private readonly handleClick;
|
|
424
481
|
private readonly handleKeydown;
|
|
425
482
|
/**
|
|
426
483
|
* Puts the highlight on an option, and chooses it where moving is choosing.
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, centerInView, columnStep, countLabel, customElement, DelayController, DisabledCascadeController, drawAutofill, endInSight,
|
|
7
|
+
import { AriaForwardController, centerInView, columnStep, countLabel, customElement, DelayController, DisabledCascadeController, drawAutofill, endInSight, formatWords, HelixFilterEvent, HelixFormElement, HelixLoadMoreEvent, hostAria, inlineStep, MixinCollection, MixinControllerValue, MixinField, markMatches, OptionWindowController, onApple, pageRows, rangeAdd, reportValues, requestChange, scrollItemIntoView, selectsAll, Typeahead, toggleEvery, typesCharacter, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { magnifyingGlass } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -34,12 +34,14 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
34
34
|
this.loadError = '';
|
|
35
35
|
this.manual = false;
|
|
36
36
|
this.multiple = false;
|
|
37
|
-
this.
|
|
38
|
-
this.resultsLabel = '{count} results';
|
|
37
|
+
this.reorderable = false;
|
|
38
|
+
this.resultsLabel = '{count, plural, one {# result} other {# results}}';
|
|
39
39
|
this.selectedLabel = '{name}, selected';
|
|
40
|
+
this.valueMissingMessage = 'Choose one to continue.';
|
|
40
41
|
this.activeValue = '';
|
|
41
42
|
this.parked = false;
|
|
42
43
|
this.anchor = '';
|
|
44
|
+
this.shifted = false;
|
|
43
45
|
this.typeahead = new Typeahead();
|
|
44
46
|
this.seen = new Set();
|
|
45
47
|
this.forwarded = false;
|
|
@@ -57,8 +59,18 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
57
59
|
if (event.defaultPrevented) {
|
|
58
60
|
return;
|
|
59
61
|
}
|
|
60
|
-
|
|
61
|
-
this.
|
|
62
|
+
const { value } = event.detail;
|
|
63
|
+
this.activeValue = value;
|
|
64
|
+
if (this.multiple && this.shifted) {
|
|
65
|
+
this.extend(value);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
this.choose(value);
|
|
69
|
+
}
|
|
70
|
+
this.shifted = false;
|
|
71
|
+
};
|
|
72
|
+
this.handleClick = (event) => {
|
|
73
|
+
this.shifted = event.shiftKey;
|
|
62
74
|
};
|
|
63
75
|
this.handleKeydown = (event) => {
|
|
64
76
|
const shown = this.shown.filter((option) => !option.disabled);
|
|
@@ -207,6 +219,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
207
219
|
this.navigate(event);
|
|
208
220
|
};
|
|
209
221
|
}
|
|
222
|
+
static { this.words = 'helix-listbox'; }
|
|
210
223
|
get filter() {
|
|
211
224
|
return this.filterState ?? this.defaultFilter;
|
|
212
225
|
}
|
|
@@ -246,7 +259,9 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
246
259
|
const count = this.shown.length;
|
|
247
260
|
this.announced =
|
|
248
261
|
this.filter.trim() && count
|
|
249
|
-
?
|
|
262
|
+
? this.resultLabel
|
|
263
|
+
? countLabel(count, this.resultLabel, this.resultsLabel, wordsLocale(this))
|
|
264
|
+
: formatWords(this, 'resultsLabel', { count })
|
|
250
265
|
: '';
|
|
251
266
|
}
|
|
252
267
|
tellActive(changed) {
|
|
@@ -259,7 +274,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
259
274
|
const active = this.entries.find((option) => option.value === this.activeValue);
|
|
260
275
|
if (active) {
|
|
261
276
|
this.announced = active.selected
|
|
262
|
-
?
|
|
277
|
+
? formatWords(this, 'selectedLabel', { name: active.text })
|
|
263
278
|
: active.text;
|
|
264
279
|
}
|
|
265
280
|
}
|
|
@@ -332,7 +347,11 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
332
347
|
}
|
|
333
348
|
extend(to) {
|
|
334
349
|
const reach = this.shown.filter((option) => !option.disabled).map((option) => option.value);
|
|
335
|
-
const
|
|
350
|
+
const from = reach.indexOf(this.anchor);
|
|
351
|
+
if (from < 0 && reach.includes(to)) {
|
|
352
|
+
this.anchor = to;
|
|
353
|
+
}
|
|
354
|
+
const taken = rangeAdd(this.values, reach, from, reach.indexOf(to));
|
|
336
355
|
if (taken) {
|
|
337
356
|
this.requestValue(taken.join(','));
|
|
338
357
|
}
|
|
@@ -430,17 +449,19 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
430
449
|
else {
|
|
431
450
|
this.internals.setFormValue(this.value === '' ? null : this.value);
|
|
432
451
|
}
|
|
433
|
-
this.reportRequired(this.value === '',
|
|
452
|
+
this.reportRequired(this.value === '', this.valueMissingMessage, 'items');
|
|
434
453
|
}
|
|
435
454
|
connectedCallback() {
|
|
436
455
|
super.connectedCallback();
|
|
437
456
|
this.addEventListener('helix-select', this.handleSelection);
|
|
438
457
|
this.addEventListener('keydown', this.handleKeydown);
|
|
458
|
+
this.addEventListener('click', this.handleClick, true);
|
|
439
459
|
}
|
|
440
460
|
disconnectedCallback() {
|
|
441
461
|
super.disconnectedCallback();
|
|
442
462
|
this.removeEventListener('helix-select', this.handleSelection);
|
|
443
463
|
this.removeEventListener('keydown', this.handleKeydown);
|
|
464
|
+
this.removeEventListener('click', this.handleClick, true);
|
|
444
465
|
markMatches(this, [], '');
|
|
445
466
|
}
|
|
446
467
|
willUpdate(changed) {
|
|
@@ -629,6 +650,7 @@ __decorate([
|
|
|
629
650
|
property({ attribute: 'default-filter' })
|
|
630
651
|
], HelixHeadlessListbox.prototype, "defaultFilter", void 0);
|
|
631
652
|
__decorate([
|
|
653
|
+
words,
|
|
632
654
|
property({ attribute: 'empty-text' })
|
|
633
655
|
], HelixHeadlessListbox.prototype, "emptyText", void 0);
|
|
634
656
|
__decorate([
|
|
@@ -641,6 +663,7 @@ __decorate([
|
|
|
641
663
|
property({ attribute: 'filter-delay', type: Number })
|
|
642
664
|
], HelixHeadlessListbox.prototype, "filterDelay", void 0);
|
|
643
665
|
__decorate([
|
|
666
|
+
words,
|
|
644
667
|
property({ attribute: 'filter-label' })
|
|
645
668
|
], HelixHeadlessListbox.prototype, "filterLabel", void 0);
|
|
646
669
|
__decorate([
|
|
@@ -661,15 +684,24 @@ __decorate([
|
|
|
661
684
|
__decorate([
|
|
662
685
|
property({ attribute: 'no-results-text' })
|
|
663
686
|
], HelixHeadlessListbox.prototype, "noResultsText", void 0);
|
|
687
|
+
__decorate([
|
|
688
|
+
property({ type: Boolean })
|
|
689
|
+
], HelixHeadlessListbox.prototype, "reorderable", void 0);
|
|
664
690
|
__decorate([
|
|
665
691
|
property({ attribute: 'result-label' })
|
|
666
692
|
], HelixHeadlessListbox.prototype, "resultLabel", void 0);
|
|
667
693
|
__decorate([
|
|
694
|
+
words,
|
|
668
695
|
property({ attribute: 'results-label' })
|
|
669
696
|
], HelixHeadlessListbox.prototype, "resultsLabel", void 0);
|
|
670
697
|
__decorate([
|
|
698
|
+
words,
|
|
671
699
|
property({ attribute: 'selected-label' })
|
|
672
700
|
], HelixHeadlessListbox.prototype, "selectedLabel", void 0);
|
|
701
|
+
__decorate([
|
|
702
|
+
words,
|
|
703
|
+
property({ attribute: 'value-missing-message' })
|
|
704
|
+
], HelixHeadlessListbox.prototype, "valueMissingMessage", void 0);
|
|
673
705
|
__decorate([
|
|
674
706
|
state()
|
|
675
707
|
], HelixHeadlessListbox.prototype, "activeValue", void 0);
|
|
@@ -45,6 +45,11 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
45
45
|
* @cssstate waiting - The loader is waiting out its `delay`, hidden and silent.
|
|
46
46
|
*/
|
|
47
47
|
export declare class HelixHeadlessLoader extends HelixElement {
|
|
48
|
+
/**
|
|
49
|
+
* The key this family's words are registered under, its styled tag:
|
|
50
|
+
* `registerWords('de', { 'helix-loader': { label: 'Wird geladen' } })`.
|
|
51
|
+
*/
|
|
52
|
+
static words: string;
|
|
48
53
|
/**
|
|
49
54
|
* How long the loader waits before it shows, in milliseconds, so work that
|
|
50
55
|
* finishes quickly never flashes one.
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, DelayController, elementById, HelixElement, hostAria, reportRuntime, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, DelayController, elementById, HelixElement, hostAria, reportRuntime, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { awaitRegion, claimBusy, releaseBusy } from '../busy.js';
|
|
@@ -18,6 +18,7 @@ let HelixHeadlessLoader = class HelixHeadlessLoader extends HelixElement {
|
|
|
18
18
|
this.region = null;
|
|
19
19
|
this.found = false;
|
|
20
20
|
}
|
|
21
|
+
static { this.words = 'helix-loader'; }
|
|
21
22
|
get waiting() {
|
|
22
23
|
return this.delay > 0 && !this.due.elapsed;
|
|
23
24
|
}
|
|
@@ -95,6 +96,7 @@ __decorate([
|
|
|
95
96
|
property()
|
|
96
97
|
], HelixHeadlessLoader.prototype, "for", void 0);
|
|
97
98
|
__decorate([
|
|
99
|
+
words,
|
|
98
100
|
property()
|
|
99
101
|
], HelixHeadlessLoader.prototype, "label", void 0);
|
|
100
102
|
HelixHeadlessLoader = __decorate([
|
|
@@ -23,6 +23,11 @@ import { type MapPoint } from '../route/map-route.js';
|
|
|
23
23
|
* @event {HelixMapPartChangeEvent} helix-map-part-change - The area's points, name, or color changed. Used by `connectMap`; pages do not need to listen for it.
|
|
24
24
|
*/
|
|
25
25
|
export declare class HelixHeadlessMapArea extends HelixElement {
|
|
26
|
+
/**
|
|
27
|
+
* The key this part's words are registered under, its styled tag:
|
|
28
|
+
* `registerWords('de', { 'helix-map-area': { label: 'Gebiet' } })`.
|
|
29
|
+
*/
|
|
30
|
+
static words: string;
|
|
26
31
|
/**
|
|
27
32
|
* Words drawn on the map with the area, such as `A` for a search sector.
|
|
28
33
|
* Unset, nothing is drawn. Keep it short: it is a caption on a map, and the
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, HelixElement, HelixMapPartChangeEvent } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, HelixElement, HelixMapPartChangeEvent, words } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { pointsConverter } from '../route/map-route.js';
|
|
@@ -16,6 +16,7 @@ let HelixHeadlessMapArea = class HelixHeadlessMapArea extends HelixElement {
|
|
|
16
16
|
this.layerKind = 'area';
|
|
17
17
|
this.label = 'Area';
|
|
18
18
|
}
|
|
19
|
+
static { this.words = 'helix-map-area'; }
|
|
19
20
|
updated(changed) {
|
|
20
21
|
super.updated(changed);
|
|
21
22
|
this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'layer' }));
|
|
@@ -37,6 +38,7 @@ __decorate([
|
|
|
37
38
|
property()
|
|
38
39
|
], HelixHeadlessMapArea.prototype, "group", void 0);
|
|
39
40
|
__decorate([
|
|
41
|
+
words,
|
|
40
42
|
property()
|
|
41
43
|
], HelixHeadlessMapArea.prototype, "label", void 0);
|
|
42
44
|
__decorate([
|
|
@@ -20,6 +20,11 @@ import { nothing, type PropertyValues } from 'lit';
|
|
|
20
20
|
* @event {HelixMapPartChangeEvent} helix-map-part-change - The layer's name or color changed. Used by `connectMap`; pages do not need to listen for it.
|
|
21
21
|
*/
|
|
22
22
|
export declare class HelixHeadlessMapBuildings extends HelixElement {
|
|
23
|
+
/**
|
|
24
|
+
* The key this part's words are registered under, its styled tag:
|
|
25
|
+
* `registerWords('de', { 'helix-map-buildings': { label: '3D-Gebäude' } })`.
|
|
26
|
+
*/
|
|
27
|
+
static words: string;
|
|
23
28
|
/** More about the buildings. Read after the label in the frame's list. */
|
|
24
29
|
description?: string;
|
|
25
30
|
/**
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, HelixElement, HelixMapPartChangeEvent } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, HelixElement, HelixMapPartChangeEvent, words } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessMapBuildings = class HelixHeadlessMapBuildings extends HelixElement {
|
|
@@ -14,6 +14,7 @@ let HelixHeadlessMapBuildings = class HelixHeadlessMapBuildings extends HelixEle
|
|
|
14
14
|
this.layerKind = 'buildings';
|
|
15
15
|
this.label = '3D buildings';
|
|
16
16
|
}
|
|
17
|
+
static { this.words = 'helix-map-buildings'; }
|
|
17
18
|
updated(changed) {
|
|
18
19
|
super.updated(changed);
|
|
19
20
|
this.dispatchEvent(new HelixMapPartChangeEvent({ kind: 'layer' }));
|
|
@@ -29,6 +30,7 @@ __decorate([
|
|
|
29
30
|
property()
|
|
30
31
|
], HelixHeadlessMapBuildings.prototype, "group", void 0);
|
|
31
32
|
__decorate([
|
|
33
|
+
words,
|
|
32
34
|
property()
|
|
33
35
|
], HelixHeadlessMapBuildings.prototype, "label", void 0);
|
|
34
36
|
HelixHeadlessMapBuildings = __decorate([
|