@fusion.dev/helix-headless 0.142.1 → 0.143.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 +16710 -707
- package/dist/accordion/item/accordion-item.d.ts +38 -2
- package/dist/accordion/item/accordion-item.js +38 -6
- package/dist/accordion/root/accordion-root.d.ts +23 -1
- package/dist/accordion/root/accordion-root.js +39 -3
- package/dist/announcement/root/announcement-root.d.ts +11 -7
- package/dist/announcement/root/announcement-root.js +1 -1
- package/dist/app-header/root/app-header-root.d.ts +21 -0
- package/dist/app-header/root/app-header-root.js +31 -5
- package/dist/area-chart/root/area-chart-root.js +16 -5
- package/dist/avatar/group/avatar-group.d.ts +24 -3
- package/dist/avatar/group/avatar-group.js +34 -2
- package/dist/avatar/root/avatar-root.d.ts +3 -1
- package/dist/avatar/root/avatar-root.js +8 -1
- package/dist/badge/root/badge-root.d.ts +8 -0
- package/dist/bar-chart/root/bar-chart-root.d.ts +19 -3
- package/dist/bar-chart/root/bar-chart-root.js +43 -13
- package/dist/blockquote/root/blockquote-root.d.ts +12 -7
- package/dist/blockquote/root/blockquote-root.js +6 -4
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +9 -3
- package/dist/breadcrumbs/root/breadcrumbs-root.js +9 -1
- package/dist/button/root/button-root.d.ts +37 -0
- package/dist/button/root/button-root.js +44 -0
- package/dist/callout/root/callout-root.d.ts +14 -5
- package/dist/callout/root/callout-root.js +11 -3
- package/dist/canvas/root/canvas-root.d.ts +1 -0
- package/dist/canvas/root/canvas-root.js +10 -1
- package/dist/carousel/root/carousel-root.d.ts +47 -5
- package/dist/carousel/root/carousel-root.js +53 -21
- package/dist/chat/composer/chat-composer.d.ts +13 -11
- package/dist/chat/composer/chat-composer.js +6 -12
- package/dist/chat/message/chat-message.js +8 -1
- package/dist/chat/root/chat-root.d.ts +1 -0
- package/dist/chat/root/chat-root.js +2 -1
- package/dist/checkbox/root/checkbox-root.d.ts +7 -0
- package/dist/checkbox/root/checkbox-root.js +7 -3
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +65 -32
- package/dist/checkbox-group/root/checkbox-group-root.js +85 -37
- package/dist/code/root/code-root.d.ts +1 -1
- package/dist/code-block/root/code-block-root.d.ts +19 -0
- package/dist/code-block/root/code-block-root.js +21 -1
- package/dist/color-input/root/color-input-root.d.ts +26 -1
- package/dist/color-input/root/color-input-root.js +32 -3
- package/dist/color-picker/root/color-picker-root.d.ts +37 -7
- package/dist/color-picker/root/color-picker-root.js +83 -6
- package/dist/combobox/root/combobox-root.d.ts +90 -2
- package/dist/combobox/root/combobox-root.js +160 -19
- package/dist/command/root/command-root.d.ts +17 -6
- package/dist/command/root/command-root.js +12 -1
- package/dist/copy-button/root/copy-button-root.d.ts +21 -6
- package/dist/copy-button/root/copy-button-root.js +11 -1
- package/dist/data-table/root/data-table-root.d.ts +164 -10
- package/dist/data-table/root/data-table-root.js +488 -57
- package/dist/date-input/root/date-input-root.d.ts +53 -8
- package/dist/date-input/root/date-input-root.js +70 -18
- package/dist/date-picker/root/date-picker-root.d.ts +84 -17
- package/dist/date-picker/root/date-picker-root.js +125 -20
- package/dist/dialog/root/dialog-root.d.ts +38 -10
- package/dist/dialog/root/dialog-root.js +55 -2
- package/dist/donut-chart/root/donut-chart-root.d.ts +39 -15
- package/dist/donut-chart/root/donut-chart-root.js +30 -10
- package/dist/drawer/root/drawer-root.d.ts +32 -7
- package/dist/drawer/root/drawer-root.js +50 -5
- package/dist/drilldown/item/drilldown-item.d.ts +16 -13
- package/dist/drilldown/item/drilldown-item.js +6 -2
- package/dist/drilldown/root/drilldown-root.d.ts +21 -5
- package/dist/drilldown/root/drilldown-root.js +26 -10
- package/dist/element-events.generated.js +35 -9
- package/dist/file-input/root/file-input-root.d.ts +18 -1
- package/dist/file-input/root/file-input-root.js +34 -8
- package/dist/filter-input/menu/filter-menu.d.ts +9 -0
- package/dist/filter-input/menu/filter-menu.js +8 -0
- package/dist/filter-input/root/filter-input-root.d.ts +5 -2
- package/dist/filter-input/root/filter-input-root.js +22 -7
- package/dist/format-date/root/format-date-root.d.ts +11 -3
- package/dist/format-date/root/format-date-root.js +26 -5
- package/dist/graph/root/graph-root.d.ts +24 -3
- package/dist/graph/root/graph-root.js +66 -12
- package/dist/heatmap/root/buckets.d.ts +2 -1
- package/dist/heatmap/root/buckets.js +5 -1
- package/dist/heatmap/root/heatmap-root.d.ts +27 -6
- package/dist/heatmap/root/heatmap-root.js +23 -6
- package/dist/icon/root/icon-root.d.ts +24 -3
- package/dist/icon/root/icon-root.js +34 -1
- package/dist/icon-button/root/icon-button-root.d.ts +1 -1
- package/dist/image/root/image-root.d.ts +9 -2
- package/dist/image/root/image-root.js +8 -2
- package/dist/input/root/input-root.d.ts +51 -9
- package/dist/input/root/input-root.js +46 -5
- package/dist/kbd/root/kbd-root.d.ts +12 -4
- package/dist/kbd/root/kbd-root.js +10 -11
- package/dist/legend/root/legend-root.d.ts +7 -0
- package/dist/legend/root/legend-root.js +7 -2
- package/dist/lightbox/item/lightbox-item.d.ts +2 -1
- package/dist/lightbox/root/lightbox-root.d.ts +16 -5
- package/dist/lightbox/root/lightbox-root.js +24 -3
- package/dist/line-chart/root/line-chart-root.d.ts +19 -2
- package/dist/line-chart/root/line-chart-root.js +40 -13
- package/dist/list/item/list-item.d.ts +11 -5
- package/dist/list/item/list-item.js +5 -6
- package/dist/listbox/root/listbox-root.d.ts +111 -2
- package/dist/listbox/root/listbox-root.js +144 -16
- package/dist/map/root/map-root.d.ts +19 -4
- package/dist/map/root/map-root.js +36 -7
- package/dist/megamenu/root/megamenu-root.d.ts +10 -1
- package/dist/megamenu/root/megamenu-root.js +10 -1
- package/dist/menu/item/menu-item.d.ts +41 -12
- package/dist/menu/item/menu-item.js +46 -3
- package/dist/menu/root/menu-root.d.ts +32 -2
- package/dist/menu/root/menu-root.js +48 -8
- package/dist/meter/root/meter-root.d.ts +6 -0
- package/dist/meter/root/meter-root.js +18 -2
- package/dist/navigation/root/navigation-root.d.ts +10 -2
- package/dist/navigation/root/navigation-root.js +13 -2
- package/dist/notifications/group/notification-group.d.ts +1 -0
- package/dist/notifications/notification/notification.d.ts +12 -0
- package/dist/notifications/notification/notification.js +31 -2
- package/dist/notifications/root/notifications-root.d.ts +7 -0
- package/dist/notifications/root/notifications-root.js +17 -2
- package/dist/number-input/root/number-input-root.d.ts +62 -7
- package/dist/number-input/root/number-input-root.js +68 -16
- package/dist/object-inspector/root/object-inspector-root.d.ts +48 -5
- package/dist/object-inspector/root/object-inspector-root.js +91 -11
- package/dist/option/root/option-root.d.ts +4 -1
- package/dist/option/root/option-root.js +1 -0
- package/dist/outline/root/outline-root.d.ts +13 -2
- package/dist/outline/root/outline-root.js +4 -2
- package/dist/pagination/root/pagination-root.d.ts +19 -1
- package/dist/pagination/root/pagination-root.js +49 -9
- package/dist/pagination/size/pagination-size.d.ts +13 -3
- package/dist/pagination/size/pagination-size.js +7 -0
- package/dist/pin-input/root/pin-input-root.d.ts +16 -0
- package/dist/pin-input/root/pin-input-root.js +19 -5
- package/dist/popover/root/popover-root.d.ts +19 -2
- package/dist/popover/root/popover-root.js +22 -1
- package/dist/progress/root/progress-root.d.ts +16 -1
- package/dist/progress/root/progress-root.js +31 -7
- package/dist/qr-code/root/qr-code-root.d.ts +19 -0
- package/dist/qr-code/root/qr-code-root.js +29 -1
- package/dist/radio/group/radio-group.d.ts +41 -0
- package/dist/radio/group/radio-group.js +50 -14
- package/dist/radio/root/radio-root.d.ts +8 -5
- package/dist/radio/root/radio-root.js +1 -2
- package/dist/rating/root/rating-root.d.ts +24 -1
- package/dist/rating/root/rating-root.js +24 -7
- package/dist/scatter-chart/root/scatter-chart-root.js +15 -7
- package/dist/select/root/select-root.d.ts +69 -3
- package/dist/select/root/select-root.js +92 -8
- package/dist/skeleton/root/skeleton-root.d.ts +14 -3
- package/dist/skeleton/root/skeleton-root.js +17 -3
- package/dist/skip-link/root/skip-link-root.d.ts +10 -0
- package/dist/skip-link/root/skip-link-root.js +15 -1
- package/dist/slider/root/slider-root.d.ts +20 -2
- package/dist/slider/root/slider-root.js +41 -3
- package/dist/sparkline/root/sparkline-root.d.ts +9 -10
- package/dist/speed-dial/item/speed-dial-item.d.ts +11 -5
- package/dist/speed-dial/item/speed-dial-item.js +7 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +15 -4
- package/dist/speed-dial/root/speed-dial-root.js +19 -5
- package/dist/splitter/root/splitter-root.d.ts +28 -6
- package/dist/splitter/root/splitter-root.js +35 -1
- package/dist/stat/root/stat-root.d.ts +7 -1
- package/dist/stat/root/stat-root.js +14 -1
- package/dist/steps/root/steps-root.js +1 -1
- package/dist/switch/root/switch-root.d.ts +2 -0
- package/dist/switch/root/switch-root.js +1 -0
- package/dist/table/cell/table-cell.d.ts +24 -4
- package/dist/table/cell/table-cell.js +21 -1
- package/dist/table/column/table-column.d.ts +32 -6
- package/dist/table/column/table-column.js +36 -6
- package/dist/table/root/table-root.d.ts +94 -3
- package/dist/table/root/table-root.js +128 -5
- package/dist/table/row/table-row.d.ts +7 -0
- package/dist/table/row/table-row.js +9 -1
- package/dist/tabs/root/tabs-root.d.ts +6 -1
- package/dist/tabs/root/tabs-root.js +6 -2
- package/dist/tag/root/tag-root.d.ts +23 -1
- package/dist/tag/root/tag-root.js +16 -2
- package/dist/textarea/root/textarea-root.d.ts +4 -0
- package/dist/textarea/root/textarea-root.js +1 -1
- package/dist/time-input/root/time-input-root.d.ts +28 -2
- package/dist/time-input/root/time-input-root.js +46 -10
- package/dist/time-picker/root/time-picker-root.d.ts +101 -18
- package/dist/time-picker/root/time-picker-root.js +115 -16
- package/dist/toast/root/toast-root.d.ts +64 -1
- package/dist/toast/root/toast-root.js +147 -2
- package/dist/toggle/group/toggle-group.d.ts +38 -1
- package/dist/toggle/group/toggle-group.js +34 -8
- package/dist/toggle/root/toggle-root.d.ts +14 -10
- package/dist/toggle/root/toggle-root.js +3 -3
- package/dist/toolbar/root/toolbar-root.d.ts +55 -15
- package/dist/toolbar/root/toolbar-root.js +99 -16
- package/dist/tooltip/root/tooltip-root.d.ts +37 -4
- package/dist/tooltip/root/tooltip-root.js +48 -0
- package/dist/tour/root/tour-root.d.ts +34 -5
- package/dist/tour/root/tour-root.js +51 -14
- package/dist/tour/stop/tour-stop.d.ts +18 -1
- package/dist/tour/stop/tour-stop.js +25 -5
- package/dist/tree/item/tree-item.d.ts +21 -5
- package/dist/tree/item/tree-item.js +14 -4
- package/dist/tree/root/tree-root.d.ts +29 -5
- package/dist/tree/root/tree-root.js +64 -8
- package/dist/trend/root/trend-root.d.ts +23 -1
- package/dist/trend/root/trend-root.js +28 -7
- package/dist/video/root/keys.d.ts +5 -0
- package/dist/video/root/keys.js +13 -1
- package/dist/video/root/video-root.d.ts +19 -0
- package/dist/video/root/video-root.js +48 -4
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +20 -2
- package/dist/video-playlist/menu/video-playlist-menu.js +27 -5
- package/dist/video-playlist/root/video-playlist-root.js +6 -3
- package/dist/virtual-list/root/virtual-list-root.d.ts +52 -4
- package/dist/virtual-list/root/virtual-list-root.js +103 -21
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +4348 -965
- package/types/vue.d.ts +972 -232
|
@@ -4,18 +4,32 @@ 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, HelixElement } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, HelixElement, hostAria } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
9
10
|
let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.label = '';
|
|
14
|
+
}
|
|
10
15
|
willUpdate(changed) {
|
|
11
16
|
super.willUpdate(changed);
|
|
12
|
-
this.
|
|
13
|
-
|
|
17
|
+
if (this.label) {
|
|
18
|
+
hostAria(this.internals, { label: this.label, role: 'progressbar' });
|
|
19
|
+
this.internals.ariaHidden = null;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
hostAria(this.internals, { label: '', role: '' });
|
|
23
|
+
this.internals.ariaHidden = 'true';
|
|
24
|
+
}
|
|
14
25
|
}
|
|
15
26
|
render() {
|
|
16
27
|
return html `<span part="skeleton"></span>`;
|
|
17
28
|
}
|
|
18
29
|
};
|
|
30
|
+
__decorate([
|
|
31
|
+
property()
|
|
32
|
+
], HelixHeadlessSkeleton.prototype, "label", void 0);
|
|
19
33
|
HelixHeadlessSkeleton = __decorate([
|
|
20
34
|
customElement('helix-headless-skeleton')
|
|
21
35
|
], HelixHeadlessSkeleton);
|
|
@@ -75,6 +75,16 @@ export declare class HelixHeadlessSkipLink extends HelixElement {
|
|
|
75
75
|
* region.
|
|
76
76
|
*/
|
|
77
77
|
private readonly skip;
|
|
78
|
+
/** The `href` the last warning was for, so a page hears once per target. */
|
|
79
|
+
private missed;
|
|
80
|
+
/**
|
|
81
|
+
* Says so when an in-page `href` names nothing.
|
|
82
|
+
*
|
|
83
|
+
* Asked on a press and not on connection: the link is first in the
|
|
84
|
+
* document, so its target is usually parsed or rendered after it, and an
|
|
85
|
+
* early check would warn about a page that is still arriving.
|
|
86
|
+
*/
|
|
87
|
+
private reportMissing;
|
|
78
88
|
protected render(): TemplateResult;
|
|
79
89
|
}
|
|
80
90
|
declare global {
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { customElement, elementById, HelixElement } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, elementById, HelixElement, reportRuntime } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
@@ -18,6 +18,7 @@ let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
|
18
18
|
}
|
|
19
19
|
const target = this.target;
|
|
20
20
|
if (!target) {
|
|
21
|
+
this.reportMissing();
|
|
21
22
|
return;
|
|
22
23
|
}
|
|
23
24
|
event.preventDefault();
|
|
@@ -29,6 +30,7 @@ let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
|
29
30
|
target.addEventListener('blur', () => target.removeAttribute('tabindex'), { once: true });
|
|
30
31
|
target.focus();
|
|
31
32
|
};
|
|
33
|
+
this.missed = '';
|
|
32
34
|
}
|
|
33
35
|
static { this.shadowRootOptions = {
|
|
34
36
|
...HelixElement.shadowRootOptions,
|
|
@@ -40,6 +42,18 @@ let HelixHeadlessSkipLink = class HelixHeadlessSkipLink extends HelixElement {
|
|
|
40
42
|
}
|
|
41
43
|
return elementById(this, decodeURIComponent(this.href.slice(1)), { orDocument: true });
|
|
42
44
|
}
|
|
45
|
+
reportMissing() {
|
|
46
|
+
if (!this.href.startsWith('#') || this.href.length < 2 || this.missed === this.href) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.missed = this.href;
|
|
50
|
+
reportRuntime({
|
|
51
|
+
kind: 'missing-target',
|
|
52
|
+
message: `<${this.localName} href="${this.href}"> names no element in its tree, so the press ` +
|
|
53
|
+
'moves focus nowhere. Give the main content that id, or point `href` at the id it has.',
|
|
54
|
+
tag: this.localName,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
43
57
|
render() {
|
|
44
58
|
return html `<a part="link" href=${this.href} @click=${this.skip}><slot>${this.label}</slot></a>`;
|
|
45
59
|
}
|
|
@@ -33,6 +33,10 @@ declare const HelixHeadlessSlider_base: (new (...args: any[]) => import("@fusion
|
|
|
33
33
|
* @aliases Range, Range input
|
|
34
34
|
* @documentation https://fusion.dev/helix/components/slider
|
|
35
35
|
*
|
|
36
|
+
* @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
|
|
37
|
+
* @slot hint - Help under the control, for content richer than the `hint` text.
|
|
38
|
+
* @slot label - The label, for content richer than the `label` text.
|
|
39
|
+
*
|
|
36
40
|
* @event {Event} change - Fired when the user releases the thumb.
|
|
37
41
|
* @event {HelixBeforeChangeEvent} helix-before-change - Fired as the value changes. Cancelable: call `preventDefault()` to keep the current value.
|
|
38
42
|
* @event {Event} input - Fired after the value changes.
|
|
@@ -123,6 +127,8 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
123
127
|
* Shows the chosen value beside the track.
|
|
124
128
|
*/
|
|
125
129
|
showValue: boolean;
|
|
130
|
+
/** How far one press of an arrow key moves the thumb. */
|
|
131
|
+
step: number;
|
|
126
132
|
/**
|
|
127
133
|
* How many characters the readout has to be able to hold, widest case.
|
|
128
134
|
*
|
|
@@ -210,9 +216,21 @@ export declare class HelixHeadlessSlider extends HelixHeadlessSlider_base {
|
|
|
210
216
|
*/
|
|
211
217
|
private snapped;
|
|
212
218
|
protected willUpdate(changed: PropertyValues): void;
|
|
219
|
+
/** One number pulled into the bounds and onto the step, as a range does. */
|
|
220
|
+
private settled;
|
|
221
|
+
/**
|
|
222
|
+
* The value as a native range would hold it: a number in the bounds on the
|
|
223
|
+
* step, or for a range, two of them in order.
|
|
224
|
+
*/
|
|
225
|
+
private sanitize;
|
|
226
|
+
/** What a screen reader says for one thumb, where `value-text` asks. */
|
|
227
|
+
private spoken;
|
|
213
228
|
protected updated(changed: PropertyValues): void;
|
|
214
|
-
/**
|
|
215
|
-
|
|
229
|
+
/**
|
|
230
|
+
* What a screen reader says for a thumb's value, with `{value}` filled in,
|
|
231
|
+
* such as `{value} degrees`. Empty announces the number alone.
|
|
232
|
+
*/
|
|
233
|
+
valueText: string;
|
|
216
234
|
protected render(): TemplateResult;
|
|
217
235
|
}
|
|
218
236
|
declare global {
|
|
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { AriaForwardController, customElement, HelixFormElement, MixinControllerValue, MixinField, restoreValue, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, customElement, fillTemplate, HelixFormElement, MixinControllerValue, MixinField, restoreValue, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue(MixinField(HelixFormElement)) {
|
|
@@ -22,6 +22,7 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
22
22
|
this.minimumLabel = 'minimum';
|
|
23
23
|
this.range = false;
|
|
24
24
|
this.showValue = false;
|
|
25
|
+
this.step = 1;
|
|
25
26
|
this.handleInput = (event) => {
|
|
26
27
|
event.stopPropagation();
|
|
27
28
|
const control = event.target;
|
|
@@ -43,7 +44,7 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
43
44
|
event.stopPropagation();
|
|
44
45
|
this.announceChange();
|
|
45
46
|
};
|
|
46
|
-
this.
|
|
47
|
+
this.valueText = '';
|
|
47
48
|
}
|
|
48
49
|
get reserve() {
|
|
49
50
|
const widest = Math.max(String(this.min).length, String(this.max).length);
|
|
@@ -110,9 +111,39 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
110
111
|
willUpdate(changed) {
|
|
111
112
|
super.willUpdate(changed);
|
|
112
113
|
if (!this.hasUpdated && this.value === '') {
|
|
113
|
-
this.defaultValue =
|
|
114
|
+
this.defaultValue = this.range
|
|
115
|
+
? `${this.min},${this.max}`
|
|
116
|
+
: String(this.min + (this.max - this.min) / 2);
|
|
117
|
+
}
|
|
118
|
+
const clean = this.sanitize(this.value);
|
|
119
|
+
if (clean !== this.value) {
|
|
120
|
+
this.value = clean;
|
|
114
121
|
}
|
|
115
122
|
}
|
|
123
|
+
settled(at) {
|
|
124
|
+
const low = Math.min(this.min, this.max);
|
|
125
|
+
const high = Math.max(this.min, this.max);
|
|
126
|
+
return Math.min(high, Math.max(low, this.snapped(Math.min(high, Math.max(low, at)))));
|
|
127
|
+
}
|
|
128
|
+
sanitize(text) {
|
|
129
|
+
if (this.range) {
|
|
130
|
+
const [from, to] = text.split(',').map((part) => Number.parseFloat(part));
|
|
131
|
+
if (from === undefined ||
|
|
132
|
+
to === undefined ||
|
|
133
|
+
!Number.isFinite(from) ||
|
|
134
|
+
!Number.isFinite(to)) {
|
|
135
|
+
return `${this.min},${this.max}`;
|
|
136
|
+
}
|
|
137
|
+
const ends = [this.settled(from), this.settled(to)].sort((a, b) => a - b);
|
|
138
|
+
return ends.join(',');
|
|
139
|
+
}
|
|
140
|
+
const parsed = Number.parseFloat(text);
|
|
141
|
+
const at = Number.isFinite(parsed) ? parsed : this.min + (this.max - this.min) / 2;
|
|
142
|
+
return String(this.settled(at));
|
|
143
|
+
}
|
|
144
|
+
spoken(at) {
|
|
145
|
+
return this.valueText ? fillTemplate(this.valueText, { value: at }) : nothing;
|
|
146
|
+
}
|
|
116
147
|
updated(changed) {
|
|
117
148
|
super.updated(changed);
|
|
118
149
|
this.sync();
|
|
@@ -130,6 +161,9 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
130
161
|
step=${this.step}
|
|
131
162
|
.value=${String(at)}
|
|
132
163
|
aria-labelledby=${this.labeled ? `${this.labelId} ${which}-name` : `${which}-name`}
|
|
164
|
+
aria-valuemin=${which === 'end' ? start : nothing}
|
|
165
|
+
aria-valuemax=${which === 'start' ? end : nothing}
|
|
166
|
+
aria-valuetext=${this.spoken(at)}
|
|
133
167
|
aria-describedby=${this.describedBy ?? nothing}
|
|
134
168
|
aria-invalid=${this.invalidity ?? nothing}
|
|
135
169
|
?disabled=${this.isDisabled}
|
|
@@ -161,6 +195,7 @@ let HelixHeadlessSlider = class HelixHeadlessSlider extends MixinControllerValue
|
|
|
161
195
|
step=${this.step}
|
|
162
196
|
.value=${this.value}
|
|
163
197
|
name=${this.name || nothing}
|
|
198
|
+
aria-valuetext=${this.spoken(this.value)}
|
|
164
199
|
aria-describedby=${this.describedBy ?? nothing}
|
|
165
200
|
aria-invalid=${this.invalidity ?? nothing}
|
|
166
201
|
?disabled=${this.isDisabled}
|
|
@@ -219,6 +254,9 @@ __decorate([
|
|
|
219
254
|
__decorate([
|
|
220
255
|
property({ type: Number })
|
|
221
256
|
], HelixHeadlessSlider.prototype, "step", void 0);
|
|
257
|
+
__decorate([
|
|
258
|
+
property({ attribute: 'value-text' })
|
|
259
|
+
], HelixHeadlessSlider.prototype, "valueText", void 0);
|
|
222
260
|
HelixHeadlessSlider = __decorate([
|
|
223
261
|
customElement('helix-headless-slider')
|
|
224
262
|
], HelixHeadlessSlider);
|
|
@@ -9,9 +9,8 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
9
9
|
* `values` to the data and `label` to the one sentence a screen reader
|
|
10
10
|
* announces.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* a sparkline has a real table behind it. `for` wins when both are set.
|
|
12
|
+
* Use `for` when a sparkline has a real table behind it. `for` wins when both
|
|
13
|
+
* are set.
|
|
15
14
|
*
|
|
16
15
|
* Without a `label` the sparkline is decorative and `aria-hidden`, for example
|
|
17
16
|
* beside a stat that already says "Sessions, 1,102". With a `label` it is an
|
|
@@ -95,8 +94,8 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
95
94
|
/**
|
|
96
95
|
* What the readings are drawn as.
|
|
97
96
|
*
|
|
98
|
-
* Absent is
|
|
99
|
-
* `bar` is a column per reading.
|
|
97
|
+
* Absent is `area`, a line with the region beneath it washed. `line` is the
|
|
98
|
+
* bare stroke, and `bar` is a column per reading.
|
|
100
99
|
*
|
|
101
100
|
* **A bar plot measures from zero and the other two measure from the data's
|
|
102
101
|
* own range**, which is the one way the plots are not interchangeable. A line
|
|
@@ -125,12 +124,12 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
125
124
|
/**
|
|
126
125
|
* The numbers, separated by whitespace or by commas.
|
|
127
126
|
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
127
|
+
* An array assigned to the property works too, which is what React 19 does
|
|
128
|
+
* with `values={[1240, 1318]}`. The attribute is the form to prefer, because
|
|
129
|
+
* a string is what survives React's hydration where an array property does
|
|
130
|
+
* not.
|
|
132
131
|
*/
|
|
133
|
-
values: string;
|
|
132
|
+
values: string | readonly number[];
|
|
134
133
|
protected readonly source: SourceController;
|
|
135
134
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
136
135
|
/** The series to draw: the table if there is one, the attribute otherwise. */
|
|
@@ -52,12 +52,18 @@ export declare class HelixHeadlessSpeedDialItem extends HelixElement {
|
|
|
52
52
|
/** Chooses the action, the same as pressing it. */
|
|
53
53
|
select(): void;
|
|
54
54
|
/**
|
|
55
|
-
* Whether the action has focus, which
|
|
55
|
+
* Whether the action has focus, which makes it the action the keyboard is on.
|
|
56
56
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
|
|
57
|
+
* `Option` calls the same thing `active`. The focused node is found through
|
|
58
|
+
* every shadow root, as `Menu.Item` does, so a dial inside another
|
|
59
|
+
* component's shadow root still knows its current action.
|
|
60
|
+
*/
|
|
61
|
+
get active(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Whether the action has focus, the same as `active`.
|
|
64
|
+
*
|
|
65
|
+
* @deprecated Read `active`. Everywhere else in the library `selected` means
|
|
66
|
+
* chosen out of a set, and a speed dial's action is never chosen that way.
|
|
61
67
|
*/
|
|
62
68
|
get selected(): boolean;
|
|
63
69
|
private choose;
|
|
@@ -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, HelixElement, HelixSelectEvent } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, deepActiveElement, HelixElement, HelixSelectEvent, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
let HelixHeadlessSpeedDialItem = class HelixHeadlessSpeedDialItem extends HelixElement {
|
|
@@ -26,8 +26,12 @@ let HelixHeadlessSpeedDialItem = class HelixHeadlessSpeedDialItem extends HelixE
|
|
|
26
26
|
select() {
|
|
27
27
|
this.choose();
|
|
28
28
|
}
|
|
29
|
+
get active() {
|
|
30
|
+
const active = deepActiveElement();
|
|
31
|
+
return active !== null && active.getRootNode() === this.renderRoot;
|
|
32
|
+
}
|
|
29
33
|
get selected() {
|
|
30
|
-
return this.
|
|
34
|
+
return this.active;
|
|
31
35
|
}
|
|
32
36
|
choose() {
|
|
33
37
|
if (this.disabled) {
|
|
@@ -42,6 +46,7 @@ let HelixHeadlessSpeedDialItem = class HelixHeadlessSpeedDialItem extends HelixE
|
|
|
42
46
|
type="button"
|
|
43
47
|
aria-disabled=${this.disabled ? 'true' : nothing}
|
|
44
48
|
?disabled=${this.disabled}
|
|
49
|
+
tabindex="-1"
|
|
45
50
|
@click=${this.handleClick}
|
|
46
51
|
>
|
|
47
52
|
<span part="icon"><slot name="icon"></slot></span>
|
|
@@ -11,8 +11,8 @@ declare const HelixHeadlessSpeedDial_base: (new (...args: any[]) => import("@fus
|
|
|
11
11
|
* - `PopoverController` for the panel
|
|
12
12
|
* - `MixinControllerOpen` for open and closed
|
|
13
13
|
*
|
|
14
|
-
* It is a separate component because a speed dial has no submenus, headers,
|
|
15
|
-
* checkable items
|
|
14
|
+
* It is a separate component because a speed dial has no submenus, headers, or
|
|
15
|
+
* checkable items.
|
|
16
16
|
*
|
|
17
17
|
* You slot the trigger. The usual floating action button is `IconButton` with
|
|
18
18
|
* `shape="circle"` and `raised`. There is no `helix-fab`, because `IconButton`
|
|
@@ -21,7 +21,9 @@ declare const HelixHeadlessSpeedDial_base: (new (...args: any[]) => import("@fus
|
|
|
21
21
|
*
|
|
22
22
|
* All four arrow keys move through the actions, because a speed dial has no
|
|
23
23
|
* nested levels to reserve the horizontal pair for. This is the default
|
|
24
|
-
* behavior of the keyboard controller.
|
|
24
|
+
* behavior of the keyboard controller. Typing a letter moves to the next
|
|
25
|
+
* action whose name starts with it. The actions are one tab stop, and Tab
|
|
26
|
+
* closes the dial and moves on.
|
|
25
27
|
*
|
|
26
28
|
* @since 0.1.0
|
|
27
29
|
* @status stable
|
|
@@ -35,7 +37,7 @@ declare const HelixHeadlessSpeedDial_base: (new (...args: any[]) => import("@fus
|
|
|
35
37
|
* @event {HelixBeforeCloseEvent} helix-before-close - The actions are about to close. Cancelable: cancel it to keep them open.
|
|
36
38
|
* @event {HelixBeforeOpenEvent} helix-before-open - The actions are about to open. Cancelable: cancel it to keep them closed.
|
|
37
39
|
* @event {HelixSelectEvent} helix-select - An action was chosen. The action sends the event, and the dial closes after it. Cancelable: cancel it to keep the dial open.
|
|
38
|
-
* @event {
|
|
40
|
+
* @event {ToggleEvent} toggle - The dial opened or closed. The event carries `newState` and `oldState`.
|
|
39
41
|
*
|
|
40
42
|
* @csspart actions - The region the actions are drawn in.
|
|
41
43
|
* @csspart trigger - The default trigger, drawn when none is slotted.
|
|
@@ -60,6 +62,15 @@ export declare class HelixHeadlessSpeedDial extends HelixHeadlessSpeedDial_base
|
|
|
60
62
|
*/
|
|
61
63
|
placement: Placement;
|
|
62
64
|
protected readonly keys: KeyboardNavigationController;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the trigger asked for the open that is under way, which is the one
|
|
67
|
+
* open that moves focus onto the first action.
|
|
68
|
+
*
|
|
69
|
+
* A dial opened by `default-open` or by a script setting `open` leaves focus
|
|
70
|
+
* where it is: on load that is wherever `autofocus` put it, and later it is
|
|
71
|
+
* wherever the reader is typing.
|
|
72
|
+
*/
|
|
73
|
+
private focusOnOpen;
|
|
63
74
|
protected readonly panel: PopoverController;
|
|
64
75
|
/** Whatever the consumer slotted, or the button rendered in its place. */
|
|
65
76
|
private get trigger();
|
|
@@ -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 { anchorElement, customElement, drawIcon, HelixElement, KeyboardNavigationController, MixinControllerOpen, PopoverController, tellDisclosure, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { anchorElement, customElement, drawIcon, HelixElement, KeyboardNavigationController, MixinControllerOpen, PopoverController, slottedWords, tellDisclosure, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { plus } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
@@ -15,9 +15,11 @@ let HelixHeadlessSpeedDial = class HelixHeadlessSpeedDial extends MixinControlle
|
|
|
15
15
|
this.offset = 12;
|
|
16
16
|
this.placement = 'top-end';
|
|
17
17
|
this.keys = new KeyboardNavigationController(this, {
|
|
18
|
-
items: () => this.items,
|
|
18
|
+
items: () => (this.open ? this.items : []),
|
|
19
19
|
selects: () => false,
|
|
20
|
+
typeahead: (item) => slottedWords(item, ['']),
|
|
20
21
|
});
|
|
22
|
+
this.focusOnOpen = false;
|
|
21
23
|
this.panel = new PopoverController(this, {
|
|
22
24
|
anchor: () => this.trigger,
|
|
23
25
|
boundary: () => this,
|
|
@@ -28,7 +30,11 @@ let HelixHeadlessSpeedDial = class HelixHeadlessSpeedDial extends MixinControlle
|
|
|
28
30
|
surface: () => this.partNamed('actions'),
|
|
29
31
|
});
|
|
30
32
|
this.handleTriggerClick = () => {
|
|
31
|
-
|
|
33
|
+
if (this.open) {
|
|
34
|
+
this.requestOpen(false);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
this.focusOnOpen = this.requestOpen(true);
|
|
32
38
|
};
|
|
33
39
|
this.handleSelect = (event) => {
|
|
34
40
|
queueMicrotask(() => {
|
|
@@ -38,6 +44,13 @@ let HelixHeadlessSpeedDial = class HelixHeadlessSpeedDial extends MixinControlle
|
|
|
38
44
|
});
|
|
39
45
|
};
|
|
40
46
|
this.handleKeydown = (event) => {
|
|
47
|
+
if (!this.open) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (event.key === 'Tab') {
|
|
51
|
+
this.requestOpen(false);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
41
54
|
if (event.key !== 'Escape') {
|
|
42
55
|
return;
|
|
43
56
|
}
|
|
@@ -74,12 +87,13 @@ let HelixHeadlessSpeedDial = class HelixHeadlessSpeedDial extends MixinControlle
|
|
|
74
87
|
if (trigger === this.partNamed('trigger')) {
|
|
75
88
|
return;
|
|
76
89
|
}
|
|
77
|
-
tellDisclosure(trigger, this.open);
|
|
90
|
+
tellDisclosure(trigger, this.open, 'menu');
|
|
78
91
|
}
|
|
79
92
|
updated(changed) {
|
|
80
93
|
super.updated?.(changed);
|
|
81
94
|
this.announce();
|
|
82
|
-
if (this.open) {
|
|
95
|
+
if (this.open && this.focusOnOpen) {
|
|
96
|
+
this.focusOnOpen = false;
|
|
83
97
|
this.updateComplete.then(() => {
|
|
84
98
|
if (this.open) {
|
|
85
99
|
this.items.find((one) => !one.disabled)?.focusItem();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { HelixElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { AriaForwardController, HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary Two panes and a divider that you can move.
|
|
@@ -13,9 +13,10 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
13
13
|
* added at `firstUpdated` and is not in the server markup. Before it appears,
|
|
14
14
|
* both dividers work on their own.
|
|
15
15
|
*
|
|
16
|
-
* The divider has `role="separator"` and `aria-valuenow
|
|
17
|
-
* pointer or move it with the arrow keys,
|
|
18
|
-
*
|
|
16
|
+
* The divider has `role="separator"` and `aria-valuenow`, and `aria-controls`
|
|
17
|
+
* names the start pane. Drag it with a pointer or move it with the arrow keys,
|
|
18
|
+
* press `Home` or `End` to move it to its bounds, and press `Enter` to collapse
|
|
19
|
+
* the start pane and open it again. A drag in progress is tracked as a state, so both dividers a
|
|
19
20
|
* corner moves stay lit for as long as they move.
|
|
20
21
|
*
|
|
21
22
|
* By default, `min` and `max` let the divider reach either edge, so you can
|
|
@@ -39,6 +40,8 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
39
40
|
*
|
|
40
41
|
* @event {HelixBeforeCollapseEvent} helix-before-collapse - Fired before a pane shuts or reopens, whether or not the resize that caused it was allowed. It carries its own position, because a shut pane sits at `collapsed-size`. Cancelable: canceling it leaves the pane as it was and the divider where the gesture put it.
|
|
41
42
|
* @event {HelixBeforeResizeEvent} helix-before-resize - Fired before the divider settles, and only when the gesture moved it. A press that moved nothing, a drag that came back, an arrow key with no room left, and a corner that moved only the other divider do not fire it. Cancelable: canceling it leaves the position to you and keeps the rest of the gesture, so a collapse the gesture reached still fires `helix-before-collapse`, which you can also cancel. A dragged divider stays where it was dropped until you set your own `position`.
|
|
43
|
+
* @event {HelixCollapseEvent} helix-collapse - Fired after a pane shuts or reopens, with the side that is shut, or empty where both are open.
|
|
44
|
+
* @event {HelixResizedEvent} helix-resized - Fired after the divider settles somewhere new, with the new position.
|
|
42
45
|
*
|
|
43
46
|
* @csspart corner - The handle where two dividers cross, added on the client.
|
|
44
47
|
* @csspart end - The box that holds the second pane.
|
|
@@ -96,8 +99,13 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
96
99
|
defaultPosition: number;
|
|
97
100
|
/**
|
|
98
101
|
* The divider's name, read by screen readers.
|
|
102
|
+
*
|
|
103
|
+
* An `aria-label` or `aria-labelledby` on the host names the divider too,
|
|
104
|
+
* and wins over this.
|
|
99
105
|
*/
|
|
100
106
|
label: string;
|
|
107
|
+
/** Carries a host `aria-label` and `aria-labelledby` to the divider. */
|
|
108
|
+
protected readonly aria: AriaForwardController;
|
|
101
109
|
/**
|
|
102
110
|
* How close the divider can come to the end, in the same units as `min`.
|
|
103
111
|
*/
|
|
@@ -453,6 +461,19 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
453
461
|
* it on every page, which on a right-to-left one sent the divider right.
|
|
454
462
|
*/
|
|
455
463
|
private travel;
|
|
464
|
+
/**
|
|
465
|
+
* Collapses the start pane, or opens whichever pane is collapsed, which is
|
|
466
|
+
* what `Enter` does on the divider.
|
|
467
|
+
*
|
|
468
|
+
* The window splitter pattern's own key, and the one way the keyboard
|
|
469
|
+
* reaches `collapsed` where `min` keeps `Home` short of the edge. Collapse
|
|
470
|
+
* overrides `min` and `max`, as it does for every other way in.
|
|
471
|
+
*
|
|
472
|
+
* Asked through `helix-before-collapse` alone. The pane opens back to the
|
|
473
|
+
* position it was collapsed from, or to `default-position` where that was
|
|
474
|
+
* the edge itself.
|
|
475
|
+
*/
|
|
476
|
+
private toggleCollapse;
|
|
456
477
|
/** Puts the divider back where the markup put it. */
|
|
457
478
|
private reset;
|
|
458
479
|
private readonly handleDoubleClick;
|
|
@@ -465,7 +486,8 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
465
486
|
*/
|
|
466
487
|
private readonly handleCornerDoubleClick;
|
|
467
488
|
/**
|
|
468
|
-
* Records that a nested splitter crosses this one at `at` percent
|
|
489
|
+
* @internal Records that a nested splitter crosses this one at `at` percent
|
|
490
|
+
* along it.
|
|
469
491
|
*
|
|
470
492
|
* Public because it is the whole of the channel between the two, and it runs
|
|
471
493
|
* one way: the child tells the parent where it is, and the parent draws the
|
|
@@ -473,7 +495,7 @@ export declare class HelixHeadlessSplitter extends HelixElement {
|
|
|
473
495
|
* anything about the other's state.
|
|
474
496
|
*/
|
|
475
497
|
cross(by: HelixHeadlessSplitter, at: number): void;
|
|
476
|
-
/** Forgets a nested splitter that has left the tree. See `cross`. */
|
|
498
|
+
/** @internal Forgets a nested splitter that has left the tree. See `cross`. */
|
|
477
499
|
uncross(by: HelixHeadlessSplitter): void;
|
|
478
500
|
/**
|
|
479
501
|
* Announces this splitter to the one it is nested in, if they cross.
|
|
@@ -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 HelixHeadlessSplitter_1;
|
|
8
|
-
import { capturePointer, closestInstance, customElement, HelixBeforeCollapseEvent, HelixBeforeResizeEvent, HelixElement, inlineStep, isRtl, requestChange, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { AriaForwardController, capturePointer, closestInstance, customElement, HelixBeforeCollapseEvent, HelixBeforeResizeEvent, HelixCollapseEvent, HelixElement, HelixResizedEvent, inlineStep, isRtl, requestChange, } from '@fusion.dev/helix-core';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property, state } from 'lit/decorators.js';
|
|
11
11
|
const STACK_BELOW = 512;
|
|
@@ -17,6 +17,10 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
|
|
|
17
17
|
this.cornerLabel = 'Resize both';
|
|
18
18
|
this.defaultPosition = 50;
|
|
19
19
|
this.label = 'Resize panes';
|
|
20
|
+
this.aria = new AriaForwardController(this, {
|
|
21
|
+
label: true,
|
|
22
|
+
target: () => this.partNamed('separator'),
|
|
23
|
+
});
|
|
20
24
|
this.max = 100;
|
|
21
25
|
this.min = 0;
|
|
22
26
|
this.step = 2;
|
|
@@ -68,6 +72,11 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
|
|
|
68
72
|
this.settle(this.reached ?? this.position);
|
|
69
73
|
};
|
|
70
74
|
this.handleKeydown = (event) => {
|
|
75
|
+
if (event.key === 'Enter') {
|
|
76
|
+
this.toggleCollapse();
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
71
80
|
const toward = this.travel(event.key);
|
|
72
81
|
let next;
|
|
73
82
|
if (toward !== 0) {
|
|
@@ -313,6 +322,7 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
|
|
|
313
322
|
const previous = this.position;
|
|
314
323
|
this.positionState = value;
|
|
315
324
|
this.requestUpdate('position', previous);
|
|
325
|
+
this.dispatchEvent(new HelixResizedEvent({ value: String(value) }));
|
|
316
326
|
},
|
|
317
327
|
event: (value) => new HelixBeforeResizeEvent({ value: String(value) }),
|
|
318
328
|
host: this,
|
|
@@ -327,6 +337,7 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
|
|
|
327
337
|
}
|
|
328
338
|
this.collapsedState = value === '' ? 'none' : value;
|
|
329
339
|
this.requestUpdate('collapsed', previous);
|
|
340
|
+
this.dispatchEvent(new HelixCollapseEvent({ value }));
|
|
330
341
|
},
|
|
331
342
|
event: (value) => new HelixBeforeCollapseEvent({ value }),
|
|
332
343
|
host: this,
|
|
@@ -340,6 +351,27 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
|
|
|
340
351
|
}
|
|
341
352
|
return key === 'ArrowDown' ? 1 : key === 'ArrowUp' ? -1 : 0;
|
|
342
353
|
}
|
|
354
|
+
toggleCollapse() {
|
|
355
|
+
const shut = this.collapsed;
|
|
356
|
+
const opened = shut ? undefined : this.position;
|
|
357
|
+
requestChange({
|
|
358
|
+
apply: (value) => {
|
|
359
|
+
const previous = this.collapsed;
|
|
360
|
+
if (opened !== undefined) {
|
|
361
|
+
this.positionState = opened;
|
|
362
|
+
}
|
|
363
|
+
else if (this.shutAt(this.clamp(this.positionState ?? this.defaultPosition))) {
|
|
364
|
+
this.positionState = this.defaultPosition;
|
|
365
|
+
}
|
|
366
|
+
this.collapsedState = value === '' ? 'none' : value;
|
|
367
|
+
this.requestUpdate('collapsed', previous);
|
|
368
|
+
this.dispatchEvent(new HelixCollapseEvent({ value }));
|
|
369
|
+
},
|
|
370
|
+
event: (value) => new HelixBeforeCollapseEvent({ value }),
|
|
371
|
+
host: this,
|
|
372
|
+
next: shut ? '' : 'start',
|
|
373
|
+
});
|
|
374
|
+
}
|
|
343
375
|
reset() {
|
|
344
376
|
const home = this.clamp(this.defaultPosition);
|
|
345
377
|
this.settle(home);
|
|
@@ -427,6 +459,7 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
|
|
|
427
459
|
const position = this.showing;
|
|
428
460
|
return html `<div
|
|
429
461
|
part="start"
|
|
462
|
+
id="start"
|
|
430
463
|
?data-dragging=${this.dragging}
|
|
431
464
|
style="--splitter-position: ${position}%"
|
|
432
465
|
>
|
|
@@ -436,6 +469,7 @@ let HelixHeadlessSplitter = HelixHeadlessSplitter_1 = class HelixHeadlessSplitte
|
|
|
436
469
|
part="separator"
|
|
437
470
|
role="separator"
|
|
438
471
|
tabindex="0"
|
|
472
|
+
aria-controls="start"
|
|
439
473
|
aria-label=${this.label}
|
|
440
474
|
aria-orientation=${this.vertical ? 'horizontal' : 'vertical'}
|
|
441
475
|
aria-valuemax=${this.collapsed ? 100 : this.clamp(this.maxPercent)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary One measurement, with a label that names what it measures.
|
|
5
5
|
*
|
|
@@ -38,6 +38,11 @@ export declare class HelixHeadlessStat extends HelixElement {
|
|
|
38
38
|
* the value's baseline whichever way the pair goes, and only this element
|
|
39
39
|
* knows which of its children the unit belongs to.
|
|
40
40
|
*
|
|
41
|
+
* **`Trend` has a `direction` too, and there it means which way a number
|
|
42
|
+
* moved:** `up`, `down` or `neutral`. A Stat and a Trend are often written
|
|
43
|
+
* side by side, so watch for the mix-up. On a Stat those three words are not
|
|
44
|
+
* layouts, and the pair stays the column.
|
|
45
|
+
*
|
|
41
46
|
* **Optional rather than defaulted to `column`, which is not a style
|
|
42
47
|
* preference.** A reflecting property with a default writes its attribute onto
|
|
43
48
|
* the host the moment the element upgrades, and the host is markup the
|
|
@@ -47,6 +52,7 @@ export declare class HelixHeadlessStat extends HelixElement {
|
|
|
47
52
|
* carries nothing nobody wrote.
|
|
48
53
|
*/
|
|
49
54
|
direction?: 'column-reverse' | 'row' | 'row-reverse';
|
|
55
|
+
protected updated(changed: PropertyValues): void;
|
|
50
56
|
protected render(): TemplateResult;
|
|
51
57
|
}
|
|
52
58
|
declare global {
|