@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
|
@@ -21,6 +21,16 @@ declare const HelixHeadlessCheckbox_base: (new (...args: any[]) => import("@fusi
|
|
|
21
21
|
* it as neither checked nor unchecked, it never submits, and the first click
|
|
22
22
|
* resolves it.
|
|
23
23
|
*
|
|
24
|
+
* **Keyboard.** The box is one tab stop.
|
|
25
|
+
*
|
|
26
|
+
* | Key | What it does |
|
|
27
|
+
* |---|---|
|
|
28
|
+
* | Space | Checks or unchecks the box, and resolves `indeterminate`. |
|
|
29
|
+
*
|
|
30
|
+
* The native input reports checked, unchecked, or mixed. `aria-readonly` is set
|
|
31
|
+
* under `readonly`, and `aria-invalid` and `aria-describedby` point at the
|
|
32
|
+
* message while one shows.
|
|
33
|
+
*
|
|
24
34
|
* @since 0.1.0
|
|
25
35
|
* @status stable
|
|
26
36
|
* @category forms
|
|
@@ -28,6 +38,8 @@ declare const HelixHeadlessCheckbox_base: (new (...args: any[]) => import("@fusi
|
|
|
28
38
|
* @documentation https://fusion.dev/helix/components/checkbox
|
|
29
39
|
*
|
|
30
40
|
* @slot - The label.
|
|
41
|
+
* @slot check - An icon drawn as the mark while the box is checked, in place of the tick.
|
|
42
|
+
* @slot dash - An icon drawn as the mark while the box is indeterminate, in place of the dash.
|
|
31
43
|
* @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
|
|
32
44
|
* @slot hint - Help under the control, for content richer than the `hint` text.
|
|
33
45
|
*
|
|
@@ -47,6 +59,8 @@ declare const HelixHeadlessCheckbox_base: (new (...args: any[]) => import("@fusi
|
|
|
47
59
|
* @csspart mark-indeterminate - Added to `mark` while the box is indeterminate.
|
|
48
60
|
*
|
|
49
61
|
* @cssstate checked - While the box is checked.
|
|
62
|
+
* @cssstate has-check - An icon is slotted into `check`.
|
|
63
|
+
* @cssstate has-dash - An icon is slotted into `dash`.
|
|
50
64
|
* @cssstate has-label - The label slot has content, so the label is drawn.
|
|
51
65
|
* @cssstate indeterminate - While the box shows the dash, neither checked nor unchecked.
|
|
52
66
|
* @cssstate invalid - The control has an error to show, from the browser's validation or from your `feedback`.
|
|
@@ -107,6 +121,12 @@ export declare class HelixHeadlessCheckbox extends HelixHeadlessCheckbox_base {
|
|
|
107
121
|
* worse problem than its spacing.
|
|
108
122
|
*/
|
|
109
123
|
private readonly handleLabelChange;
|
|
124
|
+
/**
|
|
125
|
+
* Records which of the mark's slots hold an icon, as `:state(has-check)` and
|
|
126
|
+
* `:state(has-dash)`, so a stylesheet drops its own drawing of that shape.
|
|
127
|
+
* A state, for the reason `:state(has-label)` is one.
|
|
128
|
+
*/
|
|
129
|
+
private readonly handleMarkChange;
|
|
110
130
|
/**
|
|
111
131
|
* Asks the slot, and records the answer as a state.
|
|
112
132
|
*
|
|
@@ -32,6 +32,16 @@ let HelixHeadlessCheckbox = class HelixHeadlessCheckbox extends MixinControllerC
|
|
|
32
32
|
this.handleLabelChange = () => {
|
|
33
33
|
this.syncLabelPresence();
|
|
34
34
|
};
|
|
35
|
+
this.handleMarkChange = (event) => {
|
|
36
|
+
const slot = event.target;
|
|
37
|
+
const filled = slot.assignedNodes().length > 0;
|
|
38
|
+
if (slot.name === 'dash') {
|
|
39
|
+
this.toggleState('has-dash', filled);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
this.toggleState('has-check', filled);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
35
45
|
}
|
|
36
46
|
static { this.shadowRootOptions = {
|
|
37
47
|
...HelixFormElement.shadowRootOptions,
|
|
@@ -94,7 +104,10 @@ let HelixHeadlessCheckbox = class HelixHeadlessCheckbox extends MixinControllerC
|
|
|
94
104
|
<span
|
|
95
105
|
part="mark${this.checked ? ' mark-checked' : ''}${this.indeterminate ? ' mark-indeterminate' : ''}${this.dashed ? ' mark-dash' : ''}"
|
|
96
106
|
aria-hidden="true"
|
|
97
|
-
|
|
107
|
+
>${this.dashed
|
|
108
|
+
? html `<slot name="dash" @slotchange=${this.handleMarkChange}></slot>`
|
|
109
|
+
: html `<slot name="check" @slotchange=${this.handleMarkChange}></slot>`}</span
|
|
110
|
+
>
|
|
98
111
|
</span>
|
|
99
112
|
<span part="label" ?data-hidden=${named !== null}
|
|
100
113
|
><slot @slotchange=${this.handleLabelChange}>${this.label || named}</slot></span
|
|
@@ -34,6 +34,9 @@ declare const HelixHeadlessCheckboxGroup_base: (new (...args: any[]) => import("
|
|
|
34
34
|
* only for validity and never calls `setFormValue`, so the browser does not
|
|
35
35
|
* generate a message for it.
|
|
36
36
|
*
|
|
37
|
+
* **Keyboard.** Each box is its own tab stop, as a set of native checkboxes
|
|
38
|
+
* is, and Space checks the focused one. The select-all box comes first.
|
|
39
|
+
*
|
|
37
40
|
* @since 0.1.0
|
|
38
41
|
* @status stable
|
|
39
42
|
* @category forms
|
|
@@ -221,12 +224,15 @@ export declare class HelixHeadlessCheckboxGroup extends HelixHeadlessCheckboxGro
|
|
|
221
224
|
* for the whole set, as a box moves it.
|
|
222
225
|
*/
|
|
223
226
|
private readonly handleSelectAll;
|
|
227
|
+
/** The set as the select-all helper reads it. */
|
|
228
|
+
private setBoxes;
|
|
224
229
|
/**
|
|
225
230
|
* The box above the set that checks or unchecks every box, under
|
|
226
231
|
* `select-all`, behind a seam a tier can move.
|
|
227
232
|
*
|
|
228
|
-
* Checked while every box is, and showing a dash while only some
|
|
229
|
-
*
|
|
233
|
+
* Checked while every enabled box is, and showing a dash while only some
|
|
234
|
+
* are, so its state says what a press does. It is in this shadow root, so
|
|
235
|
+
* it is no member of the set and submits nothing.
|
|
230
236
|
*/
|
|
231
237
|
protected renderSelectAll(): TemplateResult | typeof nothing;
|
|
232
238
|
protected render(): TemplateResult;
|
|
@@ -11,6 +11,7 @@ import { property } from 'lit/decorators.js';
|
|
|
11
11
|
import { html } from 'lit/static-html.js';
|
|
12
12
|
import { HelixHeadlessCheckbox } from '../../checkbox/root/checkbox-root.js';
|
|
13
13
|
import '../../checkbox/index.js';
|
|
14
|
+
import { selectAllPress, selectAllState } from '../select-all.js';
|
|
14
15
|
let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadlessCheckboxGroup extends MixinField(HelixFormElement) {
|
|
15
16
|
constructor() {
|
|
16
17
|
super(...arguments);
|
|
@@ -59,11 +60,7 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
59
60
|
this.handleSelectAll = (event) => {
|
|
60
61
|
event.preventDefault();
|
|
61
62
|
event.stopPropagation();
|
|
62
|
-
const
|
|
63
|
-
const every = enabled.length > 0 && enabled.every((box) => box.checked);
|
|
64
|
-
const next = this.boxes
|
|
65
|
-
.filter((box) => (enabled.includes(box) ? !every : box.checked))
|
|
66
|
-
.map((box) => box.value);
|
|
63
|
+
const next = selectAllPress(this.setBoxes());
|
|
67
64
|
if (!this.dispatchEvent(new HelixBeforeChangeEvent({ value: next.join(',') }))) {
|
|
68
65
|
return;
|
|
69
66
|
}
|
|
@@ -177,13 +174,18 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
177
174
|
this.validate();
|
|
178
175
|
this.linkHost();
|
|
179
176
|
}
|
|
177
|
+
setBoxes() {
|
|
178
|
+
return this.boxes.map((box) => ({
|
|
179
|
+
checked: box.checked,
|
|
180
|
+
disabled: box.isDisabled,
|
|
181
|
+
value: box.value,
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
180
184
|
renderSelectAll() {
|
|
181
185
|
if (!this.selectAll) {
|
|
182
186
|
return nothing;
|
|
183
187
|
}
|
|
184
|
-
const
|
|
185
|
-
const ticked = boxes.filter((box) => box.checked).length;
|
|
186
|
-
const every = boxes.length > 0 && ticked === boxes.length;
|
|
188
|
+
const { checked, indeterminate } = selectAllState(this.childrenKnown ? this.setBoxes() : []);
|
|
187
189
|
const box = this.tag('checkbox');
|
|
188
190
|
return html `<${box}
|
|
189
191
|
part="select-all"
|
|
@@ -191,8 +193,8 @@ let HelixHeadlessCheckboxGroup = HelixHeadlessCheckboxGroup_1 = class HelixHeadl
|
|
|
191
193
|
feedback: select-all-feedback, field: select-all-field, hint: select-all-hint,
|
|
192
194
|
label: select-all-label, mark: select-all-mark, mark-checked: select-all-mark-checked,
|
|
193
195
|
mark-dash: select-all-mark-dash, mark-indeterminate: select-all-mark-indeterminate"
|
|
194
|
-
.checked=${
|
|
195
|
-
.indeterminate=${
|
|
196
|
+
.checked=${checked}
|
|
197
|
+
.indeterminate=${indeterminate}
|
|
196
198
|
?disabled=${this.isDisabled}
|
|
197
199
|
label=${this.selectAllLabel}
|
|
198
200
|
@helix-before-toggle=${this.handleSelectAll}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** What the select-all helper reads from one box in the set. */
|
|
2
|
+
export interface SetBox {
|
|
3
|
+
/** Whether the box is checked. */
|
|
4
|
+
readonly checked: boolean;
|
|
5
|
+
/** Whether the box refuses a press, so select-all leaves it as it is. */
|
|
6
|
+
readonly disabled: boolean;
|
|
7
|
+
/** What the box submits when checked. */
|
|
8
|
+
readonly value: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What the select-all box shows: checked while every enabled box is checked,
|
|
12
|
+
* mixed while only some are, and clear while none is.
|
|
13
|
+
*
|
|
14
|
+
* A disabled box counts for nothing, because a press leaves it as it is. A
|
|
15
|
+
* set whose every box is disabled reads every box, so the select-all box still
|
|
16
|
+
* shows what the set holds.
|
|
17
|
+
*/
|
|
18
|
+
export declare const selectAllState: (boxes: readonly SetBox[]) => {
|
|
19
|
+
checked: boolean;
|
|
20
|
+
indeterminate: boolean;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* The values a press on the select-all box leaves, in the set's order: every
|
|
24
|
+
* enabled box checked, or every enabled box clear once all of them are
|
|
25
|
+
* checked. A disabled box keeps its state either way.
|
|
26
|
+
*/
|
|
27
|
+
export declare const selectAllPress: (boxes: readonly SetBox[]) => string[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const selectAllState = (boxes) => {
|
|
2
|
+
const enabled = boxes.filter((box) => !box.disabled);
|
|
3
|
+
const counted = enabled.length > 0 ? enabled : boxes;
|
|
4
|
+
const ticked = counted.filter((box) => box.checked).length;
|
|
5
|
+
const checked = counted.length > 0 && ticked === counted.length;
|
|
6
|
+
return { checked, indeterminate: ticked > 0 && !checked };
|
|
7
|
+
};
|
|
8
|
+
export const selectAllPress = (boxes) => {
|
|
9
|
+
const enabled = boxes.filter((box) => !box.disabled);
|
|
10
|
+
const every = enabled.length > 0 && enabled.every((box) => box.checked);
|
|
11
|
+
return boxes.filter((box) => (box.disabled ? box.checked : !every)).map((box) => box.value);
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The highlighted lines out of what a highlighter returned, without the
|
|
3
|
+
* `<pre>` and `<code>` around them that some highlighters write.
|
|
4
|
+
*
|
|
5
|
+
* Shiki's `codeToHtml` returns a whole block, `<pre class="shiki" tabindex="0"
|
|
6
|
+
* style="…"><code>…</code></pre>`. Drawn as given inside the block's own
|
|
7
|
+
* `<pre>`, that second `<pre>` sat 13px below the gutter's first number, and
|
|
8
|
+
* its `tabindex` was a second tab stop inside the block's scroller. Prism's
|
|
9
|
+
* `highlight` and highlight.js return the lines alone, which pass through
|
|
10
|
+
* unchanged.
|
|
11
|
+
*
|
|
12
|
+
* Only a wrapper around the whole markup is taken off, and only one. The block draws its own
|
|
13
|
+
* box and colors, so the wrapper's `style` and `class` go with it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const highlightedLines: (markup: string) => string;
|
|
@@ -20,6 +20,12 @@ import '../../copy-button/index.js';
|
|
|
20
20
|
* Shiki or Prism, and the block draws what it returns; the code stays in the
|
|
21
21
|
* slot, so the copy button and the page's own text are the code as written.
|
|
22
22
|
*
|
|
23
|
+
* Set `expandable` on a block whose height is capped, such as by
|
|
24
|
+
* `--code-block-max-block-size`, and a button under it shows every line and
|
|
25
|
+
* then fewer again, as a docs site's long example does. The button is drawn
|
|
26
|
+
* only while the cap hides something, says whether the block is expanded, and
|
|
27
|
+
* the block carries `:state(expanded)` while it is.
|
|
28
|
+
*
|
|
23
29
|
* Set `diff` to show a change. Put a unified diff, the output of `git diff` or
|
|
24
30
|
* `diff -u`, in the same slot, and the block draws the lines it added and
|
|
25
31
|
* removed. The block never computes a diff itself. Line numbers come from the
|
|
@@ -61,6 +67,7 @@ import '../../copy-button/index.js';
|
|
|
61
67
|
* @csspart copy-tooltip-left - The tooltip while it is left of the copy button. Applied with `copy-tooltip`.
|
|
62
68
|
* @csspart copy-tooltip-right - The tooltip while it is right of the copy button. Applied with `copy-tooltip`.
|
|
63
69
|
* @csspart copy-tooltip-top - The tooltip while it is above the copy button. Applied with `copy-tooltip`.
|
|
70
|
+
* @csspart expand - The button under a capped block that shows every line, and fewer again. Drawn when `expandable` is set and the cap hides something.
|
|
64
71
|
* @csspart file - In a diff, one file's header and block.
|
|
65
72
|
* @csspart filler - In a split diff, the empty row opposite a line the other side does not have.
|
|
66
73
|
* @csspart frame - The code, and the copy button beside it where there is no header.
|
|
@@ -75,14 +82,24 @@ import '../../copy-button/index.js';
|
|
|
75
82
|
* @csspart removed - In a diff, a line only the old version has, a `<del>`.
|
|
76
83
|
* @csspart split - In a split diff, the two versions side by side.
|
|
77
84
|
* @csspart text - In a diff, a line's code.
|
|
85
|
+
*
|
|
86
|
+
* @cssstate expanded - The expand button has shown every line of a capped block.
|
|
78
87
|
*/
|
|
79
88
|
export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
89
|
+
/**
|
|
90
|
+
* The expand button's words while the block shows every line.
|
|
91
|
+
*/
|
|
92
|
+
collapseLabel: string;
|
|
80
93
|
/**
|
|
81
94
|
* The copy button's name and tooltip text after a copy.
|
|
82
95
|
*/
|
|
83
96
|
copiedLabel: string;
|
|
84
97
|
/**
|
|
85
98
|
* The copy button's name and tooltip text before a copy.
|
|
99
|
+
*
|
|
100
|
+
* Where the block has a name, the button says it too, such as "Copy code,
|
|
101
|
+
* app.ts", so each copy button on a page with several blocks is told apart.
|
|
102
|
+
* In a diff, that is each file's own name.
|
|
86
103
|
*/
|
|
87
104
|
copyLabel: string;
|
|
88
105
|
/**
|
|
@@ -92,6 +109,19 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
92
109
|
* `false` reflects as no attribute at all.
|
|
93
110
|
*/
|
|
94
111
|
diff: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Whether a block whose height is capped takes a button that shows every
|
|
114
|
+
* line, and fewer again.
|
|
115
|
+
*
|
|
116
|
+
* The cap is the page's, `--code-block-max-block-size` on the styled tier;
|
|
117
|
+
* the button is drawn only while the cap hides something, measured as the
|
|
118
|
+
* block lays out. Not for a diff, whose files each scroll on their own.
|
|
119
|
+
*/
|
|
120
|
+
expandable: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* The expand button's words while the cap hides lines.
|
|
123
|
+
*/
|
|
124
|
+
expandLabel: string;
|
|
95
125
|
/**
|
|
96
126
|
* Turns the code into highlighted markup, which the block draws in place of
|
|
97
127
|
* the plain text.
|
|
@@ -99,7 +129,9 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
99
129
|
* Called with the code as written and returning HTML, such as the output of
|
|
100
130
|
* Shiki's `codeToHtml` or Prism's `highlight`. **The markup is drawn as
|
|
101
131
|
* given**, so it has to escape the code it was handed, which those
|
|
102
|
-
* highlighters do.
|
|
132
|
+
* highlighters do. A `<pre>` and `<code>` around the whole of it, which
|
|
133
|
+
* Shiki writes, are taken off, so the lines sit level with the gutter's
|
|
134
|
+
* numbers and the block keeps one tab stop. Bind the language in the function you pass. The code
|
|
103
135
|
* stays in the slot, so the copy button copies it as written and a reader
|
|
104
136
|
* without the script still has it. Not called on a server, which has no code
|
|
105
137
|
* to read, nor for a diff.
|
|
@@ -180,10 +212,30 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
180
212
|
* was not redrawn.
|
|
181
213
|
*/
|
|
182
214
|
private observer;
|
|
215
|
+
/** Whether the cap hides lines, measured from the drawn block. */
|
|
216
|
+
private capped;
|
|
217
|
+
/** Whether the expand button has shown every line. */
|
|
218
|
+
private expanded;
|
|
219
|
+
/** Watches the block's size, while it is expandable. */
|
|
220
|
+
private sizes;
|
|
221
|
+
/**
|
|
222
|
+
* Reads whether the cap hides lines: the scroller is taller inside than it
|
|
223
|
+
* is drawn. The styled tier caps the `<code>`, and a page may cap the
|
|
224
|
+
* `<pre>`, so both are asked. Left as it was while expanded, which shows
|
|
225
|
+
* everything.
|
|
226
|
+
*/
|
|
227
|
+
private readonly measure;
|
|
228
|
+
protected updated(changed: PropertyValues): void;
|
|
183
229
|
connectedCallback(): void;
|
|
184
230
|
disconnectedCallback(): void;
|
|
185
231
|
protected firstUpdated(changed: PropertyValues): void;
|
|
186
232
|
protected render(): TemplateResult;
|
|
233
|
+
/**
|
|
234
|
+
* The button that shows every line of a capped block, and fewer again, or
|
|
235
|
+
* nothing while the cap hides nothing. Not on a server, which cannot
|
|
236
|
+
* measure, so a served block draws none and the client adds it.
|
|
237
|
+
*/
|
|
238
|
+
private renderExpand;
|
|
187
239
|
/**
|
|
188
240
|
* The name with the copy button beside it, or nothing when there is no name.
|
|
189
241
|
*
|
|
@@ -207,8 +259,11 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
207
259
|
* interpolated rather than written, so `tier` resolves it: this renders the
|
|
208
260
|
* base button, and a styled subclass that sets `tier` renders the styled one
|
|
209
261
|
* from the same template.
|
|
262
|
+
*
|
|
263
|
+
* @param value The text the button copies.
|
|
264
|
+
* @param name The name of what it copies, which its label carries.
|
|
210
265
|
*/
|
|
211
|
-
protected renderCopyButton(value?: string): TemplateResult;
|
|
266
|
+
protected renderCopyButton(value?: string, name?: string): TemplateResult;
|
|
212
267
|
/** A number padded to the widest in its file, so the columns line up as text. */
|
|
213
268
|
private renderNumber;
|
|
214
269
|
private renderLine;
|
|
@@ -6,22 +6,36 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { customElement, HelixElement } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
|
-
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
11
11
|
import { html } from 'lit/static-html.js';
|
|
12
12
|
import '../../copy-button/index.js';
|
|
13
|
+
import { highlightedLines } from '../highlight.js';
|
|
13
14
|
import { gutterNumbers, lineCount } from '../lines.js';
|
|
14
15
|
import { pairLines, parsePatch } from '../patch.js';
|
|
15
16
|
let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
16
17
|
constructor() {
|
|
17
18
|
super(...arguments);
|
|
19
|
+
this.collapseLabel = 'Show fewer lines';
|
|
18
20
|
this.copiedLabel = 'Copied';
|
|
19
21
|
this.copyLabel = 'Copy code';
|
|
20
22
|
this.diff = false;
|
|
23
|
+
this.expandable = false;
|
|
24
|
+
this.expandLabel = 'Show all lines';
|
|
21
25
|
this.label = '';
|
|
22
26
|
this.lineNumbers = false;
|
|
23
27
|
this.noCopy = false;
|
|
24
28
|
this.parsed = { files: [], text: '' };
|
|
29
|
+
this.capped = false;
|
|
30
|
+
this.expanded = false;
|
|
31
|
+
this.measure = () => {
|
|
32
|
+
if (!this.expanded) {
|
|
33
|
+
this.capped =
|
|
34
|
+
this.expandable &&
|
|
35
|
+
!this.diff &&
|
|
36
|
+
[...this.renderRoot.querySelectorAll('[part="block"], [part="code"]')].some((box) => box.scrollHeight > box.clientHeight + 1);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
25
39
|
}
|
|
26
40
|
get files() {
|
|
27
41
|
if (!this.diff) {
|
|
@@ -43,6 +57,14 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
43
57
|
.map((node) => node.textContent ?? '')
|
|
44
58
|
.join('');
|
|
45
59
|
}
|
|
60
|
+
updated(changed) {
|
|
61
|
+
super.updated(changed);
|
|
62
|
+
if (this.expandable && typeof ResizeObserver !== 'undefined') {
|
|
63
|
+
this.sizes ??= new ResizeObserver(this.measure);
|
|
64
|
+
this.sizes.observe(this);
|
|
65
|
+
}
|
|
66
|
+
this.measure();
|
|
67
|
+
}
|
|
46
68
|
connectedCallback() {
|
|
47
69
|
super.connectedCallback();
|
|
48
70
|
if (typeof MutationObserver !== 'undefined') {
|
|
@@ -52,6 +74,8 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
52
74
|
}
|
|
53
75
|
disconnectedCallback() {
|
|
54
76
|
super.disconnectedCallback();
|
|
77
|
+
this.sizes?.disconnect();
|
|
78
|
+
this.sizes = undefined;
|
|
55
79
|
this.observer?.disconnect();
|
|
56
80
|
}
|
|
57
81
|
firstUpdated(changed) {
|
|
@@ -64,7 +88,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
64
88
|
return this.renderDiff(files);
|
|
65
89
|
}
|
|
66
90
|
const text = this.text;
|
|
67
|
-
const highlighted = this.highlight && text !== '' ? this.highlight(text) : undefined;
|
|
91
|
+
const highlighted = this.highlight && text !== '' ? highlightedLines(this.highlight(text)) : undefined;
|
|
68
92
|
const code = highlighted === undefined
|
|
69
93
|
? html `<code part="code"><slot @slotchange=${() => this.requestUpdate()}></slot></code>`
|
|
70
94
|
: html `<code part="code">${unsafeHTML(highlighted)}</code><slot
|
|
@@ -79,17 +103,33 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
79
103
|
<div part="frame">
|
|
80
104
|
<pre part="block">${gutter}${code}</pre>
|
|
81
105
|
${this.label ? nothing : this.renderCopy()}
|
|
82
|
-
</div
|
|
106
|
+
</div>${this.renderExpand()}`;
|
|
107
|
+
}
|
|
108
|
+
renderExpand() {
|
|
109
|
+
if (!this.expandable || !(this.capped || this.expanded)) {
|
|
110
|
+
return nothing;
|
|
111
|
+
}
|
|
112
|
+
return html `<button
|
|
113
|
+
aria-expanded=${this.expanded ? 'true' : 'false'}
|
|
114
|
+
part="expand"
|
|
115
|
+
type="button"
|
|
116
|
+
@click=${() => {
|
|
117
|
+
this.expanded = !this.expanded;
|
|
118
|
+
this.toggleState('expanded', this.expanded);
|
|
119
|
+
}}
|
|
120
|
+
>
|
|
121
|
+
${this.expanded ? this.collapseLabel : this.expandLabel}
|
|
122
|
+
</button>`;
|
|
83
123
|
}
|
|
84
124
|
renderHeader(name, value) {
|
|
85
125
|
return name
|
|
86
|
-
? html `<div part="header"><span part="label">${name}</span>${this.renderCopy(value)}</div>`
|
|
126
|
+
? html `<div part="header"><span part="label">${name}</span>${this.renderCopy(value, name)}</div>`
|
|
87
127
|
: nothing;
|
|
88
128
|
}
|
|
89
|
-
renderCopy(value) {
|
|
90
|
-
return this.noCopy ? nothing : this.renderCopyButton(value);
|
|
129
|
+
renderCopy(value, name) {
|
|
130
|
+
return this.noCopy ? nothing : this.renderCopyButton(value, name);
|
|
91
131
|
}
|
|
92
|
-
renderCopyButton(value = this.text) {
|
|
132
|
+
renderCopyButton(value = this.text, name = this.label) {
|
|
93
133
|
return html `<${this.tag('copy-button')}
|
|
94
134
|
part="copy"
|
|
95
135
|
exportparts="button: copy-button, text: copy-text, mark: copy-mark, live: copy-live, tooltip: copy-tooltip,
|
|
@@ -98,7 +138,7 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
98
138
|
tooltip-arrow-top: copy-tooltip-arrow-top, tooltip-bottom: copy-tooltip-bottom,
|
|
99
139
|
tooltip-left: copy-tooltip-left, tooltip-right: copy-tooltip-right, tooltip-top: copy-tooltip-top"
|
|
100
140
|
copied-label=${this.copiedLabel}
|
|
101
|
-
label=${this.copyLabel}
|
|
141
|
+
label=${name ? `${this.copyLabel}, ${name}` : this.copyLabel}
|
|
102
142
|
.value=${value}
|
|
103
143
|
></${this.tag('copy-button')}>`;
|
|
104
144
|
}
|
|
@@ -150,6 +190,9 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
150
190
|
})}<slot hidden @slotchange=${() => this.requestUpdate()}></slot>`;
|
|
151
191
|
}
|
|
152
192
|
};
|
|
193
|
+
__decorate([
|
|
194
|
+
property({ attribute: 'collapse-label' })
|
|
195
|
+
], HelixHeadlessCodeBlock.prototype, "collapseLabel", void 0);
|
|
153
196
|
__decorate([
|
|
154
197
|
property({ attribute: 'copied-label' })
|
|
155
198
|
], HelixHeadlessCodeBlock.prototype, "copiedLabel", void 0);
|
|
@@ -159,6 +202,12 @@ __decorate([
|
|
|
159
202
|
__decorate([
|
|
160
203
|
property({ reflect: true, type: Boolean })
|
|
161
204
|
], HelixHeadlessCodeBlock.prototype, "diff", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
property({ type: Boolean })
|
|
207
|
+
], HelixHeadlessCodeBlock.prototype, "expandable", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
property({ attribute: 'expand-label' })
|
|
210
|
+
], HelixHeadlessCodeBlock.prototype, "expandLabel", void 0);
|
|
162
211
|
__decorate([
|
|
163
212
|
property({ attribute: false })
|
|
164
213
|
], HelixHeadlessCodeBlock.prototype, "highlight", void 0);
|
|
@@ -174,6 +223,12 @@ __decorate([
|
|
|
174
223
|
__decorate([
|
|
175
224
|
property({ reflect: true })
|
|
176
225
|
], HelixHeadlessCodeBlock.prototype, "variant", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
state()
|
|
228
|
+
], HelixHeadlessCodeBlock.prototype, "capped", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
state()
|
|
231
|
+
], HelixHeadlessCodeBlock.prototype, "expanded", void 0);
|
|
177
232
|
HelixHeadlessCodeBlock = __decorate([
|
|
178
233
|
customElement('helix-headless-code-block')
|
|
179
234
|
], HelixHeadlessCodeBlock);
|
|
@@ -45,6 +45,8 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
45
45
|
* @slot end - Content at the trailing end, before the trigger.
|
|
46
46
|
* @slot feedback - The message that says what is wrong with the value.
|
|
47
47
|
* @slot hint - Help text under the field.
|
|
48
|
+
* @slot panel-footer - Content in the panel under the picker, such as a note or an action.
|
|
49
|
+
* @slot panel-header - Content in the panel above the picker, such as a heading or a shortcut.
|
|
48
50
|
* @slot start - Content at the leading end of the field, inside its border.
|
|
49
51
|
* @slot trigger - The icon on the trigger, which shows that the field opens a panel.
|
|
50
52
|
*
|
|
@@ -78,6 +80,7 @@ declare const HelixHeadlessColorInput_base: (new (...args: any[]) => import("@fu
|
|
|
78
80
|
* @csspart picker-eyedropper-button - The button inside `picker-eyedropper`.
|
|
79
81
|
* @csspart picker-eyedropper-live - The live region of the button inside `picker-eyedropper`, which says its pending label.
|
|
80
82
|
* @csspart picker-eyedropper-text - The words on the button inside `picker-eyedropper`.
|
|
83
|
+
* @csspart picker-feedback - The field's message inside the open panel, under the picker, where the panel covers the one under the field.
|
|
81
84
|
* @csspart picker-field - One channel's number field with its label, in `channel-fields`.
|
|
82
85
|
* @csspart picker-field-input - The number input in a channel's field.
|
|
83
86
|
* @csspart picker-field-label - The name above a channel's number input.
|
|
@@ -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, colorName, customElement, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerField, parseColor, toCss, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, colorName, customElement, HelixFormElement, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerField, parseColor, toCss, wordsConverter, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { html } from 'lit/static-html.js';
|
|
@@ -117,13 +117,14 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
117
117
|
channel-markers: picker-channel-markers, channel-output: picker-channel-output,
|
|
118
118
|
channels: picker-channels, controls: picker-controls, eyedropper: picker-eyedropper,
|
|
119
119
|
eyedropper-button: picker-eyedropper-button, eyedropper-live: picker-eyedropper-live, eyedropper-text: picker-eyedropper-text,
|
|
120
|
-
field: picker-field, field-input: picker-field-input, field-label: picker-field-label,
|
|
120
|
+
feedback: picker-feedback, field: picker-field, field-input: picker-field-input, field-label: picker-field-label,
|
|
121
121
|
fields: picker-fields, footer: picker-footer, format: picker-format,
|
|
122
122
|
format-button: picker-format-button, format-live: picker-format-live, format-text: picker-format-text, grid: picker-grid,
|
|
123
123
|
grid-brightness: picker-grid-brightness, grid-handle: picker-grid-handle,
|
|
124
124
|
grid-saturation: picker-grid-saturation, icon: picker-icon, sample: picker-sample,
|
|
125
125
|
swatch: picker-swatch, swatches: picker-swatches, value: picker-value"
|
|
126
126
|
?invalid=${this.resolvedFeedback !== ''}
|
|
127
|
+
.feedback=${this.resolvedFeedback}
|
|
127
128
|
?alpha=${this.alpha}
|
|
128
129
|
?channel-fields=${this.channelFields}
|
|
129
130
|
?no-format=${this.noFormat}
|
|
@@ -209,7 +210,9 @@ let HelixHeadlessColorInput = class HelixHeadlessColorInput extends MixinPickerF
|
|
|
209
210
|
popover="manual"
|
|
210
211
|
?hidden=${!this.open}
|
|
211
212
|
>
|
|
213
|
+
<slot name="panel-header"></slot>
|
|
212
214
|
${this.renderPicker()}
|
|
215
|
+
<slot name="panel-footer"></slot>
|
|
213
216
|
</div>
|
|
214
217
|
${this.renderHint()}${this.renderFeedback()}`;
|
|
215
218
|
}
|
|
@@ -224,7 +227,7 @@ __decorate([
|
|
|
224
227
|
property({ attribute: 'channel-fields', type: Boolean })
|
|
225
228
|
], HelixHeadlessColorInput.prototype, "channelFields", void 0);
|
|
226
229
|
__decorate([
|
|
227
|
-
property({ attribute: 'color-words',
|
|
230
|
+
property({ attribute: 'color-words', converter: wordsConverter })
|
|
228
231
|
], HelixHeadlessColorInput.prototype, "colorWords", void 0);
|
|
229
232
|
__decorate([
|
|
230
233
|
property({ reflect: true })
|
|
@@ -29,8 +29,12 @@ declare const HelixHeadlessColorPicker_base: (new (...args: any[]) => import("@f
|
|
|
29
29
|
*
|
|
30
30
|
* A screen reader hears the color's name, such as "vibrant red", after the two
|
|
31
31
|
* numbers on the square and after the number on the hue ramp, and each preset
|
|
32
|
-
* is named by its color.
|
|
33
|
-
* language.
|
|
32
|
+
* is named by its color. The opacity ramp is heard as a percentage. Set
|
|
33
|
+
* `color-words` to speak the names in another language.
|
|
34
|
+
*
|
|
35
|
+
* The presets are a listbox with the current color selected, and one tab
|
|
36
|
+
* stop. The arrow keys move between them, Home and End go to the ends, and
|
|
37
|
+
* Enter, Space or a press chooses one.
|
|
34
38
|
*
|
|
35
39
|
* @since 0.1.0
|
|
36
40
|
* @status stable
|
|
@@ -64,6 +68,7 @@ declare const HelixHeadlessColorPicker_base: (new (...args: any[]) => import("@f
|
|
|
64
68
|
* @csspart eyedropper-button - The button inside `eyedropper`.
|
|
65
69
|
* @csspart eyedropper-live - The live region of the button inside `eyedropper`, which says its pending label.
|
|
66
70
|
* @csspart eyedropper-text - The words on the button inside `eyedropper`, trimmed to their capitals and baseline.
|
|
71
|
+
* @csspart feedback - The message under the picker, while `feedback` is set.
|
|
67
72
|
* @csspart field - One channel's number field with its label, in `channel-fields`.
|
|
68
73
|
* @csspart field-input - The number input in a channel's field.
|
|
69
74
|
* @csspart field-label - The name above a channel's number input.
|
|
@@ -80,8 +85,8 @@ declare const HelixHeadlessColorPicker_base: (new (...args: any[]) => import("@f
|
|
|
80
85
|
* @csspart grid-brightness - The range input for the square's vertical axis.
|
|
81
86
|
* @csspart grid-saturation - The range input for the square's horizontal axis.
|
|
82
87
|
* @csspart sample - A chip of the current color. Pressing it copies the value.
|
|
83
|
-
* @csspart swatch - One preset.
|
|
84
|
-
* @csspart swatches - The row of presets.
|
|
88
|
+
* @csspart swatch - One preset, an option in the `swatches` listbox.
|
|
89
|
+
* @csspart swatches - The row of presets, a listbox.
|
|
85
90
|
* @csspart value - The text field that holds the color. It accepts a typed or pasted color.
|
|
86
91
|
*
|
|
87
92
|
* @cssproperty --color-picker-brightness - The chosen brightness, 0 to 100, as a percentage.
|
|
@@ -160,6 +165,15 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
160
165
|
* What the eyedropper is called.
|
|
161
166
|
*/
|
|
162
167
|
eyedropperLabel: string;
|
|
168
|
+
/**
|
|
169
|
+
* A message under the picker, such as what is wrong with the color.
|
|
170
|
+
*
|
|
171
|
+
* While set, the picker is invalid and does not submit, as a field's
|
|
172
|
+
* `feedback` is, and the square and the value text are described by it.
|
|
173
|
+
* Color Input shows its own message here, so a reader in the open panel
|
|
174
|
+
* still sees it.
|
|
175
|
+
*/
|
|
176
|
+
feedback: string;
|
|
163
177
|
/**
|
|
164
178
|
* The syntax the value is written in: `hex`, `rgb`, or `hsl`.
|
|
165
179
|
*
|
|
@@ -322,6 +336,8 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
322
336
|
* server's markup, which was rendered without it.
|
|
323
337
|
*/
|
|
324
338
|
private sampling;
|
|
339
|
+
/** The preset the reader was last on, which holds the row's one tab stop. */
|
|
340
|
+
private swatchAt;
|
|
325
341
|
/**
|
|
326
342
|
* Whether the value on this element was produced here.
|
|
327
343
|
*
|
|
@@ -393,6 +409,11 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
393
409
|
private readonly copier;
|
|
394
410
|
/** Takes a preset, in this picker's syntax rather than as the preset spelled it. */
|
|
395
411
|
private readonly handleSwatch;
|
|
412
|
+
/**
|
|
413
|
+
* The arrows, Home and End in the presets: focus moves, and nothing is
|
|
414
|
+
* chosen until Enter, Space or a press, as in React Aria's swatch picker.
|
|
415
|
+
*/
|
|
416
|
+
private readonly handleSwatchKeydown;
|
|
396
417
|
/** Walks the format on, and rewrites the value in it. */
|
|
397
418
|
private readonly handleFormat;
|
|
398
419
|
/**
|
|
@@ -449,6 +470,8 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
449
470
|
* what React Aria's ColorArea does.
|
|
450
471
|
*/
|
|
451
472
|
private readonly handleAreaKeydown;
|
|
473
|
+
/** @internal `feedback` marks the picker invalid, as a field's does. */
|
|
474
|
+
protected get validityFeedback(): string;
|
|
452
475
|
/**
|
|
453
476
|
* Reports "required and empty", or clears it.
|
|
454
477
|
*
|
|
@@ -557,6 +580,12 @@ export declare class HelixHeadlessColorPicker extends HelixHeadlessColorPicker_b
|
|
|
557
580
|
* tiers.
|
|
558
581
|
*/
|
|
559
582
|
protected renderTools(): TemplateResult;
|
|
583
|
+
/**
|
|
584
|
+
* The presets, as a listbox of colors with the current one selected, which
|
|
585
|
+
* is React Aria's ColorSwatchPicker: one tab stop, held by the preset the
|
|
586
|
+
* reader was last on, then the selected one, then the first.
|
|
587
|
+
*/
|
|
588
|
+
private renderSwatches;
|
|
560
589
|
protected render(): TemplateResult;
|
|
561
590
|
}
|
|
562
591
|
declare global {
|