@fusion.dev/helix-headless 0.143.0 → 0.145.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 +16990 -1383
- package/dist/accordion/item/accordion-item.d.ts +48 -12
- package/dist/accordion/item/accordion-item.js +26 -5
- package/dist/accordion/root/accordion-root.d.ts +6 -0
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +21 -1
- package/dist/announcement/root/announcement-root.js +36 -1
- package/dist/app-header/root/app-header-root.d.ts +7 -0
- package/dist/app-header/root/app-header-root.js +5 -1
- package/dist/app-header/sectioning.d.ts +7 -0
- package/dist/app-header/sectioning.js +26 -0
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +24 -7
- package/dist/avatar/root/avatar-root.d.ts +14 -0
- package/dist/avatar/root/avatar-root.js +23 -9
- package/dist/badge/root/badge-root.d.ts +11 -7
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
- package/dist/bar-chart/root/bar-chart-root.js +17 -10
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
- package/dist/button/root/button-root.d.ts +47 -1
- package/dist/button/root/button-root.js +38 -4
- package/dist/callout/root/callout-root.d.ts +18 -1
- package/dist/callout/root/callout-root.js +15 -4
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +121 -40
- package/dist/card/root/card-root.d.ts +30 -1
- package/dist/card/root/card-root.js +38 -5
- package/dist/carousel/root/carousel-root.d.ts +90 -0
- package/dist/carousel/root/carousel-root.js +134 -12
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +25 -9
- package/dist/chat/naming.d.ts +22 -0
- package/dist/chat/naming.js +12 -0
- package/dist/chat/relative-clock.d.ts +39 -0
- package/dist/chat/relative-clock.js +31 -0
- package/dist/chat/root/chat-root.d.ts +36 -0
- package/dist/chat/root/chat-root.js +24 -1
- package/dist/checkbox/root/checkbox-root.js +2 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
- package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
- package/dist/code-block/lines.d.ts +13 -0
- package/dist/code-block/lines.js +2 -0
- package/dist/code-block/root/code-block-root.d.ts +38 -1
- package/dist/code-block/root/code-block-root.js +28 -7
- package/dist/color-input/root/color-input-root.d.ts +34 -1
- package/dist/color-input/root/color-input-root.js +23 -4
- package/dist/color-picker/channels.d.ts +26 -0
- package/dist/color-picker/channels.js +84 -0
- package/dist/color-picker/root/color-picker-root.d.ts +81 -5
- package/dist/color-picker/root/color-picker-root.js +103 -10
- package/dist/combobox/root/combobox-root.d.ts +38 -3
- package/dist/combobox/root/combobox-root.js +64 -2
- package/dist/command/root/command-root.d.ts +30 -4
- package/dist/command/root/command-root.js +33 -3
- package/dist/copy-button/from.d.ts +22 -0
- package/dist/copy-button/from.js +28 -0
- package/dist/copy-button/root/copy-button-root.d.ts +47 -1
- package/dist/copy-button/root/copy-button-root.js +44 -8
- package/dist/data-table/root/data-table-root.d.ts +150 -2
- package/dist/data-table/root/data-table-root.js +303 -29
- package/dist/data-table/tree.d.ts +40 -0
- package/dist/data-table/tree.js +55 -0
- package/dist/date-input/root/date-input-root.d.ts +73 -4
- package/dist/date-input/root/date-input-root.js +93 -43
- package/dist/date-picker/root/date-picker-root.d.ts +145 -1
- package/dist/date-picker/root/date-picker-root.js +239 -48
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- package/dist/dialog/description.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +64 -1
- package/dist/dialog/root/dialog-root.js +49 -23
- package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
- package/dist/donut-chart/root/donut-chart-root.js +21 -6
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +95 -19
- package/dist/drawer/swipe-start.d.ts +9 -0
- package/dist/drawer/swipe-start.js +12 -0
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +11 -0
- package/dist/drilldown/root/drilldown-root.js +8 -3
- package/dist/element-events.generated.js +61 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +47 -0
- package/dist/file-input/root/file-input-root.js +60 -22
- package/dist/file-input/screen.d.ts +35 -0
- package/dist/file-input/screen.js +49 -0
- package/dist/filter-input/menu/filter-menu.d.ts +3 -0
- package/dist/filter-input/menu/filter-menu.js +8 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -4
- package/dist/filter-input/root/filter-input-root.js +67 -3
- package/dist/filter-input/suggest.d.ts +17 -0
- package/dist/filter-input/suggest.js +23 -0
- package/dist/format-date/options.d.ts +33 -0
- package/dist/format-date/options.js +42 -0
- package/dist/format-date/root/format-date-root.d.ts +51 -0
- package/dist/format-date/root/format-date-root.js +58 -38
- package/dist/heatmap/root/heatmap-root.d.ts +23 -6
- package/dist/heatmap/root/heatmap-root.js +24 -13
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/registry.d.ts +37 -0
- package/dist/icon/registry.js +83 -0
- package/dist/icon/root/icon-root.d.ts +30 -4
- package/dist/icon/root/icon-root.js +41 -6
- package/dist/icon/root/index.d.ts +2 -0
- package/dist/icon/root/index.js +2 -0
- package/dist/icon/set.d.ts +1 -0
- package/dist/icon/set.js +3 -0
- package/dist/image/root/image-root.d.ts +14 -0
- package/dist/image/root/image-root.js +23 -2
- package/dist/input/root/input-root.d.ts +11 -0
- package/dist/input/root/input-root.js +16 -1
- package/dist/kbd/root/kbd-root.d.ts +20 -13
- package/dist/kbd/root/kbd-root.js +35 -37
- package/dist/kbd/shortcut.d.ts +18 -0
- package/dist/kbd/shortcut.js +35 -0
- package/dist/legend/hidden-series.d.ts +8 -0
- package/dist/legend/hidden-series.js +13 -0
- package/dist/legend/root/legend-root.d.ts +56 -0
- package/dist/legend/root/legend-root.js +54 -5
- package/dist/lightbox/item/lightbox-item.d.ts +15 -0
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +61 -1
- package/dist/lightbox/root/lightbox-root.js +94 -4
- package/dist/line-chart/root/line-chart-root.d.ts +11 -3
- package/dist/line-chart/root/line-chart-root.js +19 -5
- package/dist/list/item/list-item.d.ts +68 -1
- package/dist/list/item/list-item.js +66 -4
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +106 -9
- package/dist/list/root/list-root.js +189 -4
- package/dist/list/selection.d.ts +19 -0
- package/dist/list/selection.js +21 -0
- package/dist/listbox/root/listbox-root.d.ts +74 -3
- package/dist/listbox/root/listbox-root.js +86 -9
- package/dist/loader/busy.d.ts +17 -0
- package/dist/loader/busy.js +24 -0
- package/dist/loader/root/loader-root.d.ts +37 -0
- package/dist/loader/root/loader-root.js +52 -3
- package/dist/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +21 -0
- package/dist/megamenu/root/megamenu-root.js +16 -2
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +38 -11
- package/dist/menu/item/menu-item.js +33 -1
- package/dist/menu/root/menu-root.d.ts +25 -1
- package/dist/menu/root/menu-root.js +63 -6
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +7 -0
- package/dist/meter/root/meter-root.js +6 -3
- package/dist/navigation/root/navigation-root.d.ts +16 -1
- package/dist/navigation/root/navigation-root.js +27 -1
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/notification/notification.d.ts +17 -0
- package/dist/notifications/notification/notification.js +21 -2
- package/dist/notifications/root/notifications-root.d.ts +60 -0
- package/dist/notifications/root/notifications-root.js +76 -1
- package/dist/number-input/root/number-input-root.d.ts +47 -0
- package/dist/number-input/root/number-input-root.js +58 -22
- package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
- package/dist/object-inspector/root/object-inspector-root.js +180 -80
- package/dist/object-inspector/rows.d.ts +57 -0
- package/dist/object-inspector/rows.js +86 -0
- package/dist/option/root/option-root.d.ts +54 -5
- package/dist/option/root/option-root.js +34 -5
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +68 -3
- package/dist/outline/root/outline-root.js +73 -8
- package/dist/pagination/size/pagination-size.d.ts +11 -2
- package/dist/pagination/size/pagination-size.js +19 -4
- package/dist/pin-input/format.d.ts +7 -0
- package/dist/pin-input/format.js +16 -0
- package/dist/pin-input/root/pin-input-root.d.ts +21 -0
- package/dist/pin-input/root/pin-input-root.js +29 -2
- package/dist/popover/root/popover-root.d.ts +62 -4
- package/dist/popover/root/popover-root.js +53 -5
- package/dist/progress/root/progress-root.d.ts +7 -0
- package/dist/progress/root/progress-root.js +9 -3
- package/dist/qr-code/export.d.ts +31 -0
- package/dist/qr-code/export.js +10 -0
- package/dist/qr-code/root/qr-code-root.d.ts +26 -0
- package/dist/qr-code/root/qr-code-root.js +49 -2
- package/dist/radio/group/radio-group.d.ts +17 -0
- package/dist/radio/group/radio-group.js +14 -1
- package/dist/rating/root/rating-root.d.ts +25 -0
- package/dist/rating/root/rating-root.js +46 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
- package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
- package/dist/scroll-area/root/scroll-area-root.js +218 -3
- package/dist/scroll-area/scrollbar.d.ts +65 -0
- package/dist/scroll-area/scrollbar.js +24 -0
- package/dist/select/root/select-root.d.ts +24 -0
- package/dist/select/root/select-root.js +21 -7
- package/dist/skeleton/root/skeleton-root.d.ts +25 -0
- package/dist/skeleton/root/skeleton-root.js +17 -2
- package/dist/slider/root/slider-root.d.ts +39 -0
- package/dist/slider/root/slider-root.js +45 -9
- package/dist/splitter/root/splitter-root.d.ts +13 -0
- package/dist/splitter/root/splitter-root.js +20 -2
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +2 -0
- package/dist/stat/root/stat-root.js +1 -1
- package/dist/steps/reach.d.ts +15 -0
- package/dist/steps/reach.js +12 -0
- package/dist/steps/root/steps-root.d.ts +30 -0
- package/dist/steps/root/steps-root.js +53 -0
- package/dist/steps/step/step.d.ts +39 -2
- package/dist/steps/step/step.js +29 -7
- package/dist/switch/root/switch-root.d.ts +12 -2
- package/dist/switch/root/switch-root.js +6 -1
- package/dist/table/column/table-column.d.ts +11 -0
- package/dist/table/column/table-column.js +6 -1
- package/dist/table/root/table-root.d.ts +101 -0
- package/dist/table/root/table-root.js +166 -5
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +9 -5
- package/dist/tabs/panel/tab-panel.js +3 -4
- package/dist/tabs/root/tabs-root.d.ts +25 -1
- package/dist/tabs/root/tabs-root.js +21 -3
- package/dist/tabs/tab/tab.d.ts +36 -4
- package/dist/tabs/tab/tab.js +46 -3
- package/dist/tag/group/tag-group.d.ts +107 -0
- package/dist/tag/group/tag-group.js +157 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +60 -0
- package/dist/tag/root/tag-root.js +74 -18
- package/dist/tag/selection.d.ts +10 -0
- package/dist/tag/selection.js +12 -0
- package/dist/textarea/grow.d.ts +22 -0
- package/dist/textarea/grow.js +20 -0
- package/dist/textarea/root/textarea-root.d.ts +9 -0
- package/dist/textarea/root/textarea-root.js +9 -1
- package/dist/time-input/root/time-input-root.d.ts +44 -5
- package/dist/time-input/root/time-input-root.js +69 -39
- package/dist/time-picker/root/time-picker-root.d.ts +54 -8
- package/dist/time-picker/root/time-picker-root.js +121 -91
- package/dist/timeline/group/timeline-group.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +26 -18
- package/dist/toast/item/toast-item.js +55 -48
- package/dist/toast/root/toast-root.d.ts +42 -8
- package/dist/toast/root/toast-root.js +64 -4
- package/dist/toggle/group/toggle-group.d.ts +57 -15
- package/dist/toggle/group/toggle-group.js +69 -9
- package/dist/toggle/root/toggle-root.d.ts +12 -1
- package/dist/toggle/root/toggle-root.js +11 -3
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/focus-target.d.ts +6 -0
- package/dist/tooltip/focus-target.js +9 -0
- package/dist/tooltip/root/tooltip-root.d.ts +42 -17
- package/dist/tooltip/root/tooltip-root.js +50 -9
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +35 -0
- package/dist/tour/root/tour-root.js +56 -5
- package/dist/tour/stop/tour-stop.d.ts +53 -8
- package/dist/tour/stop/tour-stop.js +45 -15
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +54 -1
- package/dist/tree/item/tree-item.js +89 -20
- package/dist/tree/root/tree-root.d.ts +37 -0
- package/dist/tree/root/tree-root.js +51 -6
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +26 -0
- package/dist/trend/root/trend-root.d.ts +13 -0
- package/dist/trend/root/trend-root.js +14 -9
- package/dist/video/media-events.d.ts +49 -0
- package/dist/video/media-events.js +39 -0
- package/dist/video/root/video-root.d.ts +99 -13
- package/dist/video/root/video-root.js +84 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +70 -2
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +30 -0
- package/dist/virtual-list/fill.js +39 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
- package/dist/virtual-list/root/virtual-list-root.js +175 -34
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +8871 -1286
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1918 -269
|
@@ -22,6 +22,13 @@ declare const HelixHeadlessTour_base: (new (...args: any[]) => import("@fusion.d
|
|
|
22
22
|
* `toggle` work as they do on `Dialog`. Setting `open` starts the run, and
|
|
23
23
|
* `skip()` and `requestOpen(false)` end it early.
|
|
24
24
|
*
|
|
25
|
+
* Each stop is told its place in the run, from `progress-label`, such as "2 of
|
|
26
|
+
* 5". It describes the stop's panel, so a screen reader says it at every stop,
|
|
27
|
+
* and `progress` draws it in the panel as well. A dialog or a floating stop,
|
|
28
|
+
* which has nothing to light, is shown over the `backdrop` part. At a `wait`
|
|
29
|
+
* stop the run waits for that stop's target to be on the page, and moves on by
|
|
30
|
+
* itself.
|
|
31
|
+
*
|
|
25
32
|
* **Focus follows the run.** Opening moves focus to the first stop's panel,
|
|
26
33
|
* and moving on from a control in a stop moves it to the next one. Ending the
|
|
27
34
|
* tour puts focus back on the element that had it when the tour opened, unless
|
|
@@ -45,6 +52,7 @@ declare const HelixHeadlessTour_base: (new (...args: any[]) => import("@fusion.d
|
|
|
45
52
|
* @event {HelixTourAskEvent} helix-tour-ask - Fired when a stop's control is pressed to move the tour. The stop sends it, and the tour handles it.
|
|
46
53
|
* @event {ToggleEvent} toggle - Sent when the tour starts or ends, with `newState` and `oldState`.
|
|
47
54
|
*
|
|
55
|
+
* @csspart backdrop - Behind a dialog or a floating stop, which lights nothing. It draws no box until you give it one.
|
|
48
56
|
* @csspart spotlight - The box over the current target. It also draws the dimmed area around the target.
|
|
49
57
|
*
|
|
50
58
|
* @cssstate open - While the tour is running.
|
|
@@ -86,6 +94,15 @@ export declare class HelixHeadlessTour extends HelixHeadlessTour_base {
|
|
|
86
94
|
* Label for the control that goes on.
|
|
87
95
|
*/
|
|
88
96
|
nextLabel: string;
|
|
97
|
+
/**
|
|
98
|
+
* Draws each stop's place in the run in its panel, as well as saying it.
|
|
99
|
+
*/
|
|
100
|
+
progress: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Each stop's place in the run, with `{index}` and `{count}` filled in.
|
|
103
|
+
* Translate it with the rest of your text.
|
|
104
|
+
*/
|
|
105
|
+
progressLabel: string;
|
|
89
106
|
/**
|
|
90
107
|
* Label for the control that leaves the tour.
|
|
91
108
|
*/
|
|
@@ -160,6 +177,24 @@ export declare class HelixHeadlessTour extends HelixHeadlessTour_base {
|
|
|
160
177
|
private settle;
|
|
161
178
|
/** The current stop's target while the run is open, which is what the light falls on. */
|
|
162
179
|
private get lit();
|
|
180
|
+
/** The stop being shown, or nothing where there are no stops. */
|
|
181
|
+
private get current();
|
|
182
|
+
/** Stops waiting, where a `wait` stop is waiting. */
|
|
183
|
+
private unwait;
|
|
184
|
+
/** The `wait` stop being waited on, so a render that changed nothing starts nothing. */
|
|
185
|
+
private waiting;
|
|
186
|
+
/**
|
|
187
|
+
* Waits at a `wait` stop for its target to be on the page, then moves on.
|
|
188
|
+
*
|
|
189
|
+
* On the stop's own root, which is where its `for` resolves.
|
|
190
|
+
*/
|
|
191
|
+
private wait;
|
|
192
|
+
/**
|
|
193
|
+
* Whether the current stop is shown over the backdrop: a dialog or a floating
|
|
194
|
+
* stop, or one with no target, which have nothing to light. Read with the
|
|
195
|
+
* light, after the stops are known, since the first render cannot know them.
|
|
196
|
+
*/
|
|
197
|
+
private veiled;
|
|
163
198
|
/** Reads the current target's box, which is where the light falls. */
|
|
164
199
|
private light;
|
|
165
200
|
/** Keeps `sizer` on the lit target, and on nothing once there is none. */
|
|
@@ -4,9 +4,10 @@ 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, deepActiveElement, deepContains, HelixActivateEvent, HelixBeforeActivateEvent, HelixCompleteEvent, HelixElement, hostAria, MixinControllerOpen, requestChange, whenHydrated, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, deepActiveElement, deepContains, fillTemplate, HelixActivateEvent, HelixBeforeActivateEvent, HelixCompleteEvent, HelixElement, hostAria, MixinControllerOpen, requestChange, whenHydrated, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property, queryAssignedElements, state } from 'lit/decorators.js';
|
|
10
|
+
import { onPage, waitFor } from '../wait.js';
|
|
10
11
|
let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(HelixElement) {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
@@ -16,6 +17,8 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
16
17
|
this.indexState = undefined;
|
|
17
18
|
this.label = '';
|
|
18
19
|
this.nextLabel = '';
|
|
20
|
+
this.progress = false;
|
|
21
|
+
this.progressLabel = '{index} of {count}';
|
|
19
22
|
this.skipLabel = '';
|
|
20
23
|
this.spotlightPadding = 8;
|
|
21
24
|
this.sizer = undefined;
|
|
@@ -42,6 +45,7 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
42
45
|
this.light();
|
|
43
46
|
};
|
|
44
47
|
this.followed = false;
|
|
48
|
+
this.veiled = false;
|
|
45
49
|
}
|
|
46
50
|
get index() {
|
|
47
51
|
return this.indexState ?? this.defaultIndex;
|
|
@@ -108,6 +112,9 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
108
112
|
window.removeEventListener('scroll', this.handleViewport, { capture: true });
|
|
109
113
|
this.sizer?.disconnect();
|
|
110
114
|
this.sized = undefined;
|
|
115
|
+
this.unwait?.();
|
|
116
|
+
this.unwait = undefined;
|
|
117
|
+
this.waiting = undefined;
|
|
111
118
|
}
|
|
112
119
|
willUpdate(changed) {
|
|
113
120
|
super.willUpdate(changed);
|
|
@@ -121,6 +128,7 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
121
128
|
this.settle();
|
|
122
129
|
this.light();
|
|
123
130
|
this.follow(changed);
|
|
131
|
+
this.wait();
|
|
124
132
|
}
|
|
125
133
|
follow(changed) {
|
|
126
134
|
if (!this.followed) {
|
|
@@ -168,6 +176,11 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
168
176
|
stop.current = this.open && index === at;
|
|
169
177
|
stop.first = index === 0;
|
|
170
178
|
stop.last = index === stops.length - 1;
|
|
179
|
+
stop.position = fillTemplate(this.progressLabel, {
|
|
180
|
+
count: stops.length,
|
|
181
|
+
index: index + 1,
|
|
182
|
+
});
|
|
183
|
+
stop.progress = this.progress;
|
|
171
184
|
if (this.backLabel !== '') {
|
|
172
185
|
stop.backLabel = this.backLabel;
|
|
173
186
|
}
|
|
@@ -184,12 +197,41 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
184
197
|
});
|
|
185
198
|
}
|
|
186
199
|
get lit() {
|
|
200
|
+
const stop = this.current;
|
|
201
|
+
return this.open && stop?.type === undefined ? stop?.target : undefined;
|
|
202
|
+
}
|
|
203
|
+
get current() {
|
|
187
204
|
const stops = this.stops;
|
|
188
|
-
return this.
|
|
189
|
-
|
|
190
|
-
|
|
205
|
+
return stops[Math.max(0, Math.min(this.index, stops.length - 1))];
|
|
206
|
+
}
|
|
207
|
+
wait() {
|
|
208
|
+
const stop = this.open ? this.current : undefined;
|
|
209
|
+
const next = stop?.type === 'wait' ? stop : undefined;
|
|
210
|
+
if (next === this.waiting) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
this.unwait?.();
|
|
214
|
+
this.unwait = undefined;
|
|
215
|
+
this.waiting = next;
|
|
216
|
+
if (!next) {
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
this.unwait = waitFor(next.getRootNode(), () => onPage(next.target), () => {
|
|
220
|
+
this.waiting = undefined;
|
|
221
|
+
this.unwait = undefined;
|
|
222
|
+
queueMicrotask(() => {
|
|
223
|
+
if (this.open && this.current === next) {
|
|
224
|
+
this.next();
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
});
|
|
191
228
|
}
|
|
192
229
|
light() {
|
|
230
|
+
const stop = this.open ? this.current : undefined;
|
|
231
|
+
const veiled = stop !== undefined && stop.type !== 'wait' && (stop.type !== undefined || !stop.target);
|
|
232
|
+
if (veiled !== this.veiled) {
|
|
233
|
+
this.veiled = veiled;
|
|
234
|
+
}
|
|
193
235
|
const target = this.lit;
|
|
194
236
|
this.watch(target);
|
|
195
237
|
if (!target || typeof target.getBoundingClientRect !== 'function') {
|
|
@@ -227,7 +269,7 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
227
269
|
}
|
|
228
270
|
render() {
|
|
229
271
|
const spot = this.spot;
|
|
230
|
-
return html `${spot === undefined
|
|
272
|
+
return html `${this.veiled ? html `<div part="backdrop" aria-hidden="true"></div>` : ''}${spot === undefined
|
|
231
273
|
? ''
|
|
232
274
|
: html `<div
|
|
233
275
|
part="spotlight"
|
|
@@ -255,6 +297,12 @@ __decorate([
|
|
|
255
297
|
__decorate([
|
|
256
298
|
property({ attribute: 'next-label' })
|
|
257
299
|
], HelixHeadlessTour.prototype, "nextLabel", void 0);
|
|
300
|
+
__decorate([
|
|
301
|
+
property({ type: Boolean })
|
|
302
|
+
], HelixHeadlessTour.prototype, "progress", void 0);
|
|
303
|
+
__decorate([
|
|
304
|
+
property({ attribute: 'progress-label' })
|
|
305
|
+
], HelixHeadlessTour.prototype, "progressLabel", void 0);
|
|
258
306
|
__decorate([
|
|
259
307
|
property({ attribute: 'skip-label' })
|
|
260
308
|
], HelixHeadlessTour.prototype, "skipLabel", void 0);
|
|
@@ -267,6 +315,9 @@ __decorate([
|
|
|
267
315
|
__decorate([
|
|
268
316
|
state()
|
|
269
317
|
], HelixHeadlessTour.prototype, "spot", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
state()
|
|
320
|
+
], HelixHeadlessTour.prototype, "veiled", void 0);
|
|
270
321
|
HelixHeadlessTour = __decorate([
|
|
271
322
|
customElement('helix-headless-tour')
|
|
272
323
|
], HelixHeadlessTour);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HelixElement, type Placement } from '@fusion.dev/helix-core';
|
|
2
|
-
import type
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../button/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* @summary One stop on a tour: the element it points at, and a panel of content about it.
|
|
@@ -15,7 +15,16 @@ import '../../button/index.js';
|
|
|
15
15
|
* - **Visibility.** The stop shows when it is `current`, which the root sets.
|
|
16
16
|
*
|
|
17
17
|
* Put any content in the stop, such as a `Card`, or a heading and a line of
|
|
18
|
-
* text.
|
|
18
|
+
* text. The `heading` and `description` slots are optional places for the
|
|
19
|
+
* title and the line under it, which then name and describe the panel.
|
|
20
|
+
*
|
|
21
|
+
* **A stop has a type.** Without one it is a bubble pointing at its target.
|
|
22
|
+
* `type="dialog"` is a panel in the middle of the window, over a backdrop, for
|
|
23
|
+
* a welcome or a summary with nothing to point at. `type="floating"` is a
|
|
24
|
+
* panel in a corner of the window, which the styled tier puts at the end of
|
|
25
|
+
* the line, for a note that points at nothing in particular. `type="wait"` shows nothing: the tour waits
|
|
26
|
+
* for the element `for` names to be on the page, such as a menu the reader has
|
|
27
|
+
* to open, and moves on by itself.
|
|
19
28
|
*
|
|
20
29
|
* **The buttons are slot fallback.** With nothing in the `actions` slot, you
|
|
21
30
|
* get Back, Next, and Skip, already wired. Slot your own `actions` and drive
|
|
@@ -25,9 +34,12 @@ import '../../button/index.js';
|
|
|
25
34
|
* on the page from markup. It resolves against the stop's root node, so a stop
|
|
26
35
|
* inside a shadow tree points at a target in that tree.
|
|
27
36
|
*
|
|
28
|
-
* The panel is a `group`,
|
|
29
|
-
*
|
|
30
|
-
*
|
|
37
|
+
* The panel is a `group`, and a `dialog` for a dialog stop, only while the
|
|
38
|
+
* stop is shown. It is named by the `heading` slot, then by the first heading
|
|
39
|
+
* in the content, then by `label`, and otherwise by its place in the tour. It
|
|
40
|
+
* is described by the `description` slot and by its place, such as "2 of 5",
|
|
41
|
+
* so a screen reader says where the reader is at every stop. `focus()` moves
|
|
42
|
+
* focus to the panel, which is what the tour does when it opens or moves on.
|
|
31
43
|
*
|
|
32
44
|
* @since 0.1.0
|
|
33
45
|
* @status stable
|
|
@@ -36,6 +48,8 @@ import '../../button/index.js';
|
|
|
36
48
|
*
|
|
37
49
|
* @slot - The stop's content. Any content works, such as a card, or a heading and a line.
|
|
38
50
|
* @slot actions - Replaces the controls, which are Back, Next, and Skip.
|
|
51
|
+
* @slot description - A line under the title, which describes the panel.
|
|
52
|
+
* @slot heading - The stop's title, which names the panel.
|
|
39
53
|
*
|
|
40
54
|
* @event {HelixTourAskEvent} helix-tour-ask - Fired when one of the stop's controls is pressed, to move the tour.
|
|
41
55
|
*
|
|
@@ -47,14 +61,20 @@ import '../../button/index.js';
|
|
|
47
61
|
* @csspart arrow-top - The arrow while the panel is above its target, on the panel's bottom edge. Applied with `arrow`.
|
|
48
62
|
* @csspart back - The control that goes to the previous stop.
|
|
49
63
|
* @csspart back-button - The button inside `back`.
|
|
64
|
+
* @csspart back-live - The live region inside `back`.
|
|
50
65
|
* @csspart back-text - The words on that button, trimmed to their capitals and baseline.
|
|
51
66
|
* @csspart bubble - The panel that points at the target.
|
|
52
67
|
* @csspart content - The region holding the slotted content.
|
|
68
|
+
* @csspart description - The slot the description is in. It draws no box until you give it one.
|
|
69
|
+
* @csspart heading - The slot the title is in. It draws no box until you give it one.
|
|
53
70
|
* @csspart next - The control that goes to the next stop, and finishes the tour on the last stop.
|
|
54
71
|
* @csspart next-button - The button inside `next`.
|
|
72
|
+
* @csspart next-live - The live region inside `next`.
|
|
55
73
|
* @csspart next-text - The words on that button, trimmed to their capitals and baseline.
|
|
74
|
+
* @csspart progress - The stop's place in the tour, such as "2 of 5". It describes the panel, and is shown when the tour has `progress`.
|
|
56
75
|
* @csspart skip - The control that ends the tour early.
|
|
57
76
|
* @csspart skip-button - The button inside `skip`.
|
|
77
|
+
* @csspart skip-live - The live region inside `skip`.
|
|
58
78
|
* @csspart skip-text - The words on that button, trimmed to their capitals and baseline.
|
|
59
79
|
*
|
|
60
80
|
* @cssstate placed-bottom - The panel sits below its target.
|
|
@@ -89,6 +109,11 @@ export declare class HelixHeadlessTourStop extends HelixElement {
|
|
|
89
109
|
* The id of the element the stop points at.
|
|
90
110
|
*/
|
|
91
111
|
for: string;
|
|
112
|
+
/**
|
|
113
|
+
* The panel's name, where neither the `heading` slot nor the content holds a
|
|
114
|
+
* heading.
|
|
115
|
+
*/
|
|
116
|
+
label: string;
|
|
92
117
|
/**
|
|
93
118
|
* Whether the stop is the last one. Its next control then shows `doneLabel`.
|
|
94
119
|
*/
|
|
@@ -101,10 +126,30 @@ export declare class HelixHeadlessTourStop extends HelixElement {
|
|
|
101
126
|
* The side of the target the panel is placed on when there is room.
|
|
102
127
|
*/
|
|
103
128
|
placement: Placement;
|
|
129
|
+
/**
|
|
130
|
+
* @internal Set by the tour: the stop's place in it, such as "2 of 5".
|
|
131
|
+
*/
|
|
132
|
+
position: string;
|
|
133
|
+
/**
|
|
134
|
+
* @internal Set by the tour: whether the stop's place is drawn as well as
|
|
135
|
+
* read.
|
|
136
|
+
*/
|
|
137
|
+
progress: boolean;
|
|
104
138
|
/**
|
|
105
139
|
* Label for the control that leaves the tour.
|
|
106
140
|
*/
|
|
107
141
|
skipLabel: string;
|
|
142
|
+
/**
|
|
143
|
+
* What kind of stop this is. Unset, it is a bubble pointing at its target.
|
|
144
|
+
*
|
|
145
|
+
* - `dialog`: a panel in the middle of the window, over a backdrop
|
|
146
|
+
* - `floating`: a panel in a corner of the window
|
|
147
|
+
* - `wait`: nothing shown, while the tour waits for the target to be on the page
|
|
148
|
+
*
|
|
149
|
+
* Reflected, because the styled tier places a dialog and a floating panel by
|
|
150
|
+
* it, and unset at rest, so no default is written onto the host.
|
|
151
|
+
*/
|
|
152
|
+
type?: 'dialog' | 'floating' | 'wait';
|
|
108
153
|
/**
|
|
109
154
|
* The side of its target the panel last landed on, which names the arrow's
|
|
110
155
|
* second part. Undefined until the first placement, which the server never
|
|
@@ -123,9 +168,9 @@ export declare class HelixHeadlessTourStop extends HelixElement {
|
|
|
123
168
|
*/
|
|
124
169
|
focus(options?: FocusOptions): void;
|
|
125
170
|
/**
|
|
126
|
-
* Names the panel by the
|
|
127
|
-
*
|
|
128
|
-
*
|
|
171
|
+
* Names and describes the panel, by element reference: the words are in the
|
|
172
|
+
* light DOM and the panel in this shadow root, which an IDREF cannot cross.
|
|
173
|
+
* `stopNaming` decides which words.
|
|
129
174
|
*/
|
|
130
175
|
private nameByHeading;
|
|
131
176
|
protected updated(changed: PropertyValues): void;
|
|
@@ -4,10 +4,12 @@ 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, elementById, HelixElement, HelixTourAskEvent, PopoverController, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { arrowReach, customElement, elementById, HelixElement, HelixTourAskEvent, PopoverController, reflectElements, sideOf, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { nothing } from 'lit';
|
|
8
9
|
import { property, state } from 'lit/decorators.js';
|
|
9
10
|
import { html } from 'lit/static-html.js';
|
|
10
11
|
import '../../button/index.js';
|
|
12
|
+
import { stopNaming } from '../naming.js';
|
|
11
13
|
let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
12
14
|
constructor() {
|
|
13
15
|
super(...arguments);
|
|
@@ -16,26 +18,30 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
16
18
|
this.doneLabel = 'Done';
|
|
17
19
|
this.first = false;
|
|
18
20
|
this.for = '';
|
|
21
|
+
this.label = '';
|
|
19
22
|
this.last = false;
|
|
20
23
|
this.nextLabel = 'Next';
|
|
21
24
|
this.placement = 'bottom';
|
|
25
|
+
this.position = '';
|
|
26
|
+
this.progress = false;
|
|
22
27
|
this.skipLabel = 'Skip';
|
|
23
28
|
this.floating = new PopoverController(this, {
|
|
24
29
|
anchor: () => this.target,
|
|
25
30
|
arrow: () => this.partNamed('arrow'),
|
|
26
31
|
offset: () => {
|
|
27
32
|
const tour = this.parentElement;
|
|
28
|
-
return (
|
|
33
|
+
return (tour?.spotlightPadding ?? 0) + arrowReach(this.partNamed('arrow'));
|
|
29
34
|
},
|
|
30
35
|
onDismiss: () => { },
|
|
31
36
|
onPlace: (placement) => {
|
|
32
|
-
const side = placement
|
|
37
|
+
const side = sideOf(placement);
|
|
33
38
|
this.toggleState('placed-bottom', side === 'bottom');
|
|
34
39
|
this.toggleState('placed-left', side === 'left');
|
|
35
40
|
this.toggleState('placed-right', side === 'right');
|
|
36
41
|
this.toggleState('placed-top', side === 'top');
|
|
37
42
|
this.side = side;
|
|
38
43
|
},
|
|
44
|
+
place: () => this.type === undefined,
|
|
39
45
|
placement: () => this.placement,
|
|
40
46
|
surface: () => this.partNamed('bubble'),
|
|
41
47
|
});
|
|
@@ -53,17 +59,23 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
53
59
|
}
|
|
54
60
|
nameByHeading() {
|
|
55
61
|
const bubble = this.partNamed('bubble');
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
const slotted = (name) => this.renderRoot
|
|
63
|
+
.querySelector(`slot[name="${name}"]`)
|
|
64
|
+
?.assignedElements({ flatten: true }) ?? [];
|
|
65
|
+
const { describedBy, labelledBy } = stopNaming({
|
|
66
|
+
content: [...this.children].filter((one) => !one.slot),
|
|
67
|
+
description: slotted('description'),
|
|
68
|
+
heading: slotted('heading'),
|
|
69
|
+
labeled: this.label !== '',
|
|
70
|
+
progress: this.position === '' ? null : this.partNamed('progress'),
|
|
71
|
+
});
|
|
72
|
+
reflectElements(bubble, 'ariaLabelledByElements', labelledBy, true);
|
|
73
|
+
reflectElements(bubble, 'ariaDescribedByElements', describedBy, true);
|
|
62
74
|
}
|
|
63
75
|
updated(changed) {
|
|
64
76
|
super.updated(changed);
|
|
65
77
|
this.nameByHeading();
|
|
66
|
-
if (this.current) {
|
|
78
|
+
if (this.current && this.type !== 'wait') {
|
|
67
79
|
this.floating.show();
|
|
68
80
|
}
|
|
69
81
|
else {
|
|
@@ -74,14 +86,14 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
74
86
|
return html `<slot name="actions">
|
|
75
87
|
<${this.tag('button')}
|
|
76
88
|
part="skip"
|
|
77
|
-
exportparts="button: skip-button, text: skip-text" emphasis="ghost" @click=${() => this.ask('skip')}>
|
|
89
|
+
exportparts="button: skip-button, live: skip-live, text: skip-text" emphasis="ghost" @click=${() => this.ask('skip')}>
|
|
78
90
|
${this.skipLabel}
|
|
79
91
|
</${this.tag('button')}>
|
|
80
92
|
${this.first
|
|
81
93
|
? ''
|
|
82
94
|
: html `<${this.tag('button')}
|
|
83
95
|
part="back"
|
|
84
|
-
exportparts="button: back-button, text: back-text"
|
|
96
|
+
exportparts="button: back-button, live: back-live, text: back-text"
|
|
85
97
|
emphasis="outlined"
|
|
86
98
|
@click=${() => this.ask('back')}
|
|
87
99
|
>
|
|
@@ -89,7 +101,7 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
89
101
|
</${this.tag('button')}>`}
|
|
90
102
|
<${this.tag('button')}
|
|
91
103
|
part="next"
|
|
92
|
-
exportparts="button: next-button, text: next-text"
|
|
104
|
+
exportparts="button: next-button, live: next-live, text: next-text"
|
|
93
105
|
emphasis="solid"
|
|
94
106
|
tone="primary"
|
|
95
107
|
@click=${() => this.ask('next')}
|
|
@@ -102,16 +114,22 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
102
114
|
return html `<div
|
|
103
115
|
part="bubble"
|
|
104
116
|
popover="manual"
|
|
105
|
-
role
|
|
117
|
+
role=${this.type === 'dialog' ? 'dialog' : 'group'}
|
|
106
118
|
tabindex="-1"
|
|
107
|
-
|
|
119
|
+
aria-label=${this.label || nothing}
|
|
120
|
+
?hidden=${!this.current || this.type === 'wait'}
|
|
108
121
|
>
|
|
109
122
|
${''}
|
|
110
123
|
<div
|
|
111
124
|
part="arrow${this.side ? { bottom: ' arrow-bottom', left: ' arrow-left', right: ' arrow-right', top: ' arrow-top' }[this.side] : ''}"
|
|
112
125
|
aria-hidden="true"
|
|
113
126
|
></div>
|
|
127
|
+
<slot name="heading" part="heading" @slotchange=${this.nameByHeading}></slot>
|
|
128
|
+
<slot name="description" part="description" @slotchange=${this.nameByHeading}></slot>
|
|
114
129
|
<div part="content"><slot></slot></div>
|
|
130
|
+
${this.position === ''
|
|
131
|
+
? ''
|
|
132
|
+
: html `<span part="progress" ?hidden=${!this.progress}>${this.position}</span>`}
|
|
115
133
|
<div part="actions">
|
|
116
134
|
${this.renderActions()}
|
|
117
135
|
</div>
|
|
@@ -136,6 +154,9 @@ __decorate([
|
|
|
136
154
|
__decorate([
|
|
137
155
|
property()
|
|
138
156
|
], HelixHeadlessTourStop.prototype, "for", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property()
|
|
159
|
+
], HelixHeadlessTourStop.prototype, "label", void 0);
|
|
139
160
|
__decorate([
|
|
140
161
|
property({ reflect: true, type: Boolean })
|
|
141
162
|
], HelixHeadlessTourStop.prototype, "last", void 0);
|
|
@@ -145,9 +166,18 @@ __decorate([
|
|
|
145
166
|
__decorate([
|
|
146
167
|
property()
|
|
147
168
|
], HelixHeadlessTourStop.prototype, "placement", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
property({ attribute: false })
|
|
171
|
+
], HelixHeadlessTourStop.prototype, "position", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
property({ attribute: false })
|
|
174
|
+
], HelixHeadlessTourStop.prototype, "progress", void 0);
|
|
148
175
|
__decorate([
|
|
149
176
|
property({ attribute: 'skip-label' })
|
|
150
177
|
], HelixHeadlessTourStop.prototype, "skipLabel", void 0);
|
|
178
|
+
__decorate([
|
|
179
|
+
property({ reflect: true })
|
|
180
|
+
], HelixHeadlessTourStop.prototype, "type", void 0);
|
|
151
181
|
__decorate([
|
|
152
182
|
state()
|
|
153
183
|
], HelixHeadlessTourStop.prototype, "side", void 0);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls `then` once `ready` answers yes: at once if it already does, and
|
|
3
|
+
* otherwise on the first change to the tree under `root` after which it does.
|
|
4
|
+
*
|
|
5
|
+
* What a tour's `wait` stop rests on: the tour waits for the element the stop
|
|
6
|
+
* names to be on the page, such as a menu the reader has to open, and moves on
|
|
7
|
+
* by itself. Returns a function that stops waiting.
|
|
8
|
+
*/
|
|
9
|
+
export declare const waitFor: (root: Node, ready: () => boolean, then: () => void) => (() => void);
|
|
10
|
+
/** Whether an element is on the page and draws something a reader can see. */
|
|
11
|
+
export declare const onPage: (element: Element | null | undefined) => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const waitFor = (root, ready, then) => {
|
|
2
|
+
if (ready()) {
|
|
3
|
+
then();
|
|
4
|
+
return () => { };
|
|
5
|
+
}
|
|
6
|
+
if (typeof MutationObserver === 'undefined') {
|
|
7
|
+
return () => { };
|
|
8
|
+
}
|
|
9
|
+
const watcher = new MutationObserver(() => {
|
|
10
|
+
if (ready()) {
|
|
11
|
+
watcher.disconnect();
|
|
12
|
+
then();
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
watcher.observe(root, { attributes: true, childList: true, subtree: true });
|
|
16
|
+
return () => watcher.disconnect();
|
|
17
|
+
};
|
|
18
|
+
export const onPage = (element) => element?.isConnected === true &&
|
|
19
|
+
(typeof element.getClientRects !== 'function' || element.getClientRects().length > 0);
|
|
@@ -23,21 +23,33 @@ declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusi
|
|
|
23
23
|
* a `value` is chosen as well and sends `helix-select`, unless the tree has
|
|
24
24
|
* `nesting="heading"`, where a branch names the list under it.
|
|
25
25
|
*
|
|
26
|
+
* A `disabled` item is reached by the arrow keys and announced as unavailable,
|
|
27
|
+
* and a press, Enter or Space on it does nothing.
|
|
28
|
+
*
|
|
29
|
+
* A `lazy` item is a branch whose children you load when it opens: opening it
|
|
30
|
+
* sends `helix-load`, the row says it is busy, and the children you add appear
|
|
31
|
+
* in it. Remove `lazy` once they are in.
|
|
32
|
+
*
|
|
26
33
|
* @since 0.1.0
|
|
27
34
|
* @status stable
|
|
28
35
|
* @aliases TreeNode, Branch, Leaf
|
|
29
36
|
* @documentation https://fusion.dev/helix/components/tree
|
|
30
37
|
*
|
|
31
38
|
* @slot - The item's label.
|
|
39
|
+
* @slot chevron - Replaces the expand and collapse mark of a branch, such as with your own icon.
|
|
32
40
|
* @slot children - Nested items, which make this a branch.
|
|
33
41
|
* @slot end - Content after the label, at the far side of the row, such as a count or a state.
|
|
34
42
|
* @slot start - Content before the label and after the chevron, such as a mark for the item.
|
|
35
43
|
*
|
|
36
44
|
* @event {HelixBeforeCloseEvent} helix-before-close - Fired before a branch closes, and cancelable.
|
|
37
45
|
* @event {HelixBeforeOpenEvent} helix-before-open - Fired before a branch opens, and cancelable.
|
|
46
|
+
* @event {HelixLoadEvent} helix-load - Fired when a `lazy` item opens, so you can load its children.
|
|
38
47
|
* @event {HelixSelectEvent} helix-select - Fired when the item is chosen, and cancelable. Canceling it changes nothing.
|
|
39
48
|
* @event {ToggleEvent} toggle - Sent when the branch opens or closes, with `newState` and `oldState`.
|
|
40
49
|
*
|
|
50
|
+
* @csspart checkbox - The check mark's box, in a tree with `selection-mode="multiple"`.
|
|
51
|
+
* @csspart checkbox-checked - The check mark's box while the item is checked.
|
|
52
|
+
* @csspart checkbox-mixed - The check mark's box while some of a branch's items are checked.
|
|
41
53
|
* @csspart group - The container for nested items.
|
|
42
54
|
* @csspart item - The node, and the focus target unless `href` moves it to the row.
|
|
43
55
|
* @csspart label - The label text.
|
|
@@ -46,10 +58,26 @@ declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusi
|
|
|
46
58
|
*
|
|
47
59
|
* @cssproperty --tree-level - How deep this row sits, counting from one as `aria-level` does, for the indent.
|
|
48
60
|
*
|
|
61
|
+
* @cssstate loading - While a `lazy` item is open and its children have not arrived.
|
|
49
62
|
* @cssstate open - While its children are shown.
|
|
50
63
|
* @cssstate selected - While it is selected.
|
|
51
64
|
*/
|
|
52
65
|
export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
66
|
+
/**
|
|
67
|
+
* @internal Set by the tree: whether the item draws a check mark and is
|
|
68
|
+
* checked rather than selected, as under `selection-mode="multiple"`.
|
|
69
|
+
*/
|
|
70
|
+
checkable: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* @internal Set by the tree in `selection-mode="multiple"`: whether the item
|
|
73
|
+
* is checked, `mixed` for a branch some of whose items are.
|
|
74
|
+
*/
|
|
75
|
+
checked: boolean | 'mixed';
|
|
76
|
+
/**
|
|
77
|
+
* Whether the item cannot be chosen, opened or followed. The arrow keys still
|
|
78
|
+
* reach it, so a reader knows it is there.
|
|
79
|
+
*/
|
|
80
|
+
disabled: boolean;
|
|
53
81
|
/**
|
|
54
82
|
* @internal Set by the tree: whether a branch heads the list under it, as
|
|
55
83
|
* under `nesting="heading"`. Such a branch only opens and closes when it is
|
|
@@ -64,6 +92,13 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
64
92
|
* current page on every item a consumer never asked to be one.
|
|
65
93
|
*/
|
|
66
94
|
href: string;
|
|
95
|
+
/**
|
|
96
|
+
* Whether the item is a branch whose children are loaded when it opens.
|
|
97
|
+
*
|
|
98
|
+
* Opening it sends `helix-load`. Add the children to its `children` slot,
|
|
99
|
+
* and remove `lazy` once they are in, as Web Awesome's tree item does.
|
|
100
|
+
*/
|
|
101
|
+
lazy: boolean;
|
|
67
102
|
/**
|
|
68
103
|
* The node's depth from the root. The tree counts it, so indentation needs no
|
|
69
104
|
* nested CSS.
|
|
@@ -151,7 +186,7 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
151
186
|
* row rather than the wrapper around it.
|
|
152
187
|
*/
|
|
153
188
|
focusItem(): void;
|
|
154
|
-
/** Selects this node and sends `helix-select`. */
|
|
189
|
+
/** Selects this node and sends `helix-select`. A disabled node sends nothing. */
|
|
155
190
|
select(): void;
|
|
156
191
|
/**
|
|
157
192
|
* Chooses this node, as a press or Enter does.
|
|
@@ -163,6 +198,13 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
163
198
|
* value and nothing listens for it.
|
|
164
199
|
*/
|
|
165
200
|
activate(): void;
|
|
201
|
+
/**
|
|
202
|
+
* Opens or closes a branch, unless the item is disabled.
|
|
203
|
+
*
|
|
204
|
+
* Every press and key that opens a branch comes through here, so `disabled`
|
|
205
|
+
* holds for all of them. A script can still set `open`.
|
|
206
|
+
*/
|
|
207
|
+
toggleOpen(): boolean;
|
|
166
208
|
/**
|
|
167
209
|
* Follows a link slotted into the name, if there is one.
|
|
168
210
|
*
|
|
@@ -184,8 +226,17 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
184
226
|
* its children.
|
|
185
227
|
*/
|
|
186
228
|
private follow;
|
|
229
|
+
/** A press on the check mark checks the item and leaves a branch as it is. */
|
|
230
|
+
private readonly handleCheckClick;
|
|
187
231
|
private readonly handleToggleClick;
|
|
188
232
|
private readonly handleRowClick;
|
|
233
|
+
/**
|
|
234
|
+
* The expand and collapse mark of a branch, as the `chevron` slot's
|
|
235
|
+
* fallback, so an icon of your own replaces it by being slotted.
|
|
236
|
+
*/
|
|
237
|
+
protected renderToggle(): TemplateResult;
|
|
238
|
+
/** The check mark, in a tree with `selection-mode="multiple"`. */
|
|
239
|
+
private renderCheckbox;
|
|
189
240
|
/** Everything inside the row, which is the same whichever element it is. */
|
|
190
241
|
private renderRow;
|
|
191
242
|
/**
|
|
@@ -204,6 +255,8 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
204
255
|
* a consumer's markup means. What stops is the write back.
|
|
205
256
|
*/
|
|
206
257
|
protected willUpdate(changed: PropertyValues): void;
|
|
258
|
+
/** Asks for a lazy branch's children when it opens. */
|
|
259
|
+
protected updated(changed: PropertyValues): void;
|
|
207
260
|
protected render(): TemplateResult;
|
|
208
261
|
}
|
|
209
262
|
declare global {
|