@fusion.dev/helix-headless 0.241.3 → 0.242.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 (89) hide show
  1. package/api.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/chat/composer/chat-composer.d.ts +8 -1
  4. package/dist/chat/composer/chat-composer.js +15 -1
  5. package/dist/chat/message/chat-message.d.ts +12 -0
  6. package/dist/chat/message/chat-message.js +8 -0
  7. package/dist/chat/root/chat-root.d.ts +9 -0
  8. package/dist/chat/root/chat-root.js +13 -1
  9. package/dist/code-editor/root/code-editor-root.d.ts +1 -0
  10. package/dist/code-editor/root/code-editor-root.js +1 -1
  11. package/dist/column-manager/root/column-manager-root.d.ts +30 -2
  12. package/dist/column-manager/root/column-manager-root.js +73 -9
  13. package/dist/combobox/root/combobox-root.d.ts +8 -1
  14. package/dist/combobox/root/combobox-root.js +19 -2
  15. package/dist/data-table/root/data-table-root.d.ts +34 -6
  16. package/dist/data-table/root/data-table-root.js +42 -7
  17. package/dist/date-input/root/date-input-root.d.ts +8 -1
  18. package/dist/date-input/root/date-input-root.js +19 -2
  19. package/dist/date-picker/root/date-picker-root.d.ts +5 -0
  20. package/dist/date-picker/root/date-picker-root.js +3 -0
  21. package/dist/editor/root/editor-root.d.ts +1 -0
  22. package/dist/editor/root/editor-root.js +1 -1
  23. package/dist/element-events.generated.js +2 -0
  24. package/dist/file-input/root/file-input-root.d.ts +8 -1
  25. package/dist/file-input/root/file-input-root.js +19 -2
  26. package/dist/filter-input/root/filter-input-root.d.ts +8 -1
  27. package/dist/filter-input/root/filter-input-root.js +13 -1
  28. package/dist/find/root/find-root.d.ts +1 -0
  29. package/dist/find/root/find-root.js +4 -4
  30. package/dist/hover-card/index.d.ts +1 -0
  31. package/dist/hover-card/index.js +1 -0
  32. package/dist/hover-card/root/hover-card-root.d.ts +122 -0
  33. package/dist/hover-card/root/hover-card-root.js +185 -0
  34. package/dist/index.d.ts +2 -0
  35. package/dist/index.js +2 -0
  36. package/dist/line-chart/root/line-chart-root.d.ts +7 -1
  37. package/dist/line-chart/root/line-chart-root.js +6 -0
  38. package/dist/list/root/list-root.d.ts +12 -1
  39. package/dist/list/root/list-root.js +11 -1
  40. package/dist/log/line/log-line.d.ts +11 -0
  41. package/dist/log/line/log-line.js +8 -0
  42. package/dist/log/root/log-root.d.ts +9 -0
  43. package/dist/log/root/log-root.js +13 -1
  44. package/dist/meter/root/meter-root.d.ts +12 -1
  45. package/dist/meter/root/meter-root.js +31 -2
  46. package/dist/navigation/root/navigation-root.d.ts +5 -1
  47. package/dist/navigation/root/navigation-root.js +13 -1
  48. package/dist/notifications/root/notifications-root.d.ts +10 -1
  49. package/dist/notifications/root/notifications-root.js +12 -1
  50. package/dist/object-inspector/root/object-inspector-root.js +6 -6
  51. package/dist/pagination/root/pagination-root.d.ts +16 -1
  52. package/dist/pagination/root/pagination-root.js +19 -1
  53. package/dist/popover/root/popover-root.d.ts +6 -0
  54. package/dist/popover/root/popover-root.js +2 -0
  55. package/dist/progress/root/progress-root.d.ts +11 -1
  56. package/dist/progress/root/progress-root.js +29 -2
  57. package/dist/sparkline/root/sparkline-root.d.ts +3 -1
  58. package/dist/sparkline/root/sparkline-root.js +8 -1
  59. package/dist/stat/root/stat-root.d.ts +22 -1
  60. package/dist/stat/root/stat-root.js +27 -4
  61. package/dist/table/root/table-root.d.ts +22 -5
  62. package/dist/table/root/table-root.js +13 -1
  63. package/dist/tabs/root/tabs-root.d.ts +6 -1
  64. package/dist/tabs/root/tabs-root.js +12 -1
  65. package/dist/tag/group/tag-group.d.ts +13 -1
  66. package/dist/tag/group/tag-group.js +12 -1
  67. package/dist/terminal/root/terminal-root.d.ts +1 -0
  68. package/dist/terminal/root/terminal-root.js +1 -1
  69. package/dist/theme-toggle/index.d.ts +1 -0
  70. package/dist/theme-toggle/index.js +1 -0
  71. package/dist/theme-toggle/root/theme-toggle-root.d.ts +98 -0
  72. package/dist/theme-toggle/root/theme-toggle-root.js +68 -0
  73. package/dist/time-input/root/time-input-root.d.ts +8 -1
  74. package/dist/time-input/root/time-input-root.js +19 -2
  75. package/dist/timeline/root/timeline-root.d.ts +10 -1
  76. package/dist/timeline/root/timeline-root.js +11 -1
  77. package/dist/toggle/group/toggle-group.d.ts +5 -1
  78. package/dist/toggle/group/toggle-group.js +12 -2
  79. package/dist/tree/root/tree-root.d.ts +13 -1
  80. package/dist/tree/root/tree-root.js +11 -1
  81. package/dist/trend/root/trend-root.d.ts +14 -1
  82. package/dist/trend/root/trend-root.js +20 -2
  83. package/examples.json +1 -1
  84. package/lint.json +1 -1
  85. package/package.json +5 -5
  86. package/types/jsx.d.ts +425 -10
  87. package/types/svelte.d.ts +2 -0
  88. package/types/vue.d.ts +249 -8
  89. package/types/words.d.ts +8 -0
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { customElement, drawStatus, HelixCompleteEvent, HelixElement, hostAria, internalsOf, numberConverter, readingText, StatusController, slotFilled, slotNamed, slottedWords, words, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { CountController, customElement, drawStatus, HelixCompleteEvent, HelixElement, hostAria, internalsOf, numberConverter, readingText, StatusController, slotFilled, slotNamed, slottedWords, words, wordsLocale, } from '@fusion.dev/helix-core';
3
3
  import { html } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
@@ -16,6 +16,15 @@ let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
16
16
  this.value = 0;
17
17
  this.valueText = '';
18
18
  this.status = new StatusController(this);
19
+ this.count = new CountController(this, {
20
+ timing: () => {
21
+ const style = getComputedStyle(this);
22
+ return {
23
+ duration: style.getPropertyValue('--progress-count-duration'),
24
+ easing: style.getPropertyValue('--progress-count-easing'),
25
+ };
26
+ },
27
+ });
19
28
  this.renamed = () => {
20
29
  this.requestUpdate();
21
30
  };
@@ -38,6 +47,15 @@ let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
38
47
  }
39
48
  willUpdate(changed) {
40
49
  super.willUpdate(changed);
50
+ const was = changed.get('value');
51
+ if (changed.has('value') &&
52
+ this.hasUpdated &&
53
+ was !== undefined &&
54
+ this.showValue &&
55
+ !this.valueText &&
56
+ !this.indeterminate) {
57
+ this.count.start(was, this.value);
58
+ }
41
59
  hostAria(internalsOf(this), {
42
60
  label: slottedWords(this, ['label']) || this.label || this.fallbackLabel,
43
61
  role: 'progressbar',
@@ -69,6 +87,15 @@ let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
69
87
  return (this.valueText ||
70
88
  readingText(Math.min(Math.max(this.value, this.range.min), this.range.max), this.fraction, wordsLocale(this), this.formatOptions));
71
89
  }
90
+ get shownText() {
91
+ const counting = this.count.counting;
92
+ if (counting === undefined) {
93
+ return this.text;
94
+ }
95
+ const { max, min } = this.range;
96
+ const held = Math.min(Math.max(counting, min), max);
97
+ return readingText(held, Math.min(Math.max((held - min) / (max - min), 0), 1) || 0, wordsLocale(this), this.formatOptions);
98
+ }
72
99
  render() {
73
100
  const fraction = this.indeterminate ? 1 : this.fraction;
74
101
  const ring = html `<svg part="track" aria-hidden="true">
@@ -86,7 +113,7 @@ let HelixHeadlessProgress = class HelixHeadlessProgress extends HelixElement {
86
113
  </div>`}
87
114
  ${this.showValue && !this.indeterminate
88
115
  ? html `<span part="value" aria-hidden="true"
89
- >${this.text}</span
116
+ >${this.shownText}</span
90
117
  >`
91
118
  : ''}${drawStatus(this.status)}`;
92
119
  }
@@ -86,7 +86,7 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
86
86
  * @csspart range - The band between the two values of `range`, drawn behind the line.
87
87
  * @csspart readout - The reading a pointer or a key rests on, as the table or `values` writes it, rendered only while there is one. Placed as `cursor` is.
88
88
  * @csspart svg - The drawing, which takes focus to be read by key where there is a `label`.
89
- * @csspart terminus - The mark on the last value.
89
+ * @csspart terminus - The mark on the last value. It carries `data-jumped` for the drawing where the line took a new shape at once, with a value more or fewer, so a stylesheet moving the mark can move it at once too.
90
90
  * @csspart wash-end - The far stop of the area's gradient.
91
91
  * @csspart wash-start - The stop of the area's gradient that meets the line.
92
92
  *
@@ -263,6 +263,8 @@ export declare class HelixHeadlessSparkline extends HelixElement {
263
263
  */
264
264
  values: string | readonly number[];
265
265
  protected readonly source: SourceController;
266
+ /** How many values the line was last drawn with, so its terminus can tell a line that moves from one that jumps. */
267
+ private drawnCount;
266
268
  /**
267
269
  * Sends the reading's moves and presses as `helix-reading-change` and
268
270
  * `helix-reading-press`, named by the table's row where there is one. Here
@@ -123,6 +123,8 @@ let HelixHeadlessSparkline = class HelixHeadlessSparkline extends HelixElement {
123
123
  ])
124
124
  : [];
125
125
  const lastAt = slots.findLastIndex((value) => value !== undefined);
126
+ const jumped = this.drawnCount !== undefined && this.drawnCount !== points.length;
127
+ this.drawnCount = points.length;
126
128
  const end = points.length < 2
127
129
  ? undefined
128
130
  : `--chart-terminus-x: ${(x(lastAt) / PLOT_WIDTH) * 100}%; --chart-terminus-y: ${(y(slots[lastAt]) / STRIP_HEIGHT) * 100}%`;
@@ -175,7 +177,12 @@ let HelixHeadlessSparkline = class HelixHeadlessSparkline extends HelixElement {
175
177
  </svg>
176
178
  ${points.length === 0 ? this.renderStatus() : nothing}${points.length < 2 || this.plot === 'bar'
177
179
  ? nothing
178
- : html `<span aria-hidden="true" part="terminus" style=${end ?? nothing}></span>`}${this.renderLone(points.length < 2 ? undefined : series, at)}${this.renderMarks(slots, at)}${this.renderReading(slots, at)}${named && count > 0 ? this.renderLive(slots) : nothing}${overview === ''
180
+ : html `<span
181
+ aria-hidden="true"
182
+ ?data-jumped=${jumped}
183
+ part="terminus"
184
+ style=${end ?? nothing}
185
+ ></span>`}${this.renderLone(points.length < 2 ? undefined : series, at)}${this.renderMarks(slots, at)}${this.renderReading(slots, at)}${named && count > 0 ? this.renderLive(slots) : nothing}${overview === ''
179
186
  ? nothing
180
187
  : html `<span hidden id="sparkline-overview" part="overview">${overview}</span>`}`;
181
188
  }
@@ -1,4 +1,4 @@
1
- import { HelixElement } from '@fusion.dev/helix-core';
1
+ import { CountController, HelixElement } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  /**
4
4
  * @summary One measurement, with a label that names what it measures.
@@ -31,6 +31,14 @@ import { type PropertyValues, type TemplateResult } from 'lit';
31
31
  * the stat with those breaks, and the slot is hidden while it is. A figure
32
32
  * holding an element is shown as it is.
33
33
  *
34
+ * **A new `value` counts to the new number** from the one before, so a figure
35
+ * that a dashboard refreshes reads as having moved. A screen reader reads only
36
+ * the new number. The stat times the count from `--stat-count-duration` and
37
+ * `--stat-count-easing`, which the styled tier sets from the duration and
38
+ * easing tokens. Here neither is set, so the figure changes at once until you
39
+ * set them, and under reduced motion it always does. A slotted figure changes
40
+ * at once.
41
+ *
34
42
  * **Each slot is a part of the same name**, and `value` for the figure, so a
35
43
  * page reaches the label, the unit and the trend from outside. A slot draws no
36
44
  * box, so a part passes inherited properties to what is slotted. **The stat
@@ -54,6 +62,9 @@ import { type PropertyValues, type TemplateResult } from 'lit';
54
62
  * @csspart unit - The slot the unit arrives through, drawing no box, as `value` does.
55
63
  * @csspart value - The slot the value is written in, or the figure the stat writes from `value` or from slotted text. A slot draws no box, so it takes the inherited properties, such as color and font, and passes them to the value.
56
64
  *
65
+ * @cssproperty --stat-count-duration - How long a new `value` takes to count from the one before. Unset, the figure changes at once.
66
+ * @cssproperty --stat-count-easing - The curve a new `value` counts along.
67
+ *
57
68
  * @cssstate has-label - Something is slotted into `label`.
58
69
  * @cssstate has-trend - Something is slotted into `trend`.
59
70
  * @cssstate has-unit - Something is slotted into `unit`.
@@ -62,6 +73,7 @@ import { type PropertyValues, type TemplateResult } from 'lit';
62
73
  * @cssstate stepped-twice - The figure is set two steps smaller, because one step smaller it still does not fit. `stepped` holds as well.
63
74
  */
64
75
  export declare class HelixHeadlessStat extends HelixElement {
76
+ protected static markRules: string[];
65
77
  /**
66
78
  * Which way the label and the value are arranged.
67
79
  *
@@ -113,6 +125,8 @@ export declare class HelixHeadlessStat extends HelixElement {
113
125
  * Absent leaves the figure to the slot.
114
126
  */
115
127
  value?: number;
128
+ /** Counting a new `value` from the one before. */
129
+ protected readonly count: CountController;
116
130
  protected willUpdate(changed: PropertyValues): void;
117
131
  protected firstUpdated(changed: PropertyValues): void;
118
132
  /** Watches the stat's own width, to step the figure down where it does not fit. */
@@ -171,6 +185,13 @@ export declare class HelixHeadlessStat extends HelixElement {
171
185
  /** Says which pieces the stat holds, one call apiece so each pairs with its `@cssstate`. */
172
186
  private readonly readPieces;
173
187
  protected render(): TemplateResult;
188
+ /**
189
+ * The figure written from `value`. **While it counts, the passing numbers
190
+ * are hidden from screen readers** and the number it is counting to is read
191
+ * in their place, so a reader who reaches the stat mid-count hears the new
192
+ * figure and not one of the numbers on the way.
193
+ */
194
+ private drawFigure;
174
195
  }
175
196
  declare global {
176
197
  interface HTMLElementTagNameMap {
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { customElement, formatNumber, formatNumberParts, HelixElement, hostAria, internalsOf, numberConverter, reportRuntime, slotFilled, slottedWords, wordsLocale, } from '@fusion.dev/helix-core';
2
+ import { CountController, customElement, formatNumber, formatNumberParts, HelixElement, hostAria, internalsOf, numberConverter, reportRuntime, SPOKEN_RULE, slotFilled, slottedWords, wordsLocale, } from '@fusion.dev/helix-core';
3
3
  import { html, nothing } from 'lit';
4
4
  import { property, state } from 'lit/decorators.js';
5
5
  const SEPARATORS = new Set([',', '.', "'", '\u2019', ' ', '\u00a0', '\u2009', '\u202f']);
@@ -8,6 +8,15 @@ let HelixHeadlessStat = class HelixHeadlessStat extends HelixElement {
8
8
  constructor() {
9
9
  super(...arguments);
10
10
  this.locale = '';
11
+ this.count = new CountController(this, {
12
+ timing: () => {
13
+ const style = getComputedStyle(this);
14
+ return {
15
+ duration: style.getPropertyValue('--stat-count-duration'),
16
+ easing: style.getPropertyValue('--stat-count-easing'),
17
+ };
18
+ },
19
+ });
11
20
  this.slottedRuns = [];
12
21
  this.figureRead = false;
13
22
  this.refit = () => this.fit();
@@ -52,8 +61,13 @@ let HelixHeadlessStat = class HelixHeadlessStat extends HelixElement {
52
61
  this.toggleState('has-trend', filled('trend'));
53
62
  };
54
63
  }
64
+ static { this.markRules = [SPOKEN_RULE]; }
55
65
  willUpdate(changed) {
56
66
  super.willUpdate(changed);
67
+ const was = changed.get('value');
68
+ if (changed.has('value') && this.hasUpdated && was !== undefined) {
69
+ this.count.start(was, this.value);
70
+ }
57
71
  if (this.childrenKnown && (!this.figureRead || changed.has('locale'))) {
58
72
  this.figureRead = true;
59
73
  this.readFigure();
@@ -152,7 +166,9 @@ let HelixHeadlessStat = class HelixHeadlessStat extends HelixElement {
152
166
  updated(changed) {
153
167
  super.updated(changed);
154
168
  this.readPieces();
155
- this.fit();
169
+ if (this.count.counting === undefined) {
170
+ this.fit();
171
+ }
156
172
  const given = this.direction;
157
173
  if (changed.has('direction') && (given === 'up' || given === 'down' || given === 'neutral')) {
158
174
  reportRuntime({
@@ -165,7 +181,7 @@ let HelixHeadlessStat = class HelixHeadlessStat extends HelixElement {
165
181
  }
166
182
  }
167
183
  render() {
168
- const value = this.value;
184
+ const value = this.count.counting ?? this.value;
169
185
  const figure = value === undefined || !Number.isFinite(value)
170
186
  ? ''
171
187
  : formatNumber(value, wordsLocale(this), this.formatOptions);
@@ -187,10 +203,17 @@ let HelixHeadlessStat = class HelixHeadlessStat extends HelixElement {
187
203
  }
188
204
  const written = figure !== '' || slotted.length > 0;
189
205
  return html `<slot name="label" part="label" @slotchange=${() => this.requestUpdate()}></slot>
190
- ${figure === '' ? html `${written ? html `<span part="value">${pieces}</span>` : nothing}<slot part=${written ? nothing : 'value'} ?hidden=${written} @slotchange=${this.readFigure}></slot>` : html `<span part="value">${pieces}</span>`}
206
+ ${figure === '' ? html `${written ? html `<span part="value">${pieces}</span>` : nothing}<slot part=${written ? nothing : 'value'} ?hidden=${written} @slotchange=${this.readFigure}></slot>` : this.drawFigure(pieces)}
191
207
  <slot name="unit" part="unit" @slotchange=${this.readPieces}></slot>
192
208
  <slot name="trend" part="trend" @slotchange=${this.readPieces}></slot>`;
193
209
  }
210
+ drawFigure(pieces) {
211
+ const to = this.value;
212
+ if (this.count.counting === undefined || to === undefined) {
213
+ return html `<span part="value">${pieces}</span>`;
214
+ }
215
+ return html `<span part="value" aria-hidden="true">${pieces}</span><span data-spoken>${formatNumber(to, wordsLocale(this), this.formatOptions)}</span>`;
216
+ }
194
217
  };
195
218
  __decorate([
196
219
  property({ reflect: true })
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixElement } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, HelixElement, LayoutMotionController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import '../../checkbox/index.js';
4
4
  import { type HelixHeadlessTableColumn } from '../column/table-column.js';
@@ -141,10 +141,18 @@ declare const HelixHeadlessTable_base: (new (...args: any[]) => import("@fusion.
141
141
  * loading lines, the live region says it, and the table takes the `error`
142
142
  * state. Clear it once you try again.
143
143
  *
144
- * The CSS custom properties listed for this component are written by it and
145
- * read by the stylesheet that draws it. Do not set them. Each holds a number
146
- * the component computes and CSS cannot, so the stylesheet can draw the table
147
- * without measuring anything.
144
+ * **Rows slide to their places.** When the table sorts, or you add, remove or
145
+ * reorder rows, each one moves from where it was drawn to where it is now, its
146
+ * cells together, and a row you add fades in. The table times it from
147
+ * `--table-move-duration` and `--table-move-easing`, which the styled tier
148
+ * sets from the duration and easing tokens. Here neither is set, so nothing
149
+ * moves until you set them. Under reduced motion nothing moves, whatever they
150
+ * say.
151
+ *
152
+ * The other CSS custom properties listed for this component are written by it
153
+ * and read by the stylesheet that draws it. Do not set them. Each holds a
154
+ * number the component computes and CSS cannot, so the stylesheet can draw the
155
+ * table without measuring anything.
148
156
  *
149
157
  * @since 0.1.0
150
158
  * @status stable
@@ -195,6 +203,8 @@ declare const HelixHeadlessTable_base: (new (...args: any[]) => import("@fusion.
195
203
  * @csspart select-all - The heading that holds the checkbox that selects every row.
196
204
  * @csspart table - The grid.
197
205
  *
206
+ * @cssproperty --table-move-duration - How long a row takes to slide to its new place, or to fade in. Unset, nothing moves.
207
+ * @cssproperty --table-move-easing - The curve a row slides and fades in along.
198
208
  * @cssproperty --table-template - The column track list the table works out from its columns. The component writes it inline on the element that reads it, so setting it has no effect. Set `columns` to change the tracks.
199
209
  *
200
210
  * @cssstate empty - While there are no rows and none are loading.
@@ -472,6 +482,13 @@ export declare class HelixHeadlessTable extends HelixHeadlessTable_base {
472
482
  protected get hasRows(): boolean;
473
483
  /** The rows the body slot was last given, under `windowed`. */
474
484
  private drawnRows;
485
+ /**
486
+ * Sliding each row to its new place when the table sorts or the page changes
487
+ * its rows. Looked for after each update, because the table draws its rows
488
+ * in order by assigning them, and in the table's own box, which scrolls
489
+ * sideways.
490
+ */
491
+ protected readonly motion: LayoutMotionController;
475
492
  /**
476
493
  * The rows drawn now, each by its first cell, with its place among the
477
494
  * rows. A row is `display: contents` and has no box, and a cell is a grid
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, anchorAt, assignSlots, auditName, commaList, customElement, cycle, everyState, followLink, format, formatWords, HelixBeforeSelectEvent, HelixBeforeSortEvent, HelixElement, HelixExpandEvent, HelixLoadMoreEvent, HelixSelectEvent, HelixSortEvent, inRowOrder, MixinCollection, onAndroid, parse, ReorderController, rangeAdd, reflectElements, requestChange, scrollingAncestor, sort, toggleEvery, treeArrow, VIRTUAL_RULE, VirtualizeController, whenHydrated, words, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, anchorAt, assignSlots, auditName, commaList, customElement, cycle, everyState, followLink, format, formatWords, HelixBeforeSelectEvent, HelixBeforeSortEvent, HelixElement, HelixExpandEvent, HelixLoadMoreEvent, HelixSelectEvent, HelixSortEvent, inRowOrder, LayoutMotionController, MixinCollection, onAndroid, parse, ReorderController, rangeAdd, reflectElements, requestChange, scrollingAncestor, sort, toggleEvery, treeArrow, VIRTUAL_RULE, VirtualizeController, whenHydrated, words, } from '@fusion.dev/helix-core';
3
3
  import { nothing } from 'lit';
4
4
  import { property, state } from 'lit/decorators.js';
5
5
  import { html } from 'lit/static-html.js';
@@ -89,6 +89,18 @@ let HelixHeadlessTable = class HelixHeadlessTable extends MixinCollection(HelixE
89
89
  });
90
90
  this.arrangedCount = 0;
91
91
  this.drawnRows = [];
92
+ this.motion = new LayoutMotionController(this, {
93
+ items: () => (this.windowed ? this.drawnRows : this.arrangedRows).filter((row) => row instanceof HTMLElement),
94
+ scroller: () => this,
95
+ timing: () => {
96
+ const style = getComputedStyle(this);
97
+ return {
98
+ duration: style.getPropertyValue('--table-move-duration'),
99
+ easing: style.getPropertyValue('--table-move-easing'),
100
+ };
101
+ },
102
+ watch: 'updates',
103
+ });
92
104
  this.reorder = new ReorderController(this, {
93
105
  axis: 'block',
94
106
  box: (key) => this.gripOf(this.rowFor(key))?.getBoundingClientRect(),
@@ -1,4 +1,4 @@
1
- import { AriaForwardController, HelixElement, KeyboardNavigationController } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, 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 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.
88
89
  * @csspart indicator - The marker that moves to the selected tab. It carries the selected tab's
89
90
  * place and size as `--indicator-x`, `--indicator-y`, `--indicator-inline-size` and
90
91
  * `--indicator-block-size`, and `data-placed` once it has been placed, for a mark you draw
@@ -95,6 +96,8 @@ declare const HelixHeadlessTabs_base: (new (...args: any[]) => import("@fusion.d
95
96
  * @csspart scroll-start - The button that scrolls the strip toward its start, shown under `scroll-controls` while there is more that way.
96
97
  * @csspart scroll-start-mark - The glyph on that button, where none is slotted.
97
98
  * @csspart tabs - The tab list.
99
+ *
100
+ * @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.
98
101
  */
99
102
  export declare class HelixHeadlessTabs extends HelixHeadlessTabs_base {
100
103
  protected static markRules: string[];
@@ -105,6 +108,8 @@ export declare class HelixHeadlessTabs extends HelixHeadlessTabs_base {
105
108
  static words: string;
106
109
  protected readonly keys: KeyboardNavigationController;
107
110
  private readonly indicator;
111
+ /** Moves the hover wash to whichever tab is under the pointer. A disabled tab takes none. */
112
+ protected readonly highlight: HoverMarkController;
108
113
  /** Carries a host `aria-label` and `aria-labelledby` to the tab list. */
109
114
  protected readonly aria: AriaForwardController;
110
115
  /**
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, auditName, customElement, deepActiveElement, glyphPath, HelixActivateEvent, HelixElement, IndicatorController, isRtl, KeyboardNavigationController, MIRROR_RULE, MixinControllerActive, onUnlessFalse, scrollWithin, whenHydrated, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, auditName, customElement, deepActiveElement, glyphPath, HelixActivateEvent, HelixElement, HoverMarkController, IndicatorController, isRtl, KeyboardNavigationController, MIRROR_RULE, MixinControllerActive, onUnlessFalse, scrollWithin, whenHydrated, } from '@fusion.dev/helix-core';
3
3
  import { caretDown, caretLeft, caretRight, caretUp } from '@fusion.dev/helix-icons';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
@@ -19,6 +19,16 @@ let HelixHeadlessTabs = class HelixHeadlessTabs extends MixinControllerActive(He
19
19
  observe: () => this.tabs,
20
20
  surface: () => this.partNamed('tabs'),
21
21
  });
22
+ this.highlight = new HoverMarkController(this, {
23
+ gliding: (on) => this.toggleState('gliding', on),
24
+ item: (under) => {
25
+ const tabs = this.tabs;
26
+ return under.find((one) => one instanceof HelixHeadlessTab && tabs.includes(one) && !one.disabled);
27
+ },
28
+ mark: () => this.partNamed('highlight'),
29
+ observe: () => this.tabs,
30
+ surface: () => this.partNamed('tabs'),
31
+ });
22
32
  this.aria = new AriaForwardController(this, {
23
33
  label: true,
24
34
  target: () => this.partNamed('tabs'),
@@ -238,6 +248,7 @@ let HelixHeadlessTabs = class HelixHeadlessTabs extends MixinControllerActive(He
238
248
  @scroll=${this.scrollControls ? this.measure : nothing}
239
249
  >
240
250
  ${this.renderScroll(-1)}
251
+ <span part="highlight" aria-hidden="true" hidden></span>
241
252
  <slot @slotchange=${this.handleSlotChange}></slot>
242
253
  <span part="indicator" aria-hidden="true"><slot name="indicator"></slot></span>
243
254
  ${this.renderScroll(1)}
@@ -1,4 +1,4 @@
1
- import { HelixElement, KeyboardNavigationController, type SelectionMode, UpgradeController } from '@fusion.dev/helix-core';
1
+ import { HelixElement, KeyboardNavigationController, LayoutMotionController, type SelectionMode, UpgradeController } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import { HelixHeadlessTag } from '../root/tag-root.js';
4
4
  /** How many tags a group lets a reader select: core's `SelectionMode`. */
@@ -41,6 +41,13 @@ export type TagSelectionMode = SelectionMode;
41
41
  * Where only disabled tags are left, the first of them holds the tab stop and
42
42
  * takes focus, so the reader stays in the set.
43
43
  *
44
+ * **Tags slide to their places.** When you remove a tag, the ones after it
45
+ * close the gap, across a wrap too, and a tag you add fades in. The group
46
+ * times it from `--tag-group-move-duration` and `--tag-group-move-easing`,
47
+ * which the styled tier sets from the duration and easing tokens. Here neither
48
+ * is set, so nothing moves until you set them. Under reduced motion nothing
49
+ * moves, whatever they say.
50
+ *
44
51
  * **Typing new tags.** A field where people type tags and press Enter to add
45
52
  * each one is Combobox with `multiple` and `allows-custom-value`, or
46
53
  * `creatable` to ask first with `helix-create`. It draws each value as a tag,
@@ -60,6 +67,9 @@ export type TagSelectionMode = SelectionMode;
60
67
  * @event {HelixDismissEvent} helix-dismiss - A tag's remove button was pressed, or Delete or Backspace on the focused tag. Bubbles from that tag, which is its `target`; remove the tag in response. Cancelable.
61
68
  *
62
69
  * @csspart empty - Holds the `empty` slot while the group has no tags, rendered only then. Takes focus when the last tag is removed.
70
+ *
71
+ * @cssproperty --tag-group-move-duration - How long a tag takes to slide to its new place, or to fade in. Unset, nothing moves.
72
+ * @cssproperty --tag-group-move-easing - The curve a tag slides and fades in along.
63
73
  */
64
74
  export declare class HelixHeadlessTagGroup extends HelixElement {
65
75
  /**
@@ -133,6 +143,8 @@ export declare class HelixHeadlessTagGroup extends HelixElement {
133
143
  * an array of values is joined.
134
144
  */
135
145
  private get written();
146
+ /** Sliding each tag to its new place when the page adds, removes or hides tags. */
147
+ protected readonly motion: LayoutMotionController;
136
148
  /** The tags the group holds, in order. */
137
149
  get tags(): HelixHeadlessTag[];
138
150
  /** The tags a key can land on, which are the ones that are not disabled. */
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { commaList, customElement, deepActiveElement, deepContains, focusItemOf, HelixElement, hostAria, internalsOf, KeyboardNavigationController, pressedValue, prunedValue, requestValue, rovingStop, slottedWords, typeaheadByWords, UpgradeController, whenHydrated, words, } from '@fusion.dev/helix-core';
2
+ import { commaList, customElement, deepActiveElement, deepContains, focusItemOf, HelixElement, hostAria, internalsOf, KeyboardNavigationController, LayoutMotionController, pressedValue, prunedValue, requestValue, rovingStop, slottedWords, typeaheadByWords, UpgradeController, whenHydrated, words, } from '@fusion.dev/helix-core';
3
3
  import { html, nothing } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  import { HelixHeadlessTag } from '../root/tag-root.js';
@@ -18,6 +18,17 @@ let HelixHeadlessTagGroup = class HelixHeadlessTagGroup extends HelixElement {
18
18
  typeahead: typeaheadByWords(),
19
19
  wrap: false,
20
20
  });
21
+ this.motion = new LayoutMotionController(this, {
22
+ items: () => this.tags,
23
+ leaving: () => this.renderRoot,
24
+ timing: () => {
25
+ const style = getComputedStyle(this);
26
+ return {
27
+ duration: style.getPropertyValue('--tag-group-move-duration'),
28
+ easing: style.getPropertyValue('--tag-group-move-easing'),
29
+ };
30
+ },
31
+ });
21
32
  this.handleKeydown = (event) => {
22
33
  const tag = this.tagOf(event);
23
34
  if (!tag || tag.disabled || event.altKey) {
@@ -237,6 +237,7 @@ export interface TerminalSink {
237
237
  * @csspart find-replace-toggle - The button that shows the find bar's replace row, which a terminal does not draw.
238
238
  * @csspart find-replace-toggle-button - The replace toggle's inner button.
239
239
  * @csspart find-replace-toggle-live - The replace toggle's live region, which speaks while the button is pending.
240
+ * @csspart find-replace-toggle-mark - The caret on the find bar's replace toggle, which points down while the replace row shows and along the line while it is shut.
240
241
  * @csspart find-replace-toggle-spinner - The ring the replace toggle turns while it is pending.
241
242
  * @csspart find-replace-toggle-text - The box the replace toggle's icon sits in.
242
243
  * @csspart find-toggle - The button in the header that opens and closes the find bar. Expanded while it is open.
@@ -482,7 +482,7 @@ let HelixHeadlessTerminal = class HelixHeadlessTerminal extends HelixElement {
482
482
  const find = this.tag('find');
483
483
  return html `<${find}
484
484
  part="find"
485
- 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-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-all: find-replace-all, 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-button: find-replace-toggle-button, replace-toggle-live: find-replace-toggle-live, replace-toggle-spinner: find-replace-toggle-spinner, replace-toggle-text: find-replace-toggle-text, replace-toggle: find-replace-toggle, replace: find-replace, 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"
485
+ 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-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-all: find-replace-all, 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-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, replace-toggle: find-replace-toggle, replace: find-replace, 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"
486
486
  close-label=${this.findCloseLabel}
487
487
  controls-label=${this.findControlsLabel}
488
488
  invalid-label=${this.findInvalidLabel}
@@ -0,0 +1 @@
1
+ export { HelixHeadlessThemeToggle } from './root/theme-toggle-root.js';
@@ -0,0 +1 @@
1
+ export { HelixHeadlessThemeToggle } from './root/theme-toggle-root.js';
@@ -0,0 +1,98 @@
1
+ import { type ColorModeTransition, HelixElement } from '@fusion.dev/helix-core';
2
+ import { type TemplateResult } from 'lit';
3
+ /**
4
+ * @summary A button that switches the page between light and dark, with the new mode spreading from the button.
5
+ *
6
+ * @description
7
+ * A press moves the whole page to the other color mode. By default the new
8
+ * mode spreads in a circle from the button. `transition` picks another way:
9
+ * `wipe` draws it across from the inline start, `fade` fades it over the old,
10
+ * and `none` changes it at once.
11
+ *
12
+ * **The choice is the page's**, held on the document element as
13
+ * `data-color-mode`, which is the one thing `helix.css` decides the mode by.
14
+ * Two of these on one page agree, and a page can set the mode in its markup,
15
+ * or from its own code with `setColorMode` from `@fusion.dev/helix-core`,
16
+ * which takes the same transitions. With no attribute the page follows the
17
+ * reader's system setting, and the button says which mode that is. To keep a
18
+ * reader's choice across visits, listen for `change` and write the mode into
19
+ * the page you serve next.
20
+ *
21
+ * **The one Helix component that starts a view transition.** A view transition
22
+ * draws the whole document twice and runs between the two pictures, so a
23
+ * component that started one for its own sake would cancel the page's, or
24
+ * have its own canceled. The color mode is the document's own state, so
25
+ * changing it is the one move that is the document's to make. Where the
26
+ * reader asked for reduced motion, or the browser has no view transitions,
27
+ * the mode changes at once.
28
+ *
29
+ * It is a toggle button: a `<button>` that says whether the page is dark with
30
+ * `aria-pressed`, under one name, `label`, whichever way it stands. Its icon
31
+ * shows what a press does next: the moon while the page is light, and the sun
32
+ * while it is dark.
33
+ *
34
+ * @since 0.241.0
35
+ * @status experimental
36
+ * @category actions
37
+ * @aliases Dark mode toggle, Color mode switch, Light and dark switch, Theme switcher
38
+ * @documentation https://fusion.dev/helix/components/theme-toggle
39
+ *
40
+ * @slot - The button's text, where it shows more than its icon. Defaults to nothing, the icon alone, named by `label`.
41
+ * @slot icon - Replaces the icon, which is the moon while the page is light and the sun while it is dark.
42
+ *
43
+ * @event {Event} change - Fired once a press has switched the page's color mode.
44
+ *
45
+ * @csspart button - The toggle button, with `aria-pressed` while the page is dark.
46
+ * @csspart icon - The icon inside the button.
47
+ *
48
+ * @cssproperty --theme-toggle-origin-x - Where a `circle` spreads from, across the viewport, while it runs. Written on the document element.
49
+ * @cssproperty --theme-toggle-origin-y - Where a `circle` spreads from, down the viewport, while it runs. Written on the document element.
50
+ * @cssproperty --theme-toggle-radius - How far a `circle` reaches, to the viewport's furthest corner, while it runs. Written on the document element.
51
+ *
52
+ * @cssstate dark - The page is in dark mode.
53
+ *
54
+ * @interactive button
55
+ */
56
+ export declare class HelixHeadlessThemeToggle extends HelixElement {
57
+ /**
58
+ * The key this family's words are registered under, its styled tag:
59
+ * `registerWords('de', { 'helix-theme-toggle': { fallbackLabel: 'Dunkler Modus' } })`.
60
+ */
61
+ static words: string;
62
+ /** The name the element gives itself where `label` is empty. */
63
+ fallbackLabel: string;
64
+ /**
65
+ * The button's name, which stays the same whichever way it stands.
66
+ *
67
+ * Empty by default, which leaves the name to `fallbackLabel`.
68
+ */
69
+ label: string;
70
+ /**
71
+ * How the page moves to the other mode: `circle` from the button, `wipe`
72
+ * across from the inline start, `fade`, or `none`.
73
+ *
74
+ * Absent is `circle`.
75
+ */
76
+ transition?: ColorModeTransition;
77
+ /** The page's mode, kept with the document element's attribute and the reader's setting. */
78
+ private mode;
79
+ /** What stops hearing the page's mode. */
80
+ private unheard;
81
+ connectedCallback(): void;
82
+ disconnectedCallback(): void;
83
+ protected updated(): void;
84
+ /** Switches the page to the other mode, spreading from the middle of the button. */
85
+ private readonly toggle;
86
+ protected render(): TemplateResult;
87
+ /**
88
+ * The icon the `icon` slot falls back to: the moon while the page is light,
89
+ * and the sun while it is dark, which is what a press does next. A tier
90
+ * above draws its own here.
91
+ */
92
+ protected renderIcon(): TemplateResult;
93
+ }
94
+ declare global {
95
+ interface HTMLElementTagNameMap {
96
+ 'helix-headless-theme-toggle': HelixHeadlessThemeToggle;
97
+ }
98
+ }