@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
@@ -693,7 +693,7 @@ let HelixHeadlessEditor = class HelixHeadlessEditor extends HelixElement {
693
693
  data-fold="block"
694
694
  ?hidden=${this.allFolded(['block'])}
695
695
  exportparts="back: block-menu-back, back-mark: block-menu-back-mark, empty: block-menu-empty,
696
- header: block-menu-header, live: block-menu-live, loading: block-menu-loading,
696
+ header: block-menu-header, highlight: block-menu-highlight, live: block-menu-live, loading: block-menu-loading,
697
697
  search-field: block-menu-search-field, surface: block-menu-surface,
698
698
  title: block-menu-title"
699
699
  label=${this.blockLabel}
@@ -774,7 +774,7 @@ let HelixHeadlessEditor = class HelixHeadlessEditor extends HelixElement {
774
774
  const find = this.tag('find');
775
775
  return html `<${find}
776
776
  part="find"
777
- exportparts="actions: find-actions, bar: find-bar, close: find-close, close-button: find-close-button, close-live: find-close-live, close-spinner: find-close-spinner, close-text: find-close-text, controls: find-controls, controls-toolbar: find-controls-toolbar, count: find-count, field: find-field, live: find-live, match-case: find-match-case, match-case-button: find-match-case-button, match-case-live: find-match-case-live, match-case-pressed: find-match-case-pressed, match-case-spinner: find-match-case-spinner, match-case-text: find-match-case-text, next: find-next, next-button: find-next-button, next-live: find-next-live, next-spinner: find-next-spinner, next-text: find-next-text, previous: find-previous, previous-button: find-previous-button, previous-live: find-previous-live, previous-spinner: find-previous-spinner, previous-text: find-previous-text, regex: find-regex, regex-button: find-regex-button, regex-live: find-regex-live, regex-pressed: find-regex-pressed, regex-spinner: find-regex-spinner, regex-text: find-regex-text, replace: find-replace, replace-all: find-replace-all, replace-all-button: find-replace-all-button, replace-all-live: find-replace-all-live, replace-all-spinner: find-replace-all-spinner, replace-all-text: find-replace-all-text, replace-button: find-replace-button, replace-field: find-replace-field, replace-live: find-replace-live, replace-spinner: find-replace-spinner, replace-text: find-replace-text, replace-toggle: find-replace-toggle, replace-toggle-button: find-replace-toggle-button, replace-toggle-live: find-replace-toggle-live, replace-toggle-mark: find-replace-toggle-mark, replace-toggle-spinner: find-replace-toggle-spinner, replace-toggle-text: find-replace-toggle-text, whole-word: find-whole-word, whole-word-button: find-whole-word-button, whole-word-live: find-whole-word-live, whole-word-pressed: find-whole-word-pressed, whole-word-spinner: find-whole-word-spinner, whole-word-text: find-whole-word-text"
777
+ exportparts="actions: find-actions, bar: find-bar, close: find-close, close-button: find-close-button, close-live: find-close-live, close-spinner: find-close-spinner, close-text: find-close-text, controls: find-controls, controls-focus: find-controls-focus, controls-toolbar: find-controls-toolbar, count: find-count, field: find-field, live: find-live, match-case: find-match-case, match-case-button: find-match-case-button, match-case-live: find-match-case-live, match-case-pressed: find-match-case-pressed, match-case-spinner: find-match-case-spinner, match-case-text: find-match-case-text, next: find-next, next-button: find-next-button, next-live: find-next-live, next-spinner: find-next-spinner, next-text: find-next-text, previous: find-previous, previous-button: find-previous-button, previous-live: find-previous-live, previous-spinner: find-previous-spinner, previous-text: find-previous-text, regex: find-regex, regex-button: find-regex-button, regex-live: find-regex-live, regex-pressed: find-regex-pressed, regex-spinner: find-regex-spinner, regex-text: find-regex-text, replace: find-replace, replace-all: find-replace-all, replace-all-button: find-replace-all-button, replace-all-live: find-replace-all-live, replace-all-spinner: find-replace-all-spinner, replace-all-text: find-replace-all-text, replace-button: find-replace-button, replace-field: find-replace-field, replace-live: find-replace-live, replace-spinner: find-replace-spinner, replace-text: find-replace-text, replace-toggle: find-replace-toggle, replace-toggle-button: find-replace-toggle-button, replace-toggle-live: find-replace-toggle-live, replace-toggle-mark: find-replace-toggle-mark, replace-toggle-spinner: find-replace-toggle-spinner, replace-toggle-text: find-replace-toggle-text, whole-word: find-whole-word, whole-word-button: find-whole-word-button, whole-word-live: find-whole-word-live, whole-word-pressed: find-whole-word-pressed, whole-word-spinner: find-whole-word-spinner, whole-word-text: find-whole-word-text"
778
778
  label=${this.findLabel}
779
779
  ?readonly=${this.readOnly}
780
780
  shortcut=""
@@ -794,7 +794,7 @@ let HelixHeadlessEditor = class HelixHeadlessEditor extends HelixElement {
794
794
  const groups = this.readOnly
795
795
  ? []
796
796
  : BAR_GROUPS.map((tools, at) => ({ template: drawn[at], tools: this.drawnOf(tools) })).filter((group) => group.template !== nothing);
797
- return html `<${toolbar} part="controls" exportparts="toolbar: controls-toolbar" label=${this.controlsLabel} @keydown=${this.handleToolbarKeys}>
797
+ return html `<${toolbar} part="controls" exportparts="focus: controls-focus, toolbar: controls-toolbar" label=${this.controlsLabel} @keydown=${this.handleToolbarKeys}>
798
798
  ${groups.map((group, at) => at === 0 ? group.template : html `${this.renderDivider(group.tools)}${group.template}`)}
799
799
  ${this.renderOverflow()}
800
800
  <slot name="actions" part="actions" ?hidden=${!this.hasActions} @slotchange=${this.handleActions}></slot>
@@ -813,7 +813,7 @@ let HelixHeadlessEditor = class HelixHeadlessEditor extends HelixElement {
813
813
  return html `<${menu}
814
814
  part="overflow"
815
815
  exportparts="back: overflow-back, back-mark: overflow-back-mark, empty: overflow-empty,
816
- header: overflow-header, live: overflow-live, loading: overflow-loading,
816
+ header: overflow-header, highlight: overflow-highlight, live: overflow-live, loading: overflow-loading,
817
817
  search-field: overflow-search-field, surface: overflow-surface,
818
818
  title: overflow-title"
819
819
  label=${this.moreLabel}
@@ -908,7 +908,7 @@ let HelixHeadlessEditor = class HelixHeadlessEditor extends HelixElement {
908
908
  @input=${this.handleLinkInput}
909
909
  @keydown=${this.handleLinkKeys}
910
910
  />
911
- <${toolbar} part="link-controls" exportparts="toolbar: link-controls-toolbar" label=${this.linkControlsLabel}>
911
+ <${toolbar} part="link-controls" exportparts="focus: link-controls-focus, toolbar: link-controls-toolbar" label=${this.linkControlsLabel}>
912
912
  <${button}
913
913
  part="link-apply"
914
914
  exportparts="button: link-apply-button, live: link-apply-live, spinner: link-apply-spinner, text: link-apply-text"
@@ -86,6 +86,7 @@ import '../../menu/index.js';
86
86
  * @csspart menu-back-mark - The icon on the back button.
87
87
  * @csspart menu-empty - Shown when there are no fields to offer.
88
88
  * @csspart menu-header - The bar above a field's page, with the back button and the field's name.
89
+ * @csspart menu-highlight - Forwarded from the menu: the wash on the row with focus, which glides from row to row.
89
90
  * @csspart menu-live - The inner menu's `live` part: the region that screen readers announce the empty and loading messages from.
90
91
  * @csspart menu-loading - Shown while the fields are loading.
91
92
  * @csspart menu-search-field - The inner menu's filter field, drawn with `filterable`.
@@ -127,7 +127,7 @@ let HelixHeadlessFilterMenu = class HelixHeadlessFilterMenu extends HelixElement
127
127
  const item = this.tag('menu-item');
128
128
  return html `<${menu}
129
129
  part="menu"
130
- exportparts="back: menu-back, back-mark: menu-back-mark, empty: menu-empty, header: menu-header,
130
+ exportparts="back: menu-back, back-mark: menu-back-mark, empty: menu-empty, header: menu-header, highlight: menu-highlight,
131
131
  live: menu-live, loading: menu-loading, search-field: menu-search-field, surface: menu-surface, title: menu-title"
132
132
  label=${this.label || this.fallbackLabel}
133
133
  @helix-before-select=${this.handleSelect}
@@ -76,6 +76,7 @@ declare const HelixHeadlessFind_base: (new (...args: any[]) => import("@fusion.d
76
76
  * @csspart close-spinner - The ring the close button turns while it is pending.
77
77
  * @csspart close-text - The box the close button's icon sits in.
78
78
  * @csspart controls - The toolbar: the options, your actions, and the buttons that move between matches and close the bar.
79
+ * @csspart controls-focus - The focus ring that travels along the buttons of the toolbar as the arrow keys move focus.
79
80
  * @csspart controls-toolbar - The box inside the toolbar that lays its buttons out.
80
81
  * @csspart count - Which match is current and how many there are, such as "3 of 12 matches".
81
82
  * @csspart field - The search field.
@@ -386,7 +386,7 @@ let HelixHeadlessFind = class HelixHeadlessFind extends MixinControllerOpen(Heli
386
386
  const toolbar = this.tag('toolbar');
387
387
  const button = this.tag('icon-button');
388
388
  const searchable = this.readable && (this.result?.count ?? 0) > 0;
389
- return html `<${toolbar} part="controls" exportparts="toolbar: controls-toolbar" label=${this.controlsLabel}>
389
+ return html `<${toolbar} part="controls" exportparts="focus: controls-focus, toolbar: controls-toolbar" label=${this.controlsLabel}>
390
390
  ${this.renderOptionButtons()}
391
391
  <slot name="actions" part="actions"></slot>
392
392
  <${button}
@@ -7,6 +7,7 @@
7
7
  * calculation off by one drops a day silently. Neither is visible in a
8
8
  * screenshot of a strip.
9
9
  */
10
+ import { type MotionItem, type MotionShares } from '@fusion.dev/helix-core';
10
11
  /** A reading, reduced to what the bucketing needs. */
11
12
  export interface Reading {
12
13
  tone?: string | undefined;
@@ -78,3 +79,29 @@ export declare const overviewOf: (cells: readonly Reading[]) => Overview;
78
79
  * reading past the end. Undefined where the reading at `at` carries no date.
79
80
  */
80
81
  export declare const monthPage: (whens: readonly (string | undefined)[], at: number, forward: boolean) => number | undefined;
82
+ /** A reading as the strip's motion knows it: by its row's label, numbered where a label comes again. */
83
+ export interface HeatCell extends Reading {
84
+ key: string;
85
+ }
86
+ /**
87
+ * The readings a strip draws, as its motion moves them: each drawn cell by
88
+ * its key, how many cells stand in a column, and the highest reading in the
89
+ * table, which a spatial heatmap's heights are measured against.
90
+ */
91
+ export interface HeatField {
92
+ cells: HeatCell[];
93
+ highest: number;
94
+ rows: number;
95
+ }
96
+ /** Each cell as the strip's motion knows it: by its key, growing in a column at a time. */
97
+ export declare const heatItems: (field: HeatField) => MotionItem[];
98
+ /**
99
+ * The strip `at` the shares between `from` and `to`, which it draws while its
100
+ * readings move. **A cell both hold moves from its old reading to its new
101
+ * one**, and its tone follows the reading through the buckets between.
102
+ * **A cell only `to` holds grows from empty**: it has no tone until it starts,
103
+ * then its reading climbs from zero, or a cell's own `data-tone` shows at
104
+ * once. A cell `from` held and `to` does not is gone at once, since every
105
+ * cell after it has taken a step along the strip.
106
+ */
107
+ export declare const heatBetween: (from: HeatField | undefined, to: HeatField, at: MotionShares) => HeatField;
@@ -1,4 +1,4 @@
1
- import { extremesOf } from '@fusion.dev/helix-core';
1
+ import { extremesOf, mix } from '@fusion.dev/helix-core';
2
2
  export const toneOf = (reading, thresholds, tones) => {
3
3
  if (reading.tone) {
4
4
  return reading.tone;
@@ -58,3 +58,26 @@ export const monthPage = (whens, at, forward) => {
58
58
  }
59
59
  return forward ? whens.length - 1 : 0;
60
60
  };
61
+ export const heatItems = (field) => field.cells.map((cell, index) => ({
62
+ key: cell.key,
63
+ step: Math.floor(index / Math.max(1, field.rows)),
64
+ }));
65
+ export const heatBetween = (from, to, at) => {
66
+ const before = new Map((from?.cells ?? []).map((cell) => [cell.key, cell]));
67
+ const cells = to.cells.map((cell) => {
68
+ const share = at.share(cell.key);
69
+ const old = before.get(cell.key);
70
+ if (!old || at.floor(cell.key) || old.value === undefined) {
71
+ if (share <= 0) {
72
+ return { key: cell.key, value: undefined };
73
+ }
74
+ return { ...cell, value: cell.value === undefined ? undefined : cell.value * share };
75
+ }
76
+ return {
77
+ ...cell,
78
+ value: cell.value === undefined ? undefined : mix(old.value, cell.value, share),
79
+ };
80
+ });
81
+ const highest = from && at.axes < 1 ? mix(from.highest, to.highest, at.axes) : to.highest;
82
+ return { ...to, cells, highest };
83
+ };
@@ -1,7 +1,7 @@
1
- import { AriaForwardController, HelixElement, StatusController } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, HelixElement, ReadingsMotionController, StatusController } from '@fusion.dev/helix-core';
2
2
  import { nothing, type PropertyValues, type TemplateResult } from 'lit';
3
3
  import '../../tooltip/index.js';
4
- import { type Reading } from './buckets.js';
4
+ import { type HeatField, type Reading } from './buckets.js';
5
5
  declare const HelixHeadlessHeatmap_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartStatusInterface);
6
6
  /**
7
7
  * @summary A strip of cells, each colored by its reading, for uptime, contributions, or activity.
@@ -185,6 +185,30 @@ export declare class HelixHeadlessHeatmap extends HelixHeadlessHeatmap_base {
185
185
  * `min-cell` is.
186
186
  */
187
187
  gap: number;
188
+ /**
189
+ * Grows the cells in the first time the strip comes into view with
190
+ * readings, a column at a time from the first, so the drawing arrives the
191
+ * way a page's own picture does. Each cell starts empty and its reading
192
+ * climbs to its own, its tone stepping up through the tones between, fast
193
+ * at first and slow to rest. A cell's own `data-tone` shows as its column
194
+ * starts.
195
+ *
196
+ * Under `prefers-reduced-motion`, or where the page has paused its motion
197
+ * through `pauseMotion` or `Motion Toggle`, the cells take their tones from
198
+ * the start. A later table grows the cells it adds the same way, such as
199
+ * the newest day of a strip that keeps the latest.
200
+ */
201
+ grow: boolean;
202
+ /**
203
+ * Grows the cells in again each time the strip comes back into view after
204
+ * it left it, as a pane does when it is opened again, where `grow` alone
205
+ * grows them the first time only. Only a strip that grows takes it.
206
+ *
207
+ * While it is out of view the cells stand empty, so the first frame after
208
+ * it returns is the start of the growth and never a flash of the whole
209
+ * strip.
210
+ */
211
+ growAgain: boolean;
188
212
  /**
189
213
  * The smallest a cell may get before the strip draws fewer of them, in CSS pixels.
190
214
  *
@@ -336,6 +360,33 @@ export declare class HelixHeadlessHeatmap extends HelixHeadlessHeatmap_base {
336
360
  * image a reader lands on. The host is a generic around it.
337
361
  */
338
362
  protected readonly aria: AriaForwardController;
363
+ /** Grows the cells in under `grow`, and moves them to new readings on `moveTiming`. */
364
+ protected readonly motion: ReadingsMotionController<HeatField>;
365
+ /**
366
+ * How long a cell's reading takes to move to a new one, and its curve. The
367
+ * flat strip moves none: a cell changes tone through the stylesheet's own
368
+ * transition of its color. A spatial heatmap, whose prisms rise and fall,
369
+ * reads its own hooks.
370
+ */
371
+ protected moveTiming(): {
372
+ duration: string;
373
+ easing: string;
374
+ };
375
+ /**
376
+ * The readings drawn, read once for each table and each width, and which
377
+ * table they come from: a new width or row count lays the same table out
378
+ * anew, which is not a new reading.
379
+ */
380
+ private heatMemo;
381
+ /** The table the motion last followed, by `heatMemo`'s count. */
382
+ private followed;
383
+ /**
384
+ * The drawn readings as the strip's motion moves them: each by its row's
385
+ * label, newest kept, with the highest reading in the table.
386
+ */
387
+ protected get heatField(): HeatField;
388
+ /** The drawn readings as they stand this frame: on their way while they grow or move, and as the table holds them at rest. */
389
+ protected get movingField(): HeatField;
339
390
  private observer;
340
391
  private announced;
341
392
  /**
@@ -1,10 +1,10 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, byRow, CHART_PLOT, commaList, customElement, drawTooltip, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, HelixResizeEvent, MixinChartSource, MixinChartStatus, markRegion, numberConverter, pressedValue, rangeAdd, requestValue, StatusController, spokenReading, words, wordsLocale, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, byRow, CHART_PLOT, commaList, customElement, drawTooltip, formatWords, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, HelixResizeEvent, keysOf, MixinChartSource, MixinChartStatus, markRegion, numberConverter, pressedValue, ReadingsMotionController, rangeAdd, requestValue, StatusController, spokenReading, words, wordsLocale, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
3
3
  import { html, nothing } from 'lit';
4
4
  import { property, state } from 'lit/decorators.js';
5
5
  import '../../tooltip/index.js';
6
6
  import { inSequence, rectangleOf } from '../rectangle.js';
7
- import { fits, monthPage, overviewOf, toneOf } from './buckets.js';
7
+ import { fits, heatBetween, heatItems, monthPage, overviewOf, toneOf, } from './buckets.js';
8
8
  const dayOf = (when, locale) => {
9
9
  if (!when) {
10
10
  return undefined;
@@ -30,6 +30,8 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(M
30
30
  super(...arguments);
31
31
  this.busiestLabel = 'Busiest';
32
32
  this.gap = 2;
33
+ this.grow = false;
34
+ this.growAgain = false;
33
35
  this.minCell = 8;
34
36
  this.overviewLabel = '{busiestLabel}: {busiest}; {totalLabel} {total}.';
35
37
  this.rows = 1;
@@ -46,6 +48,14 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(M
46
48
  this.aria = new AriaForwardController(this, {
47
49
  target: () => this.partNamed('strip'),
48
50
  });
51
+ this.motion = new ReadingsMotionController(this, {
52
+ between: heatBetween,
53
+ grow: () => this.grow,
54
+ growAgain: () => this.growAgain,
55
+ items: heatItems,
56
+ timing: () => this.moveTiming(),
57
+ });
58
+ this.followed = -1;
49
59
  this.observer = undefined;
50
60
  this.announced = undefined;
51
61
  this.anchor = -1;
@@ -123,6 +133,36 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(M
123
133
  get visible() {
124
134
  return Math.min(this.points.length, this.room);
125
135
  }
136
+ moveTiming() {
137
+ return { duration: '', easing: '' };
138
+ }
139
+ get heatField() {
140
+ const [series, rows, room, tall] = [this.series, this.sourceRows, this.room, this.rowCount];
141
+ const memo = this.heatMemo;
142
+ if (memo?.series !== series || memo.rows !== rows || memo.room !== room || memo.tall !== tall) {
143
+ const points = this.points;
144
+ const first = Math.max(0, points.length - room);
145
+ const drawn = points.slice(first);
146
+ const keys = keysOf(drawn.map((_, index) => rows[first + index]?.label ?? ''));
147
+ const table = memo?.series === series && memo.rows === rows ? memo.table : (memo?.table ?? -1) + 1;
148
+ this.heatMemo = {
149
+ field: {
150
+ cells: drawn.map((point, index) => ({ ...point, key: keys[index] })),
151
+ highest: points.reduce((high, point) => (point.value !== undefined && point.value > high ? point.value : high), 0),
152
+ rows: tall,
153
+ },
154
+ room,
155
+ rows,
156
+ series,
157
+ table,
158
+ tall,
159
+ };
160
+ }
161
+ return this.heatMemo.field;
162
+ }
163
+ get movingField() {
164
+ return this.motion.drawn ?? this.heatField;
165
+ }
126
166
  keysOf(cells) {
127
167
  const offset = this.points.length - cells.length;
128
168
  const rows = this.sourceRows;
@@ -216,6 +256,15 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(M
216
256
  willUpdate(changed) {
217
257
  super.willUpdate(changed);
218
258
  this.pointer.grid = this.rowCount;
259
+ const field = this.heatField;
260
+ const table = this.heatMemo?.table ?? -1;
261
+ if (table === this.followed) {
262
+ this.motion.relayout(field, field.cells.length > 0);
263
+ }
264
+ else {
265
+ this.followed = table;
266
+ this.motion.follow(field, field.cells.length > 0);
267
+ }
219
268
  }
220
269
  pageFrom(at, forward) {
221
270
  const offset = this.points.length - this.drawn.length;
@@ -276,8 +325,9 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(M
276
325
  const grid = readable && this.selectionMode !== undefined;
277
326
  const keys = this.selectionMode ? this.keysOf(cells) : [];
278
327
  const chosen = new Set(this.selectionMode ? commaList(this.value) : []);
328
+ const moving = this.movingField.cells;
279
329
  const drawn = cells.map((reading, index) => {
280
- const tone = toneOf(reading, bounds, palette);
330
+ const tone = toneOf(moving[index] ?? reading, bounds, palette);
281
331
  const active = this.pointer.at === index;
282
332
  const picked = chosen.has(keys[index] ?? '');
283
333
  if (grid) {
@@ -390,6 +440,12 @@ __decorate([
390
440
  __decorate([
391
441
  property({ converter: numberConverter('gap', 2, 'pixels') })
392
442
  ], HelixHeadlessHeatmap.prototype, "gap", void 0);
443
+ __decorate([
444
+ property({ reflect: true, type: Boolean })
445
+ ], HelixHeadlessHeatmap.prototype, "grow", void 0);
446
+ __decorate([
447
+ property({ attribute: 'grow-again', reflect: true, type: Boolean })
448
+ ], HelixHeadlessHeatmap.prototype, "growAgain", void 0);
393
449
  __decorate([
394
450
  property({ attribute: 'min-cell', converter: numberConverter('min-cell', 8, 'pixels') })
395
451
  ], HelixHeadlessHeatmap.prototype, "minCell", void 0);
@@ -86,23 +86,28 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
86
86
  * @event {HelixReadingPressEvent} helix-reading-press - A reading was clicked, tapped, or pressed with Enter or Space, with the same detail as `helix-reading-change`.
87
87
  *
88
88
  * @csspart area - The wash under one line, where `area` is set.
89
+ * @csspart area-hidden - The `area` of a series a legend hid, kept where it was last drawn and hidden, so a stylesheet can fade it out. Set alongside `area`.
89
90
  * @csspart axis - The numbers of the scale beside the plot, unless `value-axis` is `none`.
90
- * @csspart band - The band around the reading under the pointer.
91
+ * @csspart band - The band around the reading under the pointer, moved to its slot with `translate`, so a stylesheet can glide it from one to the next.
91
92
  * @csspart baseline - The rule at zero, where zero is inside the range.
92
93
  * @csspart empty - The words in place of the drawing when the table has no readings: the `empty` slot, falling back to `empty-text`. Not drawn while the table cannot be read yet, on the server and during hydration.
93
94
  * @csspart error - The words in place of the drawing while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
94
95
  * @csspart gridline - One rule across the plot, unless `gridlines` is `none`.
95
- * @csspart guide - A rule down the reading a pointer is resting on.
96
+ * @csspart gridline-leaving - A rule at a level the scale no longer has, kept hidden at its place on the new scale, so a stylesheet can fade it out as it moves. Set alongside `gridline`.
97
+ * @csspart guide - A rule down the reading a pointer is resting on, moved to it with `translate`, so a stylesheet can glide it from one to the next.
96
98
  * @csspart label - One reading's name, placed along the row by `--chart-label-start` and `--chart-label-size` with its text centered. Only the names that fit are drawn, the first and the last always.
97
99
  * @csspart labels - The row of reading names, which the names share: lay it out as one grid cell they all stand in.
98
100
  * @csspart line - The line for one series.
99
101
  * @csspart line-dashed - A `line` whose series `dashed` names. Set alongside `line`.
102
+ * @csspart line-hidden - The `line` of a series a legend hid, kept where it was last drawn and hidden, so a stylesheet can fade it out. Set alongside `line`.
100
103
  * @csspart live - The readout: a polite live region that says the reading the keys moved to. Hide it visually.
101
104
  * @csspart loading - The words in place of the drawing while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
102
105
  * @csspart mark - The invisible point the tooltip is anchored to.
103
106
  * @csspart marker - The marks on one series' readings under `markers`, as one path with a stroke of no length at each reading: give it a round `stroke-linecap`, a `stroke-width` the size of a mark and `vector-effect: non-scaling-stroke`. Carries its series color as `--chart-series`.
107
+ * @csspart marker-hidden - The `marker` paths of a series a legend hid, kept where they were last drawn and hidden. Set alongside `marker`.
104
108
  * @csspart marker-lone - The `marker` path of one series' readings with a blank on either side, which no line reaches and which are marked without `markers`. Set alongside `marker`.
105
109
  * @csspart marker-ring - The same marks again under each series' `marker` paths, to stroke a little wider in the page's color, so a mark reads over the line it sits on.
110
+ * @csspart marker-ring-hidden - The `marker-ring` of a series a legend hid. Set alongside `marker-ring`.
106
111
  * @csspart plot - The drawing, which takes focus to be read by key. With nothing to draw, a group named as the chart is, holding the `empty` or `loading` part.
107
112
  * @csspart sonify - The button that plays the chart as sound, under `sonify`.
108
113
  * @csspart summary - The chart's name and each series' latest reading, written as a sentence for screen readers. Hide it visually.
@@ -110,7 +115,9 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
110
115
  * @csspart table - The readings as a table, for a screen reader, rendered only where they were drawn from `data`, a page of them at a time past a few hundred. Hide it visually.
111
116
  * @csspart table-pages - Which readings a page of the `table` holds, and the buttons that show the previous and the next page, rendered only while it holds a page. Hide it visually.
112
117
  * @csspart terminus - The mark on one series' last reading. It carries `data-jumped` for the drawing where its line took a new shape at once, with a reading more or fewer, so a stylesheet moving the mark can move it at once too.
118
+ * @csspart terminus-hidden - The `terminus` of a series a legend hid, kept where it was last drawn and `hidden`. Set alongside `terminus`.
113
119
  * @csspart tick - One number on the axis, placed with `inset-block-start` at its level.
120
+ * @csspart tick-leaving - A number the scale no longer has, kept `hidden` at its place on the new scale, held inside the plot, so a stylesheet can fade it out as it moves. Set alongside `tick`.
114
121
  * @csspart tooltip-anchor - The `Tooltip` element itself.
115
122
  * @csspart tooltip-arrow - The bubble's point, forwarded from `Tooltip`.
116
123
  * @csspart tooltip-arrow-bottom - The point while the bubble is below the reading, so on its top edge, beside `tooltip-arrow`.
@@ -325,6 +332,22 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
325
332
  * near the top of the box.
326
333
  */
327
334
  zero: boolean;
335
+ /** The scale drawn before this one, whose levels the axis and the rules leave from. */
336
+ private readonly scaleBefore;
337
+ /** The scale before the one this render draws, from `scaleBefore`. */
338
+ private domainBefore;
339
+ /**
340
+ * The scales each series was last drawn with while it was shown, by its
341
+ * key, so a series a legend hides stays where it was as it fades out.
342
+ */
343
+ private readonly shownWith;
344
+ /**
345
+ * The scales a series is drawn with: this render's while it is shown, and
346
+ * the last it was shown with once a legend hides it, so it fades out where
347
+ * it stood while the others move to the new scale. Nothing for a series
348
+ * hidden since the chart first drew it, which has nowhere to fade from.
349
+ */
350
+ private scalesFor;
328
351
  /**
329
352
  * How many readings each series' line was last drawn with, so a terminus
330
353
  * can tell a line that moves to its new shape from one that jumps to it.
@@ -405,6 +428,7 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
405
428
  * differently without reimplementing the plot.
406
429
  */
407
430
  protected renderTermini(ends: Array<{
431
+ hidden?: boolean;
408
432
  index: number;
409
433
  jumped: boolean;
410
434
  x: number;
@@ -1,7 +1,8 @@
1
1
  import { __decorate } from "tslib";
2
- import { byRow, CategoryAxisController, CHART_PLOT, columnPoints, commaList, customElement, drawTooltip, drawValueAxis, formatNumbers, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, headroom, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, ticks, unbroken, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { byRow, CategoryAxisController, CHART_PLOT, columnPoints, commaList, customElement, drawTooltip, drawValueAxis, formatNumbers, HelixElement, HelixReadingChangeEvent, HelixReadingPressEvent, headroom, heldInside, levelsOf, linear, linePath, MIRROR_RULE, MixinChartSource, MixinChartStatus, PLOT_HEIGHT, PLOT_WIDTH, ScaleMemory, seriesIndex, seriesKey, unbroken, wordsLocale, } from '@fusion.dev/helix-core';
3
3
  import { html, nothing, svg } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
+ import { repeat } from 'lit/directives/repeat.js';
5
6
  import '../../tooltip/index.js';
6
7
  const round = (value) => Math.round(value * 100) / 100;
7
8
  let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStatus(MixinChartSource(HelixElement)) {
@@ -15,6 +16,8 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
15
16
  this.slots = new WeakMap();
16
17
  this.names = new CategoryAxisController(this);
17
18
  this.zero = false;
19
+ this.scaleBefore = new ScaleMemory();
20
+ this.shownWith = new Map();
18
21
  this.drawnCounts = new Map();
19
22
  }
20
23
  static { this.markRules = [MIRROR_RULE]; }
@@ -105,13 +108,21 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
105
108
  }
106
109
  return held;
107
110
  }
111
+ scalesFor(one, x, y) {
112
+ if (this.showsSeries(one.name)) {
113
+ return { hidden: false, x, y };
114
+ }
115
+ const held = this.shownWith.get(seriesKey(one.name));
116
+ return held ? { hidden: true, ...held } : undefined;
117
+ }
108
118
  ends(series, x, y) {
109
119
  return series.flatMap((one, depth) => {
110
120
  const before = this.drawnCounts.get(one.name);
111
121
  this.drawnCounts.set(one.name, one.points.length);
112
122
  const jumped = before !== undefined && before !== one.points.length;
113
123
  const last = one.points.at(-1);
114
- if (!this.showsSeries(one.name)) {
124
+ const drawn = this.scalesFor(one, x, y);
125
+ if (!drawn) {
115
126
  return [];
116
127
  }
117
128
  if (!last || one.points.length < 2) {
@@ -119,10 +130,11 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
119
130
  }
120
131
  return [
121
132
  {
133
+ hidden: drawn.hidden,
122
134
  index: seriesIndex(depth),
123
135
  jumped,
124
- x: (x(last.at) / PLOT_WIDTH) * 100,
125
- y: (y(last.value) / PLOT_HEIGHT) * 100,
136
+ x: (drawn.x(last.at) / PLOT_WIDTH) * 100,
137
+ y: (drawn.y(last.value) / PLOT_HEIGHT) * 100,
126
138
  },
127
139
  ];
128
140
  });
@@ -135,10 +147,16 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
135
147
  }
136
148
  const domain = this.range(series);
137
149
  const { x, y } = this.scalesOf(domain, readings.length);
150
+ this.domainBefore = this.scaleBefore.before(domain);
151
+ for (const one of series) {
152
+ if (this.showsSeries(one.name)) {
153
+ this.shownWith.set(seriesKey(one.name), { x, y });
154
+ }
155
+ }
138
156
  return html `${this.drawsAxis ? this.renderAxis(y, domain) : nothing}${this.renderPlot(series, x, y, domain)} ${this.renderLabels(readings)}${this.renderSummary(series)}${this.renderSonify()}${this.renderTable()}`;
139
157
  }
140
158
  renderAxis(y, domain) {
141
- return drawValueAxis(domain, (value) => (y(value) / PLOT_HEIGHT) * 100, formatNumbers(wordsLocale(this)), (widest) => `--line-chart-axis: ${widest}ch`);
159
+ return drawValueAxis(domain, (value) => (y(value) / PLOT_HEIGHT) * 100, formatNumbers(wordsLocale(this)), (widest) => `--line-chart-axis: ${widest}ch`, this.domainBefore);
142
160
  }
143
161
  renderSummary(series) {
144
162
  const rows = this.sourceRows;
@@ -162,8 +180,9 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
162
180
  renderPlot(series, x, y, domain) {
163
181
  const floor = domain[0] <= 0 && domain[1] >= 0 ? y(0) : undefined;
164
182
  const ends = this.terminus === 'none' ? [] : this.ends(series, x, y);
165
- const holes = this.terminus === 'ring' && ends.length > 0
166
- ? ends
183
+ const rings = ends.filter((end) => !end.hidden);
184
+ const holes = this.terminus === 'ring' && rings.length > 0
185
+ ? rings
167
186
  .map((end) => `radial-gradient(circle at ${end.x}% ${end.y}%, #0000 calc(var(--_chart-terminus-inner) - 0.5px), #000 var(--_chart-terminus-inner))`)
168
187
  .join(', ')
169
188
  : undefined;
@@ -209,8 +228,16 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
209
228
  .map(({ at }) => svg `<line part="gridline" x1=${x(at)} x2=${x(at)} y1="0" y2=${PLOT_HEIGHT} />`)
210
229
  : [];
211
230
  const across = this.rulesValue
212
- ? ticks(domain).map((level) => svg `<line part="gridline" x1="0" x2=${PLOT_WIDTH} y1=${y(level)} y2=${y(level)} />`)
213
- : [];
231
+ ? repeat(levelsOf(domain, this.domainBefore), (one) => one.level, ({ leaving, level }) => svg `<line
232
+ part="gridline${leaving ? ' gridline-leaving' : ''}"
233
+ style=${`translate: 0 ${leaving ? heldInside(y(level)) : y(level)}px`}
234
+ visibility=${leaving ? 'hidden' : nothing}
235
+ x1="0"
236
+ x2=${PLOT_WIDTH}
237
+ y1="0"
238
+ y2="0"
239
+ />`)
240
+ : nothing;
214
241
  return svg `${down}${across}`;
215
242
  }
216
243
  renderBand(count) {
@@ -219,55 +246,76 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
219
246
  return nothing;
220
247
  }
221
248
  const slot = PLOT_WIDTH / count;
222
- return svg `<rect height=${PLOT_HEIGHT} part="band" width=${slot} x=${at * slot} y="0" />`;
249
+ return svg `<rect
250
+ height=${PLOT_HEIGHT}
251
+ part="band"
252
+ style=${`translate: ${at * slot}px 0`}
253
+ width=${slot}
254
+ x="0"
255
+ y="0"
256
+ />`;
223
257
  }
224
258
  renderGuide(x) {
225
259
  const at = this.pointer.at;
226
260
  if (at < 0) {
227
261
  return nothing;
228
262
  }
229
- return svg `<line part="guide" x1=${x(at)} x2=${x(at)} y1="0" y2=${PLOT_HEIGHT} />`;
263
+ return svg `<line
264
+ part="guide"
265
+ style=${`translate: ${x(at)}px 0`}
266
+ x1="0"
267
+ x2="0"
268
+ y1="0"
269
+ y2=${PLOT_HEIGHT}
270
+ />`;
230
271
  }
231
272
  renderTermini(ends) {
232
273
  if (ends.length === 0) {
233
274
  return nothing;
234
275
  }
235
- return html `${ends.map((end) => html `<span
276
+ return html `${repeat(ends, (end) => end.index, (end) => html `<span
236
277
  aria-hidden="true"
237
278
  ?data-jumped=${end.jumped}
238
- part="terminus"
279
+ ?hidden=${end.hidden === true}
280
+ part="terminus${end.hidden ? ' terminus-hidden' : ''}"
239
281
  style=${`--chart-series: var(--chart-series-${end.index}); --chart-terminus-x: ${end.x}%; --chart-terminus-y: ${end.y}%`}
240
282
  ></span>`)}`;
241
283
  }
242
284
  renderMarkers(series, x, y) {
243
285
  const drawn = series.flatMap((one, depth) => {
244
- if (!this.showsSeries(one.name)) {
286
+ const scales = this.scalesFor(one, x, y);
287
+ if (!scales) {
245
288
  return [];
246
289
  }
247
- const { lone, marks } = this.marksOf(one, x, y);
248
- return lone === '' && marks === '' ? [] : [{ index: seriesIndex(depth), lone, marks }];
290
+ const { lone, marks } = this.marksOf(one, scales.x, scales.y);
291
+ return lone === '' && marks === ''
292
+ ? []
293
+ : [{ hidden: scales.hidden, index: seriesIndex(depth), lone, marks }];
249
294
  });
250
295
  if (drawn.length === 0) {
251
296
  return nothing;
252
297
  }
253
- return svg `${drawn.map(({ index, lone, marks }) => svg `<path
298
+ return svg `${repeat(drawn, ({ index }) => index, ({ hidden, index, lone, marks }) => svg `<path
254
299
  d=${marks + lone}
255
300
  data-series=${index}
256
- part="marker-ring"
301
+ part="marker-ring${hidden ? ' marker-ring-hidden' : ''}"
302
+ visibility=${hidden ? 'hidden' : nothing}
257
303
  />${marks === ''
258
304
  ? nothing
259
305
  : svg `<path
260
306
  d=${marks}
261
307
  data-series=${index}
262
- part="marker"
308
+ part="marker${hidden ? ' marker-hidden' : ''}"
263
309
  style="--chart-series: var(--chart-series-${index})"
310
+ visibility=${hidden ? 'hidden' : nothing}
264
311
  />`}${lone === ''
265
312
  ? nothing
266
313
  : svg `<path
267
314
  d=${lone}
268
315
  data-series=${index}
269
- part="marker marker-lone"
316
+ part="marker marker-lone${hidden ? ' marker-hidden' : ''}"
270
317
  style="--chart-series: var(--chart-series-${index})"
318
+ visibility=${hidden ? 'hidden' : nothing}
271
319
  />`}`)}`;
272
320
  }
273
321
  marksOf(one, x, y) {
@@ -300,10 +348,12 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
300
348
  return this.dashed !== '' && commaList(this.dashed).some((one) => seriesKey(one) === key);
301
349
  }
302
350
  renderSeries(one, depth, x, y, piece) {
303
- if (!this.showsSeries(one.name)) {
351
+ const scales = this.scalesFor(one, x, y);
352
+ if (!scales) {
304
353
  return html `${nothing}`;
305
354
  }
306
- const runs = this.runsOf(one, x, y);
355
+ const hidden = scales.hidden;
356
+ const runs = this.runsOf(one, scales.x, scales.y);
307
357
  if (runs.length === 0) {
308
358
  return html `${nothing}`;
309
359
  }
@@ -321,8 +371,9 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
321
371
  ? svg `<path
322
372
  d=${wash}
323
373
  data-series=${index}
324
- part="area"
374
+ part="area${hidden ? ' area-hidden' : ''}"
325
375
  style="--chart-series: var(--chart-series-${index})"
376
+ visibility=${hidden ? 'hidden' : nothing}
326
377
  />`
327
378
  : html `${nothing}`;
328
379
  }
@@ -330,8 +381,9 @@ let HelixHeadlessLineChart = class HelixHeadlessLineChart extends MixinChartStat
330
381
  d=${path}
331
382
  data-series=${index}
332
383
  fill="none"
333
- part="line${this.dashes(one.name) ? ' line-dashed' : ''}"
384
+ part="line${this.dashes(one.name) ? ' line-dashed' : ''}${hidden ? ' line-hidden' : ''}"
334
385
  style="--chart-series: var(--chart-series-${index})"
386
+ visibility=${hidden ? 'hidden' : nothing}
335
387
  />`;
336
388
  }
337
389
  renderLabels(readings) {