@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.
Files changed (76) hide show
  1. package/api.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/area-chart/root/area-chart-root.d.ts +18 -3
  4. package/dist/area-chart/root/area-chart-root.js +29 -11
  5. package/dist/bar-chart/root/bar-chart-root.d.ts +12 -2
  6. package/dist/bar-chart/root/bar-chart-root.js +92 -32
  7. package/dist/code-editor/root/code-editor-root.d.ts +15 -0
  8. package/dist/code-editor/root/code-editor-root.js +8 -2
  9. package/dist/data-table/changes.d.ts +39 -0
  10. package/dist/data-table/changes.js +60 -0
  11. package/dist/data-table/root/data-table-root.d.ts +33 -0
  12. package/dist/data-table/root/data-table-root.js +52 -2
  13. package/dist/drawer/root/drawer-root.d.ts +54 -14
  14. package/dist/drawer/root/drawer-root.js +102 -29
  15. package/dist/editor/root/editor-root.d.ts +5 -0
  16. package/dist/editor/root/editor-root.js +5 -5
  17. package/dist/filter-input/menu/filter-menu.d.ts +1 -0
  18. package/dist/filter-input/menu/filter-menu.js +1 -1
  19. package/dist/find/root/find-root.d.ts +1 -0
  20. package/dist/find/root/find-root.js +1 -1
  21. package/dist/heatmap/root/buckets.d.ts +27 -0
  22. package/dist/heatmap/root/buckets.js +24 -1
  23. package/dist/heatmap/root/heatmap-root.d.ts +53 -2
  24. package/dist/heatmap/root/heatmap-root.js +59 -3
  25. package/dist/line-chart/root/line-chart-root.d.ts +26 -2
  26. package/dist/line-chart/root/line-chart-root.js +76 -24
  27. package/dist/menu/root/menu-root.d.ts +23 -1
  28. package/dist/menu/root/menu-root.js +60 -1
  29. package/dist/navigation/root/navigation-root.d.ts +1 -0
  30. package/dist/navigation/root/navigation-root.js +1 -1
  31. package/dist/scatter-chart/root/scatter-chart-root.d.ts +3 -0
  32. package/dist/scatter-chart/root/scatter-chart-root.js +28 -8
  33. package/dist/skeleton/root/skeleton-root.d.ts +26 -2
  34. package/dist/skeleton/root/skeleton-root.js +19 -4
  35. package/dist/spatial-bar-chart/bars.d.ts +35 -9
  36. package/dist/spatial-bar-chart/bars.js +74 -17
  37. package/dist/spatial-bar-chart/root/spatial-bar-chart-root.d.ts +22 -34
  38. package/dist/spatial-bar-chart/root/spatial-bar-chart-root.js +46 -111
  39. package/dist/spatial-heatmap/root/spatial-heatmap-root.d.ts +27 -4
  40. package/dist/spatial-heatmap/root/spatial-heatmap-root.js +52 -13
  41. package/dist/spatial-ribbon-chart/ribbons.d.ts +10 -1
  42. package/dist/spatial-ribbon-chart/ribbons.js +25 -9
  43. package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.d.ts +43 -3
  44. package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.js +46 -8
  45. package/dist/spatial-scatter-chart/field.d.ts +23 -0
  46. package/dist/spatial-scatter-chart/field.js +47 -1
  47. package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +46 -3
  48. package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.js +56 -13
  49. package/dist/spatial-surface-chart/grid.d.ts +16 -0
  50. package/dist/spatial-surface-chart/grid.js +36 -1
  51. package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +46 -2
  52. package/dist/spatial-surface-chart/root/spatial-surface-chart-root.js +53 -7
  53. package/dist/spatial-treemap/blocks.d.ts +32 -1
  54. package/dist/spatial-treemap/blocks.js +72 -2
  55. package/dist/spatial-treemap/root/spatial-treemap-root.d.ts +45 -3
  56. package/dist/spatial-treemap/root/spatial-treemap-root.js +46 -6
  57. package/dist/tabs/root/tabs-root.d.ts +5 -1
  58. package/dist/tabs/root/tabs-root.js +8 -1
  59. package/dist/terminal/root/terminal-root.d.ts +2 -0
  60. package/dist/terminal/root/terminal-root.js +2 -2
  61. package/dist/toast/item/toast-item.d.ts +16 -11
  62. package/dist/toast/item/toast-item.js +13 -28
  63. package/dist/toast/root/toast-root.d.ts +6 -3
  64. package/dist/toast/root/toast-root.js +2 -2
  65. package/dist/toggle/group/toggle-group.d.ts +5 -1
  66. package/dist/toggle/group/toggle-group.js +8 -2
  67. package/dist/toolbar/root/toolbar-root.d.ts +9 -1
  68. package/dist/toolbar/root/toolbar-root.js +9 -1
  69. package/dist/video/root/video-root.d.ts +2 -0
  70. package/dist/video/root/video-root.js +2 -2
  71. package/dist/video-playlist/menu/video-playlist-menu.d.ts +1 -0
  72. package/dist/video-playlist/menu/video-playlist-menu.js +1 -1
  73. package/lint.json +1 -1
  74. package/package.json +5 -5
  75. package/types/jsx.d.ts +399 -59
  76. package/types/vue.d.ts +250 -31
@@ -1,4 +1,4 @@
1
- import { ticks } from '@fusion.dev/helix-core';
1
+ import { mix, mixAxis, ticks } from '@fusion.dev/helix-core';
2
2
  import { niceRange } from '../spatial-scatter-chart/field.js';
3
3
  export const surfaceOf = (rows, columns) => {
4
4
  const [xAt, zAt, yAt] = columns;
@@ -111,3 +111,38 @@ export const contoursOf = (field, levels) => {
111
111
  });
112
112
  };
113
113
  export const contourLevels = (field) => field.axes.y.ticks.filter((tick) => tick > field.lowest && tick < field.highest);
114
+ const placeKey = (cell) => `${cell.x}\u0001${cell.z}`;
115
+ export const surfaceItems = (field) => field.cells.map((cell, index) => ({
116
+ key: placeKey(cell),
117
+ step: Math.floor(index / Math.max(field.depths.length, 1)),
118
+ }));
119
+ const samePlaces = (one, other) => one.length === other.length && one.every((place, at) => place === other[at]);
120
+ export const surfaceBetween = (from, to, at) => {
121
+ if (from && !(samePlaces(from.acrosses, to.acrosses) && samePlaces(from.depths, to.depths))) {
122
+ return to;
123
+ }
124
+ const moved = from !== undefined && at.axes < 1;
125
+ const lowest = moved ? mix(from.lowest, to.lowest, at.axes) : to.lowest;
126
+ const highest = moved ? mix(from.highest, to.highest, at.axes) : to.highest;
127
+ const cells = to.cells.map((cell, index) => {
128
+ const share = at.share(placeKey(cell));
129
+ const old = from?.cells[index];
130
+ if (cell.value === undefined) {
131
+ return old?.value !== undefined && share < 1
132
+ ? { ...old, value: mix(old.value, lowest, share) }
133
+ : cell;
134
+ }
135
+ const start = !old || old.value === undefined || at.floor(placeKey(cell)) ? lowest : old.value;
136
+ return { ...cell, value: mix(start, cell.value, share) };
137
+ });
138
+ const field = {
139
+ ...to,
140
+ axes: moved ? { ...to.axes, y: mixAxis(from.axes.y, to.axes.y, at.axes) } : to.axes,
141
+ cells,
142
+ contours: [],
143
+ highest,
144
+ lowest,
145
+ };
146
+ field.contours = contoursOf(field, contourLevels(to));
147
+ return field;
148
+ };
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixElement } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, HelixElement, ReadingsMotionController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import '../../tooltip/index.js';
4
4
  import { type SurfaceField } from '../grid.js';
@@ -66,7 +66,7 @@ declare const HelixHeadlessSpatialSurfaceChart_base: typeof HelixElement & (new
66
66
  * @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
67
67
  * @slot loading - Content shown while `loading` is set and there are no readings yet. Falls back to `loading-text`.
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.
69
+ * @event {HelixPlotChangeEvent} helix-plot-change - The readings or the place the keys rest on changed, or a frame of a move drew the surface on its way, which the renderer is told. It stays on the chart.
70
70
  * @event {HelixPlotTurnEvent} helix-plot-turn - Shift with an arrow asked the view to turn, by a step across or up.
71
71
  * @event {HelixReadingChangeEvent} helix-reading-change - The reading moved, or was put away: `index` is the row, or `-1` for none or a place with no reading, with its `label` and the `pointerType` that moved it.
72
72
  * @event {HelixReadingPressEvent} helix-reading-press - A place was clicked or pressed with Enter or Space, with the same detail as `helix-reading-change`.
@@ -107,6 +107,8 @@ declare const HelixHeadlessSpatialSurfaceChart_base: typeof HelixElement & (new
107
107
  * @csspart tooltip-value - A column's value inside the tooltip.
108
108
  *
109
109
  * @cssproperty --spatial-surface-chart-level - How high a face of the surface stands between the lowest reading and the highest, from 0 to 1: its corners' average. The component writes it on each face, and the stylesheet that colors the face along the ramp reads it.
110
+ * @cssproperty --spatial-surface-chart-move-duration - How long the surface takes to move to a new table's readings: each place rises or falls to its new height, a place that gains a reading rises from the lowest one, and a place that loses its reading sinks to it. A grid whose places changed is drawn at once. Unset, a new table is drawn at once. The rise under `grow` keeps its own timing.
111
+ * @cssproperty --spatial-surface-chart-move-easing - The curve the surface moves to new readings along.
110
112
  * @cssproperty --spatial-surface-chart-shade - How far a face of the surface turns from the light, as a share of lightness to take from its color, from 0 facing it to about 0.3. The component writes it on each face, and the stylesheet that shades the face reads it.
111
113
  *
112
114
  * @cssstate active - While a place is shown, under the pointer or the keys.
@@ -127,6 +129,34 @@ export declare class HelixHeadlessSpatialSurfaceChart extends HelixHeadlessSpati
127
129
  * same height read as such. A renderer draws them too.
128
130
  */
129
131
  contours: boolean;
132
+ /**
133
+ * Raises the surface from a flat sheet at its lowest reading the first
134
+ * time the chart comes into view with readings, each row across a little
135
+ * after the one before it, so the drawing arrives the way a page's own
136
+ * picture does. The rise is fast at first, slows to rest, and never passes
137
+ * a reading.
138
+ *
139
+ * Under `prefers-reduced-motion`, or where the page has paused its motion
140
+ * through `pauseMotion` or `Motion Toggle`, the surface stands at its
141
+ * readings from the start. A later table moves the surface on
142
+ * `--spatial-surface-chart-move-duration`, and stands it at its new
143
+ * readings at once where that is unset: each place rises or falls to its
144
+ * new height, a place that gains a reading rises from the lowest reading,
145
+ * and one that loses its reading sinks to it. A table whose places across
146
+ * or in depth changed draws its new grid at once, since its places cannot
147
+ * be matched to the old ones.
148
+ */
149
+ grow: boolean;
150
+ /**
151
+ * Raises the surface again each time the chart comes back into view after
152
+ * it left it, as a pane does when it is opened again, where `grow` alone
153
+ * raises it the first time only. Only a chart that grows takes it.
154
+ *
155
+ * While it is out of view the surface lies flat, so the first frame after
156
+ * it returns is the start of the rise and never a flash of the whole
157
+ * drawing.
158
+ */
159
+ growAgain: boolean;
130
160
  /**
131
161
  * Draws no box: no edges, grid, numbers, or names, so the readings stand
132
162
  * alone and fill the plot, as a picture on a product's own page does. The
@@ -164,6 +194,14 @@ export declare class HelixHeadlessSpatialSurfaceChart extends HelixHeadlessSpati
164
194
  private last;
165
195
  /** The place the keys rested on last, so a change of it can be told. */
166
196
  private told;
197
+ /**
198
+ * Moves the surface from one table to the next, and raises it under
199
+ * `grow`, timed by `--spatial-surface-chart-move-duration` and
200
+ * `--spatial-surface-chart-move-easing`.
201
+ */
202
+ protected readonly motion: ReadingsMotionController<SurfaceField>;
203
+ /** The surface drawn last, kept so a frame of its move can be told. */
204
+ private lastShown;
167
205
  /** Carries a host `aria-labelledby` and `aria-describedby` to the plot. */
168
206
  protected readonly aria: AriaForwardController;
169
207
  /**
@@ -174,6 +212,12 @@ export declare class HelixHeadlessSpatialSurfaceChart extends HelixHeadlessSpati
174
212
  get field(): SurfaceField;
175
213
  /** The field last read, and the rows it was read from. */
176
214
  private memo;
215
+ /**
216
+ * The surface as drawn this frame, which a renderer draws: `field` at
217
+ * rest, and while the readings move, each place between its last height
218
+ * and its new one, with the contour lines through it.
219
+ */
220
+ get shown(): SurfaceField;
177
221
  /** The place the keys or the pointer rest on, as its place in `field.cells`, or `-1`. */
178
222
  get active(): number;
179
223
  /** The number of places on the grid, which the keys walk. */
@@ -1,10 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, spokenReading, words, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, ReadingsMotionController, 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';
6
6
  import { boundsOf, boxView, DragTurn, drawBox, inBox, nearestTo, PlotRoomWatch, SPATIAL_VIEW, shape, turned, wordsFitted, } from '../../spatial-scatter-chart/view.js';
7
- import { levelOf, surfaceOf } from '../grid.js';
7
+ import { levelOf, surfaceBetween, surfaceItems, surfaceOf } from '../grid.js';
8
8
  const LIGHT = (() => {
9
9
  const [x, y, z] = [-0.45, 1, 0.35];
10
10
  const length = Math.hypot(x, y, z);
@@ -21,6 +21,8 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  this.contours = false;
24
+ this.grow = false;
25
+ this.growAgain = false;
24
26
  this.noBox = false;
25
27
  this.openLabel = '{across} {x}, {depth} {z}: no reading';
26
28
  this.plotLabel = '3D surface chart';
@@ -33,6 +35,19 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
33
35
  }, () => this.requestUpdate());
34
36
  this.placed = [];
35
37
  this.told = -1;
38
+ this.motion = new ReadingsMotionController(this, {
39
+ between: surfaceBetween,
40
+ grow: () => this.grow,
41
+ growAgain: () => this.growAgain,
42
+ items: surfaceItems,
43
+ timing: () => {
44
+ const style = getComputedStyle(this);
45
+ return {
46
+ duration: style.getPropertyValue('--spatial-surface-chart-move-duration'),
47
+ easing: style.getPropertyValue('--spatial-surface-chart-move-easing'),
48
+ };
49
+ },
50
+ });
36
51
  this.aria = new AriaForwardController(this, {
37
52
  target: () => this.partNamed('plot'),
38
53
  });
@@ -83,6 +98,9 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
83
98
  }
84
99
  return this.memo.field;
85
100
  }
101
+ get shown() {
102
+ return this.motion.drawn ?? this.field;
103
+ }
86
104
  get active() {
87
105
  return this.pointer.at;
88
106
  }
@@ -106,7 +124,9 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
106
124
  }
107
125
  willUpdate(changed) {
108
126
  super.willUpdate(changed);
109
- this.pointer.grid = Math.max(1, this.field.depths.length);
127
+ const field = this.field;
128
+ this.pointer.grid = Math.max(1, field.depths.length);
129
+ this.motion.follow(field, field.readings > 0);
110
130
  }
111
131
  connectedCallback() {
112
132
  super.connectedCallback();
@@ -120,10 +140,16 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
120
140
  updated(changed) {
121
141
  super.updated(changed);
122
142
  const field = this.field;
143
+ const shown = this.shown;
123
144
  if (field !== this.last) {
124
145
  this.last = field;
146
+ this.lastShown = shown;
125
147
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'data' }));
126
148
  }
149
+ else if (shown !== this.lastShown) {
150
+ this.lastShown = shown;
151
+ this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'move' }));
152
+ }
127
153
  if (this.pointer.at !== this.told) {
128
154
  this.told = this.pointer.at;
129
155
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'focus' }));
@@ -162,8 +188,12 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
162
188
  </div>
163
189
  ${readable ? this.renderSummary(field) : this.renderStatus()}${this.renderSonify()}${this.renderTable()}`;
164
190
  }
165
- renderFallback(field, at) {
166
- const view = wordsFitted(this.plotRoom.room, (words) => boxView(field.axes, this.camera, [], this.noBox, words, wordsLocale(this)));
191
+ renderFallback(read, at) {
192
+ const view = wordsFitted(this.plotRoom.room, (words) => boxView(read.axes, this.camera, [], this.noBox, words, wordsLocale(this)));
193
+ const field = this.motion.moving ? this.shown : read;
194
+ const moving = field === read
195
+ ? view
196
+ : boxView(field.axes, this.camera, [], this.noBox, view.words, wordsLocale(this));
167
197
  const depths = field.depths.length;
168
198
  const boxed = field.cells.map((cell) => cell.value === undefined
169
199
  ? undefined
@@ -196,7 +226,17 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
196
226
  faces.sort((one, other) => one.depth - other.depth);
197
227
  const active = places.find((place) => place.index === at);
198
228
  const row = field.cells[at]?.row;
199
- const bounds = this.drag.frame(this.noBox ? boundsOf(places, 0.1) : view.bounds, view.on([0, 0, 0]));
229
+ const bounds = this.drag.frame(this.noBox
230
+ ? boundsOf(read.cells.flatMap((cell) => cell.value === undefined
231
+ ? []
232
+ : [
233
+ view.on([
234
+ inBox(read.axes.x, cell.x),
235
+ inBox(read.axes.y, cell.value),
236
+ inBox(read.axes.z, cell.z),
237
+ ]),
238
+ ]), 0.1)
239
+ : view.bounds, view.on([0, 0, 0]));
200
240
  const short = (value) => Math.round(value * 1000) / 1000;
201
241
  return html `<div aria-hidden="true" dir="ltr" ?hidden=${this.rendered} part="fallback">
202
242
  <svg
@@ -210,7 +250,7 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
210
250
  @pointerleave=${this.onDrawingLeave}
211
251
  @pointermove=${this.onDrawingMove}
212
252
  @pointerup=${this.onDrawingTap}
213
- >${this.noBox ? nothing : drawBox(view)}${faces.map((face) => svg `<path d=${shape(face.points.map((point) => view.on(point)))} data-corners=${face.corners.join(' ')} part="face" style="--spatial-surface-chart-level: ${short(face.level)}; --spatial-surface-chart-shade: ${short(face.shade)}"></path>${this.contours ? this.renderContoursIn(field, face.square, view.on) : nothing}`)}${active
253
+ >${this.noBox ? nothing : drawBox(moving)}${faces.map((face) => svg `<path d=${shape(face.points.map((point) => view.on(point)))} data-corners=${face.corners.join(' ')} part="face" style="--spatial-surface-chart-level: ${short(face.level)}; --spatial-surface-chart-shade: ${short(face.shade)}"></path>${this.contours ? this.renderContoursIn(field, face.square, view.on) : nothing}`)}${active
214
254
  ? svg `<circle cx=${active.x} cy=${active.y} part="ring" r="0.085"></circle><foreignObject height="0.001" overflow="visible" width="0.001" x=${active.x} y=${active.y}>${this.renderOwnTooltip(row)}</foreignObject>`
215
255
  : nothing}</svg>
216
256
  </div>`;
@@ -290,6 +330,12 @@ let HelixHeadlessSpatialSurfaceChart = class HelixHeadlessSpatialSurfaceChart ex
290
330
  __decorate([
291
331
  property({ reflect: true, type: Boolean })
292
332
  ], HelixHeadlessSpatialSurfaceChart.prototype, "contours", void 0);
333
+ __decorate([
334
+ property({ reflect: true, type: Boolean })
335
+ ], HelixHeadlessSpatialSurfaceChart.prototype, "grow", void 0);
336
+ __decorate([
337
+ property({ attribute: 'grow-again', reflect: true, type: Boolean })
338
+ ], HelixHeadlessSpatialSurfaceChart.prototype, "growAgain", void 0);
293
339
  __decorate([
294
340
  property({ attribute: 'no-box', reflect: true, type: Boolean })
295
341
  ], HelixHeadlessSpatialSurfaceChart.prototype, "noBox", void 0);
@@ -6,7 +6,7 @@
6
6
  * that is the same, and blocks painted in the wrong order cover the ones in
7
7
  * front of them.
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
  /** A part of the floor: across from `x0` to `x1`, and in depth from `z0` to `z1`, each from -1 to 1. */
@@ -24,8 +24,19 @@ export interface TreemapBlock {
24
24
  group: string;
25
25
  /** Its group's place among the groups, which its color is read by. */
26
26
  groupIndex: number;
27
+ /**
28
+ * How much of its height it stands at, from 0 on the floor to 1, on a field
29
+ * drawn between two tables while it grows in or shrinks away. A table's own
30
+ * field has none, and every block stands whole.
31
+ */
32
+ grown?: number | undefined;
27
33
  /** Its height, from the second numeric column, where the table has one. */
28
34
  height?: number | undefined;
35
+ /**
36
+ * What the block is known by from one table to the next, on a field drawn
37
+ * between two while the readings move. A table's own field has none.
38
+ */
39
+ key?: string | undefined;
29
40
  /** The row's own label. */
30
41
  label: string;
31
42
  /** The row it was read from, counting from zero. */
@@ -72,6 +83,26 @@ export declare const squarified: (sizes: readonly number[], within: FloorArea) =
72
83
  * largest stand at the back left**, where they hide the least.
73
84
  */
74
85
  export declare const treemapOf: (rows: readonly FieldRow[], columns: readonly number[], groupBy?: string) => TreemapField;
86
+ /**
87
+ * The key of each block of `field`, in its order: its label, numbered where a
88
+ * label comes again. A field drawn between two tables carries each block's
89
+ * key with it.
90
+ */
91
+ export declare const blockKeys: (field: TreemapField) => string[];
92
+ /** Each block as the chart's motion knows it: by its key, growing in in the table's order. */
93
+ export declare const blockItems: (field: TreemapField) => MotionItem[];
94
+ /**
95
+ * The blocks `at` the shares between `from` and `to`, which the chart draws
96
+ * while its readings move. **A block both tables hold moves** to its new
97
+ * part of the floor and its new height. **A block only `to` holds grows**:
98
+ * from the floor while the chart grows in, and in a later table from the
99
+ * middle of its part of the floor as well, while its neighbors make room.
100
+ * **A block only `from` held shrinks** to the middle of its part and to the
101
+ * floor, after `to`'s blocks, and goes. The height's axis moves with
102
+ * `at.axes`. With no `from`, every block rises from the floor where it
103
+ * stands.
104
+ */
105
+ export declare const blocksBetween: (from: TreemapField | undefined, to: TreemapField, at: MotionShares) => TreemapField;
75
106
  /** A block as the chart's own drawing paints it. */
76
107
  export interface DrawnBlock {
77
108
  /** Its eight corners on the page, which a drawing with no box is framed around. */
@@ -1,4 +1,4 @@
1
- import { solid, ticks } from '@fusion.dev/helix-core';
1
+ import { keysOf, mix, mixAxis, 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;
@@ -122,12 +122,82 @@ export const treemapOf = (rows, columns, groupBy = '') => {
122
122
  size: nameOf(sizeAt),
123
123
  };
124
124
  };
125
+ export const blockKeys = (field) => {
126
+ const keys = keysOf(field.blocks.map((block) => block.label));
127
+ return field.blocks.map((block, index) => block.key ?? keys[index]);
128
+ };
129
+ export const blockItems = (field) => blockKeys(field).map((key, step) => ({ key, step }));
130
+ const mixArea = (from, to, share) => ({
131
+ x0: mix(from.x0, to.x0, share),
132
+ x1: mix(from.x1, to.x1, share),
133
+ z0: mix(from.z0, to.z0, share),
134
+ z1: mix(from.z1, to.z1, share),
135
+ });
136
+ const middleOf = (area) => {
137
+ const [x, z] = [(area.x0 + area.x1) / 2, (area.z0 + area.z1) / 2];
138
+ return { x0: x, x1: x, z0: z, z1: z };
139
+ };
140
+ export const blocksBetween = (from, to, at) => {
141
+ const before = new Map();
142
+ if (from) {
143
+ const had = blockKeys(from);
144
+ from.blocks.forEach((block, index) => {
145
+ before.set(had[index], block);
146
+ });
147
+ }
148
+ const keys = blockKeys(to);
149
+ const blocks = to.blocks.map((block, index) => {
150
+ const key = keys[index];
151
+ const share = at.share(key);
152
+ const old = before.get(key);
153
+ if (!old || at.floor(key)) {
154
+ const start = old ? old.area : from ? middleOf(block.area) : block.area;
155
+ return { ...block, area: mixArea(start, block.area, share), grown: share, key };
156
+ }
157
+ const height = old.height !== undefined && block.height !== undefined
158
+ ? mix(old.height, block.height, share)
159
+ : block.height;
160
+ return {
161
+ ...block,
162
+ area: mixArea(old.area, block.area, share),
163
+ grown: mix(old.grown ?? 1, 1, share),
164
+ height,
165
+ key,
166
+ };
167
+ });
168
+ const kept = new Set(keys);
169
+ for (const [key, old] of before) {
170
+ const share = at.share(key);
171
+ if (!kept.has(key) && share < 1) {
172
+ blocks.push({
173
+ ...old,
174
+ area: mixArea(old.area, middleOf(old.area), share),
175
+ grown: (old.grown ?? 1) * (1 - share),
176
+ key,
177
+ });
178
+ }
179
+ }
180
+ if (!from || at.axes >= 1 || from.height !== to.height) {
181
+ return { ...to, blocks };
182
+ }
183
+ const [fx, fy, fz] = from.axes.extent;
184
+ const [tx, ty, tz] = to.axes.extent;
185
+ return {
186
+ ...to,
187
+ axes: {
188
+ ...to.axes,
189
+ extent: [mix(fx, tx, at.axes), mix(fy, ty, at.axes), mix(fz, tz, at.axes)],
190
+ y: mixAxis(from.axes.y, to.axes.y, at.axes),
191
+ },
192
+ blocks,
193
+ };
194
+ };
125
195
  export const blocksDrawn = (field, projection) => {
126
196
  const [ex, ey, ez] = field.axes.extent;
127
197
  const zero = inBox(field.axes.y, 0) * ey;
128
198
  const tall = field.height !== '';
129
199
  return field.blocks.map((block, index) => {
130
- const top = inBox(field.axes.y, tall ? (block.height ?? 0) : 1) * ey;
200
+ const top = inBox(field.axes.y, (tall ? (block.height ?? 0) : 1) * (block.grown ?? 1)) * ey;
131
201
  const base = Math.min(zero, top);
132
202
  const height = Math.abs(top - zero);
133
203
  const floor = {
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixElement } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, HelixElement, ReadingsMotionController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import '../../tooltip/index.js';
4
4
  import { type TreemapField } from '../blocks.js';
@@ -68,7 +68,7 @@ declare const HelixHeadlessSpatialTreemap_base: typeof HelixElement & (new (...a
68
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
69
  * @slot loading - Content shown while `loading` is set and there are no readings yet. Falls back to `loading-text`.
70
70
  *
71
- * @event {HelixPlotChangeEvent} helix-plot-change - The blocks or the block the keys rest on changed, which the renderer is told. It stays on the chart.
71
+ * @event {HelixPlotChangeEvent} helix-plot-change - The blocks or the block the keys rest on changed, or a frame of a move drew the blocks on their way, which the renderer is told. It stays on the chart.
72
72
  * @event {HelixPlotTurnEvent} helix-plot-turn - Shift with an arrow asked the view to turn, by a step across or up.
73
73
  * @event {HelixReadingChangeEvent} helix-reading-change - The reading moved, or was put away: `index` is the row, or `-1` for none, with its `label` and the `pointerType` that moved it.
74
74
  * @event {HelixReadingPressEvent} helix-reading-press - A block was clicked or pressed with Enter or Space, with the same detail as `helix-reading-change`.
@@ -110,6 +110,8 @@ declare const HelixHeadlessSpatialTreemap_base: typeof HelixElement & (new (...a
110
110
  * @csspart tooltip-surface-top - The bubble while it is above the reading. Set alongside `tooltip-surface`.
111
111
  * @csspart tooltip-value - A column's value inside the tooltip.
112
112
  *
113
+ * @cssproperty --spatial-treemap-move-duration - How long the blocks take to move to a new table's readings: a block the table keeps moves to its new part of the floor and its new height, a block it adds grows from the middle of its part, and a block it drops shrinks away. Unset, a new table is drawn at once. The growth under `grow` keeps its own timing.
114
+ * @cssproperty --spatial-treemap-move-easing - The curve the blocks move to new readings along.
113
115
  * @cssproperty --spatial-treemap-shade - How far a block'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.
114
116
  *
115
117
  * @cssstate active - While a block is shown, under the pointer or the keys.
@@ -126,6 +128,29 @@ export declare class HelixHeadlessSpatialTreemap extends HelixHeadlessSpatialTre
126
128
  static words: string;
127
129
  /** The column of text that gathers the rows into groups, by its heading. None by default. */
128
130
  groupBy: string;
131
+ /**
132
+ * Grows the blocks in from the floor the first time the chart comes
133
+ * into view with readings, one after another in the order of the table, so the drawing arrives the way a
134
+ * page's own picture does. The growth is fast at first, slows to rest,
135
+ * and never passes a reading.
136
+ *
137
+ * Under `prefers-reduced-motion`, or where the page has paused its motion
138
+ * through `pauseMotion` or `Motion Toggle`, the blocks stand at their
139
+ * readings from the start. A later table grows the blocks it adds, each
140
+ * from the floor, so a reading that arrives while the chart is in view
141
+ * arrives the same way. The blocks it keeps move to their new parts of the floor and their new heights on `--spatial-treemap-move-duration`, and stand there at once where it is unset.
142
+ */
143
+ grow: boolean;
144
+ /**
145
+ * Grows the blocks in again each time the chart comes back into view
146
+ * after it left it, as a pane does when it is opened again, where `grow`
147
+ * alone grows them the first time only. Only a chart that grows takes it.
148
+ *
149
+ * While it is out of view the blocks stand at the floor, so the first
150
+ * frame after it returns is the start of the growth and never a flash of
151
+ * the whole drawing.
152
+ */
153
+ growAgain: boolean;
129
154
  /**
130
155
  * Draws no box: no edges, grid, numbers, or names, so the readings stand
131
156
  * alone and fill the plot, as a picture on a product's own page does. The
@@ -154,6 +179,14 @@ export declare class HelixHeadlessSpatialTreemap extends HelixHeadlessSpatialTre
154
179
  private last;
155
180
  /** The block the keys rested on last, so a change of it can be told. */
156
181
  private told;
182
+ /**
183
+ * Moves the blocks from one table to the next, and grows them in under
184
+ * `grow`, timed by `--spatial-treemap-move-duration` and
185
+ * `--spatial-treemap-move-easing`.
186
+ */
187
+ protected readonly motion: ReadingsMotionController<TreemapField>;
188
+ /** The blocks drawn last, kept so a frame of their move can be told. */
189
+ private lastShown;
157
190
  /** Carries a host `aria-labelledby` and `aria-describedby` to the plot. */
158
191
  protected readonly aria: AriaForwardController;
159
192
  /**
@@ -178,7 +211,7 @@ export declare class HelixHeadlessSpatialTreemap extends HelixHeadlessSpatialTre
178
211
  * A touch keeps it until a tap lands elsewhere, and a mouse leaving a
179
212
  * reading the keys moved to leaves it. Called by the connector.
180
213
  */
181
- requestActive(index: number, kind?: 'mouse' | 'pen' | 'touch'): void;
214
+ requestActive(at: number, kind?: 'mouse' | 'pen' | 'touch'): void;
182
215
  /**
183
216
  * Says where the renderer draws the reading, as fractions of the plot from
184
217
  * its top left, or `undefined` while it draws none. The tooltip points
@@ -188,6 +221,15 @@ export declare class HelixHeadlessSpatialTreemap extends HelixHeadlessSpatialTre
188
221
  x: number;
189
222
  y: number;
190
223
  } | undefined): void;
224
+ /**
225
+ * The blocks as drawn this frame, which a renderer draws: `field` at rest,
226
+ * and while the readings move, every block between its last place and its
227
+ * new one, in `field`'s order, then each block the last table had and the
228
+ * new one does not, shrinking away.
229
+ */
230
+ get shown(): TreemapField;
231
+ /** Decided before the table is drawn, so a block that grows never shows at its height first. */
232
+ protected willUpdate(changed: PropertyValues<this>): void;
191
233
  connectedCallback(): void;
192
234
  protected updated(changed: PropertyValues): void;
193
235
  /**
@@ -1,10 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, spokenReading, words, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, CHART_PLOT, customElement, drawTooltip, formatWords, HelixElement, HelixPlotChangeEvent, HelixPlotTurnEvent, HelixReadingChangeEvent, HelixReadingPressEvent, isRtl, MixinChartSource, MixinChartStatus, ReadingsMotionController, 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';
6
6
  import { boundsOf, boxView, DragTurn, drawBox, PlotRoomWatch, SPATIAL_VIEW, turned, wordsFitted, } from '../../spatial-scatter-chart/view.js';
7
- import { blocksDrawn, paintOrder, treemapOf, } from '../blocks.js';
7
+ import { blockItems, blocksBetween, blocksDrawn, paintOrder, treemapOf, } from '../blocks.js';
8
8
  const TURNS = {
9
9
  ArrowDown: { across: 0, up: -1 },
10
10
  ArrowLeft: { across: -1, up: 0 },
@@ -16,6 +16,8 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
16
16
  constructor() {
17
17
  super(...arguments);
18
18
  this.groupBy = '';
19
+ this.grow = false;
20
+ this.growAgain = false;
19
21
  this.noBox = false;
20
22
  this.plotLabel = '3D treemap';
21
23
  this.summaryLabel = '{count, plural, one {# item} other {# items}} in {groups, plural, one {# group} other {# groups}}, sized from {low} to {high}.';
@@ -26,6 +28,19 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
26
28
  this.camera = next(this.camera);
27
29
  }, () => this.requestUpdate());
28
30
  this.told = -1;
31
+ this.motion = new ReadingsMotionController(this, {
32
+ between: blocksBetween,
33
+ grow: () => this.grow,
34
+ growAgain: () => this.growAgain,
35
+ items: blockItems,
36
+ timing: () => {
37
+ const style = getComputedStyle(this);
38
+ return {
39
+ duration: style.getPropertyValue('--spatial-treemap-move-duration'),
40
+ easing: style.getPropertyValue('--spatial-treemap-move-easing'),
41
+ };
42
+ },
43
+ });
29
44
  this.aria = new AriaForwardController(this, {
30
45
  target: () => this.partNamed('plot'),
31
46
  });
@@ -94,7 +109,8 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
94
109
  this.rendered = on;
95
110
  this.toggleState('drawn', on);
96
111
  }
97
- requestActive(index, kind = 'mouse') {
112
+ requestActive(at, kind = 'mouse') {
113
+ const index = at < this.field.blocks.length ? at : -1;
98
114
  if (kind === 'touch') {
99
115
  this.pointer.tapTo(index);
100
116
  }
@@ -105,6 +121,14 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
105
121
  placeReading(at) {
106
122
  this.place = at;
107
123
  }
124
+ get shown() {
125
+ return this.motion.drawn ?? this.field;
126
+ }
127
+ willUpdate(changed) {
128
+ super.willUpdate(changed);
129
+ const field = this.field;
130
+ this.motion.follow(field, field.blocks.length > 0);
131
+ }
108
132
  connectedCallback() {
109
133
  super.connectedCallback();
110
134
  this.pointer.axis = 'none';
@@ -117,10 +141,16 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
117
141
  updated(changed) {
118
142
  super.updated(changed);
119
143
  const field = this.field;
144
+ const shown = this.shown;
120
145
  if (field !== this.last) {
121
146
  this.last = field;
147
+ this.lastShown = shown;
122
148
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'data' }));
123
149
  }
150
+ else if (shown !== this.lastShown) {
151
+ this.lastShown = shown;
152
+ this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'move' }));
153
+ }
124
154
  if (this.pointer.at !== this.told) {
125
155
  this.told = this.pointer.at;
126
156
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'focus' }));
@@ -157,10 +187,14 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
157
187
  }
158
188
  renderFallback(field, at) {
159
189
  const view = wordsFitted(this.plotRoom.room, (words) => boxView(field.axes, this.camera, [], this.noBox, words, wordsLocale(this)));
160
- const blocks = blocksDrawn(field, view.projection);
190
+ const drawn = this.motion.moving ? this.shown : field;
191
+ const moving = drawn === field
192
+ ? view
193
+ : boxView(drawn.axes, this.camera, [], this.noBox, view.words, wordsLocale(this));
194
+ const blocks = blocksDrawn(drawn, view.projection);
161
195
  const active = blocks[at];
162
196
  const bounds = this.drag.frame(this.noBox
163
- ? boundsOf(blocks.flatMap((block) => block.corners), 0.1)
197
+ ? boundsOf((drawn === field ? blocks : blocksDrawn(field, view.projection)).flatMap((block) => block.corners), 0.1)
164
198
  : view.bounds, view.on([0, 0, 0]));
165
199
  return html `<div aria-hidden="true" dir="ltr" ?hidden=${this.rendered} part="fallback">
166
200
  <svg
@@ -174,7 +208,7 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
174
208
  @pointerleave=${this.onDrawingLeave}
175
209
  @pointermove=${this.onDrawingMove}
176
210
  @pointerup=${this.onDrawingTap}
177
- >${this.noBox ? nothing : drawBox(view)}${paintOrder(view.projection, blocks).map((block) => svg `${this.renderBlock(field, block, at)}${block === active ? svg `<path d=${active.drawn.outline} part="ring"></path>` : nothing}`)}${active
211
+ >${this.noBox ? nothing : drawBox(moving)}${paintOrder(view.projection, blocks).map((block) => svg `${this.renderBlock(drawn, block, at)}${block === active ? svg `<path d=${active.drawn.outline} part="ring"></path>` : nothing}`)}${active
178
212
  ? svg `<path d=${active.drawn.outline} part="ring-behind"></path><foreignObject height="0.001" overflow="visible" width="0.001" x=${active.drawn.peak.x} y=${active.drawn.peak.y}>${this.renderOwnTooltip(field.blocks[at]?.row)}</foreignObject>`
179
213
  : nothing}</svg>
180
214
  </div>`;
@@ -224,6 +258,12 @@ let HelixHeadlessSpatialTreemap = class HelixHeadlessSpatialTreemap extends Mixi
224
258
  __decorate([
225
259
  property({ attribute: 'group-by' })
226
260
  ], HelixHeadlessSpatialTreemap.prototype, "groupBy", void 0);
261
+ __decorate([
262
+ property({ reflect: true, type: Boolean })
263
+ ], HelixHeadlessSpatialTreemap.prototype, "grow", void 0);
264
+ __decorate([
265
+ property({ attribute: 'grow-again', reflect: true, type: Boolean })
266
+ ], HelixHeadlessSpatialTreemap.prototype, "growAgain", void 0);
227
267
  __decorate([
228
268
  property({ attribute: 'no-box', reflect: true, type: Boolean })
229
269
  ], HelixHeadlessSpatialTreemap.prototype, "noBox", void 0);
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixElement, HoverMarkController, KeyboardNavigationController } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, FocusMarkController, HelixElement, HoverMarkController, KeyboardNavigationController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  declare const HelixHeadlessTabs_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerActiveInterface) & typeof HelixElement;
4
4
  /**
@@ -85,6 +85,7 @@ declare const HelixHeadlessTabs_base: (new (...args: any[]) => import("@fusion.d
85
85
  * @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the active tab changes, and cancelable. Canceling it is the only way to block a change.
86
86
  * @event {HelixBeforeSelectEvent} helix-before-select - Fired when a tab is chosen. The tab sends it and the root handles it, so you can listen on the root. Cancelable: canceling it stops the change and leaves the decision to you.
87
87
  *
88
+ * @csspart focus - The focus ring, which travels from tab to tab as the arrow keys move focus along the strip. It carries the place and size of the control with focus as the indicator does, its corners, outline width, and offset, `data-placed` while focus shows on one, and `data-gliding` from the frame after it arrives. Hidden until a stylesheet shows it.
88
89
  * @csspart highlight - The wash under the pointer, which glides from tab to tab while a mouse or pen moves along them. It carries the tab's place and size as the indicator does, `data-placed` while it is over one, and `data-gliding` from the frame after it arrives. Hidden until a stylesheet shows it, so the headless tier lays out as it did without it.
89
90
  * @csspart indicator - The marker that moves to the selected tab. It carries the selected tab's
90
91
  * place and size as `--indicator-x`, `--indicator-y`, `--indicator-inline-size` and
@@ -97,6 +98,7 @@ declare const HelixHeadlessTabs_base: (new (...args: any[]) => import("@fusion.d
97
98
  * @csspart scroll-start-mark - The glyph on that button, where none is slotted.
98
99
  * @csspart tabs - The tab list.
99
100
  *
101
+ * @cssstate focus-gliding - While the focus ring is on a tab, so it draws the ring in place of each tab's own.
100
102
  * @cssstate gliding - While a mouse or pen is over a tab, so the highlight draws the hover wash in place of each tab's own.
101
103
  */
102
104
  export declare class HelixHeadlessTabs extends HelixHeadlessTabs_base {
@@ -108,6 +110,8 @@ export declare class HelixHeadlessTabs extends HelixHeadlessTabs_base {
108
110
  static words: string;
109
111
  protected readonly keys: KeyboardNavigationController;
110
112
  private readonly indicator;
113
+ /** Moves the focus ring from tab to tab as the arrow keys move focus. */
114
+ protected readonly focusRing: FocusMarkController;
111
115
  /** Moves the hover wash to whichever tab is under the pointer. A disabled tab takes none. */
112
116
  protected readonly highlight: HoverMarkController;
113
117
  /** Carries a host `aria-label` and `aria-labelledby` to the tab list. */