@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,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, appleTouch, valueAsNumber as asNumber, customElement,
|
|
7
|
+
import { AriaForwardController, appleTouch, valueAsNumber as asNumber, customElement, formatNumber, formatWords, numberAsValue as fromNumber, HelixFormElement, holdCaret, MixinControllerValue, MixinField, parseNumber, restoreValue, submitImplicitly, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { minus, plus } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -20,12 +20,16 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
|
|
|
20
20
|
});
|
|
21
21
|
this.announcesInput = true;
|
|
22
22
|
this.autocomplete = '';
|
|
23
|
+
this.badInputMessage = 'Please enter a number.';
|
|
23
24
|
this.decrementLabel = 'Decrease';
|
|
24
25
|
this.incrementLabel = 'Increase';
|
|
25
26
|
this.locale = '';
|
|
26
27
|
this.placeholder = '';
|
|
28
|
+
this.rangeOverflowMessage = 'Value must be {max} or less.';
|
|
29
|
+
this.rangeUnderflowMessage = 'Value must be {min} or more.';
|
|
27
30
|
this.readOnly = false;
|
|
28
31
|
this.scrub = false;
|
|
32
|
+
this.stepMismatchMessage = 'Please enter a valid value. The two nearest valid values are {below} and {above}.';
|
|
29
33
|
this.valueText = '';
|
|
30
34
|
this.wheel = false;
|
|
31
35
|
this.editing = false;
|
|
@@ -143,6 +147,7 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
|
|
|
143
147
|
}
|
|
144
148
|
};
|
|
145
149
|
}
|
|
150
|
+
static { this.words = 'helix-number-input'; }
|
|
146
151
|
get shown() {
|
|
147
152
|
const parsed = this.numeric;
|
|
148
153
|
if (this.editing || this.formatOptions === undefined || parsed === null) {
|
|
@@ -177,6 +182,12 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
|
|
|
177
182
|
this.grainOf = [this.locale, options, fresh];
|
|
178
183
|
return fresh;
|
|
179
184
|
}
|
|
185
|
+
written(number) {
|
|
186
|
+
return formatNumber(number, wordsLocale(this), {
|
|
187
|
+
maximumFractionDigits: 20,
|
|
188
|
+
useGrouping: false,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
180
191
|
onStep(value) {
|
|
181
192
|
const step = this.grid;
|
|
182
193
|
const anchor = this.min ?? 0;
|
|
@@ -259,25 +270,23 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
|
|
|
259
270
|
this.internals.setValidity({ valueMissing: true }, this.valueMissingMessage || 'Please fill in this field.', control);
|
|
260
271
|
}
|
|
261
272
|
else if (this.value.trim() !== '' && parsed === null) {
|
|
262
|
-
this.internals.setValidity({ badInput: true }, this.badInputMessage
|
|
273
|
+
this.internals.setValidity({ badInput: true }, this.badInputMessage, control);
|
|
263
274
|
}
|
|
264
275
|
else if (parsed !== null && this.min !== undefined && parsed < this.min) {
|
|
265
|
-
this.internals.setValidity({ rangeUnderflow: true },
|
|
266
|
-
min: this.min,
|
|
267
|
-
}), control);
|
|
276
|
+
this.internals.setValidity({ rangeUnderflow: true }, formatWords(this, 'rangeUnderflowMessage', { min: this.written(this.min) }), control);
|
|
268
277
|
}
|
|
269
278
|
else if (parsed !== null && this.max !== undefined && parsed > this.max) {
|
|
270
|
-
this.internals.setValidity({ rangeOverflow: true },
|
|
271
|
-
max: this.max,
|
|
272
|
-
}), control);
|
|
279
|
+
this.internals.setValidity({ rangeOverflow: true }, formatWords(this, 'rangeOverflowMessage', { max: this.written(this.max) }), control);
|
|
273
280
|
}
|
|
274
281
|
else if (parsed !== null && !this.onStep(parsed)) {
|
|
275
282
|
const step = this.grid;
|
|
276
283
|
const anchor = this.min ?? 0;
|
|
277
284
|
const below = this.clamp(anchor + Math.floor((parsed - anchor) / step) * step);
|
|
278
285
|
const above = this.clamp(anchor + Math.ceil((parsed - anchor) / step) * step);
|
|
279
|
-
this.internals.setValidity({ stepMismatch: true },
|
|
280
|
-
|
|
286
|
+
this.internals.setValidity({ stepMismatch: true }, formatWords(this, 'stepMismatchMessage', {
|
|
287
|
+
above: this.written(above),
|
|
288
|
+
below: this.written(below),
|
|
289
|
+
}), control);
|
|
281
290
|
}
|
|
282
291
|
else {
|
|
283
292
|
this.internals.setValidity({}, '', control);
|
|
@@ -347,7 +356,7 @@ let HelixHeadlessNumberInput = class HelixHeadlessNumberInput extends MixinContr
|
|
|
347
356
|
aria-valuetext=${parsed === null
|
|
348
357
|
? nothing
|
|
349
358
|
: this.valueText
|
|
350
|
-
?
|
|
359
|
+
? formatWords(this, 'valueText', {
|
|
351
360
|
value: this.formatOptions
|
|
352
361
|
? formatNumber(parsed, this.locale, this.formatOptions)
|
|
353
362
|
: this.value,
|
|
@@ -393,15 +402,18 @@ __decorate([
|
|
|
393
402
|
property()
|
|
394
403
|
], HelixHeadlessNumberInput.prototype, "autocomplete", void 0);
|
|
395
404
|
__decorate([
|
|
405
|
+
words,
|
|
396
406
|
property({ attribute: 'bad-input-message' })
|
|
397
407
|
], HelixHeadlessNumberInput.prototype, "badInputMessage", void 0);
|
|
398
408
|
__decorate([
|
|
409
|
+
words,
|
|
399
410
|
property({ attribute: 'decrement-label' })
|
|
400
411
|
], HelixHeadlessNumberInput.prototype, "decrementLabel", void 0);
|
|
401
412
|
__decorate([
|
|
402
413
|
property({ attribute: 'format-options', type: Object })
|
|
403
414
|
], HelixHeadlessNumberInput.prototype, "formatOptions", void 0);
|
|
404
415
|
__decorate([
|
|
416
|
+
words,
|
|
405
417
|
property({ attribute: 'increment-label' })
|
|
406
418
|
], HelixHeadlessNumberInput.prototype, "incrementLabel", void 0);
|
|
407
419
|
__decorate([
|
|
@@ -420,9 +432,11 @@ __decorate([
|
|
|
420
432
|
property()
|
|
421
433
|
], HelixHeadlessNumberInput.prototype, "placeholder", void 0);
|
|
422
434
|
__decorate([
|
|
435
|
+
words,
|
|
423
436
|
property({ attribute: 'range-overflow-message' })
|
|
424
437
|
], HelixHeadlessNumberInput.prototype, "rangeOverflowMessage", void 0);
|
|
425
438
|
__decorate([
|
|
439
|
+
words,
|
|
426
440
|
property({ attribute: 'range-underflow-message' })
|
|
427
441
|
], HelixHeadlessNumberInput.prototype, "rangeUnderflowMessage", void 0);
|
|
428
442
|
__decorate([
|
|
@@ -435,6 +449,7 @@ __decorate([
|
|
|
435
449
|
property({ type: Number })
|
|
436
450
|
], HelixHeadlessNumberInput.prototype, "step", void 0);
|
|
437
451
|
__decorate([
|
|
452
|
+
words,
|
|
438
453
|
property({ attribute: 'step-mismatch-message' })
|
|
439
454
|
], HelixHeadlessNumberInput.prototype, "stepMismatchMessage", void 0);
|
|
440
455
|
__decorate([
|
|
@@ -51,8 +51,8 @@ import { type Row } from '../rows.js';
|
|
|
51
51
|
* `filter` narrows the tree to the entries whose key or value holds the text,
|
|
52
52
|
* ignoring case, and the branches that lead to them, which it opens. A matched
|
|
53
53
|
* branch keeps everything under it. Each matched row carries `row-match`, and
|
|
54
|
-
* a screen reader hears how many entries matched from `
|
|
55
|
-
* `
|
|
54
|
+
* a screen reader hears how many entries matched from `results-label`.
|
|
55
|
+
* `filterable` adds a field that sets it: typing sends
|
|
56
56
|
* `helix-filter`, which you can cancel, and then `helix-filtered`, and Down
|
|
57
57
|
* moves from the field to the tree.
|
|
58
58
|
*
|
|
@@ -123,6 +123,11 @@ import { type Row } from '../rows.js';
|
|
|
123
123
|
* @cssproperty --object-inspector-level - How deep a row is, from 0 at the root, for indenting it.
|
|
124
124
|
*/
|
|
125
125
|
export declare class HelixHeadlessObjectInspector extends HelixElement {
|
|
126
|
+
/**
|
|
127
|
+
* The key this family's words are registered under, its styled tag:
|
|
128
|
+
* `registerWords('de', { 'helix-object-inspector': { copyValueLabel: 'Wert kopieren' } })`.
|
|
129
|
+
*/
|
|
130
|
+
static words: string;
|
|
126
131
|
/**
|
|
127
132
|
* The active row's path, such as `/meta/tags/0`, and the empty string for the
|
|
128
133
|
* root.
|
|
@@ -178,13 +183,33 @@ export declare class HelixHeadlessObjectInspector extends HelixElement {
|
|
|
178
183
|
* page's markup should not take the page down over a comma.
|
|
179
184
|
*/
|
|
180
185
|
for: string;
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
-
|
|
186
|
+
/**
|
|
187
|
+
* How an array of one entry counts it, where `items-label` should not say
|
|
188
|
+
* it. `{count}` is the count.
|
|
189
|
+
*
|
|
190
|
+
* @deprecated Write every form in `items-label`, as `{count, plural, one
|
|
191
|
+
* {# item} other {# items}}`. Removed in the next major version.
|
|
192
|
+
*/
|
|
193
|
+
itemLabel?: string;
|
|
194
|
+
/**
|
|
195
|
+
* How an array counts its entries. `{count}` is the count, written in the
|
|
196
|
+
* locale, and each language writes the forms it has: `{count, plural, one
|
|
197
|
+
* {# element} few {# elementy} many {# elementów} other {# elementu}}`.
|
|
198
|
+
*/
|
|
184
199
|
itemsLabel: string;
|
|
185
|
-
/**
|
|
186
|
-
|
|
187
|
-
|
|
200
|
+
/**
|
|
201
|
+
* How an object of one key counts it, where `keys-label` should not say it.
|
|
202
|
+
* `{count}` is the count.
|
|
203
|
+
*
|
|
204
|
+
* @deprecated Write every form in `keys-label`, as `{count, plural, one
|
|
205
|
+
* {# key} other {# keys}}`. Removed in the next major version.
|
|
206
|
+
*/
|
|
207
|
+
keyLabel?: string;
|
|
208
|
+
/**
|
|
209
|
+
* How an object counts its keys. `{count}` is the count, written in the
|
|
210
|
+
* locale, and each language writes the forms it has: `{count, plural, one
|
|
211
|
+
* {# klucz} few {# klucze} many {# kluczy} other {# klucza}}`.
|
|
212
|
+
*/
|
|
188
213
|
keysLabel: string;
|
|
189
214
|
/**
|
|
190
215
|
* Accessible name for the tree, and the text of the header where there is one.
|
|
@@ -204,11 +229,19 @@ export declare class HelixHeadlessObjectInspector extends HelixElement {
|
|
|
204
229
|
* reach a value.
|
|
205
230
|
*/
|
|
206
231
|
noCopy: boolean;
|
|
207
|
-
/** What a screen reader hears when a filter matches one entry. `{count}` is the count. */
|
|
208
|
-
resultLabel: string;
|
|
209
232
|
/**
|
|
210
|
-
* What a screen reader hears when a filter matches
|
|
211
|
-
*
|
|
233
|
+
* What a screen reader hears when a filter matches one entry, where
|
|
234
|
+
* `results-label` should not say it. `{count}` is the count.
|
|
235
|
+
*
|
|
236
|
+
* @deprecated Write every form in `results-label`, as `{count, plural, one
|
|
237
|
+
* {# result} other {# results}}`. Removed in the next major version.
|
|
238
|
+
*/
|
|
239
|
+
resultLabel?: string;
|
|
240
|
+
/**
|
|
241
|
+
* What a screen reader hears when a filter matches entries. `{count}` is
|
|
242
|
+
* how many, written in the locale, and each language writes the forms it
|
|
243
|
+
* has: `{count, plural, one {# wynik} few {# wyniki} many {# wyników}
|
|
244
|
+
* other {# wyniku}}`.
|
|
212
245
|
*/
|
|
213
246
|
resultsLabel: string;
|
|
214
247
|
/**
|
|
@@ -291,6 +324,12 @@ export declare class HelixHeadlessObjectInspector extends HelixElement {
|
|
|
291
324
|
/** Opens the branches around each path, where the value has them. */
|
|
292
325
|
private openAround;
|
|
293
326
|
protected willUpdate(changed: PropertyValues): void;
|
|
327
|
+
/**
|
|
328
|
+
* A count in its plural message, `items-label`, `keys-label` or
|
|
329
|
+
* `results-label`, or in the deprecated sentence for one where a page still
|
|
330
|
+
* sets it.
|
|
331
|
+
*/
|
|
332
|
+
private counted;
|
|
294
333
|
/** Says how many entries the filter matched, and nothing for an empty one. */
|
|
295
334
|
private tell;
|
|
296
335
|
protected firstUpdated(changed: PropertyValues): void;
|
|
@@ -351,7 +390,7 @@ export declare class HelixHeadlessObjectInspector extends HelixElement {
|
|
|
351
390
|
* box, or in the window where the box does not scroll, less one, so the row
|
|
352
391
|
* at one edge lands at the other.
|
|
353
392
|
*/
|
|
354
|
-
private
|
|
393
|
+
private pageStep;
|
|
355
394
|
/** A press opens or closes the row it lands on, once that row is the active one. */
|
|
356
395
|
private handleRowClick;
|
|
357
396
|
/** Text typed in the filter field, asked for before the tree narrows to it. */
|
|
@@ -380,6 +419,10 @@ export declare class HelixHeadlessObjectInspector extends HelixElement {
|
|
|
380
419
|
private renderRow;
|
|
381
420
|
/** Whether a row of the tree holds focus. */
|
|
382
421
|
private hasFocusedRow;
|
|
422
|
+
/** Where the row holding focus is among the visible rows, or nothing while none does. */
|
|
423
|
+
private focusedIndex;
|
|
424
|
+
/** Focus on the tree itself, its stop while the active row is not drawn, goes on to that row. */
|
|
425
|
+
private readonly handleTreeFocus;
|
|
383
426
|
/**
|
|
384
427
|
* A row that takes focus some other way than the keys, from a script or a
|
|
385
428
|
* screen reader, becomes the active row, so focus and the keys agree.
|
|
@@ -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
|
var HelixHeadlessObjectInspector_1;
|
|
8
|
-
import { AriaForwardController, CopyController, countLabel, customElement, drawStatus, elementById,
|
|
8
|
+
import { AriaForwardController, CopyController, countLabel, customElement, drawStatus, elementById, formatWords, HelixActivateEvent, HelixBeforeActivateEvent, HelixBeforeCloseEvent, HelixBeforeOpenEvent, HelixElement, HelixFilterEvent, HelixFilteredEvent, inlineStep, pageRows, requestChange, StatusController, scrollItemIntoView, scrollRoom, searchableById, Typeahead, treeArrow, VirtualizeController, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
9
9
|
import { caretDown, caretRight } from '@fusion.dev/helix-icons';
|
|
10
10
|
import { html, nothing } from 'lit';
|
|
11
11
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -24,14 +24,11 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
24
24
|
this.filterable = false;
|
|
25
25
|
this.filterLabel = 'Filter';
|
|
26
26
|
this.for = '';
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.keyLabel = '{count} key';
|
|
30
|
-
this.keysLabel = '{count} keys';
|
|
27
|
+
this.itemsLabel = '{count, plural, one {# item} other {# items}}';
|
|
28
|
+
this.keysLabel = '{count, plural, one {# key} other {# keys}}';
|
|
31
29
|
this.label = '';
|
|
32
30
|
this.noCopy = false;
|
|
33
|
-
this.
|
|
34
|
-
this.resultsLabel = '{count} results';
|
|
31
|
+
this.resultsLabel = '{count, plural, one {# result} other {# results}}';
|
|
35
32
|
this.treeLabel = 'Value';
|
|
36
33
|
this.value = undefined;
|
|
37
34
|
this.windowed = false;
|
|
@@ -85,10 +82,10 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
85
82
|
this.move(rows.length - 1);
|
|
86
83
|
break;
|
|
87
84
|
case 'PageDown':
|
|
88
|
-
this.move(this.cursor + this.
|
|
85
|
+
this.move(this.cursor + this.pageStep());
|
|
89
86
|
break;
|
|
90
87
|
case 'PageUp':
|
|
91
|
-
this.move(this.cursor - this.
|
|
88
|
+
this.move(this.cursor - this.pageStep());
|
|
92
89
|
break;
|
|
93
90
|
case 'ArrowRight':
|
|
94
91
|
case 'ArrowLeft':
|
|
@@ -153,6 +150,11 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
153
150
|
this.requestUpdate();
|
|
154
151
|
}
|
|
155
152
|
};
|
|
153
|
+
this.handleTreeFocus = () => {
|
|
154
|
+
this.revealing = true;
|
|
155
|
+
this.focusing = true;
|
|
156
|
+
this.requestUpdate();
|
|
157
|
+
};
|
|
156
158
|
this.handleFocusIn = (event) => {
|
|
157
159
|
const index = Number(event.target.dataset?.index);
|
|
158
160
|
if (Number.isInteger(index) && index !== this.cursor) {
|
|
@@ -166,6 +168,7 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
166
168
|
};
|
|
167
169
|
}
|
|
168
170
|
static { HelixHeadlessObjectInspector_1 = this; }
|
|
171
|
+
static { this.words = 'helix-object-inspector'; }
|
|
169
172
|
get active() {
|
|
170
173
|
return this.wanted ?? this.rows[this.cursor]?.path ?? '';
|
|
171
174
|
}
|
|
@@ -234,9 +237,15 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
234
237
|
this.tell();
|
|
235
238
|
}
|
|
236
239
|
}
|
|
240
|
+
counted(which, count) {
|
|
241
|
+
const one = this[`${which}Label`];
|
|
242
|
+
return one
|
|
243
|
+
? countLabel(count, one, this[`${which}sLabel`], wordsLocale(this))
|
|
244
|
+
: formatWords(this, `${which}sLabel`, { count });
|
|
245
|
+
}
|
|
237
246
|
tell() {
|
|
238
247
|
if (this.found) {
|
|
239
|
-
this.status.say(
|
|
248
|
+
this.status.say(this.counted('result', this.found.size));
|
|
240
249
|
}
|
|
241
250
|
}
|
|
242
251
|
firstUpdated(changed) {
|
|
@@ -367,6 +376,7 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
367
376
|
}
|
|
368
377
|
this.revealing = true;
|
|
369
378
|
this.focusing = true;
|
|
379
|
+
this.requestUpdate();
|
|
370
380
|
return true;
|
|
371
381
|
}
|
|
372
382
|
typeahead(letter) {
|
|
@@ -375,11 +385,8 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
375
385
|
this.move(at);
|
|
376
386
|
}
|
|
377
387
|
}
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const room = tree && tree.scrollHeight > tree.clientHeight + 1 ? tree.clientHeight : window.innerHeight;
|
|
381
|
-
const tall = this.virtualize.sizeOf(this.cursor) || HelixHeadlessObjectInspector_1.ESTIMATE;
|
|
382
|
-
return Math.max(1, Math.floor(room / tall) - 1);
|
|
388
|
+
pageStep() {
|
|
389
|
+
return pageRows(scrollRoom(this.partNamed('tree')), this.virtualize.sizeOf(this.cursor) || HelixHeadlessObjectInspector_1.ESTIMATE);
|
|
383
390
|
}
|
|
384
391
|
handleRowClick(index, row) {
|
|
385
392
|
if (this.move(index) && row.branch) {
|
|
@@ -391,18 +398,8 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
391
398
|
if (row.branch) {
|
|
392
399
|
const count = entries(value).length;
|
|
393
400
|
const array = Array.isArray(value);
|
|
394
|
-
const one = new Intl.PluralRules(this.lang || undefined).select(count) === 'one';
|
|
395
|
-
const words = array
|
|
396
|
-
? one
|
|
397
|
-
? this.itemLabel
|
|
398
|
-
: this.itemsLabel
|
|
399
|
-
: one
|
|
400
|
-
? this.keyLabel
|
|
401
|
-
: this.keysLabel;
|
|
402
401
|
return html `<span part="summary">${array ? '[…]' : '{…}'}</span>
|
|
403
|
-
<span part="count" dir="auto"
|
|
404
|
-
>${fillTemplate(words, { count: formatNumbers(this.lang)(count) })}</span
|
|
405
|
-
>`;
|
|
402
|
+
<span part="count" dir="auto">${this.counted(array ? 'item' : 'key', count)}</span>`;
|
|
406
403
|
}
|
|
407
404
|
if (typeof value === 'string') {
|
|
408
405
|
return html `<span part="string" dir="ltr">${JSON.stringify(value)}</span>`;
|
|
@@ -446,8 +443,11 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
446
443
|
</div>`;
|
|
447
444
|
}
|
|
448
445
|
hasFocusedRow() {
|
|
446
|
+
return this.focusedIndex() !== undefined;
|
|
447
|
+
}
|
|
448
|
+
focusedIndex() {
|
|
449
449
|
const focused = this.shadowRoot?.activeElement;
|
|
450
|
-
return focused?.getAttribute?.('role') === 'row';
|
|
450
|
+
return focused?.getAttribute?.('role') === 'row' ? Number(focused.dataset.index) : undefined;
|
|
451
451
|
}
|
|
452
452
|
renderCopyButton(row) {
|
|
453
453
|
return staticHtml `<${this.tag('copy-button')}
|
|
@@ -457,15 +457,16 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
457
457
|
tooltip-arrow-left: copy-tooltip-arrow-left, tooltip-arrow-right: copy-tooltip-arrow-right,
|
|
458
458
|
tooltip-arrow-top: copy-tooltip-arrow-top, tooltip-bottom: copy-tooltip-bottom,
|
|
459
459
|
tooltip-left: copy-tooltip-left, tooltip-right: copy-tooltip-right, tooltip-top: copy-tooltip-top"
|
|
460
|
-
label=${row?.key === undefined ? this.copyValueLabel :
|
|
460
|
+
label=${row?.key === undefined ? this.copyValueLabel : formatWords(this, 'copyLabel', { name: row.key })}
|
|
461
461
|
.value=${this.copyable(row)}
|
|
462
462
|
></${this.tag('copy-button')}>`;
|
|
463
463
|
}
|
|
464
464
|
render() {
|
|
465
465
|
const rows = this.rows;
|
|
466
466
|
const { first, last } = this.windowed ? this.virtualize.window : { first: 0, last: rows.length };
|
|
467
|
-
const
|
|
468
|
-
|
|
467
|
+
const focused = this.focusedIndex();
|
|
468
|
+
const kept = this.windowed && focused !== undefined && (focused < first || focused >= last)
|
|
469
|
+
? focused
|
|
469
470
|
: undefined;
|
|
470
471
|
const { after, before } = this.windowed
|
|
471
472
|
? this.virtualize.spacers(kept)
|
|
@@ -475,6 +476,7 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
475
476
|
if (kept !== undefined && keptRow) {
|
|
476
477
|
shown.splice(kept < first ? 0 : shown.length, 0, [keptRow, kept]);
|
|
477
478
|
}
|
|
479
|
+
const stopless = rows.length > 0 && !shown.some(([, at]) => at === this.cursor);
|
|
478
480
|
return html `${this.label ? html `<div part="header"><span part="label">${this.label}</span></div>` : nothing}${this.filterable
|
|
479
481
|
? html `<input
|
|
480
482
|
part="search-field"
|
|
@@ -494,8 +496,10 @@ let HelixHeadlessObjectInspector = class HelixHeadlessObjectInspector extends He
|
|
|
494
496
|
id="tree"
|
|
495
497
|
role="treegrid"
|
|
496
498
|
?data-scroller=${this.windowed}
|
|
499
|
+
tabindex=${stopless ? '0' : nothing}
|
|
497
500
|
aria-label=${this.label || this.treeLabel}
|
|
498
501
|
@keydown=${this.handleKeydown}
|
|
502
|
+
@focus=${this.handleTreeFocus}
|
|
499
503
|
@focusin=${this.handleFocusIn}
|
|
500
504
|
@focusout=${this.handleFocusOut}
|
|
501
505
|
@scroll=${() => this.virtualize.measure()}
|
|
@@ -513,9 +517,11 @@ __decorate([
|
|
|
513
517
|
property()
|
|
514
518
|
], HelixHeadlessObjectInspector.prototype, "active", null);
|
|
515
519
|
__decorate([
|
|
520
|
+
words,
|
|
516
521
|
property({ attribute: 'copy-label' })
|
|
517
522
|
], HelixHeadlessObjectInspector.prototype, "copyLabel", void 0);
|
|
518
523
|
__decorate([
|
|
524
|
+
words,
|
|
519
525
|
property({ attribute: 'copy-value-label' })
|
|
520
526
|
], HelixHeadlessObjectInspector.prototype, "copyValueLabel", void 0);
|
|
521
527
|
__decorate([
|
|
@@ -531,6 +537,7 @@ __decorate([
|
|
|
531
537
|
property({ type: Boolean })
|
|
532
538
|
], HelixHeadlessObjectInspector.prototype, "filterable", void 0);
|
|
533
539
|
__decorate([
|
|
540
|
+
words,
|
|
534
541
|
property({ attribute: 'filter-label' })
|
|
535
542
|
], HelixHeadlessObjectInspector.prototype, "filterLabel", void 0);
|
|
536
543
|
__decorate([
|
|
@@ -540,12 +547,14 @@ __decorate([
|
|
|
540
547
|
property({ attribute: 'item-label' })
|
|
541
548
|
], HelixHeadlessObjectInspector.prototype, "itemLabel", void 0);
|
|
542
549
|
__decorate([
|
|
550
|
+
words,
|
|
543
551
|
property({ attribute: 'items-label' })
|
|
544
552
|
], HelixHeadlessObjectInspector.prototype, "itemsLabel", void 0);
|
|
545
553
|
__decorate([
|
|
546
554
|
property({ attribute: 'key-label' })
|
|
547
555
|
], HelixHeadlessObjectInspector.prototype, "keyLabel", void 0);
|
|
548
556
|
__decorate([
|
|
557
|
+
words,
|
|
549
558
|
property({ attribute: 'keys-label' })
|
|
550
559
|
], HelixHeadlessObjectInspector.prototype, "keysLabel", void 0);
|
|
551
560
|
__decorate([
|
|
@@ -558,9 +567,11 @@ __decorate([
|
|
|
558
567
|
property({ attribute: 'result-label' })
|
|
559
568
|
], HelixHeadlessObjectInspector.prototype, "resultLabel", void 0);
|
|
560
569
|
__decorate([
|
|
570
|
+
words,
|
|
561
571
|
property({ attribute: 'results-label' })
|
|
562
572
|
], HelixHeadlessObjectInspector.prototype, "resultsLabel", void 0);
|
|
563
573
|
__decorate([
|
|
574
|
+
words,
|
|
564
575
|
property({ attribute: 'tree-label' })
|
|
565
576
|
], HelixHeadlessObjectInspector.prototype, "treeLabel", void 0);
|
|
566
577
|
__decorate([
|
|
@@ -56,6 +56,11 @@ import { type Branch } from '../levels.js';
|
|
|
56
56
|
* @csspart nav - The navigation landmark.
|
|
57
57
|
*/
|
|
58
58
|
export declare class HelixHeadlessOutline extends HelixElement {
|
|
59
|
+
/**
|
|
60
|
+
* The key this family's words are registered under, its styled tag:
|
|
61
|
+
* `registerWords('de', { 'helix-outline': { label: 'Auf dieser Seite' } })`.
|
|
62
|
+
*/
|
|
63
|
+
static words: string;
|
|
59
64
|
/**
|
|
60
65
|
* Manual, so each link in a flat run can be put in a list item of its own.
|
|
61
66
|
*
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, elementById, HelixActivateEvent, HelixElement, IndicatorController, plainClick, reflectElements, scrollItemIntoView, scrollingAncestor, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, elementById, HelixActivateEvent, HelixElement, IndicatorController, plainClick, reflectElements, scrollItemIntoView, scrollingAncestor, words, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { levelOf, nest } from '../levels.js';
|
|
@@ -78,6 +78,7 @@ let HelixHeadlessOutline = class HelixHeadlessOutline extends HelixElement {
|
|
|
78
78
|
this.namedByHeading = reflectElements(this.partNamed('nav'), 'ariaLabelledByElements', slot?.assignedElements({ flatten: true }) ?? [], this.namedByHeading);
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
+
static { this.words = 'helix-outline'; }
|
|
81
82
|
static { this.shadowRootOptions = {
|
|
82
83
|
...HelixElement.shadowRootOptions,
|
|
83
84
|
slotAssignment: 'manual',
|
|
@@ -287,6 +288,7 @@ __decorate([
|
|
|
287
288
|
property({ type: Boolean })
|
|
288
289
|
], HelixHeadlessOutline.prototype, "follow", void 0);
|
|
289
290
|
__decorate([
|
|
291
|
+
words,
|
|
290
292
|
property()
|
|
291
293
|
], HelixHeadlessOutline.prototype, "label", void 0);
|
|
292
294
|
__decorate([
|
|
@@ -58,6 +58,11 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
58
58
|
* @cssstate empty - There is one page or none, so there is nothing to page through.
|
|
59
59
|
*/
|
|
60
60
|
export declare class HelixHeadlessPagination extends HelixElement {
|
|
61
|
+
/**
|
|
62
|
+
* The key this family's words are registered under, its styled tag:
|
|
63
|
+
* `registerWords('de', { 'helix-pagination': { nextLabel: 'Nächste Seite' } })`.
|
|
64
|
+
*/
|
|
65
|
+
static words: string;
|
|
61
66
|
/**
|
|
62
67
|
* How many pages to show at each end, whatever the current one is.
|
|
63
68
|
*/
|
|
@@ -119,7 +124,8 @@ export declare class HelixHeadlessPagination extends HelixElement {
|
|
|
119
124
|
*/
|
|
120
125
|
lastLabel: string;
|
|
121
126
|
/**
|
|
122
|
-
*
|
|
127
|
+
* The locale the words and the page numbers are in, as a BCP 47 tag such as
|
|
128
|
+
* `de`. Empty reads the nearest `lang`, then the browser's language.
|
|
123
129
|
*
|
|
124
130
|
* The same property the calendar takes, doing the same job one layer down:
|
|
125
131
|
* the templates make the *words* the consumer's, and this makes the *numbers*
|
|
@@ -4,13 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, deepActiveElement, fillTemplate, formatNumbers, HelixActivateEvent, HelixElement, HelixNavigateEvent, hostAria, requestChange, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, deepActiveElement, fillTemplate, formatNumbers, formatWords, HelixActivateEvent, HelixElement, HelixNavigateEvent, hostAria, requestChange, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretDoubleLeft, caretDoubleRight, caretLeft, caretRight, } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
11
11
|
import { repeat } from 'lit/directives/repeat.js';
|
|
12
12
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
13
|
-
const fill = (template, page, pages
|
|
13
|
+
const fill = (template, page, pages) => fillTemplate(template, { page: String(page), pages: String(pages) });
|
|
14
14
|
let HelixHeadlessPagination = class HelixHeadlessPagination extends HelixElement {
|
|
15
15
|
constructor() {
|
|
16
16
|
super(...arguments);
|
|
@@ -47,6 +47,7 @@ let HelixHeadlessPagination = class HelixHeadlessPagination extends HelixElement
|
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
49
|
}
|
|
50
|
+
static { this.words = 'helix-pagination'; }
|
|
50
51
|
get page() {
|
|
51
52
|
const asked = this.pageState ?? this.defaultPage;
|
|
52
53
|
return Math.min(this.count, Math.max(1, Math.floor(asked) || 1));
|
|
@@ -57,7 +58,7 @@ let HelixHeadlessPagination = class HelixHeadlessPagination extends HelixElement
|
|
|
57
58
|
this.requestUpdate('page', previous);
|
|
58
59
|
}
|
|
59
60
|
get numbers() {
|
|
60
|
-
return formatNumbers(this
|
|
61
|
+
return formatNumbers(wordsLocale(this));
|
|
61
62
|
}
|
|
62
63
|
get count() {
|
|
63
64
|
if (this.pages > 0) {
|
|
@@ -162,13 +163,13 @@ let HelixHeadlessPagination = class HelixHeadlessPagination extends HelixElement
|
|
|
162
163
|
}
|
|
163
164
|
if (this.announced !== this.page) {
|
|
164
165
|
this.announced = this.page;
|
|
165
|
-
this.announcement =
|
|
166
|
+
this.announcement = formatWords(this, 'pageLabel', { page: this.page, pages: this.count });
|
|
166
167
|
}
|
|
167
168
|
}
|
|
168
169
|
renderPage(page) {
|
|
169
170
|
const current = page === this.current;
|
|
170
171
|
const shown = this.numbers(page);
|
|
171
|
-
const name =
|
|
172
|
+
const name = formatWords(this, 'pageLabel', { page, pages: this.count });
|
|
172
173
|
return html `<li part="item">
|
|
173
174
|
${this.href
|
|
174
175
|
? html `<a
|
|
@@ -192,7 +193,7 @@ let HelixHeadlessPagination = class HelixHeadlessPagination extends HelixElement
|
|
|
192
193
|
}
|
|
193
194
|
renderGap(hidden) {
|
|
194
195
|
const to = Math.round((hidden.from + hidden.to) / 2);
|
|
195
|
-
const name =
|
|
196
|
+
const name = formatWords(this, 'gapLabel', { page: to, pages: this.count });
|
|
196
197
|
return html `<li part="item">
|
|
197
198
|
${this.href
|
|
198
199
|
? html `<a
|
|
@@ -283,7 +284,7 @@ let HelixHeadlessPagination = class HelixHeadlessPagination extends HelixElement
|
|
|
283
284
|
if (this.compact) {
|
|
284
285
|
return html `${this.ends ? this.renderFirst() : nothing}${this.renderPrevious()}
|
|
285
286
|
<span part="status"
|
|
286
|
-
>${
|
|
287
|
+
>${formatWords(this, 'statusLabel', { page: this.current, pages: this.count })}</span
|
|
287
288
|
>
|
|
288
289
|
${this.renderNext()}${this.ends ? this.renderLast() : nothing}${this.renderLive()}`;
|
|
289
290
|
}
|
|
@@ -314,30 +315,36 @@ __decorate([
|
|
|
314
315
|
property({ type: Boolean })
|
|
315
316
|
], HelixHeadlessPagination.prototype, "ends", void 0);
|
|
316
317
|
__decorate([
|
|
318
|
+
words,
|
|
317
319
|
property({ attribute: 'first-label' })
|
|
318
320
|
], HelixHeadlessPagination.prototype, "firstLabel", void 0);
|
|
319
321
|
__decorate([
|
|
322
|
+
words,
|
|
320
323
|
property({ attribute: 'gap-label' })
|
|
321
324
|
], HelixHeadlessPagination.prototype, "gapLabel", void 0);
|
|
322
325
|
__decorate([
|
|
323
326
|
property()
|
|
324
327
|
], HelixHeadlessPagination.prototype, "href", void 0);
|
|
325
328
|
__decorate([
|
|
329
|
+
words,
|
|
326
330
|
property()
|
|
327
331
|
], HelixHeadlessPagination.prototype, "label", void 0);
|
|
328
332
|
__decorate([
|
|
333
|
+
words,
|
|
329
334
|
property({ attribute: 'last-label' })
|
|
330
335
|
], HelixHeadlessPagination.prototype, "lastLabel", void 0);
|
|
331
336
|
__decorate([
|
|
332
337
|
property()
|
|
333
338
|
], HelixHeadlessPagination.prototype, "locale", void 0);
|
|
334
339
|
__decorate([
|
|
340
|
+
words,
|
|
335
341
|
property({ attribute: 'next-label' })
|
|
336
342
|
], HelixHeadlessPagination.prototype, "nextLabel", void 0);
|
|
337
343
|
__decorate([
|
|
338
344
|
property({ type: Number })
|
|
339
345
|
], HelixHeadlessPagination.prototype, "page", null);
|
|
340
346
|
__decorate([
|
|
347
|
+
words,
|
|
341
348
|
property({ attribute: 'page-label' })
|
|
342
349
|
], HelixHeadlessPagination.prototype, "pageLabel", void 0);
|
|
343
350
|
__decorate([
|
|
@@ -347,12 +354,14 @@ __decorate([
|
|
|
347
354
|
property({ attribute: 'page-size', type: Number })
|
|
348
355
|
], HelixHeadlessPagination.prototype, "pageSize", void 0);
|
|
349
356
|
__decorate([
|
|
357
|
+
words,
|
|
350
358
|
property({ attribute: 'previous-label' })
|
|
351
359
|
], HelixHeadlessPagination.prototype, "previousLabel", void 0);
|
|
352
360
|
__decorate([
|
|
353
361
|
property({ type: Number })
|
|
354
362
|
], HelixHeadlessPagination.prototype, "siblings", void 0);
|
|
355
363
|
__decorate([
|
|
364
|
+
words,
|
|
356
365
|
property({ attribute: 'status-label' })
|
|
357
366
|
], HelixHeadlessPagination.prototype, "statusLabel", void 0);
|
|
358
367
|
__decorate([
|