@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
|
@@ -132,6 +132,11 @@ declare const HelixHeadlessFilterInput_base: (new (...args: any[]) => import("@f
|
|
|
132
132
|
* @cssstate open - The suggestions are open.
|
|
133
133
|
*/
|
|
134
134
|
export declare class HelixHeadlessFilterInput extends HelixHeadlessFilterInput_base {
|
|
135
|
+
/**
|
|
136
|
+
* The key this family's words are registered under, its styled tag:
|
|
137
|
+
* `registerWords('de', { 'helix-filter-input': { clearLabel: 'Leeren' } })`.
|
|
138
|
+
*/
|
|
139
|
+
static words: string;
|
|
135
140
|
protected readonly aria: AriaForwardController;
|
|
136
141
|
/** Typed, so every keystroke is announced. See `announcesInput`. */
|
|
137
142
|
protected readonly announcesInput = true;
|
|
@@ -161,9 +166,21 @@ export declare class HelixHeadlessFilterInput extends HelixHeadlessFilterInput_b
|
|
|
161
166
|
* Not a label: it goes when typing starts.
|
|
162
167
|
*/
|
|
163
168
|
placeholder: string;
|
|
164
|
-
/**
|
|
165
|
-
|
|
166
|
-
|
|
169
|
+
/**
|
|
170
|
+
* What a reader hears for one suggestion, where `suggestions-label` should
|
|
171
|
+
* not say it. `{count}` is the count.
|
|
172
|
+
*
|
|
173
|
+
* @deprecated Write every form in `suggestions-label`, as `{count, plural,
|
|
174
|
+
* one {# suggestion} other {# suggestions}}`. Removed in the next major
|
|
175
|
+
* version.
|
|
176
|
+
*/
|
|
177
|
+
suggestionLabel?: string;
|
|
178
|
+
/**
|
|
179
|
+
* What a reader hears as the panel opens on its suggestions. `{count}` is
|
|
180
|
+
* how many, written in the locale, and each language writes the forms it
|
|
181
|
+
* has: `{count, plural, one {# sugestia} few {# sugestie} many {# sugestii}
|
|
182
|
+
* other {# sugestii}}`.
|
|
183
|
+
*/
|
|
167
184
|
suggestionsLabel: string;
|
|
168
185
|
/** The live region, rendered from the first count said. */
|
|
169
186
|
private readonly status;
|
|
@@ -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, countLabel, customElement, drawIcon, drawStatus, HelixFacetEvent, HelixFormElement, holdCaret, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, PopoverController, restoreValue, StatusController, scrollItemIntoView, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, countLabel, customElement, drawIcon, drawStatus, formatWords, HelixFacetEvent, HelixFormElement, holdCaret, MixinControllerOpen, MixinControllerValue, MixinField, MixinTokens, PopoverController, restoreValue, StatusController, scrollItemIntoView, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { x } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
@@ -25,8 +25,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinContr
|
|
|
25
25
|
this.clearLabel = 'Clear';
|
|
26
26
|
this.filterSuggestions = false;
|
|
27
27
|
this.placeholder = '';
|
|
28
|
-
this.
|
|
29
|
-
this.suggestionsLabel = '{count} suggestions';
|
|
28
|
+
this.suggestionsLabel = '{count, plural, one {# suggestion} other {# suggestions}}';
|
|
30
29
|
this.status = new StatusController(this);
|
|
31
30
|
this.saidCount = -1;
|
|
32
31
|
this.narrowed = new Set();
|
|
@@ -161,6 +160,7 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinContr
|
|
|
161
160
|
this.over = this.hideOverflow(this.tokens);
|
|
162
161
|
};
|
|
163
162
|
}
|
|
163
|
+
static { this.words = 'helix-filter-input'; }
|
|
164
164
|
narrow() {
|
|
165
165
|
const term = this.filterSuggestions
|
|
166
166
|
? currentTerm(this.value, this.control?.selectionStart ?? this.value.length)
|
|
@@ -186,7 +186,9 @@ let HelixHeadlessFilterInput = class HelixHeadlessFilterInput extends MixinContr
|
|
|
186
186
|
if (count < 0) {
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
|
-
this.status.sayNow(
|
|
189
|
+
this.status.sayNow(this.suggestionLabel
|
|
190
|
+
? countLabel(count, this.suggestionLabel, this.suggestionsLabel, wordsLocale(this))
|
|
191
|
+
: formatWords(this, 'suggestionsLabel', { count }));
|
|
190
192
|
}
|
|
191
193
|
formValue() {
|
|
192
194
|
const entries = (this.tokens?.assignedElements({ flatten: true }) ?? [])
|
|
@@ -443,6 +445,7 @@ __decorate([
|
|
|
443
445
|
property({ type: Boolean })
|
|
444
446
|
], HelixHeadlessFilterInput.prototype, "clearable", void 0);
|
|
445
447
|
__decorate([
|
|
448
|
+
words,
|
|
446
449
|
property({ attribute: 'clear-label' })
|
|
447
450
|
], HelixHeadlessFilterInput.prototype, "clearLabel", void 0);
|
|
448
451
|
__decorate([
|
|
@@ -455,6 +458,7 @@ __decorate([
|
|
|
455
458
|
property({ attribute: 'suggestion-label' })
|
|
456
459
|
], HelixHeadlessFilterInput.prototype, "suggestionLabel", void 0);
|
|
457
460
|
__decorate([
|
|
461
|
+
words,
|
|
458
462
|
property({ attribute: 'suggestions-label' })
|
|
459
463
|
], HelixHeadlessFilterInput.prototype, "suggestionsLabel", void 0);
|
|
460
464
|
__decorate([
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type TemplateResult } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* Each date field `Intl` names, drawn as a part of its own.
|
|
4
|
+
*
|
|
5
|
+
* Keyed by the `type` of `Intl.DateTimeFormat#formatToParts`. Written out one
|
|
6
|
+
* template to a field rather than bound through one `part` binding, because a
|
|
7
|
+
* part is read from the source as a literal: a bound name is a part no
|
|
8
|
+
* stylesheet check can find. A type left out, the punctuation between the
|
|
9
|
+
* fields among them, is drawn as plain text.
|
|
10
|
+
*/
|
|
11
|
+
export declare const FIELD: Record<string, (value: string) => TemplateResult>;
|
|
12
|
+
/**
|
|
13
|
+
* A formatted date, each field in a part of its own and the text between them
|
|
14
|
+
* as it is.
|
|
15
|
+
*
|
|
16
|
+
* The words are the ones `format` would give, in the same order, so the reading
|
|
17
|
+
* a screen reader hears and the text a reader copies do not change: an inline
|
|
18
|
+
* span with no style of its own changes nothing on the page either.
|
|
19
|
+
*/
|
|
20
|
+
export declare const drawFields: (parts: readonly Intl.DateTimeFormatPart[]) => unknown[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
export const FIELD = {
|
|
3
|
+
day: (value) => html `<span part="day">${value}</span>`,
|
|
4
|
+
dayPeriod: (value) => html `<span part="day-period">${value}</span>`,
|
|
5
|
+
era: (value) => html `<span part="era">${value}</span>`,
|
|
6
|
+
hour: (value) => html `<span part="hour">${value}</span>`,
|
|
7
|
+
minute: (value) => html `<span part="minute">${value}</span>`,
|
|
8
|
+
month: (value) => html `<span part="month">${value}</span>`,
|
|
9
|
+
second: (value) => html `<span part="second">${value}</span>`,
|
|
10
|
+
timeZoneName: (value) => html `<span part="time-zone-name">${value}</span>`,
|
|
11
|
+
weekday: (value) => html `<span part="weekday">${value}</span>`,
|
|
12
|
+
year: (value) => html `<span part="year">${value}</span>`,
|
|
13
|
+
};
|
|
14
|
+
export const drawFields = (parts) => parts.map(({ type, value }) => FIELD[type]?.(value) ?? value);
|
|
@@ -18,7 +18,8 @@ export interface Asked {
|
|
|
18
18
|
year?: 'numeric' | '2-digit' | undefined;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
* The `Intl.DateTimeFormat` options for what was asked, and none that was not
|
|
21
|
+
* The `Intl.DateTimeFormat` options for what was asked, and none that was not:
|
|
22
|
+
* an option not asked for is `undefined`, which `Intl` reads as absent.
|
|
22
23
|
*
|
|
23
24
|
* **A style wins over the fields.** `dateStyle` and `timeStyle` are each
|
|
24
25
|
* locale's own whole pattern, and `Intl` throws a `TypeError` when one is
|
|
@@ -1,42 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
'era',
|
|
4
|
-
'hour',
|
|
5
|
-
'minute',
|
|
6
|
-
'month',
|
|
7
|
-
'second',
|
|
8
|
-
'timeZoneName',
|
|
9
|
-
'weekday',
|
|
10
|
-
'year',
|
|
11
|
-
];
|
|
1
|
+
import { FIELD } from './fields.js';
|
|
2
|
+
const FIELDS = Object.keys(FIELD);
|
|
12
3
|
export const formatOptions = (asked, dateOnly = false) => {
|
|
13
|
-
const options = {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
options.timeStyle = asked.timeStyle;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
for (const field of FIELDS) {
|
|
25
|
-
const value = asked[field];
|
|
26
|
-
if (value) {
|
|
27
|
-
;
|
|
28
|
-
options[field] = value;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (asked.hourCycle) {
|
|
33
|
-
options.hourCycle = asked.hourCycle;
|
|
34
|
-
}
|
|
35
|
-
if (asked.timeZone) {
|
|
36
|
-
options.timeZone = asked.timeZone;
|
|
37
|
-
}
|
|
38
|
-
else if (dateOnly) {
|
|
39
|
-
options.timeZone = 'UTC';
|
|
4
|
+
const options = {
|
|
5
|
+
hourCycle: asked.hourCycle,
|
|
6
|
+
timeZone: asked.timeZone || (dateOnly ? 'UTC' : undefined),
|
|
7
|
+
};
|
|
8
|
+
const styled = asked.dateStyle || asked.timeStyle;
|
|
9
|
+
for (const field of styled ? ['dateStyle', 'timeStyle'] : FIELDS) {
|
|
10
|
+
options[field] = asked[field];
|
|
40
11
|
}
|
|
41
12
|
return options;
|
|
42
13
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HelixElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { type DateCalendar, HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary A timestamp, formatted for the user's locale.
|
|
@@ -27,6 +27,12 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
27
27
|
* showing a date schedules none, so a long feed left open costs almost nothing.
|
|
28
28
|
* `frozen` draws the reading once and leaves it.
|
|
29
29
|
*
|
|
30
|
+
* **`fields` draws each field of a date as a part of its own**, such as
|
|
31
|
+
* `day`, `month` and `year`, so a stylesheet can set the year in a lighter ink
|
|
32
|
+
* or the weekday in capitals with `::part()`. The text between the fields is
|
|
33
|
+
* the locale's own and has no part. An `elapsed` or `relative` reading is one
|
|
34
|
+
* phrase, with no parts inside it.
|
|
35
|
+
*
|
|
30
36
|
* **The output is always `<time datetime>`**, so copy and paste and scripts
|
|
31
37
|
* parsing the page get the exact instant, whatever the visible text says. A
|
|
32
38
|
* screen reader reads the text, so an `elapsed` reading is named in full, such
|
|
@@ -37,15 +43,43 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
37
43
|
* Picker format their dates, so a reader west of UTC sees August 4 and not
|
|
38
44
|
* August 3.
|
|
39
45
|
*
|
|
46
|
+
* **A date is written in a calendar Date Picker draws**: the locale's own
|
|
47
|
+
* where its months are the Gregorian months, as `th-TH` writes 2569 for 2026,
|
|
48
|
+
* and `gregory` where they are not, as for `fa-IR`. `calendar` picks one of
|
|
49
|
+
* the five.
|
|
50
|
+
*
|
|
40
51
|
* @since 0.1.0
|
|
41
52
|
* @status stable
|
|
42
53
|
* @category typography
|
|
43
54
|
* @aliases RelativeTime, Timestamp, TimeAgo
|
|
44
55
|
* @documentation https://fusion.dev/helix/components/format-date
|
|
45
56
|
*
|
|
57
|
+
* @csspart day - The day of the month, with `fields`.
|
|
58
|
+
* @csspart day-period - AM or PM, or the locale's word for the part of the day, with `fields`.
|
|
59
|
+
* @csspart era - The era, such as AD, with `fields` and `era`.
|
|
60
|
+
* @csspart hour - The hour, with `fields`.
|
|
61
|
+
* @csspart minute - The minute, with `fields`.
|
|
62
|
+
* @csspart month - The month, with `fields`.
|
|
63
|
+
* @csspart second - The second, with `fields`.
|
|
46
64
|
* @csspart time - The `<time>` element that holds the formatted text.
|
|
65
|
+
* @csspart time-zone-name - The time zone's name, with `fields`, where `time-zone-name` or a `long` or `full` `time-style` shows it.
|
|
66
|
+
* @csspart weekday - The day of the week, with `fields`.
|
|
67
|
+
* @csspart year - The year, with `fields`.
|
|
68
|
+
*
|
|
69
|
+
* @cssstate future - An `elapsed` or `relative` reading of a moment still to come, such as "in 3 hours".
|
|
70
|
+
* @cssstate past - An `elapsed` or `relative` reading of a moment gone, such as "3 hours ago".
|
|
47
71
|
*/
|
|
48
72
|
export declare class HelixHeadlessFormatDate extends HelixElement {
|
|
73
|
+
/**
|
|
74
|
+
* The calendar a date is written in: `gregory`, `buddhist`, `japanese`,
|
|
75
|
+
* `roc`, or `iso8601`, the calendars Date Picker and Date Input draw.
|
|
76
|
+
*
|
|
77
|
+
* Absent is the locale's own where it is one of the five, such as
|
|
78
|
+
* `buddhist` for `th-TH`, and `gregory` for every other, such as `persian`
|
|
79
|
+
* for `fa-IR`, so a date written here reads as the same date a Date Picker
|
|
80
|
+
* beside it shows.
|
|
81
|
+
*/
|
|
82
|
+
calendar?: DateCalendar;
|
|
49
83
|
/**
|
|
50
84
|
* The timestamp, in any format `Date` can parse.
|
|
51
85
|
*
|
|
@@ -86,6 +120,16 @@ export declare class HelixHeadlessFormatDate extends HelixElement {
|
|
|
86
120
|
* How the era is written, such as AD, where a date is shown.
|
|
87
121
|
*/
|
|
88
122
|
era?: 'long' | 'narrow' | 'short';
|
|
123
|
+
/**
|
|
124
|
+
* Draws each field of a date in a part of its own: `weekday`, `day`,
|
|
125
|
+
* `month`, `year`, `era`, `hour`, `minute`, `second`, `day-period` and
|
|
126
|
+
* `time-zone-name`, so `::part(year)` can set the year apart.
|
|
127
|
+
*
|
|
128
|
+
* Off by default, which draws the date as one run of text, as Shoelace and
|
|
129
|
+
* Web Awesome do. An `elapsed` or `relative` reading is one phrase either
|
|
130
|
+
* way.
|
|
131
|
+
*/
|
|
132
|
+
fields?: boolean;
|
|
89
133
|
/**
|
|
90
134
|
* Draws an `elapsed` or `relative` reading once and leaves it, where it
|
|
91
135
|
* would otherwise move on as it goes stale.
|
|
@@ -118,7 +162,10 @@ export declare class HelixHeadlessFormatDate extends HelixElement {
|
|
|
118
162
|
* Shoelace and Web Awesome read it, then the runtime's own.
|
|
119
163
|
*/
|
|
120
164
|
locale: string;
|
|
121
|
-
/**
|
|
165
|
+
/**
|
|
166
|
+
* The locale the words are written in, `locale` or the page's `lang`, with
|
|
167
|
+
* the calendar.
|
|
168
|
+
*/
|
|
122
169
|
private get language();
|
|
123
170
|
/**
|
|
124
171
|
* How the minute is written, where a time of day is shown.
|
|
@@ -184,15 +231,18 @@ export declare class HelixHeadlessFormatDate extends HelixElement {
|
|
|
184
231
|
private readonly clock;
|
|
185
232
|
/**
|
|
186
233
|
* The date read out of the light DOM, where no attribute carried one.
|
|
234
|
+
*
|
|
235
|
+
* Not a reactive state: `read` asks for the update itself, which keeps the
|
|
236
|
+
* `state` decorator out of this element's bundle.
|
|
187
237
|
*/
|
|
188
238
|
private written;
|
|
189
|
-
private watching
|
|
239
|
+
private watching?;
|
|
190
240
|
/** Whether the timestamp is a day with no time, which is formatted in UTC. */
|
|
191
241
|
private get dateOnly();
|
|
192
242
|
/** The timestamp, or nothing where there is not one to read. */
|
|
193
243
|
private get moment();
|
|
194
|
-
/**
|
|
195
|
-
private get
|
|
244
|
+
/** The timestamp as written, in the attribute or in the light DOM. */
|
|
245
|
+
private get source();
|
|
196
246
|
/** Whether the reading is how long ago rather than the date. */
|
|
197
247
|
private get reading();
|
|
198
248
|
/** What the reading says now, and when it stops being true. */
|
|
@@ -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 { customElement, elapsedTime, HelixElement,
|
|
7
|
+
import { calendarLocale, customElement, elapsedTime, HelixElement, RelativeClockController, relativeTime, wordsLocale, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
|
-
import { property
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { drawFields } from '../fields.js';
|
|
10
11
|
import { formatOptions } from '../options.js';
|
|
11
12
|
const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
12
13
|
let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement {
|
|
@@ -22,28 +23,27 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
|
|
|
22
23
|
if (!moment || !this.reading) {
|
|
23
24
|
return undefined;
|
|
24
25
|
}
|
|
25
|
-
return this.frozen ?
|
|
26
|
+
return this.frozen ? Infinity : this.readingAt(moment, now).next;
|
|
26
27
|
},
|
|
27
28
|
});
|
|
28
29
|
this.written = '';
|
|
29
|
-
this.watching = undefined;
|
|
30
30
|
}
|
|
31
31
|
get language() {
|
|
32
|
-
return
|
|
32
|
+
return calendarLocale(wordsLocale(this), this.calendar);
|
|
33
33
|
}
|
|
34
34
|
get dateOnly() {
|
|
35
|
-
return DATE_ONLY.test(
|
|
35
|
+
return DATE_ONLY.test(this.source);
|
|
36
36
|
}
|
|
37
37
|
get moment() {
|
|
38
|
-
const source = this.
|
|
38
|
+
const source = this.source;
|
|
39
39
|
if (source === '') {
|
|
40
40
|
return undefined;
|
|
41
41
|
}
|
|
42
42
|
const parsed = new Date(source);
|
|
43
43
|
return Number.isNaN(parsed.getTime()) ? undefined : parsed;
|
|
44
44
|
}
|
|
45
|
-
get
|
|
46
|
-
return
|
|
45
|
+
get source() {
|
|
46
|
+
return (this.date || this.written).trim();
|
|
47
47
|
}
|
|
48
48
|
get reading() {
|
|
49
49
|
return this.elapsed || this.relative !== undefined;
|
|
@@ -65,7 +65,6 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
|
|
|
65
65
|
disconnectedCallback() {
|
|
66
66
|
super.disconnectedCallback();
|
|
67
67
|
this.watching?.disconnect();
|
|
68
|
-
this.watching = undefined;
|
|
69
68
|
}
|
|
70
69
|
firstUpdated(changed) {
|
|
71
70
|
super.firstUpdated(changed);
|
|
@@ -77,14 +76,12 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
|
|
|
77
76
|
if (this.childrenKnown) {
|
|
78
77
|
this.read();
|
|
79
78
|
}
|
|
80
|
-
if (changed.has(
|
|
81
|
-
changed.has('elapsed') ||
|
|
82
|
-
changed.has('frozen') ||
|
|
83
|
-
changed.has('locale') ||
|
|
84
|
-
changed.has('numeric') ||
|
|
85
|
-
changed.has('relative')) {
|
|
79
|
+
if (['date', 'elapsed', 'frozen', 'locale', 'numeric', 'relative'].some((key) => changed.has(key))) {
|
|
86
80
|
this.clock.tick();
|
|
87
81
|
}
|
|
82
|
+
const ahead = this.reading ? (this.moment?.getTime() ?? NaN) - this.clock.now : NaN;
|
|
83
|
+
this.toggleState('past', ahead <= 0);
|
|
84
|
+
this.toggleState('future', ahead > 0);
|
|
88
85
|
}
|
|
89
86
|
read() {
|
|
90
87
|
if (this.date !== '') {
|
|
@@ -93,6 +90,7 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
|
|
|
93
90
|
const written = this.textContent?.trim() ?? '';
|
|
94
91
|
if (written !== this.written) {
|
|
95
92
|
this.written = written;
|
|
93
|
+
this.requestUpdate();
|
|
96
94
|
this.clock.tick();
|
|
97
95
|
}
|
|
98
96
|
}
|
|
@@ -106,28 +104,25 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
|
|
|
106
104
|
if (!moment) {
|
|
107
105
|
return nothing;
|
|
108
106
|
}
|
|
109
|
-
const datetime = this.dateOnly ?
|
|
107
|
+
const datetime = this.dateOnly ? this.source : moment.toISOString();
|
|
110
108
|
if (!this.reading) {
|
|
111
|
-
const
|
|
112
|
-
return html `<time part="time" datetime=${datetime}>${
|
|
109
|
+
const format = new Intl.DateTimeFormat(this.language || undefined, formatOptions(this, this.dateOnly));
|
|
110
|
+
return html `<time part="time" datetime=${datetime}>${this.fields ? drawFields(format.formatToParts(moment)) : format.format(moment)}</time>`;
|
|
113
111
|
}
|
|
114
112
|
const now = new Date(this.clock.now);
|
|
115
|
-
const
|
|
116
|
-
const whole = new Intl.DateTimeFormat(this.language || undefined, {
|
|
113
|
+
const whole = new Intl.DateTimeFormat(this.language || undefined, formatOptions({
|
|
117
114
|
dateStyle: 'long',
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
}).format(moment);
|
|
115
|
+
hourCycle: this.hourCycle,
|
|
116
|
+
timeStyle: this.dateOnly ? undefined : 'short',
|
|
117
|
+
timeZone: this.timeZone,
|
|
118
|
+
}, this.dateOnly)).format(moment);
|
|
122
119
|
const spoken = relativeTime(this.language, { numeric: this.numeric ?? 'auto' })(moment, now).text;
|
|
123
|
-
return html `<time
|
|
124
|
-
part="time"
|
|
125
|
-
datetime=${datetime}
|
|
126
|
-
aria-label=${spoken}
|
|
127
|
-
title=${whole}
|
|
128
|
-
>${this.readingAt(moment, now).text}</time>`;
|
|
120
|
+
return html `<time part="time" datetime=${datetime} aria-label=${spoken} title=${whole}>${this.readingAt(moment, now).text}</time>`;
|
|
129
121
|
}
|
|
130
122
|
};
|
|
123
|
+
__decorate([
|
|
124
|
+
property()
|
|
125
|
+
], HelixHeadlessFormatDate.prototype, "calendar", void 0);
|
|
131
126
|
__decorate([
|
|
132
127
|
property()
|
|
133
128
|
], HelixHeadlessFormatDate.prototype, "date", void 0);
|
|
@@ -143,6 +138,9 @@ __decorate([
|
|
|
143
138
|
__decorate([
|
|
144
139
|
property()
|
|
145
140
|
], HelixHeadlessFormatDate.prototype, "era", void 0);
|
|
141
|
+
__decorate([
|
|
142
|
+
property({ type: Boolean })
|
|
143
|
+
], HelixHeadlessFormatDate.prototype, "fields", void 0);
|
|
146
144
|
__decorate([
|
|
147
145
|
property({ type: Boolean })
|
|
148
146
|
], HelixHeadlessFormatDate.prototype, "frozen", void 0);
|
|
@@ -185,9 +183,6 @@ __decorate([
|
|
|
185
183
|
__decorate([
|
|
186
184
|
property()
|
|
187
185
|
], HelixHeadlessFormatDate.prototype, "year", void 0);
|
|
188
|
-
__decorate([
|
|
189
|
-
state()
|
|
190
|
-
], HelixHeadlessFormatDate.prototype, "written", void 0);
|
|
191
186
|
HelixHeadlessFormatDate = __decorate([
|
|
192
187
|
customElement('helix-headless-format-date')
|
|
193
188
|
], HelixHeadlessFormatDate);
|
|
@@ -87,6 +87,17 @@ export declare const within: (adjacency: Adjacency, from: string, depth: number)
|
|
|
87
87
|
* its order instead.
|
|
88
88
|
*/
|
|
89
89
|
export declare const entriesOf: (sorted: readonly GraphNode[], adjacency: Adjacency, active: string, query: string, shown?: ReadonlySet<string>) => Entry[];
|
|
90
|
+
/**
|
|
91
|
+
* The row the keyboard stays on once the rows are read again from changed
|
|
92
|
+
* notes or links: the row of the note it was on, `id`, wherever that note now
|
|
93
|
+
* is, or, where the note was taken away, the row at `at` that took its place,
|
|
94
|
+
* the last row where the list grew shorter than that.
|
|
95
|
+
*
|
|
96
|
+
* **The reader stays where they were.** A graph a page feeds as things happen
|
|
97
|
+
* changes its notes every few seconds, and a cursor sent to the top on each
|
|
98
|
+
* change threw a reader moving through the list back to its first row.
|
|
99
|
+
*/
|
|
100
|
+
export declare const cursorAfter: (entries: readonly Entry[], id: string | undefined, at: number) => number;
|
|
90
101
|
/** The notes in the order of their names, as the page's language orders words. */
|
|
91
102
|
export declare const sortedOf: (nodes: readonly GraphNode[], lang?: string) => GraphNode[];
|
|
92
103
|
/** One group the notes are in, as the legend names it. */
|
|
@@ -69,6 +69,10 @@ export const entriesOf = (sorted, adjacency, active, query, shown) => {
|
|
|
69
69
|
}
|
|
70
70
|
return [...first, ...neighbors, ...rest];
|
|
71
71
|
};
|
|
72
|
+
export const cursorAfter = (entries, id, at) => {
|
|
73
|
+
const found = id === undefined ? -1 : entries.findIndex((entry) => entry.node.id === id);
|
|
74
|
+
return found >= 0 ? found : Math.max(0, Math.min(at, entries.length - 1));
|
|
75
|
+
};
|
|
72
76
|
export const sortedOf = (nodes, lang) => {
|
|
73
77
|
const collator = new Intl.Collator(lang || undefined, { numeric: true, sensitivity: 'base' });
|
|
74
78
|
return [...nodes].sort((one, other) => collator.compare(nameOf(one), nameOf(other)));
|