@fusion.dev/helix-headless 0.236.0 → 0.237.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/api.json +1 -1
- package/custom-elements.json +1 -1
- package/dist/app-header/root/app-header-root.d.ts +9 -0
- package/dist/app-header/root/app-header-root.js +21 -0
- package/dist/area-chart/root/area-chart-root.d.ts +29 -15
- package/dist/area-chart/root/area-chart-root.js +10 -7
- package/dist/bar-chart/root/bar-chart-root.d.ts +41 -23
- package/dist/bar-chart/root/bar-chart-root.js +15 -10
- package/dist/button/root/button-root.js +1 -1
- package/dist/canvas/root/canvas-root.d.ts +10 -3
- package/dist/canvas/root/canvas-root.js +31 -14
- package/dist/color-input/root/color-input-root.d.ts +4 -2
- package/dist/color-input/root/color-input-root.js +1 -1
- package/dist/combobox/root/combobox-root.d.ts +8 -7
- package/dist/combobox/root/combobox-root.js +7 -3
- package/dist/command/root/command-root.d.ts +22 -2
- package/dist/command/root/command-root.js +39 -5
- package/dist/data-table/root/data-table-root.d.ts +10 -7
- package/dist/data-table/root/data-table-root.js +6 -1
- package/dist/date-picker/root/date-picker-root.d.ts +1 -1
- package/dist/date-picker/root/date-picker-root.js +9 -2
- package/dist/dialog/root/dialog-root.d.ts +13 -3
- package/dist/dialog/root/dialog-root.js +33 -2
- package/dist/donut-chart/root/donut-chart-root.d.ts +23 -1
- package/dist/donut-chart/root/donut-chart-root.js +41 -13
- package/dist/drawer/root/drawer-root.d.ts +10 -2
- package/dist/drawer/root/drawer-root.js +34 -1
- package/dist/filter-input/chip/filter-chip.js +2 -2
- package/dist/find/root/find-root.d.ts +11 -1
- package/dist/find/root/find-root.js +11 -0
- package/dist/heatmap/root/heatmap-root.d.ts +11 -8
- package/dist/heatmap/root/heatmap-root.js +27 -2
- package/dist/kbd/root/kbd-root.d.ts +4 -0
- package/dist/kbd/root/kbd-root.js +2 -1
- package/dist/lightbox/root/lightbox-root.js +3 -2
- package/dist/line-chart/root/line-chart-root.d.ts +36 -23
- package/dist/line-chart/root/line-chart-root.js +20 -13
- package/dist/list/item/list-item.d.ts +2 -1
- package/dist/list/item/list-item.js +4 -1
- package/dist/list/root/list-root.d.ts +33 -8
- package/dist/list/root/list-root.js +17 -3
- package/dist/listbox/root/listbox-root.d.ts +48 -15
- package/dist/listbox/root/listbox-root.js +65 -6
- package/dist/map/root/map-root.js +7 -7
- package/dist/markdown/tree.d.ts +6 -1
- package/dist/markdown/tree.js +1 -1
- package/dist/megamenu/root/megamenu-root.d.ts +19 -0
- package/dist/megamenu/root/megamenu-root.js +24 -0
- package/dist/menu/filter/menu-filter.js +3 -1
- package/dist/menu/item/menu-item.d.ts +12 -0
- package/dist/menu/item/menu-item.js +3 -0
- package/dist/menu/root/menu-root.d.ts +7 -1
- package/dist/menu/root/menu-root.js +6 -3
- package/dist/motion-toggle/root/motion-toggle-root.js +2 -2
- package/dist/notifications/notification/notification.d.ts +1 -0
- package/dist/notifications/notification/notification.js +1 -0
- package/dist/notifications/root/notifications-root.d.ts +7 -5
- package/dist/notifications/root/notifications-root.js +1 -1
- package/dist/number-input/root/number-input-root.d.ts +6 -0
- package/dist/number-input/root/number-input-root.js +14 -4
- package/dist/object-inspector/root/object-inspector-root.d.ts +6 -5
- package/dist/object-inspector/root/object-inspector-root.js +9 -3
- package/dist/option/root/option-root.d.ts +14 -0
- package/dist/option/root/option-root.js +3 -0
- package/dist/pagination/root/pagination-root.d.ts +36 -0
- package/dist/pagination/root/pagination-root.js +55 -2
- package/dist/pin-input/code.js +1 -1
- package/dist/qr-code/root/qr-code-root.d.ts +1 -0
- package/dist/qr-code/root/qr-code-root.js +1 -0
- package/dist/rating/root/rating-root.d.ts +1 -0
- package/dist/rating/root/rating-root.js +1 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +6 -0
- package/dist/select/root/select-root.d.ts +27 -1
- package/dist/select/root/select-root.js +34 -3
- package/dist/shortcut-overlay/root/shortcut-overlay-root.d.ts +5 -0
- package/dist/shortcut-overlay/root/shortcut-overlay-root.js +15 -1
- package/dist/skeleton/root/skeleton-root.d.ts +1 -0
- package/dist/skeleton/root/skeleton-root.js +3 -0
- package/dist/sparkline/root/sparkline-root.d.ts +53 -0
- package/dist/sparkline/root/sparkline-root.js +37 -1
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.d.ts +4 -1
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.js +2 -2
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.d.ts +3 -0
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.js +2 -2
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +3 -0
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.js +2 -2
- package/dist/spatial-scatter-chart/view.d.ts +17 -8
- package/dist/spatial-scatter-chart/view.js +7 -6
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +3 -0
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.js +2 -2
- package/dist/spatial-treemap/root/spatial-treemap-root.d.ts +3 -0
- package/dist/spatial-treemap/root/spatial-treemap-root.js +2 -2
- package/dist/splitter/root/splitter-root.js +3 -1
- package/dist/stat/group/stat-group.d.ts +13 -0
- package/dist/stat/group/stat-group.js +22 -1
- package/dist/stat/root/stat-root.d.ts +62 -1
- package/dist/stat/root/stat-root.js +146 -4
- package/dist/table/cell/table-cell.d.ts +1 -0
- package/dist/table/cell/table-cell.js +4 -0
- package/dist/table/root/table-root.d.ts +7 -6
- package/dist/table/root/table-root.js +1 -1
- package/dist/tabs/tab/tab.js +2 -2
- package/dist/tag/root/tag-root.js +2 -2
- package/dist/timeline/root/timeline-root.d.ts +2 -2
- package/dist/timeline/root/timeline-root.js +1 -1
- package/dist/toast/root/toast-root.d.ts +53 -6
- package/dist/toast/root/toast-root.js +158 -1
- package/dist/toggle/root/toggle-root.d.ts +1 -0
- package/dist/toggle/root/toggle-root.js +1 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +1 -0
- package/dist/video-playlist/root/video-playlist-root.js +2 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +2 -2
- package/dist/virtual-list/root/virtual-list-root.js +1 -1
- package/examples.json +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +633 -168
- package/types/vue.d.ts +379 -95
- package/types/words.d.ts +51 -12
|
@@ -21,7 +21,8 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
21
21
|
});
|
|
22
22
|
this.status = new StatusController(this);
|
|
23
23
|
this.autocomplete = '';
|
|
24
|
-
this.emptyText = 'No
|
|
24
|
+
this.emptyText = 'No options';
|
|
25
|
+
this.errorText = '';
|
|
25
26
|
this.filterable = false;
|
|
26
27
|
this.focusable = true;
|
|
27
28
|
this.items = undefined;
|
|
@@ -29,8 +30,10 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
29
30
|
this.loading = false;
|
|
30
31
|
this.loadingText = 'Loading';
|
|
31
32
|
this.multiple = false;
|
|
33
|
+
this.noResultsText = 'No matches';
|
|
32
34
|
this.placeholder = 'Choose';
|
|
33
35
|
this.position = 'floating';
|
|
36
|
+
this.readOnly = false;
|
|
34
37
|
this.valueMissingMessage = 'Choose one to continue.';
|
|
35
38
|
this.upgradeWatch = new UpgradeController(this, () => {
|
|
36
39
|
this.listbox?.requestUpdate();
|
|
@@ -160,6 +163,18 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
160
163
|
};
|
|
161
164
|
}
|
|
162
165
|
static { this.words = 'helix-select'; }
|
|
166
|
+
requestValue(next) {
|
|
167
|
+
if (this.readOnly) {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
return super.requestValue(next);
|
|
171
|
+
}
|
|
172
|
+
requestOpen(next) {
|
|
173
|
+
if (next && this.readOnly) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
return super.requestOpen(next);
|
|
177
|
+
}
|
|
163
178
|
get selectedIndex() {
|
|
164
179
|
return this.listbox?.selectedIndex ?? -1;
|
|
165
180
|
}
|
|
@@ -288,12 +303,16 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
288
303
|
}
|
|
289
304
|
firstUpdated(changed) {
|
|
290
305
|
super.firstUpdated(changed);
|
|
306
|
+
if (this.hasAttribute('autofocus')) {
|
|
307
|
+
this.focus();
|
|
308
|
+
}
|
|
291
309
|
this.finishHydration();
|
|
292
310
|
}
|
|
293
311
|
updated(changed) {
|
|
294
312
|
super.updated(changed);
|
|
295
313
|
this.sync();
|
|
296
314
|
this.linkHost();
|
|
315
|
+
this.toggleState('error', Boolean(this.errorText));
|
|
297
316
|
if (this.open) {
|
|
298
317
|
if (changed.has('open')) {
|
|
299
318
|
this.listbox?.highlight(this.opening);
|
|
@@ -317,8 +336,10 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
317
336
|
renderListbox() {
|
|
318
337
|
return html `<${this.tag('listbox')}
|
|
319
338
|
empty-text=${this.emptyText}
|
|
339
|
+
no-results-text=${this.noResultsText}
|
|
320
340
|
loading-text=${this.loadingText}
|
|
321
341
|
?loading=${this.loading}
|
|
342
|
+
error-text=${this.errorText || nothing}
|
|
322
343
|
part="listbox"
|
|
323
344
|
exportparts="empty: listbox-empty, error: listbox-error, feedback: listbox-feedback,
|
|
324
345
|
filter-icon: listbox-filter-icon, filter-mark: listbox-filter-mark, hint: listbox-hint,
|
|
@@ -374,7 +395,7 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
374
395
|
@keydown=${this.handleTriggerKeydown}
|
|
375
396
|
>
|
|
376
397
|
<slot name="start"></slot>
|
|
377
|
-
<span part="value" id="value" ?data-placeholder=${this.chosen.length === 0}>${this.renderValue()}</span>
|
|
398
|
+
<span part="value" id="value" dir="auto" ?data-placeholder=${this.chosen.length === 0}>${this.renderValue()}</span>
|
|
378
399
|
<slot name="end"></slot>
|
|
379
400
|
${this.renderIndicator()}
|
|
380
401
|
</button>
|
|
@@ -385,7 +406,7 @@ let HelixHeadlessSelect = class HelixHeadlessSelect extends MixinControllerOpen(
|
|
|
385
406
|
${this.renderHint()}${this.renderFeedback()}${drawStatus(this.status)}
|
|
386
407
|
${drawAutofill({
|
|
387
408
|
autocomplete: this.autocomplete,
|
|
388
|
-
disabled: this.isDisabled,
|
|
409
|
+
disabled: this.isDisabled || this.readOnly,
|
|
389
410
|
multiple: this.multiple,
|
|
390
411
|
onFill: (value) => this.requestValue(value),
|
|
391
412
|
options: this.entries,
|
|
@@ -400,6 +421,9 @@ __decorate([
|
|
|
400
421
|
words,
|
|
401
422
|
property({ attribute: 'empty-text' })
|
|
402
423
|
], HelixHeadlessSelect.prototype, "emptyText", void 0);
|
|
424
|
+
__decorate([
|
|
425
|
+
property({ attribute: 'error-text' })
|
|
426
|
+
], HelixHeadlessSelect.prototype, "errorText", void 0);
|
|
403
427
|
__decorate([
|
|
404
428
|
property({ reflect: true, type: Boolean })
|
|
405
429
|
], HelixHeadlessSelect.prototype, "filterable", void 0);
|
|
@@ -423,6 +447,10 @@ __decorate([
|
|
|
423
447
|
__decorate([
|
|
424
448
|
property({ reflect: true, type: Boolean })
|
|
425
449
|
], HelixHeadlessSelect.prototype, "multiple", void 0);
|
|
450
|
+
__decorate([
|
|
451
|
+
words,
|
|
452
|
+
property({ attribute: 'no-results-text' })
|
|
453
|
+
], HelixHeadlessSelect.prototype, "noResultsText", void 0);
|
|
426
454
|
__decorate([
|
|
427
455
|
words,
|
|
428
456
|
property()
|
|
@@ -430,6 +458,9 @@ __decorate([
|
|
|
430
458
|
__decorate([
|
|
431
459
|
property()
|
|
432
460
|
], HelixHeadlessSelect.prototype, "position", void 0);
|
|
461
|
+
__decorate([
|
|
462
|
+
property({ attribute: 'readonly', reflect: true, type: Boolean })
|
|
463
|
+
], HelixHeadlessSelect.prototype, "readOnly", void 0);
|
|
433
464
|
__decorate([
|
|
434
465
|
property({ attribute: false })
|
|
435
466
|
], HelixHeadlessSelect.prototype, "valueContent", void 0);
|
|
@@ -128,6 +128,11 @@ export declare class HelixHeadlessShortcutOverlay extends HelixElement {
|
|
|
128
128
|
* still overlaps moves down a row. Controls side by side in a toolbar are
|
|
129
129
|
* narrower than a key and a name together, and badges drawn over each other
|
|
130
130
|
* read as neither.
|
|
131
|
+
*
|
|
132
|
+
* **Both badges of a pair that would overlap drop it**, measured at full
|
|
133
|
+
* width before any is placed. Placed one at a time, the first of three
|
|
134
|
+
* toolbar buttons kept its name, the second dropped it, and the third, clear
|
|
135
|
+
* of the second's shorter badge, kept it: "⌘B Bold", "⌘I", "⌘K Link".
|
|
131
136
|
*/
|
|
132
137
|
private arrange;
|
|
133
138
|
protected render(): TemplateResult;
|
|
@@ -187,6 +187,20 @@ let HelixHeadlessShortcutOverlay = class HelixHeadlessShortcutOverlay extends He
|
|
|
187
187
|
const width = window.innerWidth;
|
|
188
188
|
const height = window.innerHeight;
|
|
189
189
|
const drawn = [...(this.renderRoot.querySelectorAll('[part~="badge"]') ?? [])];
|
|
190
|
+
const full = drawn.map((element, index) => {
|
|
191
|
+
element.toggleAttribute('data-compact', false);
|
|
192
|
+
const { height: tall, width: wide } = element.getBoundingClientRect();
|
|
193
|
+
const left = (this.badges[index]?.left ?? 0) - wide / 2;
|
|
194
|
+
const top = (this.badges[index]?.top ?? 0) + margin;
|
|
195
|
+
return { bottom: top + tall, left, right: left + wide, top };
|
|
196
|
+
});
|
|
197
|
+
const crowded = new Set(full.flatMap((one, index) => full.some((other, at) => at !== index &&
|
|
198
|
+
one.left < other.right &&
|
|
199
|
+
one.right > other.left &&
|
|
200
|
+
one.top < other.bottom &&
|
|
201
|
+
one.bottom > other.top)
|
|
202
|
+
? [index]
|
|
203
|
+
: []));
|
|
190
204
|
drawn.forEach((element, index) => {
|
|
191
205
|
const badge = this.badges[index];
|
|
192
206
|
if (!badge) {
|
|
@@ -204,7 +218,7 @@ let HelixHeadlessShortcutOverlay = class HelixHeadlessShortcutOverlay extends He
|
|
|
204
218
|
one.top < other.bottom &&
|
|
205
219
|
one.bottom > other.top);
|
|
206
220
|
const under = badge.top + margin;
|
|
207
|
-
let place = box(
|
|
221
|
+
let place = box(crowded.has(index), under);
|
|
208
222
|
if (hits(place).length > 0) {
|
|
209
223
|
place = box(true, under);
|
|
210
224
|
}
|
|
@@ -35,6 +35,7 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
35
35
|
* @csspart skeleton - The placeholder shape.
|
|
36
36
|
*
|
|
37
37
|
* @cssstate wrapping - The skeleton holds content, an element or words, and takes that content's size. Line breaks and spaces alone are not content.
|
|
38
|
+
* @cssstate wrapping-block - The content the skeleton holds is a block, which fills its line, so the skeleton fills the line with it.
|
|
38
39
|
*/
|
|
39
40
|
export declare class HelixHeadlessSkeleton extends HelixElement {
|
|
40
41
|
/**
|
|
@@ -16,6 +16,9 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
16
16
|
super.willUpdate(changed);
|
|
17
17
|
const wraps = this.wraps;
|
|
18
18
|
this.toggleState('wrapping', wraps);
|
|
19
|
+
const first = this.firstElementChild;
|
|
20
|
+
const display = wraps && first && this.isConnected ? getComputedStyle(first).display : '';
|
|
21
|
+
this.toggleState('wrapping-block', /^(block|flex|grid|table|list-item|flow-root)$/.test(display));
|
|
19
22
|
internalsOf(this).ariaBusy = this.loading ? 'true' : null;
|
|
20
23
|
if (this.label && (this.loading || !wraps)) {
|
|
21
24
|
hostAria(internalsOf(this), { label: this.label, role: 'progressbar' });
|
|
@@ -34,6 +34,11 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
34
34
|
* such as a normal range. A blank cell in a `for` table is a gap in the line,
|
|
35
35
|
* and a reading alone between two blanks is a `lone` mark.
|
|
36
36
|
*
|
|
37
|
+
* **Nothing to draw.** With no readings it shows `empty-text`, "No readings",
|
|
38
|
+
* in place of the line, and `loading` shows `loading-text` there until
|
|
39
|
+
* readings arrive, as on every chart. The `empty` and `loading` slots take
|
|
40
|
+
* markup in place of either.
|
|
41
|
+
*
|
|
37
42
|
* Place it beside a `Stat`, because a change beside a figure is a second fact,
|
|
38
43
|
* as `Stat`'s own spec says. `Trend` is composed the same way.
|
|
39
44
|
*
|
|
@@ -59,15 +64,22 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
59
64
|
* @aliases Micro Chart, Trend Line, Inline Chart
|
|
60
65
|
* @documentation https://fusion.dev/helix/components/sparkline
|
|
61
66
|
*
|
|
67
|
+
* @slot empty - Content shown in place of the line when there are no readings. Falls back to `empty-text`.
|
|
68
|
+
* @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
|
|
69
|
+
* @slot loading - Content shown in place of the line while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
70
|
+
*
|
|
62
71
|
* @event {HelixReadingChangeEvent} helix-reading-change - The reading shown moved, or was put away: `index` is the reading, or `-1` for none, with its row's `label` from a table and the `pointerType` that moved it.
|
|
63
72
|
* @event {HelixReadingPressEvent} helix-reading-press - A reading was clicked, tapped, or pressed with Enter or Space, with the same detail as `helix-reading-change`.
|
|
64
73
|
*
|
|
65
74
|
* @csspart area - The region between the line and the bottom of its range.
|
|
66
75
|
* @csspart bar - One column, drawn when `plot="bar"`.
|
|
67
76
|
* @csspart cursor - The mark on the reading a pointer or a key rests on, rendered only while there is one. Placed with `inset-inline-start` and `inset-block-start`.
|
|
77
|
+
* @csspart empty - The words in place of the line when there are no readings: the `empty` slot, falling back to `empty-text`. Not drawn while a table named by `for` cannot be read yet, on the server and during hydration.
|
|
78
|
+
* @csspart error - The words in place of the line while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
|
|
68
79
|
* @csspart high - The mark on the highest reading, under `marks="high"`. Placed as `cursor` is.
|
|
69
80
|
* @csspart line - The line's path.
|
|
70
81
|
* @csspart live - A polite region that says the reading a key moved to, rendered only with a `label`. Hide it visually.
|
|
82
|
+
* @csspart loading - The words in place of the line while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
|
|
71
83
|
* @csspart lone - The mark on a reading no line reaches, with a blank or an end on each side. Placed as `cursor` is.
|
|
72
84
|
* @csspart low - The mark on the lowest reading, under `marks="low"`. Placed as `cursor` is.
|
|
73
85
|
* @csspart overview - What the readings come to, in `overview-label`, which describes the drawing. Rendered `hidden` with a name, since it is read through the description and not shown.
|
|
@@ -80,6 +92,10 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
80
92
|
*
|
|
81
93
|
* @cssproperty --chart-terminus-x - Where the last point sits horizontally, as a percentage.
|
|
82
94
|
* @cssproperty --chart-terminus-y - Where the last point sits vertically, as a percentage.
|
|
95
|
+
*
|
|
96
|
+
* @cssstate empty - While the `empty` part stands in place of the line.
|
|
97
|
+
* @cssstate error - While the `error` part stands in place of the line.
|
|
98
|
+
* @cssstate loading - While the `loading` part stands in place of the line.
|
|
83
99
|
*/
|
|
84
100
|
export declare class HelixHeadlessSparkline extends HelixElement {
|
|
85
101
|
protected static markRules: string[];
|
|
@@ -117,6 +133,20 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
117
133
|
* here, which is what lets a line take the reading aid.
|
|
118
134
|
*/
|
|
119
135
|
curve?: Curve;
|
|
136
|
+
/**
|
|
137
|
+
* The words shown in place of the line when there are no readings, and the
|
|
138
|
+
* fallback of the `empty` slot.
|
|
139
|
+
*/
|
|
140
|
+
emptyText: string;
|
|
141
|
+
/**
|
|
142
|
+
* The words shown in place of the line when the readings did not load, such
|
|
143
|
+
* as "The visits did not load". Empty, the default, shows nothing.
|
|
144
|
+
*
|
|
145
|
+
* While it is set and there are no readings, the `error` line stands in place
|
|
146
|
+
* of the line, followed by your own content in the `error` slot, and the
|
|
147
|
+
* sparkline takes the `error` state. Clear it once you try again.
|
|
148
|
+
*/
|
|
149
|
+
errorText: string;
|
|
120
150
|
/**
|
|
121
151
|
* The id of a table to read the readings from, when a table holds the data.
|
|
122
152
|
*
|
|
@@ -137,6 +167,20 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
137
167
|
* than announced without a name.
|
|
138
168
|
*/
|
|
139
169
|
label: string;
|
|
170
|
+
/**
|
|
171
|
+
* Whether the readings are still on their way. The sparkline shows
|
|
172
|
+
* `loading-text` in place of an empty drawing until it has readings.
|
|
173
|
+
*
|
|
174
|
+
* Reflected, so a stylesheet can treat the sparkline while it waits. One
|
|
175
|
+
* that already has readings keeps drawing them, so a refresh does not blank
|
|
176
|
+
* it.
|
|
177
|
+
*/
|
|
178
|
+
loading: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* The words shown in place of the line while `loading` is set and there are
|
|
181
|
+
* no readings yet, and the fallback of the `loading` slot.
|
|
182
|
+
*/
|
|
183
|
+
loadingText: string;
|
|
140
184
|
/**
|
|
141
185
|
* The locale the words, the readout's numbers and positions are in, such
|
|
142
186
|
* as `de` for `1.240`.
|
|
@@ -231,6 +275,8 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
231
275
|
/** The two values of `range`, lower first, or none. */
|
|
232
276
|
private get band();
|
|
233
277
|
protected willUpdate(changed: PropertyValues<this>): void;
|
|
278
|
+
/** Records what stands in place of the line as the `empty` and `loading` states. */
|
|
279
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
234
280
|
/**
|
|
235
281
|
* The series to draw, and how many readings it has room for: the table's
|
|
236
282
|
* first series over the table's rows if there is one, the attribute
|
|
@@ -249,6 +295,13 @@ export declare class HelixHeadlessSparkline extends HelixElement {
|
|
|
249
295
|
*/
|
|
250
296
|
private reading;
|
|
251
297
|
protected render(): TemplateResult;
|
|
298
|
+
/**
|
|
299
|
+
* The words in place of the line while there is nothing to draw, as every
|
|
300
|
+
* chart's `MixinChartStatus` writes them: the `error` line, the `loading`
|
|
301
|
+
* line, the `empty` line, or nothing while a table named by `for` cannot be
|
|
302
|
+
* read yet.
|
|
303
|
+
*/
|
|
304
|
+
protected renderStatus(): TemplateResult | typeof nothing;
|
|
252
305
|
/**
|
|
253
306
|
* A mark on each reading with a blank on either side, which no line can
|
|
254
307
|
* reach, so a line and an area show it as `LineChart` does. Not on a bar
|
|
@@ -7,8 +7,12 @@ const STRIP_HEIGHT = 32;
|
|
|
7
7
|
let HelixHeadlessSparkline = class HelixHeadlessSparkline extends HelixElement {
|
|
8
8
|
constructor() {
|
|
9
9
|
super(...arguments);
|
|
10
|
+
this.emptyText = 'No readings';
|
|
11
|
+
this.errorText = '';
|
|
10
12
|
this.for = '';
|
|
11
13
|
this.label = '';
|
|
14
|
+
this.loading = false;
|
|
15
|
+
this.loadingText = 'Loading readings';
|
|
12
16
|
this.locale = '';
|
|
13
17
|
this.marks = '';
|
|
14
18
|
this.overviewLabel = 'From {first} to {last}, highest {high}, lowest {low}';
|
|
@@ -50,6 +54,13 @@ let HelixHeadlessSparkline = class HelixHeadlessSparkline extends HelixElement {
|
|
|
50
54
|
this.source.watch();
|
|
51
55
|
}
|
|
52
56
|
}
|
|
57
|
+
updated(changed) {
|
|
58
|
+
super.updated(changed);
|
|
59
|
+
const root = this.renderRoot;
|
|
60
|
+
this.toggleState('empty', root.querySelector('[part="empty"]') !== null);
|
|
61
|
+
this.toggleState('loading', root.querySelector('[part="loading"]') !== null);
|
|
62
|
+
this.toggleState('error', root.querySelector('[part="error"]') !== null);
|
|
63
|
+
}
|
|
53
64
|
drawn() {
|
|
54
65
|
const read = this.source.series;
|
|
55
66
|
if (read.length > 0) {
|
|
@@ -162,12 +173,23 @@ let HelixHeadlessSparkline = class HelixHeadlessSparkline extends HelixElement {
|
|
|
162
173
|
y=${bar.y}
|
|
163
174
|
/>`)}
|
|
164
175
|
</svg>
|
|
165
|
-
${points.length < 2 || this.plot === 'bar'
|
|
176
|
+
${points.length === 0 ? this.renderStatus() : nothing}${points.length < 2 || this.plot === 'bar'
|
|
166
177
|
? nothing
|
|
167
178
|
: html `<span aria-hidden="true" part="terminus" style=${end ?? nothing}></span>`}${this.renderLone(points.length < 2 ? undefined : series, at)}${this.renderMarks(slots, at)}${this.renderReading(slots, at)}${named && count > 0 ? this.renderLive(slots) : nothing}${overview === ''
|
|
168
179
|
? nothing
|
|
169
180
|
: html `<span hidden id="sparkline-overview" part="overview">${overview}</span>`}`;
|
|
170
181
|
}
|
|
182
|
+
renderStatus() {
|
|
183
|
+
if (this.errorText) {
|
|
184
|
+
return html `<p dir="auto" part="error" role="alert">${this.errorText}<slot name="error"></slot></p>`;
|
|
185
|
+
}
|
|
186
|
+
if (this.loading) {
|
|
187
|
+
return html `<p dir="auto" part="loading"><slot name="loading">${this.loadingText}</slot></p>`;
|
|
188
|
+
}
|
|
189
|
+
return this.source.known
|
|
190
|
+
? html `<p dir="auto" part="empty"><slot name="empty">${this.emptyText}</slot></p>`
|
|
191
|
+
: nothing;
|
|
192
|
+
}
|
|
171
193
|
renderLone(series, at) {
|
|
172
194
|
if (!series || this.plot === 'bar') {
|
|
173
195
|
return nothing;
|
|
@@ -212,12 +234,26 @@ let HelixHeadlessSparkline = class HelixHeadlessSparkline extends HelixElement {
|
|
|
212
234
|
__decorate([
|
|
213
235
|
property({ reflect: true })
|
|
214
236
|
], HelixHeadlessSparkline.prototype, "curve", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
words,
|
|
239
|
+
property({ attribute: 'empty-text' })
|
|
240
|
+
], HelixHeadlessSparkline.prototype, "emptyText", void 0);
|
|
241
|
+
__decorate([
|
|
242
|
+
property({ attribute: 'error-text' })
|
|
243
|
+
], HelixHeadlessSparkline.prototype, "errorText", void 0);
|
|
215
244
|
__decorate([
|
|
216
245
|
property()
|
|
217
246
|
], HelixHeadlessSparkline.prototype, "for", void 0);
|
|
218
247
|
__decorate([
|
|
219
248
|
property()
|
|
220
249
|
], HelixHeadlessSparkline.prototype, "label", void 0);
|
|
250
|
+
__decorate([
|
|
251
|
+
property({ reflect: true, type: Boolean })
|
|
252
|
+
], HelixHeadlessSparkline.prototype, "loading", void 0);
|
|
253
|
+
__decorate([
|
|
254
|
+
words,
|
|
255
|
+
property({ attribute: 'loading-text' })
|
|
256
|
+
], HelixHeadlessSparkline.prototype, "loadingText", void 0);
|
|
221
257
|
__decorate([
|
|
222
258
|
property()
|
|
223
259
|
], HelixHeadlessSparkline.prototype, "locale", void 0);
|
|
@@ -70,6 +70,7 @@ declare const HelixHeadlessSpatialBarChart_base: typeof HelixElement & (new (...
|
|
|
70
70
|
*
|
|
71
71
|
* @slot - The renderer's box, which the 3D drawing is made in.
|
|
72
72
|
* @slot empty - Content shown when the table has no readings. Falls back to `empty-text`.
|
|
73
|
+
* @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
|
|
73
74
|
* @slot loading - Content shown while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
74
75
|
*
|
|
75
76
|
* @event {HelixPlotChangeEvent} helix-plot-change - The bars or the bar the keys rest on changed, which the renderer is told. It stays on the chart.
|
|
@@ -82,6 +83,7 @@ declare const HelixHeadlessSpatialBarChart_base: typeof HelixElement & (new (...
|
|
|
82
83
|
* @csspart bar-active - The bar the pointer or the keys rest on. Set alongside `bar`.
|
|
83
84
|
* @csspart drawing - The chart's own drawing in SVG: the box, its grid and names, and the bars.
|
|
84
85
|
* @csspart empty - The words when the table has no readings: the `empty` slot, falling back to `empty-text`.
|
|
86
|
+
* @csspart error - The words while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
|
|
85
87
|
* @csspart face - One face of a bar the view shows, shaded by which way it faces.
|
|
86
88
|
* @csspart fallback - The box the chart's own drawing fills, shown until a renderer has drawn and where none is connected. Hidden from screen readers.
|
|
87
89
|
* @csspart floor - One place on the floor of a `row`, under a bar or where one would stand, drawn as its outline.
|
|
@@ -116,7 +118,7 @@ declare const HelixHeadlessSpatialBarChart_base: typeof HelixElement & (new (...
|
|
|
116
118
|
* @csspart tooltip-value - A column's value inside the tooltip.
|
|
117
119
|
* @csspart value - The value of a bar whose cell names a tone, written above it in the chart's own drawing.
|
|
118
120
|
*
|
|
119
|
-
* @cssproperty --spatial-bar-chart-shade -How far a bar's face turns from the light, from 0 for its top. The component writes it on each face, and the stylesheet that shades the face reads it.
|
|
121
|
+
* @cssproperty --spatial-bar-chart-shade - How far a bar's face turns from the light, from 0 for its top. The component writes it on each face, and the stylesheet that shades the face reads it.
|
|
120
122
|
* @cssproperty --spatial-bar-chart-tone-accent - The color of a bar whose cell says `data-tone="accent"`.
|
|
121
123
|
* @cssproperty --spatial-bar-chart-tone-danger - The color of a bar whose cell says `data-tone="danger"`.
|
|
122
124
|
* @cssproperty --spatial-bar-chart-tone-info - The color of a bar whose cell says `data-tone="info"`.
|
|
@@ -128,6 +130,7 @@ declare const HelixHeadlessSpatialBarChart_base: typeof HelixElement & (new (...
|
|
|
128
130
|
* @cssstate active - While a bar is shown, under the pointer or the keys.
|
|
129
131
|
* @cssstate drawn - While a renderer has drawn the bars, and the chart's own drawing is hidden.
|
|
130
132
|
* @cssstate empty - While the `empty` part stands in place of the readings.
|
|
133
|
+
* @cssstate error - While the `error` part stands in place of the readings.
|
|
131
134
|
* @cssstate loading - While the `loading` part stands in place of the readings.
|
|
132
135
|
*/
|
|
133
136
|
export declare class HelixHeadlessSpatialBarChart extends HelixHeadlessSpatialBarChart_base {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, motionPaused, reducedMotion, shortNumber, spokenReading, words, } from '@fusion.dev/helix-core';
|
|
2
|
+
import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, motionPaused, reducedMotion, shortNumber, spokenReading, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { html, nothing, svg, } from 'lit';
|
|
4
4
|
import { property, state } from 'lit/decorators.js';
|
|
5
5
|
import '../../tooltip/index.js';
|
|
@@ -334,7 +334,7 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
|
|
|
334
334
|
const layout = this.layout ?? 'grid';
|
|
335
335
|
const lined = layout === 'grid' ? undefined : layout;
|
|
336
336
|
const bare = this.noBox || lined !== undefined;
|
|
337
|
-
const view = wordsFitted(this.room, (words) => boxView(read.axes, this.camera, [], bare, words));
|
|
337
|
+
const view = wordsFitted(this.room, (words) => boxView(read.axes, this.camera, [], bare, words, wordsLocale(this)));
|
|
338
338
|
const room = this.room;
|
|
339
339
|
const sized = lined && room?.bar ? this.sized(read, view.projection, lined, room) : undefined;
|
|
340
340
|
const field = sized?.field ?? read;
|
|
@@ -64,6 +64,7 @@ declare const HelixHeadlessSpatialRibbonChart_base: typeof HelixElement & (new (
|
|
|
64
64
|
*
|
|
65
65
|
* @slot - The renderer's box, which the 3D drawing is made in.
|
|
66
66
|
* @slot empty - Content shown when the table has no readings. Falls back to `empty-text`.
|
|
67
|
+
* @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
|
|
67
68
|
* @slot loading - Content shown while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
68
69
|
*
|
|
69
70
|
* @event {HelixPlotChangeEvent} helix-plot-change - The readings or the reading the keys rest on changed, which the renderer is told. It stays on the chart.
|
|
@@ -74,6 +75,7 @@ declare const HelixHeadlessSpatialRibbonChart_base: typeof HelixElement & (new (
|
|
|
74
75
|
* @csspart axis-name - A measure's name, along its edge of the box, in the chart's own drawing.
|
|
75
76
|
* @csspart drawing - The chart's own drawing in SVG: the box, its grid and names, and the ribbons.
|
|
76
77
|
* @csspart empty - The words when the table has no readings: the `empty` slot, falling back to `empty-text`.
|
|
78
|
+
* @csspart error - The words while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
|
|
77
79
|
* @csspart face - One face of a ribbon the view shows: a piece of its top, an end, or its side, shaded by how far it turns from the light.
|
|
78
80
|
* @csspart fallback - The box the chart's own drawing fills, shown until a renderer has drawn and where none is connected. Hidden from screen readers.
|
|
79
81
|
* @csspart grid - The box's edges and its grid, in the chart's own drawing.
|
|
@@ -110,6 +112,7 @@ declare const HelixHeadlessSpatialRibbonChart_base: typeof HelixElement & (new (
|
|
|
110
112
|
* @cssstate active - While a reading is shown, under the pointer or the keys.
|
|
111
113
|
* @cssstate drawn - While a renderer has drawn the ribbons, and the chart's own drawing is hidden.
|
|
112
114
|
* @cssstate empty - While the `empty` part stands in place of the readings.
|
|
115
|
+
* @cssstate error - While the `error` part stands in place of the readings.
|
|
113
116
|
* @cssstate loading - While the `loading` part stands in place of the readings.
|
|
114
117
|
*/
|
|
115
118
|
export declare class HelixHeadlessSpatialRibbonChart extends HelixHeadlessSpatialRibbonChart_base {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, spokenReading, words, } from '@fusion.dev/helix-core';
|
|
2
|
+
import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, spokenReading, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { html, nothing, svg, } from 'lit';
|
|
4
4
|
import { property, state } from 'lit/decorators.js';
|
|
5
5
|
import '../../tooltip/index.js';
|
|
@@ -154,7 +154,7 @@ let HelixHeadlessSpatialRibbonChart = class HelixHeadlessSpatialRibbonChart exte
|
|
|
154
154
|
${readable ? this.renderSummary(field) : this.renderStatus()}${this.renderSonify()}${this.renderTable()}`;
|
|
155
155
|
}
|
|
156
156
|
renderFallback(field, at) {
|
|
157
|
-
const view = wordsFitted(this.plotRoom.room, (words) => boxView(field.axes, this.camera, [], this.noBox, words));
|
|
157
|
+
const view = wordsFitted(this.plotRoom.room, (words) => boxView(field.axes, this.camera, [], this.noBox, words, wordsLocale(this)));
|
|
158
158
|
const ribbons = ribbonsDrawn(field, view.projection).sort((one, other) => one.depth - other.depth);
|
|
159
159
|
const places = ribbons.flatMap((ribbon) => ribbon.readings);
|
|
160
160
|
this.placed = places;
|
|
@@ -61,6 +61,7 @@ declare const HelixHeadlessSpatialScatterChart_base: typeof HelixElement & (new
|
|
|
61
61
|
*
|
|
62
62
|
* @slot - The renderer's box, which the 3D drawing is made in.
|
|
63
63
|
* @slot empty - Content shown when the table has no points. Falls back to `empty-text`.
|
|
64
|
+
* @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
|
|
64
65
|
* @slot loading - Content shown while `loading` is set and there are no points yet. Falls back to `loading-text`.
|
|
65
66
|
*
|
|
66
67
|
* @event {HelixPlotChangeEvent} helix-plot-change - The points or the point the keys rest on changed, which the renderer is told. It stays on the chart.
|
|
@@ -72,6 +73,7 @@ declare const HelixHeadlessSpatialScatterChart_base: typeof HelixElement & (new
|
|
|
72
73
|
* @csspart drawing - The chart's own drawing in SVG: the box, its grid and numbers, and the points.
|
|
73
74
|
* @csspart drop-line - The line from a point straight down to the floor of the box, drawn under `drop-lines`, in its group's color.
|
|
74
75
|
* @csspart empty - The words when the table has no points: the `empty` slot, falling back to `empty-text`.
|
|
76
|
+
* @csspart error - The words while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
|
|
75
77
|
* @csspart fallback - The box the chart's own drawing fills, shown until a renderer has drawn and where none is connected. Hidden from screen readers.
|
|
76
78
|
* @csspart grid - The box's edges and its grid at the ticks, in the chart's own drawing.
|
|
77
79
|
* @csspart live - The readout: a polite live region that says the point the keys moved to. Hide it visually.
|
|
@@ -106,6 +108,7 @@ declare const HelixHeadlessSpatialScatterChart_base: typeof HelixElement & (new
|
|
|
106
108
|
* @cssstate active - While a point is shown, under the pointer or the keys.
|
|
107
109
|
* @cssstate drawn - While a renderer has drawn the points, and the chart's own drawing is hidden.
|
|
108
110
|
* @cssstate empty - While the `empty` part stands in place of the points.
|
|
111
|
+
* @cssstate error - While the `error` part stands in place of the points.
|
|
109
112
|
* @cssstate loading - While the `loading` part stands in place of the points.
|
|
110
113
|
*/
|
|
111
114
|
export declare class HelixHeadlessSpatialScatterChart extends HelixHeadlessSpatialScatterChart_base {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, shortNumber, spokenReading, words, } from '@fusion.dev/helix-core';
|
|
2
|
+
import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, shortNumber, spokenReading, words, wordsLocale, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { html, nothing, svg } from 'lit';
|
|
4
4
|
import { property, state } from 'lit/decorators.js';
|
|
5
5
|
import '../../tooltip/index.js';
|
|
@@ -156,7 +156,7 @@ let HelixHeadlessSpatialScatterChart = class HelixHeadlessSpatialScatterChart ex
|
|
|
156
156
|
${readable ? this.renderSummary(field) : this.renderStatus()}${this.renderSonify()}${this.renderTable()}`;
|
|
157
157
|
}
|
|
158
158
|
renderFallback(field, at) {
|
|
159
|
-
const view = wordsFitted(this.plotRoom.room, (words) => boxView(field.axes, this.camera, [], this.noBox, words));
|
|
159
|
+
const view = wordsFitted(this.plotRoom.room, (words) => boxView(field.axes, this.camera, [], this.noBox, words, wordsLocale(this)));
|
|
160
160
|
const places = field.points.map((point, index) => {
|
|
161
161
|
const box = [
|
|
162
162
|
inBox(field.axes.x, point.x),
|
|
@@ -63,21 +63,26 @@ export interface BoxView {
|
|
|
63
63
|
}
|
|
64
64
|
/** Where a number stands in the box, from -1 at its axis' low end to 1 at its high end. */
|
|
65
65
|
export declare const inBox: (axis: PlotAxis, value: number) => number;
|
|
66
|
-
/**
|
|
67
|
-
|
|
66
|
+
/**
|
|
67
|
+
* A number on an axis, written short enough for a tick and grouped in
|
|
68
|
+
* `locale` as the flat charts write theirs, such as `3,000`: the runtime's own
|
|
69
|
+
* locale where it is empty. Negative zero is written as zero.
|
|
70
|
+
*/
|
|
71
|
+
export declare const tickText: (value: number, locale?: string) => string;
|
|
68
72
|
/** How large a tick's number and a measure's name are, on the page, in the box's units. */
|
|
69
73
|
export declare const TICK_SIZE = 0.13;
|
|
70
74
|
export declare const NAME_SIZE = 0.15;
|
|
71
75
|
/**
|
|
72
76
|
* The box for `axes`, seen from `camera`, and the readings' own places on
|
|
73
|
-
* the page, which `extra` adds to the bounds.
|
|
77
|
+
* the page, which `extra` adds to the bounds. Its numbers are written in
|
|
78
|
+
* `locale`.
|
|
74
79
|
*/
|
|
75
80
|
export declare const boxView: (axes: {
|
|
76
81
|
extent?: BoxExtent | undefined;
|
|
77
82
|
x: PlotAxis;
|
|
78
83
|
y: PlotAxis;
|
|
79
84
|
z: PlotAxis;
|
|
80
|
-
}, camera: Camera, extra?: readonly PagePoint[], bare?: boolean, words?: number) => BoxView;
|
|
85
|
+
}, camera: Camera, extra?: readonly PagePoint[], bare?: boolean, words?: number, locale?: string) => BoxView;
|
|
81
86
|
/** The drawing's box on the page, and the font size its words are measured against. */
|
|
82
87
|
export interface PlotRoom {
|
|
83
88
|
font: number;
|
|
@@ -85,13 +90,17 @@ export interface PlotRoom {
|
|
|
85
90
|
width: number;
|
|
86
91
|
}
|
|
87
92
|
/**
|
|
88
|
-
* The view whose ticks stand at the box's font size
|
|
93
|
+
* The view whose ticks stand at the box's font size on the page.
|
|
89
94
|
*
|
|
90
95
|
* The drawing scales through its `viewBox`, so a tick written in the box's units
|
|
91
96
|
* shrinks with the box: measured October 2026 at 390 wide, 7.4 pixels on Scatter
|
|
92
|
-
* and Surface, under the 12 of the box's own font.
|
|
93
|
-
* are
|
|
94
|
-
*
|
|
97
|
+
* and Surface, under the 12 of the box's own font. **And it grows with the box**,
|
|
98
|
+
* so the words are held to the font size from above as well as from below:
|
|
99
|
+
* measured November 4, 2026 at 640 wide, Treemap's ticks drew at 15.4 and its
|
|
100
|
+
* axis name at 17.8, against 12 and 13.8 on Surface beside it. The words widen
|
|
101
|
+
* the frame they are measured on, so the measure runs again on what they
|
|
102
|
+
* widened. Where nothing has measured the box, as on a server, the words stay
|
|
103
|
+
* at their written size.
|
|
95
104
|
*/
|
|
96
105
|
export declare const wordsFitted: (room: PlotRoom | undefined, draw: (words: number) => BoxView) => BoxView;
|
|
97
106
|
/** Keeps a chart told the size and font size of the box its own drawing fills. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { boxLabels, pathData, projectionOf, shortNumber, } from '@fusion.dev/helix-core';
|
|
1
|
+
import { boxLabels, formatNumbers, pathData, projectionOf, shortNumber, } from '@fusion.dev/helix-core';
|
|
2
2
|
import { svg } from 'lit';
|
|
3
3
|
export const SPATIAL_VIEW = { tilt: 25, turn: 42 };
|
|
4
4
|
export const VIEW_STEP = 15;
|
|
@@ -6,12 +6,12 @@ export const inBox = (axis, value) => {
|
|
|
6
6
|
const [low, high] = axis.range;
|
|
7
7
|
return high === low ? 0 : ((value - low) / (high - low)) * 2 - 1;
|
|
8
8
|
};
|
|
9
|
-
export const tickText = (value) =>
|
|
9
|
+
export const tickText = (value, locale = '') => formatNumbers(locale)(Number(value.toPrecision(6)) || 0);
|
|
10
10
|
const WIDE = 0.58;
|
|
11
11
|
export const TICK_SIZE = 0.13;
|
|
12
12
|
export const NAME_SIZE = 0.15;
|
|
13
13
|
const LABEL_GAP = 0.06;
|
|
14
|
-
export const boxView = (axes, camera, extra = [], bare = false, words = 1) => {
|
|
14
|
+
export const boxView = (axes, camera, extra = [], bare = false, words = 1, locale = '') => {
|
|
15
15
|
const projection = projectionOf(camera);
|
|
16
16
|
const [ex, ey, ez] = axes.extent ?? [1, 1, 1];
|
|
17
17
|
const on = ([x, y, z]) => projection.at(x * ex, -z * ez, y * ey);
|
|
@@ -50,7 +50,7 @@ export const boxView = (axes, camera, extra = [], bare = false, words = 1) => {
|
|
|
50
50
|
return {
|
|
51
51
|
at: inBox(axis, tick),
|
|
52
52
|
category: label !== undefined && !/\d/.test(label),
|
|
53
|
-
text: label ?? tickText(tick),
|
|
53
|
+
text: label ?? tickText(tick, locale),
|
|
54
54
|
};
|
|
55
55
|
}),
|
|
56
56
|
});
|
|
@@ -86,6 +86,7 @@ export const boxView = (axes, camera, extra = [], bare = false, words = 1) => {
|
|
|
86
86
|
};
|
|
87
87
|
const WORD_PASSES = 4;
|
|
88
88
|
const MOST_WORDS = 3;
|
|
89
|
+
const FEWEST_WORDS = 0.25;
|
|
89
90
|
export const wordsFitted = (room, draw) => {
|
|
90
91
|
let view = draw(1);
|
|
91
92
|
if (!room) {
|
|
@@ -93,7 +94,7 @@ export const wordsFitted = (room, draw) => {
|
|
|
93
94
|
}
|
|
94
95
|
for (let pass = 0; pass < WORD_PASSES; pass += 1) {
|
|
95
96
|
const pixel = 1 / Math.min(room.width / view.bounds.width, room.height / view.bounds.height);
|
|
96
|
-
view = draw(Math.min(MOST_WORDS, Math.max(
|
|
97
|
+
view = draw(Math.min(MOST_WORDS, Math.max(FEWEST_WORDS, (room.font * pixel) / TICK_SIZE)));
|
|
97
98
|
}
|
|
98
99
|
return view;
|
|
99
100
|
};
|
|
@@ -115,7 +116,7 @@ export class PlotRoomWatch {
|
|
|
115
116
|
const was = this.room;
|
|
116
117
|
if (was?.width !== width || was.height !== height || was.font !== font) {
|
|
117
118
|
this.room = height > 0 && width > 0 ? { font, height, width } : undefined;
|
|
118
|
-
this.host.requestUpdate();
|
|
119
|
+
requestAnimationFrame(() => this.host.requestUpdate());
|
|
119
120
|
}
|
|
120
121
|
});
|
|
121
122
|
this.sizes.observe(box);
|
|
@@ -63,6 +63,7 @@ declare const HelixHeadlessSpatialSurfaceChart_base: typeof HelixElement & (new
|
|
|
63
63
|
*
|
|
64
64
|
* @slot - The renderer's box, which the 3D drawing is made in.
|
|
65
65
|
* @slot empty - Content shown when the table has no readings. Falls back to `empty-text`.
|
|
66
|
+
* @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
|
|
66
67
|
* @slot loading - Content shown while `loading` is set and there are no readings yet. Falls back to `loading-text`.
|
|
67
68
|
*
|
|
68
69
|
* @event {HelixPlotChangeEvent} helix-plot-change - The readings or the place the keys rest on changed, which the renderer is told. It stays on the chart.
|
|
@@ -74,6 +75,7 @@ declare const HelixHeadlessSpatialSurfaceChart_base: typeof HelixElement & (new
|
|
|
74
75
|
* @csspart contour - The pieces of one contour line that cross one square of the surface, drawn under `contours` at their height, colored along the ramp by it.
|
|
75
76
|
* @csspart drawing - The chart's own drawing in SVG: the box, its grid and numbers, and the surface.
|
|
76
77
|
* @csspart empty - The words when the table has no readings: the `empty` slot, falling back to `empty-text`.
|
|
78
|
+
* @csspart error - The words while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
|
|
77
79
|
* @csspart face - One square of the surface between four readings, or a triangle where one is missing, shaded by its height and by which way it faces.
|
|
78
80
|
* @csspart fallback - The box the chart's own drawing fills, shown until a renderer has drawn and where none is connected. Hidden from screen readers.
|
|
79
81
|
* @csspart grid - The box's edges and its grid at the ticks, in the chart's own drawing.
|
|
@@ -110,6 +112,7 @@ declare const HelixHeadlessSpatialSurfaceChart_base: typeof HelixElement & (new
|
|
|
110
112
|
* @cssstate active - While a place is shown, under the pointer or the keys.
|
|
111
113
|
* @cssstate drawn - While a renderer has drawn the surface, and the chart's own drawing is hidden.
|
|
112
114
|
* @cssstate empty - While the `empty` part stands in place of the readings.
|
|
115
|
+
* @cssstate error - While the `error` part stands in place of the readings.
|
|
113
116
|
* @cssstate loading - While the `loading` part stands in place of the readings.
|
|
114
117
|
*/
|
|
115
118
|
export declare class HelixHeadlessSpatialSurfaceChart extends HelixHeadlessSpatialSurfaceChart_base {
|