@fusion.dev/helix-headless 0.0.0-dev
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/LICENSE +21 -0
- package/custom-elements.json +75202 -0
- package/dist/accordion/index.d.ts +2 -0
- package/dist/accordion/index.js +2 -0
- package/dist/accordion/item/accordion-item.d.ts +141 -0
- package/dist/accordion/item/accordion-item.js +214 -0
- package/dist/accordion/root/accordion-root.d.ts +57 -0
- package/dist/accordion/root/accordion-root.js +96 -0
- package/dist/announcement/index.d.ts +1 -0
- package/dist/announcement/index.js +1 -0
- package/dist/announcement/root/announcement-root.d.ts +106 -0
- package/dist/announcement/root/announcement-root.js +144 -0
- package/dist/app-header/index.d.ts +1 -0
- package/dist/app-header/index.js +1 -0
- package/dist/app-header/root/app-header-root.d.ts +113 -0
- package/dist/app-header/root/app-header-root.js +147 -0
- package/dist/avatar/group/avatar-group.d.ts +116 -0
- package/dist/avatar/group/avatar-group.js +136 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +2 -0
- package/dist/avatar/root/avatar-root.d.ts +71 -0
- package/dist/avatar/root/avatar-root.js +147 -0
- package/dist/badge/index.d.ts +1 -0
- package/dist/badge/index.js +1 -0
- package/dist/badge/root/badge-root.d.ts +61 -0
- package/dist/badge/root/badge-root.js +121 -0
- package/dist/bar-chart/index.d.ts +1 -0
- package/dist/bar-chart/index.js +1 -0
- package/dist/bar-chart/root/bar-chart-root.d.ts +266 -0
- package/dist/bar-chart/root/bar-chart-root.js +515 -0
- package/dist/blockquote/index.d.ts +1 -0
- package/dist/blockquote/index.js +1 -0
- package/dist/blockquote/root/blockquote-root.d.ts +51 -0
- package/dist/blockquote/root/blockquote-root.js +84 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +104 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +137 -0
- package/dist/breadcrumbs/index.d.ts +2 -0
- package/dist/breadcrumbs/index.js +2 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +77 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +94 -0
- package/dist/button/index.d.ts +1 -0
- package/dist/button/index.js +1 -0
- package/dist/button/root/button-root.d.ts +251 -0
- package/dist/button/root/button-root.js +401 -0
- package/dist/button-group/index.d.ts +1 -0
- package/dist/button-group/index.js +1 -0
- package/dist/button-group/root/button-group-root.d.ts +62 -0
- package/dist/button-group/root/button-group-root.js +62 -0
- package/dist/callout/index.d.ts +1 -0
- package/dist/callout/index.js +1 -0
- package/dist/callout/root/callout-root.d.ts +72 -0
- package/dist/callout/root/callout-root.js +90 -0
- package/dist/card/index.d.ts +1 -0
- package/dist/card/index.js +1 -0
- package/dist/card/root/card-root.d.ts +54 -0
- package/dist/card/root/card-root.js +71 -0
- package/dist/carousel/index.d.ts +1 -0
- package/dist/carousel/index.js +1 -0
- package/dist/carousel/root/carousel-root.d.ts +399 -0
- package/dist/carousel/root/carousel-root.js +723 -0
- package/dist/chat/composer/chat-composer.d.ts +160 -0
- package/dist/chat/composer/chat-composer.js +273 -0
- package/dist/chat/index.d.ts +3 -0
- package/dist/chat/index.js +3 -0
- package/dist/chat/message/chat-message.d.ts +170 -0
- package/dist/chat/message/chat-message.js +271 -0
- package/dist/chat/root/chat-root.d.ts +216 -0
- package/dist/chat/root/chat-root.js +389 -0
- package/dist/checkbox/index.d.ts +1 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/checkbox/root/checkbox-root.d.ts +108 -0
- package/dist/checkbox/root/checkbox-root.js +207 -0
- package/dist/checkbox-group/index.d.ts +1 -0
- package/dist/checkbox-group/index.js +1 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +155 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +293 -0
- package/dist/code/index.d.ts +1 -0
- package/dist/code/index.js +1 -0
- package/dist/code/root/code-root.d.ts +36 -0
- package/dist/code/root/code-root.js +43 -0
- package/dist/code-block/index.d.ts +1 -0
- package/dist/code-block/index.js +1 -0
- package/dist/code-block/root/code-block-root.d.ts +112 -0
- package/dist/code-block/root/code-block-root.js +155 -0
- package/dist/color-input/index.d.ts +1 -0
- package/dist/color-input/index.js +1 -0
- package/dist/color-input/root/color-input-root.d.ts +227 -0
- package/dist/color-input/root/color-input-root.js +456 -0
- package/dist/color-picker/color.d.ts +74 -0
- package/dist/color-picker/color.js +238 -0
- package/dist/color-picker/index.d.ts +2 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/color-picker/root/color-picker-root.d.ts +303 -0
- package/dist/color-picker/root/color-picker-root.js +576 -0
- package/dist/combobox/index.d.ts +1 -0
- package/dist/combobox/index.js +1 -0
- package/dist/combobox/root/combobox-root.d.ts +396 -0
- package/dist/combobox/root/combobox-root.js +808 -0
- package/dist/command/index.d.ts +1 -0
- package/dist/command/index.js +1 -0
- package/dist/command/root/command-root.d.ts +166 -0
- package/dist/command/root/command-root.js +353 -0
- package/dist/copy-button/index.d.ts +1 -0
- package/dist/copy-button/index.js +1 -0
- package/dist/copy-button/root/copy-button-root.d.ts +154 -0
- package/dist/copy-button/root/copy-button-root.js +225 -0
- package/dist/data-table/index.d.ts +2 -0
- package/dist/data-table/index.js +2 -0
- package/dist/data-table/root/data-table-root.d.ts +392 -0
- package/dist/data-table/root/data-table-root.js +729 -0
- package/dist/data-table/root/order.d.ts +116 -0
- package/dist/data-table/root/order.js +175 -0
- package/dist/date-input/index.d.ts +1 -0
- package/dist/date-input/index.js +1 -0
- package/dist/date-input/root/date-input-root.d.ts +361 -0
- package/dist/date-input/root/date-input-root.js +791 -0
- package/dist/date-picker/index.d.ts +1 -0
- package/dist/date-picker/index.js +1 -0
- package/dist/date-picker/root/date-picker-root.d.ts +361 -0
- package/dist/date-picker/root/date-picker-root.js +837 -0
- package/dist/dialog/index.d.ts +1 -0
- package/dist/dialog/index.js +1 -0
- package/dist/dialog/root/dialog-root.d.ts +185 -0
- package/dist/dialog/root/dialog-root.js +319 -0
- package/dist/divider/index.d.ts +1 -0
- package/dist/divider/index.js +1 -0
- package/dist/divider/root/divider-root.d.ts +68 -0
- package/dist/divider/root/divider-root.js +116 -0
- package/dist/donut-chart/index.d.ts +1 -0
- package/dist/donut-chart/index.js +1 -0
- package/dist/donut-chart/root/donut-chart-root.d.ts +209 -0
- package/dist/donut-chart/root/donut-chart-root.js +395 -0
- package/dist/drawer/index.d.ts +1 -0
- package/dist/drawer/index.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +144 -0
- package/dist/drawer/root/drawer-root.js +222 -0
- package/dist/drilldown/index.d.ts +2 -0
- package/dist/drilldown/index.js +2 -0
- package/dist/drilldown/item/drilldown-item.d.ts +87 -0
- package/dist/drilldown/item/drilldown-item.js +152 -0
- package/dist/drilldown/root/drilldown-root.d.ts +115 -0
- package/dist/drilldown/root/drilldown-root.js +263 -0
- package/dist/element-events.generated.d.ts +1 -0
- package/dist/element-events.generated.js +125 -0
- package/dist/empty/index.d.ts +1 -0
- package/dist/empty/index.js +1 -0
- package/dist/empty/root/empty-root.d.ts +47 -0
- package/dist/empty/root/empty-root.js +68 -0
- package/dist/file-input/index.d.ts +1 -0
- package/dist/file-input/index.js +1 -0
- package/dist/file-input/root/file-input-root.d.ts +196 -0
- package/dist/file-input/root/file-input-root.js +488 -0
- package/dist/format-date/index.d.ts +1 -0
- package/dist/format-date/index.js +1 -0
- package/dist/format-date/root/format-date-root.d.ts +151 -0
- package/dist/format-date/root/format-date-root.js +266 -0
- package/dist/heatmap/index.d.ts +2 -0
- package/dist/heatmap/index.js +2 -0
- package/dist/heatmap/root/buckets.d.ts +62 -0
- package/dist/heatmap/root/buckets.js +85 -0
- package/dist/heatmap/root/heatmap-root.d.ts +330 -0
- package/dist/heatmap/root/heatmap-root.js +526 -0
- package/dist/icon/index.d.ts +1 -0
- package/dist/icon/index.js +1 -0
- package/dist/icon/root/icon-root.d.ts +53 -0
- package/dist/icon/root/icon-root.js +93 -0
- package/dist/icon-button/index.d.ts +1 -0
- package/dist/icon-button/index.js +1 -0
- package/dist/icon-button/root/icon-button-root.d.ts +40 -0
- package/dist/icon-button/root/icon-button-root.js +46 -0
- package/dist/image/index.d.ts +1 -0
- package/dist/image/index.js +1 -0
- package/dist/image/root/image-root.d.ts +213 -0
- package/dist/image/root/image-root.js +335 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +99 -0
- package/dist/input/index.d.ts +1 -0
- package/dist/input/index.js +1 -0
- package/dist/input/root/input-root.d.ts +281 -0
- package/dist/input/root/input-root.js +472 -0
- package/dist/kbd/index.d.ts +1 -0
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/root/kbd-root.d.ts +98 -0
- package/dist/kbd/root/kbd-root.js +230 -0
- package/dist/legend/index.d.ts +1 -0
- package/dist/legend/index.js +1 -0
- package/dist/legend/root/legend-root.d.ts +83 -0
- package/dist/legend/root/legend-root.js +125 -0
- package/dist/line-chart/index.d.ts +1 -0
- package/dist/line-chart/index.js +1 -0
- package/dist/line-chart/root/line-chart-root.d.ts +238 -0
- package/dist/line-chart/root/line-chart-root.js +365 -0
- package/dist/list/index.d.ts +2 -0
- package/dist/list/index.js +2 -0
- package/dist/list/item/list-item.d.ts +95 -0
- package/dist/list/item/list-item.js +148 -0
- package/dist/list/root/list-root.d.ts +72 -0
- package/dist/list/root/list-root.js +61 -0
- package/dist/listbox/index.d.ts +1 -0
- package/dist/listbox/index.js +1 -0
- package/dist/listbox/root/listbox-root.d.ts +357 -0
- package/dist/listbox/root/listbox-root.js +890 -0
- package/dist/loader/index.d.ts +1 -0
- package/dist/loader/index.js +1 -0
- package/dist/loader/root/loader-root.d.ts +52 -0
- package/dist/loader/root/loader-root.js +74 -0
- package/dist/megamenu/index.d.ts +1 -0
- package/dist/megamenu/index.js +1 -0
- package/dist/megamenu/root/megamenu-root.d.ts +254 -0
- package/dist/megamenu/root/megamenu-root.js +526 -0
- package/dist/menu/index.d.ts +2 -0
- package/dist/menu/index.js +2 -0
- package/dist/menu/item/menu-item.d.ts +231 -0
- package/dist/menu/item/menu-item.js +405 -0
- package/dist/menu/root/menu-root.d.ts +158 -0
- package/dist/menu/root/menu-root.js +422 -0
- package/dist/meter/index.d.ts +1 -0
- package/dist/meter/index.js +1 -0
- package/dist/meter/root/meter-root.d.ts +234 -0
- package/dist/meter/root/meter-root.js +316 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +1 -0
- package/dist/navigation/root/navigation-root.d.ts +55 -0
- package/dist/navigation/root/navigation-root.js +130 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/notification/notification.d.ts +181 -0
- package/dist/notifications/notification/notification.js +305 -0
- package/dist/notifications/root/notifications-root.d.ts +168 -0
- package/dist/notifications/root/notifications-root.js +291 -0
- package/dist/number-input/index.d.ts +1 -0
- package/dist/number-input/index.js +1 -0
- package/dist/number-input/root/number-input-root.d.ts +282 -0
- package/dist/number-input/root/number-input-root.js +592 -0
- package/dist/option/group/option-group.d.ts +38 -0
- package/dist/option/group/option-group.js +58 -0
- package/dist/option/index.d.ts +2 -0
- package/dist/option/index.js +2 -0
- package/dist/option/root/option-root.d.ts +194 -0
- package/dist/option/root/option-root.js +247 -0
- package/dist/outline/index.d.ts +1 -0
- package/dist/outline/index.js +1 -0
- package/dist/outline/root/outline-root.d.ts +237 -0
- package/dist/outline/root/outline-root.js +519 -0
- package/dist/pagination/index.d.ts +3 -0
- package/dist/pagination/index.js +3 -0
- package/dist/pagination/root/pagination-root.d.ts +390 -0
- package/dist/pagination/root/pagination-root.js +695 -0
- package/dist/pagination/size/pagination-size.d.ts +127 -0
- package/dist/pagination/size/pagination-size.js +232 -0
- package/dist/pagination/summary/pagination-summary.d.ts +90 -0
- package/dist/pagination/summary/pagination-summary.js +145 -0
- package/dist/pin-input/index.d.ts +1 -0
- package/dist/pin-input/index.js +1 -0
- package/dist/pin-input/root/pin-input-root.d.ts +292 -0
- package/dist/pin-input/root/pin-input-root.js +553 -0
- package/dist/popover/index.d.ts +1 -0
- package/dist/popover/index.js +1 -0
- package/dist/popover/root/popover-root.d.ts +108 -0
- package/dist/popover/root/popover-root.js +231 -0
- package/dist/progress/index.d.ts +1 -0
- package/dist/progress/index.js +1 -0
- package/dist/progress/root/progress-root.d.ts +125 -0
- package/dist/progress/root/progress-root.js +212 -0
- package/dist/qr-code/index.d.ts +1 -0
- package/dist/qr-code/index.js +1 -0
- package/dist/qr-code/root/qr-code-root.d.ts +93 -0
- package/dist/qr-code/root/qr-code-root.js +233 -0
- package/dist/quote/index.d.ts +1 -0
- package/dist/quote/index.js +1 -0
- package/dist/quote/root/quote-root.d.ts +36 -0
- package/dist/quote/root/quote-root.js +50 -0
- package/dist/radio/group/radio-group.d.ts +84 -0
- package/dist/radio/group/radio-group.js +170 -0
- package/dist/radio/index.d.ts +2 -0
- package/dist/radio/index.js +2 -0
- package/dist/radio/root/radio-root.d.ts +102 -0
- package/dist/radio/root/radio-root.js +151 -0
- package/dist/rating/index.d.ts +1 -0
- package/dist/rating/index.js +1 -0
- package/dist/rating/root/rating-root.d.ts +242 -0
- package/dist/rating/root/rating-root.js +484 -0
- package/dist/scroll-area/index.d.ts +1 -0
- package/dist/scroll-area/index.js +1 -0
- package/dist/scroll-area/root/scroll-area-root.d.ts +96 -0
- package/dist/scroll-area/root/scroll-area-root.js +215 -0
- package/dist/select/index.d.ts +1 -0
- package/dist/select/index.js +1 -0
- package/dist/select/root/select-root.d.ts +170 -0
- package/dist/select/root/select-root.js +419 -0
- package/dist/skeleton/index.d.ts +1 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton/root/skeleton-root.d.ts +31 -0
- package/dist/skeleton/root/skeleton-root.js +42 -0
- package/dist/slider/index.d.ts +1 -0
- package/dist/slider/index.js +1 -0
- package/dist/slider/root/slider-root.d.ts +235 -0
- package/dist/slider/root/slider-root.js +488 -0
- package/dist/sparkline/index.d.ts +1 -0
- package/dist/sparkline/index.js +1 -0
- package/dist/sparkline/root/sparkline-root.d.ts +147 -0
- package/dist/sparkline/root/sparkline-root.js +278 -0
- package/dist/speed-dial/index.d.ts +2 -0
- package/dist/speed-dial/index.js +2 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +71 -0
- package/dist/speed-dial/item/speed-dial-item.js +113 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +122 -0
- package/dist/speed-dial/root/speed-dial-root.js +251 -0
- package/dist/splitter/index.d.ts +1 -0
- package/dist/splitter/index.js +1 -0
- package/dist/splitter/root/splitter-root.d.ts +491 -0
- package/dist/splitter/root/splitter-root.js +1030 -0
- package/dist/stat/group/stat-group.d.ts +30 -0
- package/dist/stat/group/stat-group.js +47 -0
- package/dist/stat/index.d.ts +2 -0
- package/dist/stat/index.js +2 -0
- package/dist/stat/root/stat-root.d.ts +62 -0
- package/dist/stat/root/stat-root.js +51 -0
- package/dist/steps/index.d.ts +2 -0
- package/dist/steps/index.js +2 -0
- package/dist/steps/root/steps-root.d.ts +110 -0
- package/dist/steps/root/steps-root.js +130 -0
- package/dist/steps/step/step.d.ts +139 -0
- package/dist/steps/step/step.js +215 -0
- package/dist/switch/index.d.ts +1 -0
- package/dist/switch/index.js +1 -0
- package/dist/switch/root/switch-root.d.ts +74 -0
- package/dist/switch/root/switch-root.js +153 -0
- package/dist/table/cell/table-cell.d.ts +34 -0
- package/dist/table/cell/table-cell.js +52 -0
- package/dist/table/column/table-column.d.ts +165 -0
- package/dist/table/column/table-column.js +222 -0
- package/dist/table/index.d.ts +4 -0
- package/dist/table/index.js +4 -0
- package/dist/table/root/table-root.d.ts +98 -0
- package/dist/table/root/table-root.js +161 -0
- package/dist/table/row/table-row.d.ts +27 -0
- package/dist/table/row/table-row.js +42 -0
- package/dist/tabs/index.d.ts +3 -0
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/panel/tab-panel.d.ts +67 -0
- package/dist/tabs/panel/tab-panel.js +98 -0
- package/dist/tabs/root/tabs-root.d.ts +123 -0
- package/dist/tabs/root/tabs-root.js +217 -0
- package/dist/tabs/tab/tab.d.ts +64 -0
- package/dist/tabs/tab/tab.js +116 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +41 -0
- package/dist/tag/root/tag-root.js +67 -0
- package/dist/textarea/index.d.ts +1 -0
- package/dist/textarea/index.js +1 -0
- package/dist/textarea/root/textarea-root.d.ts +215 -0
- package/dist/textarea/root/textarea-root.js +380 -0
- package/dist/time-input/index.d.ts +1 -0
- package/dist/time-input/index.js +1 -0
- package/dist/time-input/root/time-input-root.d.ts +322 -0
- package/dist/time-input/root/time-input-root.js +661 -0
- package/dist/time-picker/index.d.ts +1 -0
- package/dist/time-picker/index.js +1 -0
- package/dist/time-picker/root/time-picker-root.d.ts +380 -0
- package/dist/time-picker/root/time-picker-root.js +669 -0
- package/dist/timeline/index.d.ts +2 -0
- package/dist/timeline/index.js +2 -0
- package/dist/timeline/item/timeline-item.d.ts +81 -0
- package/dist/timeline/item/timeline-item.js +128 -0
- package/dist/timeline/root/timeline-root.d.ts +52 -0
- package/dist/timeline/root/timeline-root.js +72 -0
- package/dist/toast/index.d.ts +2 -0
- package/dist/toast/index.js +2 -0
- package/dist/toast/item/toast-item.d.ts +183 -0
- package/dist/toast/item/toast-item.js +345 -0
- package/dist/toast/root/toast-root.d.ts +72 -0
- package/dist/toast/root/toast-root.js +87 -0
- package/dist/toggle/group/toggle-group.d.ts +140 -0
- package/dist/toggle/group/toggle-group.js +278 -0
- package/dist/toggle/index.d.ts +2 -0
- package/dist/toggle/index.js +2 -0
- package/dist/toggle/root/toggle-root.d.ts +99 -0
- package/dist/toggle/root/toggle-root.js +146 -0
- package/dist/toolbar/index.d.ts +1 -0
- package/dist/toolbar/index.js +1 -0
- package/dist/toolbar/root/toolbar-root.d.ts +105 -0
- package/dist/toolbar/root/toolbar-root.js +260 -0
- package/dist/tooltip/index.d.ts +1 -0
- package/dist/tooltip/index.js +1 -0
- package/dist/tooltip/root/tooltip-root.d.ts +388 -0
- package/dist/tooltip/root/tooltip-root.js +707 -0
- package/dist/tour/index.d.ts +2 -0
- package/dist/tour/index.js +2 -0
- package/dist/tour/root/tour-root.d.ts +161 -0
- package/dist/tour/root/tour-root.js +351 -0
- package/dist/tour/stop/tour-stop.d.ts +131 -0
- package/dist/tour/stop/tour-stop.js +249 -0
- package/dist/tree/index.d.ts +2 -0
- package/dist/tree/index.js +2 -0
- package/dist/tree/item/tree-item.d.ts +208 -0
- package/dist/tree/item/tree-item.js +381 -0
- package/dist/tree/root/tree-root.d.ts +88 -0
- package/dist/tree/root/tree-root.js +287 -0
- package/dist/trend/index.d.ts +1 -0
- package/dist/trend/index.js +1 -0
- package/dist/trend/root/trend-root.d.ts +67 -0
- package/dist/trend/root/trend-root.js +106 -0
- package/dist/video/index.d.ts +1 -0
- package/dist/video/index.js +1 -0
- package/dist/video/root/video-root.d.ts +711 -0
- package/dist/video/root/video-root.js +1821 -0
- package/dist/video-playlist/index.d.ts +3 -0
- package/dist/video-playlist/index.js +3 -0
- package/dist/video-playlist/item/video-playlist-item.d.ts +101 -0
- package/dist/video-playlist/item/video-playlist-item.js +162 -0
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +121 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +237 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +108 -0
- package/dist/video-playlist/root/video-playlist-root.js +218 -0
- package/dist/virtual-list/index.d.ts +1 -0
- package/dist/virtual-list/index.js +1 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +121 -0
- package/dist/virtual-list/root/virtual-list-root.js +221 -0
- package/jsx.d.ts +49767 -0
- package/package.json +77 -0
- package/svelte.d.ts +129 -0
- package/vue.d.ts +9242 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import type { HelixHeadlessTourStop } from '../stop/tour-stop.js';
|
|
4
|
+
/**
|
|
5
|
+
* @summary A guided run through an interface, one stop at a time.
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* The root owns the order and nothing else. Which stop is current, what Next
|
|
9
|
+
* and Back mean, when the run is finished; the stops own where they point, and
|
|
10
|
+
* the consumer owns every word.
|
|
11
|
+
*
|
|
12
|
+
* **The spotlight is a shadow, not a hole.** The scrim is a box the size of the
|
|
13
|
+
* current target with an enormous spread on its `box-shadow`, so the darkness
|
|
14
|
+
* is what the shadow paints and the target is simply where the box is. A
|
|
15
|
+
* `clip-path` on a full-screen scrim is the other way to do it and is worse
|
|
16
|
+
* here: it needs the viewport in the same coordinate space as the cut, which
|
|
17
|
+
* stops being true the moment anything between them is transformed.
|
|
18
|
+
*
|
|
19
|
+
* **It measures, and this is a case where measuring is the only option.** The
|
|
20
|
+
* target is an element somewhere else on the page whose position nothing can
|
|
21
|
+
* know statically. That is different from a trail folding by width, where the
|
|
22
|
+
* design rule was expressible and the measurement was answering a question
|
|
23
|
+
* nobody had asked. Here the question is "where is that button", and there is
|
|
24
|
+
* no other way to ask it.
|
|
25
|
+
*
|
|
26
|
+
* **Nothing is measured on the server and nothing needs to be.** A tour starts
|
|
27
|
+
* closed and a closed tour draws nothing, so the server renders the stops as
|
|
28
|
+
* inert markup and the first frame is correct. This is also what makes it
|
|
29
|
+
* acceptable for the root to write `current` onto stops it does not own: there
|
|
30
|
+
* is no server state for the write to disagree with.
|
|
31
|
+
*
|
|
32
|
+
* **It cannot point inside a modal, and nothing can fix that here.**
|
|
33
|
+
* `showModal()` makes everything outside the dialog's own subtree inert, so a
|
|
34
|
+
* panel anywhere else is unpressable however the top layer is ordered: this is
|
|
35
|
+
* what modal means rather than a stacking accident. Measured with a modal
|
|
36
|
+
* `Drawer` open, `elementsFromPoint` over the tour's own Done button returned
|
|
37
|
+
* the drawer, the press light-dismissed the drawer, and the tour heard nothing
|
|
38
|
+
* at all. Anything a tour points into has to stay reachable, which for `Drawer`
|
|
39
|
+
* and `Dialog` means not modal while the tour is running.
|
|
40
|
+
*
|
|
41
|
+
* **Focus is not trapped.** A reader has to be able to look at, and reach, the
|
|
42
|
+
* thing being pointed at. `Escape` leaves, which is the one binding a tour
|
|
43
|
+
* needs and the one every reader already tries.
|
|
44
|
+
*
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
* @status experimental
|
|
47
|
+
* @category overlays
|
|
48
|
+
* @aliases Coachmark, Product tour, Walkthrough, Onboarding
|
|
49
|
+
* @documentation https://helix.fusion.dev/components/tour
|
|
50
|
+
*
|
|
51
|
+
* @slot - The stops, in the order they should be visited.
|
|
52
|
+
*
|
|
53
|
+
* @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the current stop moves, carrying the new index. Cancelable: refusing it takes the decision and nothing moves.
|
|
54
|
+
* @event {HelixBeforeCloseEvent} helix-before-close - Fired before the reader leaves early. Cancelable: refusing it takes the decision and nothing moves.
|
|
55
|
+
* @event {HelixCompleteEvent} helix-complete - Fired when the last stop is
|
|
56
|
+
* finished.
|
|
57
|
+
* @event {Event} toggle - Says the state moved, carrying `newState` and `oldState`.
|
|
58
|
+
*
|
|
59
|
+
* @csspart spotlight - The box over the current target, which paints the scrim.
|
|
60
|
+
*/
|
|
61
|
+
export declare class HelixHeadlessTour extends HelixElement {
|
|
62
|
+
/**
|
|
63
|
+
* Whether the tour is running.
|
|
64
|
+
*/
|
|
65
|
+
open: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Which stop the reader is on.
|
|
68
|
+
*
|
|
69
|
+
* **It announced after it moved for two days, which made refusing it
|
|
70
|
+
* impossible.** `index` was a plain property the tour wrote to directly:
|
|
71
|
+
* `move` assigned it and *then* announced, so `preventDefault` on the change
|
|
72
|
+
* arrived after the move it was refusing. It goes through `requestChange`
|
|
73
|
+
* now, which announces first and applies only if nobody refused, and refusing
|
|
74
|
+
* is how a consumer takes the decision. See 294.
|
|
75
|
+
*
|
|
76
|
+
* The shape is `Carousel`'s, which is the nearest thing in the library: a
|
|
77
|
+
* `default-index` for markup that only seeds and a held state that is
|
|
78
|
+
* `undefined` until somebody sets one.
|
|
79
|
+
*
|
|
80
|
+
*
|
|
81
|
+
*/
|
|
82
|
+
get index(): number;
|
|
83
|
+
set index(next: number);
|
|
84
|
+
/**
|
|
85
|
+
* Stop to start on, where nothing declared one.
|
|
86
|
+
*/
|
|
87
|
+
defaultIndex: number;
|
|
88
|
+
/** The stop being shown, whoever set it, and `undefined` until somebody has. */
|
|
89
|
+
private indexState;
|
|
90
|
+
/**
|
|
91
|
+
* Accessible name for the run, such as "Getting started".
|
|
92
|
+
*/
|
|
93
|
+
label: string;
|
|
94
|
+
/**
|
|
95
|
+
* Space left around the target when it is lit, in pixels.
|
|
96
|
+
*/
|
|
97
|
+
spotlightPadding: number;
|
|
98
|
+
/**
|
|
99
|
+
* Label for the control that goes back, handed to every stop.
|
|
100
|
+
*/
|
|
101
|
+
backLabel: string;
|
|
102
|
+
/**
|
|
103
|
+
* Label for the control that goes on.
|
|
104
|
+
*/
|
|
105
|
+
nextLabel: string;
|
|
106
|
+
/**
|
|
107
|
+
* Label for the control that goes on from the last stop.
|
|
108
|
+
*/
|
|
109
|
+
doneLabel: string;
|
|
110
|
+
/**
|
|
111
|
+
* Label for the control that leaves the tour.
|
|
112
|
+
*/
|
|
113
|
+
skipLabel: string;
|
|
114
|
+
private assigned;
|
|
115
|
+
/**
|
|
116
|
+
* Where the light falls, read from the current target.
|
|
117
|
+
*/
|
|
118
|
+
private spot;
|
|
119
|
+
/** The stops, in the order they were written. */
|
|
120
|
+
get stops(): HelixHeadlessTourStop[];
|
|
121
|
+
/** How many stops there are. */
|
|
122
|
+
get length(): number;
|
|
123
|
+
/** Goes on, and finishes the run on the last stop. */
|
|
124
|
+
next(): void;
|
|
125
|
+
/** Goes back, and does nothing on the first stop. */
|
|
126
|
+
back(): void;
|
|
127
|
+
/**
|
|
128
|
+
* Leaves the run early, which is a close rather than a completion.
|
|
129
|
+
*
|
|
130
|
+
* Announced before it is applied, and cancelable because of it. Both closes
|
|
131
|
+
* wrote `open` first and dispatched after, so a consumer calling
|
|
132
|
+
* `preventDefault` was refusing something that had already happened.
|
|
133
|
+
*/
|
|
134
|
+
skip(): void;
|
|
135
|
+
private finish;
|
|
136
|
+
private move;
|
|
137
|
+
private readonly handleAsk;
|
|
138
|
+
private readonly handleKeydown;
|
|
139
|
+
private readonly handleViewport;
|
|
140
|
+
connectedCallback(): void;
|
|
141
|
+
disconnectedCallback(): void;
|
|
142
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
143
|
+
protected updated(changed: PropertyValues): void;
|
|
144
|
+
/**
|
|
145
|
+
* Tells each stop where it is in the run.
|
|
146
|
+
*
|
|
147
|
+
* Written onto the stops, which is the one outward write in this family and
|
|
148
|
+
* is argued for on the class above. The labels go with it, and only where the
|
|
149
|
+
* root was given one, so a stop keeps its own default unless somebody has
|
|
150
|
+
* localised the tour.
|
|
151
|
+
*/
|
|
152
|
+
private settle;
|
|
153
|
+
/** Reads the current target's box, which is where the light falls. */
|
|
154
|
+
private light;
|
|
155
|
+
protected render(): TemplateResult;
|
|
156
|
+
}
|
|
157
|
+
declare global {
|
|
158
|
+
interface HTMLElementTagNameMap {
|
|
159
|
+
'helix-headless-tour': HelixHeadlessTour;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { customElement, HelixBeforeActivateEvent, HelixBeforeCloseEvent, HelixCompleteEvent, HelixElement, hostAria, requestChange, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { html } from 'lit';
|
|
9
|
+
import { property, queryAssignedElements, state } from 'lit/decorators.js';
|
|
10
|
+
/**
|
|
11
|
+
* @summary A guided run through an interface, one stop at a time.
|
|
12
|
+
*
|
|
13
|
+
* @description
|
|
14
|
+
* The root owns the order and nothing else. Which stop is current, what Next
|
|
15
|
+
* and Back mean, when the run is finished; the stops own where they point, and
|
|
16
|
+
* the consumer owns every word.
|
|
17
|
+
*
|
|
18
|
+
* **The spotlight is a shadow, not a hole.** The scrim is a box the size of the
|
|
19
|
+
* current target with an enormous spread on its `box-shadow`, so the darkness
|
|
20
|
+
* is what the shadow paints and the target is simply where the box is. A
|
|
21
|
+
* `clip-path` on a full-screen scrim is the other way to do it and is worse
|
|
22
|
+
* here: it needs the viewport in the same coordinate space as the cut, which
|
|
23
|
+
* stops being true the moment anything between them is transformed.
|
|
24
|
+
*
|
|
25
|
+
* **It measures, and this is a case where measuring is the only option.** The
|
|
26
|
+
* target is an element somewhere else on the page whose position nothing can
|
|
27
|
+
* know statically. That is different from a trail folding by width, where the
|
|
28
|
+
* design rule was expressible and the measurement was answering a question
|
|
29
|
+
* nobody had asked. Here the question is "where is that button", and there is
|
|
30
|
+
* no other way to ask it.
|
|
31
|
+
*
|
|
32
|
+
* **Nothing is measured on the server and nothing needs to be.** A tour starts
|
|
33
|
+
* closed and a closed tour draws nothing, so the server renders the stops as
|
|
34
|
+
* inert markup and the first frame is correct. This is also what makes it
|
|
35
|
+
* acceptable for the root to write `current` onto stops it does not own: there
|
|
36
|
+
* is no server state for the write to disagree with.
|
|
37
|
+
*
|
|
38
|
+
* **It cannot point inside a modal, and nothing can fix that here.**
|
|
39
|
+
* `showModal()` makes everything outside the dialog's own subtree inert, so a
|
|
40
|
+
* panel anywhere else is unpressable however the top layer is ordered: this is
|
|
41
|
+
* what modal means rather than a stacking accident. Measured with a modal
|
|
42
|
+
* `Drawer` open, `elementsFromPoint` over the tour's own Done button returned
|
|
43
|
+
* the drawer, the press light-dismissed the drawer, and the tour heard nothing
|
|
44
|
+
* at all. Anything a tour points into has to stay reachable, which for `Drawer`
|
|
45
|
+
* and `Dialog` means not modal while the tour is running.
|
|
46
|
+
*
|
|
47
|
+
* **Focus is not trapped.** A reader has to be able to look at, and reach, the
|
|
48
|
+
* thing being pointed at. `Escape` leaves, which is the one binding a tour
|
|
49
|
+
* needs and the one every reader already tries.
|
|
50
|
+
*
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
* @status experimental
|
|
53
|
+
* @category overlays
|
|
54
|
+
* @aliases Coachmark, Product tour, Walkthrough, Onboarding
|
|
55
|
+
* @documentation https://helix.fusion.dev/components/tour
|
|
56
|
+
*
|
|
57
|
+
* @slot - The stops, in the order they should be visited.
|
|
58
|
+
*
|
|
59
|
+
* @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the current stop moves, carrying the new index. Cancelable: refusing it takes the decision and nothing moves.
|
|
60
|
+
* @event {HelixBeforeCloseEvent} helix-before-close - Fired before the reader leaves early. Cancelable: refusing it takes the decision and nothing moves.
|
|
61
|
+
* @event {HelixCompleteEvent} helix-complete - Fired when the last stop is
|
|
62
|
+
* finished.
|
|
63
|
+
* @event {Event} toggle - Says the state moved, carrying `newState` and `oldState`.
|
|
64
|
+
*
|
|
65
|
+
* @csspart spotlight - The box over the current target, which paints the scrim.
|
|
66
|
+
*/
|
|
67
|
+
let HelixHeadlessTour = class HelixHeadlessTour extends HelixElement {
|
|
68
|
+
constructor() {
|
|
69
|
+
super(...arguments);
|
|
70
|
+
/**
|
|
71
|
+
* Whether the tour is running.
|
|
72
|
+
*/
|
|
73
|
+
this.open = false;
|
|
74
|
+
/**
|
|
75
|
+
* Stop to start on, where nothing declared one.
|
|
76
|
+
*/
|
|
77
|
+
this.defaultIndex = 0;
|
|
78
|
+
/** The stop being shown, whoever set it, and `undefined` until somebody has. */
|
|
79
|
+
this.indexState = undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Accessible name for the run, such as "Getting started".
|
|
82
|
+
*/
|
|
83
|
+
this.label = '';
|
|
84
|
+
/**
|
|
85
|
+
* Space left around the target when it is lit, in pixels.
|
|
86
|
+
*/
|
|
87
|
+
this.spotlightPadding = 8;
|
|
88
|
+
/**
|
|
89
|
+
* Label for the control that goes back, handed to every stop.
|
|
90
|
+
*/
|
|
91
|
+
this.backLabel = '';
|
|
92
|
+
/**
|
|
93
|
+
* Label for the control that goes on.
|
|
94
|
+
*/
|
|
95
|
+
this.nextLabel = '';
|
|
96
|
+
/**
|
|
97
|
+
* Label for the control that goes on from the last stop.
|
|
98
|
+
*/
|
|
99
|
+
this.doneLabel = '';
|
|
100
|
+
/**
|
|
101
|
+
* Label for the control that leaves the tour.
|
|
102
|
+
*/
|
|
103
|
+
this.skipLabel = '';
|
|
104
|
+
this.handleAsk = (event) => {
|
|
105
|
+
const what = event.detail?.what;
|
|
106
|
+
if (what === 'next') {
|
|
107
|
+
this.next();
|
|
108
|
+
}
|
|
109
|
+
else if (what === 'back') {
|
|
110
|
+
this.back();
|
|
111
|
+
}
|
|
112
|
+
else if (what === 'skip') {
|
|
113
|
+
this.skip();
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
this.handleKeydown = (event) => {
|
|
117
|
+
if (this.open && event.key === 'Escape') {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
this.skip();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
/* On the window, because the scrim is fixed and a scroll or a resize moves
|
|
123
|
+
the target out from under it. Passive: neither handler cancels anything. */
|
|
124
|
+
this.handleViewport = () => {
|
|
125
|
+
this.light();
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Which stop the reader is on.
|
|
130
|
+
*
|
|
131
|
+
* **It announced after it moved for two days, which made refusing it
|
|
132
|
+
* impossible.** `index` was a plain property the tour wrote to directly:
|
|
133
|
+
* `move` assigned it and *then* announced, so `preventDefault` on the change
|
|
134
|
+
* arrived after the move it was refusing. It goes through `requestChange`
|
|
135
|
+
* now, which announces first and applies only if nobody refused, and refusing
|
|
136
|
+
* is how a consumer takes the decision. See 294.
|
|
137
|
+
*
|
|
138
|
+
* The shape is `Carousel`'s, which is the nearest thing in the library: a
|
|
139
|
+
* `default-index` for markup that only seeds and a held state that is
|
|
140
|
+
* `undefined` until somebody sets one.
|
|
141
|
+
*
|
|
142
|
+
*
|
|
143
|
+
*/
|
|
144
|
+
get index() {
|
|
145
|
+
return this.indexState ?? this.defaultIndex;
|
|
146
|
+
}
|
|
147
|
+
set index(next) {
|
|
148
|
+
const previous = this.index;
|
|
149
|
+
this.indexState = next;
|
|
150
|
+
this.requestUpdate('index', previous);
|
|
151
|
+
}
|
|
152
|
+
/** The stops, in the order they were written. */
|
|
153
|
+
get stops() {
|
|
154
|
+
return (this.assigned ?? []).filter((one) => one.current !== undefined);
|
|
155
|
+
}
|
|
156
|
+
/** How many stops there are. */
|
|
157
|
+
get length() {
|
|
158
|
+
return this.stops.length;
|
|
159
|
+
}
|
|
160
|
+
/** Goes on, and finishes the run on the last stop. */
|
|
161
|
+
next() {
|
|
162
|
+
if (this.index >= this.length - 1) {
|
|
163
|
+
this.finish();
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
this.move(this.index + 1);
|
|
167
|
+
}
|
|
168
|
+
/** Goes back, and does nothing on the first stop. */
|
|
169
|
+
back() {
|
|
170
|
+
if (this.index <= 0) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
this.move(this.index - 1);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Leaves the run early, which is a close rather than a completion.
|
|
177
|
+
*
|
|
178
|
+
* Announced before it is applied, and cancelable because of it. Both closes
|
|
179
|
+
* wrote `open` first and dispatched after, so a consumer calling
|
|
180
|
+
* `preventDefault` was refusing something that had already happened.
|
|
181
|
+
*/
|
|
182
|
+
skip() {
|
|
183
|
+
const event = new HelixBeforeCloseEvent();
|
|
184
|
+
this.dispatchEvent(event);
|
|
185
|
+
if (event.defaultPrevented) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
this.open = false;
|
|
189
|
+
}
|
|
190
|
+
/* Announced before it closes, and not cancelable, which is the difference
|
|
191
|
+
from `skip`. `HelixCompleteEvent` is `cancelable: false` by construction:
|
|
192
|
+
leaving early is a request a consumer may refuse, and having reached the
|
|
193
|
+
end is something that has already happened. What ordering still buys is a
|
|
194
|
+
listener that reads `open` and sees the tour as it was when it finished. */
|
|
195
|
+
finish() {
|
|
196
|
+
this.dispatchEvent(new HelixCompleteEvent({ value: String(this.index) }));
|
|
197
|
+
this.open = false;
|
|
198
|
+
}
|
|
199
|
+
/* The one audited path, which every stateful change in the library goes
|
|
200
|
+
through and this did not. It announces, then applies where nothing refused
|
|
201
|
+
and where the consumer has not taken the value over, and it audits a
|
|
202
|
+
controlled tour whose consumer never answers. */
|
|
203
|
+
move(to) {
|
|
204
|
+
requestChange({
|
|
205
|
+
apply: (value) => {
|
|
206
|
+
this.index = value;
|
|
207
|
+
},
|
|
208
|
+
event: (value) => new HelixBeforeActivateEvent({ value: String(value) }),
|
|
209
|
+
host: this,
|
|
210
|
+
next: to,
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
connectedCallback() {
|
|
214
|
+
super.connectedCallback();
|
|
215
|
+
/* On the host, not on the slot the stops are assigned to.
|
|
216
|
+
The event is composed and bubbles, so in a browser it reaches either. It
|
|
217
|
+
does not reach the slot under `bun test`: happy-dom does not propagate
|
|
218
|
+
events through slot assignment, so a listener bound there hears nothing
|
|
219
|
+
and every spec about pressing Next passes for the wrong reason or fails
|
|
220
|
+
for a reason that is not the component's. `Megamenu` moved its own
|
|
221
|
+
listener to the host for exactly this. */
|
|
222
|
+
this.addEventListener('helix-tour-ask', this.handleAsk);
|
|
223
|
+
this.ownerDocument.addEventListener('keydown', this.handleKeydown);
|
|
224
|
+
globalThis.addEventListener('resize', this.handleViewport, { passive: true });
|
|
225
|
+
globalThis.addEventListener('scroll', this.handleViewport, { capture: true, passive: true });
|
|
226
|
+
}
|
|
227
|
+
disconnectedCallback() {
|
|
228
|
+
super.disconnectedCallback();
|
|
229
|
+
this.removeEventListener('helix-tour-ask', this.handleAsk);
|
|
230
|
+
this.ownerDocument.removeEventListener('keydown', this.handleKeydown);
|
|
231
|
+
globalThis.removeEventListener('resize', this.handleViewport);
|
|
232
|
+
globalThis.removeEventListener('scroll', this.handleViewport, { capture: true });
|
|
233
|
+
}
|
|
234
|
+
willUpdate(changed) {
|
|
235
|
+
super.willUpdate(changed);
|
|
236
|
+
/* Only the first time, before anything reads it. A script assigning `index`
|
|
237
|
+
to a tour nobody owns would otherwise hand it to a consumer who never
|
|
238
|
+
asked, and the tour would stop moving itself from then on. See
|
|
239
|
+
`MixinControllerOpen`, which argues the whole decide-once rule. */
|
|
240
|
+
hostAria(this.internals, { label: this.label, role: 'region' });
|
|
241
|
+
}
|
|
242
|
+
updated(changed) {
|
|
243
|
+
super.updated(changed);
|
|
244
|
+
this.settle();
|
|
245
|
+
this.light();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Tells each stop where it is in the run.
|
|
249
|
+
*
|
|
250
|
+
* Written onto the stops, which is the one outward write in this family and
|
|
251
|
+
* is argued for on the class above. The labels go with it, and only where the
|
|
252
|
+
* root was given one, so a stop keeps its own default unless somebody has
|
|
253
|
+
* localised the tour.
|
|
254
|
+
*/
|
|
255
|
+
settle() {
|
|
256
|
+
const stops = this.stops;
|
|
257
|
+
const at = Math.max(0, Math.min(this.index, stops.length - 1));
|
|
258
|
+
stops.forEach((stop, index) => {
|
|
259
|
+
stop.current = this.open && index === at;
|
|
260
|
+
stop.first = index === 0;
|
|
261
|
+
stop.last = index === stops.length - 1;
|
|
262
|
+
if (this.backLabel !== '') {
|
|
263
|
+
stop.backLabel = this.backLabel;
|
|
264
|
+
}
|
|
265
|
+
if (this.nextLabel !== '') {
|
|
266
|
+
stop.nextLabel = this.nextLabel;
|
|
267
|
+
}
|
|
268
|
+
if (this.doneLabel !== '') {
|
|
269
|
+
stop.doneLabel = this.doneLabel;
|
|
270
|
+
}
|
|
271
|
+
if (this.skipLabel !== '') {
|
|
272
|
+
stop.skipLabel = this.skipLabel;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
/** Reads the current target's box, which is where the light falls. */
|
|
277
|
+
light() {
|
|
278
|
+
const stops = this.stops;
|
|
279
|
+
const target = this.open
|
|
280
|
+
? stops[Math.max(0, Math.min(this.index, stops.length - 1))]?.target
|
|
281
|
+
: undefined;
|
|
282
|
+
if (!target || typeof target.getBoundingClientRect !== 'function') {
|
|
283
|
+
this.spot = undefined;
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
const box = target.getBoundingClientRect();
|
|
287
|
+
const pad = this.spotlightPadding;
|
|
288
|
+
const next = {
|
|
289
|
+
height: box.height + pad * 2,
|
|
290
|
+
left: box.left - pad,
|
|
291
|
+
top: box.top - pad,
|
|
292
|
+
width: box.width + pad * 2,
|
|
293
|
+
};
|
|
294
|
+
const same = this.spot !== undefined &&
|
|
295
|
+
this.spot.top === next.top &&
|
|
296
|
+
this.spot.left === next.left &&
|
|
297
|
+
this.spot.width === next.width &&
|
|
298
|
+
this.spot.height === next.height;
|
|
299
|
+
if (!same) {
|
|
300
|
+
this.spot = next;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
render() {
|
|
304
|
+
const spot = this.spot;
|
|
305
|
+
return html `${spot === undefined
|
|
306
|
+
? ''
|
|
307
|
+
: html `<div
|
|
308
|
+
part="spotlight"
|
|
309
|
+
aria-hidden="true"
|
|
310
|
+
style=${`inset-block-start: ${spot.top}px; inset-inline-start: ${spot.left}px; block-size: ${spot.height}px; inline-size: ${spot.width}px`}
|
|
311
|
+
></div>`}
|
|
312
|
+
<slot></slot>`;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
__decorate([
|
|
316
|
+
property({ reflect: true, type: Boolean })
|
|
317
|
+
], HelixHeadlessTour.prototype, "open", void 0);
|
|
318
|
+
__decorate([
|
|
319
|
+
property({ type: Number })
|
|
320
|
+
], HelixHeadlessTour.prototype, "index", null);
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ attribute: 'default-index', type: Number })
|
|
323
|
+
], HelixHeadlessTour.prototype, "defaultIndex", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property()
|
|
326
|
+
], HelixHeadlessTour.prototype, "label", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ attribute: 'spotlight-padding', type: Number })
|
|
329
|
+
], HelixHeadlessTour.prototype, "spotlightPadding", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
property({ attribute: 'back-label' })
|
|
332
|
+
], HelixHeadlessTour.prototype, "backLabel", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
property({ attribute: 'next-label' })
|
|
335
|
+
], HelixHeadlessTour.prototype, "nextLabel", void 0);
|
|
336
|
+
__decorate([
|
|
337
|
+
property({ attribute: 'done-label' })
|
|
338
|
+
], HelixHeadlessTour.prototype, "doneLabel", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
property({ attribute: 'skip-label' })
|
|
341
|
+
], HelixHeadlessTour.prototype, "skipLabel", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
queryAssignedElements({ flatten: true })
|
|
344
|
+
], HelixHeadlessTour.prototype, "assigned", void 0);
|
|
345
|
+
__decorate([
|
|
346
|
+
state()
|
|
347
|
+
], HelixHeadlessTour.prototype, "spot", void 0);
|
|
348
|
+
HelixHeadlessTour = __decorate([
|
|
349
|
+
customElement('helix-headless-tour')
|
|
350
|
+
], HelixHeadlessTour);
|
|
351
|
+
export { HelixHeadlessTour };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { HelixElement, type Placement } from '@fusion.dev/helix-core';
|
|
2
|
+
import type { PropertyValues, TemplateResult } from 'lit';
|
|
3
|
+
import '../../button/index.js';
|
|
4
|
+
/**
|
|
5
|
+
* @summary One stop on a tour: what it points at, and a panel to say it in.
|
|
6
|
+
*
|
|
7
|
+
* @description
|
|
8
|
+
* A stop names a target with `for` and holds whatever the consumer puts in it.
|
|
9
|
+
* It owns no content of its own, which is the whole shape of this family: the
|
|
10
|
+
* tour abstracts the three things that are genuinely hard, and the words are
|
|
11
|
+
* the consumer's.
|
|
12
|
+
*
|
|
13
|
+
* What it does own:
|
|
14
|
+
*
|
|
15
|
+
* - **Where the panel goes.** Anchored to the target through the same floating
|
|
16
|
+
* pass every other overlay here uses.
|
|
17
|
+
* - **That it is on top.** A popover, so it is in the top layer. A tour points
|
|
18
|
+
* at things inside dialogs, inside scrollers, inside anything with a stacking
|
|
19
|
+
* context, and a panel in the ordinary flow loses to all three.
|
|
20
|
+
* - **When it shows.** Which is `current`, and which the root decides.
|
|
21
|
+
*
|
|
22
|
+
* What it does not own is the heading, the paragraph, the picture and the
|
|
23
|
+
* layout. Slot a `helix-card`, or a heading and a line of prose, or anything
|
|
24
|
+
* else. This was written the other way first, with `title` and `body` parts and
|
|
25
|
+
* a fixed arrangement, which is a component deciding what a tour is allowed to
|
|
26
|
+
* say.
|
|
27
|
+
*
|
|
28
|
+
* **The buttons are slot fallback, so the common case costs nothing and the
|
|
29
|
+
* uncommon one is possible.** Write nothing and get Back, Next and Skip already
|
|
30
|
+
* wired. Slot `actions` and they are yours, driven by `next()`, `back()` and
|
|
31
|
+
* `skip()` on the root, which are public for exactly that.
|
|
32
|
+
*
|
|
33
|
+
* **`for` is an id, the same as `Tooltip`'s.** The target is elsewhere on the
|
|
34
|
+
* page, and an id is the one reference a consumer can write in markup without
|
|
35
|
+
* holding an element. Resolved against the root node, so a stop inside a shadow
|
|
36
|
+
* tree points at a target in that tree.
|
|
37
|
+
*
|
|
38
|
+
* @since 0.1.0
|
|
39
|
+
* @status experimental
|
|
40
|
+
* @category overlays
|
|
41
|
+
* @documentation https://helix.fusion.dev/components/tour
|
|
42
|
+
*
|
|
43
|
+
* @slot - What this stop says. A card, a heading and a line, anything.
|
|
44
|
+
* @slot actions - Replaces the controls, which are Back, Next and Skip.
|
|
45
|
+
*
|
|
46
|
+
* @event {HelixTourAskEvent} helix-tour-ask - A stop asking the tour to move, from its own controls.
|
|
47
|
+
*
|
|
48
|
+
* @csspart actions - The row the controls sit in.
|
|
49
|
+
* @csspart arrow - The point, which the floating pass places against the target.
|
|
50
|
+
* @csspart back - The control that goes to the previous stop.
|
|
51
|
+
* @csspart back-button - The inner control.
|
|
52
|
+
* @csspart bubble - The panel that points at the target.
|
|
53
|
+
* @csspart content - The region holding the slotted content.
|
|
54
|
+
* @csspart next - The control that goes on, and finishes on the last stop.
|
|
55
|
+
* @csspart next-button - The inner control.
|
|
56
|
+
* @csspart skip - The control that leaves the tour.
|
|
57
|
+
* @csspart skip-button - The inner control.
|
|
58
|
+
*/
|
|
59
|
+
export declare class HelixHeadlessTourStop extends HelixElement {
|
|
60
|
+
/**
|
|
61
|
+
* The id of the element this stop is about.
|
|
62
|
+
*/
|
|
63
|
+
for: string;
|
|
64
|
+
/**
|
|
65
|
+
* Which side of the target the panel prefers.
|
|
66
|
+
*/
|
|
67
|
+
placement: Placement;
|
|
68
|
+
/**
|
|
69
|
+
* Whether this is the stop the reader is on.
|
|
70
|
+
*
|
|
71
|
+
* Written by the root rather than by a consumer, which is the one place this
|
|
72
|
+
* family writes onto markup it does not own. It is acceptable here for a
|
|
73
|
+
* reason that did not hold for the trail or the avatar group: a tour starts
|
|
74
|
+
* closed, so there is no server state to get wrong. The server renders a
|
|
75
|
+
* closed tour, a closed tour shows nothing, and nothing can disagree.
|
|
76
|
+
*/
|
|
77
|
+
current: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Whether this is the last stop, so the control says Done.
|
|
80
|
+
*/
|
|
81
|
+
last: boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Whether this is the first stop, so there is nowhere back to.
|
|
84
|
+
*/
|
|
85
|
+
first: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Label for the control that goes back.
|
|
88
|
+
*/
|
|
89
|
+
backLabel: string;
|
|
90
|
+
/**
|
|
91
|
+
* Label for the control that goes on.
|
|
92
|
+
*/
|
|
93
|
+
nextLabel: string;
|
|
94
|
+
/**
|
|
95
|
+
* Label for the control that goes on from the last stop.
|
|
96
|
+
*/
|
|
97
|
+
doneLabel: string;
|
|
98
|
+
/**
|
|
99
|
+
* Label for the control that leaves the tour.
|
|
100
|
+
*/
|
|
101
|
+
skipLabel: string;
|
|
102
|
+
/** The element this stop is about, or null where the id resolves to nothing. */
|
|
103
|
+
get target(): HTMLElement | null;
|
|
104
|
+
private readonly floating;
|
|
105
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
106
|
+
protected updated(changed: PropertyValues): void;
|
|
107
|
+
/**
|
|
108
|
+
* Skip, back and next, behind a seam the styled tier can move.
|
|
109
|
+
*
|
|
110
|
+
* They are slot fallback rather than markup a consumer has to write, so a
|
|
111
|
+
* tour with nothing slotted still has the three controls a tour needs; and
|
|
112
|
+
* they are a method as well, so a tier above can render its own three without
|
|
113
|
+
* reimplementing the panel around them. Both are needed: the slot is for the
|
|
114
|
+
* consumer and the method is for the tier.
|
|
115
|
+
*/
|
|
116
|
+
protected renderActions(): TemplateResult;
|
|
117
|
+
protected render(): TemplateResult;
|
|
118
|
+
/**
|
|
119
|
+
* Says what the reader pressed and lets the root decide.
|
|
120
|
+
*
|
|
121
|
+
* A stop cannot move a tour: it does not know what is after it, and a stop
|
|
122
|
+
* that reached up to its parent to find out would be a stop that only works
|
|
123
|
+
* inside one. Composed, so the root hears it through its own slot.
|
|
124
|
+
*/
|
|
125
|
+
private ask;
|
|
126
|
+
}
|
|
127
|
+
declare global {
|
|
128
|
+
interface HTMLElementTagNameMap {
|
|
129
|
+
'helix-headless-tour-stop': HelixHeadlessTourStop;
|
|
130
|
+
}
|
|
131
|
+
}
|