@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
|
@@ -20,7 +20,10 @@ declare const HelixHeadlessInput_base: (new (...args: any[]) => import("@fusion.
|
|
|
20
20
|
* which a reset restores.
|
|
21
21
|
*
|
|
22
22
|
* Validity comes from the browser. `type` and `required` are set on the real
|
|
23
|
-
* input, and its `validity` is copied to the host.
|
|
23
|
+
* input, and its `validity` is copied to the host. `validate` adds your own
|
|
24
|
+
* rule, run on every change once the browser finds nothing wrong, as React
|
|
25
|
+
* Aria's TextField `validate` does. What it returns is the message the field
|
|
26
|
+
* shows once the user has edited it, and the message a submit raises.
|
|
24
27
|
*
|
|
25
28
|
* @since 0.1.0
|
|
26
29
|
* @status stable
|
|
@@ -36,7 +39,7 @@ declare const HelixHeadlessInput_base: (new (...args: any[]) => import("@fusion.
|
|
|
36
39
|
*
|
|
37
40
|
* @event {Event} change - Sent when the user finishes changing the value. Relayed from the native input.
|
|
38
41
|
* @event {HelixBeforeChangeEvent} helix-before-change - The text is about to change. Cancelable: cancel it to keep the current text.
|
|
39
|
-
* @event {
|
|
42
|
+
* @event {HelixClearEvent} helix-clear - Fired after the clear button has emptied the field, after `input` and `change`.
|
|
40
43
|
* @event {Event} input - Fired as the value changes.
|
|
41
44
|
*
|
|
42
45
|
* @csspart clear - The button that empties the field.
|
|
@@ -48,7 +51,8 @@ declare const HelixHeadlessInput_base: (new (...args: any[]) => import("@fusion.
|
|
|
48
51
|
* @csspart reveal - The button that shows and hides a password.
|
|
49
52
|
* @csspart reveal-pressed - The reveal button while the password is shown, added beside `reveal`.
|
|
50
53
|
*
|
|
51
|
-
* @cssstate
|
|
54
|
+
* @cssstate blank - The field holds no text.
|
|
55
|
+
* @cssstate invalid - The control has an error to show, from the browser's validation, `validate`, or your `feedback`.
|
|
52
56
|
*/
|
|
53
57
|
export declare class HelixHeadlessInput extends HelixHeadlessInput_base {
|
|
54
58
|
protected readonly aria: AriaForwardController;
|
|
@@ -281,6 +285,12 @@ export declare class HelixHeadlessInput extends HelixHeadlessInput_base {
|
|
|
281
285
|
* validation follow.
|
|
282
286
|
*/
|
|
283
287
|
type: InputType;
|
|
288
|
+
/**
|
|
289
|
+
* Your own rule for the value, run on every change once the browser finds
|
|
290
|
+
* nothing wrong. Return a message, or a list of them, to mark the field
|
|
291
|
+
* invalid, and `true`, `null`, or nothing to accept the value.
|
|
292
|
+
*/
|
|
293
|
+
validate?: (value: string) => string | string[] | true | null | undefined;
|
|
284
294
|
protected render(): TemplateResult;
|
|
285
295
|
}
|
|
286
296
|
declare global {
|
|
@@ -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, customElement, drawIcon, HelixFormElement, holdCaret, MixinControllerValue, MixinField, restoreValue, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, customElement, drawIcon, HelixClearEvent, HelixFormElement, holdCaret, MixinControllerValue, MixinField, restoreValue, submitImplicitly, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { eye, eyeSlash, x } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -38,7 +38,7 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinControllerValue(M
|
|
|
38
38
|
this.handleClear = () => {
|
|
39
39
|
if (this.value !== '' && this.requestValue('')) {
|
|
40
40
|
this.announceChange();
|
|
41
|
-
this.dispatchEvent(new
|
|
41
|
+
this.dispatchEvent(new HelixClearEvent());
|
|
42
42
|
}
|
|
43
43
|
const control = this.control;
|
|
44
44
|
if (control) {
|
|
@@ -48,7 +48,7 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinControllerValue(M
|
|
|
48
48
|
};
|
|
49
49
|
this.handleKeypress = (event) => {
|
|
50
50
|
if (event.key === 'Enter' && !event.defaultPrevented) {
|
|
51
|
-
this.
|
|
51
|
+
submitImplicitly(this.form);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
this.handleChange = (event) => {
|
|
@@ -112,6 +112,11 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinControllerValue(M
|
|
|
112
112
|
return;
|
|
113
113
|
}
|
|
114
114
|
this.copyValidity(control);
|
|
115
|
+
const own = control.validity.valid ? this.validate?.(this.value) : undefined;
|
|
116
|
+
const message = Array.isArray(own) ? own.join(' ') : typeof own === 'string' ? own : '';
|
|
117
|
+
if (message !== '') {
|
|
118
|
+
this.internals.setValidity({ customError: true }, message, control);
|
|
119
|
+
}
|
|
115
120
|
this.refreshFeedback();
|
|
116
121
|
}
|
|
117
122
|
focus(options) {
|
|
@@ -136,6 +141,7 @@ let HelixHeadlessInput = class HelixHeadlessInput extends MixinControllerValue(M
|
|
|
136
141
|
}
|
|
137
142
|
willUpdate(changed) {
|
|
138
143
|
super.willUpdate(changed);
|
|
144
|
+
this.toggleState('blank', this.value === '');
|
|
139
145
|
if (!this.hasUpdated) {
|
|
140
146
|
return;
|
|
141
147
|
}
|
|
@@ -268,6 +274,9 @@ __decorate([
|
|
|
268
274
|
__decorate([
|
|
269
275
|
property()
|
|
270
276
|
], HelixHeadlessInput.prototype, "type", void 0);
|
|
277
|
+
__decorate([
|
|
278
|
+
property({ attribute: false })
|
|
279
|
+
], HelixHeadlessInput.prototype, "validate", void 0);
|
|
271
280
|
HelixHeadlessInput = __decorate([
|
|
272
281
|
customElement('helix-headless-input')
|
|
273
282
|
], HelixHeadlessInput);
|
|
@@ -23,6 +23,11 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
23
23
|
* the shortcut with the control. A chord the page wrote there itself is left
|
|
24
24
|
* alone, and the key takes back only what it added.
|
|
25
25
|
*
|
|
26
|
+
* `caps` draws a chord as a key per key: each is a `key` part and the `+`
|
|
27
|
+
* between two a `separator` part, so a sheet can draw a cap for each.
|
|
28
|
+
* `key-labels` renames any key, on every platform, such as
|
|
29
|
+
* `key-labels='{"mod":"Command"}'`.
|
|
30
|
+
*
|
|
26
31
|
* @since 0.1.0
|
|
27
32
|
* @status stable
|
|
28
33
|
* @category typography
|
|
@@ -33,9 +38,20 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
33
38
|
*
|
|
34
39
|
* @event {HelixShortcutEvent} helix-shortcut - The chord was pressed. Cancelable: cancel it to let the key press keep its usual effect.
|
|
35
40
|
*
|
|
36
|
-
* @csspart kbd - The key
|
|
41
|
+
* @csspart kbd - The key, or the chord under `keys`.
|
|
42
|
+
* @csspart key - One key of a chord under `keys` and `caps`, such as `Ctrl` in `Ctrl+K`.
|
|
43
|
+
* @csspart separator - The `+` between two keys of a chord under `keys` and `caps`, drawn where the platform writes one: on Windows and Linux. An Apple keyboard writes none.
|
|
37
44
|
*/
|
|
38
45
|
export declare class HelixHeadlessKbd extends HelixElement {
|
|
46
|
+
/**
|
|
47
|
+
* Draws a chord under `keys` as one key per key, each a `key` part with a
|
|
48
|
+
* `separator` part between two where the platform writes a `+`, as GitHub
|
|
49
|
+
* and most docs draw `Ctrl` `K`.
|
|
50
|
+
*
|
|
51
|
+
* Absent, a chord is one key holding the whole label, as it always was.
|
|
52
|
+
* Reflected, because the styled tier draws the caps on the keys under it.
|
|
53
|
+
*/
|
|
54
|
+
caps: boolean;
|
|
39
55
|
/**
|
|
40
56
|
* The id of the control the shortcut works, which is given the chord as its
|
|
41
57
|
* `aria-keyshortcuts`.
|
|
@@ -45,6 +61,18 @@ export declare class HelixHeadlessKbd extends HelixElement {
|
|
|
45
61
|
* shortcut the page binds itself.
|
|
46
62
|
*/
|
|
47
63
|
for: string;
|
|
64
|
+
/**
|
|
65
|
+
* Names for keys in place of the platform's own, by the key's name in
|
|
66
|
+
* `keys`, written as JSON in the attribute: `key-labels='{"mod":"Command",
|
|
67
|
+
* "enter":"Return"}'` shows `Command` and `Return` wherever `mod` and
|
|
68
|
+
* `enter` are written.
|
|
69
|
+
*
|
|
70
|
+
* For a page in another language, or a product with its own word for a key.
|
|
71
|
+
* Absent, the platform's glyphs and words are used. Only what is shown
|
|
72
|
+
* changes: the chord written onto `aria-keyshortcuts` keeps the names a
|
|
73
|
+
* screen reader knows.
|
|
74
|
+
*/
|
|
75
|
+
keyLabels?: Record<string, string>;
|
|
48
76
|
/**
|
|
49
77
|
* The key or chord to show, such as `mod+k`, `?`, or `/`.
|
|
50
78
|
*
|
|
@@ -93,6 +121,12 @@ export declare class HelixHeadlessKbd extends HelixElement {
|
|
|
93
121
|
private readonly handleKeydown;
|
|
94
122
|
protected firstUpdated(changed: PropertyValues): void;
|
|
95
123
|
protected render(): TemplateResult;
|
|
124
|
+
/**
|
|
125
|
+
* The chord under `caps`, a part for each key and for each `+` between two,
|
|
126
|
+
* so a sheet can draw a cap per key. Written with no space between, so a
|
|
127
|
+
* chord reads as the one label it was.
|
|
128
|
+
*/
|
|
129
|
+
protected renderChord(): TemplateResult;
|
|
96
130
|
}
|
|
97
131
|
declare global {
|
|
98
132
|
interface HTMLElementTagNameMap {
|
|
@@ -5,7 +5,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
import { ariaChord, chordParts, customElement, elementById, HelixElement, HelixShortcutEvent, matchesChord, onApple, printableChord, } from '@fusion.dev/helix-core';
|
|
8
|
-
import { html } from 'lit';
|
|
8
|
+
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { claimShortcut, releaseShortcut } from '../shortcut.js';
|
|
11
11
|
const typing = (node) => {
|
|
@@ -70,6 +70,7 @@ const ELSEWHERE = {
|
|
|
70
70
|
let HelixHeadlessKbd = class HelixHeadlessKbd extends HelixElement {
|
|
71
71
|
constructor() {
|
|
72
72
|
super(...arguments);
|
|
73
|
+
this.caps = false;
|
|
73
74
|
this.for = '';
|
|
74
75
|
this.keys = '';
|
|
75
76
|
this.handleKeydown = (event) => {
|
|
@@ -134,8 +135,12 @@ let HelixHeadlessKbd = class HelixHeadlessKbd extends HelixElement {
|
|
|
134
135
|
get label() {
|
|
135
136
|
const apple = !this.hydrating && onApple();
|
|
136
137
|
const names = apple ? APPLE : ELSEWHERE;
|
|
137
|
-
const
|
|
138
|
-
|
|
138
|
+
const own = this.keyLabels ?? {};
|
|
139
|
+
const keys = chordParts(this.keys).map((part) => {
|
|
140
|
+
const name = part.toLowerCase();
|
|
141
|
+
return own[name] ?? names[name] ?? (part.length === 1 ? part.toUpperCase() : part);
|
|
142
|
+
});
|
|
143
|
+
return { keys, separator: apple ? '' : '+' };
|
|
139
144
|
}
|
|
140
145
|
listen() {
|
|
141
146
|
if (!this.within || this.keys === '') {
|
|
@@ -157,12 +162,26 @@ let HelixHeadlessKbd = class HelixHeadlessKbd extends HelixElement {
|
|
|
157
162
|
this.finishHydration();
|
|
158
163
|
}
|
|
159
164
|
render() {
|
|
160
|
-
|
|
165
|
+
if (this.keys === '') {
|
|
166
|
+
return html `<kbd part="kbd"><slot></slot></kbd>`;
|
|
167
|
+
}
|
|
168
|
+
const { keys, separator } = this.label;
|
|
169
|
+
return html `<kbd part="kbd">${this.caps ? this.renderChord() : keys.join(separator)}</kbd>`;
|
|
170
|
+
}
|
|
171
|
+
renderChord() {
|
|
172
|
+
const { keys, separator } = this.label;
|
|
173
|
+
return html `${keys.map((key, index) => html `${index > 0 && separator !== '' ? html `<span part="separator">${separator}</span>` : nothing}<span part="key">${key}</span>`)}`;
|
|
161
174
|
}
|
|
162
175
|
};
|
|
176
|
+
__decorate([
|
|
177
|
+
property({ reflect: true, type: Boolean })
|
|
178
|
+
], HelixHeadlessKbd.prototype, "caps", void 0);
|
|
163
179
|
__decorate([
|
|
164
180
|
property()
|
|
165
181
|
], HelixHeadlessKbd.prototype, "for", void 0);
|
|
182
|
+
__decorate([
|
|
183
|
+
property({ attribute: 'key-labels', type: Object })
|
|
184
|
+
], HelixHeadlessKbd.prototype, "keyLabels", void 0);
|
|
166
185
|
__decorate([
|
|
167
186
|
property()
|
|
168
187
|
], HelixHeadlessKbd.prototype, "keys", void 0);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HelixElement, SourceController } from '@fusion.dev/helix-core';
|
|
1
|
+
import { HelixElement, KeyboardNavigationController, SourceController } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary A list of the series in a chart, each name beside the color it is drawn in.
|
|
@@ -21,8 +21,13 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
21
21
|
* **`toggles` makes each entry a button that hides its series.** Every chart
|
|
22
22
|
* reading the same table draws without a hidden series and fits its scale to
|
|
23
23
|
* the rest, and the series keeps its color. The button says whether its
|
|
24
|
-
* series is shown with `aria-pressed`.
|
|
25
|
-
*
|
|
24
|
+
* series is shown with `aria-pressed`. The buttons are one tab stop: the
|
|
25
|
+
* arrow keys move between them, Home and End go to the first and the last,
|
|
26
|
+
* and a typed letter goes to the next name starting with it.
|
|
27
|
+
* `hidden-series` holds the hidden names,
|
|
28
|
+
* so a page can start with some hidden or read which are. Two legends on one
|
|
29
|
+
* table show the same hidden series: the list written last wins, and the
|
|
30
|
+
* other legend takes it for its own entries.
|
|
26
31
|
*
|
|
27
32
|
* @since 0.1.0
|
|
28
33
|
* @status stable
|
|
@@ -99,16 +104,56 @@ export declare class HelixHeadlessLegend extends HelixElement {
|
|
|
99
104
|
*/
|
|
100
105
|
toggles: boolean;
|
|
101
106
|
protected readonly source: SourceController;
|
|
102
|
-
/**
|
|
103
|
-
|
|
107
|
+
/**
|
|
108
|
+
* The toggle that holds the one tab stop, by place: the one a reader was
|
|
109
|
+
* last on, or the first.
|
|
110
|
+
*/
|
|
111
|
+
private stop;
|
|
112
|
+
/**
|
|
113
|
+
* The arrow keys, Home, End and typed letters among the toggles, so a
|
|
114
|
+
* legend of twelve series is one tab stop, as a toolbar of
|
|
115
|
+
* toggle buttons is. Nothing without `toggles`, where there is nothing to
|
|
116
|
+
* press.
|
|
117
|
+
*/
|
|
118
|
+
protected readonly keys: KeyboardNavigationController;
|
|
119
|
+
/** The table this legend last wrote its `hidden-series` to, so leaving undoes it. */
|
|
120
|
+
private wroteTo;
|
|
121
|
+
/** Whether this update writes `hidden-series` to the table, decided before the render. */
|
|
122
|
+
private writes;
|
|
123
|
+
/**
|
|
124
|
+
* Decides who holds the hidden series for this update: this legend, or the
|
|
125
|
+
* table.
|
|
126
|
+
*
|
|
127
|
+
* **This legend, where its own `hidden-series` moved**, by a press, by the
|
|
128
|
+
* page, or by its first value, and where it has a list the table it now
|
|
129
|
+
* reads has not had from it yet. **The table otherwise**, which is a second
|
|
130
|
+
* legend on the same table having hidden something: this one takes the
|
|
131
|
+
* table's list for its own entries and writes nothing back.
|
|
132
|
+
*
|
|
133
|
+
* Writing back on every update is what hung a page with two legends whose
|
|
134
|
+
* lists differed: each write asks every reader of the table to update,
|
|
135
|
+
* which included the other legend, which wrote its own list back. Now the
|
|
136
|
+
* last list written wins and the other legend shows it, as two switches on
|
|
137
|
+
* one lamp do.
|
|
138
|
+
*/
|
|
104
139
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
140
|
+
/**
|
|
141
|
+
* Takes the table's hidden series as this legend's own, for its entries.
|
|
142
|
+
*
|
|
143
|
+
* A name hidden on the table that is not one of this legend's entries stays
|
|
144
|
+
* out of its list: a legend of the rows and one of the columns share a
|
|
145
|
+
* table, and each keeps a list of its own.
|
|
146
|
+
*/
|
|
147
|
+
private follow;
|
|
105
148
|
/**
|
|
106
149
|
* Hands `hidden-series` to the table, where every chart reading it finds
|
|
107
150
|
* it.
|
|
108
151
|
*
|
|
109
152
|
* After the update rather than before, because a server has no table and a
|
|
110
153
|
* hydrating render must draw what the server drew: the charts follow a frame
|
|
111
|
-
* after the legend, which is when they draw at all.
|
|
154
|
+
* after the legend, which is when they draw at all. Only this legend's own
|
|
155
|
+
* entries are written, so a series another legend hid among other names
|
|
156
|
+
* stays hidden.
|
|
112
157
|
*/
|
|
113
158
|
protected updated(changed: PropertyValues<this>): void;
|
|
114
159
|
disconnectedCallback(): void;
|
|
@@ -135,9 +180,11 @@ export declare class HelixHeadlessLegend extends HelixElement {
|
|
|
135
180
|
* The button around a name under `toggles`, behind a seam a tier can move.
|
|
136
181
|
*
|
|
137
182
|
* Pressed while its series is shown, which is the state a reader changes by
|
|
138
|
-
* pressing it: a toggle button says whether its thing is on.
|
|
183
|
+
* pressing it: a toggle button says whether its thing is on. `holds` says
|
|
184
|
+
* whether it is the one tab stop, which is the last toggle a reader was on,
|
|
185
|
+
* the toggle at `index`.
|
|
139
186
|
*/
|
|
140
|
-
protected renderToggle(name: string, off: boolean): TemplateResult;
|
|
187
|
+
protected renderToggle(name: string, off: boolean, index?: number, holds?: boolean): TemplateResult;
|
|
141
188
|
}
|
|
142
189
|
declare global {
|
|
143
190
|
interface HTMLElementTagNameMap {
|
|
@@ -4,9 +4,9 @@ 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 { commaList, customElement, HelixBeforeChangeEvent, HelixElement, requestChange, SourceController, seriesIndex, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { commaList, customElement, HelixBeforeChangeEvent, HelixElement, KeyboardNavigationController, requestChange, SourceController, seriesIndex, seriesKey, typeaheadBy, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
|
-
import { property } from 'lit/decorators.js';
|
|
9
|
+
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { isHidden, toggledNames } from '../hidden-series.js';
|
|
11
11
|
let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
|
|
12
12
|
constructor() {
|
|
@@ -16,25 +16,58 @@ let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
|
|
|
16
16
|
this.label = '';
|
|
17
17
|
this.toggles = false;
|
|
18
18
|
this.source = new SourceController(this);
|
|
19
|
-
this.
|
|
19
|
+
this.stop = 0;
|
|
20
|
+
this.keys = new KeyboardNavigationController(this, {
|
|
21
|
+
items: () => this.toggles
|
|
22
|
+
? [...this.renderRoot.querySelectorAll('[part="toggle"]')].map((button) => ({
|
|
23
|
+
contains: (node) => button.contains(node),
|
|
24
|
+
disabled: false,
|
|
25
|
+
focusItem: () => button.focus(),
|
|
26
|
+
select: () => { },
|
|
27
|
+
selected: false,
|
|
28
|
+
words: button.textContent?.trim() ?? '',
|
|
29
|
+
}))
|
|
30
|
+
: [],
|
|
31
|
+
origin: 'focus',
|
|
32
|
+
selects: () => false,
|
|
33
|
+
typeahead: typeaheadBy((item) => item.words ?? ''),
|
|
34
|
+
});
|
|
35
|
+
this.wroteTo = null;
|
|
36
|
+
this.writes = false;
|
|
20
37
|
}
|
|
21
38
|
willUpdate(changed) {
|
|
22
39
|
if (changed.has('for')) {
|
|
23
40
|
this.source.watch();
|
|
24
41
|
}
|
|
42
|
+
const table = this.source.element;
|
|
43
|
+
const asked = changed.has('hiddenSeries') &&
|
|
44
|
+
!(changed.get('hiddenSeries') === undefined && this.hiddenSeries === '');
|
|
45
|
+
this.writes = asked || (table !== null && table !== this.wroteTo && this.hiddenSeries !== '');
|
|
46
|
+
if (!this.writes && table !== null) {
|
|
47
|
+
this.follow();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
follow() {
|
|
51
|
+
const hidden = this.source.hidden;
|
|
52
|
+
const now = commaList(this.hiddenSeries);
|
|
53
|
+
const next = this.names().filter((name) => hidden.has(seriesKey(name)));
|
|
54
|
+
const same = next.length === now.length &&
|
|
55
|
+
next.every((name) => now.some((one) => seriesKey(one) === seriesKey(name)));
|
|
56
|
+
if (!same) {
|
|
57
|
+
this.hiddenSeries = next.join(', ');
|
|
58
|
+
}
|
|
25
59
|
}
|
|
26
60
|
updated(changed) {
|
|
27
61
|
super.updated(changed);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
this.source.hide(names);
|
|
31
|
-
this.wrote = names.length > 0;
|
|
62
|
+
if (this.writes) {
|
|
63
|
+
this.writes = false;
|
|
64
|
+
this.wroteTo = this.source.hide(commaList(this.hiddenSeries), this.names()) ?? this.wroteTo;
|
|
32
65
|
}
|
|
33
66
|
}
|
|
34
67
|
disconnectedCallback() {
|
|
35
|
-
if (this.
|
|
36
|
-
this.source.hide([]);
|
|
37
|
-
this.
|
|
68
|
+
if (this.wroteTo !== null) {
|
|
69
|
+
this.source.hide([], this.names());
|
|
70
|
+
this.wroteTo = null;
|
|
38
71
|
}
|
|
39
72
|
super.disconnectedCallback();
|
|
40
73
|
}
|
|
@@ -58,8 +91,10 @@ let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
|
|
|
58
91
|
}
|
|
59
92
|
render() {
|
|
60
93
|
const named = this.label || this.source.element?.querySelector('caption')?.textContent?.trim();
|
|
94
|
+
const names = this.names();
|
|
95
|
+
const stop = Math.min(this.stop, names.length - 1);
|
|
61
96
|
return html `<ul aria-label=${named || nothing} part="list" role="list">
|
|
62
|
-
${
|
|
97
|
+
${names.map((name, index) => {
|
|
63
98
|
const off = isHidden(this.hiddenSeries, name);
|
|
64
99
|
return html `<li
|
|
65
100
|
data-series=${seriesIndex(index)}
|
|
@@ -67,17 +102,21 @@ let HelixHeadlessLegend = class HelixHeadlessLegend extends HelixElement {
|
|
|
67
102
|
style="--chart-series: var(--chart-series-${seriesIndex(index)})"
|
|
68
103
|
role="listitem"
|
|
69
104
|
>
|
|
70
|
-
${this.toggles ? this.renderToggle(name, off) : html `<span part="name">${name}</span>`}
|
|
105
|
+
${this.toggles ? this.renderToggle(name, off, index, index === stop) : html `<span part="name">${name}</span>`}
|
|
71
106
|
</li>`;
|
|
72
107
|
})}
|
|
73
108
|
</ul>`;
|
|
74
109
|
}
|
|
75
|
-
renderToggle(name, off) {
|
|
110
|
+
renderToggle(name, off, index = 0, holds = true) {
|
|
76
111
|
return html `<button
|
|
77
112
|
aria-pressed=${off ? 'false' : 'true'}
|
|
78
113
|
part="toggle"
|
|
114
|
+
tabindex=${holds ? '0' : '-1'}
|
|
79
115
|
type="button"
|
|
80
116
|
@click=${() => this.toggle(name)}
|
|
117
|
+
@focus=${() => {
|
|
118
|
+
this.stop = index;
|
|
119
|
+
}}
|
|
81
120
|
>
|
|
82
121
|
<span part="name">${name}</span>
|
|
83
122
|
</button>`;
|
|
@@ -98,6 +137,9 @@ __decorate([
|
|
|
98
137
|
__decorate([
|
|
99
138
|
property({ reflect: true, type: Boolean })
|
|
100
139
|
], HelixHeadlessLegend.prototype, "toggles", void 0);
|
|
140
|
+
__decorate([
|
|
141
|
+
state()
|
|
142
|
+
], HelixHeadlessLegend.prototype, "stop", void 0);
|
|
101
143
|
HelixHeadlessLegend = __decorate([
|
|
102
144
|
customElement('helix-headless-legend')
|
|
103
145
|
], HelixHeadlessLegend);
|
|
@@ -19,9 +19,18 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
19
19
|
* focus stays in the dialog.
|
|
20
20
|
*
|
|
21
21
|
* Set `controls` for the viewer's own previous, next and close controls, named
|
|
22
|
-
* by `previous-label`, `next-label` and `dismiss-label
|
|
23
|
-
*
|
|
24
|
-
*
|
|
22
|
+
* by `previous-label`, `next-label` and `dismiss-label`, whose glyphs you can
|
|
23
|
+
* replace in the `previous-icon`, `next-icon` and `dismiss-icon` slots. Without
|
|
24
|
+
* it, compose the chrome yourself in the `header` and `footer` slots, with
|
|
25
|
+
* buttons that send `--previous`, `--next` and `--close`.
|
|
26
|
+
*
|
|
27
|
+
* **Set `max-zoom` to let a reader zoom into the shown item**, such as `3`.
|
|
28
|
+
* Two fingers pinch it, a double click or a double tap zooms all the way in
|
|
29
|
+
* about the point pressed and back out, and once zoomed one pointer drags it
|
|
30
|
+
* about. `+` and `-` zoom in and out from the keyboard, and `0` puts it back.
|
|
31
|
+
* The scale and the offset are on the `viewport` part as `--lightbox-zoom`,
|
|
32
|
+
* `--lightbox-pan-x` and `--lightbox-pan-y`, written only while zoomed, and a
|
|
33
|
+
* swipe moves to the next item only while the item is at its own size.
|
|
25
34
|
*
|
|
26
35
|
* Each item is a slide: a `group` with the role description in
|
|
27
36
|
* `slide-role-label`, named by its `label` or by `slide-label`. A touch or a pen
|
|
@@ -41,8 +50,11 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
41
50
|
* @documentation https://fusion.dev/helix/components/lightbox
|
|
42
51
|
*
|
|
43
52
|
* @slot - The items, which are `<helix-headless-lightbox-item>` elements.
|
|
53
|
+
* @slot dismiss-icon - Replaces the glyph inside the close control.
|
|
44
54
|
* @slot footer - Content below the item, such as a counter or a thumbnail strip.
|
|
45
55
|
* @slot header - Content above the item, such as a title and a close button.
|
|
56
|
+
* @slot next-icon - Replaces the glyph inside the next control.
|
|
57
|
+
* @slot previous-icon - Replaces the glyph inside the previous control.
|
|
46
58
|
*
|
|
47
59
|
* @event {Event} close - Fired when the viewer closes. The component dispatches it again from the host, because the dialog's own event does not leave the shadow root.
|
|
48
60
|
* @event {HelixActivateEvent} helix-activate - Fired after the shown item changes, when the element already holds the new item.
|
|
@@ -51,19 +63,26 @@ declare const HelixHeadlessLightbox_base: (new (...args: any[]) => import("@fusi
|
|
|
51
63
|
* @event {HelixBeforeOpenEvent} helix-before-open - Fired before the viewer opens. Cancelable.
|
|
52
64
|
* @event {ToggleEvent} toggle - Fired when the viewer opens or closes, with `newState` and `oldState`.
|
|
53
65
|
*
|
|
66
|
+
* @csspart counter - The place of the shown item in the set, drawn with `counter`.
|
|
54
67
|
* @csspart dialog - The native dialog element.
|
|
55
68
|
* @csspart dismiss - The close control, drawn with `controls`.
|
|
56
|
-
* @csspart dismiss-mark - The glyph on the close control.
|
|
69
|
+
* @csspart dismiss-mark - The glyph on the close control, where none is slotted.
|
|
57
70
|
* @csspart live - The live region that announces which item is shown.
|
|
58
71
|
* @csspart next - The control that shows the next item, drawn with `controls`.
|
|
59
|
-
* @csspart next-mark - The glyph on the next control.
|
|
72
|
+
* @csspart next-mark - The glyph on the next control, where none is slotted.
|
|
60
73
|
* @csspart previous - The control that shows the previous item, drawn with `controls`.
|
|
61
|
-
* @csspart previous-mark - The glyph on the previous control.
|
|
74
|
+
* @csspart previous-mark - The glyph on the previous control, where none is slotted.
|
|
62
75
|
* @csspart viewport - The box the current item is shown in.
|
|
63
76
|
*
|
|
77
|
+
* @cssproperty --lightbox-pan-x - How far the zoomed item is moved across from the middle of the viewport, in pixels, toward the right. Written only while zoomed.
|
|
78
|
+
* @cssproperty --lightbox-pan-y - How far the zoomed item is moved down from the middle of the viewport, in pixels. Written only while zoomed.
|
|
79
|
+
* @cssproperty --lightbox-zoom - The scale the shown item is zoomed to, such as `2`. Written only while zoomed.
|
|
80
|
+
*
|
|
64
81
|
* @cssstate fullscreen - While the viewer fills the screen.
|
|
65
82
|
* @cssstate idle - The user has been still long enough for the controls to hide.
|
|
66
83
|
* @cssstate open - While the viewer is open.
|
|
84
|
+
* @cssstate zoomable - While `max-zoom` lets a reader zoom.
|
|
85
|
+
* @cssstate zoomed - While the shown item is zoomed past its own size.
|
|
67
86
|
*/
|
|
68
87
|
export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
69
88
|
/**
|
|
@@ -75,6 +94,13 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
75
94
|
* either end of a set that does not `loop`.
|
|
76
95
|
*/
|
|
77
96
|
controls: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Draws the place of the shown item in the set over the picture, in the
|
|
99
|
+
* words of `status-label`, such as "2 of 5". It hides with the controls while
|
|
100
|
+
* the reader is idle. Screen readers hear the place from the live region, so
|
|
101
|
+
* the drawn copy is hidden from them.
|
|
102
|
+
*/
|
|
103
|
+
counter: boolean;
|
|
78
104
|
/**
|
|
79
105
|
* The close control's accessible name. Translate it with the rest of your
|
|
80
106
|
* interface.
|
|
@@ -97,6 +123,11 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
97
123
|
* Whether moving past the last item returns to the first.
|
|
98
124
|
*/
|
|
99
125
|
loop: boolean;
|
|
126
|
+
/**
|
|
127
|
+
* How far a reader can zoom into the shown item, as a scale, such as `3`.
|
|
128
|
+
* `1`, the default, turns zooming off.
|
|
129
|
+
*/
|
|
130
|
+
maxZoom: number;
|
|
100
131
|
/**
|
|
101
132
|
* The next control's accessible name.
|
|
102
133
|
*/
|
|
@@ -132,6 +163,14 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
132
163
|
/** What the live region is currently saying. */
|
|
133
164
|
private announcement;
|
|
134
165
|
protected readonly swipes: SwipeController;
|
|
166
|
+
private readonly zoomer;
|
|
167
|
+
/** Writes the zoom on the viewport, and nothing at the item's own size. */
|
|
168
|
+
private drawZoom;
|
|
169
|
+
/**
|
|
170
|
+
* Zooms the shown item to `scale`, held between `1` and `max-zoom`, about
|
|
171
|
+
* the middle of the viewport.
|
|
172
|
+
*/
|
|
173
|
+
zoomTo(scale: number): void;
|
|
135
174
|
private readonly fullscreen;
|
|
136
175
|
private readonly idle;
|
|
137
176
|
/**
|
|
@@ -202,6 +241,8 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
202
241
|
* a reader having no way to know which one this component thinks it is.
|
|
203
242
|
*/
|
|
204
243
|
private readonly handleKeydown;
|
|
244
|
+
/** `+` and `-` zoom in and out by half again, and `0` puts the item back. Returns whether it was one. */
|
|
245
|
+
private zoomKey;
|
|
205
246
|
/** Home and End, which are an index rather than a step. */
|
|
206
247
|
private toEnd;
|
|
207
248
|
/** The item on screen: the one `active` names, or the first where it names none. */
|
|
@@ -236,6 +277,8 @@ export declare class HelixHeadlessLightbox extends HelixHeadlessLightbox_base {
|
|
|
236
277
|
* every page load.
|
|
237
278
|
*/
|
|
238
279
|
private say;
|
|
280
|
+
/** The shown item's place in the set, in the words of `status-label`. */
|
|
281
|
+
private place;
|
|
239
282
|
protected render(): TemplateResult;
|
|
240
283
|
/**
|
|
241
284
|
* The viewer's own controls, behind a seam a tier above can move.
|