@fusion.dev/helix-headless 0.147.0 → 0.149.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 +11222 -2332
- package/dist/accordion/item/accordion-item.d.ts +5 -2
- package/dist/accordion/item/accordion-item.js +11 -7
- package/dist/accordion/root/accordion-root.js +4 -6
- package/dist/announcement/root/announcement-root.d.ts +61 -5
- package/dist/announcement/root/announcement-root.js +126 -20
- package/dist/area-chart/root/area-chart-root.d.ts +11 -0
- package/dist/area-chart/root/area-chart-root.js +21 -9
- package/dist/avatar/group/avatar-group.d.ts +10 -2
- package/dist/avatar/group/avatar-group.js +10 -5
- package/dist/badge/count.d.ts +19 -0
- package/dist/badge/count.js +20 -0
- package/dist/badge/root/badge-root.d.ts +6 -2
- package/dist/badge/root/badge-root.js +8 -22
- package/dist/bar-chart/root/bar-chart-root.d.ts +13 -1
- package/dist/bar-chart/root/bar-chart-root.js +17 -4
- package/dist/blockquote/root/blockquote-root.d.ts +66 -8
- package/dist/blockquote/root/blockquote-root.js +85 -8
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +2 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +8 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +5 -2
- package/dist/button/root/button-root.d.ts +10 -1
- package/dist/button/root/button-root.js +3 -2
- package/dist/button-group/arrows.d.ts +14 -0
- package/dist/button-group/arrows.js +10 -0
- package/dist/button-group/root/button-group-root.d.ts +144 -3
- package/dist/button-group/root/button-group-root.js +142 -2
- package/dist/callout/root/callout-root.d.ts +16 -2
- package/dist/callout/root/callout-root.js +16 -4
- package/dist/canvas/describe.d.ts +10 -0
- package/dist/canvas/describe.js +9 -0
- package/dist/canvas/edge-pan.d.ts +61 -0
- package/dist/canvas/edge-pan.js +63 -0
- package/dist/canvas/neighbor.d.ts +17 -0
- package/dist/canvas/neighbor.js +1 -0
- package/dist/canvas/node/canvas-node.d.ts +12 -2
- package/dist/canvas/node/canvas-node.js +8 -3
- package/dist/canvas/root/canvas-document.d.ts +10 -0
- package/dist/canvas/root/canvas-document.js +1 -0
- package/dist/canvas/root/canvas-root.d.ts +168 -9
- package/dist/canvas/root/canvas-root.js +239 -69
- package/dist/canvas/snap.d.ts +42 -0
- package/dist/canvas/snap.js +32 -0
- package/dist/carousel/root/carousel-root.d.ts +9 -3
- package/dist/carousel/root/carousel-root.js +17 -10
- package/dist/chat/composer/chat-composer.d.ts +5 -0
- package/dist/chat/composer/chat-composer.js +4 -1
- package/dist/chat/message/chat-message.d.ts +9 -5
- package/dist/chat/message/chat-message.js +8 -4
- package/dist/chat/naming.js +2 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +38 -14
- package/dist/checkbox/root/checkbox-root.d.ts +11 -0
- package/dist/checkbox/root/checkbox-root.js +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +24 -0
- package/dist/checkbox-group/root/checkbox-group-root.js +28 -12
- package/dist/checkbox-group/select-all.d.ts +11 -0
- package/dist/checkbox-group/select-all.js +5 -0
- package/dist/code-block/root/code-block-root.d.ts +20 -8
- package/dist/code-block/root/code-block-root.js +16 -5
- package/dist/color-input/root/color-input-root.d.ts +13 -0
- package/dist/color-input/root/color-input-root.js +18 -5
- package/dist/color-picker/root/color-picker-root.d.ts +19 -3
- package/dist/color-picker/root/color-picker-root.js +52 -24
- package/dist/color-picker/wheel.d.ts +11 -0
- package/dist/color-picker/wheel.js +9 -0
- package/dist/combobox/root/combobox-root.d.ts +106 -18
- package/dist/combobox/root/combobox-root.js +101 -26
- package/dist/command/root/command-root.d.ts +19 -9
- package/dist/command/root/command-root.js +9 -4
- package/dist/copy-button/root/copy-button-root.d.ts +5 -0
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/root/data-table-root.d.ts +171 -29
- package/dist/data-table/root/data-table-root.js +284 -161
- package/dist/date-input/root/date-input-root.d.ts +32 -9
- package/dist/date-input/root/date-input-root.js +66 -44
- package/dist/date-picker/root/date-picker-root.d.ts +38 -15
- package/dist/date-picker/root/date-picker-root.js +52 -33
- package/dist/description-list/item/description-list-item.d.ts +4 -0
- package/dist/description-list/item/description-list-item.js +7 -1
- package/dist/dialog/root/dialog-root.d.ts +12 -1
- package/dist/dialog/root/dialog-root.js +11 -4
- package/dist/divider/root/divider-root.d.ts +45 -16
- package/dist/divider/root/divider-root.js +28 -4
- package/dist/donut-chart/root/donut-chart-root.d.ts +5 -0
- package/dist/donut-chart/root/donut-chart-root.js +8 -5
- package/dist/drawer/root/drawer-root.d.ts +12 -1
- package/dist/drawer/root/drawer-root.js +9 -2
- package/dist/drilldown/item/drilldown-item.js +3 -4
- package/dist/drilldown/root/drilldown-root.d.ts +5 -0
- package/dist/drilldown/root/drilldown-root.js +4 -1
- package/dist/element-events.generated.js +26 -3
- package/dist/empty/root/empty-root.d.ts +17 -3
- package/dist/empty/root/empty-root.js +29 -5
- package/dist/file-input/root/file-input-root.d.ts +18 -3
- package/dist/file-input/root/file-input-root.js +34 -18
- package/dist/file-input/status.js +2 -1
- package/dist/filter-input/chip/filter-chip.d.ts +13 -0
- package/dist/filter-input/chip/filter-chip.js +7 -3
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +3 -1
- package/dist/filter-input/root/filter-input-root.d.ts +20 -3
- package/dist/filter-input/root/filter-input-root.js +8 -4
- package/dist/format-date/fields.d.ts +20 -0
- package/dist/format-date/fields.js +14 -0
- package/dist/format-date/options.d.ts +2 -1
- package/dist/format-date/options.js +9 -38
- package/dist/format-date/root/format-date-root.d.ts +55 -5
- package/dist/format-date/root/format-date-root.js +29 -34
- package/dist/graph/root/graph-model.d.ts +11 -0
- package/dist/graph/root/graph-model.js +4 -0
- package/dist/graph/root/graph-root.d.ts +101 -14
- package/dist/graph/root/graph-root.js +140 -46
- package/dist/heatmap/root/heatmap-root.d.ts +37 -4
- package/dist/heatmap/root/heatmap-root.js +51 -16
- package/dist/icon-button/root/icon-button-root.d.ts +5 -0
- package/dist/icon-button/root/icon-button-root.js +1 -0
- package/dist/image/root/image-root.d.ts +11 -0
- package/dist/input/root/input-root.d.ts +5 -0
- package/dist/input/root/input-root.js +4 -1
- package/dist/kbd/root/kbd-root.js +1 -2
- package/dist/legend/root/legend-root.js +4 -17
- package/dist/lightbox/root/lightbox-root.d.ts +14 -4
- package/dist/lightbox/root/lightbox-root.js +25 -7
- package/dist/line-chart/root/line-chart-root.d.ts +5 -0
- package/dist/line-chart/root/line-chart-root.js +4 -2
- package/dist/list/item/list-item.d.ts +32 -0
- package/dist/list/item/list-item.js +34 -7
- package/dist/list/root/list-root.d.ts +87 -0
- package/dist/list/root/list-root.js +119 -23
- package/dist/listbox/reorder/index.d.ts +1 -0
- package/dist/listbox/reorder/index.js +4 -0
- package/dist/listbox/reorder/listbox-reorder.d.ts +83 -0
- package/dist/listbox/reorder/listbox-reorder.js +151 -0
- package/dist/listbox/root/listbox-root.d.ts +185 -33
- package/dist/listbox/root/listbox-root.js +166 -136
- package/dist/loader/root/loader-root.d.ts +5 -0
- package/dist/loader/root/loader-root.js +3 -1
- package/dist/map/area/map-area.d.ts +5 -0
- package/dist/map/area/map-area.js +3 -1
- package/dist/map/buildings/map-buildings.d.ts +5 -0
- package/dist/map/buildings/map-buildings.js +3 -1
- package/dist/map/contours/map-contours.d.ts +5 -0
- package/dist/map/contours/map-contours.js +3 -1
- package/dist/map/landcover/map-landcover.d.ts +5 -0
- package/dist/map/landcover/map-landcover.js +3 -1
- package/dist/map/marker/map-marker.d.ts +18 -2
- package/dist/map/marker/map-marker.js +13 -5
- package/dist/map/points/map-points.d.ts +5 -0
- package/dist/map/points/map-points.js +6 -4
- package/dist/map/position/map-position.d.ts +5 -0
- package/dist/map/position/map-position.js +3 -1
- package/dist/map/raster/map-raster.d.ts +5 -0
- package/dist/map/raster/map-raster.js +3 -1
- package/dist/map/root/map-root.d.ts +73 -16
- package/dist/map/root/map-root.js +122 -44
- package/dist/map/route/map-route.d.ts +5 -0
- package/dist/map/route/map-route.js +3 -1
- package/dist/map/terrain/map-terrain.d.ts +5 -0
- package/dist/map/terrain/map-terrain.js +3 -1
- package/dist/megamenu/root/megamenu-root.js +4 -11
- package/dist/menu/root/menu-root.d.ts +7 -2
- package/dist/menu/root/menu-root.js +3 -1
- package/dist/meter/root/meter-root.d.ts +16 -3
- package/dist/meter/root/meter-root.js +12 -5
- package/dist/navigation/root/navigation-root.d.ts +5 -0
- package/dist/navigation/root/navigation-root.js +7 -8
- package/dist/notifications/group/notification-group.d.ts +8 -1
- package/dist/notifications/group/notification-group.js +12 -6
- package/dist/notifications/notification/notification.d.ts +17 -1
- package/dist/notifications/notification/notification.js +6 -2
- package/dist/notifications/root/notifications-root.d.ts +49 -5
- package/dist/notifications/root/notifications-root.js +36 -8
- package/dist/number-input/root/number-input-root.d.ts +21 -8
- package/dist/number-input/root/number-input-root.js +26 -11
- package/dist/object-inspector/root/object-inspector-root.d.ts +56 -13
- package/dist/object-inspector/root/object-inspector-root.js +41 -30
- package/dist/outline/root/outline-root.d.ts +5 -0
- package/dist/outline/root/outline-root.js +3 -1
- package/dist/pagination/root/pagination-root.d.ts +7 -1
- package/dist/pagination/root/pagination-root.js +16 -7
- package/dist/pagination/size/pagination-size.d.ts +8 -3
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pagination/summary/pagination-summary.d.ts +8 -6
- package/dist/pagination/summary/pagination-summary.js +4 -9
- package/dist/pin-input/code.d.ts +23 -0
- package/dist/pin-input/code.js +21 -0
- package/dist/pin-input/root/pin-input-root.d.ts +9 -3
- package/dist/pin-input/root/pin-input-root.js +13 -23
- package/dist/popover/root/popover-root.d.ts +12 -2
- package/dist/popover/root/popover-root.js +10 -4
- package/dist/progress/root/progress-root.d.ts +7 -2
- package/dist/progress/root/progress-root.js +5 -2
- package/dist/qr-code/name.d.ts +3 -2
- package/dist/qr-code/name.js +2 -2
- package/dist/qr-code/root/qr-code-root.d.ts +26 -5
- package/dist/qr-code/root/qr-code-root.js +27 -6
- package/dist/radio/group/radio-group.d.ts +11 -0
- package/dist/radio/group/radio-group.js +8 -2
- package/dist/rating/root/rating-root.d.ts +12 -1
- package/dist/rating/root/rating-root.js +10 -3
- package/dist/scatter-chart/measures.d.ts +22 -0
- package/dist/scatter-chart/measures.js +11 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +22 -8
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -23
- package/dist/select/root/select-root.d.ts +67 -8
- package/dist/select/root/select-root.js +45 -11
- package/dist/skip-link/root/skip-link-root.d.ts +5 -0
- package/dist/skip-link/root/skip-link-root.js +3 -1
- package/dist/slider/root/slider-root.d.ts +7 -2
- package/dist/slider/root/slider-root.js +11 -5
- package/dist/sparkline/readings.d.ts +15 -5
- package/dist/sparkline/readings.js +3 -3
- package/dist/sparkline/root/sparkline-root.d.ts +9 -4
- package/dist/sparkline/root/sparkline-root.js +9 -3
- package/dist/speed-dial/group/speed-dial-group.d.ts +48 -0
- package/dist/speed-dial/group/speed-dial-group.js +43 -0
- package/dist/speed-dial/index.d.ts +1 -0
- package/dist/speed-dial/index.js +1 -0
- package/dist/speed-dial/item/speed-dial-item.d.ts +26 -1
- package/dist/speed-dial/item/speed-dial-item.js +41 -3
- package/dist/speed-dial/long-press.d.ts +50 -0
- package/dist/speed-dial/long-press.js +48 -0
- package/dist/speed-dial/root/speed-dial-root.d.ts +85 -1
- package/dist/speed-dial/root/speed-dial-root.js +117 -5
- package/dist/splitter/root/splitter-root.d.ts +12 -3
- package/dist/splitter/root/splitter-root.js +22 -4
- package/dist/steps/root/steps-root.d.ts +9 -2
- package/dist/steps/root/steps-root.js +6 -3
- package/dist/steps/step/step.d.ts +12 -0
- package/dist/steps/step/step.js +11 -2
- package/dist/switch/root/switch-root.d.ts +11 -0
- package/dist/switch/root/switch-root.js +8 -2
- package/dist/table/cell/table-cell.d.ts +8 -1
- package/dist/table/cell/table-cell.js +6 -2
- package/dist/table/column/table-column.d.ts +11 -4
- package/dist/table/column/table-column.js +15 -10
- package/dist/table/grid-controller.d.ts +122 -0
- package/dist/table/grid-controller.js +299 -0
- package/dist/table/root/table-root.d.ts +154 -8
- package/dist/table/root/table-root.js +197 -38
- package/dist/table/row/table-row.d.ts +55 -1
- package/dist/table/row/table-row.js +60 -7
- package/dist/tabs/root/tabs-root.d.ts +5 -0
- package/dist/tabs/root/tabs-root.js +3 -1
- package/dist/tag/group/tag-group.d.ts +5 -0
- package/dist/tag/group/tag-group.js +8 -15
- package/dist/tag/root/tag-root.d.ts +14 -1
- package/dist/tag/root/tag-root.js +11 -8
- package/dist/textarea/root/textarea-root.d.ts +5 -0
- package/dist/textarea/root/textarea-root.js +3 -1
- package/dist/time-input/root/time-input-root.d.ts +14 -7
- package/dist/time-input/root/time-input-root.js +43 -32
- package/dist/time-picker/root/time-picker-root.d.ts +16 -7
- package/dist/time-picker/root/time-picker-root.js +28 -12
- package/dist/toast/item/toast-item.d.ts +13 -3
- package/dist/toast/item/toast-item.js +2 -0
- package/dist/toast/root/toast-root.d.ts +22 -2
- package/dist/toast/root/toast-root.js +24 -17
- package/dist/toggle/group/toggle-group.js +3 -5
- package/dist/toolbar/root/toolbar-root.d.ts +36 -0
- package/dist/toolbar/root/toolbar-root.js +43 -9
- package/dist/tooltip/root/tooltip-root.d.ts +27 -17
- package/dist/tooltip/root/tooltip-root.js +1 -2
- package/dist/tour/root/tour-root.d.ts +8 -2
- package/dist/tour/root/tour-root.js +4 -2
- package/dist/tour/stop/tour-stop.d.ts +5 -0
- package/dist/tour/stop/tour-stop.js +6 -1
- package/dist/tree/grip.d.ts +5 -0
- package/dist/tree/grip.js +1 -0
- package/dist/tree/item/tree-item.d.ts +24 -0
- package/dist/tree/item/tree-item.js +27 -5
- package/dist/tree/root/tree-root.d.ts +66 -1
- package/dist/tree/root/tree-root.js +77 -5
- package/dist/trend/root/trend-root.d.ts +20 -4
- package/dist/trend/root/trend-root.js +20 -5
- package/dist/video/root/video-root.d.ts +23 -3
- package/dist/video/root/video-root.js +56 -15
- 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/root/video-playlist-root.d.ts +5 -0
- package/dist/video-playlist/root/video-playlist-root.js +3 -1
- package/dist/virtual-list/root/virtual-list-root.d.ts +19 -3
- package/dist/virtual-list/root/virtual-list-root.js +10 -19
- package/lint.json +1 -1
- package/package.json +7 -6
- package/types/jsx.d.ts +6005 -2114
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1594 -676
- package/types/words.d.ts +3280 -0
- package/dist/kbd/keys.d.ts +0 -29
- package/dist/kbd/keys.js +0 -52
- package/dist/toast/hotkey.d.ts +0 -22
- package/dist/toast/hotkey.js +0 -23
- package/dist/tooltip/focus-target.d.ts +0 -6
- package/dist/tooltip/focus-target.js +0 -9
|
@@ -4,10 +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 { anchorElement, arrowReach, customElement, elementById, HelixElement, hostAria, linkDescription, MixinControllerOpen, OpenPhaseController, onUnlessFalse, PopoverController, reportRuntime, sideOf, unlinkDescription, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { anchorElement, arrowReach, customElement, elementById, focusTarget, HelixElement, hostAria, linkDescription, MixinControllerOpen, OpenPhaseController, onUnlessFalse, PopoverController, reportRuntime, sideOf, unlinkDescription, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property, state } from 'lit/decorators.js';
|
|
10
|
-
import { focusTarget } from '../focus-target.js';
|
|
11
10
|
const GENERIC = new Set(['div', 'p', 'section', 'span']);
|
|
12
11
|
const WARMTH = Symbol.for('fusion.helix.tooltip.warmth');
|
|
13
12
|
const warmth = () => {
|
|
@@ -76,6 +76,12 @@ declare const HelixHeadlessTour_base: (new (...args: any[]) => import("@fusion.d
|
|
|
76
76
|
* @cssstate waiting - While the tour waits at a `wait` stop for its target to be on the page.
|
|
77
77
|
*/
|
|
78
78
|
export declare class HelixHeadlessTour extends HelixHeadlessTour_base {
|
|
79
|
+
/**
|
|
80
|
+
* The key this family's words are registered under, its styled tag:
|
|
81
|
+
* `registerWords('de', { 'helix-tour': { progressLabel: '{index} von {count}' } })`.
|
|
82
|
+
* A stop's own words are under `helix-tour-stop`.
|
|
83
|
+
*/
|
|
84
|
+
static words: string;
|
|
79
85
|
/**
|
|
80
86
|
* Label for the control that goes back, passed to every stop.
|
|
81
87
|
*/
|
|
@@ -117,8 +123,8 @@ export declare class HelixHeadlessTour extends HelixHeadlessTour_base {
|
|
|
117
123
|
*/
|
|
118
124
|
progress: boolean;
|
|
119
125
|
/**
|
|
120
|
-
* Each stop's place in the run, with `{index}` and `{count}` filled in
|
|
121
|
-
* Translate it with the rest of your text.
|
|
126
|
+
* Each stop's place in the run, with `{index}` and `{count}` filled in and
|
|
127
|
+
* written in the locale. Translate it with the rest of your text.
|
|
122
128
|
*/
|
|
123
129
|
progressLabel: string;
|
|
124
130
|
/**
|
|
@@ -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 { controlsIn, customElement, deepActiveElement, deepContains,
|
|
7
|
+
import { controlsIn, customElement, deepActiveElement, deepContains, formatWords, HelixActivateEvent, HelixBeforeActivateEvent, HelixCompleteEvent, HelixElement, HelixTourStatusEvent, hostAria, inlineStep, keyClaimed, MixinControllerOpen, requestChange, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property, queryAssignedElements, state } from 'lit/decorators.js';
|
|
10
10
|
import { stopBefore } from '../back.js';
|
|
@@ -62,6 +62,7 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
62
62
|
this.followed = false;
|
|
63
63
|
this.veiled = false;
|
|
64
64
|
}
|
|
65
|
+
static { this.words = 'helix-tour'; }
|
|
65
66
|
get index() {
|
|
66
67
|
return this.indexState ?? this.defaultIndex;
|
|
67
68
|
}
|
|
@@ -218,7 +219,7 @@ let HelixHeadlessTour = class HelixHeadlessTour extends MixinControllerOpen(Heli
|
|
|
218
219
|
stop.current = this.open && index === at;
|
|
219
220
|
stop.first = index === 0;
|
|
220
221
|
stop.last = index === stops.length - 1;
|
|
221
|
-
stop.position =
|
|
222
|
+
stop.position = formatWords(this, 'progressLabel', {
|
|
222
223
|
count: stops.length,
|
|
223
224
|
index: index + 1,
|
|
224
225
|
});
|
|
@@ -346,6 +347,7 @@ __decorate([
|
|
|
346
347
|
property({ type: Boolean })
|
|
347
348
|
], HelixHeadlessTour.prototype, "progress", void 0);
|
|
348
349
|
__decorate([
|
|
350
|
+
words,
|
|
349
351
|
property({ attribute: 'progress-label' })
|
|
350
352
|
], HelixHeadlessTour.prototype, "progressLabel", void 0);
|
|
351
353
|
__decorate([
|
|
@@ -86,6 +86,11 @@ import '../../button/index.js';
|
|
|
86
86
|
* @cssstate placed-top - The panel sits above its target.
|
|
87
87
|
*/
|
|
88
88
|
export declare class HelixHeadlessTourStop extends HelixElement {
|
|
89
|
+
/**
|
|
90
|
+
* The key this part's words are registered under, its styled tag:
|
|
91
|
+
* `registerWords('de', { 'helix-tour-stop': { nextLabel: 'Weiter' } })`.
|
|
92
|
+
*/
|
|
93
|
+
static words: string;
|
|
89
94
|
/**
|
|
90
95
|
* Label for the control that goes back.
|
|
91
96
|
*/
|
|
@@ -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 { arrowReach, customElement, elementById, HelixElement, HelixTourAskEvent, PopoverController, reflectElements, sideOf, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { arrowReach, customElement, elementById, HelixElement, HelixTourAskEvent, PopoverController, reflectElements, sideOf, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { nothing } from 'lit';
|
|
9
9
|
import { property, state } from 'lit/decorators.js';
|
|
10
10
|
import { html } from 'lit/static-html.js';
|
|
@@ -46,6 +46,7 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
46
46
|
surface: () => this.partNamed('bubble'),
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
+
static { this.words = 'helix-tour-stop'; }
|
|
49
50
|
get target() {
|
|
50
51
|
return this.for === '' ? null : elementById(this, this.for);
|
|
51
52
|
}
|
|
@@ -140,12 +141,14 @@ let HelixHeadlessTourStop = class HelixHeadlessTourStop extends HelixElement {
|
|
|
140
141
|
}
|
|
141
142
|
};
|
|
142
143
|
__decorate([
|
|
144
|
+
words,
|
|
143
145
|
property({ attribute: 'back-label' })
|
|
144
146
|
], HelixHeadlessTourStop.prototype, "backLabel", void 0);
|
|
145
147
|
__decorate([
|
|
146
148
|
property({ reflect: true, type: Boolean })
|
|
147
149
|
], HelixHeadlessTourStop.prototype, "current", void 0);
|
|
148
150
|
__decorate([
|
|
151
|
+
words,
|
|
149
152
|
property({ attribute: 'done-label' })
|
|
150
153
|
], HelixHeadlessTourStop.prototype, "doneLabel", void 0);
|
|
151
154
|
__decorate([
|
|
@@ -161,6 +164,7 @@ __decorate([
|
|
|
161
164
|
property({ reflect: true, type: Boolean })
|
|
162
165
|
], HelixHeadlessTourStop.prototype, "last", void 0);
|
|
163
166
|
__decorate([
|
|
167
|
+
words,
|
|
164
168
|
property({ attribute: 'next-label' })
|
|
165
169
|
], HelixHeadlessTourStop.prototype, "nextLabel", void 0);
|
|
166
170
|
__decorate([
|
|
@@ -173,6 +177,7 @@ __decorate([
|
|
|
173
177
|
property({ attribute: false })
|
|
174
178
|
], HelixHeadlessTourStop.prototype, "progress", void 0);
|
|
175
179
|
__decorate([
|
|
180
|
+
words,
|
|
176
181
|
property({ attribute: 'skip-label' })
|
|
177
182
|
], HelixHeadlessTourStop.prototype, "skipLabel", void 0);
|
|
178
183
|
__decorate([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const fromGrip = (event) => Boolean(event.composedPath()[0]?.closest?.('[part="grip"]'));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
/** Where an item stands in a move: the item being moved, or the one the drop indicator is beside. */
|
|
4
|
+
export type TreeItemMove = 'dragging' | 'drop-after' | 'drop-before';
|
|
3
5
|
declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
|
|
4
6
|
/**
|
|
5
7
|
* @summary One node in a tree.
|
|
@@ -31,6 +33,11 @@ declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusi
|
|
|
31
33
|
* sends `helix-load`, the row says it is busy, and the children you add appear
|
|
32
34
|
* in it. Remove `lazy` once they are in.
|
|
33
35
|
*
|
|
36
|
+
* **In a `reorderable` tree, the row has a grip** at its far end, which a
|
|
37
|
+
* pointer drags to move the item among its siblings. The tree says which item
|
|
38
|
+
* is moving and where the drop indicator is, with the `dragging`,
|
|
39
|
+
* `drop-before`, and `drop-after` states.
|
|
40
|
+
*
|
|
34
41
|
* @since 0.1.0
|
|
35
42
|
* @status stable
|
|
36
43
|
* @aliases TreeNode, Branch, Leaf
|
|
@@ -51,6 +58,8 @@ declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusi
|
|
|
51
58
|
* @csspart checkbox - The check mark's box, in a tree with `selection-mode="multiple"`.
|
|
52
59
|
* @csspart checkbox-checked - The check mark's box while the item is checked.
|
|
53
60
|
* @csspart checkbox-mixed - The check mark's box while some of a branch's items are checked.
|
|
61
|
+
* @csspart grip - The handle a pointer drags to move the item, in a `reorderable` tree. Hidden from screen readers, which move the item with Alt and an arrow.
|
|
62
|
+
* @csspart grip-mark - The icon on the grip.
|
|
54
63
|
* @csspart group - The container for nested items.
|
|
55
64
|
* @csspart item - The node, and the focus target unless `href` moves it to the row.
|
|
56
65
|
* @csspart label - The label text.
|
|
@@ -60,6 +69,9 @@ declare const HelixHeadlessTreeItem_base: (new (...args: any[]) => import("@fusi
|
|
|
60
69
|
* @cssproperty --tree-level - How deep this row sits, counting from one as `aria-level` does, for the indent.
|
|
61
70
|
*
|
|
62
71
|
* @cssstate checked - While it is checked, in a tree with `selection-mode="multiple"`.
|
|
72
|
+
* @cssstate dragging - The item is being moved, in a `reorderable` tree.
|
|
73
|
+
* @cssstate drop-after - The item being moved goes after this one when it is dropped.
|
|
74
|
+
* @cssstate drop-before - The item being moved goes before this one when it is dropped.
|
|
63
75
|
* @cssstate loading - While a `lazy` item is open and its children have not arrived.
|
|
64
76
|
* @cssstate mixed - While some of a branch's items are checked, in a tree with `selection-mode="multiple"`.
|
|
65
77
|
* @cssstate open - While its children are shown.
|
|
@@ -81,6 +93,11 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
81
93
|
* reach it, so a reader knows it is there.
|
|
82
94
|
*/
|
|
83
95
|
disabled: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* @internal Whether the row draws a grip, written by a `reorderable` tree.
|
|
98
|
+
* No attribute: it is coordination between elements, as `focusable` is.
|
|
99
|
+
*/
|
|
100
|
+
grip: boolean;
|
|
84
101
|
/**
|
|
85
102
|
* @internal Set by the tree: whether a branch heads the list under it, as
|
|
86
103
|
* under `nesting="heading"`, or is not chosen at all, as under
|
|
@@ -124,6 +141,11 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
124
141
|
* hydrates.
|
|
125
142
|
*/
|
|
126
143
|
level?: number;
|
|
144
|
+
/**
|
|
145
|
+
* @internal Where the item stands in a move, written by a `reorderable`
|
|
146
|
+
* tree: the item being moved, or the one the drop indicator is beside.
|
|
147
|
+
*/
|
|
148
|
+
move?: TreeItemMove | undefined;
|
|
127
149
|
/**
|
|
128
150
|
* The link's `rel` value, which describes how the linked page relates to this
|
|
129
151
|
* one.
|
|
@@ -190,6 +212,8 @@ export declare class HelixHeadlessTreeItem extends HelixHeadlessTreeItem_base {
|
|
|
190
212
|
* row rather than the wrapper around it.
|
|
191
213
|
*/
|
|
192
214
|
focusItem(): void;
|
|
215
|
+
/** @internal The element that takes focus for this node, read by the tree. */
|
|
216
|
+
get focusTarget(): HTMLElement | null | undefined;
|
|
193
217
|
/** Selects this node and sends `helix-select`. A disabled node sends nothing. */
|
|
194
218
|
select(): void;
|
|
195
219
|
/**
|
|
@@ -5,16 +5,18 @@ 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 { customElement, HelixElement, HelixLoadEvent, HelixSelectEvent, MixinControllerOpen, } from '@fusion.dev/helix-core';
|
|
8
|
-
import { caretDown, check, minus } from '@fusion.dev/helix-icons';
|
|
8
|
+
import { caretDown, check, dotsSixVertical, minus } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
11
11
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
12
|
+
import { fromGrip } from '../grip.js';
|
|
12
13
|
let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerOpen(HelixElement) {
|
|
13
14
|
constructor() {
|
|
14
15
|
super(...arguments);
|
|
15
16
|
this.checkable = false;
|
|
16
17
|
this.checked = false;
|
|
17
18
|
this.disabled = false;
|
|
19
|
+
this.grip = false;
|
|
18
20
|
this.heads = false;
|
|
19
21
|
this.href = '';
|
|
20
22
|
this.lazy = false;
|
|
@@ -35,6 +37,10 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
35
37
|
this.toggleOpen();
|
|
36
38
|
};
|
|
37
39
|
this.handleRowClick = (event) => {
|
|
40
|
+
if (fromGrip(event)) {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
38
44
|
const onLink = event.composedPath().some((node) => node instanceof HTMLAnchorElement);
|
|
39
45
|
if (this.disabled) {
|
|
40
46
|
event.preventDefault();
|
|
@@ -70,9 +76,10 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
70
76
|
return this.branch || this.lazy;
|
|
71
77
|
}
|
|
72
78
|
focusItem() {
|
|
73
|
-
this.
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
this.focusTarget?.focus({ preventScroll: true });
|
|
80
|
+
}
|
|
81
|
+
get focusTarget() {
|
|
82
|
+
return this.renderRoot?.querySelector(this.href === '' ? '[part="item"]' : '[part="row"]');
|
|
76
83
|
}
|
|
77
84
|
select() {
|
|
78
85
|
if (this.disabled) {
|
|
@@ -136,7 +143,13 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
136
143
|
return html `${this.isBranch ? this.renderToggle() : nothing}${this.renderCheckbox()}
|
|
137
144
|
<slot name="start"></slot>
|
|
138
145
|
<span part="label"><slot></slot></span>
|
|
139
|
-
<slot name="end"></slot
|
|
146
|
+
<slot name="end"></slot>${this.grip && !this.disabled
|
|
147
|
+
? html `<span part="grip" aria-hidden="true"
|
|
148
|
+
><svg part="grip-mark" fill="currentColor" viewBox=${dotsSixVertical.viewBox}>
|
|
149
|
+
${unsafeSVG(dotsSixVertical.content)}
|
|
150
|
+
</svg></span
|
|
151
|
+
>`
|
|
152
|
+
: nothing}`;
|
|
140
153
|
}
|
|
141
154
|
willUpdate(changed) {
|
|
142
155
|
super.willUpdate(changed);
|
|
@@ -144,6 +157,9 @@ let HelixHeadlessTreeItem = class HelixHeadlessTreeItem extends MixinControllerO
|
|
|
144
157
|
this.toggleState('checked', this.checkable && this.checked === true);
|
|
145
158
|
this.toggleState('mixed', this.checkable && this.checked === 'mixed');
|
|
146
159
|
this.toggleState('loading', this.open && this.lazy);
|
|
160
|
+
this.toggleState('dragging', this.move === 'dragging');
|
|
161
|
+
this.toggleState('drop-after', this.move === 'drop-after');
|
|
162
|
+
this.toggleState('drop-before', this.move === 'drop-before');
|
|
147
163
|
if (this.childrenKnown) {
|
|
148
164
|
this.branch = this.knownChildren.some((child) => child.slot === 'children');
|
|
149
165
|
}
|
|
@@ -221,6 +237,9 @@ __decorate([
|
|
|
221
237
|
__decorate([
|
|
222
238
|
property({ reflect: true, type: Boolean })
|
|
223
239
|
], HelixHeadlessTreeItem.prototype, "disabled", void 0);
|
|
240
|
+
__decorate([
|
|
241
|
+
property({ attribute: false })
|
|
242
|
+
], HelixHeadlessTreeItem.prototype, "grip", void 0);
|
|
224
243
|
__decorate([
|
|
225
244
|
property({ attribute: false })
|
|
226
245
|
], HelixHeadlessTreeItem.prototype, "heads", void 0);
|
|
@@ -233,6 +252,9 @@ __decorate([
|
|
|
233
252
|
__decorate([
|
|
234
253
|
property({ attribute: false, type: Number })
|
|
235
254
|
], HelixHeadlessTreeItem.prototype, "level", void 0);
|
|
255
|
+
__decorate([
|
|
256
|
+
property({ attribute: false })
|
|
257
|
+
], HelixHeadlessTreeItem.prototype, "move", void 0);
|
|
236
258
|
__decorate([
|
|
237
259
|
property()
|
|
238
260
|
], HelixHeadlessTreeItem.prototype, "rel", void 0);
|
|
@@ -36,6 +36,19 @@ declare const HelixHeadlessTree_base: (new (...args: any[]) => import("@fusion.d
|
|
|
36
36
|
* tree of check marks, Control+A (Command+A on an Apple keyboard) checks every
|
|
37
37
|
* item or clears them all, and Shift with Up or Down Arrow moves and checks.
|
|
38
38
|
*
|
|
39
|
+
* **`reorderable` lets you move items among their siblings.** Alt with Up or
|
|
40
|
+
* Down moves the focused item a place, and Alt with Home or End to the first
|
|
41
|
+
* or the last place among its siblings, as the APG's rearrangeable listbox
|
|
42
|
+
* does. Each row gets a grip at its far end: drag it to move the item, and the
|
|
43
|
+
* tree scrolls near an edge. A click on a grip picks the item up and a click on
|
|
44
|
+
* one of its siblings drops it there, which needs no drag. The arrows move an
|
|
45
|
+
* item picked up that way, Enter or Space drops it, and Escape puts it back.
|
|
46
|
+
* The tree says each step in its `live` region. A drop sends
|
|
47
|
+
* `helix-before-reorder`, which you can refuse, and then `helix-reorder`, whose
|
|
48
|
+
* `keys` hold the siblings in the new order. **You move the items**: the tree
|
|
49
|
+
* moves no element of yours, and focus follows the moved item once you have.
|
|
50
|
+
* Moving an item into another branch is not part of this.
|
|
51
|
+
*
|
|
39
52
|
* @since 0.1.0
|
|
40
53
|
* @status stable
|
|
41
54
|
* @category navigation
|
|
@@ -46,14 +59,29 @@ declare const HelixHeadlessTree_base: (new (...args: any[]) => import("@fusion.d
|
|
|
46
59
|
*
|
|
47
60
|
* @event {HelixActivateEvent} helix-activate - Fired after the current node changes, so the tree already holds the new one.
|
|
48
61
|
* @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the current node changes, and cancelable. Canceling it is the only way to stop the change.
|
|
62
|
+
* @event {HelixBeforeReorderEvent} helix-before-reorder - Fired when an item is dropped at a new place among its siblings, in a `reorderable` tree, with the siblings' keys in the new order. Cancelable: cancel it to keep the item where it is.
|
|
63
|
+
* @event {HelixReorderEvent} helix-reorder - Fired after `helix-before-reorder` when nobody canceled it. Move your items to the order in `keys`, each an item's `value`, or its words where it has none. Cancelable: cancel it to say the move did not happen.
|
|
49
64
|
* @event {HelixSelectEvent} helix-select - Fired when an item is chosen. The item sends it, and you can listen for it on the tree. Cancelable: canceling it changes nothing.
|
|
50
65
|
*
|
|
66
|
+
* @csspart drag-preview - A copy of the row a pointer drags by its grip, which follows the pointer in the top layer until the item is let go, in a `reorderable` tree. Hidden from assistive technology.
|
|
51
67
|
* @csspart empty - Shown when there are no rows to show.
|
|
52
|
-
* @csspart live - A copy of the empty and loading messages, in a live region that announces them when they change. Visually hidden in the styled tier.
|
|
68
|
+
* @csspart live - A copy of the empty and loading messages, and each step of a move in a `reorderable` tree, in a live region that announces them when they change. Visually hidden in the styled tier.
|
|
53
69
|
* @csspart loading - Shown while the rows load.
|
|
54
70
|
* @csspart tree - The tree container.
|
|
55
71
|
*/
|
|
56
72
|
export declare class HelixHeadlessTree extends HelixHeadlessTree_base {
|
|
73
|
+
/**
|
|
74
|
+
* The key this family's words are registered under, its styled tag:
|
|
75
|
+
* `registerWords('de', { 'helix-tree': { label: 'Baum' } })`.
|
|
76
|
+
*/
|
|
77
|
+
static words: string;
|
|
78
|
+
/**
|
|
79
|
+
* What screen readers hear when a held item is put back, or a move is
|
|
80
|
+
* refused, in a `reorderable` tree.
|
|
81
|
+
*/
|
|
82
|
+
canceledLabel: string;
|
|
83
|
+
/** What screen readers hear when a held item is dropped, in a `reorderable` tree. */
|
|
84
|
+
droppedLabel: string;
|
|
57
85
|
/**
|
|
58
86
|
* Accessible name for the tree.
|
|
59
87
|
*
|
|
@@ -61,10 +89,36 @@ export declare class HelixHeadlessTree extends HelixHeadlessTree_base {
|
|
|
61
89
|
* wins over this.
|
|
62
90
|
*/
|
|
63
91
|
label: string;
|
|
92
|
+
/**
|
|
93
|
+
* What screen readers hear each time an item moves, in a `reorderable`
|
|
94
|
+
* tree. `{name}` is the item's words, `{position}` its place among its
|
|
95
|
+
* siblings, counting from 1, and `{count}` the number of siblings.
|
|
96
|
+
*/
|
|
97
|
+
movedLabel: string;
|
|
64
98
|
/** Carries a host `aria-label` and `aria-labelledby` to the tree. */
|
|
65
99
|
protected readonly aria: AriaForwardController;
|
|
66
100
|
/** The letters typed so far, for moving to an item by its name. */
|
|
67
101
|
private readonly typeahead;
|
|
102
|
+
/**
|
|
103
|
+
* Moving items among their siblings, in a `reorderable` tree. The items are
|
|
104
|
+
* the page's, so a drop asks the page to move them.
|
|
105
|
+
*/
|
|
106
|
+
private readonly reorder;
|
|
107
|
+
/** The key an item is moved by: its `value`, or its words where it has none. */
|
|
108
|
+
private keyOf;
|
|
109
|
+
/** The item that stands for a key. */
|
|
110
|
+
private itemFor;
|
|
111
|
+
/** The innermost item an event came from. */
|
|
112
|
+
private itemOf;
|
|
113
|
+
/** The key of the innermost item an event came from, unless it is disabled. */
|
|
114
|
+
private keyAt;
|
|
115
|
+
/** An item and the items beside it, under the same parent, in order. */
|
|
116
|
+
private siblingsOf;
|
|
117
|
+
/**
|
|
118
|
+
* The keys of the items a key's item moves among: its siblings, a disabled
|
|
119
|
+
* one included, which stays where it is while the others move past it.
|
|
120
|
+
*/
|
|
121
|
+
private siblingKeys;
|
|
68
122
|
/**
|
|
69
123
|
* What a deeper level means: `peer` for no change, `subordinate` for a lower
|
|
70
124
|
* rank, or `heading` for a parent that heads the items under it.
|
|
@@ -102,6 +156,17 @@ export declare class HelixHeadlessTree extends HelixHeadlessTree_base {
|
|
|
102
156
|
* The resting state is the absence of the attribute, which is `peer`.
|
|
103
157
|
*/
|
|
104
158
|
nesting?: 'heading' | 'peer' | 'subordinate';
|
|
159
|
+
/**
|
|
160
|
+
* What screen readers hear when a click on a grip picks up an item, in a
|
|
161
|
+
* `reorderable` tree. `{name}` is the item's words.
|
|
162
|
+
*/
|
|
163
|
+
pickedUpLabel: string;
|
|
164
|
+
/**
|
|
165
|
+
* Lets you move items among their siblings, by dragging a grip or with Alt
|
|
166
|
+
* and an arrow. The tree moves no item itself: you move your data on
|
|
167
|
+
* `helix-reorder`.
|
|
168
|
+
*/
|
|
169
|
+
reorderable: boolean;
|
|
105
170
|
/**
|
|
106
171
|
* Whether a reader can check many items, or choose only the items at the
|
|
107
172
|
* ends. Unset, one item is chosen at a time, branches included.
|
|
@@ -4,9 +4,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, closestInstance, commaList, customElement, HelixElement, inlineStep, keyClaimed, MixinCollection, MixinControllerActive, scrollItemIntoView, selectsAll, slottedWords, Typeahead, treeArrow, typesCharacter, whenHydrated, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, closestInstance, commaList, customElement, HelixElement, inlineStep, keyClaimed, MixinCollection, MixinControllerActive, ReorderController, scrollItemIntoView, selectsAll, slottedWords, Typeahead, treeArrow, typesCharacter, whenHydrated, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { fromGrip } from '../grip.js';
|
|
10
11
|
import { HelixHeadlessTreeItem } from '../item/tree-item.js';
|
|
11
12
|
import { checkedState, pressRow } from '../selection.js';
|
|
12
13
|
const KEYS = new Set([
|
|
@@ -22,12 +23,35 @@ const KEYS = new Set([
|
|
|
22
23
|
let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinControllerActive(HelixElement)) {
|
|
23
24
|
constructor() {
|
|
24
25
|
super(...arguments);
|
|
26
|
+
this.canceledLabel = 'Canceled';
|
|
27
|
+
this.droppedLabel = 'Dropped';
|
|
25
28
|
this.label = 'Tree';
|
|
29
|
+
this.movedLabel = '{name} moved to position {position} of {count}';
|
|
26
30
|
this.aria = new AriaForwardController(this, {
|
|
27
31
|
label: true,
|
|
28
32
|
target: () => this.partNamed('tree'),
|
|
29
33
|
});
|
|
30
34
|
this.typeahead = new Typeahead();
|
|
35
|
+
this.reorder = new ReorderController(this, {
|
|
36
|
+
axis: 'block',
|
|
37
|
+
box: (key) => this.itemFor(key)?.getBoundingClientRect(),
|
|
38
|
+
current: (event) => this.keyAt(event),
|
|
39
|
+
grip: (event) => {
|
|
40
|
+
const item = this.itemOf(event);
|
|
41
|
+
const element = fromGrip(event) && item?.focusTarget;
|
|
42
|
+
return item && element ? { element, key: this.keyOf(item) } : undefined;
|
|
43
|
+
},
|
|
44
|
+
item: (event) => this.keyAt(event),
|
|
45
|
+
keys: (key) => this.siblingKeys(key),
|
|
46
|
+
name: (key) => {
|
|
47
|
+
const item = this.itemFor(key);
|
|
48
|
+
return (item && slottedWords(item, [''])) || key;
|
|
49
|
+
},
|
|
50
|
+
preview: (key) => this.itemFor(key)?.shadowRoot?.querySelector('[part="row"]'),
|
|
51
|
+
refocus: (key) => this.focusOn(this.itemFor(key)),
|
|
52
|
+
});
|
|
53
|
+
this.pickedUpLabel = 'Picked up {name}';
|
|
54
|
+
this.reorderable = false;
|
|
31
55
|
this.handleSelection = (event) => {
|
|
32
56
|
const origin = event.target;
|
|
33
57
|
if (!(origin instanceof HelixHeadlessTreeItem) || !this.items.includes(origin)) {
|
|
@@ -107,6 +131,28 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
107
131
|
this.syncItems();
|
|
108
132
|
};
|
|
109
133
|
}
|
|
134
|
+
static { this.words = 'helix-tree'; }
|
|
135
|
+
keyOf(item) {
|
|
136
|
+
return item.value || slottedWords(item, ['']);
|
|
137
|
+
}
|
|
138
|
+
itemFor(key) {
|
|
139
|
+
return this.items.find((item) => this.keyOf(item) === key);
|
|
140
|
+
}
|
|
141
|
+
itemOf(event) {
|
|
142
|
+
const item = closestInstance(event.composedPath()[0], HelixHeadlessTreeItem);
|
|
143
|
+
return item && this.items.includes(item) ? item : undefined;
|
|
144
|
+
}
|
|
145
|
+
keyAt(event) {
|
|
146
|
+
const item = this.itemOf(event);
|
|
147
|
+
return item && !item.disabled ? this.keyOf(item) : undefined;
|
|
148
|
+
}
|
|
149
|
+
siblingsOf(item) {
|
|
150
|
+
return [...(item.parentElement?.children ?? [])].filter((node) => node instanceof HelixHeadlessTreeItem && node.slot === item.slot);
|
|
151
|
+
}
|
|
152
|
+
siblingKeys(key) {
|
|
153
|
+
const item = this.itemFor(key);
|
|
154
|
+
return item ? this.siblingsOf(item).map((one) => this.keyOf(one)) : [];
|
|
155
|
+
}
|
|
110
156
|
get values() {
|
|
111
157
|
return this.multiple ? commaList(this.active) : this.active === '' ? [] : [this.active];
|
|
112
158
|
}
|
|
@@ -160,6 +206,7 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
160
206
|
const multiple = this.multiple;
|
|
161
207
|
const checked = new Set(this.values);
|
|
162
208
|
for (const item of this.items) {
|
|
209
|
+
const key = this.keyOf(item);
|
|
163
210
|
const selected = !multiple && item.value !== '' && item.value === this.active;
|
|
164
211
|
const state = multiple ? checkedState(this.rowOf(item), checked) : false;
|
|
165
212
|
const focusable = item === stop;
|
|
@@ -178,6 +225,8 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
178
225
|
item.focusable = focusable;
|
|
179
226
|
item.level = level;
|
|
180
227
|
item.heads = heads;
|
|
228
|
+
item.grip = this.reorderable;
|
|
229
|
+
item.move = this.reorder.moveOf(key);
|
|
181
230
|
});
|
|
182
231
|
}
|
|
183
232
|
}
|
|
@@ -200,8 +249,7 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
200
249
|
return false;
|
|
201
250
|
}
|
|
202
251
|
if (event.key === '*') {
|
|
203
|
-
const
|
|
204
|
-
for (const sibling of siblings) {
|
|
252
|
+
for (const sibling of this.siblingsOf(current)) {
|
|
205
253
|
if (sibling.isBranch && !sibling.open) {
|
|
206
254
|
sibling.requestOpen(true);
|
|
207
255
|
}
|
|
@@ -274,7 +322,11 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
274
322
|
}
|
|
275
323
|
updated(changed) {
|
|
276
324
|
super.updated(changed);
|
|
277
|
-
if (changed.has('active') ||
|
|
325
|
+
if (changed.has('active') ||
|
|
326
|
+
changed.has('nesting') ||
|
|
327
|
+
changed.has('selectionMode') ||
|
|
328
|
+
this.reorderable ||
|
|
329
|
+
changed.has('reorderable')) {
|
|
278
330
|
this.syncItems();
|
|
279
331
|
}
|
|
280
332
|
}
|
|
@@ -293,15 +345,35 @@ let HelixHeadlessTree = class HelixHeadlessTree extends MixinCollection(MixinCon
|
|
|
293
345
|
}}
|
|
294
346
|
></slot>
|
|
295
347
|
${this.renderStatus(this.hasRows)}
|
|
296
|
-
</div>${this.renderLive(this.hasRows)}`;
|
|
348
|
+
</div>${this.renderLive(this.hasRows)}${this.reorder.drawDragPreview()}`;
|
|
297
349
|
}
|
|
298
350
|
};
|
|
299
351
|
__decorate([
|
|
352
|
+
words,
|
|
353
|
+
property({ attribute: 'canceled-label' })
|
|
354
|
+
], HelixHeadlessTree.prototype, "canceledLabel", void 0);
|
|
355
|
+
__decorate([
|
|
356
|
+
words,
|
|
357
|
+
property({ attribute: 'dropped-label' })
|
|
358
|
+
], HelixHeadlessTree.prototype, "droppedLabel", void 0);
|
|
359
|
+
__decorate([
|
|
360
|
+
words,
|
|
300
361
|
property()
|
|
301
362
|
], HelixHeadlessTree.prototype, "label", void 0);
|
|
363
|
+
__decorate([
|
|
364
|
+
words,
|
|
365
|
+
property({ attribute: 'moved-label' })
|
|
366
|
+
], HelixHeadlessTree.prototype, "movedLabel", void 0);
|
|
302
367
|
__decorate([
|
|
303
368
|
property({ reflect: true })
|
|
304
369
|
], HelixHeadlessTree.prototype, "nesting", void 0);
|
|
370
|
+
__decorate([
|
|
371
|
+
words,
|
|
372
|
+
property({ attribute: 'picked-up-label' })
|
|
373
|
+
], HelixHeadlessTree.prototype, "pickedUpLabel", void 0);
|
|
374
|
+
__decorate([
|
|
375
|
+
property({ type: Boolean })
|
|
376
|
+
], HelixHeadlessTree.prototype, "reorderable", void 0);
|
|
305
377
|
__decorate([
|
|
306
378
|
property({ attribute: 'selection-mode', reflect: true })
|
|
307
379
|
], HelixHeadlessTree.prototype, "selectionMode", void 0);
|
|
@@ -58,7 +58,13 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
58
58
|
*/
|
|
59
59
|
export declare class HelixHeadlessTrend extends HelixElement {
|
|
60
60
|
/**
|
|
61
|
-
* The
|
|
61
|
+
* The key this family's words are registered under, its styled tag:
|
|
62
|
+
* `registerWords('de', { 'helix-trend': { upLabel: 'Gestiegen' } })`.
|
|
63
|
+
*/
|
|
64
|
+
static words: string;
|
|
65
|
+
/**
|
|
66
|
+
* The word read out after the direction when the move is an improvement,
|
|
67
|
+
* `{betterLabel}` in `judgment-label`.
|
|
62
68
|
*/
|
|
63
69
|
betterLabel: string;
|
|
64
70
|
/**
|
|
@@ -97,9 +103,18 @@ export declare class HelixHeadlessTrend extends HelixElement {
|
|
|
97
103
|
*/
|
|
98
104
|
good?: 'down' | 'up';
|
|
99
105
|
/**
|
|
100
|
-
*
|
|
106
|
+
* What the `direction` part says. `{direction}` is the word for the
|
|
107
|
+
* movement, `up-label`, `down-label` or `unchanged-label`, and
|
|
108
|
+
* `{judgment}` is `better` or `worse` where `good` judges the move, so a
|
|
109
|
+
* language whose words agree with the movement writes each phrase whole:
|
|
110
|
+
* `{judgment, select, better {...} worse {...} other {...}}`.
|
|
111
|
+
* `{betterLabel}` and `{worseLabel}` are `better-label` and `worse-label`.
|
|
112
|
+
*/
|
|
113
|
+
judgmentLabel: string;
|
|
114
|
+
/**
|
|
115
|
+
* The locale the words and `value` are in, such as `de` for `1.234,5`.
|
|
101
116
|
*
|
|
102
|
-
* Absent
|
|
117
|
+
* Absent reads the nearest `lang`, then the runtime's own. Set it on a page rendered on a server, so
|
|
103
118
|
* the server and the browser write the figure alike.
|
|
104
119
|
*/
|
|
105
120
|
locale: string;
|
|
@@ -133,7 +148,8 @@ export declare class HelixHeadlessTrend extends HelixElement {
|
|
|
133
148
|
*/
|
|
134
149
|
value?: number;
|
|
135
150
|
/**
|
|
136
|
-
* The word read out after the direction when the move is a setback
|
|
151
|
+
* The word read out after the direction when the move is a setback,
|
|
152
|
+
* `{worseLabel}` in `judgment-label`.
|
|
137
153
|
*/
|
|
138
154
|
worseLabel: string;
|
|
139
155
|
/**
|