@fusion.dev/helix-headless 0.144.0 → 0.146.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 +15195 -4240
- package/dist/accordion/item/accordion-item.d.ts +62 -12
- package/dist/accordion/item/accordion-item.js +41 -10
- package/dist/accordion/root/accordion-root.d.ts +14 -5
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +24 -3
- package/dist/announcement/root/announcement-root.js +39 -2
- package/dist/app-header/root/app-header-root.d.ts +12 -0
- package/dist/app-header/root/app-header-root.js +13 -1
- package/dist/app-header/sectioning.d.ts +9 -0
- package/dist/app-header/sectioning.js +27 -0
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/badge/root/badge-root.d.ts +3 -1
- package/dist/badge/root/badge-root.js +2 -2
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +52 -15
- package/dist/bar-chart/stack.d.ts +15 -0
- package/dist/bar-chart/stack.js +19 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +57 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +73 -3
- package/dist/button/root/button-root.d.ts +26 -0
- package/dist/button/root/button-root.js +38 -18
- package/dist/button-group/root/button-group-root.d.ts +2 -1
- package/dist/button-group/root/button-group-root.js +5 -1
- package/dist/canvas/node/canvas-node.d.ts +4 -3
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +123 -42
- package/dist/card/root/card-root.d.ts +24 -3
- package/dist/card/root/card-root.js +20 -8
- package/dist/carousel/root/carousel-root.d.ts +133 -4
- package/dist/carousel/root/carousel-root.js +174 -24
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- 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 +27 -10
- package/dist/chat/naming.d.ts +26 -0
- package/dist/chat/naming.js +14 -0
- package/dist/chat/root/chat-root.d.ts +58 -0
- package/dist/chat/root/chat-root.js +43 -3
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +14 -1
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
- package/dist/checkbox-group/select-all.d.ts +27 -0
- package/dist/checkbox-group/select-all.js +12 -0
- package/dist/code-block/highlight.d.ts +15 -0
- package/dist/code-block/highlight.js +4 -0
- package/dist/code-block/root/code-block-root.d.ts +57 -2
- package/dist/code-block/root/code-block-root.js +63 -8
- package/dist/color-input/root/color-input-root.d.ts +3 -0
- package/dist/color-input/root/color-input-root.js +6 -3
- package/dist/color-picker/root/color-picker-root.d.ts +33 -4
- package/dist/color-picker/root/color-picker-root.js +80 -21
- package/dist/color-picker/swatches.d.ts +12 -0
- package/dist/color-picker/swatches.js +26 -0
- package/dist/combobox/root/combobox-root.d.ts +43 -0
- package/dist/combobox/root/combobox-root.js +79 -15
- package/dist/command/root/command-root.d.ts +16 -1
- package/dist/command/root/command-root.js +22 -4
- package/dist/copy-button/root/copy-button-root.d.ts +26 -1
- package/dist/copy-button/root/copy-button-root.js +12 -5
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +24 -0
- package/dist/data-table/keys.js +24 -0
- package/dist/data-table/root/data-table-root.d.ts +170 -13
- package/dist/data-table/root/data-table-root.js +294 -52
- package/dist/data-table/tree.d.ts +55 -0
- package/dist/data-table/tree.js +54 -0
- package/dist/date-input/root/date-input-root.d.ts +3 -1
- package/dist/date-input/root/date-input-root.js +18 -7
- package/dist/date-picker/root/date-picker-root.js +12 -6
- 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.js +15 -1
- package/dist/dialog/root/dialog-root.d.ts +8 -2
- package/dist/dialog/root/dialog-root.js +16 -1
- package/dist/divider/root/divider-root.d.ts +3 -0
- package/dist/divider/root/divider-root.js +2 -1
- package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
- package/dist/donut-chart/root/donut-chart-root.js +48 -1
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +59 -0
- package/dist/drawer/root/drawer-root.js +63 -4
- 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 +29 -0
- package/dist/drilldown/root/drilldown-root.js +28 -5
- package/dist/element-events.generated.js +83 -12
- package/dist/empty/root/empty-root.d.ts +3 -1
- package/dist/empty/root/empty-root.js +3 -2
- package/dist/file-input/root/file-input-root.d.ts +69 -6
- package/dist/file-input/root/file-input-root.js +82 -19
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +16 -4
- package/dist/filter-input/root/filter-input-root.d.ts +30 -6
- package/dist/filter-input/root/filter-input-root.js +1 -1
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/root/format-date-root.d.ts +9 -16
- package/dist/format-date/root/format-date-root.js +10 -27
- package/dist/heatmap/root/heatmap-root.d.ts +24 -13
- package/dist/heatmap/root/heatmap-root.js +34 -12
- package/dist/icon/root/icon-root.d.ts +12 -1
- package/dist/icon/root/icon-root.js +21 -10
- package/dist/icon/settle.d.ts +7 -0
- package/dist/icon/settle.js +10 -0
- package/dist/icon-button/root/icon-button-root.d.ts +2 -0
- package/dist/image/root/image-root.d.ts +5 -1
- package/dist/image/root/image-root.js +10 -2
- package/dist/input/root/input-root.d.ts +13 -3
- package/dist/input/root/input-root.js +12 -3
- package/dist/kbd/root/kbd-root.d.ts +35 -1
- package/dist/kbd/root/kbd-root.js +23 -4
- package/dist/legend/root/legend-root.d.ts +55 -8
- package/dist/legend/root/legend-root.js +55 -13
- package/dist/lightbox/root/lightbox-root.d.ts +49 -6
- package/dist/lightbox/root/lightbox-root.js +86 -19
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +22 -0
- package/dist/lightbox/zoom.js +16 -0
- package/dist/line-chart/root/line-chart-root.d.ts +22 -1
- package/dist/line-chart/root/line-chart-root.js +21 -1
- package/dist/list/item/list-item.d.ts +70 -1
- package/dist/list/item/list-item.js +77 -6
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +155 -9
- package/dist/list/root/list-root.js +246 -4
- package/dist/list/selection.d.ts +49 -0
- package/dist/list/selection.js +30 -0
- package/dist/listbox/root/listbox-root.d.ts +37 -1
- package/dist/listbox/root/listbox-root.js +49 -4
- package/dist/loader/busy.d.ts +10 -0
- package/dist/loader/busy.js +11 -0
- package/dist/loader/root/loader-root.d.ts +9 -2
- package/dist/loader/root/loader-root.js +23 -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 +62 -0
- package/dist/megamenu/root/megamenu-root.js +90 -5
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +87 -11
- package/dist/menu/item/menu-item.js +78 -22
- package/dist/menu/root/menu-root.d.ts +39 -1
- package/dist/menu/root/menu-root.js +65 -8
- 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 +20 -1
- package/dist/meter/root/meter-root.js +11 -15
- package/dist/navigation/root/navigation-root.d.ts +18 -2
- package/dist/navigation/root/navigation-root.js +29 -3
- package/dist/notifications/root/notifications-root.d.ts +25 -0
- package/dist/notifications/root/notifications-root.js +33 -5
- package/dist/number-input/root/number-input-root.d.ts +17 -8
- package/dist/number-input/root/number-input-root.js +2 -7
- package/dist/object-inspector/root/object-inspector-root.d.ts +161 -32
- package/dist/object-inspector/root/object-inspector-root.js +264 -123
- package/dist/object-inspector/rows.d.ts +75 -0
- package/dist/object-inspector/rows.js +119 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +86 -3
- package/dist/outline/root/outline-root.js +95 -12
- package/dist/pagination/size/pagination-size.d.ts +12 -2
- package/dist/pagination/size/pagination-size.js +20 -5
- package/dist/pin-input/code.d.ts +10 -0
- package/dist/pin-input/code.js +13 -0
- package/dist/pin-input/root/pin-input-root.d.ts +25 -1
- package/dist/pin-input/root/pin-input-root.js +10 -11
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +41 -0
- package/dist/popover/root/popover-root.d.ts +57 -7
- package/dist/popover/root/popover-root.js +58 -3
- package/dist/progress/root/progress-root.d.ts +20 -0
- package/dist/progress/root/progress-root.js +15 -15
- package/dist/qr-code/export.d.ts +26 -1
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/root/qr-code-root.d.ts +19 -5
- package/dist/qr-code/root/qr-code-root.js +58 -9
- package/dist/quote/marks.d.ts +8 -0
- package/dist/quote/marks.js +5 -0
- package/dist/quote/root/quote-root.d.ts +14 -2
- package/dist/quote/root/quote-root.js +23 -1
- package/dist/radio/group/radio-group.d.ts +4 -10
- package/dist/radio/group/radio-group.js +5 -10
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +6 -1
- package/dist/rating/root/rating-root.d.ts +10 -5
- package/dist/rating/root/rating-root.js +32 -8
- package/dist/rating/steps.d.ts +7 -0
- package/dist/rating/steps.js +9 -0
- package/dist/scatter-chart/fit.d.ts +15 -0
- package/dist/scatter-chart/fit.js +35 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +21 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
- package/dist/scroll-area/root/scroll-area-root.d.ts +84 -0
- package/dist/scroll-area/root/scroll-area-root.js +106 -7
- package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
- package/dist/scroll-area/scrollbar-controller.js +172 -0
- package/dist/scroll-area/scrollbar.d.ts +92 -0
- package/dist/scroll-area/scrollbar.js +33 -0
- package/dist/select/root/select-root.d.ts +15 -0
- package/dist/select/root/select-root.js +18 -6
- package/dist/skeleton/root/skeleton-root.d.ts +3 -0
- package/dist/skeleton/root/skeleton-root.js +4 -2
- package/dist/skip-link/root/skip-link-root.js +2 -2
- package/dist/slider/root/slider-root.d.ts +41 -4
- package/dist/slider/root/slider-root.js +23 -3
- package/dist/sparkline/readings.d.ts +18 -0
- package/dist/sparkline/readings.js +19 -0
- package/dist/sparkline/root/sparkline-root.d.ts +78 -7
- package/dist/sparkline/root/sparkline-root.js +118 -23
- package/dist/speed-dial/root/speed-dial-root.js +2 -2
- package/dist/splitter/root/splitter-root.d.ts +20 -12
- package/dist/splitter/root/splitter-root.js +226 -203
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +14 -5
- package/dist/stat/root/stat-root.js +21 -5
- package/dist/steps/reach.d.ts +20 -0
- package/dist/steps/reach.js +15 -0
- package/dist/steps/root/steps-root.d.ts +76 -0
- package/dist/steps/root/steps-root.js +93 -1
- package/dist/steps/step/step.d.ts +45 -2
- package/dist/steps/step/step.js +33 -6
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +11 -10
- package/dist/table/column/table-column.js +8 -19
- package/dist/table/root/table-root.d.ts +126 -4
- package/dist/table/root/table-root.js +156 -6
- 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 +22 -5
- package/dist/tabs/panel/tab-panel.js +34 -6
- package/dist/tabs/root/tabs-root.d.ts +37 -1
- package/dist/tabs/root/tabs-root.js +22 -4
- package/dist/tabs/tab/tab.d.ts +41 -4
- package/dist/tabs/tab/tab.js +49 -3
- package/dist/tag/group/tag-group.d.ts +31 -4
- package/dist/tag/group/tag-group.js +46 -7
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +28 -1
- package/dist/textarea/root/textarea-root.js +40 -1
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +16 -8
- package/dist/time-picker/root/time-picker-root.d.ts +18 -4
- package/dist/time-picker/root/time-picker-root.js +7 -10
- package/dist/time-picker/wheel-name.d.ts +9 -0
- package/dist/time-picker/wheel-name.js +15 -0
- 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/item/toast-item.d.ts +24 -18
- package/dist/toast/item/toast-item.js +36 -40
- package/dist/toast/root/toast-root.d.ts +6 -0
- package/dist/toast/root/toast-root.js +16 -1
- package/dist/toggle/group/toggle-group.d.ts +24 -3
- package/dist/toggle/group/toggle-group.js +34 -5
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/root/tooltip-root.d.ts +13 -2
- package/dist/tooltip/root/tooltip-root.js +9 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +30 -2
- package/dist/tour/root/tour-root.js +34 -8
- package/dist/tree/item/tree-item.d.ts +61 -4
- package/dist/tree/item/tree-item.js +92 -20
- package/dist/tree/root/tree-root.d.ts +58 -0
- package/dist/tree/root/tree-root.js +80 -16
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +13 -0
- package/dist/trend/root/trend-root.d.ts +43 -18
- package/dist/trend/root/trend-root.js +31 -6
- package/dist/video/media-events.d.ts +44 -0
- package/dist/video/media-events.js +35 -0
- package/dist/video/root/video-root.d.ts +117 -18
- package/dist/video/root/video-root.js +93 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +77 -3
- 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 +22 -0
- package/dist/virtual-list/fill.js +23 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/plan.d.ts +49 -0
- package/dist/virtual-list/plan.js +16 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +259 -26
- package/dist/virtual-list/root/virtual-list-root.js +333 -49
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +8113 -1394
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +1678 -353
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/listbox/range.d.ts +0 -17
- package/dist/listbox/range.js +0 -5
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { commaList, pressedValue, rangeAdd } from '@fusion.dev/helix-core';
|
|
2
|
+
export const choiceValue = ({ anchor, arrived = false, behavior, extend = false, mode, pressed, shown, toggle = false, value, }) => {
|
|
3
|
+
if (mode === 'none') {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
const now = commaList(value);
|
|
7
|
+
if (extend && mode === 'multiple') {
|
|
8
|
+
const from = anchor === undefined ? -1 : shown.indexOf(anchor);
|
|
9
|
+
const range = rangeAdd(now, shown, from, shown.indexOf(pressed));
|
|
10
|
+
return range ? range.join(', ') : null;
|
|
11
|
+
}
|
|
12
|
+
if (behavior === 'replace' && !toggle) {
|
|
13
|
+
return now.length === 1 && now[0] === pressed ? null : pressed;
|
|
14
|
+
}
|
|
15
|
+
if (arrived) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
const next = pressedValue(mode, value, pressed);
|
|
19
|
+
return next === value ? null : next;
|
|
20
|
+
};
|
|
21
|
+
export const rowStop = (count, at, step) => {
|
|
22
|
+
if (count <= 1) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
const next = at + step;
|
|
26
|
+
if (next >= count) {
|
|
27
|
+
return 0;
|
|
28
|
+
}
|
|
29
|
+
return next < 0 ? count - 1 : next;
|
|
30
|
+
};
|
|
@@ -44,18 +44,22 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
44
44
|
*
|
|
45
45
|
* @slot - The options, and any groups of them.
|
|
46
46
|
* @slot empty - What the list shows when it has no options to show, for content richer than `empty-text`.
|
|
47
|
+
* @slot error - What the list shows while `load-error` is set, for content richer than its text.
|
|
47
48
|
* @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
|
|
48
49
|
* @slot filter-icon - The icon in the filter field. Defaults to a magnifying glass.
|
|
49
50
|
* @slot hint - The hint, for content richer than plain text.
|
|
50
51
|
* @slot label - The label, for content richer than plain text.
|
|
51
52
|
* @slot loading - What the list shows while its options load, for content richer than `loading-text`.
|
|
53
|
+
* @slot no-results - What the list shows when a filter hides every option, for content richer than `no-results-text`.
|
|
52
54
|
*
|
|
53
55
|
* @event {Event} change - Fired after the value changes.
|
|
54
56
|
* @event {HelixBeforeChangeEvent} helix-before-change - Fired when the value is about to change, and cancelable.
|
|
55
57
|
* @event {HelixFilterEvent} helix-filter - Fired before the list is filtered, and cancelable.
|
|
58
|
+
* @event {HelixLoadMoreEvent} helix-load-more - Fired once the list is scrolled within a screen of its end, once for each number of options, and not while `loading` is set. Add the next page of options and set `loading` while you fetch it.
|
|
56
59
|
* @event {Event} input - Fired after the value changes.
|
|
57
60
|
*
|
|
58
|
-
* @csspart empty - The text shown when the filter hides every
|
|
61
|
+
* @csspart empty - The text shown when the list has no options to show, or the filter hides every one. `:state(no-results)` is set for the second.
|
|
62
|
+
* @csspart error - The text shown while `load-error` is set.
|
|
59
63
|
* @csspart feedback - The message that says what is wrong with the value.
|
|
60
64
|
* @csspart filter-icon - The icon beside the filter field.
|
|
61
65
|
* @csspart filter-mark - The default icon beside the filter field, shown when none is slotted.
|
|
@@ -68,8 +72,10 @@ declare const HelixHeadlessListbox_base: (new (...args: any[]) => import("@fusio
|
|
|
68
72
|
* @csspart search-field - The filter field.
|
|
69
73
|
*
|
|
70
74
|
* @cssstate empty - The list has no options to show: none were given, or the filter hid every one.
|
|
75
|
+
* @cssstate error - While `load-error` is set.
|
|
71
76
|
* @cssstate invalid - The control has an error to show, from the browser's validation or from your `feedback`.
|
|
72
77
|
* @cssstate loading - While `loading` is set.
|
|
78
|
+
* @cssstate no-results - A filter hid every option of a list that has some.
|
|
73
79
|
*/
|
|
74
80
|
export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
75
81
|
protected readonly aria: AriaForwardController;
|
|
@@ -130,6 +136,14 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
130
136
|
* Placeholder text for the filter field.
|
|
131
137
|
*/
|
|
132
138
|
filterLabel: string;
|
|
139
|
+
/**
|
|
140
|
+
* What the list says when its options could not be loaded, such as after a
|
|
141
|
+
* request to a server fails. Empty is no error.
|
|
142
|
+
*
|
|
143
|
+
* Set, it shows under any options there are, in place of `empty-text` and
|
|
144
|
+
* `loading-text`, and a screen reader hears it. Clear it when you ask again.
|
|
145
|
+
*/
|
|
146
|
+
loadError: string;
|
|
133
147
|
/**
|
|
134
148
|
* Stops the arrow keys from choosing each option they move to. Enter, Space
|
|
135
149
|
* or a click chooses the highlighted option.
|
|
@@ -143,6 +157,13 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
143
157
|
* Whether more than one option can be chosen.
|
|
144
158
|
*/
|
|
145
159
|
multiple: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* The text shown when a filter hides every option of a list that has some.
|
|
162
|
+
*
|
|
163
|
+
* Absent, the list says `empty-text` in both cases. Set it to tell "nothing
|
|
164
|
+
* matches what you typed" from "there is nothing here".
|
|
165
|
+
*/
|
|
166
|
+
noResultsText?: string;
|
|
146
167
|
/**
|
|
147
168
|
* What a screen reader hears when a filter leaves one option. `{count}` is
|
|
148
169
|
* the count.
|
|
@@ -430,6 +451,14 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
430
451
|
private takeFilter;
|
|
431
452
|
/** Filters at once on a filter still waiting out `filterDelay`. */
|
|
432
453
|
private flushFilter;
|
|
454
|
+
/** The number of options the list last asked for more at. */
|
|
455
|
+
private askedAt;
|
|
456
|
+
/**
|
|
457
|
+
* Asks for more once the reader is within a screen of the end, React Aria's
|
|
458
|
+
* `onLoadMore`: once for each number of options, so a scroll that goes on
|
|
459
|
+
* asks again only after the next page arrived, and never while loading.
|
|
460
|
+
*/
|
|
461
|
+
private readonly handleScroll;
|
|
433
462
|
/** Requests a new filter, and returns whether the request went through. */
|
|
434
463
|
requestFilter(next: string): boolean;
|
|
435
464
|
/**
|
|
@@ -485,6 +514,13 @@ export declare class HelixHeadlessListbox extends HelixHeadlessListbox_base {
|
|
|
485
514
|
* the live region still says it.
|
|
486
515
|
*/
|
|
487
516
|
protected renderStatus(hasContent: boolean): TemplateResult | typeof nothing;
|
|
517
|
+
/**
|
|
518
|
+
* Whether a filter hid every option of a list that has some, which is a
|
|
519
|
+
* different thing to say from a list that has none.
|
|
520
|
+
*/
|
|
521
|
+
private get noResults();
|
|
522
|
+
/** The error, or what a filter that hid everything says, before the shared words. */
|
|
523
|
+
protected renderLive(hasContent: boolean): TemplateResult;
|
|
488
524
|
protected render(): TemplateResult;
|
|
489
525
|
}
|
|
490
526
|
declare global {
|
|
@@ -4,14 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, countLabel, customElement, DelayController, DisabledCascadeController, HelixFilterEvent, HelixFormElement, hostAria, MixinCollection, MixinControllerValue, MixinField, reportValues, requestChange, scrollItemIntoView, Typeahead, typesCharacter, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, countLabel, customElement, DelayController, DisabledCascadeController, HelixFilterEvent, HelixFormElement, HelixLoadMoreEvent, hostAria, MixinCollection, MixinControllerValue, MixinField, rangeAdd, reportValues, requestChange, scrollItemIntoView, Typeahead, typesCharacter, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { magnifyingGlass } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
11
11
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
12
12
|
import { HelixHeadlessOptionGroup } from '../../option/group/option-group.js';
|
|
13
13
|
import { HelixHeadlessOption } from '../../option/root/option-root.js';
|
|
14
|
-
import { rangeAdd } from '../range.js';
|
|
15
14
|
const MOVES = new Set(['ArrowDown', 'ArrowUp', 'End', 'Home', 'PageDown', 'PageUp']);
|
|
16
15
|
const FIELD_MOVES = new Set(['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp']);
|
|
17
16
|
const PAGE = 10;
|
|
@@ -71,6 +70,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
71
70
|
this.filterable = false;
|
|
72
71
|
this.filterDelay = 0;
|
|
73
72
|
this.filterLabel = 'Filter';
|
|
73
|
+
this.loadError = '';
|
|
74
74
|
this.manual = false;
|
|
75
75
|
this.multiple = false;
|
|
76
76
|
this.resultLabel = '{count} result';
|
|
@@ -193,6 +193,18 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
193
193
|
this.takeFilter(control);
|
|
194
194
|
};
|
|
195
195
|
this.filtering = new DelayController(this, { renders: false });
|
|
196
|
+
this.askedAt = -1;
|
|
197
|
+
this.handleScroll = (event) => {
|
|
198
|
+
const items = event.currentTarget;
|
|
199
|
+
const count = this.options.length;
|
|
200
|
+
if (this.loading || count === this.askedAt || items.clientHeight === 0) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (items.scrollHeight - items.scrollTop - items.clientHeight <= items.clientHeight) {
|
|
204
|
+
this.askedAt = count;
|
|
205
|
+
this.dispatchEvent(new HelixLoadMoreEvent());
|
|
206
|
+
}
|
|
207
|
+
};
|
|
196
208
|
this.handleFilterKeydown = (event) => {
|
|
197
209
|
if (event.key === 'Enter' || FIELD_MOVES.has(event.key)) {
|
|
198
210
|
this.flushFilter();
|
|
@@ -472,6 +484,8 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
472
484
|
}
|
|
473
485
|
this.toggleState('empty', !this.showsOptions);
|
|
474
486
|
this.toggleState('loading', this.loading);
|
|
487
|
+
this.toggleState('error', this.loadError !== '');
|
|
488
|
+
this.toggleState('no-results', this.noResults);
|
|
475
489
|
}
|
|
476
490
|
seedDeclared() {
|
|
477
491
|
if (this.owned || this.defaultValue !== '' || this.hasAttribute('default-value')) {
|
|
@@ -546,13 +560,37 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
546
560
|
: true;
|
|
547
561
|
}
|
|
548
562
|
renderStatus(hasContent) {
|
|
563
|
+
if (this.loadError !== '') {
|
|
564
|
+
return html `<p part="error"><slot name="error">${this.loadError}</slot></p>`;
|
|
565
|
+
}
|
|
549
566
|
if (!this.loading && hasContent) {
|
|
550
567
|
return nothing;
|
|
551
568
|
}
|
|
552
|
-
|
|
553
|
-
|
|
569
|
+
if (this.loading) {
|
|
570
|
+
return html `<p part="loading"><slot name="loading">${this.loadingText}</slot></p>`;
|
|
571
|
+
}
|
|
572
|
+
const given = this.noResultsText !== undefined ||
|
|
573
|
+
this.querySelector?.(':scope > [slot="no-results"]') != null;
|
|
574
|
+
return this.noResults && given
|
|
575
|
+
? html `<p part="empty"><slot name="no-results">${this.noResultsText ?? this.emptyText}</slot></p>`
|
|
554
576
|
: html `<p part="empty"><slot name="empty">${this.emptyText}</slot></p>`;
|
|
555
577
|
}
|
|
578
|
+
get noResults() {
|
|
579
|
+
return (this.counted &&
|
|
580
|
+
!this.loading &&
|
|
581
|
+
this.filter !== '' &&
|
|
582
|
+
this.options.length > 0 &&
|
|
583
|
+
!this.hasMatches);
|
|
584
|
+
}
|
|
585
|
+
renderLive(hasContent) {
|
|
586
|
+
if (this.loadError !== '') {
|
|
587
|
+
return html `<span part="live" role="status">${this.loadError}</span>`;
|
|
588
|
+
}
|
|
589
|
+
if (this.noResults && this.noResultsText !== undefined) {
|
|
590
|
+
return html `<span part="live" role="status">${this.noResultsText}</span>`;
|
|
591
|
+
}
|
|
592
|
+
return super.renderLive(hasContent);
|
|
593
|
+
}
|
|
556
594
|
render() {
|
|
557
595
|
const shown = this.showsOptions;
|
|
558
596
|
return html `${this.renderGroupLabel()}
|
|
@@ -589,6 +627,7 @@ let HelixHeadlessListbox = class HelixHeadlessListbox extends MixinCollection(Mi
|
|
|
589
627
|
aria-required=${this.required ? 'true' : nothing}
|
|
590
628
|
${''}
|
|
591
629
|
tabindex=${this.filterable ? nothing : this.isDisabled ? -1 : 0}
|
|
630
|
+
@scroll=${this.handleScroll}
|
|
592
631
|
>
|
|
593
632
|
<slot @slotchange=${() => this.place()}></slot>
|
|
594
633
|
${this.renderStatus(shown)}
|
|
@@ -617,12 +656,18 @@ __decorate([
|
|
|
617
656
|
__decorate([
|
|
618
657
|
property({ attribute: 'filter-label' })
|
|
619
658
|
], HelixHeadlessListbox.prototype, "filterLabel", void 0);
|
|
659
|
+
__decorate([
|
|
660
|
+
property({ attribute: 'load-error' })
|
|
661
|
+
], HelixHeadlessListbox.prototype, "loadError", void 0);
|
|
620
662
|
__decorate([
|
|
621
663
|
property({ type: Boolean })
|
|
622
664
|
], HelixHeadlessListbox.prototype, "manual", void 0);
|
|
623
665
|
__decorate([
|
|
624
666
|
property({ reflect: true, type: Boolean })
|
|
625
667
|
], HelixHeadlessListbox.prototype, "multiple", void 0);
|
|
668
|
+
__decorate([
|
|
669
|
+
property({ attribute: 'no-results-text' })
|
|
670
|
+
], HelixHeadlessListbox.prototype, "noResultsText", void 0);
|
|
626
671
|
__decorate([
|
|
627
672
|
property({ attribute: 'result-label' })
|
|
628
673
|
], HelixHeadlessListbox.prototype, "resultLabel", void 0);
|
package/dist/loader/busy.d.ts
CHANGED
|
@@ -15,3 +15,13 @@
|
|
|
15
15
|
export declare const claimBusy: (region: Element) => void;
|
|
16
16
|
/** Takes a claim back, and the attribute with the last one. */
|
|
17
17
|
export declare const releaseBusy: (region: Element) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Calls `found` with the region `find` answers once it is in `root`, and
|
|
20
|
+
* returns the call that stops waiting.
|
|
21
|
+
*
|
|
22
|
+
* For a loader whose region is not on the page yet: a framework often draws
|
|
23
|
+
* the loader before the list it stands for, and a region looked up once, a
|
|
24
|
+
* frame after connecting, was never marked. Watches for children and ids being
|
|
25
|
+
* written, and stops at the first answer.
|
|
26
|
+
*/
|
|
27
|
+
export declare const awaitRegion: (root: Node, find: () => Element | null, found: (region: Element) => void) => (() => void);
|
package/dist/loader/busy.js
CHANGED
|
@@ -22,3 +22,14 @@ export const releaseBusy = (region) => {
|
|
|
22
22
|
CLAIMS.set(region, held - 1);
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
|
+
export const awaitRegion = (root, find, found) => {
|
|
26
|
+
const observer = new MutationObserver(() => {
|
|
27
|
+
const region = find();
|
|
28
|
+
if (region) {
|
|
29
|
+
observer.disconnect();
|
|
30
|
+
found(region);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
observer.observe(root, { attributeFilter: ['id'], childList: true, subtree: true });
|
|
34
|
+
return () => observer.disconnect();
|
|
35
|
+
};
|
|
@@ -22,11 +22,12 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
22
22
|
* **`for` names the region being loaded**, and the loader sets
|
|
23
23
|
* `aria-busy="true"` on it for as long as the loader is on the page, so a
|
|
24
24
|
* screen reader waits for the region rather than reading it half filled. Two
|
|
25
|
-
* loaders in one region hold it busy until the last one leaves.
|
|
25
|
+
* loaders in one region hold it busy until the last one leaves. A region drawn
|
|
26
|
+
* after the loader is marked when it arrives.
|
|
26
27
|
*
|
|
27
28
|
* **`delay` keeps a quick load from flashing a loader.** The loader stays
|
|
28
29
|
* hidden, and silent, for that many milliseconds, and appears only if the work
|
|
29
|
-
* is still going.
|
|
30
|
+
* is still going. While it waits it carries `:state(waiting)`.
|
|
30
31
|
*
|
|
31
32
|
* @since 0.1.0
|
|
32
33
|
* @status stable
|
|
@@ -40,6 +41,8 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
40
41
|
* @csspart mark - The region that holds the slotted content at the center.
|
|
41
42
|
* @csspart svg - The rotating circle pair.
|
|
42
43
|
* @csspart track - The full circle behind the indicator.
|
|
44
|
+
*
|
|
45
|
+
* @cssstate waiting - The loader is waiting out its `delay`, hidden and silent.
|
|
43
46
|
*/
|
|
44
47
|
export declare class HelixHeadlessLoader extends HelixElement {
|
|
45
48
|
/**
|
|
@@ -67,6 +70,10 @@ export declare class HelixHeadlessLoader extends HelixElement {
|
|
|
67
70
|
private readonly due;
|
|
68
71
|
/** The region this loader marked busy, so it is the one released. */
|
|
69
72
|
private region;
|
|
73
|
+
/** Stops waiting for a region `for` names that is not on the page yet. */
|
|
74
|
+
private stopAwaiting;
|
|
75
|
+
/** Whether `for` has named an element while the loader was on the page. */
|
|
76
|
+
private found;
|
|
70
77
|
/** Whether the loader is still waiting out its `delay`. */
|
|
71
78
|
private get waiting();
|
|
72
79
|
connectedCallback(): void;
|
|
@@ -4,10 +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, DelayController, elementById, HelixElement, hostAria, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, DelayController, elementById, HelixElement, hostAria, reportRuntime, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
-
import { claimBusy, releaseBusy } from '../busy.js';
|
|
10
|
+
import { awaitRegion, claimBusy, releaseBusy } from '../busy.js';
|
|
11
11
|
let HelixHeadlessLoader = class HelixHeadlessLoader extends HelixElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments);
|
|
@@ -16,6 +16,7 @@ let HelixHeadlessLoader = class HelixHeadlessLoader extends HelixElement {
|
|
|
16
16
|
this.label = 'Loading';
|
|
17
17
|
this.due = new DelayController(this);
|
|
18
18
|
this.region = null;
|
|
19
|
+
this.found = false;
|
|
19
20
|
}
|
|
20
21
|
get waiting() {
|
|
21
22
|
return this.delay > 0 && !this.due.elapsed;
|
|
@@ -29,10 +30,26 @@ let HelixHeadlessLoader = class HelixHeadlessLoader extends HelixElement {
|
|
|
29
30
|
}
|
|
30
31
|
disconnectedCallback() {
|
|
31
32
|
super.disconnectedCallback();
|
|
33
|
+
if (this.stopAwaiting && !this.found) {
|
|
34
|
+
reportRuntime({
|
|
35
|
+
kind: 'missing-target',
|
|
36
|
+
message: `<${this.localName} for="${this.for}"> named no element in its tree while it was on ` +
|
|
37
|
+
'the page, so no region was marked busy. Give the region that id.',
|
|
38
|
+
tag: this.localName,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
this.stopAwaiting?.();
|
|
42
|
+
this.stopAwaiting = undefined;
|
|
32
43
|
this.release();
|
|
33
44
|
}
|
|
34
45
|
mark() {
|
|
35
|
-
|
|
46
|
+
this.stopAwaiting?.();
|
|
47
|
+
this.stopAwaiting = undefined;
|
|
48
|
+
const named = this.isConnected && this.for !== '';
|
|
49
|
+
const region = named ? elementById(this, this.for) : null;
|
|
50
|
+
if (named && !region) {
|
|
51
|
+
this.stopAwaiting = awaitRegion(this.getRootNode(), () => elementById(this, this.for), () => this.mark());
|
|
52
|
+
}
|
|
36
53
|
if (region === this.region) {
|
|
37
54
|
return;
|
|
38
55
|
}
|
|
@@ -40,6 +57,7 @@ let HelixHeadlessLoader = class HelixHeadlessLoader extends HelixElement {
|
|
|
40
57
|
if (region) {
|
|
41
58
|
claimBusy(region);
|
|
42
59
|
this.region = region;
|
|
60
|
+
this.found = true;
|
|
43
61
|
}
|
|
44
62
|
}
|
|
45
63
|
release() {
|
|
@@ -51,6 +69,7 @@ let HelixHeadlessLoader = class HelixHeadlessLoader extends HelixElement {
|
|
|
51
69
|
updated(changed) {
|
|
52
70
|
super.updated(changed);
|
|
53
71
|
if (changed.has('for') && changed.get('for') !== undefined) {
|
|
72
|
+
this.found = false;
|
|
54
73
|
this.mark();
|
|
55
74
|
}
|
|
56
75
|
}
|
|
@@ -59,6 +78,7 @@ let HelixHeadlessLoader = class HelixHeadlessLoader extends HelixElement {
|
|
|
59
78
|
hostAria(this.internals, { label: this.label, role: 'progressbar' });
|
|
60
79
|
this.internals.ariaBusy = 'true';
|
|
61
80
|
this.internals.ariaHidden = this.waiting ? 'true' : null;
|
|
81
|
+
this.toggleState('waiting', this.waiting);
|
|
62
82
|
}
|
|
63
83
|
render() {
|
|
64
84
|
return html `<svg part="svg" viewBox="0 0 24 24" aria-hidden="true" ?hidden=${this.waiting}>
|
|
@@ -45,7 +45,8 @@ declare const HelixHeadlessMap_base: (new (...args: any[]) => import("@fusion.de
|
|
|
45
45
|
* for each layer, which sets the layer's `hidden` attribute. Layers with the
|
|
46
46
|
* same `group`, such as a route and its dotted legs, share one tile. A tile
|
|
47
47
|
* sends `helix-before-toggle` from the layer first, so you can store the
|
|
48
|
-
* choice or refuse it
|
|
48
|
+
* choice or refuse it, and `helix-toggle` from it once `hidden` holds the
|
|
49
|
+
* choice.
|
|
49
50
|
*
|
|
50
51
|
* Imagery, a `helix-map-raster` with `ground`, is a map type and not a tile.
|
|
51
52
|
* The menu opens with a card for each type, Standard, Hybrid, and Satellite,
|
|
@@ -80,6 +81,7 @@ declare const HelixHeadlessMap_base: (new (...args: any[]) => import("@fusion.de
|
|
|
80
81
|
* @event {HelixMapRotateEvent} helix-map-rotate - A rotate or Face north button, or Shift with Left or Right, was pressed. Turn your map in response.
|
|
81
82
|
* @event {HelixMapTiltEvent} helix-map-tilt - The 3D button, or Shift with Up or Down, was pressed. Tilt your map in response.
|
|
82
83
|
* @event {HelixMapZoomEvent} helix-map-zoom - A zoom button or key was pressed, with a direction. Zoom your map in response.
|
|
84
|
+
* @event {HelixToggleEvent} helix-toggle - A layer's tile in the layers menu showed or hid it. Sent from the layer once its `hidden` attribute holds the choice, with `checked` true when it is shown.
|
|
83
85
|
*
|
|
84
86
|
* @csspart attribution - The strip under the map that holds the credit.
|
|
85
87
|
* @csspart compass - The compass and the pan and rotate buttons around it.
|
|
@@ -291,7 +293,9 @@ export declare class HelixHeadlessMap extends HelixHeadlessMap_base {
|
|
|
291
293
|
* **Asked first, from the layer.** The tile wrote `hidden` onto the
|
|
292
294
|
* consumer's element and said nothing, so a page could neither keep the
|
|
293
295
|
* choice nor keep its own state in step. The request comes from the first
|
|
294
|
-
* layer of the tile, which is the element the page wrote.
|
|
296
|
+
* layer of the tile, which is the element the page wrote. Once `hidden`
|
|
297
|
+
* holds the answer, the same layer sends `helix-toggle`, the request's verb
|
|
298
|
+
* without `before`, since the platform has no word for a layer shown.
|
|
295
299
|
*/
|
|
296
300
|
private showLayers;
|
|
297
301
|
/** Asks for a map type, and sends `change` once it holds. */
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, fillTemplate, formatNumbers, HelixActivateEvent, HelixBeforeChangeEvent, HelixBeforeToggleEvent, HelixElement, HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, hostAria, KeyboardNavigationController, MixinViewport, requestChange, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, fillTemplate, formatNumbers, HelixActivateEvent, HelixBeforeChangeEvent, HelixBeforeToggleEvent, HelixElement, HelixMapClusterEvent, HelixMapPanEvent, HelixMapPartChangeEvent, HelixMapReadyEvent, HelixMapRotateEvent, HelixMapTiltEvent, HelixMapZoomEvent, HelixToggleEvent, hostAria, KeyboardNavigationController, MixinViewport, requestChange, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { buildings, cloudRain, dotsNine, leaf, mountains, path, polygon, stack, target, } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -210,7 +210,7 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
210
210
|
if (!first) {
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
|
-
requestChange({
|
|
213
|
+
const applied = requestChange({
|
|
214
214
|
apply: () => {
|
|
215
215
|
for (const layer of layers) {
|
|
216
216
|
layer.hidden = !shown;
|
|
@@ -221,6 +221,9 @@ let HelixHeadlessMap = class HelixHeadlessMap extends MixinViewport(HelixElement
|
|
|
221
221
|
host: first,
|
|
222
222
|
next: shown,
|
|
223
223
|
});
|
|
224
|
+
if (applied) {
|
|
225
|
+
first.dispatchEvent(new HelixToggleEvent({ checked: shown }));
|
|
226
|
+
}
|
|
224
227
|
}
|
|
225
228
|
chooseMapType(type) {
|
|
226
229
|
const applied = requestChange({
|
|
@@ -20,6 +20,29 @@ declare const HelixHeadlessMegamenu_base: (new (...args: any[]) => import("@fusi
|
|
|
20
20
|
* which. Hover is the default because in a navigation bar people expect to move
|
|
21
21
|
* along the row and see each section.
|
|
22
22
|
*
|
|
23
|
+
* When one panel opens in place of another, each says which way the reader
|
|
24
|
+
* moved, as Radix's `data-motion` does. Moving toward the end of the bar, the
|
|
25
|
+
* one opening is `:state(from-end)` and the one closing is `:state(to-start)`;
|
|
26
|
+
* moving back, they are `:state(from-start)` and `:state(to-end)`. A
|
|
27
|
+
* stylesheet slides them on that. Start and end follow the reading direction,
|
|
28
|
+
* so on a right-to-left page the end is on the left. A panel that opens or
|
|
29
|
+
* closes on its own carries none of the four. A press on another megamenu's
|
|
30
|
+
* trigger hands over the same way as hovering it.
|
|
31
|
+
*
|
|
32
|
+
* While a panel is open its surface carries its own size, as
|
|
33
|
+
* `--megamenu-surface-inline-size` and `--megamenu-surface-block-size`, and a
|
|
34
|
+
* panel that took over from another also carries that one's size, as
|
|
35
|
+
* `--megamenu-from-inline-size` and `--megamenu-from-block-size`. Radix's
|
|
36
|
+
* navigation menu publishes the same pair from its shared viewport, so a
|
|
37
|
+
* stylesheet can grow or shrink one panel into the next.
|
|
38
|
+
*
|
|
39
|
+
* Put megamenus in a `Navigation` with `arrows` and the arrow keys move
|
|
40
|
+
* between their triggers. Down Arrow on the trigger of an open panel moves
|
|
41
|
+
* focus to the panel's first link, Escape closes the panel and returns focus
|
|
42
|
+
* to its trigger, and Tab moves through the panel's links and closes it on the
|
|
43
|
+
* way out. The trigger says `aria-expanded`, and the panel is a group named by
|
|
44
|
+
* `label`.
|
|
45
|
+
*
|
|
23
46
|
* @since 0.1.0
|
|
24
47
|
* @status stable
|
|
25
48
|
* @category navigation
|
|
@@ -36,10 +59,18 @@ declare const HelixHeadlessMegamenu_base: (new (...args: any[]) => import("@fusi
|
|
|
36
59
|
* @csspart surface - The floating panel that opens.
|
|
37
60
|
* @csspart trigger - The default trigger button, shown when the `trigger` slot is empty.
|
|
38
61
|
*
|
|
62
|
+
* @cssproperty --megamenu-from-block-size - The height of the panel this one took over from, written on the surface while it is open.
|
|
63
|
+
* @cssproperty --megamenu-from-inline-size - The width of the panel this one took over from, written on the surface while it is open.
|
|
64
|
+
* @cssproperty --megamenu-surface-block-size - The panel's own height, written on the surface while it is open.
|
|
65
|
+
* @cssproperty --megamenu-surface-inline-size - The panel's own width, written on the surface while it is open.
|
|
39
66
|
* @cssproperty --megamenu-top - Where the panel starts, measured from the bar above it.
|
|
40
67
|
*
|
|
68
|
+
* @cssstate from-end - The panel opened in place of one earlier in the bar, so it can enter from the end side.
|
|
69
|
+
* @cssstate from-start - The panel opened in place of one later in the bar, so it can enter from the start side.
|
|
41
70
|
* @cssstate narrow - The page is narrower than `band-below`, so the panel is shown as a band whatever its variant.
|
|
42
71
|
* @cssstate open - The panel is open, and the trigger is shown as current.
|
|
72
|
+
* @cssstate to-end - The panel closed because one earlier in the bar opened, so it can leave toward the end.
|
|
73
|
+
* @cssstate to-start - The panel closed because one later in the bar opened, so it can leave toward the start.
|
|
43
74
|
*/
|
|
44
75
|
export declare class HelixHeadlessMegamenu extends HelixHeadlessMegamenu_base {
|
|
45
76
|
/**
|
|
@@ -119,6 +150,16 @@ export declare class HelixHeadlessMegamenu extends HelixHeadlessMegamenu_base {
|
|
|
119
150
|
private get slotted();
|
|
120
151
|
/** Whatever the consumer slotted, or the button rendered in its place. */
|
|
121
152
|
private get trigger();
|
|
153
|
+
/**
|
|
154
|
+
* @internal The control a `Navigation`'s arrow keys move to: the trigger
|
|
155
|
+
* the consumer slotted, or the button drawn in its place.
|
|
156
|
+
*/
|
|
157
|
+
get navigationControl(): HTMLElement;
|
|
158
|
+
/**
|
|
159
|
+
* Down Arrow on the trigger of an open panel moves focus to the panel's first
|
|
160
|
+
* link or control, as Radix's navigation menu does.
|
|
161
|
+
*/
|
|
162
|
+
private readonly handleKeyDown;
|
|
122
163
|
/** Shuts it and puts the reader back where they were. */
|
|
123
164
|
private close;
|
|
124
165
|
/**
|
|
@@ -241,6 +282,27 @@ export declare class HelixHeadlessMegamenu extends HelixHeadlessMegamenu_base {
|
|
|
241
282
|
* overruled.
|
|
242
283
|
*/
|
|
243
284
|
protected willUpdate(changed: PropertyValues): void;
|
|
285
|
+
/**
|
|
286
|
+
* Clears the direction of every panel but the two in a hand-over, so only
|
|
287
|
+
* the latest move is ever described.
|
|
288
|
+
*/
|
|
289
|
+
private static settle;
|
|
290
|
+
/** Whether the panel is closing because another one opened in its place. */
|
|
291
|
+
private handedOver;
|
|
292
|
+
/** The panel's size the last time it was open, in pixels. */
|
|
293
|
+
private size;
|
|
294
|
+
/** The size of the panel this one took over from, if it took over. */
|
|
295
|
+
private from;
|
|
296
|
+
/**
|
|
297
|
+
* Writes the panel's size onto its surface, and the size of the panel it
|
|
298
|
+
* took over from, for a stylesheet that grows one into the next.
|
|
299
|
+
*/
|
|
300
|
+
private measure;
|
|
301
|
+
/**
|
|
302
|
+
* Says which way the reader moved when one panel took over from another.
|
|
303
|
+
* Nothing clears all four, for a panel opened or closed on its own.
|
|
304
|
+
*/
|
|
305
|
+
private motion;
|
|
244
306
|
protected updated(changed: PropertyValues): void;
|
|
245
307
|
/**
|
|
246
308
|
* The control that opens it, behind a seam the styled tier can move.
|