@fusion.dev/helix-headless 0.245.0 → 0.247.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/area-chart/root/area-chart-root.d.ts +18 -3
- package/dist/area-chart/root/area-chart-root.js +29 -11
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -2
- package/dist/bar-chart/root/bar-chart-root.js +92 -32
- package/dist/code-editor/root/code-editor-root.d.ts +15 -0
- package/dist/code-editor/root/code-editor-root.js +8 -2
- package/dist/data-table/changes.d.ts +39 -0
- package/dist/data-table/changes.js +60 -0
- package/dist/data-table/root/data-table-root.d.ts +33 -0
- package/dist/data-table/root/data-table-root.js +52 -2
- package/dist/drawer/root/drawer-root.d.ts +54 -14
- package/dist/drawer/root/drawer-root.js +102 -29
- package/dist/editor/root/editor-root.d.ts +5 -0
- package/dist/editor/root/editor-root.js +5 -5
- package/dist/filter-input/menu/filter-menu.d.ts +1 -0
- package/dist/filter-input/menu/filter-menu.js +1 -1
- package/dist/find/root/find-root.d.ts +1 -0
- package/dist/find/root/find-root.js +1 -1
- package/dist/heatmap/root/buckets.d.ts +27 -0
- package/dist/heatmap/root/buckets.js +24 -1
- package/dist/heatmap/root/heatmap-root.d.ts +53 -2
- package/dist/heatmap/root/heatmap-root.js +59 -3
- package/dist/line-chart/root/line-chart-root.d.ts +26 -2
- package/dist/line-chart/root/line-chart-root.js +76 -24
- package/dist/menu/root/menu-root.d.ts +23 -1
- package/dist/menu/root/menu-root.js +60 -1
- package/dist/navigation/root/navigation-root.d.ts +1 -0
- package/dist/navigation/root/navigation-root.js +1 -1
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +3 -0
- package/dist/scatter-chart/root/scatter-chart-root.js +28 -8
- package/dist/skeleton/root/skeleton-root.d.ts +26 -2
- package/dist/skeleton/root/skeleton-root.js +19 -4
- package/dist/spatial-bar-chart/bars.d.ts +35 -9
- package/dist/spatial-bar-chart/bars.js +74 -17
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.d.ts +22 -34
- package/dist/spatial-bar-chart/root/spatial-bar-chart-root.js +46 -111
- package/dist/spatial-heatmap/root/spatial-heatmap-root.d.ts +27 -4
- package/dist/spatial-heatmap/root/spatial-heatmap-root.js +52 -13
- package/dist/spatial-ribbon-chart/ribbons.d.ts +10 -1
- package/dist/spatial-ribbon-chart/ribbons.js +25 -9
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.d.ts +43 -3
- package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.js +46 -8
- package/dist/spatial-scatter-chart/field.d.ts +23 -0
- package/dist/spatial-scatter-chart/field.js +47 -1
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +46 -3
- package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.js +56 -13
- package/dist/spatial-surface-chart/grid.d.ts +16 -0
- package/dist/spatial-surface-chart/grid.js +36 -1
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +46 -2
- package/dist/spatial-surface-chart/root/spatial-surface-chart-root.js +53 -7
- package/dist/spatial-treemap/blocks.d.ts +32 -1
- package/dist/spatial-treemap/blocks.js +72 -2
- package/dist/spatial-treemap/root/spatial-treemap-root.d.ts +45 -3
- package/dist/spatial-treemap/root/spatial-treemap-root.js +46 -6
- package/dist/tabs/root/tabs-root.d.ts +5 -1
- package/dist/tabs/root/tabs-root.js +8 -1
- package/dist/terminal/root/terminal-root.d.ts +2 -0
- package/dist/terminal/root/terminal-root.js +2 -2
- package/dist/toast/item/toast-item.d.ts +16 -11
- package/dist/toast/item/toast-item.js +13 -28
- package/dist/toast/root/toast-root.d.ts +6 -3
- package/dist/toast/root/toast-root.js +2 -2
- package/dist/toggle/group/toggle-group.d.ts +5 -1
- package/dist/toggle/group/toggle-group.js +8 -2
- package/dist/toolbar/root/toolbar-root.d.ts +9 -1
- package/dist/toolbar/root/toolbar-root.js +9 -1
- package/dist/video/root/video-root.d.ts +2 -0
- package/dist/video/root/video-root.js +2 -2
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +1 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +1 -1
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +399 -59
- package/types/vue.d.ts +250 -31
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AriaForwardController, HelixElement, KeyboardNavigationController, OpenPhaseController, type Placement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { AriaForwardController, HelixElement, HoverMarkController, KeyboardNavigationController, OpenPhaseController, type Placement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
declare const HelixHeadlessMenu_base: (new (...args: any[]) => import("@fusion.dev/helix-core").CollectionElement) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
|
|
4
4
|
/**
|
|
@@ -142,6 +142,7 @@ declare const HelixHeadlessMenu_base: (new (...args: any[]) => import("@fusion.d
|
|
|
142
142
|
* @csspart back-mark - The glyph on the back control of a submenu.
|
|
143
143
|
* @csspart empty - The text shown when the menu has no items.
|
|
144
144
|
* @csspart header - The bar above a submenu, holding the way back and its name.
|
|
145
|
+
* @csspart highlight - The wash on the row with focus, which glides from row to row as the pointer or the keys move focus. It carries the row's place and size as an indicator does, `data-placed` while it is on one, `data-gliding` from the frame after it arrives, and `data-tone` with the row's `tone`. Hidden until a stylesheet shows it, so the headless tier lays out as it did without it.
|
|
145
146
|
* @csspart live - A live region that repeats the empty and loading text, so screen readers announce it when it changes. Visually hidden in the styled tier.
|
|
146
147
|
* @csspart loading - The text shown while the items are loading.
|
|
147
148
|
* @csspart search-field - With `filterable`, the field that narrows the rows.
|
|
@@ -154,6 +155,7 @@ declare const HelixHeadlessMenu_base: (new (...args: any[]) => import("@fusion.d
|
|
|
154
155
|
* @cssstate drilled - A submenu's page is showing, so content that is not a row can hide with the top page.
|
|
155
156
|
* @cssstate entering - From the moment the panel shows until its entrance has finished.
|
|
156
157
|
* @cssstate exiting - From the moment the panel hides until its exit has finished.
|
|
158
|
+
* @cssstate gliding - While the highlight is on a row, so it draws the wash in place of each row's own.
|
|
157
159
|
* @cssstate mark - A row on the current page has a checkbox or a link, so every row keeps the trailing column.
|
|
158
160
|
* @cssstate open - While the menu is open.
|
|
159
161
|
* @cssstate placed-bottom - While the open panel sits below its trigger.
|
|
@@ -343,6 +345,26 @@ export declare class HelixHeadlessMenu extends HelixHeadlessMenu_base {
|
|
|
343
345
|
*/
|
|
344
346
|
protected readonly keys: KeyboardNavigationController;
|
|
345
347
|
protected readonly phases: OpenPhaseController;
|
|
348
|
+
/**
|
|
349
|
+
* **The highlight glides from row to row**, as the hover wash does in
|
|
350
|
+
* `Navigation`, `Tabs` and `Toggle Group`. It marks what each row lights on
|
|
351
|
+
* its own: the row with focus, which the pointer and the keys both move,
|
|
352
|
+
* while the pointer is over the panel or focus shows, and the row the keys
|
|
353
|
+
* reached in a filtered menu. Between two rows the pointer leaves focus
|
|
354
|
+
* where it was, so the mark holds and glides on. Rows on the panel only: a
|
|
355
|
+
* flyout's rows are drawn in their parent row and light themselves.
|
|
356
|
+
*/
|
|
357
|
+
protected readonly highlight: HoverMarkController;
|
|
358
|
+
/** The frame the highlight is next placed in. */
|
|
359
|
+
private highlightFrame;
|
|
360
|
+
/**
|
|
361
|
+
* Places the highlight a frame from now, once focus, the pointer, and each
|
|
362
|
+
* row's own update have settled. Every input that can move it books the
|
|
363
|
+
* same frame, so a burst of them places it once.
|
|
364
|
+
*/
|
|
365
|
+
private readonly queueHighlight;
|
|
366
|
+
/** The row the highlight belongs on, as the box its wash fills, or nothing. */
|
|
367
|
+
private highlightedRow;
|
|
346
368
|
/** Carries a host `aria-label` and `aria-labelledby` to the surface. */
|
|
347
369
|
protected readonly aria: AriaForwardController;
|
|
348
370
|
/** Where a context menu was asked for, in the viewport, while it is open. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
|
-
import { AriaForwardController, anchorElement, auditEntry, auditWrapped, customElement, DrilldownController, deepActiveElement, deepContains, elementById, focusTarget, HelixElement, inlineStep, internalsOf, KeyboardNavigationController, linkDescription, MIRROR_RULE, MixinCollection, MixinControllerOpen, numberConverter, OpenPhaseController, onUnlessFalse, PopoverController, scrollItemIntoView, sideOf, slottedWords, tellDisclosure, typeaheadBy, unlinkDescription, untilReactHydrated, words, } from '@fusion.dev/helix-core';
|
|
2
|
+
import { AriaForwardController, anchorElement, auditEntry, auditWrapped, customElement, DrilldownController, deepActiveElement, deepContains, elementById, focusTarget, HelixElement, HoverMarkController, inlineStep, internalsOf, KeyboardNavigationController, linkDescription, MIRROR_RULE, MixinCollection, MixinControllerOpen, numberConverter, OpenPhaseController, onUnlessFalse, PopoverController, scrollItemIntoView, sideOf, slottedWords, tellDisclosure, typeaheadBy, unlinkDescription, untilReactHydrated, words, } from '@fusion.dev/helix-core';
|
|
3
3
|
import { caretLeft } from '@fusion.dev/helix-icons';
|
|
4
4
|
import { html, nothing } from 'lit';
|
|
5
5
|
import { property } from 'lit/decorators.js';
|
|
@@ -11,6 +11,7 @@ const isItem = (element) => element !== null &&
|
|
|
11
11
|
element.isMenuItem === true;
|
|
12
12
|
const HOVER_DELAY = 100;
|
|
13
13
|
const GRACE = 300;
|
|
14
|
+
const HIGHLIGHT_EVENTS = ['focusin', 'focusout', 'pointerover', 'pointerout', 'keydown'];
|
|
14
15
|
const inTriangle = (x, y, [a, b, c]) => {
|
|
15
16
|
if (!a || !b || !c) {
|
|
16
17
|
return false;
|
|
@@ -77,6 +78,31 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
|
|
|
77
78
|
open: () => this.open,
|
|
78
79
|
surface: () => this.partNamed('surface'),
|
|
79
80
|
});
|
|
81
|
+
this.highlight = new HoverMarkController(this, {
|
|
82
|
+
gliding: (on) => this.toggleState('gliding', on),
|
|
83
|
+
mark: () => this.partNamed('highlight'),
|
|
84
|
+
surface: () => this.partNamed('surface'),
|
|
85
|
+
});
|
|
86
|
+
this.highlightFrame = 0;
|
|
87
|
+
this.queueHighlight = () => {
|
|
88
|
+
if (typeof requestAnimationFrame !== 'function') {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
cancelAnimationFrame(this.highlightFrame);
|
|
92
|
+
this.highlightFrame = requestAnimationFrame(() => {
|
|
93
|
+
this.highlightFrame = 0;
|
|
94
|
+
const box = this.highlightedRow();
|
|
95
|
+
const tone = box ? box.getRootNode().host?.getAttribute('tone') : null;
|
|
96
|
+
const mark = this.partNamed('highlight');
|
|
97
|
+
if (tone) {
|
|
98
|
+
mark?.setAttribute('data-tone', tone);
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
mark?.removeAttribute('data-tone');
|
|
102
|
+
}
|
|
103
|
+
this.highlight.show(box);
|
|
104
|
+
});
|
|
105
|
+
};
|
|
80
106
|
this.aria = new AriaForwardController(this, {
|
|
81
107
|
label: true,
|
|
82
108
|
target: () => this.menuBox,
|
|
@@ -390,6 +416,29 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
|
|
|
390
416
|
get pressHeld() {
|
|
391
417
|
return !this.context && this.openOn === 'long-press';
|
|
392
418
|
}
|
|
419
|
+
highlightedRow() {
|
|
420
|
+
const surface = this.partNamed('surface');
|
|
421
|
+
if (!this.open || !surface) {
|
|
422
|
+
return undefined;
|
|
423
|
+
}
|
|
424
|
+
const pointer = surface.matches(':hover');
|
|
425
|
+
const rows = this.flies ? this.topRows : this.drilldown.rows;
|
|
426
|
+
for (const row of rows) {
|
|
427
|
+
if (row.disabled || !this.kept(row)) {
|
|
428
|
+
continue;
|
|
429
|
+
}
|
|
430
|
+
const box = row.shadowRoot?.querySelector('[part~="item"]');
|
|
431
|
+
if (!box) {
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
if (this.filters?.highlighted === row ||
|
|
435
|
+
box.matches(':focus-visible') ||
|
|
436
|
+
(pointer && box.matches(':focus'))) {
|
|
437
|
+
return box;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return undefined;
|
|
441
|
+
}
|
|
393
442
|
tellTrigger() {
|
|
394
443
|
const slot = this.renderRoot?.querySelector('slot[name="trigger"]');
|
|
395
444
|
const trigger = slot?.assignedElements({ flatten: true })[0];
|
|
@@ -627,6 +676,9 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
|
|
|
627
676
|
this.addEventListener('pointercancel', this.handlePointerCancel);
|
|
628
677
|
this.addEventListener('click', this.handleHeldClick, true);
|
|
629
678
|
this.addEventListener('focusin', this.handleTriggerFocusIn);
|
|
679
|
+
for (const type of HIGHLIGHT_EVENTS) {
|
|
680
|
+
this.addEventListener(type, this.queueHighlight);
|
|
681
|
+
}
|
|
630
682
|
this.rowWatch = new MutationObserver(this.followRemoved);
|
|
631
683
|
this.rowWatch.observe(this, { childList: true, subtree: true });
|
|
632
684
|
void this.whenSettled.then(() => {
|
|
@@ -656,6 +708,11 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
|
|
|
656
708
|
this.removeEventListener('pointercancel', this.handlePointerCancel);
|
|
657
709
|
this.removeEventListener('click', this.handleHeldClick, true);
|
|
658
710
|
this.removeEventListener('focusin', this.handleTriggerFocusIn);
|
|
711
|
+
for (const type of HIGHLIGHT_EVENTS) {
|
|
712
|
+
this.removeEventListener(type, this.queueHighlight);
|
|
713
|
+
}
|
|
714
|
+
cancelAnimationFrame(this.highlightFrame);
|
|
715
|
+
this.highlightFrame = 0;
|
|
659
716
|
this.unwatchArea();
|
|
660
717
|
this.rowWatch?.disconnect();
|
|
661
718
|
this.rowWatch = undefined;
|
|
@@ -696,6 +753,7 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
|
|
|
696
753
|
}
|
|
697
754
|
updated(changed) {
|
|
698
755
|
super.updated(changed);
|
|
756
|
+
this.queueHighlight();
|
|
699
757
|
if (changed.has('for') || changed.has('context')) {
|
|
700
758
|
this.watchArea();
|
|
701
759
|
}
|
|
@@ -858,6 +916,7 @@ let HelixHeadlessMenu = class HelixHeadlessMenu extends MixinCollection(MixinCon
|
|
|
858
916
|
data-filtered=${filters?.filtering ? '' : nothing}
|
|
859
917
|
?hidden=${!this.open}
|
|
860
918
|
>
|
|
919
|
+
<div part="highlight" aria-hidden="true" hidden></div>
|
|
861
920
|
${filters ? filters.drawFilter(rows, busy) : rows}
|
|
862
921
|
</div>${this.renderLive(this.hasRows)}`;
|
|
863
922
|
}
|
|
@@ -86,6 +86,7 @@ import '../../menu/index.js';
|
|
|
86
86
|
* @csspart overflow-back-mark - The glyph on the back control of a submenu.
|
|
87
87
|
* @csspart overflow-empty - The text shown when the menu has no items.
|
|
88
88
|
* @csspart overflow-header - The bar above a submenu, holding the way back and its name.
|
|
89
|
+
* @csspart overflow-highlight - Forwarded from the menu: the wash on the row with focus, which glides from row to row.
|
|
89
90
|
* @csspart overflow-live - The overflow menu's live region, which repeats the empty and loading text for screen readers.
|
|
90
91
|
* @csspart overflow-loading - The text shown while the items are loading.
|
|
91
92
|
* @csspart overflow-option - One destination in the overflow menu, a link to its address. Checked where it is the current one.
|
|
@@ -296,7 +296,7 @@ let HelixHeadlessNavigation = class HelixHeadlessNavigation extends HelixElement
|
|
|
296
296
|
return html `<${menu}
|
|
297
297
|
part="overflow"
|
|
298
298
|
exportparts="back: overflow-back, back-mark: overflow-back-mark, empty: overflow-empty,
|
|
299
|
-
header: overflow-header, live: overflow-live, loading: overflow-loading,
|
|
299
|
+
header: overflow-header, highlight: overflow-highlight, live: overflow-live, loading: overflow-loading,
|
|
300
300
|
search-field: overflow-search-field, surface: overflow-surface,
|
|
301
301
|
title: overflow-title"
|
|
302
302
|
label=${this.moreLabel}
|
|
@@ -127,6 +127,7 @@ declare const HelixHeadlessScatterChart_base: typeof HelixElement & (new (...arg
|
|
|
127
127
|
* @csspart point-active - The point of the row the reading rests on, one for each series with a point in that row, drawn over the others as an element of its own and placed by `--chart-point-x` and `--chart-point-y`. Under `size-by`, it carries its size as `--chart-point-weight`.
|
|
128
128
|
* @csspart point-ring - The points of a `point` path again, under it, to stroke a little wider in the page's color, so each point keeps its edge where it overlaps another.
|
|
129
129
|
* @csspart points - The points of one series that do not overlap one another, as a group of their `point-ring` and `point` paths. Its opacity is each point's, so where points overlap they darken. Carries its series color as `--chart-series`.
|
|
130
|
+
* @csspart points-hidden - The `points` of a series a legend hid, kept where they were last drawn, with each path `visibility="hidden"`, so a stylesheet can fade them out while the others move to the new scale. Set alongside `points`.
|
|
130
131
|
* @csspart sonify - The button that plays the chart as sound, under `sonify`.
|
|
131
132
|
* @csspart summary - The text that says how strongly the measures relate, for people who cannot see the points.
|
|
132
133
|
* @csspart svg - The drawing surface the gridlines and the trend lines sit on.
|
|
@@ -303,6 +304,8 @@ export declare class HelixHeadlessScatterChart extends HelixHeadlessScatterChart
|
|
|
303
304
|
protected render(): TemplateResult;
|
|
304
305
|
/** The rules and the points, behind a seam the styled tier can move. */
|
|
305
306
|
protected renderPlot(field: ScatterField, along: (value: number) => number, up: (value: number) => number): TemplateResult;
|
|
307
|
+
/** Each series' points as they were last drawn while it was shown, by its depth. */
|
|
308
|
+
private readonly shownPoints;
|
|
306
309
|
/**
|
|
307
310
|
* Every shown series' points, as `points` groups of `point-ring` and
|
|
308
311
|
* `point` paths, held against the field and the sizes they were drawn at.
|
|
@@ -3,6 +3,7 @@ import { CHART_PLOT, customElement, drawTooltip, formatNumbers, formatWords, Hel
|
|
|
3
3
|
import { html, nothing, svg } from 'lit';
|
|
4
4
|
import { property } from 'lit/decorators.js';
|
|
5
5
|
import { keyed } from 'lit/directives/keyed.js';
|
|
6
|
+
import { repeat } from 'lit/directives/repeat.js';
|
|
6
7
|
import '../../tooltip/index.js';
|
|
7
8
|
import { correlation, leastSquares } from '../fit.js';
|
|
8
9
|
import { layersOf } from '../layers.js';
|
|
@@ -60,6 +61,7 @@ let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinCha
|
|
|
60
61
|
this.requestUpdate();
|
|
61
62
|
}
|
|
62
63
|
};
|
|
64
|
+
this.shownPoints = new Map();
|
|
63
65
|
this.handleMove = (event) => {
|
|
64
66
|
if (event.pointerType !== 'mouse' && event.pointerType !== 'pen') {
|
|
65
67
|
return;
|
|
@@ -332,14 +334,27 @@ let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinCha
|
|
|
332
334
|
series.set(point.depth, [point]);
|
|
333
335
|
}
|
|
334
336
|
}
|
|
335
|
-
const
|
|
337
|
+
for (const [depth, points] of series) {
|
|
338
|
+
this.shownPoints.set(depth, points);
|
|
339
|
+
}
|
|
340
|
+
const all = field.yNames
|
|
341
|
+
.map((_, depth) => depth)
|
|
342
|
+
.flatMap((depth) => {
|
|
343
|
+
const shown = series.get(depth);
|
|
344
|
+
if (shown) {
|
|
345
|
+
return [[depth, shown, false]];
|
|
346
|
+
}
|
|
347
|
+
const held = this.shownPoints.get(depth);
|
|
348
|
+
return held ? [[depth, held, true]] : [];
|
|
349
|
+
});
|
|
350
|
+
const groups = all.flatMap(([depth, points, hidden]) => {
|
|
336
351
|
const placed = points.map((point) => ({
|
|
337
352
|
width: measured ? ringOf(point) : 0,
|
|
338
353
|
x: (point.x / PLOT_WIDTH) * width,
|
|
339
354
|
y: (point.y / PLOT_HEIGHT) * height,
|
|
340
355
|
}));
|
|
341
356
|
const index = seriesIndex(depth);
|
|
342
|
-
return layersOf(placed, measured ? LAYERS : 1, ratio).map((layer) => {
|
|
357
|
+
return layersOf(placed, measured ? LAYERS : 1, ratio).map((layer, deep) => {
|
|
343
358
|
const sized = new Map();
|
|
344
359
|
for (const at of layer) {
|
|
345
360
|
const point = points[at];
|
|
@@ -356,13 +371,18 @@ let HelixHeadlessScatterChart = class HelixHeadlessScatterChart extends MixinCha
|
|
|
356
371
|
d: dots.join(''),
|
|
357
372
|
style: weight === undefined ? nothing : `--chart-point-weight: ${weight}`,
|
|
358
373
|
}));
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
374
|
+
const unseen = hidden ? 'hidden' : nothing;
|
|
375
|
+
return {
|
|
376
|
+
key: `${depth} ${deep}`,
|
|
377
|
+
mark: svg `<g
|
|
378
|
+
data-series=${index}
|
|
379
|
+
part="points${hidden ? ' points-hidden' : ''}"
|
|
380
|
+
style="--chart-series: var(--chart-series-${index})"
|
|
381
|
+
>${paths.map(({ d, style }) => svg `<path d=${d} part="point-ring" style=${style} visibility=${unseen} />`)}${paths.map(({ d, style }) => svg `<path d=${d} part="point" style=${style} visibility=${unseen} />`)}</g>`,
|
|
382
|
+
};
|
|
364
383
|
});
|
|
365
|
-
})
|
|
384
|
+
});
|
|
385
|
+
const marks = svg `${repeat(groups, (one) => one.key, (one) => one.mark)}`;
|
|
366
386
|
this.painted = { field, key, marks };
|
|
367
387
|
return marks;
|
|
368
388
|
}
|
|
@@ -22,6 +22,14 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
22
22
|
* `loading` off and the content is shown as it is. An empty skeleton is a
|
|
23
23
|
* placeholder of its own size, as before.
|
|
24
24
|
*
|
|
25
|
+
* **Draw your own placeholder in the `placeholder` slot** where the content is
|
|
26
|
+
* not there until it loads, such as a card that is drawn from data: a circle
|
|
27
|
+
* and three lines, laid out as the card will be. While `loading` is set the
|
|
28
|
+
* placeholder shows and the content is hidden. Once it is off the placeholder
|
|
29
|
+
* is hidden and the content shows. The placeholder is hidden from screen
|
|
30
|
+
* readers. A server cannot see the children, so it serves both, and the
|
|
31
|
+
* content is hidden once the page has its children.
|
|
32
|
+
*
|
|
25
33
|
* @since 0.1.0
|
|
26
34
|
* @status stable
|
|
27
35
|
* @category feedback
|
|
@@ -32,8 +40,10 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
32
40
|
* @documentation https://fusion.dev/helix/components/skeleton
|
|
33
41
|
*
|
|
34
42
|
* @slot - The content the skeleton stands in for, which sizes it. Optional.
|
|
43
|
+
* @slot placeholder - What shows while `loading` is set, in place of the content, such as skeletons laid out as the content will be. Falls back to the skeleton's own shape.
|
|
35
44
|
*
|
|
36
|
-
* @csspart content - The box around the content, inert while `loading
|
|
45
|
+
* @csspart content - The box around the content, inert while `loading`, and hidden while `loading` where the `placeholder` slot is filled.
|
|
46
|
+
* @csspart placeholder - The box around the `placeholder` slot and the shape it falls back to, hidden once the content has loaded.
|
|
37
47
|
* @csspart sheen - The highlight inside the shape, which the styled tier sweeps across it. Empty, and drawn by no rule on this tier.
|
|
38
48
|
* @csspart skeleton - The placeholder shape.
|
|
39
49
|
*
|
|
@@ -62,10 +72,24 @@ export declare class HelixHeadlessSkeleton extends HelixElement {
|
|
|
62
72
|
* be known. Not on a server, where an unlabeled skeleton is taken for an
|
|
63
73
|
* empty one until the page has its children.
|
|
64
74
|
*/
|
|
65
|
-
|
|
75
|
+
protected get wraps(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the page drew its own placeholder, in the `placeholder` slot,
|
|
78
|
+
* read off the children where they can be known. Not on a server, which
|
|
79
|
+
* serves the content and the placeholder both until the page has its
|
|
80
|
+
* children.
|
|
81
|
+
*/
|
|
82
|
+
protected get placeholdered(): boolean;
|
|
66
83
|
protected willUpdate(changed: PropertyValues): void;
|
|
67
84
|
protected firstUpdated(changed: PropertyValues): void;
|
|
68
85
|
protected render(): TemplateResult;
|
|
86
|
+
/**
|
|
87
|
+
* The `placeholder` slot, with the shape as its fallback, hidden from
|
|
88
|
+
* assistive technology and once the content has loaded.
|
|
89
|
+
*
|
|
90
|
+
* @param update Asks for the update that reads what the page slotted.
|
|
91
|
+
*/
|
|
92
|
+
protected renderPlaceholder(update: () => void): TemplateResult;
|
|
69
93
|
/**
|
|
70
94
|
* The placeholder shape and the sheen inside it.
|
|
71
95
|
*
|
|
@@ -12,11 +12,14 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
12
12
|
return (this.childrenKnown &&
|
|
13
13
|
[...this.childNodes].some((node) => node.nodeType === 1 || (node.textContent ?? '').trim() !== ''));
|
|
14
14
|
}
|
|
15
|
+
get placeholdered() {
|
|
16
|
+
return this.knownChildren.some((child) => child.slot === 'placeholder');
|
|
17
|
+
}
|
|
15
18
|
willUpdate(changed) {
|
|
16
19
|
super.willUpdate(changed);
|
|
17
20
|
const wraps = this.wraps;
|
|
18
21
|
this.toggleState('wrapping', wraps);
|
|
19
|
-
const first = this.firstElementChild;
|
|
22
|
+
const first = this.knownChildren.find((child) => child.slot !== 'placeholder') ?? this.firstElementChild;
|
|
20
23
|
const display = wraps && first && this.isConnected ? getComputedStyle(first).display : '';
|
|
21
24
|
this.toggleState('wrapping-block', /^(block|flex|grid|table|list-item|flow-root)$/.test(display));
|
|
22
25
|
internalsOf(this).ariaBusy = this.loading ? 'true' : null;
|
|
@@ -34,9 +37,21 @@ let HelixHeadlessSkeleton = class HelixHeadlessSkeleton extends HelixElement {
|
|
|
34
37
|
this.finishHydration();
|
|
35
38
|
}
|
|
36
39
|
render() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
const update = () => this.requestUpdate();
|
|
41
|
+
return html `<span
|
|
42
|
+
part="content"
|
|
43
|
+
?hidden=${this.loading && this.placeholdered}
|
|
44
|
+
?inert=${this.loading}
|
|
45
|
+
><slot @slotchange=${update}></slot></span
|
|
46
|
+
>${this.renderPlaceholder(update)}`;
|
|
47
|
+
}
|
|
48
|
+
renderPlaceholder(update) {
|
|
49
|
+
return html `<span
|
|
50
|
+
part="placeholder"
|
|
51
|
+
aria-hidden="true"
|
|
52
|
+
?hidden=${!this.loading && this.wraps}
|
|
53
|
+
><slot name="placeholder" @slotchange=${update}>${this.renderShape()}</slot></span
|
|
54
|
+
>`;
|
|
40
55
|
}
|
|
41
56
|
renderShape() {
|
|
42
57
|
return html `<span part="skeleton"><span part="sheen"></span></span>`;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* measured from anywhere but zero says one value is a multiple of another
|
|
7
7
|
* when it is not.
|
|
8
8
|
*/
|
|
9
|
-
import { type Drawn, type PagePoint, type Projection } from '@fusion.dev/helix-core';
|
|
9
|
+
import { type Drawn, type MotionItem, type MotionShares, type PagePoint, type Projection } from '@fusion.dev/helix-core';
|
|
10
10
|
import { type FieldRow, type PlotAxis } from '../spatial-scatter-chart/field.js';
|
|
11
11
|
import { type BoxExtent } from '../spatial-scatter-chart/view.js';
|
|
12
12
|
/** One place on the grid: a category across, a series in depth, and its value, where the table has one. */
|
|
@@ -26,10 +26,26 @@ export interface BarCell {
|
|
|
26
26
|
label: string;
|
|
27
27
|
/** Which row of the grid in depth it stands in: its series, or the one row of a stacked chart. */
|
|
28
28
|
lane: number;
|
|
29
|
+
/**
|
|
30
|
+
* What the cell is known by from one table to the next, on a field drawn
|
|
31
|
+
* between two while the readings move. A table's own field has none.
|
|
32
|
+
*/
|
|
33
|
+
key?: string | undefined;
|
|
29
34
|
/** The row it was read from, counting from zero. */
|
|
30
35
|
row: number;
|
|
31
36
|
/** The tone the cell names with `data-tone`, which colors its own bar, where it names one. */
|
|
32
37
|
tone?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* On a field drawn between two, the series whose color the cell moves
|
|
40
|
+
* from, and how far it has come, from 0 to 1, where a move takes it to
|
|
41
|
+
* another series' place in depth, such as when a series before it left.
|
|
42
|
+
* Its color moves with it, so a bar shrinking out and the one taking its
|
|
43
|
+
* place never wear one color.
|
|
44
|
+
*/
|
|
45
|
+
wore?: {
|
|
46
|
+
depth: number;
|
|
47
|
+
share: number;
|
|
48
|
+
} | undefined;
|
|
33
49
|
/** The value, where the cell holds a number. */
|
|
34
50
|
value?: number | undefined;
|
|
35
51
|
}
|
|
@@ -167,7 +183,8 @@ export interface FloorPlate {
|
|
|
167
183
|
* The places on the floor of a row, one for each category in each lane,
|
|
168
184
|
* whether a bar stands there or not: a square a little wider than a bar's
|
|
169
185
|
* footprint, turned as the bars are, where zero stands on the value axis,
|
|
170
|
-
* along the row `layout` lays.
|
|
186
|
+
* along the row `layout` lays. Between two tables, each place slides with
|
|
187
|
+
* its bar.
|
|
171
188
|
*/
|
|
172
189
|
export declare const floorOf: (field: BarField, projection: Projection, layout?: Exclude<BarLayout, 'grid'>) => FloorPlate[];
|
|
173
190
|
/** A category's name written under its place in a row. */
|
|
@@ -189,11 +206,20 @@ export interface RowName {
|
|
|
189
206
|
*/
|
|
190
207
|
export declare const namesOf: (field: BarField, plates: readonly FloorPlate[], size: number) => RowName[];
|
|
191
208
|
/**
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
|
|
209
|
+
* The key of each cell of `field`, in the order of its cells: its
|
|
210
|
+
* category's name and its series', each numbered where it comes again. A
|
|
211
|
+
* field drawn between two tables carries each cell's key with it.
|
|
212
|
+
*/
|
|
213
|
+
export declare const barKeys: (field: BarField) => string[];
|
|
214
|
+
/** Each cell of `field` as the chart's motion knows it: by its key, growing in with its category. */
|
|
215
|
+
export declare const barItems: (field: BarField) => MotionItem[];
|
|
216
|
+
/**
|
|
217
|
+
* The bars `at` the shares between `from` and `to`, which the chart draws
|
|
218
|
+
* while its readings move: `to`'s cells, each at its share of the way from
|
|
219
|
+
* its reading in `from` to its reading in `to`, then each cell `from` had
|
|
220
|
+
* and `to` does not, shrinking to the floor. **A cell moves along the floor
|
|
221
|
+
* as well as up**, so a category added before it slides it across. The axes
|
|
222
|
+
* move with `at.axes`, and the value axis's ticks are the new ones from the
|
|
223
|
+
* start. With no `from`, every bar grows from the floor.
|
|
196
224
|
*/
|
|
197
|
-
export declare const
|
|
198
|
-
/** How long the bars of `categories` take to grow in, the last one included, in milliseconds. */
|
|
199
|
-
export declare const growTime: (categories: number) => number;
|
|
225
|
+
export declare const barsBetween: (from: BarField | undefined, to: BarField, at: MotionShares) => BarField;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { depthOrder, pathData, solid, ticks, } from '@fusion.dev/helix-core';
|
|
1
|
+
import { depthOrder, keysOf, mix, mixAxis, pathData, solid, ticks, } from '@fusion.dev/helix-core';
|
|
2
2
|
import { niceRange } from '../spatial-scatter-chart/field.js';
|
|
3
3
|
import { inBox } from '../spatial-scatter-chart/view.js';
|
|
4
4
|
const HEIGHT = 0.6;
|
|
@@ -156,13 +156,16 @@ export const paintOrder = (projection, bars) => {
|
|
|
156
156
|
return [...columns.values()].flatMap((column) => column.sort((one, two) => one.base - two.base));
|
|
157
157
|
};
|
|
158
158
|
const PLATE = 0.85;
|
|
159
|
+
const ownCells = (field) => field.cells
|
|
160
|
+
.slice(0, field.categories.length * Math.max(field.series.length, 1))
|
|
161
|
+
.map((cell, index) => ({ across: Math.floor(index / Math.max(field.series.length, 1)), cell }));
|
|
159
162
|
export const floorOf = (field, projection, layout = 'row') => {
|
|
160
163
|
const { place, spacing } = placesOf(field, projection, layout);
|
|
161
164
|
const floor = inBox(field.axes.y, 0) * field.axes.extent[1];
|
|
162
165
|
const half = (spacing * PLATE) / 2;
|
|
163
166
|
const seen = new Set();
|
|
164
|
-
return field.
|
|
165
|
-
const key = `${
|
|
167
|
+
return ownCells(field).flatMap(({ across, cell }) => {
|
|
168
|
+
const key = `${across} ${cell.lane}`;
|
|
166
169
|
if (seen.has(key)) {
|
|
167
170
|
return [];
|
|
168
171
|
}
|
|
@@ -175,7 +178,7 @@ export const floorOf = (field, projection, layout = 'row') => {
|
|
|
175
178
|
projection.at(x - half, y + half, floor),
|
|
176
179
|
];
|
|
177
180
|
const front = corners.reduce((low, one) => (one.y > low.y ? one : low));
|
|
178
|
-
return [{ across
|
|
181
|
+
return [{ across, corners, d: pathData(corners), front }];
|
|
179
182
|
});
|
|
180
183
|
};
|
|
181
184
|
const NAME_WIDE = 0.58;
|
|
@@ -188,9 +191,9 @@ export const namesOf = (field, plates, size) => {
|
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
193
|
const tones = new Map();
|
|
191
|
-
for (const cell of field
|
|
192
|
-
if (cell.tone && cell.value !== undefined && !tones.has(
|
|
193
|
-
tones.set(
|
|
194
|
+
for (const { across, cell } of ownCells(field)) {
|
|
195
|
+
if (cell.tone && cell.value !== undefined && !tones.has(across)) {
|
|
196
|
+
tones.set(across, cell.tone);
|
|
194
197
|
}
|
|
195
198
|
}
|
|
196
199
|
const all = field.categories.flatMap((text, across) => {
|
|
@@ -235,15 +238,69 @@ export const namesOf = (field, plates, size) => {
|
|
|
235
238
|
}
|
|
236
239
|
return [];
|
|
237
240
|
};
|
|
238
|
-
const
|
|
239
|
-
const
|
|
240
|
-
const
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
const cellKey = (category, series) => `${category}\u0001${series}`;
|
|
242
|
+
export const barKeys = (field) => {
|
|
243
|
+
const categories = keysOf(field.categories);
|
|
244
|
+
const series = keysOf(field.series);
|
|
245
|
+
return field.cells.map((cell) => cell.key ?? cellKey(categories[cell.across] ?? cell.label, series[cell.depth] ?? ''));
|
|
246
|
+
};
|
|
247
|
+
export const barItems = (field) => {
|
|
248
|
+
const keys = barKeys(field);
|
|
249
|
+
return field.cells.map((cell, index) => ({ key: keys[index], step: cell.across }));
|
|
250
|
+
};
|
|
251
|
+
const grownTo = (cell, share) => ({
|
|
252
|
+
from: cell.from * share,
|
|
253
|
+
value: cell.value === undefined ? undefined : cell.value * share,
|
|
254
|
+
});
|
|
255
|
+
export const barsBetween = (from, to, at) => {
|
|
256
|
+
const keys = barKeys(to);
|
|
257
|
+
const before = new Map();
|
|
258
|
+
if (from) {
|
|
259
|
+
const had = barKeys(from);
|
|
260
|
+
from.cells.forEach((cell, index) => {
|
|
261
|
+
before.set(had[index], cell);
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
const cells = to.cells.map((cell, index) => {
|
|
265
|
+
const key = keys[index];
|
|
266
|
+
const share = at.share(key);
|
|
267
|
+
const old = before.get(key);
|
|
268
|
+
if (!old || at.floor(key) || old.value === undefined) {
|
|
269
|
+
return { ...cell, key, ...grownTo(cell, share) };
|
|
270
|
+
}
|
|
271
|
+
if (cell.value === undefined) {
|
|
272
|
+
return share >= 1 ? { ...cell, key } : { ...old, key, ...grownTo(old, 1 - share) };
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
...cell,
|
|
276
|
+
across: mix(old.across, cell.across, share),
|
|
277
|
+
from: mix(old.from, cell.from, share),
|
|
278
|
+
key,
|
|
279
|
+
lane: mix(old.lane, cell.lane, share),
|
|
280
|
+
value: mix(old.value, cell.value, share),
|
|
281
|
+
...(old.depth !== cell.depth && share < 1 ? { wore: { depth: old.depth, share } } : {}),
|
|
282
|
+
};
|
|
283
|
+
});
|
|
284
|
+
const kept = new Set(keys);
|
|
285
|
+
for (const [key, old] of before) {
|
|
286
|
+
const share = at.share(key);
|
|
287
|
+
if (!kept.has(key) && share < 1 && old.value !== undefined) {
|
|
288
|
+
cells.push({ ...old, key, ...grownTo(old, 1 - share) });
|
|
289
|
+
}
|
|
246
290
|
}
|
|
247
|
-
|
|
291
|
+
if (!from || at.axes >= 1) {
|
|
292
|
+
return { ...to, cells };
|
|
293
|
+
}
|
|
294
|
+
const [fx, fy, fz] = from.axes.extent;
|
|
295
|
+
const [tx, ty, tz] = to.axes.extent;
|
|
296
|
+
return {
|
|
297
|
+
...to,
|
|
298
|
+
axes: {
|
|
299
|
+
extent: [mix(fx, tx, at.axes), mix(fy, ty, at.axes), mix(fz, tz, at.axes)],
|
|
300
|
+
x: mixAxis(from.axes.x, to.axes.x, at.axes),
|
|
301
|
+
y: mixAxis(from.axes.y, to.axes.y, at.axes),
|
|
302
|
+
z: mixAxis(from.axes.z, to.axes.z, at.axes),
|
|
303
|
+
},
|
|
304
|
+
cells,
|
|
305
|
+
};
|
|
248
306
|
};
|
|
249
|
-
export const growTime = (categories) => GROW + stepOf(categories) * Math.max(0, categories - 1);
|