@fusion.dev/helix-headless 0.236.0 → 0.237.1

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 (119) hide show
  1. package/api.json +1 -1
  2. package/custom-elements.json +1 -1
  3. package/dist/app-header/root/app-header-root.d.ts +9 -0
  4. package/dist/app-header/root/app-header-root.js +21 -0
  5. package/dist/area-chart/root/area-chart-root.d.ts +29 -15
  6. package/dist/area-chart/root/area-chart-root.js +10 -7
  7. package/dist/bar-chart/root/bar-chart-root.d.ts +41 -23
  8. package/dist/bar-chart/root/bar-chart-root.js +15 -10
  9. package/dist/button/root/button-root.js +1 -1
  10. package/dist/canvas/root/canvas-root.d.ts +10 -3
  11. package/dist/canvas/root/canvas-root.js +31 -14
  12. package/dist/color-input/root/color-input-root.d.ts +4 -2
  13. package/dist/color-input/root/color-input-root.js +1 -1
  14. package/dist/combobox/root/combobox-root.d.ts +8 -7
  15. package/dist/combobox/root/combobox-root.js +7 -3
  16. package/dist/command/root/command-root.d.ts +22 -2
  17. package/dist/command/root/command-root.js +39 -5
  18. package/dist/data-table/root/data-table-root.d.ts +10 -7
  19. package/dist/data-table/root/data-table-root.js +6 -1
  20. package/dist/date-picker/root/date-picker-root.d.ts +1 -1
  21. package/dist/date-picker/root/date-picker-root.js +9 -2
  22. package/dist/dialog/root/dialog-root.d.ts +13 -3
  23. package/dist/dialog/root/dialog-root.js +33 -2
  24. package/dist/donut-chart/root/donut-chart-root.d.ts +23 -1
  25. package/dist/donut-chart/root/donut-chart-root.js +41 -13
  26. package/dist/drawer/root/drawer-root.d.ts +10 -2
  27. package/dist/drawer/root/drawer-root.js +34 -1
  28. package/dist/filter-input/chip/filter-chip.js +2 -2
  29. package/dist/find/root/find-root.d.ts +11 -1
  30. package/dist/find/root/find-root.js +11 -0
  31. package/dist/heatmap/root/heatmap-root.d.ts +11 -8
  32. package/dist/heatmap/root/heatmap-root.js +27 -2
  33. package/dist/kbd/root/kbd-root.d.ts +4 -0
  34. package/dist/kbd/root/kbd-root.js +2 -1
  35. package/dist/lightbox/root/lightbox-root.js +3 -2
  36. package/dist/line-chart/root/line-chart-root.d.ts +36 -23
  37. package/dist/line-chart/root/line-chart-root.js +20 -13
  38. package/dist/list/item/list-item.d.ts +2 -1
  39. package/dist/list/item/list-item.js +4 -1
  40. package/dist/list/root/list-root.d.ts +33 -8
  41. package/dist/list/root/list-root.js +17 -3
  42. package/dist/listbox/root/listbox-root.d.ts +48 -15
  43. package/dist/listbox/root/listbox-root.js +65 -6
  44. package/dist/map/root/map-root.js +7 -7
  45. package/dist/markdown/tree.d.ts +6 -1
  46. package/dist/markdown/tree.js +1 -1
  47. package/dist/megamenu/root/megamenu-root.d.ts +19 -0
  48. package/dist/megamenu/root/megamenu-root.js +24 -0
  49. package/dist/menu/filter/menu-filter.js +3 -1
  50. package/dist/menu/item/menu-item.d.ts +12 -0
  51. package/dist/menu/item/menu-item.js +3 -0
  52. package/dist/menu/root/menu-root.d.ts +7 -1
  53. package/dist/menu/root/menu-root.js +6 -3
  54. package/dist/motion-toggle/root/motion-toggle-root.js +2 -2
  55. package/dist/notifications/notification/notification.d.ts +1 -0
  56. package/dist/notifications/notification/notification.js +1 -0
  57. package/dist/notifications/root/notifications-root.d.ts +7 -5
  58. package/dist/notifications/root/notifications-root.js +1 -1
  59. package/dist/number-input/root/number-input-root.d.ts +6 -0
  60. package/dist/number-input/root/number-input-root.js +14 -4
  61. package/dist/object-inspector/root/object-inspector-root.d.ts +6 -5
  62. package/dist/object-inspector/root/object-inspector-root.js +9 -3
  63. package/dist/option/root/option-root.d.ts +14 -0
  64. package/dist/option/root/option-root.js +3 -0
  65. package/dist/pagination/root/pagination-root.d.ts +36 -0
  66. package/dist/pagination/root/pagination-root.js +55 -2
  67. package/dist/pin-input/code.js +1 -1
  68. package/dist/qr-code/root/qr-code-root.d.ts +1 -0
  69. package/dist/qr-code/root/qr-code-root.js +1 -0
  70. package/dist/rating/root/rating-root.d.ts +1 -0
  71. package/dist/rating/root/rating-root.js +1 -0
  72. package/dist/scatter-chart/root/scatter-chart-root.d.ts +6 -0
  73. package/dist/select/root/select-root.d.ts +27 -1
  74. package/dist/select/root/select-root.js +34 -3
  75. package/dist/shortcut-overlay/root/shortcut-overlay-root.d.ts +5 -0
  76. package/dist/shortcut-overlay/root/shortcut-overlay-root.js +15 -1
  77. package/dist/skeleton/root/skeleton-root.d.ts +1 -0
  78. package/dist/skeleton/root/skeleton-root.js +3 -0
  79. package/dist/sparkline/root/sparkline-root.d.ts +53 -0
  80. package/dist/sparkline/root/sparkline-root.js +37 -1
  81. package/dist/spatial-bar-chart/root/spatial-bar-chart-root.d.ts +4 -1
  82. package/dist/spatial-bar-chart/root/spatial-bar-chart-root.js +2 -2
  83. package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.d.ts +3 -0
  84. package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.js +2 -2
  85. package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +3 -0
  86. package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.js +2 -2
  87. package/dist/spatial-scatter-chart/view.d.ts +17 -8
  88. package/dist/spatial-scatter-chart/view.js +7 -6
  89. package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +3 -0
  90. package/dist/spatial-surface-chart/root/spatial-surface-chart-root.js +2 -2
  91. package/dist/spatial-treemap/root/spatial-treemap-root.d.ts +3 -0
  92. package/dist/spatial-treemap/root/spatial-treemap-root.js +2 -2
  93. package/dist/splitter/root/splitter-root.js +3 -1
  94. package/dist/stat/group/stat-group.d.ts +13 -0
  95. package/dist/stat/group/stat-group.js +22 -1
  96. package/dist/stat/root/stat-root.d.ts +62 -1
  97. package/dist/stat/root/stat-root.js +146 -4
  98. package/dist/table/cell/table-cell.d.ts +1 -0
  99. package/dist/table/cell/table-cell.js +4 -0
  100. package/dist/table/root/table-root.d.ts +7 -6
  101. package/dist/table/root/table-root.js +1 -1
  102. package/dist/tabs/tab/tab.js +2 -2
  103. package/dist/tag/root/tag-root.js +2 -2
  104. package/dist/timeline/root/timeline-root.d.ts +2 -2
  105. package/dist/timeline/root/timeline-root.js +1 -1
  106. package/dist/toast/root/toast-root.d.ts +53 -6
  107. package/dist/toast/root/toast-root.js +158 -1
  108. package/dist/toggle/root/toggle-root.d.ts +1 -0
  109. package/dist/toggle/root/toggle-root.js +1 -1
  110. package/dist/video-playlist/root/video-playlist-root.d.ts +1 -0
  111. package/dist/video-playlist/root/video-playlist-root.js +2 -0
  112. package/dist/virtual-list/root/virtual-list-root.d.ts +2 -2
  113. package/dist/virtual-list/root/virtual-list-root.js +1 -1
  114. package/examples.json +1 -1
  115. package/lint.json +1 -1
  116. package/package.json +5 -5
  117. package/types/jsx.d.ts +633 -168
  118. package/types/vue.d.ts +379 -95
  119. package/types/words.d.ts +51 -12
@@ -78,9 +78,9 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
78
78
  * @documentation https://fusion.dev/helix/components/combobox
79
79
  *
80
80
  * @slot - The options.
81
- * @slot empty - What the list shows when typing hides every option, for content richer than `empty-text`.
81
+ * @slot empty - What the list shows when it has no options, for content richer than `empty-text`.
82
82
  * @slot end - After the text, for a unit or a clear button.
83
- * @slot error - What the list shows while `error-text` is set, for content richer than its text.
83
+ * @slot error - Content the list shows after `error-text` while it is set, such as a button that tries again.
84
84
  * @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
85
85
  * @slot hint - The hint, for content richer than plain text.
86
86
  * @slot indicator - Replaces the caret that shows the field opens a list.
@@ -109,7 +109,7 @@ declare const HelixHeadlessCombobox_base: (new (...args: any[]) => import("@fusi
109
109
  * @csspart indicator - The caret.
110
110
  * @csspart label - The label above the field.
111
111
  * @csspart listbox - The list inside the panel.
112
- * @csspart listbox-empty - Shown when a filter has hidden everything.
112
+ * @csspart listbox-empty - Shown when the list has no options, or typing has hidden every one.
113
113
  * @csspart listbox-error - Shown while `error-text` is set.
114
114
  * @csspart listbox-feedback - The inner list's error message.
115
115
  * @csspart listbox-filter-icon - The icon beside the list's filter field.
@@ -150,7 +150,7 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
150
150
  protected readonly listed: ListedController;
151
151
  /**
152
152
  * The key this family's words are registered under, its styled tag:
153
- * `registerWords('de', { 'helix-combobox': { emptyText: 'Keine Treffer' } })`.
153
+ * `registerWords('de', { 'helix-combobox': { noResultsText: 'Keine Treffer' } })`.
154
154
  */
155
155
  static words: string;
156
156
  protected readonly aria: AriaForwardController;
@@ -206,7 +206,8 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
206
206
  */
207
207
  createLabel: string;
208
208
  /**
209
- * Text shown when the filter hides every option.
209
+ * The text shown when the list has no options. Typing that hides every
210
+ * option shows `no-results-text`.
210
211
  */
211
212
  emptyText: string;
212
213
  /**
@@ -287,9 +288,9 @@ export declare class HelixHeadlessCombobox extends HelixHeadlessCombobox_base {
287
288
  multiple: boolean;
288
289
  /**
289
290
  * The text shown when typing hides every one of the options, where there are
290
- * some. Absent, `empty-text` shows. See Listbox's `no-results-text`.
291
+ * some. See Listbox's `no-results-text`.
291
292
  */
292
- noResultsText?: string;
293
+ noResultsText: string;
293
294
  /**
294
295
  * What opens the list: `input`, typing or pressing Down; `focus`, also
295
296
  * arriving in the field, by Tab or a press; or `manual`, only Down, Alt+Down
@@ -24,7 +24,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
24
24
  this.autocomplete = 'off';
25
25
  this.creatable = false;
26
26
  this.createLabel = 'Add "{value}"';
27
- this.emptyText = 'No matches';
27
+ this.emptyText = 'No options';
28
28
  this.errorText = '';
29
29
  this.filterDelay = 0;
30
30
  this.listLabel = 'Options';
@@ -32,6 +32,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
32
32
  this.loadingText = 'Loading';
33
33
  this.locale = '';
34
34
  this.multiple = false;
35
+ this.noResultsText = 'No matches';
35
36
  this.openOn = 'input';
36
37
  this.placeholder = '';
37
38
  this.readOnly = false;
@@ -596,7 +597,7 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
596
597
  empty-text=${this.emptyText}
597
598
  error-text=${this.loadError || this.errorText}
598
599
  loading-text=${this.loadingText}
599
- no-results-text=${this.noResultsText ?? nothing}
600
+ no-results-text=${this.noResultsText}
600
601
  lang=${handedLocale(this) || nothing}
601
602
  result-label=${this.resultLabel ?? ''}
602
603
  results-label=${this.resultsLabel}
@@ -613,7 +614,9 @@ let HelixHeadlessCombobox = class HelixHeadlessCombobox extends MixinControllerO
613
614
  <slot @slotchange=${() => this.requestUpdate()}></slot>
614
615
  <slot name="empty" slot="empty">${this.emptyText}</slot>
615
616
  <slot name="loading" slot="loading">${this.loadingText}</slot>
616
- <slot name="error" slot="error">${this.loadError || this.errorText}</slot>
617
+ <!-- No fallback: the list shows the error words itself and this slot
618
+ after them, so words here would say them twice. -->
619
+ <slot name="error" slot="error"></slot>
617
620
  <slot
618
621
  name="no-results"
619
622
  slot=${this.querySelector?.(':scope > [slot="no-results"]') ? 'no-results' : nothing}
@@ -752,6 +755,7 @@ __decorate([
752
755
  property({ type: Boolean })
753
756
  ], HelixHeadlessCombobox.prototype, "multiple", void 0);
754
757
  __decorate([
758
+ words,
755
759
  property({ attribute: 'no-results-text' })
756
760
  ], HelixHeadlessCombobox.prototype, "noResultsText", void 0);
757
761
  __decorate([
@@ -51,7 +51,10 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
51
51
  * **Keyboard.** Focus goes to the filter field as the palette opens, with no
52
52
  * command highlighted, as in React Aria's Autocomplete, so Enter runs nothing
53
53
  * until you type or press Down. Typing highlights the first command left, and
54
- * the highlight moves through the commands while you type.
54
+ * the highlight moves through the commands while you type. Emptying the filter
55
+ * puts the list back as it opened, with no command highlighted and the list at
56
+ * its top. Escape clears the filter before it closes the palette, so a hint
57
+ * for Escape in the `footer` slot says Clear while the filter holds text.
55
58
  *
56
59
  * | Key | What it does |
57
60
  * |---|---|
@@ -93,7 +96,7 @@ declare const HelixHeadlessCommand_base: (new (...args: any[]) => import("@fusio
93
96
  *
94
97
  * @slot - The commands, and any groups of them.
95
98
  * @slot empty - What the palette shows when typing matches no commands, for content richer than `empty-text`.
96
- * @slot error - What the palette shows while `error-text` is set, for content richer than its text.
99
+ * @slot error - Content the palette shows after `error-text` while it is set, such as a button that tries again.
97
100
  * @slot filter-icon - Replaces the magnifying glass in the filter field.
98
101
  * @slot footer - Content under the list, such as the keys that work in the palette.
99
102
  * @slot header - Content above the filter field, such as a title or the scope being searched. A heading here does not rename the palette, which `label` names.
@@ -436,6 +439,23 @@ export declare class HelixHeadlessCommand extends HelixHeadlessCommand_base {
436
439
  * filter is applied, so the list's update is waited for a turn later.
437
440
  */
438
441
  private readonly handleFilter;
442
+ /** Counts filter events, so a start over waits on the latest one only. */
443
+ private filterTurn;
444
+ /** Whether the next emptied filter is an Escape a reader pressed at a query. */
445
+ private escaping;
446
+ /** Notes an Escape pressed while something is typed, before the list clears it. */
447
+ private readonly noteEscape;
448
+ /**
449
+ * Puts the full list back as an opening shows it: no command highlighted,
450
+ * and the list at its top.
451
+ *
452
+ * **An emptied filter is the list a reader opened**, so it looks the same.
453
+ * After Escape cleared a query, the first command left by the query stayed
454
+ * highlighted and the list stayed scrolled about 22 pixels down, cutting the
455
+ * first group's heading, where the same list on opening had no highlight and
456
+ * its heading in full.
457
+ */
458
+ private startOver;
439
459
  /** Whether a child fills the named slot, so it is handed on to the dialog or the list. */
440
460
  private fills;
441
461
  protected updated(changed: PropertyValues): void;
@@ -125,10 +125,25 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
125
125
  if (this.typed.trim() === '' && typed.trim() !== '') {
126
126
  this.readControls();
127
127
  }
128
+ const emptied = this.typed !== '' && typed === '';
129
+ const cleared = this.escaping;
130
+ this.escaping = false;
128
131
  this.typed = typed;
132
+ this.filterTurn += 1;
133
+ const turn = this.filterTurn;
129
134
  void Promise.resolve()
130
135
  .then(() => this.listbox?.updateComplete)
131
- .then(() => this.markStatus());
136
+ .then(() => {
137
+ this.markStatus();
138
+ if (emptied && cleared && turn === this.filterTurn) {
139
+ this.startOver();
140
+ }
141
+ });
142
+ };
143
+ this.filterTurn = 0;
144
+ this.escaping = false;
145
+ this.noteEscape = (event) => {
146
+ this.escaping = event.key === 'Escape' && this.typed !== '';
132
147
  };
133
148
  }
134
149
  static { this.words = 'helix-command'; }
@@ -174,6 +189,7 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
174
189
  auditChildren(this, 'listbox', 'listbox', 'the palette has no working list', true);
175
190
  this.addEventListener('helix-before-select', this.swallowOptionSelect);
176
191
  this.addEventListener('keydown', this.handleAlternate, { capture: true });
192
+ this.addEventListener('keydown', this.noteEscape, { capture: true });
177
193
  this.addEventListener('keydown', this.handleBack);
178
194
  this.addEventListener('click', this.handleAlternate, { capture: true });
179
195
  document.addEventListener('keydown', this.handleHotkey);
@@ -188,6 +204,7 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
188
204
  this.unregister?.();
189
205
  this.removeEventListener('helix-before-select', this.swallowOptionSelect);
190
206
  this.removeEventListener('keydown', this.handleAlternate, { capture: true });
207
+ this.removeEventListener('keydown', this.noteEscape, { capture: true });
191
208
  this.removeEventListener('keydown', this.handleBack);
192
209
  this.removeEventListener('click', this.handleAlternate, { capture: true });
193
210
  document.removeEventListener('keydown', this.handleHotkey);
@@ -224,6 +241,17 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
224
241
  this.toggleState('empty', settled && !shown);
225
242
  this.toggleState('no-results', settled && list.filter !== '' && options.length > 0 && !shown);
226
243
  }
244
+ startOver() {
245
+ const list = this.listbox;
246
+ if (!list || this.typed !== '' || list.filter !== '') {
247
+ return;
248
+ }
249
+ list.highlight('none');
250
+ const items = list.shadowRoot?.querySelector('[part="items"]');
251
+ if (items) {
252
+ items.scrollTop = 0;
253
+ }
254
+ }
227
255
  fills(name) {
228
256
  return this.querySelector?.(`:scope > [slot="${name}"]`) != null;
229
257
  }
@@ -311,7 +339,7 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
311
339
  filter-label=${this.placeholder}
312
340
  error-text=${this.loadError || this.errorText}
313
341
  loading-text=${this.loadingText}
314
- no-results-text=${this.noResultsText ?? nothing}
342
+ no-results-text=${this.noResultsText ?? this.emptyText}
315
343
  result-label=${this.resultLabel ?? ''}
316
344
  results-label=${this.resultsLabel}
317
345
  ?loading=${this.loading}
@@ -328,10 +356,16 @@ let HelixHeadlessCommand = class HelixHeadlessCommand extends MixinControllerOpe
328
356
  ${this.page === '' ? html `<slot></slot>` : html `<slot name=${`page:${this.page}`}></slot>`}
329
357
  ${this.renderControls()}
330
358
  <!-- Handed on with the text as the fallback, for the reason Combobox
331
- gives: the list's own fallback never shows behind a passed slot. -->
332
- <slot name="empty" slot="empty">${this.emptyText}</slot>
359
+ gives: the list's own fallback never shows behind a passed slot.
360
+ The palette's empty line is what typing that matches nothing
361
+ shows, so it goes to the list's no-results line unless the
362
+ no-results slot is filled. With no commands at all, the list's
363
+ own empty line says empty-text. -->
364
+ <slot name="empty" slot=${this.fills('no-results') ? 'empty' : 'no-results'}>${this.emptyText}</slot>
333
365
  <slot name="loading" slot="loading">${this.loadingText}</slot>
334
- <slot name="error" slot="error">${this.loadError || this.errorText}</slot>
366
+ <!-- No fallback: the list shows the error words itself and this slot
367
+ after them, so words here would say them twice. -->
368
+ <slot name="error" slot="error"></slot>
335
369
  <!-- Handed on only while something fills it: an assigned slot hides the
336
370
  list's own fallback, which is no-results-text or empty-text. -->
337
371
  <slot
@@ -112,9 +112,10 @@ declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fus
112
112
  * next rows to `rows`, and set `loading` while they are on their way.
113
113
  *
114
114
  * When a fetch fails, set `error-text`, such as "The files did not load", and
115
- * put a button that tries again in the `error` slot. The line shows after the
116
- * rows in place of the empty and loading lines, the live region says it, and
117
- * the table takes the `error` state. Clear it once you try again.
115
+ * put a button that tries again in the `error` slot. The line shows the words
116
+ * and then the button, after the rows in place of the empty and loading lines,
117
+ * the live region says it, and the table takes the `error` state. Clear it
118
+ * once you try again.
118
119
  *
119
120
  * The controls inside the cells leave the tab order, so Tab moves past the
120
121
  * whole grid. A windowed table keeps the row holding focus drawn while the
@@ -196,7 +197,7 @@ declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fus
196
197
  *
197
198
  * @slot - The columns, as `TableColumn` elements, and the first page served as `TableRow` elements, which show until `rows` holds a row.
198
199
  * @slot empty - Content shown when there are no rows to show and none are loading, such as a picture and a link. Falls back to `empty-text`, which the live region still says.
199
- * @slot error - Content shown while `error-text` is set, such as a button that tries again. Falls back to `error-text`, which the live region still says.
200
+ * @slot error - Content shown after `error-text` while it is set, such as a button that tries again.
200
201
  * @slot footer - Content below the grid. It replaces the built-in pagination.
201
202
  * @slot loading - Content shown while the rows load, such as a spinner. Falls back to `loading-text`, which the live region still says.
202
203
  * @slot toolbar - Content above the grid, such as a search field or actions.
@@ -415,9 +416,9 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
415
416
  * files did not load". Set it when a fetch fails, and clear it once you try
416
417
  * again. Empty, the default, shows nothing.
417
418
  *
418
- * While it is set, a line after the rows shows it, or your own content in the
419
- * `error` slot, in place of the empty and loading lines, and the live region
420
- * says it.
419
+ * While it is set, a line after the rows shows it, followed by your own
420
+ * content in the `error` slot, in place of the empty and loading lines, and
421
+ * the live region says it.
421
422
  */
422
423
  errorText: string;
423
424
  /**
@@ -1424,6 +1425,8 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
1424
1425
  * the table has, whatever the rows hold, since it scrolls them.
1425
1426
  */
1426
1427
  private watchSize;
1428
+ /** Watches the table's own children, which the manual slots need to be told about. */
1429
+ private arrivals;
1427
1430
  disconnectedCallback(): void;
1428
1431
  /**
1429
1432
  * Notes whether Shift is held, before the press reaches a checkbox, whose
@@ -1455,7 +1455,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1455
1455
  </div>`;
1456
1456
  }
1457
1457
  renderError() {
1458
- return html `<p part="error" role="row"><span role="gridcell"><slot name="error">${this.errorText}</slot></span></p>`;
1458
+ return html `<p part="error" role="row"><span role="gridcell">${this.errorText}<slot name="error"></slot></span></p>`;
1459
1459
  }
1460
1460
  render() {
1461
1461
  const { available, matched, page } = this.view;
@@ -1545,6 +1545,10 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1545
1545
  this.addEventListener('keydown', this.handleGridKey);
1546
1546
  this.addEventListener('keydown', this.handleGripKey);
1547
1547
  this.addEventListener('helix-before-resize', this.handleResize);
1548
+ if (typeof MutationObserver !== 'undefined') {
1549
+ this.arrivals ??= new MutationObserver(() => this.assign());
1550
+ this.arrivals.observe(this, { childList: true });
1551
+ }
1548
1552
  this.watchSize();
1549
1553
  }
1550
1554
  firstUpdated(changed) {
@@ -1572,6 +1576,7 @@ let HelixHeadlessDataTable = class HelixHeadlessDataTable extends MixinCollectio
1572
1576
  this.removeEventListener('keydown', this.handleGridKey);
1573
1577
  this.removeEventListener('keydown', this.handleGripKey);
1574
1578
  this.removeEventListener('helix-before-resize', this.handleResize);
1579
+ this.arrivals?.disconnect();
1575
1580
  this.sizeObserver?.disconnect();
1576
1581
  }
1577
1582
  rowPartsOf(row, index) {
@@ -98,7 +98,7 @@ declare const HelixHeadlessDatePicker_base: (new (...args: any[]) => import("@fu
98
98
  * @csspart previous-mark - The glyph on the previous month control, where none is slotted.
99
99
  * @csspart selection - The chosen date or range in words, which screen readers hear when it changes. Drawn for screen readers only.
100
100
  * @csspart week - One row of days.
101
- * @csspart weekday - A column header naming a day of the week. It shows the short name and says the full one.
101
+ * @csspart weekday - A column header naming a day of the week. It shows the short name, or the narrow one where short names are long, and says the full one.
102
102
  *
103
103
  * @cssproperty --date-picker-column-count - How many month columns are drawn, capped at two. `--date-picker-columns` overrides it.
104
104
  *
@@ -18,6 +18,11 @@ const KEYS = new Set([
18
18
  ' ',
19
19
  ]);
20
20
  const firstOf = (year, month) => addMonths(asDate('2000-01-01'), (year - 2000) * 12 + month);
21
+ const columnHeads = (utc) => {
22
+ const short = utc({ weekday: 'short' });
23
+ const long = Array.from({ length: 7 }, (_, day) => short.format(Date.UTC(2026, 0, 4 + day))).some((name) => [...name].length > 4);
24
+ return long ? utc({ weekday: 'narrow' }) : short;
25
+ };
21
26
  let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerFeedback(MixinControllerValue(HelixFormElement)) {
22
27
  constructor() {
23
28
  super(...arguments);
@@ -282,7 +287,9 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
282
287
  this.previewed = '';
283
288
  this.show(date);
284
289
  this.updateComplete.then(() => {
285
- this.renderRoot.querySelector('[part~="cell"][tabindex="0"]')?.focus();
290
+ this.renderRoot
291
+ .querySelector('[part~="cell"][tabindex="0"]')
292
+ ?.focus({ preventScroll: true });
286
293
  });
287
294
  }
288
295
  select(date) {
@@ -579,7 +586,7 @@ let HelixHeadlessDatePicker = class HelixHeadlessDatePicker extends MixinPickerF
579
586
  long: utc({ dateStyle: 'long' }),
580
587
  monthName: utc({ month: 'short' }),
581
588
  monthYear: utc({ month: 'short', year: 'numeric' }),
582
- weekday: utc({ weekday: 'short' }),
589
+ weekday: columnHeads(utc),
583
590
  weekdayName: utc({ weekday: 'long' }),
584
591
  year: utc({ year: 'numeric' }),
585
592
  };
@@ -36,8 +36,10 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
36
36
  *
37
37
  * Set `alert` for a dialog that interrupts to ask for an answer, such as a
38
38
  * confirmation before a deletion. It is an `alertdialog`, which a screen reader
39
- * announces with its description as it opens. Set `dismissible` to draw a
40
- * close control, labeled by `dismiss-label`.
39
+ * announces with its description as it opens. Put the action that dismisses
40
+ * first in the footer, with `autofocus`, so focus starts on the action that
41
+ * destroys nothing. Set
42
+ * `dismissible` to draw a close control, labeled by `dismiss-label`.
41
43
  *
42
44
  * **Keyboard.** Opening moves focus to the first control in the dialog.
43
45
  *
@@ -57,7 +59,7 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
57
59
  *
58
60
  * @slot - The dialog's content.
59
61
  * @slot dismiss-icon - Replaces the glyph inside the close control.
60
- * @slot footer - The dialog's actions.
62
+ * @slot footer - The dialog's actions, written in the order they are drawn: the one that dismisses first, and the primary one last, at the trailing edge.
61
63
  * @slot header - The title, and anything beside it.
62
64
  * @slot icon - An icon above the title, for a warning dialog.
63
65
  *
@@ -76,6 +78,7 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
76
78
  * @cssstate entering - From the moment the dialog opens until its entrance has finished.
77
79
  * @cssstate exiting - From the moment the dialog closes until its exit has finished.
78
80
  * @cssstate open - While the dialog is open.
81
+ * @cssstate stacked - While the dialog is open over another modal surface that does not hold it, such as a second Dialog or a Drawer.
79
82
  */
80
83
  export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
81
84
  /**
@@ -234,6 +237,13 @@ export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
234
237
  connectedCallback(): void;
235
238
  disconnectedCallback(): void;
236
239
  protected updated(changed: PropertyValues): void;
240
+ /**
241
+ * Whether a modal surface opened before this one is still holding the page
242
+ * and is not an ancestor of this one. A dialog written inside another already
243
+ * takes the panel's raised rungs; one opened beside it does not, and in dark
244
+ * the two were one fill under the scrim, measured 1.07:1.
245
+ */
246
+ private overAnother;
237
247
  /** Opens once anything slotted has had its first render. See `updated`. */
238
248
  private openWhenSlotted;
239
249
  /**
@@ -1,9 +1,18 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, auditName, CommandController, customElement, drawDismiss, drawDismissGlyph, FocusScopeController, focusableElements, HelixElement, headingsIn, hostAria, internalsOf, lockScroll, MixinControllerOpen, OpenPhaseController, reflectElements, unlockScroll, words, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, auditName, autofocusTarget, CommandController, coversPress, customElement, drawDismiss, drawDismissGlyph, FocusScopeController, focusAs, focusableElements, HelixElement, headingsIn, hostAria, internalsOf, lockScroll, MixinControllerOpen, OpenPhaseController, openingFocus, raiseAbove, reflectElements, refocusWithin, scrollHolders, unlockScroll, words, } from '@fusion.dev/helix-core';
3
3
  import { html, nothing } from 'lit';
4
4
  import { property } from 'lit/decorators.js';
5
5
  import { wordsIn } from '../description.js';
6
6
  import { closeOnDialogSubmit, commandValue } from '../form-method.js';
7
+ const holds = (outer, inner) => {
8
+ for (let node = inner; node;) {
9
+ if (node === outer) {
10
+ return true;
11
+ }
12
+ node = node instanceof ShadowRoot ? node.host : (node.parentNode ?? null);
13
+ }
14
+ return false;
15
+ };
7
16
  let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(HelixElement) {
8
17
  constructor() {
9
18
  super(...arguments);
@@ -64,6 +73,9 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
64
73
  if (!panel || event.target !== panel) {
65
74
  return;
66
75
  }
76
+ if (coversPress(event)) {
77
+ return;
78
+ }
67
79
  const box = panel.getBoundingClientRect();
68
80
  if (event.clientX >= box.left &&
69
81
  event.clientX <= box.right &&
@@ -139,6 +151,7 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
139
151
  else {
140
152
  unlockScroll(this);
141
153
  }
154
+ this.toggleState('stacked', this.open && this.overAnother());
142
155
  const dialog = this.dialog;
143
156
  if (!dialog) {
144
157
  return;
@@ -155,16 +168,34 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
155
168
  dialog.close();
156
169
  }
157
170
  }
171
+ overAnother() {
172
+ const holders = scrollHolders();
173
+ const at = holders.indexOf(this);
174
+ return holders.slice(0, at < 0 ? holders.length : at).some((one) => !holds(one, this));
175
+ }
158
176
  async openWhenSlotted(dialog) {
177
+ const focusing = openingFocus();
159
178
  await Promise.all([...this.children]
160
179
  .map((one) => one.updateComplete)
161
180
  .filter((one) => one instanceof Promise));
162
181
  if (this.open && !dialog.open && this.isConnected) {
163
182
  dialog.showModal();
183
+ raiseAbove();
184
+ const marked = await autofocusTarget(this);
185
+ if (marked && this.open && dialog.open) {
186
+ focusAs(marked, focusing);
187
+ return;
188
+ }
164
189
  const chose = this.matches(':focus-within') &&
165
190
  !(this.renderRoot instanceof ShadowRoot && this.renderRoot.activeElement === dialog);
166
191
  if (!chose) {
167
- focusableElements(this)[0]?.focus();
192
+ const first = focusableElements(this)[0];
193
+ if (first) {
194
+ focusAs(first, focusing);
195
+ }
196
+ }
197
+ else {
198
+ refocusWithin(this, focusing);
168
199
  }
169
200
  }
170
201
  }
@@ -44,6 +44,9 @@ declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args:
44
44
  * `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
45
45
  * there until readings arrive. The `empty` and `loading` slots take markup in
46
46
  * their place.
47
+ * When the readings did not load, set `error-text`, such as "The visits did
48
+ * not load": it stands in the plot in place of both, and the `error` slot
49
+ * takes a button that tries again, shown after the words.
47
50
  *
48
51
  * **Keyboard.** The plot is one tab stop.
49
52
  *
@@ -63,6 +66,7 @@ declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args:
63
66
  *
64
67
  * @slot - Content in the middle of the ring, usually a total. It is read by screen readers, while the ring itself is hidden from them.
65
68
  * @slot empty - Content shown in place of the ring when the table has no readings. Falls back to `empty-text`.
69
+ * @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
66
70
  * @slot loading - Content shown in place of the ring while `loading` is set and there are no readings yet. Falls back to `loading-text`.
67
71
  *
68
72
  * @event {HelixReadingChangeEvent} helix-reading-change - The slice shown moved, or was put away: `index` is the slice's row, or `-1` for none, with its `label` and the `pointerType` that moved it.
@@ -70,6 +74,7 @@ declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args:
70
74
  *
71
75
  * @csspart center - The middle of the ring, holding whatever is slotted.
72
76
  * @csspart empty - The words in place of the ring 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.
77
+ * @csspart error - The words in place of the ring while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
73
78
  * @csspart live - The readout: a polite live region that says the slice the keys moved to. Hide it visually.
74
79
  * @csspart loading - The words in place of the ring while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
75
80
  * @csspart mark - The invisible point the tooltip is anchored to.
@@ -104,6 +109,7 @@ declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args:
104
109
  *
105
110
  * @cssstate active - While a slice is shown, under the pointer or the keys, with its tooltip open.
106
111
  * @cssstate empty - While the `empty` part stands in place of the ring.
112
+ * @cssstate error - While the `error` part stands in place of the ring.
107
113
  * @cssstate loading - While the `loading` part stands in place of the ring.
108
114
  */
109
115
  export declare class HelixHeadlessDonutChart extends HelixHeadlessDonutChart_base {
@@ -244,6 +250,17 @@ export declare class HelixHeadlessDonutChart extends HelixHeadlessDonutChart_bas
244
250
  * left out here too.
245
251
  */
246
252
  protected renderSummary(shares: DonutShare[]): TemplateResult;
253
+ /**
254
+ * The plot with no readings to draw, the ring's track under the words.
255
+ *
256
+ * **The track stays**, so an empty donut is still a donut. The words alone
257
+ * stood in a blank square, which reads as a chart that did not draw, and the
258
+ * frame served before the readings arrive already drew the track: it went
259
+ * the moment the table turned out to be empty.
260
+ */
261
+ protected renderEmpty(): TemplateResult;
262
+ /** The whole ring the slices are drawn on. */
263
+ private renderTrack;
247
264
  /**
248
265
  * The ring itself, behind a seam the styled tier can move.
249
266
  *
@@ -271,7 +288,12 @@ export declare class HelixHeadlessDonutChart extends HelixHeadlessDonutChart_bas
271
288
  * numbers rather than a measurement.
272
289
  */
273
290
  private get frame();
274
- /** One slice, as a dash the length of its share. */
291
+ /**
292
+ * The seam each slice leaves at either end, as a length along the ring:
293
+ * half a `SEAM`, and none where one slice is the whole.
294
+ */
295
+ private get seam();
296
+ /** One slice, as a dash the length of its share, less the seam at each end. */
275
297
  protected renderSegment(share: DonutShare, index: number): TemplateResult;
276
298
  /**
277
299
  * The same slice again, as a shape with an inside.
@@ -19,6 +19,7 @@ const percentIn = (locale) => {
19
19
  const CENTER = PLOT_WIDTH / 2;
20
20
  const EDGE = 40;
21
21
  const GAP = 9999;
22
+ const SEAM = 0.8;
22
23
  const THICKNESS = {
23
24
  large: 8,
24
25
  medium: 16,
@@ -97,6 +98,36 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSt
97
98
  const listed = new Intl.ListFormat(locale, { style: 'short', type: 'unit' }).format(parts);
98
99
  return html `<p id="helix-chart-summary" part="summary">${named}${listed}.</p>`;
99
100
  }
101
+ renderEmpty() {
102
+ const named = this.named;
103
+ return html `<div
104
+ aria-label=${named || nothing}
105
+ id=${CHART_PLOT}
106
+ part="plot"
107
+ role=${named ? 'group' : nothing}
108
+ >
109
+ <svg
110
+ aria-hidden="true"
111
+ data-mirror=${this.sweep === 'half' ? '' : nothing}
112
+ viewBox=${this.frame}
113
+ xmlns="http://www.w3.org/2000/svg"
114
+ >
115
+ ${this.renderTrack()}
116
+ </svg>
117
+ ${this.renderStatus()}
118
+ </div>`;
119
+ }
120
+ renderTrack() {
121
+ return svg `<circle
122
+ cx=${CENTER}
123
+ cy=${CENTER}
124
+ fill="none"
125
+ part="track"
126
+ r=${this.radius}
127
+ stroke-dasharray="${2 * Math.PI * this.radius * this.span} ${GAP}"
128
+ stroke-width=${this.thickness}
129
+ />`;
130
+ }
100
131
  renderPlot(shares) {
101
132
  const drawn = shares.length > 0;
102
133
  return html `<div
@@ -115,15 +146,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSt
115
146
  viewBox=${this.frame}
116
147
  xmlns="http://www.w3.org/2000/svg"
117
148
  >
118
- <circle
119
- cx=${CENTER}
120
- cy=${CENTER}
121
- fill="none"
122
- part="track"
123
- r=${this.radius}
124
- stroke-dasharray="${2 * Math.PI * this.radius * this.span} ${GAP}"
125
- stroke-width=${this.thickness}
126
- />
149
+ ${this.renderTrack()}
127
150
  ${shares.map((share, index) => this.renderSegment(share, index))}
128
151
  </svg>
129
152
  ${this.hole === 'none' ? nothing : html `<div id="helix-chart-center" part="center"><slot></slot></div>`}
@@ -164,9 +187,13 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSt
164
187
  }
165
188
  return `0 ${CENTER - EDGE} ${PLOT_WIDTH} ${EDGE + this.thickness / 2}`;
166
189
  }
190
+ get seam() {
191
+ return this.shares.filter((share) => share.fraction > 0).length > 1 ? SEAM / 2 : 0;
192
+ }
167
193
  renderSegment(share, index) {
168
194
  const circumference = 2 * Math.PI * this.radius;
169
- const length = share.fraction * circumference * this.span;
195
+ const seam = this.seam;
196
+ const length = Math.max(0, share.fraction * circumference * this.span - seam * 2);
170
197
  const active = this.pointer.at === index;
171
198
  return svg `<circle
172
199
  cx=${CENTER}
@@ -188,14 +215,15 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSt
188
215
  part="segment${active ? ' segment-active' : ''}"
189
216
  r=${this.radius}
190
217
  stroke-dasharray="${length} ${GAP}"
191
- stroke-dashoffset=${-share.start * circumference * this.span}
218
+ stroke-dashoffset=${-(share.start * circumference * this.span + seam)}
192
219
  />
193
220
  ${this.renderEdge(share, index)}`;
194
221
  }
195
222
  renderEdge(share, index) {
196
223
  const turn = 2 * Math.PI * this.span;
197
- const from = share.start * turn + this.origin;
198
- const to = (share.start + share.fraction) * turn + this.origin;
224
+ const seam = Math.min(this.seam / this.radius, share.fraction * turn * 0.5);
225
+ const from = share.start * turn + this.origin + seam;
226
+ const to = (share.start + share.fraction) * turn + this.origin - seam;
199
227
  const outer = EDGE;
200
228
  const inner = EDGE - this.thickness;
201
229
  const at = (radius, angle) => `${(CENTER + Math.cos(angle) * radius).toFixed(3)} ${(CENTER + Math.sin(angle) * radius).toFixed(3)}`;