@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,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The arithmetic behind the scrollbars a scroll area draws under `scrollbars`.
|
|
3
|
+
*
|
|
4
|
+
* Every length here is along one axis and counted from that axis' start, which
|
|
5
|
+
* is the right-hand edge on a right-to-left page for the horizontal one. The
|
|
6
|
+
* component turns a pointer and a `scrollLeft` into those counts, so nothing
|
|
7
|
+
* below has to know which way the line runs.
|
|
8
|
+
*/
|
|
9
|
+
/** Which scrollbars are drawn, and when. Absent keeps the browser's own. */
|
|
10
|
+
export type Scrollbars = 'always' | 'auto' | 'hover' | 'scroll';
|
|
11
|
+
/** The two axes a scrollbar runs along. */
|
|
12
|
+
export type Axis = 'horizontal' | 'vertical';
|
|
13
|
+
/** The box a scrollbar reads, as the numbers it reads off it. */
|
|
14
|
+
export interface Box {
|
|
15
|
+
clientHeight: number;
|
|
16
|
+
clientWidth: number;
|
|
17
|
+
scrollHeight: number;
|
|
18
|
+
scrollLeft: number;
|
|
19
|
+
scrollTop: number;
|
|
20
|
+
scrollWidth: number;
|
|
21
|
+
}
|
|
22
|
+
/** One axis of the viewport, read off the box. */
|
|
23
|
+
export interface Extent {
|
|
24
|
+
/** How much of the content the viewport shows, `clientHeight` or `clientWidth`. */
|
|
25
|
+
client: number;
|
|
26
|
+
/** How far from its start the axis is scrolled, never negative. */
|
|
27
|
+
offset: number;
|
|
28
|
+
/** The whole length of the content, `scrollHeight` or `scrollWidth`. */
|
|
29
|
+
scroll: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The share of the track the thumb covers, from 0 to 1: how much of the content
|
|
33
|
+
* is in view. A box with no content, or one that shows all of it, is 1.
|
|
34
|
+
*/
|
|
35
|
+
export declare const thumbFraction: ({ client, scroll }: Extent) => number;
|
|
36
|
+
/**
|
|
37
|
+
* How far along the axis is scrolled, from 0 at the start to 1 at the end. An
|
|
38
|
+
* axis with nothing to scroll is 0.
|
|
39
|
+
*/
|
|
40
|
+
export declare const scrollFraction: ({ client, offset, scroll }: Extent) => number;
|
|
41
|
+
/**
|
|
42
|
+
* How far the content moves for each pixel the thumb is dragged.
|
|
43
|
+
*
|
|
44
|
+
* The thumb travels the track less its own length, and the content travels
|
|
45
|
+
* its length less the view, so the ratio of the two is the gearing. Zero where
|
|
46
|
+
* the thumb fills the track and cannot move.
|
|
47
|
+
*/
|
|
48
|
+
export declare const scrollPerPixel: (extent: Extent, track: number, thumb: number) => number;
|
|
49
|
+
/**
|
|
50
|
+
* The offset that puts the middle of the thumb under a press on the track.
|
|
51
|
+
*
|
|
52
|
+
* `along` is where the press landed, counted from the track's start. The thumb
|
|
53
|
+
* stops at either end of the track, so a press near an end scrolls to that end.
|
|
54
|
+
*/
|
|
55
|
+
export declare const offsetAt: (extent: Extent, along: number, track: number, thumb: number) => number;
|
|
56
|
+
/**
|
|
57
|
+
* Whether an axis has a scrollbar at all: it can scroll, and under every value
|
|
58
|
+
* but `always` it has something to scroll.
|
|
59
|
+
*
|
|
60
|
+
* An axis whose `overflow` is `hidden` or `clip` cannot be scrolled by a reader,
|
|
61
|
+
* so it gets no scrollbar whatever `scrollbars` says. That is how a consumer
|
|
62
|
+
* keeps a horizontal bar off a list that only scrolls down.
|
|
63
|
+
*/
|
|
64
|
+
export declare const hasScrollbar: (mode: Scrollbars, scrollable: boolean, overflows: boolean) => boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether a scrollbar that exists is showing at this moment.
|
|
67
|
+
*
|
|
68
|
+
* `auto` and `always` show it the whole time. `scroll` shows it while the
|
|
69
|
+
* content is moving and for the hide delay after, and while the pointer holds
|
|
70
|
+
* it. `hover` adds the time the pointer is over the scroll area.
|
|
71
|
+
*/
|
|
72
|
+
export declare const showsScrollbar: (mode: Scrollbars, moment: {
|
|
73
|
+
active: boolean;
|
|
74
|
+
held: boolean;
|
|
75
|
+
hovered: boolean;
|
|
76
|
+
}) => boolean;
|
|
77
|
+
/**
|
|
78
|
+
* One axis of a box, counted from its start whichever way the line runs: a
|
|
79
|
+
* right-to-left box counts `scrollLeft` down from zero, so its offset is the
|
|
80
|
+
* distance from zero.
|
|
81
|
+
*/
|
|
82
|
+
export declare const extentOf: (box: Box, axis: Axis) => Extent;
|
|
83
|
+
/**
|
|
84
|
+
* Where a pointer is along a track, counted from the track's start: its top,
|
|
85
|
+
* or its left edge, or its right edge on a right-to-left page.
|
|
86
|
+
*/
|
|
87
|
+
export declare const alongTrack: (pointer: number, track: {
|
|
88
|
+
bottom: number;
|
|
89
|
+
left: number;
|
|
90
|
+
right: number;
|
|
91
|
+
top: number;
|
|
92
|
+
}, axis: Axis, rtl: boolean) => number;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const clamp = (value, low, high) => Math.min(Math.max(value, low), high);
|
|
2
|
+
export const thumbFraction = ({ client, scroll }) => scroll <= 0 ? 1 : clamp(client / scroll, 0, 1);
|
|
3
|
+
export const scrollFraction = ({ client, offset, scroll }) => {
|
|
4
|
+
const room = scroll - client;
|
|
5
|
+
return room <= 0 ? 0 : clamp(offset / room, 0, 1);
|
|
6
|
+
};
|
|
7
|
+
export const scrollPerPixel = (extent, track, thumb) => {
|
|
8
|
+
const run = track - thumb;
|
|
9
|
+
return run <= 0 ? 0 : Math.max(0, extent.scroll - extent.client) / run;
|
|
10
|
+
};
|
|
11
|
+
export const offsetAt = (extent, along, track, thumb) => {
|
|
12
|
+
const run = track - thumb;
|
|
13
|
+
if (run <= 0) {
|
|
14
|
+
return 0;
|
|
15
|
+
}
|
|
16
|
+
return clamp((along - thumb / 2) / run, 0, 1) * Math.max(0, extent.scroll - extent.client);
|
|
17
|
+
};
|
|
18
|
+
export const hasScrollbar = (mode, scrollable, overflows) => scrollable && (mode === 'always' || overflows);
|
|
19
|
+
export const showsScrollbar = (mode, moment) => {
|
|
20
|
+
if (mode === 'auto' || mode === 'always') {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
return moment.active || moment.held || (mode === 'hover' && moment.hovered);
|
|
24
|
+
};
|
|
25
|
+
export const extentOf = (box, axis) => axis === 'vertical'
|
|
26
|
+
? { client: box.clientHeight, offset: box.scrollTop, scroll: box.scrollHeight }
|
|
27
|
+
: { client: box.clientWidth, offset: Math.abs(box.scrollLeft), scroll: box.scrollWidth };
|
|
28
|
+
export const alongTrack = (pointer, track, axis, rtl) => {
|
|
29
|
+
if (axis === 'vertical') {
|
|
30
|
+
return pointer - track.top;
|
|
31
|
+
}
|
|
32
|
+
return rtl ? track.right - pointer : pointer - track.left;
|
|
33
|
+
};
|
|
@@ -48,6 +48,7 @@ declare const HelixHeadlessSelect_base: (new (...args: any[]) => import("@fusion
|
|
|
48
48
|
* @event {HelixBeforeCloseEvent} helix-before-close - Fired before the list closes. Cancelable: canceling it keeps the list open and leaves the decision to you.
|
|
49
49
|
* @event {HelixBeforeOpenEvent} helix-before-open - Fired before the list opens. Cancelable: canceling it keeps the list closed and leaves the decision to you.
|
|
50
50
|
* @event {HelixFilterEvent} helix-filter - Fired as the user types in the filter field of a `filterable` select, with the text the list is filtered by. Cancelable: cancel it to leave the list unfiltered and filter the options yourself.
|
|
51
|
+
* @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 and set `loading` while you fetch it.
|
|
51
52
|
* @event {Event} input - Fired after the value changes.
|
|
52
53
|
* @event {ToggleEvent} toggle - Fired after the list opens or closes, with `newState` and `oldState`.
|
|
53
54
|
*
|
|
@@ -57,6 +58,7 @@ declare const HelixHeadlessSelect_base: (new (...args: any[]) => import("@fusion
|
|
|
57
58
|
* @csspart label - The label above the trigger.
|
|
58
59
|
* @csspart listbox - The list inside the panel.
|
|
59
60
|
* @csspart listbox-empty - The text shown when the filter hides every option.
|
|
61
|
+
* @csspart listbox-error - The inner list's `error` part, shown while its `load-error` is set.
|
|
60
62
|
* @csspart listbox-feedback - The inner list's message that says what is wrong with the value.
|
|
61
63
|
* @csspart listbox-filter-icon - The icon beside the filter field.
|
|
62
64
|
* @csspart listbox-filter-mark - The default icon beside the filter field, shown when none is slotted.
|
|
@@ -276,6 +278,19 @@ export declare class HelixHeadlessSelect extends HelixHeadlessSelect_base {
|
|
|
276
278
|
* cannot change.
|
|
277
279
|
*/
|
|
278
280
|
protected renderIndicator(): TemplateResult;
|
|
281
|
+
/**
|
|
282
|
+
* What names the list once it opens: the `label`, the host's `aria-label`,
|
|
283
|
+
* or the words of what names the host from outside, its `aria-labelledby`
|
|
284
|
+
* or a `<label>` for it.
|
|
285
|
+
*
|
|
286
|
+
* **Words rather than a reference**, because the list is inside another
|
|
287
|
+
* element's shadow root and neither an IDREF nor the host's labels reach it.
|
|
288
|
+
* Read as the list renders, which opening it makes happen, so a label
|
|
289
|
+
* changed while the list is closed is read when it next opens. Without the
|
|
290
|
+
* last two routes a Select named by a `<label for>` opened onto a listbox
|
|
291
|
+
* with no name, which the missing-name warning reported.
|
|
292
|
+
*/
|
|
293
|
+
private get listName();
|
|
279
294
|
/**
|
|
280
295
|
* What names the trigger: the label, then the choice.
|
|
281
296
|
*
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, afterLinkFollowed, customElement, HelixFormElement, hostAria, MixinControllerOpen, MixinControllerValue, MixinField, PopoverController, reportValues, typesCharacter, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, afterLinkFollowed, customElement, elementById, HelixFormElement, hostAria, MixinControllerOpen, MixinControllerValue, MixinField, PopoverController, reportValues, typesCharacter, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretDown } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { nothing } from 'lit';
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
@@ -214,15 +214,15 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
214
214
|
loading-text=${this.loadingText}
|
|
215
215
|
?loading=${this.loading}
|
|
216
216
|
part="listbox"
|
|
217
|
-
exportparts="empty: listbox-empty,
|
|
218
|
-
filter-
|
|
219
|
-
label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
220
|
-
search-field: listbox-search-field"
|
|
217
|
+
exportparts="empty: listbox-empty, error: listbox-error, feedback: listbox-feedback,
|
|
218
|
+
filter-icon: listbox-filter-icon, filter-mark: listbox-filter-mark, hint: listbox-hint,
|
|
219
|
+
items: listbox-items, label: listbox-label, live: listbox-live, loading: listbox-loading,
|
|
220
|
+
search: listbox-search, search-field: listbox-search-field"
|
|
221
221
|
.value=${this.value}
|
|
222
222
|
?multiple=${this.multiple}
|
|
223
223
|
?filterable=${this.filterable}
|
|
224
224
|
manual
|
|
225
|
-
aria-label=${this.
|
|
225
|
+
aria-label=${this.listName || nothing}
|
|
226
226
|
@keydown=${this.handleListKeydown}
|
|
227
227
|
@helix-before-change=${this.handleChange}
|
|
228
228
|
@change=${this.stopInner}
|
|
@@ -240,6 +240,18 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
240
240
|
</svg>
|
|
241
241
|
</slot>`;
|
|
242
242
|
}
|
|
243
|
+
get listName() {
|
|
244
|
+
const own = this.label || this.getAttribute('aria-label');
|
|
245
|
+
if (own) {
|
|
246
|
+
return own;
|
|
247
|
+
}
|
|
248
|
+
const ids = (this.getAttribute('aria-labelledby') ?? '').split(/\s+/).filter(Boolean);
|
|
249
|
+
const named = ids.length > 0 ? ids.map((id) => elementById(this, id)) : [...(this.labels ?? [])];
|
|
250
|
+
return named
|
|
251
|
+
.map((one) => (one?.textContent ?? '').replace(/\s+/g, ' ').trim())
|
|
252
|
+
.filter(Boolean)
|
|
253
|
+
.join(' ');
|
|
254
|
+
}
|
|
243
255
|
get triggerNames() {
|
|
244
256
|
const outside = (this.internals.labels?.length ?? 0) > 0 && !this.labeled;
|
|
245
257
|
if (this.hasAttribute('aria-labelledby') || outside) {
|
|
@@ -31,7 +31,10 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
31
31
|
* @slot - The content the skeleton stands in for, which sizes it. Optional.
|
|
32
32
|
*
|
|
33
33
|
* @csspart content - The box around the content, inert while `loading`.
|
|
34
|
+
* @csspart sheen - The highlight inside the shape, which the styled tier sweeps across it. Empty, and drawn by no rule on this tier.
|
|
34
35
|
* @csspart skeleton - The placeholder shape.
|
|
36
|
+
*
|
|
37
|
+
* @cssstate wrapping - The skeleton holds content, an element or words, and takes that content's size. Line breaks and spaces alone are not content.
|
|
35
38
|
*/
|
|
36
39
|
export declare class HelixHeadlessSkeleton extends HelixElement {
|
|
37
40
|
/**
|
|
@@ -19,6 +19,8 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
19
19
|
}
|
|
20
20
|
willUpdate(changed) {
|
|
21
21
|
super.willUpdate(changed);
|
|
22
|
+
const wraps = this.wraps;
|
|
23
|
+
this.toggleState('wrapping', wraps);
|
|
22
24
|
this.internals.ariaBusy = this.loading ? 'true' : null;
|
|
23
25
|
if (this.label) {
|
|
24
26
|
hostAria(this.internals, { label: this.label, role: 'progressbar' });
|
|
@@ -26,7 +28,7 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
26
28
|
}
|
|
27
29
|
else {
|
|
28
30
|
hostAria(this.internals, { label: '', role: '' });
|
|
29
|
-
this.internals.ariaHidden =
|
|
31
|
+
this.internals.ariaHidden = wraps ? null : 'true';
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
firstUpdated(changed) {
|
|
@@ -36,7 +38,7 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
36
38
|
render() {
|
|
37
39
|
return html `<span part="content" ?inert=${this.loading}
|
|
38
40
|
><slot @slotchange=${() => this.requestUpdate()}></slot></span
|
|
39
|
-
><span part="skeleton"></span>`;
|
|
41
|
+
><span part="skeleton"><span part="sheen"></span></span>`;
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
__decorate([
|
|
@@ -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, elementById, HelixElement, reportRuntime } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, elementById, HelixElement, plainClick, reportRuntime, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
@@ -13,7 +13,7 @@ let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
|
13
13
|
this.href = '#main';
|
|
14
14
|
this.label = 'Skip to content';
|
|
15
15
|
this.skip = (event) => {
|
|
16
|
-
if (event
|
|
16
|
+
if (!plainClick(event)) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
19
|
const target = this.target;
|
|
@@ -20,7 +20,13 @@ declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion
|
|
|
20
20
|
*
|
|
21
21
|
* A range with two thumbs is two inputs stacked on one track, because there is
|
|
22
22
|
* no native two-thumb range. Each thumb keeps its own value.
|
|
23
|
-
* `min-steps-between-thumbs` keeps them that many steps apart
|
|
23
|
+
* `min-steps-between-thumbs` keeps them that many steps apart, and the readout
|
|
24
|
+
* joins the two as `range-text` writes them.
|
|
25
|
+
*
|
|
26
|
+
* `origin` sets where a single thumb's fill starts: at `min`, at the middle of
|
|
27
|
+
* the track, or at `max`. A balance or an offset from zero fills from the
|
|
28
|
+
* middle, as Zag's slider `origin` does. The fill's ends are published as
|
|
29
|
+
* `--slider-from` and `--slider-to`.
|
|
24
30
|
*
|
|
25
31
|
* `format-options` writes the value with `Intl.NumberFormat` in `locale`, as a
|
|
26
32
|
* currency, a percent or a unit, and `formatter` writes it with a function of
|
|
@@ -34,6 +40,20 @@ declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion
|
|
|
34
40
|
* the first render. HTML does not apply `required` to a range either, so it is
|
|
35
41
|
* not set on the input. It only adds the marker beside the label.
|
|
36
42
|
*
|
|
43
|
+
* **Keyboard.** Each thumb is one tab stop, and its keys are the native
|
|
44
|
+
* range's.
|
|
45
|
+
*
|
|
46
|
+
* | Key | What it does |
|
|
47
|
+
* |---|---|
|
|
48
|
+
* | Right, Up | Moves the thumb up by `step`. |
|
|
49
|
+
* | Left, Down | Moves the thumb down by `step`. |
|
|
50
|
+
* | Page Up, Page Down | Moves the thumb by a larger step. |
|
|
51
|
+
* | Home, End | Moves the thumb to its lowest or highest value. |
|
|
52
|
+
*
|
|
53
|
+
* Each thumb is an `<input type="range">` with `aria-valuetext` where the value
|
|
54
|
+
* is formatted or worded. A range's thumbs say they stop at each other with
|
|
55
|
+
* `aria-valuemin` and `aria-valuemax`.
|
|
56
|
+
*
|
|
37
57
|
* @since 0.1.0
|
|
38
58
|
* @status stable
|
|
39
59
|
* @category forms
|
|
@@ -59,9 +79,9 @@ declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion
|
|
|
59
79
|
* @csspart output - The current value, shown beside the track.
|
|
60
80
|
*
|
|
61
81
|
* @cssproperty --slider-fraction - The value as a fraction of the range, 0 to 1.
|
|
62
|
-
* @cssproperty --slider-from - Where
|
|
82
|
+
* @cssproperty --slider-from - Where the filled span starts, as a fraction of the track, 0 to 1: a range's lower thumb, or a single thumb's `origin`.
|
|
63
83
|
* @cssproperty --slider-marker-at - Where one marker sits, as a percentage of the track.
|
|
64
|
-
* @cssproperty --slider-to - Where
|
|
84
|
+
* @cssproperty --slider-to - Where the filled span ends, as a fraction of the track, 0 to 1: a range's upper thumb, or the farther of a single thumb and its `origin`.
|
|
65
85
|
*
|
|
66
86
|
* @cssstate invalid - The slider has an error to show, from the browser's validation or from your `feedback`.
|
|
67
87
|
*/
|
|
@@ -148,6 +168,12 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
148
168
|
* rather than a thumb sitting on nothing.
|
|
149
169
|
*/
|
|
150
170
|
orientation?: 'horizontal' | 'vertical';
|
|
171
|
+
/**
|
|
172
|
+
* Where a single thumb's fill starts: `start` at `min`, `center` at the
|
|
173
|
+
* middle of the track, or `end` at `max`. Absent is `start`. A range fills
|
|
174
|
+
* between its thumbs and ignores it.
|
|
175
|
+
*/
|
|
176
|
+
origin?: 'center' | 'end' | 'start';
|
|
151
177
|
/**
|
|
152
178
|
* Adds a second thumb, so the value is a pair.
|
|
153
179
|
*
|
|
@@ -156,6 +182,11 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
156
182
|
* the two, since a range has no single number.
|
|
157
183
|
*/
|
|
158
184
|
range: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* How the readout joins a range's two values, with `{start}` and `{end}`
|
|
187
|
+
* filled in. Write it in the page's language, such as `{start} bis {end}`.
|
|
188
|
+
*/
|
|
189
|
+
rangeText: string;
|
|
159
190
|
/**
|
|
160
191
|
* Shows the chosen value beside the track.
|
|
161
192
|
*/
|
|
@@ -174,7 +205,8 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
174
205
|
*
|
|
175
206
|
* Widest rather than current, so the box never changes size at all. Measured
|
|
176
207
|
* off the bounds because that is what the readout can ever say: the longer of
|
|
177
|
-
* the two ends, twice, plus the
|
|
208
|
+
* the two ends, twice, plus the words `range-text` puts between them when
|
|
209
|
+
* both are shown. Negative
|
|
178
210
|
* bounds are covered by measuring the rendered string rather than the digits,
|
|
179
211
|
* since the sign is a character like any other.
|
|
180
212
|
*
|
|
@@ -238,6 +270,11 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
238
270
|
* there is no order for this to be on the wrong side of.
|
|
239
271
|
*/
|
|
240
272
|
private get fraction();
|
|
273
|
+
/**
|
|
274
|
+
* A single thumb's fill: `--slider-fraction`, and under `origin` the span
|
|
275
|
+
* from the origin to the thumb as `--slider-from` and `--slider-to`.
|
|
276
|
+
*/
|
|
277
|
+
private get fillStyle();
|
|
241
278
|
/**
|
|
242
279
|
* A value snapped to the step, counted from `min` the way a range counts it.
|
|
243
280
|
*
|
|
@@ -23,6 +23,7 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
23
23
|
this.minimumLabel = 'minimum';
|
|
24
24
|
this.minStepsBetweenThumbs = 0;
|
|
25
25
|
this.range = false;
|
|
26
|
+
this.rangeText = '{start} to {end}';
|
|
26
27
|
this.showValue = false;
|
|
27
28
|
this.step = 1;
|
|
28
29
|
this.handleInput = (event) => {
|
|
@@ -51,7 +52,9 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
51
52
|
}
|
|
52
53
|
get reserve() {
|
|
53
54
|
const widest = Math.max(this.said(this.min).length, this.said(this.max).length);
|
|
54
|
-
return this.range
|
|
55
|
+
return this.range
|
|
56
|
+
? widest * 2 + fillTemplate(this.rangeText, { end: '', start: '' }).length
|
|
57
|
+
: widest;
|
|
55
58
|
}
|
|
56
59
|
get precision() {
|
|
57
60
|
return String(this.step).split('.')[1]?.length ?? 0;
|
|
@@ -104,6 +107,14 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
104
107
|
}
|
|
105
108
|
return this.along(this.snapped(this.valueAsNumber));
|
|
106
109
|
}
|
|
110
|
+
get fillStyle() {
|
|
111
|
+
const fraction = this.fraction;
|
|
112
|
+
if (!this.origin) {
|
|
113
|
+
return `--slider-fraction: ${fraction}`;
|
|
114
|
+
}
|
|
115
|
+
const at = { center: 0.5, end: 1, start: 0 }[this.origin] ?? 0;
|
|
116
|
+
return `--slider-fraction: ${fraction}; --slider-from: ${Math.min(at, fraction)}; --slider-to: ${Math.max(at, fraction)}`;
|
|
117
|
+
}
|
|
107
118
|
snapped(at) {
|
|
108
119
|
if (!(this.step > 0)) {
|
|
109
120
|
return at;
|
|
@@ -211,7 +222,8 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
211
222
|
part="control"
|
|
212
223
|
id=${this.controlId}
|
|
213
224
|
type="range"
|
|
214
|
-
style
|
|
225
|
+
style=${this.fillStyle}
|
|
226
|
+
data-origin=${this.origin ?? nothing}
|
|
215
227
|
min=${this.min}
|
|
216
228
|
max=${this.max}
|
|
217
229
|
step=${this.step}
|
|
@@ -241,7 +253,9 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
241
253
|
for=${this.range ? 'control control-end' : 'control'}
|
|
242
254
|
aria-hidden="true"
|
|
243
255
|
style=${`--_slider-output-reserve: ${this.reserve}ch`}
|
|
244
|
-
>${this.range
|
|
256
|
+
>${this.range
|
|
257
|
+
? fillTemplate(this.rangeText, { end: this.said(end), start: this.said(start) })
|
|
258
|
+
: this.said(this.value)}</output
|
|
245
259
|
>`
|
|
246
260
|
: nothing}
|
|
247
261
|
</div>
|
|
@@ -281,9 +295,15 @@ __decorate([
|
|
|
281
295
|
__decorate([
|
|
282
296
|
property({ reflect: true })
|
|
283
297
|
], HelixHeadlessSlider.prototype, "orientation", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property({ reflect: true })
|
|
300
|
+
], HelixHeadlessSlider.prototype, "origin", void 0);
|
|
284
301
|
__decorate([
|
|
285
302
|
property({ reflect: true, type: Boolean })
|
|
286
303
|
], HelixHeadlessSlider.prototype, "range", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property({ attribute: 'range-text' })
|
|
306
|
+
], HelixHeadlessSlider.prototype, "rangeText", void 0);
|
|
287
307
|
__decorate([
|
|
288
308
|
property({ attribute: 'show-value', reflect: true, type: Boolean })
|
|
289
309
|
], HelixHeadlessSlider.prototype, "showValue", void 0);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Where the highest and the lowest readings are, by place, or none. */
|
|
2
|
+
export interface Extremes {
|
|
3
|
+
/** The place of the highest reading, the first where several tie. */
|
|
4
|
+
high?: number;
|
|
5
|
+
/** The place of the lowest reading, the first where several tie. */
|
|
6
|
+
low?: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Where the highest and the lowest readings stand. A blank slot is passed
|
|
10
|
+
* over, and a list with nothing in it has neither.
|
|
11
|
+
*/
|
|
12
|
+
export declare const extremesOf: (slots: readonly (number | undefined)[]) => Extremes;
|
|
13
|
+
/**
|
|
14
|
+
* A reading in words, for the readout: the row's name where a table gave one,
|
|
15
|
+
* the reading as it is written, and where it stands in brackets, such as
|
|
16
|
+
* "Mon: 12 (3 of 7)". The same order every chart's readout uses.
|
|
17
|
+
*/
|
|
18
|
+
export declare const readingWords: (label: string, text: string, position: string) => string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const extremesOf = (slots) => {
|
|
2
|
+
const found = {};
|
|
3
|
+
slots.forEach((value, at) => {
|
|
4
|
+
if (value === undefined) {
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
if (found.high === undefined || value > slots[found.high]) {
|
|
8
|
+
found.high = at;
|
|
9
|
+
}
|
|
10
|
+
if (found.low === undefined || value < slots[found.low]) {
|
|
11
|
+
found.low = at;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return found;
|
|
15
|
+
};
|
|
16
|
+
export const readingWords = (label, text, position) => {
|
|
17
|
+
const named = label === '' ? text : text === '' ? label : `${label}: ${text}`;
|
|
18
|
+
return position === '' ? named : `${named} (${position})`;
|
|
19
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Curve, HelixElement, SourceController } from '@fusion.dev/helix-core';
|
|
2
|
-
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
1
|
+
import { ChartPointerController, type Curve, HelixElement, SourceController } from '@fusion.dev/helix-core';
|
|
2
|
+
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary A small chart with no axes that shows the shape of a series beside its number.
|
|
5
5
|
*
|
|
@@ -13,8 +13,16 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
13
13
|
* are set.
|
|
14
14
|
*
|
|
15
15
|
* Without a `label` the sparkline is decorative and `aria-hidden`, for example
|
|
16
|
-
* beside a stat that already says "Sessions, 1,102". With a `label` it is
|
|
17
|
-
*
|
|
16
|
+
* beside a stat that already says "Sessions, 1,102". With a `label` it is
|
|
17
|
+
* named by that sentence and read by key, as every chart is: the drawing takes
|
|
18
|
+
* focus, the arrow keys walk the readings, Home and End go to the first and
|
|
19
|
+
* the last, Escape puts the reading away, and the `live` part says each
|
|
20
|
+
* reading with where it stands, such as "Mon: 12 (3 of 7)".
|
|
21
|
+
*
|
|
22
|
+
* A pointer resting on the drawing shows the reading under it: the `cursor`
|
|
23
|
+
* part marks it and the `readout` part writes it. `marks` adds a mark on the
|
|
24
|
+
* highest and the lowest reading. A blank cell in a `for` table is a gap in
|
|
25
|
+
* the line.
|
|
18
26
|
*
|
|
19
27
|
* Place it beside a `Stat`, because a change beside a figure is a second fact,
|
|
20
28
|
* as `Stat`'s own spec says. `Trend` is composed the same way.
|
|
@@ -32,8 +40,13 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
32
40
|
*
|
|
33
41
|
* @csspart area - The region between the line and the bottom of its range.
|
|
34
42
|
* @csspart bar - One column, drawn when `plot="bar"`.
|
|
43
|
+
* @csspart cursor - The mark on the reading a pointer or a key rests on, rendered only while there is one. Placed with `inset-inline-start` and `inset-block-start`.
|
|
44
|
+
* @csspart high - The mark on the highest reading, under `marks="high"`. Placed as `cursor` is.
|
|
35
45
|
* @csspart line - The line's path.
|
|
36
|
-
* @csspart
|
|
46
|
+
* @csspart live - A polite region that says the reading a key moved to, rendered only with a `label`. Hide it visually.
|
|
47
|
+
* @csspart low - The mark on the lowest reading, under `marks="low"`. Placed as `cursor` is.
|
|
48
|
+
* @csspart readout - The reading a pointer or a key rests on, as the table or `values` writes it, rendered only while there is one. Placed as `cursor` is.
|
|
49
|
+
* @csspart svg - The drawing, which takes focus to be read by key where there is a `label`.
|
|
37
50
|
* @csspart terminus - The mark on the last value.
|
|
38
51
|
* @csspart wash-end - The far stop of the area's gradient.
|
|
39
52
|
* @csspart wash-start - The stop of the area's gradient that meets the line.
|
|
@@ -91,6 +104,22 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
91
104
|
* than announced without a name.
|
|
92
105
|
*/
|
|
93
106
|
label: string;
|
|
107
|
+
/**
|
|
108
|
+
* The locale the readout's numbers and positions are written in, such as
|
|
109
|
+
* `de` for `1.240`.
|
|
110
|
+
*
|
|
111
|
+
* Absent uses the runtime's own. A table's cells are shown as the table
|
|
112
|
+
* writes them, whatever this says.
|
|
113
|
+
*/
|
|
114
|
+
locale: string;
|
|
115
|
+
/**
|
|
116
|
+
* Which readings take a mark of their own: `high`, `low`, or both,
|
|
117
|
+
* separated by spaces.
|
|
118
|
+
*
|
|
119
|
+
* Absent marks none, and the drawing is what it was. Each mark is a part,
|
|
120
|
+
* placed at its reading, for a stylesheet to draw.
|
|
121
|
+
*/
|
|
122
|
+
marks: string;
|
|
94
123
|
/**
|
|
95
124
|
* What the readings are drawn as.
|
|
96
125
|
*
|
|
@@ -121,6 +150,15 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
121
150
|
* is markup, the same reason `curve` lives here.
|
|
122
151
|
*/
|
|
123
152
|
plot?: 'area' | 'bar' | 'line';
|
|
153
|
+
/**
|
|
154
|
+
* Where a reading the keys moved to stands among the readings, said after
|
|
155
|
+
* it. `{position}` and `{count}` are replaced with the numbers, written in
|
|
156
|
+
* `locale`.
|
|
157
|
+
*
|
|
158
|
+
* Set it to the words of the page's language, such as `{position} von
|
|
159
|
+
* {count}`, or to nothing to say no position.
|
|
160
|
+
*/
|
|
161
|
+
positionLabel: string;
|
|
124
162
|
/**
|
|
125
163
|
* The numbers, separated by whitespace or by commas.
|
|
126
164
|
*
|
|
@@ -131,10 +169,43 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
131
169
|
*/
|
|
132
170
|
values: string | readonly number[];
|
|
133
171
|
protected readonly source: SourceController;
|
|
172
|
+
/**
|
|
173
|
+
* Finds the reading a pointer or a key rests on, as it does for every
|
|
174
|
+
* chart, so a sparkline is read the way they are.
|
|
175
|
+
*/
|
|
176
|
+
readonly pointer: ChartPointerController;
|
|
134
177
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
135
|
-
/**
|
|
136
|
-
|
|
178
|
+
/**
|
|
179
|
+
* The series to draw, and how many readings it has room for: the table's
|
|
180
|
+
* first series over the table's rows if there is one, the attribute
|
|
181
|
+
* otherwise.
|
|
182
|
+
*
|
|
183
|
+
* Over the rows, so a blank cell is a reading with nothing in it and the
|
|
184
|
+
* line breaks there, as `LineChart` draws one. Joined across, the line
|
|
185
|
+
* claimed a value the table does not have.
|
|
186
|
+
*/
|
|
187
|
+
private drawn;
|
|
188
|
+
/** How many readings there are, which the pointer and the keys walk. */
|
|
189
|
+
get readings(): number;
|
|
190
|
+
/**
|
|
191
|
+
* The reading at a place, in words: the table's cell as it is written, or
|
|
192
|
+
* the number in `locale`, after the row's name where a table gave one.
|
|
193
|
+
*/
|
|
194
|
+
private reading;
|
|
137
195
|
protected render(): TemplateResult;
|
|
196
|
+
/** The marks `marks` asks for, on the highest and the lowest reading. */
|
|
197
|
+
protected renderMarks(slots: (number | undefined)[], at: (index: number, value: number) => string): TemplateResult | typeof nothing;
|
|
198
|
+
/**
|
|
199
|
+
* The reading a pointer or a key rests on: a mark on it and its words
|
|
200
|
+
* beside it. Hidden from a screen reader, which hears the `live` part.
|
|
201
|
+
*/
|
|
202
|
+
protected renderReading(slots: (number | undefined)[], at: (index: number, value: number) => string): TemplateResult | typeof nothing;
|
|
203
|
+
/**
|
|
204
|
+
* The polite region that says a reading the keys moved to, in words and
|
|
205
|
+
* with where it stands. Rendered from the first drawing and empty until a
|
|
206
|
+
* key moves the reading, so it is heard when its words change.
|
|
207
|
+
*/
|
|
208
|
+
protected renderLive(slots: (number | undefined)[]): TemplateResult;
|
|
138
209
|
}
|
|
139
210
|
declare global {
|
|
140
211
|
interface HTMLElementTagNameMap {
|