@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 { 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 BarField } from '../bars.js';
@@ -73,7 +73,7 @@ declare const HelixHeadlessSpatialBarChart_base: typeof HelixElement & (new (...
73
73
  * @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
74
74
  * @slot loading - Content shown while `loading` is set and there are no readings yet. Falls back to `loading-text`.
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.
76
+ * @event {HelixPlotChangeEvent} helix-plot-change - The bars or the bar the keys rest on changed, or a frame of a move drew the bars on their way, which the renderer is told. It stays on the chart.
77
77
  * @event {HelixPlotTurnEvent} helix-plot-turn - Shift with an arrow asked the view to turn, by a step across or up.
78
78
  * @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.
79
79
  * @event {HelixReadingPressEvent} helix-reading-press - A bar was clicked or pressed with Enter or Space, with the same detail as `helix-reading-change`.
@@ -118,6 +118,8 @@ declare const HelixHeadlessSpatialBarChart_base: typeof HelixElement & (new (...
118
118
  * @csspart tooltip-value - A column's value inside the tooltip.
119
119
  * @csspart value - The value of a bar whose cell names a tone, written above it in the chart's own drawing.
120
120
  *
121
+ * @cssproperty --spatial-bar-chart-move-duration - How long the bars take to move to a new table's readings: a bar the table keeps rises or falls to its new value, a bar it adds grows from the floor, and a bar it drops shrinks to the floor. Unset, a new table is drawn at once. The growth under `grow` keeps its own timing.
122
+ * @cssproperty --spatial-bar-chart-move-easing - The curve the bars move to new readings along.
121
123
  * @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.
122
124
  * @cssproperty --spatial-bar-chart-tone-accent - The color of a bar whose cell says `data-tone="accent"`.
123
125
  * @cssproperty --spatial-bar-chart-tone-danger - The color of a bar whose cell says `data-tone="danger"`.
@@ -147,9 +149,10 @@ export declare class HelixHeadlessSpatialBarChart extends HelixHeadlessSpatialBa
147
149
  *
148
150
  * Under `prefers-reduced-motion`, or where the page has paused its motion
149
151
  * through `pauseMotion` or `Motion Toggle`, the bars stand at their height
150
- * from the start. A later table draws the bars it already had at their
151
- * height, and grows the bars it adds, each from the floor, so a reading that
152
- * arrives while the chart is in view arrives the same way.
152
+ * from the start. A later table grows the bars it adds, each from the
153
+ * floor, so a reading that arrives while the chart is in view arrives the
154
+ * same way. The bars it keeps move to their new values on
155
+ * `--spatial-bar-chart-move-duration`, and stand at once where it is unset.
153
156
  */
154
157
  grow: boolean;
155
158
  /**
@@ -249,25 +252,13 @@ export declare class HelixHeadlessSpatialBarChart extends HelixHeadlessSpatialBa
249
252
  /** Measures the box the chart's own drawing fills. */
250
253
  private sizes;
251
254
  /**
252
- * How far the bars have grown in: waiting to be seen, growing since a
253
- * moment, or `undefined` once they stand at their height. `grew` says the
254
- * first table has been drawn, so a later one is not grown again.
255
+ * Moves the bars from one table to the next, and grows them in under
256
+ * `grow`, timed by `--spatial-bar-chart-move-duration` and
257
+ * `--spatial-bar-chart-move-easing`.
255
258
  */
256
- private growth;
257
- private grew;
258
- /**
259
- * The bars a later table added, by category label, each growing from the
260
- * floor: when it started, and its place among the bars that came with it, so
261
- * several arriving together follow one another as the first table's do. A
262
- * bar leaves the map once it stands.
263
- */
264
- private readonly fresh;
265
- /** The categories of the table drawn last, so a later table's new ones are known. */
266
- private drawnLabels;
267
- /** Watches for the chart to leave the view, after which `grow-again` has it grow in once more. */
268
- private gone;
269
- /** Watches for the chart to come into view, which starts the bars growing. */
270
- private seen;
259
+ protected readonly motion: ReadingsMotionController<BarField>;
260
+ /** The bars drawn last, kept so a frame of their move can be told. */
261
+ private lastShown;
271
262
  /** Carries a host `aria-labelledby` and `aria-describedby` to the plot. */
272
263
  protected readonly aria: AriaForwardController;
273
264
  /**
@@ -277,6 +268,13 @@ export declare class HelixHeadlessSpatialBarChart extends HelixHeadlessSpatialBa
277
268
  get field(): BarField;
278
269
  /** The field last read, and the rows, columns, and series it was read from. */
279
270
  private memo;
271
+ /**
272
+ * The bars as drawn this frame, which a renderer draws: `field` at rest,
273
+ * and while the readings move, every cell between its last reading and
274
+ * its new one, in `field`'s order, then each cell the last table had and
275
+ * the new one does not, shrinking to the floor.
276
+ */
277
+ get shown(): BarField;
280
278
  /** The bar the keys or the pointer rest on, as its place in `field.cells`, or `-1`. */
281
279
  get active(): number;
282
280
  /** The number of places on the grid, which the keys walk. */
@@ -292,7 +290,7 @@ export declare class HelixHeadlessSpatialBarChart extends HelixHeadlessSpatialBa
292
290
  * A touch keeps it until a tap lands elsewhere, and a mouse leaving a
293
291
  * reading the keys moved to leaves it. Called by the connector.
294
292
  */
295
- requestActive(index: number, kind?: 'mouse' | 'pen' | 'touch'): void;
293
+ requestActive(at: number, kind?: 'mouse' | 'pen' | 'touch'): void;
296
294
  /**
297
295
  * Says where the renderer draws the reading, as fractions of the plot from
298
296
  * its top left, or `undefined` while it draws none. The tooltip points
@@ -309,8 +307,6 @@ export declare class HelixHeadlessSpatialBarChart extends HelixHeadlessSpatialBa
309
307
  * the server calls this one.
310
308
  */
311
309
  protected willUpdate(changed: PropertyValues<this>): void;
312
- /** Draws each frame until the bars a later table added stand. */
313
- private followFresh;
314
310
  disconnectedCallback(): void;
315
311
  /** The element the size observer watches, so a drawing drawn again is watched again. */
316
312
  private measured;
@@ -331,14 +327,6 @@ export declare class HelixHeadlessSpatialBarChart extends HelixHeadlessSpatialBa
331
327
  * the row is too long for the plot, its bars narrow until it fits.
332
328
  */
333
329
  private sized;
334
- /** Starts the bars growing once the chart comes into view, and draws each frame until they stand. */
335
- private watchGrowth;
336
- /**
337
- * Under `grow-again`, waits for the chart to leave the view, then puts the
338
- * bars back at the floor and waits to be seen, so growing again starts from
339
- * the same place the first time did.
340
- */
341
- private watchExit;
342
330
  connectedCallback(): void;
343
331
  protected updated(changed: PropertyValues): void;
344
332
  /**
@@ -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, motionPaused, reducedMotion, shortNumber, 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, 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';
6
6
  import { boundsOf, boxView, DragTurn, drawBox, SPATIAL_VIEW, TICK_SIZE, turned, wordsFitted, } from '../../spatial-scatter-chart/view.js';
7
- import { barsDrawn, barsOf, climbing, floorOf, grownAt, growTime, heightened, namesOf, paintOrder, rowFits, tallestTimes, widthOf, } from '../bars.js';
7
+ import { barItems, barsBetween, barsDrawn, barsOf, climbing, floorOf, heightened, namesOf, paintOrder, rowFits, tallestTimes, widthOf, } from '../bars.js';
8
8
  const barSizeOf = (style) => {
9
9
  const size = Number.parseFloat(style.columnGap);
10
10
  return Number.isFinite(size) && size > 0 ? size : undefined;
@@ -19,6 +19,12 @@ const TURNS = {
19
19
  };
20
20
  const SERIES = 24;
21
21
  const toned = (tone) => tone && /^[a-z][a-z0-9-]*$/.test(tone) ? tone : undefined;
22
+ const scaledAs = (shown, read, sized) => sized === read
23
+ ? shown
24
+ : {
25
+ ...heightened(shown, sized.axes.extent[1] / read.axes.extent[1]),
26
+ ...(sized.climb === undefined ? {} : { climb: sized.climb }),
27
+ };
22
28
  const around = (frame, points) => {
23
29
  const xs = [frame.x, frame.x + frame.width, ...points.map((point) => point.x)];
24
30
  const ys = [frame.y, frame.y + frame.height, ...points.map((point) => point.y)];
@@ -41,8 +47,19 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
41
47
  this.camera = next(this.camera);
42
48
  }, () => this.requestUpdate());
43
49
  this.told = -1;
44
- this.grew = false;
45
- this.fresh = new Map();
50
+ this.motion = new ReadingsMotionController(this, {
51
+ between: barsBetween,
52
+ grow: () => this.grow,
53
+ growAgain: () => this.growAgain,
54
+ items: barItems,
55
+ timing: () => {
56
+ const style = getComputedStyle(this);
57
+ return {
58
+ duration: style.getPropertyValue('--spatial-bar-chart-move-duration'),
59
+ easing: style.getPropertyValue('--spatial-bar-chart-move-easing'),
60
+ };
61
+ },
62
+ });
46
63
  this.aria = new AriaForwardController(this, {
47
64
  target: () => this.partNamed('plot'),
48
65
  });
@@ -100,6 +117,9 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
100
117
  }
101
118
  return this.memo.field;
102
119
  }
120
+ get shown() {
121
+ return this.motion.drawn ?? this.field;
122
+ }
103
123
  get active() {
104
124
  return this.pointer.at;
105
125
  }
@@ -110,7 +130,8 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
110
130
  this.rendered = on;
111
131
  this.toggleState('drawn', on);
112
132
  }
113
- requestActive(index, kind = 'mouse') {
133
+ requestActive(at, kind = 'mouse') {
134
+ const index = at < this.field.cells.length ? at : -1;
114
135
  if (kind === 'touch') {
115
136
  this.pointer.tapTo(index);
116
137
  }
@@ -125,53 +146,13 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
125
146
  super.willUpdate(changed);
126
147
  const field = this.field;
127
148
  this.pointer.grid = Math.max(1, field.series.length);
128
- const labels = new Set(field.categories);
129
- const moves = typeof IntersectionObserver === 'function' &&
130
- typeof requestAnimationFrame === 'function' &&
131
- !reducedMotion() &&
132
- !motionPaused();
133
- if (this.grow && !this.grew && field.readings > 0) {
134
- this.grew = true;
135
- this.growth = moves ? {} : undefined;
136
- }
137
- else if (this.grow && this.grew && field.readings > 0 && this.drawnLabels && moves) {
138
- const added = [...labels].filter((label) => !this.drawnLabels?.has(label));
139
- if (added.length > 0 && !this.growth) {
140
- const since = performance.now();
141
- added.forEach((label, index) => {
142
- this.fresh.set(label, { count: added.length, index, since });
143
- });
144
- this.followFresh();
145
- }
146
- }
147
- if (field.readings > 0) {
148
- this.drawnLabels = labels;
149
- }
150
- }
151
- followFresh() {
152
- const frame = () => {
153
- const now = performance.now();
154
- for (const [label, one] of this.fresh) {
155
- if (now - one.since >= growTime(one.count)) {
156
- this.fresh.delete(label);
157
- }
158
- }
159
- this.requestUpdate();
160
- if (this.fresh.size > 0) {
161
- requestAnimationFrame(frame);
162
- }
163
- };
164
- requestAnimationFrame(frame);
149
+ this.motion.follow(field, field.readings > 0);
165
150
  }
166
151
  disconnectedCallback() {
167
152
  super.disconnectedCallback();
168
153
  this.sizes?.disconnect();
169
154
  this.sizes = undefined;
170
155
  this.measured = undefined;
171
- this.seen?.disconnect();
172
- this.seen = undefined;
173
- this.gone?.disconnect();
174
- this.gone = undefined;
175
156
  }
176
157
  measure() {
177
158
  const box = this.partNamed('fallback');
@@ -225,55 +206,10 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
225
206
  const times = Math.min(fills, tallestTimes(field, projection, barsDrawn(field, projection, layout)));
226
207
  return { field: heightened(field, times), unit };
227
208
  }
228
- watchGrowth() {
229
- if (!this.growth || this.growth.since !== undefined || this.seen) {
230
- return;
231
- }
232
- this.seen = new IntersectionObserver(([entry]) => {
233
- if (!entry?.isIntersecting || !this.growth) {
234
- return;
235
- }
236
- this.seen?.disconnect();
237
- this.seen = undefined;
238
- const since = performance.now();
239
- this.growth = { since };
240
- const length = growTime(this.field.categories.length);
241
- const frame = () => {
242
- if (this.growth?.since !== since) {
243
- return;
244
- }
245
- if (performance.now() - since >= length) {
246
- this.growth = undefined;
247
- this.watchExit();
248
- return;
249
- }
250
- this.requestUpdate();
251
- requestAnimationFrame(frame);
252
- };
253
- requestAnimationFrame(frame);
254
- }, { threshold: 0.4 });
255
- this.seen.observe(this);
256
- }
257
- watchExit() {
258
- if (!this.growAgain || this.gone) {
259
- return;
260
- }
261
- this.gone = new IntersectionObserver(([entry]) => {
262
- if (!entry || entry.isIntersecting) {
263
- return;
264
- }
265
- this.gone?.disconnect();
266
- this.gone = undefined;
267
- this.fresh.clear();
268
- this.growth = {};
269
- });
270
- this.gone.observe(this);
271
- }
272
209
  connectedCallback() {
273
210
  super.connectedCallback();
274
211
  if (this.hasUpdated) {
275
212
  this.measure();
276
- this.watchGrowth();
277
213
  }
278
214
  this.pointer.axis = 'none';
279
215
  this.pointer.onReading = (heard, detail) => {
@@ -289,12 +225,17 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
289
225
  updated(changed) {
290
226
  super.updated(changed);
291
227
  this.measure();
292
- this.watchGrowth();
293
228
  const field = this.field;
229
+ const shown = this.shown;
294
230
  if (field !== this.last) {
295
231
  this.last = field;
232
+ this.lastShown = shown;
296
233
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'data' }));
297
234
  }
235
+ else if (shown !== this.lastShown) {
236
+ this.lastShown = shown;
237
+ this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'move' }));
238
+ }
298
239
  if (this.pointer.at !== this.told) {
299
240
  this.told = this.pointer.at;
300
241
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'focus' }));
@@ -339,19 +280,11 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
339
280
  const sized = lined && room?.bar ? this.sized(read, view.projection, lined, room) : undefined;
340
281
  const field = sized?.field ?? read;
341
282
  const full = barsDrawn(field, view.projection, layout);
342
- const growth = this.growth;
343
- const since = growth?.since;
344
- const elapsed = since === undefined ? 0 : performance.now() - since;
345
- const categories = field.categories.length;
346
- const now = performance.now();
347
- const bars = growth
348
- ? barsDrawn(field, view.projection, layout, (one) => grownAt(one.across, categories, elapsed))
349
- : this.fresh.size > 0
350
- ? barsDrawn(field, view.projection, layout, (one) => {
351
- const added = this.fresh.get(one.label);
352
- return added ? grownAt(added.index, added.count, now - added.since) : 1;
353
- })
354
- : full;
283
+ const drawn = this.motion.moving ? scaledAs(this.shown, read, field) : field;
284
+ const moving = drawn === field
285
+ ? view
286
+ : boxView(drawn.axes, this.camera, [], bare, view.words, wordsLocale(this));
287
+ const bars = drawn === field ? full : barsDrawn(drawn, view.projection, layout);
355
288
  const floor = lined && !this.noBox ? floorOf(field, view.projection, lined) : [];
356
289
  const active = bars.find((bar) => bar.index === at);
357
290
  const cell = field.cells[at];
@@ -406,6 +339,10 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
406
339
  y: fits.y + (fits.height - high) / 2,
407
340
  }
408
341
  : fits;
342
+ const plates = drawn === field || floor.length === 0 || !lined
343
+ ? floor
344
+ : floorOf(drawn, view.projection, lined);
345
+ const written = plates === floor ? names : namesOf(drawn, plates, size);
409
346
  const bounds = this.drag.frame(placed, view.on([0, 0, 0]));
410
347
  const pixel = pixelOf(bounds);
411
348
  const font = Math.round(size * 10_000) / 10_000;
@@ -421,9 +358,9 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
421
358
  @pointerleave=${this.onDrawingLeave}
422
359
  @pointermove=${this.onDrawingMove}
423
360
  @pointerup=${this.onDrawingTap}
424
- >${bars.some((bar) => field.cells[bar.index]?.tone)
361
+ >${bars.some((bar) => drawn.cells[bar.index]?.tone)
425
362
  ? svg `<defs><filter height="160%" id="helix-spatial-bar-chart-glow" width="500%" x="-200%" y="-30%"><feGaussianBlur stdDeviation=${(pixel ?? 0.006) * 8}></feGaussianBlur></filter></defs>`
426
- : nothing}${bare ? nothing : drawBox(view)}${floor.map((plate) => svg `<path d=${plate.d} part="floor"></path>`)}${names.map((name) => svg `<text data-tone=${name.tone ?? nothing} dominant-baseline="central" font-size=${font} part="tick" style="${name.tone ? `--chart-series: var(--spatial-bar-chart-tone-${name.tone})` : ''}" text-anchor="middle" x=${shortNumber(name.x)} y=${shortNumber(name.y)}>${name.text}</text>`)}${paintOrder(view.projection, bars).map((bar) => svg `${field.cells[bar.index]?.tone ? svg `<path d=${bar.drawn.outline} fill="none" filter="url(#helix-spatial-bar-chart-glow)" part="glow" style="--chart-series: var(--spatial-bar-chart-tone-${field.cells[bar.index]?.tone})"></path>` : nothing}${this.renderBar(field, bar, at)}${bar === active ? svg `<path d=${active.drawn.outline} part="ring"></path>` : nothing}`)}${values.map((value) => {
363
+ : nothing}${bare ? nothing : drawBox(moving)}${plates.map((plate) => svg `<path d=${plate.d} part="floor"></path>`)}${written.map((name) => svg `<text data-tone=${name.tone ?? nothing} dominant-baseline="central" font-size=${font} part="tick" style="${name.tone ? `--chart-series: var(--spatial-bar-chart-tone-${name.tone})` : ''}" text-anchor="middle" x=${shortNumber(name.x)} y=${shortNumber(name.y)}>${name.text}</text>`)}${paintOrder(view.projection, bars).map((bar) => svg `${drawn.cells[bar.index]?.tone ? svg `<path d=${bar.drawn.outline} fill="none" filter="url(#helix-spatial-bar-chart-glow)" part="glow" style="--chart-series: var(--spatial-bar-chart-tone-${drawn.cells[bar.index]?.tone})"></path>` : nothing}${this.renderBar(drawn, bar, at)}${bar === active ? svg `<path d=${active.drawn.outline} part="ring"></path>` : nothing}`)}${values.map((value) => {
427
364
  const crown = bars.find((bar) => bar.index === value.index)?.drawn.crown ?? value.y + size;
428
365
  return svg `<text data-tone=${value.tone ?? nothing} dominant-baseline="central" font-size=${font} part="value" text-anchor="middle" x=${shortNumber(value.x)} y=${shortNumber(crown - size)}>${value.text}</text>`;
429
366
  })}${active
@@ -433,7 +370,8 @@ let HelixHeadlessSpatialBarChart = class HelixHeadlessSpatialBarChart extends Mi
433
370
  }
434
371
  renderBar(field, bar, at) {
435
372
  const one = field.cells[bar.index];
436
- const series = ((one?.depth ?? 0) % SERIES) + 1;
373
+ const wore = one?.wore && one.wore.share < 0.5 ? one.wore.depth : one?.depth;
374
+ const series = ((wore ?? 0) % SERIES) + 1;
437
375
  const short = (value) => Math.round(value * 1000) / 1000;
438
376
  return svg `<g data-index=${bar.index} data-tone=${one?.tone ?? nothing} part="bar${bar.index === at ? ' bar-active' : ''}" style="--chart-series: ${one?.tone ? `var(--spatial-bar-chart-tone-${one.tone}, var(--chart-series-${series}))` : `var(--chart-series-${series})`}">${bar.drawn.faces.map((face) => svg `<path d=${face.d} part="face" style="--spatial-bar-chart-shade: ${short(face.darken)}"></path>`)}</g>`;
439
377
  }
@@ -522,9 +460,6 @@ __decorate([
522
460
  __decorate([
523
461
  state()
524
462
  ], HelixHeadlessSpatialBarChart.prototype, "room", void 0);
525
- __decorate([
526
- state()
527
- ], HelixHeadlessSpatialBarChart.prototype, "growth", void 0);
528
463
  HelixHeadlessSpatialBarChart = __decorate([
529
464
  customElement('helix-headless-spatial-bar-chart')
530
465
  ], HelixHeadlessSpatialBarChart);
@@ -95,7 +95,7 @@ type DrawnCorners = {
95
95
  *
96
96
  * @slot renderer - The renderer's box, which a 3D drawing is made in, over the chart's own.
97
97
  *
98
- * @event {HelixPlotChangeEvent} helix-plot-change - The readings drawn or the reading the keys rest on changed, which a renderer is told. It stays on the chart.
98
+ * @event {HelixPlotChangeEvent} helix-plot-change - The readings drawn or the reading the keys rest on changed, or a frame of a move drew the readings on their way, which a renderer is told. It stays on the chart.
99
99
  * @event {HelixPlotTurnEvent} helix-plot-turn - Shift with an arrow asked a renderer's view to turn, by a step across or up.
100
100
  *
101
101
  * @csspart base - The slab the prisms stand on: a group holding its top and its two sides. Hidden from screen readers.
@@ -113,6 +113,8 @@ type DrawnCorners = {
113
113
  *
114
114
  * @cssproperty --spatial-heatmap-label-x - Where the `start` or the `end` label stands clear of the drawing, from the footer's inline start, in pixels. The component measures it and writes it on the label, with `data-placed`, as the view turns.
115
115
  * @cssproperty --spatial-heatmap-label-y - Where the `start` or the `end` label stands clear of the drawing, from the footer's top, in pixels. The component measures it and writes it on the label, with `data-placed`, as the view turns.
116
+ * @cssproperty --spatial-heatmap-move-duration - How long the prisms take to move to a new table's readings: a cell the table keeps rises or falls to its new height, its tone following it through the tones between, and the heights of all of them follow the table's new highest reading. Unset, a new table is drawn at once. The growth under `grow` keeps its own timing.
117
+ * @cssproperty --spatial-heatmap-move-easing - The curve the prisms move to new readings along.
116
118
  * @cssproperty --spatial-heatmap-span - How many cells the drawing spans across: its columns and its rows together. The component writes it on the strip, and a stylesheet that caps the cell size reads it.
117
119
  *
118
120
  * @cssstate drawn - While a renderer has drawn the relief, and the chart's own drawing stays unseen under it.
@@ -134,7 +136,7 @@ export declare class HelixHeadlessSpatialHeatmap extends HelixHeadlessHeatmap {
134
136
  */
135
137
  relief: number;
136
138
  /** The prisms drawn on the last render, which the tooltip is placed against. */
137
- private shown;
139
+ private drawnPrisms;
138
140
  /** Where the chart's own drawing is seen from, which a drag or Shift with an arrow turns. */
139
141
  private camera;
140
142
  /** What places the first and last labels again when one of them, or the footer, changes size. */
@@ -163,8 +165,10 @@ export declare class HelixHeadlessSpatialHeatmap extends HelixHeadlessHeatmap {
163
165
  private place;
164
166
  /** Where the renderer draws the two ends of the front edge, which the first and last labels stand at. */
165
167
  private corners;
166
- /** The field last told, and the reading, so a renderer is told of a change only. */
168
+ /** The field last told, the frame of a move, and the reading, so a renderer is told of a change only. */
167
169
  private told;
170
+ /** `field`, built again only when the readings or what draws them change, so a change is told by identity. */
171
+ private plotted;
168
172
  /**
169
173
  * What a renderer draws: every reading drawn, down each column and then
170
174
  * across, with its place on the grid, its height in cells, and its tone.
@@ -180,6 +184,14 @@ export declare class HelixHeadlessSpatialHeatmap extends HelixHeadlessHeatmap {
180
184
  columns: number;
181
185
  rows: number;
182
186
  };
187
+ /**
188
+ * The relief as drawn this frame, which a renderer draws: `field` at rest,
189
+ * and while the readings grow or move, each prism at its height on the way,
190
+ * in the tone of its reading on the way.
191
+ */
192
+ get shown(): HelixHeadlessSpatialHeatmap['field'];
193
+ /** The readings as a renderer draws them: each with its place on the grid, its height in cells, and its tone. */
194
+ private plotOf;
183
195
  /** The reading the pointer or the keys rest on, as its place in `field.cells`, or `-1`. */
184
196
  get active(): number;
185
197
  /**
@@ -226,7 +238,18 @@ export declare class HelixHeadlessSpatialHeatmap extends HelixHeadlessHeatmap {
226
238
  * left of its first column.
227
239
  */
228
240
  protected get room(): number;
229
- /** The drawn readings as prisms, standing against the highest reading in the table. */
241
+ /**
242
+ * How long a prism takes to rise or fall to a new reading, and its curve:
243
+ * `--spatial-heatmap-move-duration` and `--spatial-heatmap-move-easing`.
244
+ */
245
+ protected moveTiming(): {
246
+ duration: string;
247
+ easing: string;
248
+ };
249
+ /**
250
+ * The drawn readings as prisms, standing against the highest reading in the
251
+ * table, each at its height on the way while the readings grow or move.
252
+ */
230
253
  private drawnRelief;
231
254
  protected render(): TemplateResult;
232
255
  /**
@@ -6,7 +6,7 @@ import '../../tooltip/index.js';
6
6
  import { fits, toneOf } from '../../heatmap/root/buckets.js';
7
7
  import { HelixHeadlessHeatmap } from '../../heatmap/root/heatmap-root.js';
8
8
  import { DragTurn, turned } from '../../spatial-scatter-chart/view.js';
9
- import { ACROSS, heightsOf, highestOf, labelPlaces, reliefOf, } from '../projection.js';
9
+ import { ACROSS, heightsOf, labelPlaces, reliefOf, } from '../projection.js';
10
10
  const LABEL_GAP = 4;
11
11
  const TURNS = {
12
12
  ArrowDown: { across: 0, up: -1 },
@@ -19,7 +19,7 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
19
19
  super(...arguments);
20
20
  this.flat = false;
21
21
  this.relief = 2;
22
- this.shown = undefined;
22
+ this.drawnPrisms = undefined;
23
23
  this.camera = ISOMETRIC;
24
24
  this.labelSizes = undefined;
25
25
  this.drag = new DragTurn((next) => {
@@ -45,7 +45,11 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
45
45
  }
46
46
  };
47
47
  this.rendered = false;
48
- this.told = { at: -1, field: '' };
48
+ this.told = {
49
+ at: -1,
50
+ field: undefined,
51
+ frame: undefined,
52
+ };
49
53
  this.onTurnKeydown = (event) => {
50
54
  const turn = TURNS[event.key];
51
55
  if (!event.shiftKey ||
@@ -89,12 +93,33 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
89
93
  }
90
94
  }
91
95
  get field() {
92
- const cells = this.drawn;
96
+ const [heat, flat, relief, thresholds, tones] = [
97
+ this.heatField,
98
+ this.flat,
99
+ this.relief,
100
+ this.thresholds,
101
+ this.tones,
102
+ ];
103
+ const memo = this.plotted;
104
+ if (memo?.heat !== heat ||
105
+ memo.flat !== flat ||
106
+ memo.relief !== relief ||
107
+ memo.thresholds !== thresholds ||
108
+ memo.tones !== tones) {
109
+ this.plotted = { field: this.plotOf(heat), flat, heat, relief, thresholds, tones };
110
+ }
111
+ return this.plotted.field;
112
+ }
113
+ get shown() {
114
+ return this.motion.moving ? this.plotOf(this.movingField) : this.field;
115
+ }
116
+ plotOf(heat) {
117
+ const cells = heat.cells;
93
118
  const rows = this.rowCount;
94
119
  const bounds = writtenNumbers(this.thresholds);
95
120
  const palette = writtenList(this.tones);
96
121
  const tallest = this.flat ? 0 : Math.max(0, this.relief || 0);
97
- const heights = heightsOf(cells.map((point) => point.value), highestOf(this.points.map((point) => point.value)), tallest);
122
+ const heights = heightsOf(cells.map((point) => point.value), heat.highest, tallest);
98
123
  const first = this.points.length - cells.length;
99
124
  return {
100
125
  cells: cells.map((cell, index) => ({
@@ -134,11 +159,17 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
134
159
  updated(changed) {
135
160
  super.updated(changed);
136
161
  this.placeLabels();
137
- const field = JSON.stringify(this.field);
162
+ const field = this.field;
163
+ const frame = this.motion.drawn;
138
164
  if (field !== this.told.field) {
139
165
  this.told.field = field;
166
+ this.told.frame = frame;
140
167
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'data' }));
141
168
  }
169
+ else if (frame !== this.told.frame) {
170
+ this.told.frame = frame;
171
+ this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'move' }));
172
+ }
142
173
  if (this.pointer.at !== this.told.at) {
143
174
  this.told.at = this.pointer.at;
144
175
  this.dispatchEvent(new HelixPlotChangeEvent({ kind: 'focus' }));
@@ -157,10 +188,17 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
157
188
  const across = width / ACROSS - this.rowCount * pitch - this.gapPx;
158
189
  return fits(this.points.length, Math.max(across, Number.MIN_VALUE), this.cellPx, this.gapPx, this.rowCount);
159
190
  }
191
+ moveTiming() {
192
+ const style = getComputedStyle(this);
193
+ return {
194
+ duration: style.getPropertyValue('--spatial-heatmap-move-duration'),
195
+ easing: style.getPropertyValue('--spatial-heatmap-move-easing'),
196
+ };
197
+ }
160
198
  drawnRelief() {
161
199
  const tallest = this.flat ? 0 : Math.max(0, this.relief || 0);
162
- const highest = highestOf(this.points.map((point) => point.value));
163
- const heights = heightsOf(this.drawn.map((point) => point.value), highest, tallest);
200
+ const moving = this.movingField;
201
+ const heights = heightsOf(moving.cells.map((point) => point.value), moving.highest, tallest);
164
202
  return reliefOf(heights, this.rowCount, this.cellPx / (this.cellPx + this.gapPx), this.camera);
165
203
  }
166
204
  render() {
@@ -173,9 +211,10 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
173
211
  const chosen = new Set(this.selectionMode ? commaList(this.value) : []);
174
212
  const fits = this.drawnRelief();
175
213
  const relief = { ...fits, box: this.drag.frame(fits.box, fits.middle) };
176
- this.shown = relief;
214
+ this.drawnPrisms = relief;
177
215
  const at = this.pointer.at;
178
- const prisms = relief.order.map((index) => this.renderPrism(relief.prisms[index], at === index, chosen.has(keys[index] ?? ''), grid, toneOf(cells[index] ?? { value: undefined }, bounds, palette)));
216
+ const moving = this.movingField.cells;
217
+ const prisms = relief.order.map((index) => this.renderPrism(relief.prisms[index], at === index, chosen.has(keys[index] ?? ''), grid, toneOf(moving[index] ?? cells[index] ?? { value: undefined }, bounds, palette)));
179
218
  const { box } = relief;
180
219
  const drawing = readable
181
220
  ? html `<svg
@@ -233,7 +272,7 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
233
272
  placeLabels() {
234
273
  const footer = this.partNamed('footer');
235
274
  const [end, start] = [this.partNamed('end'), this.partNamed('start')];
236
- const relief = this.shown;
275
+ const relief = this.drawnPrisms;
237
276
  if (!footer || !end || !start || !relief?.corners) {
238
277
  return;
239
278
  }
@@ -299,8 +338,8 @@ let HelixHeadlessSpatialHeatmap = class HelixHeadlessSpatialHeatmap extends Heli
299
338
  }
300
339
  renderTooltip(grid = false) {
301
340
  const at = this.pointer.at;
302
- const prism = this.shown?.prisms[at];
303
- const box = this.shown?.box;
341
+ const prism = this.drawnPrisms?.prisms[at];
342
+ const box = this.drawnPrisms?.box;
304
343
  const reading = grid ? undefined : this.pointer;
305
344
  if (this.rendered) {
306
345
  const place = this.place;
@@ -7,7 +7,7 @@
7
7
  * front, and a value read under the wrong column bends a ribbon where the
8
8
  * data never did.
9
9
  */
10
- import { type PagePoint, type Projection } from '@fusion.dev/helix-core';
10
+ import { type MotionShares, type PagePoint, type Projection } from '@fusion.dev/helix-core';
11
11
  import { type BarCell, type BarField } from '../spatial-bar-chart/bars.js';
12
12
  import type { FieldRow } from '../spatial-scatter-chart/field.js';
13
13
  /**
@@ -25,6 +25,15 @@ export type RibbonCell = BarCell;
25
25
  * a wall.
26
26
  */
27
27
  export declare const ribbonsOf: (rows: readonly FieldRow[], columns: readonly number[]) => RibbonField;
28
+ /**
29
+ * The ribbons `at` the shares between `from` and `to`, which the chart draws
30
+ * while its readings move, as a bar chart's bars move: **a reading both
31
+ * tables hold rises or falls** to its new value and slides to its new place,
32
+ * **a reading only `to` holds grows** from zero, and **a reading only `from`
33
+ * held sinks** to zero, then goes. A series the new table drops goes at once,
34
+ * since its ribbon would stand in another's depth.
35
+ */
36
+ export declare const ribbonsBetween: (from: RibbonField | undefined, to: RibbonField, at: MotionShares) => RibbonField;
28
37
  /** One face of a ribbon, as path data, and how far it turns from the light. */
29
38
  export interface RibbonFace {
30
39
  d: string;