@fusion.dev/helix-headless 0.235.1 → 0.237.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 (126) 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 +15 -7
  19. package/dist/data-table/root/data-table-root.js +9 -2
  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 +16 -2
  64. package/dist/option/root/option-root.js +7 -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/radio/root/radio-root.js +4 -0
  71. package/dist/rating/root/rating-root.d.ts +1 -0
  72. package/dist/rating/root/rating-root.js +1 -0
  73. package/dist/scatter-chart/root/scatter-chart-root.d.ts +6 -0
  74. package/dist/select/root/select-root.d.ts +27 -1
  75. package/dist/select/root/select-root.js +34 -3
  76. package/dist/shortcut-overlay/root/shortcut-overlay-root.d.ts +5 -0
  77. package/dist/shortcut-overlay/root/shortcut-overlay-root.js +15 -1
  78. package/dist/skeleton/root/skeleton-root.d.ts +1 -0
  79. package/dist/skeleton/root/skeleton-root.js +3 -0
  80. package/dist/sparkline/root/sparkline-root.d.ts +53 -0
  81. package/dist/sparkline/root/sparkline-root.js +37 -1
  82. package/dist/spatial-bar-chart/root/spatial-bar-chart-root.d.ts +4 -1
  83. package/dist/spatial-bar-chart/root/spatial-bar-chart-root.js +2 -2
  84. package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.d.ts +3 -0
  85. package/dist/spatial-ribbon-chart/root/spatial-ribbon-chart-root.js +2 -2
  86. package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.d.ts +3 -0
  87. package/dist/spatial-scatter-chart/root/spatial-scatter-chart-root.js +2 -2
  88. package/dist/spatial-scatter-chart/view.d.ts +17 -8
  89. package/dist/spatial-scatter-chart/view.js +7 -6
  90. package/dist/spatial-surface-chart/root/spatial-surface-chart-root.d.ts +3 -0
  91. package/dist/spatial-surface-chart/root/spatial-surface-chart-root.js +2 -2
  92. package/dist/spatial-treemap/root/spatial-treemap-root.d.ts +3 -0
  93. package/dist/spatial-treemap/root/spatial-treemap-root.js +2 -2
  94. package/dist/splitter/root/splitter-root.js +3 -1
  95. package/dist/stat/group/stat-group.d.ts +13 -0
  96. package/dist/stat/group/stat-group.js +22 -1
  97. package/dist/stat/root/stat-root.d.ts +62 -1
  98. package/dist/stat/root/stat-root.js +146 -4
  99. package/dist/table/cell/table-cell.d.ts +1 -0
  100. package/dist/table/cell/table-cell.js +4 -0
  101. package/dist/table/column/table-column.d.ts +11 -0
  102. package/dist/table/column/table-column.js +4 -0
  103. package/dist/table/root/table-root.d.ts +7 -6
  104. package/dist/table/root/table-root.js +1 -1
  105. package/dist/tabs/panel/tab-panel.d.ts +30 -0
  106. package/dist/tabs/panel/tab-panel.js +28 -3
  107. package/dist/tabs/root/tabs-root.d.ts +8 -0
  108. package/dist/tabs/root/tabs-root.js +8 -2
  109. package/dist/tabs/tab/tab.js +2 -2
  110. package/dist/tag/root/tag-root.js +2 -2
  111. package/dist/timeline/root/timeline-root.d.ts +2 -2
  112. package/dist/timeline/root/timeline-root.js +1 -1
  113. package/dist/toast/root/toast-root.d.ts +53 -6
  114. package/dist/toast/root/toast-root.js +158 -1
  115. package/dist/toggle/root/toggle-root.d.ts +1 -0
  116. package/dist/toggle/root/toggle-root.js +1 -1
  117. package/dist/video-playlist/root/video-playlist-root.d.ts +1 -0
  118. package/dist/video-playlist/root/video-playlist-root.js +2 -0
  119. package/dist/virtual-list/root/virtual-list-root.d.ts +2 -2
  120. package/dist/virtual-list/root/virtual-list-root.js +1 -1
  121. package/examples.json +1 -1
  122. package/lint.json +1 -1
  123. package/package.json +5 -5
  124. package/types/jsx.d.ts +693 -169
  125. package/types/vue.d.ts +423 -96
  126. package/types/words.d.ts +51 -12
@@ -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)}`;
@@ -52,7 +52,10 @@ declare const HelixHeadlessDrawer_base: (new (...args: any[]) => import("@fusion
52
52
  * is: the elements in the default slot before the first one that is or holds
53
53
  * a control. An `aria-describedby` on the host replaces it.
54
54
  *
55
- * **Keyboard.** Opening moves focus to the first control in the panel.
55
+ * **Keyboard.** Opening a modal drawer moves focus to the control marked
56
+ * `autofocus`, or else to the control that closes it: a slotted one whose
57
+ * `command` closes this drawer, such as a Close or Cancel button, and else
58
+ * the close control `dismissible` draws.
56
59
  *
57
60
  * | Key | What it does |
58
61
  * |---|---|
@@ -86,7 +89,7 @@ declare const HelixHeadlessDrawer_base: (new (...args: any[]) => import("@fusion
86
89
  *
87
90
  * @slot - The drawer's content.
88
91
  * @slot dismiss-icon - Replaces the glyph inside the close control.
89
- * @slot footer - Content pinned below the scrolling area, such as the drawer's actions.
92
+ * @slot footer - Content pinned below the scrolling area, such as the drawer's actions. Write the action that dismisses first and the primary one last.
90
93
  * @slot header - Content pinned above the scrolling area.
91
94
  *
92
95
  * @event {Event} close - Sent from the host after the drawer closes, because the native `close` event does not leave the shadow root.
@@ -326,6 +329,11 @@ export declare class HelixHeadlessDrawer extends HelixHeadlessDrawer_base {
326
329
  connectedCallback(): void;
327
330
  disconnectedCallback(): void;
328
331
  protected updated(changed: PropertyValues): void;
332
+ /**
333
+ * The control that closes this drawer: a slotted one whose `command` closes
334
+ * it, such as Close or Cancel, and else the close control `dismissible` draws.
335
+ */
336
+ private get closer();
329
337
  protected render(): TemplateResult;
330
338
  /**
331
339
  * The glyph on the close control, behind a seam: slot fallback, so a
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { AriaForwardController, auditName, CommandController, customElement, drawDismiss, drawDismissGlyph, edgeOffset, FocusScopeController, HelixElement, headingsIn, isRtl, lockScroll, MixinControllerOpen, nearest, OpenPhaseController, onUnlessFalse, parseSnapPoints, reflectElements, SwipeController, settleSwipe, snapTravel, swipeAxis, swipeEdge, towardEdge, unlockScroll, words, } from '@fusion.dev/helix-core';
2
+ import { AriaForwardController, auditName, autofocusTarget, CommandController, coversPress, customElement, drawDismiss, drawDismissGlyph, edgeOffset, FocusScopeController, focusAs, focusableElements, HelixElement, headingsIn, isRtl, lockScroll, MixinControllerOpen, nearest, OpenPhaseController, onUnlessFalse, openingFocus, parseSnapPoints, raiseAbove, reflectElements, refocusWithin, SwipeController, settleSwipe, snapTravel, swipeAxis, swipeEdge, towardEdge, 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 '../../dialog/description.js';
@@ -93,6 +93,9 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
93
93
  if (!panel || event.target !== panel || !this.modal) {
94
94
  return;
95
95
  }
96
+ if (coversPress(event)) {
97
+ return;
98
+ }
96
99
  const box = panel.getBoundingClientRect();
97
100
  if (event.clientX >= box.left &&
98
101
  event.clientX <= box.right &&
@@ -247,18 +250,48 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
247
250
  headingsIn(this.renderRoot
248
251
  .querySelector('slot[name="header"]')
249
252
  ?.assignedElements({ flatten: true }) ?? []).length > 0);
253
+ const focusing = openingFocus();
250
254
  if (this.modal) {
251
255
  panel.showModal();
256
+ raiseAbove();
252
257
  }
253
258
  else {
254
259
  panel.show();
255
260
  }
261
+ void autofocusTarget(this).then((marked) => {
262
+ if (!this.open) {
263
+ return;
264
+ }
265
+ const first = marked ?? (this.modal ? this.closer : null);
266
+ if (first) {
267
+ focusAs(first, focusing);
268
+ return;
269
+ }
270
+ const chose = this.matches(':focus-within') &&
271
+ !(this.renderRoot instanceof ShadowRoot && this.renderRoot.activeElement === panel);
272
+ const fallback = this.modal && !chose ? focusableElements(this)[0] : undefined;
273
+ if (fallback) {
274
+ focusAs(fallback, focusing);
275
+ }
276
+ else {
277
+ refocusWithin(this, focusing);
278
+ }
279
+ });
256
280
  this.restAt(parseSnapPoints(this.snapPoints)[0] ?? 1);
257
281
  }
258
282
  else if (!this.open && panel.open) {
259
283
  panel.close();
260
284
  }
261
285
  }
286
+ get closer() {
287
+ const closes = [
288
+ ...this.querySelectorAll('[command="--close"], [command="close"], [command="request-close"]'),
289
+ ].find((one) => {
290
+ const target = one.getAttribute('commandfor');
291
+ return target === null || target === this.id;
292
+ });
293
+ return closes ?? this.renderRoot.querySelector('dialog > button');
294
+ }
262
295
  render() {
263
296
  const closedBy = this.closedBy ?? (this.modal ? undefined : 'closerequest');
264
297
  return html `<dialog
@@ -29,11 +29,11 @@ let HelixHeadlessFilterChip = class HelixHeadlessFilterChip extends MixinDismiss
29
29
  const operator = this.operatorLabel !== '' || this.knownChildren.some((child) => child.slot === 'operator');
30
30
  const values = !this.childrenKnown ||
31
31
  [...this.childNodes].some((node) => node instanceof Element ? node.slot === '' : (node.textContent ?? '').trim() !== '');
32
- return html `<span part="field"><slot name="field">${this.label}</slot></span>
32
+ return html `<span part="field"><slot name="field" dir="auto">${this.label}</slot></span>
33
33
  ${operator
34
34
  ? html `<span part="operator"><slot name="operator">${this.operatorLabel}</slot></span>`
35
35
  : nothing}
36
- <span part="values" ?hidden=${!values}><slot></slot></span>
36
+ <span part="values" ?hidden=${!values}><slot dir="auto"></slot></span>
37
37
  ${this.dismissible
38
38
  ? html `<button
39
39
  part="dismiss"
@@ -272,7 +272,17 @@ export declare class HelixHeadlessFind extends HelixHeadlessFind_base {
272
272
  private offers;
273
273
  /** The text selected in the content, where it lies on one line, or nothing. */
274
274
  private selectedText;
275
- /** Searches with the finder, and says where the search stands. */
275
+ /** Whether a search is waiting for the document to finish parsing. */
276
+ private waitingForParse;
277
+ /**
278
+ * Searches with the finder, and says where the search stands.
279
+ *
280
+ * **A target the parser has not reached yet is searched once it has.** A
281
+ * Find defined by a script in the head upgrades before the element `for`
282
+ * names exists, and searched nothing for good: no matches, with the text on
283
+ * the page. While the document is still loading, a search with no target
284
+ * runs again when parsing ends, as `autofocusTarget` waits for the same.
285
+ */
276
286
  private search;
277
287
  /** Takes the last search's marks away, where it drew any. */
278
288
  private endSearch;
@@ -44,6 +44,7 @@ let HelixHeadlessFind = class HelixHeadlessFind extends MixinControllerOpen(Heli
44
44
  this.announcement = '';
45
45
  this.said = 0;
46
46
  this.inside = false;
47
+ this.waitingForParse = false;
47
48
  this.handleWhere = (event) => {
48
49
  this.inside = this.within(event);
49
50
  };
@@ -263,6 +264,16 @@ let HelixHeadlessFind = class HelixHeadlessFind extends MixinControllerOpen(Heli
263
264
  search(direction) {
264
265
  const finder = this.finder;
265
266
  if (!finder) {
267
+ const document = this.ownerDocument;
268
+ if (document?.readyState === 'loading' && !this.waitingForParse) {
269
+ this.waitingForParse = true;
270
+ document.addEventListener('DOMContentLoaded', () => {
271
+ this.waitingForParse = false;
272
+ if (this.open) {
273
+ this.search('first');
274
+ }
275
+ }, { once: true });
276
+ }
266
277
  return;
267
278
  }
268
279
  if (this.marking !== finder) {
@@ -75,9 +75,9 @@ declare const HelixHeadlessHeatmap_base: typeof HelixElement & (new (...args: an
75
75
  * Space, each with the row of the table in `index`.
76
76
  *
77
77
  * **Nothing to draw.** A table with no readings shows `empty-text`, "No
78
- * readings", under the strip, and `loading` shows `loading-text` there until
79
- * readings arrive. The `empty` and `loading` slots take markup in place of
80
- * either, as on every chart.
78
+ * readings", in place of the cells, and `loading` shows `loading-text` there
79
+ * until readings arrive. The `empty` and `loading` slots take markup in place
80
+ * of either, as on every chart.
81
81
  *
82
82
  * **Keyboard.** The strip is one tab stop once it has cells.
83
83
  *
@@ -99,10 +99,11 @@ declare const HelixHeadlessHeatmap_base: typeof HelixElement & (new (...args: an
99
99
  * @aliases Contribution graph, Uptime strip, Calendar heatmap, Activity graph
100
100
  * @documentation https://fusion.dev/helix/components/heatmap
101
101
  *
102
- * @slot empty - Content shown under the strip when the table has no readings, such as a link to add the first. Falls back to `empty-text`.
102
+ * @slot empty - Content shown in place of the cells when the table has no readings, such as a link to add the first. Falls back to `empty-text`.
103
103
  * @slot end - Below the strip, at the trailing edge: usually the newest date.
104
- * @slot loading - Content shown under the strip while `loading` is set and there are no readings yet. Falls back to `loading-text`.
105
- * @slot start - Below the strip, at the leading edge: usually the oldest date.
104
+ * @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
105
+ * @slot loading - Content shown in place of the cells while `loading` is set and there are no readings yet. Falls back to `loading-text`.
106
+ * @slot start - Below the strip, at the leading edge: usually the oldest date. While a narrow strip drops its oldest readings, the first drawn row stands in its place: its date, as day and short month in the chart's locale, where its heading holds a `<time>`, and its heading's words otherwise.
106
107
  * @slot summary - Below the strip, in the middle: a summary of the range shown.
107
108
  *
108
109
  * @event {Event} change - Fired once a press or a key has changed which cells are selected.
@@ -114,11 +115,12 @@ declare const HelixHeadlessHeatmap_base: typeof HelixElement & (new (...args: an
114
115
  * @csspart cell - One reading.
115
116
  * @csspart cell-active - The cell the pointer or the keys rest on. Set alongside `cell`.
116
117
  * @csspart cell-selected - A cell that is selected, under `selection-mode`. Set alongside `cell`.
117
- * @csspart empty - The words under the strip 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, there being no document to resolve `for` in.
118
+ * @csspart empty - The words in place of the cells 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, there being no document to resolve `for` in.
118
119
  * @csspart end - The trailing slot's box.
120
+ * @csspart error - The words in place of the cells while `error-text` is set and there are no readings, followed by the `error` slot. Announced as it appears.
119
121
  * @csspart footer - The three-slot row under the strip.
120
122
  * @csspart live - The readout: a polite live region that says the cell the keys moved to. Hide it visually.
121
- * @csspart loading - The words under the strip while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
123
+ * @csspart loading - The words in place of the cells while `loading` is set and there are no readings: the `loading` slot, falling back to `loading-text`.
122
124
  * @csspart mark - The invisible point the tooltip is anchored to.
123
125
  * @csspart overview - The busiest reading and the total of the readings drawn, written as a sentence for screen readers, which describes the strip. Rendered once there are cells. Hide it visually.
124
126
  * @csspart plot - The same element as `strip`, under the name every chart gives the drawing that takes focus.
@@ -164,6 +166,7 @@ declare const HelixHeadlessHeatmap_base: typeof HelixElement & (new (...args: an
164
166
  *
165
167
  * @cssstate active - While a cell is shown, under the pointer or the keys, with its tooltip open.
166
168
  * @cssstate empty - While the `empty` part stands in place of the cells.
169
+ * @cssstate error - While the `error` part stands in place of the cells.
167
170
  * @cssstate loading - While the `loading` part stands in place of the cells.
168
171
  */
169
172
  export declare class HelixHeadlessHeatmap extends HelixHeadlessHeatmap_base {
@@ -1,10 +1,30 @@
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, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
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';
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
7
  import { fits, monthPage, overviewOf, toneOf } from './buckets.js';
8
+ const dayOf = (when, locale) => {
9
+ if (!when) {
10
+ return undefined;
11
+ }
12
+ const date = new Date(when);
13
+ if (Number.isNaN(date.getTime())) {
14
+ return undefined;
15
+ }
16
+ const dateOnly = /^\d{4}-\d{2}-\d{2}$/.test(when);
17
+ try {
18
+ return new Intl.DateTimeFormat(locale || undefined, {
19
+ day: 'numeric',
20
+ month: 'short',
21
+ ...(dateOnly ? { timeZone: 'UTC' } : {}),
22
+ }).format(date);
23
+ }
24
+ catch {
25
+ return undefined;
26
+ }
27
+ };
8
28
  let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(MixinChartSource(HelixElement)) {
9
29
  constructor() {
10
30
  super(...arguments);
@@ -276,6 +296,11 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(M
276
296
  ></span>`;
277
297
  });
278
298
  const at = this.pointer.at;
299
+ const dropped = this.dropped;
300
+ const first = this.sourceRows[dropped];
301
+ const drawnStart = dropped > 0 && this.querySelector(':scope > [slot="start"]') !== null
302
+ ? (dayOf(first?.when, wordsLocale(this)) ?? first?.label ?? '')
303
+ : '';
279
304
  return html `<div
280
305
  aria-activedescendant=${grid && at >= 0 ? `cell-${at}` : nothing}
281
306
  aria-describedby=${readable ? 'helix-chart-summary' : nothing}
@@ -297,7 +322,7 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartStatus(M
297
322
  </div>
298
323
  ${cells.length === 0 ? this.renderStatus() : nothing}
299
324
  <div part="footer">
300
- <span part="start"><slot name="start"></slot></span>
325
+ <span part="start"><slot ?hidden=${drawnStart !== ''} name="start" @slotchange=${() => this.requestUpdate()}></slot>${drawnStart}</span>
301
326
  <span part="summary"><slot name="summary"></slot></span>
302
327
  <span part="end"><slot name="end"></slot></span>
303
328
  </div>${readable ? this.renderOverview(cells) : nothing}${this.status.spoken
@@ -149,6 +149,10 @@ export declare class HelixHeadlessKbd extends HelixElement {
149
149
  * so a sheet can draw a cap per key. Written with no space between, so a
150
150
  * chord reads as the one label it was. Where the chord is said in words,
151
151
  * the parts are hidden from a screen reader, which reads the words.
152
+ *
153
+ * A key drawn as one arrow or technical symbol, such as ⌘, ⇧ or ↵, carries
154
+ * `data-symbol`, so a sheet can draw it in a face that has the glyph at the
155
+ * height of a letter.
152
156
  */
153
157
  protected renderChord(): TemplateResult;
154
158
  }
@@ -152,7 +152,7 @@ let HelixHeadlessKbd = class HelixHeadlessKbd extends HelixElement {
152
152
  renderChord() {
153
153
  const { keys, separator, spoken } = this.label;
154
154
  const hidden = spoken === '' ? nothing : 'true';
155
- return html `${keys.map((key, index) => html `${index > 0 && separator !== '' ? html `<span part="separator" aria-hidden=${hidden}>${separator}</span>` : nothing}<span part="key" aria-hidden=${hidden}>${key}</span>`)}`;
155
+ return html `${keys.map((key, index) => html `${index > 0 && separator !== '' ? html `<span part="separator" aria-hidden=${hidden}>${separator}</span>` : nothing}<span part="key" aria-hidden=${hidden} ?data-symbol=${drawnAsSymbol(key)}>${key}</span>`)}`;
156
156
  }
157
157
  };
158
158
  __decorate([
@@ -177,3 +177,4 @@ HelixHeadlessKbd = __decorate([
177
177
  customElement('helix-headless-kbd')
178
178
  ], HelixHeadlessKbd);
179
179
  export { HelixHeadlessKbd };
180
+ const drawnAsSymbol = (key) => /^[\u2190-\u21ff\u2300-\u23ff]$/u.test(key);
@@ -1,5 +1,5 @@
1
1
  import { __decorate } from "tslib";
2
- import { auditName, CommandController, customElement, DelayController, deepActiveElement, deepContains, drawDismiss, drawDismissGlyph, FocusScopeController, FullscreenController, formatWords, HelixElement, hostAria, IdleController, inlineStep, internalsOf, isRtl, keyClaimed, lockScroll, MIRROR_RULE, MixinControllerActive, MixinControllerOpen, numberConverter, OpenPhaseController, resolveActiveItem, SwipeController, swipeStep, timeConverter, unlockScroll, whenHydrated, words, } from '@fusion.dev/helix-core';
2
+ import { auditName, CommandController, coversPress, customElement, DelayController, deepActiveElement, deepContains, drawDismiss, drawDismissGlyph, FocusScopeController, FullscreenController, formatWords, HelixElement, hostAria, IdleController, inlineStep, internalsOf, isRtl, keyClaimed, lockScroll, MIRROR_RULE, MixinControllerActive, MixinControllerOpen, numberConverter, OpenPhaseController, raiseAbove, resolveActiveItem, SwipeController, swipeStep, timeConverter, unlockScroll, whenHydrated, words, } from '@fusion.dev/helix-core';
3
3
  import { caretLeft, caretRight, minus, plus } from '@fusion.dev/helix-icons';
4
4
  import { html, nothing } from 'lit';
5
5
  import { property, state } from 'lit/decorators.js';
@@ -133,7 +133,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
133
133
  };
134
134
  this.zoomedItem = undefined;
135
135
  this.handleBackdrop = (event) => {
136
- if (this.dragged(event) || !this.onEmptyArea(event)) {
136
+ if (this.dragged(event) || !this.onEmptyArea(event) || coversPress(event)) {
137
137
  return;
138
138
  }
139
139
  this.requestOpen(false);
@@ -358,6 +358,7 @@ let HelixHeadlessLightbox = class HelixHeadlessLightbox extends MixinControllerA
358
358
  if (this.open && !dialog.open) {
359
359
  auditName(this, () => null, 'lightbox', () => this.label !== '');
360
360
  dialog.showModal();
361
+ raiseAbove();
361
362
  dialog.focus({ preventScroll: true });
362
363
  this.idle.stir();
363
364
  }
@@ -27,8 +27,10 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
27
27
  * `<svg>` that fills its box scales with the box, so the same `font-size` can
28
28
  * render at 10px in a narrow chart and 43px in a wide one.
29
29
  *
30
- * `value-axis` draws the scale's numbers beside the plot, at the levels
31
- * `gridlines` rules, written in `locale`.
30
+ * The scale's numbers stand beside the plot, written in `locale`, at the
31
+ * levels the gridlines rule, and the top of the scale is a level above the
32
+ * highest reading. `value-axis="none"` and `gridlines="none"` take them away,
33
+ * for a chart read for its shape.
32
34
  *
33
35
  * The table is the accessible representation, and the drawing is hidden from
34
36
  * screen readers, who get the numbers. The `summary` part names the chart, from
@@ -54,6 +56,9 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
54
56
  * `empty-text`, "No readings", in the plot, and `loading` shows `loading-text`
55
57
  * there until readings arrive. The `empty` and `loading` slots take markup in
56
58
  * their place, such as a link to add the first reading.
59
+ * When the readings did not load, set `error-text`, such as "The visits did
60
+ * not load": it stands in the plot in place of both, and the `error` slot
61
+ * takes a button that tries again, shown after the words.
57
62
  *
58
63
  * **Keyboard.** The plot is one tab stop.
59
64
  *
@@ -74,17 +79,19 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
74
79
  * @documentation https://fusion.dev/helix/components/line-chart
75
80
  *
76
81
  * @slot empty - Content shown in place of the drawing when the table has no readings, such as a link to add the first. Falls back to `empty-text`.
82
+ * @slot error - Content shown after `error-text` while it is set and there are no readings, such as a button that tries again.
77
83
  * @slot loading - Content shown in place of the drawing while `loading` is set and there are no readings yet. Falls back to `loading-text`.
78
84
  *
79
85
  * @event {HelixReadingChangeEvent} helix-reading-change - The reading shown moved, or was put away: `index` is the row, or `-1` for none, with its `label`, the `series` the keys rest on, and the `pointerType` that moved it.
80
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`.
81
87
  *
82
88
  * @csspart area - The wash under one line, where `area` is set.
83
- * @csspart axis - The numbers of the scale beside the plot, under `value-axis`.
89
+ * @csspart axis - The numbers of the scale beside the plot, unless `value-axis` is `none`.
84
90
  * @csspart band - The band around the reading under the pointer.
85
91
  * @csspart baseline - The rule at zero, where zero is inside the range.
86
92
  * @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.
87
- * @csspart gridline - One rule across the plot, under `gridlines`.
93
+ * @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
+ * @csspart gridline - One rule across the plot, unless `gridlines` is `none`.
88
95
  * @csspart guide - A rule down the reading a pointer is resting on.
89
96
  * @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.
90
97
  * @csspart labels - The row of reading names, which the names share: lay it out as one grid cell they all stand in.
@@ -129,6 +136,7 @@ declare const HelixHeadlessLineChart_base: typeof HelixElement & (new (...args:
129
136
  *
130
137
  * @cssstate active - While a reading is shown, under the pointer or the keys, with its tooltip open.
131
138
  * @cssstate empty - While the `empty` part stands in the plot.
139
+ * @cssstate error - While the `error` part stands in the plot.
132
140
  * @cssstate loading - While the `loading` part stands in the plot.
133
141
  */
134
142
  export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base {
@@ -193,9 +201,10 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
193
201
  /**
194
202
  * Which rules are drawn across the plot, if any.
195
203
  *
196
- * Absent draws none, which is the honest default rather than a timid one: a
197
- * chart in a card and a chart beside a figure are read as a shape, and a grid
198
- * over one is furniture around a drawing nobody is measuring.
204
+ * Absent rules the levels, as `value` does, which are the levels the `axis`
205
+ * part numbers: a reading is measured against the rule beside it. `none`
206
+ * draws no rules, for a chart in a card or beside a figure that is read as a
207
+ * shape.
199
208
  *
200
209
  * `value` rules the axis the readings are *measured* on, at the levels
201
210
  * `ticks` picks, which are round numbers anchored to the number line rather
@@ -204,17 +213,15 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
204
213
  * through each reading whose name is drawn, which is what lets a point be
205
214
  * traced down to its label across a wide chart. `both` draws both.
206
215
  *
207
- * **A bare `gridlines` means `value`**, and so does anything unrecognized.
208
- * The attribute a consumer reaches for first should be the grid they meant,
209
- * and a typo should fall back to the useful half rather than to nothing at
210
- * all: an unrecognized value that draws no rules is indistinguishable from
211
- * the attribute being absent, which is the one thing a reader cannot debug.
216
+ * **A bare `gridlines` means `value`**, and so does anything unrecognized,
217
+ * so a typo draws the rules the chart rests with. Only `none` takes them
218
+ * away, which is a word nobody types by accident.
212
219
  *
213
220
  * Furniture rather than data, so the rules are inside the `aria-hidden` plot
214
221
  * and reach no reader through the table.
215
222
  */
216
- gridlines?: 'both' | 'category' | 'value';
217
- /** Whether the levels are ruled, which is every value but `category`. */
223
+ gridlines?: 'both' | 'category' | 'none' | 'value';
224
+ /** Whether the levels are ruled, which is every value but `category` and `none`. */
218
225
  protected get rulesValue(): boolean;
219
226
  /** Whether each reading is ruled, which only two values ask for. */
220
227
  protected get rulesCategory(): boolean;
@@ -262,14 +269,19 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
262
269
  */
263
270
  terminus?: 'none' | 'ring' | 'square' | 'triangle';
264
271
  /**
265
- * Draws the scale's numbers beside the plot, the `axis` part, at the levels
266
- * `gridlines` rules, so a reading can be measured off the drawing as well
267
- * as read from the tooltip.
272
+ * Whether the scale's numbers are drawn beside the plot, the `axis` part.
268
273
  *
269
- * Absent draws none: a line read for its shape needs no numbers beside it,
270
- * and the tooltip and the table hold every reading.
274
+ * Absent draws them, at the levels `gridlines` rules, so a reading can be
275
+ * measured off the drawing as well as read from the tooltip. `none` draws no
276
+ * axis, for a line read for its shape, where the tooltip and the table hold
277
+ * every reading.
278
+ *
279
+ * Reflected, because the stylesheet gives the axis a column of its own unless
280
+ * this is `none`, and undefaulted, so a host carries only what you wrote.
271
281
  */
272
- valueAxis: boolean;
282
+ valueAxis?: 'none';
283
+ /** Whether the axis is drawn, which is every value but `none`. */
284
+ protected get drawsAxis(): boolean;
273
285
  /** The domain last worked out, held while the series, the hidden ones and `zero` are the same. */
274
286
  private ranged;
275
287
  /** The domain every series is drawn against, which the tooltip also needs. */
@@ -324,7 +336,7 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
324
336
  private ends;
325
337
  protected render(): TemplateResult;
326
338
  /**
327
- * The scale's numbers beside the plot, under `value-axis`, written in the
339
+ * The scale's numbers beside the plot, unless `value-axis` is `none`, written in the
328
340
  * chart's locale. A seam, so a subclass can write the numbers its own way,
329
341
  * such as a currency.
330
342
  */
@@ -417,12 +429,13 @@ export declare class HelixHeadlessLineChart extends HelixHeadlessLineChart_base
417
429
  /** Whether `dashed` names this series, matched as a heading is. */
418
430
  private dashes;
419
431
  /**
420
- * One series, its wash first so the line is drawn over its own fill.
432
+ * One series' wash or its line. The chart draws every wash and then every
433
+ * line, so a line is drawn over its own fill and over every other series'.
421
434
  *
422
435
  * Each reading sits at its own row, and the line breaks where a row has no
423
436
  * reading: a line drawn across a blank claims a value nobody measured.
424
437
  */
425
- protected renderSeries(one: Series, depth: number, x: (value: number) => number, y: (value: number) => number): TemplateResult;
438
+ protected renderSeries(one: Series, depth: number, x: (value: number) => number, y: (value: number) => number, piece: 'area' | 'line'): TemplateResult;
426
439
  /**
427
440
  * The reading names, as HTML beside the drawing rather than inside it.
428
441
  *