@fusion.dev/helix-headless 0.147.0 → 0.148.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 (141) hide show
  1. package/custom-elements.json +4512 -790
  2. package/dist/accordion/item/accordion-item.d.ts +5 -2
  3. package/dist/accordion/item/accordion-item.js +11 -7
  4. package/dist/accordion/root/accordion-root.js +4 -6
  5. package/dist/announcement/root/announcement-root.d.ts +56 -5
  6. package/dist/announcement/root/announcement-root.js +124 -21
  7. package/dist/area-chart/root/area-chart-root.js +3 -4
  8. package/dist/badge/count.d.ts +14 -0
  9. package/dist/badge/count.js +20 -0
  10. package/dist/badge/root/badge-root.js +8 -22
  11. package/dist/blockquote/root/blockquote-root.d.ts +66 -8
  12. package/dist/blockquote/root/blockquote-root.js +85 -8
  13. package/dist/breadcrumbs/breadcrumb/breadcrumb.js +2 -2
  14. package/dist/button-group/arrows.d.ts +14 -0
  15. package/dist/button-group/arrows.js +10 -0
  16. package/dist/button-group/root/button-group-root.d.ts +141 -3
  17. package/dist/button-group/root/button-group-root.js +142 -2
  18. package/dist/canvas/edge-pan.d.ts +61 -0
  19. package/dist/canvas/edge-pan.js +63 -0
  20. package/dist/canvas/node/canvas-node.d.ts +12 -2
  21. package/dist/canvas/node/canvas-node.js +6 -2
  22. package/dist/canvas/root/canvas-document.d.ts +10 -0
  23. package/dist/canvas/root/canvas-document.js +1 -0
  24. package/dist/canvas/root/canvas-root.d.ts +107 -5
  25. package/dist/canvas/root/canvas-root.js +140 -36
  26. package/dist/canvas/snap.d.ts +42 -0
  27. package/dist/canvas/snap.js +32 -0
  28. package/dist/carousel/root/carousel-root.d.ts +4 -3
  29. package/dist/carousel/root/carousel-root.js +2 -6
  30. package/dist/chat/root/chat-root.d.ts +13 -3
  31. package/dist/chat/root/chat-root.js +2 -6
  32. package/dist/checkbox-group/root/checkbox-group-root.d.ts +13 -0
  33. package/dist/checkbox-group/root/checkbox-group-root.js +18 -10
  34. package/dist/checkbox-group/select-all.d.ts +11 -0
  35. package/dist/checkbox-group/select-all.js +5 -0
  36. package/dist/code-block/root/code-block-root.d.ts +8 -6
  37. package/dist/code-block/root/code-block-root.js +4 -3
  38. package/dist/color-picker/root/color-picker-root.js +6 -12
  39. package/dist/color-picker/wheel.d.ts +11 -0
  40. package/dist/color-picker/wheel.js +9 -0
  41. package/dist/combobox/root/combobox-root.d.ts +70 -11
  42. package/dist/combobox/root/combobox-root.js +68 -18
  43. package/dist/command/root/command-root.d.ts +4 -3
  44. package/dist/data-table/root/data-table-root.js +17 -44
  45. package/dist/description-list/item/description-list-item.d.ts +4 -0
  46. package/dist/description-list/item/description-list-item.js +7 -1
  47. package/dist/divider/root/divider-root.d.ts +45 -16
  48. package/dist/divider/root/divider-root.js +28 -4
  49. package/dist/drilldown/item/drilldown-item.js +3 -4
  50. package/dist/element-events.generated.js +1 -0
  51. package/dist/empty/root/empty-root.d.ts +17 -3
  52. package/dist/empty/root/empty-root.js +29 -5
  53. package/dist/file-input/root/file-input-root.js +3 -4
  54. package/dist/file-input/status.js +2 -1
  55. package/dist/filter-input/chip/filter-chip.js +2 -3
  56. package/dist/format-date/fields.d.ts +20 -0
  57. package/dist/format-date/fields.js +14 -0
  58. package/dist/format-date/options.d.ts +2 -1
  59. package/dist/format-date/options.js +9 -38
  60. package/dist/format-date/root/format-date-root.d.ts +35 -3
  61. package/dist/format-date/root/format-date-root.js +24 -32
  62. package/dist/graph/root/graph-root.d.ts +23 -5
  63. package/dist/graph/root/graph-root.js +17 -20
  64. package/dist/heatmap/root/heatmap-root.d.ts +12 -0
  65. package/dist/heatmap/root/heatmap-root.js +26 -11
  66. package/dist/image/root/image-root.d.ts +11 -0
  67. package/dist/kbd/root/kbd-root.js +1 -2
  68. package/dist/legend/root/legend-root.js +4 -17
  69. package/dist/list/root/list-root.js +8 -22
  70. package/dist/listbox/root/listbox-root.d.ts +119 -24
  71. package/dist/listbox/root/listbox-root.js +130 -132
  72. package/dist/map/marker/map-marker.d.ts +2 -1
  73. package/dist/map/root/map-root.d.ts +40 -2
  74. package/dist/map/root/map-root.js +64 -23
  75. package/dist/megamenu/root/megamenu-root.js +4 -11
  76. package/dist/menu/root/menu-root.d.ts +2 -2
  77. package/dist/navigation/root/navigation-root.js +5 -8
  78. package/dist/notifications/group/notification-group.d.ts +8 -1
  79. package/dist/notifications/group/notification-group.js +12 -6
  80. package/dist/notifications/notification/notification.d.ts +12 -1
  81. package/dist/notifications/notification/notification.js +3 -1
  82. package/dist/notifications/root/notifications-root.d.ts +41 -5
  83. package/dist/notifications/root/notifications-root.js +27 -7
  84. package/dist/object-inspector/root/object-inspector-root.d.ts +5 -1
  85. package/dist/object-inspector/root/object-inspector-root.js +21 -11
  86. package/dist/pagination/size/pagination-size.d.ts +1 -0
  87. package/dist/pagination/size/pagination-size.js +1 -1
  88. package/dist/pin-input/code.d.ts +23 -0
  89. package/dist/pin-input/code.js +25 -0
  90. package/dist/pin-input/root/pin-input-root.js +9 -23
  91. package/dist/qr-code/root/qr-code-root.d.ts +14 -3
  92. package/dist/qr-code/root/qr-code-root.js +19 -5
  93. package/dist/scatter-chart/measures.d.ts +22 -0
  94. package/dist/scatter-chart/measures.js +11 -0
  95. package/dist/scatter-chart/root/scatter-chart-root.d.ts +2 -6
  96. package/dist/scatter-chart/root/scatter-chart-root.js +6 -19
  97. package/dist/select/root/select-root.d.ts +56 -8
  98. package/dist/select/root/select-root.js +33 -9
  99. package/dist/speed-dial/group/speed-dial-group.d.ts +48 -0
  100. package/dist/speed-dial/group/speed-dial-group.js +43 -0
  101. package/dist/speed-dial/index.d.ts +1 -0
  102. package/dist/speed-dial/index.js +1 -0
  103. package/dist/speed-dial/item/speed-dial-item.d.ts +26 -1
  104. package/dist/speed-dial/item/speed-dial-item.js +41 -3
  105. package/dist/speed-dial/long-press.d.ts +50 -0
  106. package/dist/speed-dial/long-press.js +48 -0
  107. package/dist/speed-dial/root/speed-dial-root.d.ts +80 -1
  108. package/dist/speed-dial/root/speed-dial-root.js +114 -5
  109. package/dist/splitter/root/splitter-root.d.ts +7 -3
  110. package/dist/splitter/root/splitter-root.js +16 -3
  111. package/dist/table/cell/table-cell.d.ts +8 -1
  112. package/dist/table/cell/table-cell.js +6 -2
  113. package/dist/table/grid-controller.d.ts +117 -0
  114. package/dist/table/grid-controller.js +293 -0
  115. package/dist/table/root/table-root.d.ts +47 -3
  116. package/dist/table/root/table-root.js +81 -24
  117. package/dist/table/row/table-row.d.ts +13 -1
  118. package/dist/table/row/table-row.js +20 -6
  119. package/dist/tag/group/tag-group.js +6 -15
  120. package/dist/time-picker/root/time-picker-root.d.ts +1 -0
  121. package/dist/time-picker/root/time-picker-root.js +3 -0
  122. package/dist/toast/item/toast-item.d.ts +6 -3
  123. package/dist/toast/item/toast-item.js +1 -0
  124. package/dist/toast/root/toast-root.d.ts +13 -1
  125. package/dist/toast/root/toast-root.js +20 -14
  126. package/dist/toggle/group/toggle-group.js +3 -5
  127. package/dist/toolbar/root/toolbar-root.d.ts +31 -0
  128. package/dist/toolbar/root/toolbar-root.js +39 -8
  129. package/dist/tooltip/root/tooltip-root.js +1 -2
  130. package/dist/video/root/video-root.d.ts +11 -0
  131. package/dist/video/root/video-root.js +15 -1
  132. package/dist/virtual-list/root/virtual-list-root.js +6 -18
  133. package/lint.json +1 -1
  134. package/package.json +5 -5
  135. package/types/jsx.d.ts +2005 -266
  136. package/types/svelte.d.ts +1 -0
  137. package/types/vue.d.ts +338 -62
  138. package/dist/kbd/keys.d.ts +0 -29
  139. package/dist/kbd/keys.js +0 -52
  140. package/dist/tooltip/focus-target.d.ts +0 -6
  141. package/dist/tooltip/focus-target.js +0 -9
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { AriaForwardController, customElement, drawIcon, drawStatus, fillTemplate, formatNumbers, HelixBeforeChangeEvent, HelixFormElement, HelixRejectEvent, MixinField, requestChange, restoreValue, SlottedGlyph, StatusController, } from '@fusion.dev/helix-core';
7
+ import { AriaForwardController, customElement, drawIcon, drawStatus, fillTemplate, formatNumbers, HelixBeforeChangeEvent, HelixFormElement, HelixRejectEvent, labelWith, MixinField, requestChange, restoreValue, SlottedGlyph, StatusController, } from '@fusion.dev/helix-core';
8
8
  import { trash } from '@fusion.dev/helix-icons';
9
9
  import { nothing } from 'lit';
10
10
  import { property, state } from 'lit/decorators.js';
@@ -12,7 +12,6 @@ import { html } from 'lit/static-html.js';
12
12
  import { screenFiles } from '../screen.js';
13
13
  import { barOf, saysStatus } from '../status.js';
14
14
  import '../../tag/index.js';
15
- const named = (label, name) => label.includes('{name}') ? fillTemplate(label, { name }) : `${label} ${name}`;
16
15
  const size = (bytes, locale) => {
17
16
  const units = ['bytes', 'KB', 'MB', 'GB', 'TB'];
18
17
  let value = bytes;
@@ -281,7 +280,7 @@ let HelixHeadlessFileInput = class HelixHeadlessFileInput extends MixinField(Hel
281
280
  part="progress"
282
281
  max="1"
283
282
  value=${bar === 'unmeasured' ? nothing : bar}
284
- aria-label=${named(this.progressLabel, file.name)}
283
+ aria-label=${labelWith(this.progressLabel, 'name', file.name)}
285
284
  ></progress>`}${status.text ? html `<span part="status-text">${status.text}</span>` : nothing}</span
286
285
  >`;
287
286
  }
@@ -346,7 +345,7 @@ let HelixHeadlessFileInput = class HelixHeadlessFileInput extends MixinField(Hel
346
345
  <button
347
346
  part="remove"
348
347
  type="button"
349
- aria-label=${named(this.removeLabel, file.name)}
348
+ aria-label=${labelWith(this.removeLabel, 'name', file.name)}
350
349
  data-at=${at}
351
350
  ?disabled=${this.isDisabled}
352
351
  @click=${this.handleRemove}
@@ -1,7 +1,8 @@
1
+ import { clamp } from '@fusion.dev/helix-core';
1
2
  export const barOf = (status) => {
2
3
  const { progress, state } = status;
3
4
  if (typeof progress === 'number' && Number.isFinite(progress)) {
4
- return Math.min(1, Math.max(0, progress));
5
+ return clamp(progress, 0, 1);
5
6
  }
6
7
  return state === 'uploading' ? 'unmeasured' : undefined;
7
8
  };
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { customElement, HelixElement, MixinDismissible, slottedWords } from '@fusion.dev/helix-core';
7
+ import { customElement, HelixElement, labelWith, MixinDismissible, slottedWords, } from '@fusion.dev/helix-core';
8
8
  import { x } from '@fusion.dev/helix-icons';
9
9
  import { html, nothing } from 'lit';
10
10
  import { property } from 'lit/decorators.js';
@@ -21,8 +21,7 @@ let HelixHeadlessFilterChip = class HelixHeadlessFilterChip extends MixinDismiss
21
21
  const words = [read('field', this.label), read('operator', this.operatorLabel), read('', '')]
22
22
  .filter(Boolean)
23
23
  .join(' ');
24
- const label = this.dismissLabel;
25
- return label.includes('{label}') ? label.replace('{label}', words) : `${label} ${words}`.trim();
24
+ return labelWith(this.dismissLabel, 'label', words);
26
25
  }
27
26
  firstUpdated(changed) {
28
27
  super.firstUpdated(changed);
@@ -0,0 +1,20 @@
1
+ import { type TemplateResult } from 'lit';
2
+ /**
3
+ * Each date field `Intl` names, drawn as a part of its own.
4
+ *
5
+ * Keyed by the `type` of `Intl.DateTimeFormat#formatToParts`. Written out one
6
+ * template to a field rather than bound through one `part` binding, because a
7
+ * part is read from the source as a literal: a bound name is a part no
8
+ * stylesheet check can find. A type left out, the punctuation between the
9
+ * fields among them, is drawn as plain text.
10
+ */
11
+ export declare const FIELD: Record<string, (value: string) => TemplateResult>;
12
+ /**
13
+ * A formatted date, each field in a part of its own and the text between them
14
+ * as it is.
15
+ *
16
+ * The words are the ones `format` would give, in the same order, so the reading
17
+ * a screen reader hears and the text a reader copies do not change: an inline
18
+ * span with no style of its own changes nothing on the page either.
19
+ */
20
+ export declare const drawFields: (parts: readonly Intl.DateTimeFormatPart[]) => unknown[];
@@ -0,0 +1,14 @@
1
+ import { html } from 'lit';
2
+ export const FIELD = {
3
+ day: (value) => html `<span part="day">${value}</span>`,
4
+ dayPeriod: (value) => html `<span part="day-period">${value}</span>`,
5
+ era: (value) => html `<span part="era">${value}</span>`,
6
+ hour: (value) => html `<span part="hour">${value}</span>`,
7
+ minute: (value) => html `<span part="minute">${value}</span>`,
8
+ month: (value) => html `<span part="month">${value}</span>`,
9
+ second: (value) => html `<span part="second">${value}</span>`,
10
+ timeZoneName: (value) => html `<span part="time-zone-name">${value}</span>`,
11
+ weekday: (value) => html `<span part="weekday">${value}</span>`,
12
+ year: (value) => html `<span part="year">${value}</span>`,
13
+ };
14
+ export const drawFields = (parts) => parts.map(({ type, value }) => FIELD[type]?.(value) ?? value);
@@ -18,7 +18,8 @@ export interface Asked {
18
18
  year?: 'numeric' | '2-digit' | undefined;
19
19
  }
20
20
  /**
21
- * The `Intl.DateTimeFormat` options for what was asked, and none that was not.
21
+ * The `Intl.DateTimeFormat` options for what was asked, and none that was not:
22
+ * an option not asked for is `undefined`, which `Intl` reads as absent.
22
23
  *
23
24
  * **A style wins over the fields.** `dateStyle` and `timeStyle` are each
24
25
  * locale's own whole pattern, and `Intl` throws a `TypeError` when one is
@@ -1,42 +1,13 @@
1
- const FIELDS = [
2
- 'day',
3
- 'era',
4
- 'hour',
5
- 'minute',
6
- 'month',
7
- 'second',
8
- 'timeZoneName',
9
- 'weekday',
10
- 'year',
11
- ];
1
+ import { FIELD } from './fields.js';
2
+ const FIELDS = Object.keys(FIELD);
12
3
  export const formatOptions = (asked, dateOnly = false) => {
13
- const options = {};
14
- const styled = asked.dateStyle !== undefined || asked.timeStyle !== undefined;
15
- if (styled) {
16
- if (asked.dateStyle) {
17
- options.dateStyle = asked.dateStyle;
18
- }
19
- if (asked.timeStyle) {
20
- options.timeStyle = asked.timeStyle;
21
- }
22
- }
23
- else {
24
- for (const field of FIELDS) {
25
- const value = asked[field];
26
- if (value) {
27
- ;
28
- options[field] = value;
29
- }
30
- }
31
- }
32
- if (asked.hourCycle) {
33
- options.hourCycle = asked.hourCycle;
34
- }
35
- if (asked.timeZone) {
36
- options.timeZone = asked.timeZone;
37
- }
38
- else if (dateOnly) {
39
- options.timeZone = 'UTC';
4
+ const options = {
5
+ hourCycle: asked.hourCycle,
6
+ timeZone: asked.timeZone || (dateOnly ? 'UTC' : undefined),
7
+ };
8
+ const styled = asked.dateStyle || asked.timeStyle;
9
+ for (const field of styled ? ['dateStyle', 'timeStyle'] : FIELDS) {
10
+ options[field] = asked[field];
40
11
  }
41
12
  return options;
42
13
  };
@@ -27,6 +27,12 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
27
27
  * showing a date schedules none, so a long feed left open costs almost nothing.
28
28
  * `frozen` draws the reading once and leaves it.
29
29
  *
30
+ * **`fields` draws each field of a date as a part of its own**, such as
31
+ * `day`, `month` and `year`, so a stylesheet can set the year in a lighter ink
32
+ * or the weekday in capitals with `::part()`. The text between the fields is
33
+ * the locale's own and has no part. An `elapsed` or `relative` reading is one
34
+ * phrase, with no parts inside it.
35
+ *
30
36
  * **The output is always `<time datetime>`**, so copy and paste and scripts
31
37
  * parsing the page get the exact instant, whatever the visible text says. A
32
38
  * screen reader reads the text, so an `elapsed` reading is named in full, such
@@ -43,7 +49,20 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
43
49
  * @aliases RelativeTime, Timestamp, TimeAgo
44
50
  * @documentation https://fusion.dev/helix/components/format-date
45
51
  *
52
+ * @csspart day - The day of the month, with `fields`.
53
+ * @csspart day-period - AM or PM, or the locale's word for the part of the day, with `fields`.
54
+ * @csspart era - The era, such as AD, with `fields` and `era`.
55
+ * @csspart hour - The hour, with `fields`.
56
+ * @csspart minute - The minute, with `fields`.
57
+ * @csspart month - The month, with `fields`.
58
+ * @csspart second - The second, with `fields`.
46
59
  * @csspart time - The `<time>` element that holds the formatted text.
60
+ * @csspart time-zone-name - The time zone's name, with `fields`, where `time-zone-name` or a `long` or `full` `time-style` shows it.
61
+ * @csspart weekday - The day of the week, with `fields`.
62
+ * @csspart year - The year, with `fields`.
63
+ *
64
+ * @cssstate future - An `elapsed` or `relative` reading of a moment still to come, such as "in 3 hours".
65
+ * @cssstate past - An `elapsed` or `relative` reading of a moment gone, such as "3 hours ago".
47
66
  */
48
67
  export declare class HelixHeadlessFormatDate extends HelixElement {
49
68
  /**
@@ -86,6 +105,16 @@ export declare class HelixHeadlessFormatDate extends HelixElement {
86
105
  * How the era is written, such as AD, where a date is shown.
87
106
  */
88
107
  era?: 'long' | 'narrow' | 'short';
108
+ /**
109
+ * Draws each field of a date in a part of its own: `weekday`, `day`,
110
+ * `month`, `year`, `era`, `hour`, `minute`, `second`, `day-period` and
111
+ * `time-zone-name`, so `::part(year)` can set the year apart.
112
+ *
113
+ * Off by default, which draws the date as one run of text, as Shoelace and
114
+ * Web Awesome do. An `elapsed` or `relative` reading is one phrase either
115
+ * way.
116
+ */
117
+ fields?: boolean;
89
118
  /**
90
119
  * Draws an `elapsed` or `relative` reading once and leaves it, where it
91
120
  * would otherwise move on as it goes stale.
@@ -184,15 +213,18 @@ export declare class HelixHeadlessFormatDate extends HelixElement {
184
213
  private readonly clock;
185
214
  /**
186
215
  * The date read out of the light DOM, where no attribute carried one.
216
+ *
217
+ * Not a reactive state: `read` asks for the update itself, which keeps the
218
+ * `state` decorator out of this element's bundle.
187
219
  */
188
220
  private written;
189
- private watching;
221
+ private watching?;
190
222
  /** Whether the timestamp is a day with no time, which is formatted in UTC. */
191
223
  private get dateOnly();
192
224
  /** The timestamp, or nothing where there is not one to read. */
193
225
  private get moment();
194
- /** Every `Intl.DateTimeFormat` option a consumer set, and none they did not. */
195
- private get options();
226
+ /** The timestamp as written, in the attribute or in the light DOM. */
227
+ private get source();
196
228
  /** Whether the reading is how long ago rather than the date. */
197
229
  private get reading();
198
230
  /** What the reading says now, and when it stops being true. */
@@ -6,7 +6,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { customElement, elapsedTime, HelixElement, localeOf, RelativeClockController, relativeTime, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
- import { property, state } from 'lit/decorators.js';
9
+ import { property } from 'lit/decorators.js';
10
+ import { drawFields } from '../fields.js';
10
11
  import { formatOptions } from '../options.js';
11
12
  const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
12
13
  let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement {
@@ -22,28 +23,27 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
22
23
  if (!moment || !this.reading) {
23
24
  return undefined;
24
25
  }
25
- return this.frozen ? Number.POSITIVE_INFINITY : this.readingAt(moment, now).next;
26
+ return this.frozen ? Infinity : this.readingAt(moment, now).next;
26
27
  },
27
28
  });
28
29
  this.written = '';
29
- this.watching = undefined;
30
30
  }
31
31
  get language() {
32
32
  return localeOf(this, this.locale);
33
33
  }
34
34
  get dateOnly() {
35
- return DATE_ONLY.test((this.date || this.written).trim());
35
+ return DATE_ONLY.test(this.source);
36
36
  }
37
37
  get moment() {
38
- const source = this.date || this.written;
38
+ const source = this.source;
39
39
  if (source === '') {
40
40
  return undefined;
41
41
  }
42
42
  const parsed = new Date(source);
43
43
  return Number.isNaN(parsed.getTime()) ? undefined : parsed;
44
44
  }
45
- get options() {
46
- return formatOptions(this, this.dateOnly);
45
+ get source() {
46
+ return (this.date || this.written).trim();
47
47
  }
48
48
  get reading() {
49
49
  return this.elapsed || this.relative !== undefined;
@@ -65,7 +65,6 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
65
65
  disconnectedCallback() {
66
66
  super.disconnectedCallback();
67
67
  this.watching?.disconnect();
68
- this.watching = undefined;
69
68
  }
70
69
  firstUpdated(changed) {
71
70
  super.firstUpdated(changed);
@@ -77,14 +76,12 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
77
76
  if (this.childrenKnown) {
78
77
  this.read();
79
78
  }
80
- if (changed.has('date') ||
81
- changed.has('elapsed') ||
82
- changed.has('frozen') ||
83
- changed.has('locale') ||
84
- changed.has('numeric') ||
85
- changed.has('relative')) {
79
+ if (['date', 'elapsed', 'frozen', 'locale', 'numeric', 'relative'].some((key) => changed.has(key))) {
86
80
  this.clock.tick();
87
81
  }
82
+ const ahead = this.reading ? (this.moment?.getTime() ?? NaN) - this.clock.now : NaN;
83
+ this.toggleState('past', ahead <= 0);
84
+ this.toggleState('future', ahead > 0);
88
85
  }
89
86
  read() {
90
87
  if (this.date !== '') {
@@ -93,6 +90,7 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
93
90
  const written = this.textContent?.trim() ?? '';
94
91
  if (written !== this.written) {
95
92
  this.written = written;
93
+ this.requestUpdate();
96
94
  this.clock.tick();
97
95
  }
98
96
  }
@@ -106,26 +104,20 @@ let HelixHeadlessFormatDate = class HelixHeadlessFormatDate extends HelixElement
106
104
  if (!moment) {
107
105
  return nothing;
108
106
  }
109
- const datetime = this.dateOnly ? (this.date || this.written).trim() : moment.toISOString();
107
+ const datetime = this.dateOnly ? this.source : moment.toISOString();
110
108
  if (!this.reading) {
111
- const text = new Intl.DateTimeFormat(this.language || undefined, this.options).format(moment);
112
- return html `<time part="time" datetime=${datetime}>${text}</time>`;
109
+ const format = new Intl.DateTimeFormat(this.language || undefined, formatOptions(this, this.dateOnly));
110
+ return html `<time part="time" datetime=${datetime}>${this.fields ? drawFields(format.formatToParts(moment)) : format.format(moment)}</time>`;
113
111
  }
114
112
  const now = new Date(this.clock.now);
115
- const zone = this.timeZone || (this.dateOnly ? 'UTC' : undefined);
116
- const whole = new Intl.DateTimeFormat(this.language || undefined, {
113
+ const whole = new Intl.DateTimeFormat(this.language || undefined, formatOptions({
117
114
  dateStyle: 'long',
118
- ...(this.dateOnly ? {} : { timeStyle: 'short' }),
119
- ...(this.hourCycle ? { hourCycle: this.hourCycle } : {}),
120
- ...(zone ? { timeZone: zone } : {}),
121
- }).format(moment);
115
+ hourCycle: this.hourCycle,
116
+ timeStyle: this.dateOnly ? undefined : 'short',
117
+ timeZone: this.timeZone,
118
+ }, this.dateOnly)).format(moment);
122
119
  const spoken = relativeTime(this.language, { numeric: this.numeric ?? 'auto' })(moment, now).text;
123
- return html `<time
124
- part="time"
125
- datetime=${datetime}
126
- aria-label=${spoken}
127
- title=${whole}
128
- >${this.readingAt(moment, now).text}</time>`;
120
+ return html `<time part="time" datetime=${datetime} aria-label=${spoken} title=${whole}>${this.readingAt(moment, now).text}</time>`;
129
121
  }
130
122
  };
131
123
  __decorate([
@@ -143,6 +135,9 @@ __decorate([
143
135
  __decorate([
144
136
  property()
145
137
  ], HelixHeadlessFormatDate.prototype, "era", void 0);
138
+ __decorate([
139
+ property({ type: Boolean })
140
+ ], HelixHeadlessFormatDate.prototype, "fields", void 0);
146
141
  __decorate([
147
142
  property({ type: Boolean })
148
143
  ], HelixHeadlessFormatDate.prototype, "frozen", void 0);
@@ -185,9 +180,6 @@ __decorate([
185
180
  __decorate([
186
181
  property()
187
182
  ], HelixHeadlessFormatDate.prototype, "year", void 0);
188
- __decorate([
189
- state()
190
- ], HelixHeadlessFormatDate.prototype, "written", void 0);
191
183
  HelixHeadlessFormatDate = __decorate([
192
184
  customElement('helix-headless-format-date')
193
185
  ], HelixHeadlessFormatDate);
@@ -41,7 +41,14 @@ declare const HelixHeadlessGraph_base: (new (...args: any[]) => import("@fusion.
41
41
  * @slot - The renderer's box, which the drawing is made in.
42
42
  * @slot filter-icon - The icon in the search field. Defaults to a magnifying glass.
43
43
  * @slot footer - Content below the graph.
44
+ * @slot fullscreen-icon - Replaces the glyph inside the fullscreen button.
44
45
  * @slot header - Content above the graph.
46
+ * @slot pan-down-icon - Replaces the glyph inside the pan down button.
47
+ * @slot pan-end-icon - Replaces the glyph inside the button that pans toward the end of a line of text.
48
+ * @slot pan-start-icon - Replaces the glyph inside the button that pans toward the start of a line of text.
49
+ * @slot pan-up-icon - Replaces the glyph inside the pan up button.
50
+ * @slot zoom-in-icon - Replaces the glyph inside the zoom-in button.
51
+ * @slot zoom-out-icon - Replaces the glyph inside the zoom-out button.
45
52
  *
46
53
  * @event {HelixActivateEvent} helix-activate - A note was selected, in the list or in the drawing. The detail's `value` is its `id`.
47
54
  * @event {HelixBeforeActivateEvent} helix-before-activate - A note is about to be selected. Cancelable: cancel it to keep the selection in your own state.
@@ -91,9 +98,14 @@ declare const HelixHeadlessGraph_base: (new (...args: any[]) => import("@fusion.
91
98
  * @csspart zoom-in - The zoom in button.
92
99
  * @csspart zoom-out - The zoom out button.
93
100
  *
101
+ * @cssstate empty - The list holds no notes: the graph has none, or a search or the groups hid them all.
94
102
  * @cssstate fullscreen - The graph fills the screen.
95
103
  * @cssstate idle - The user has been still long enough for the header and footer to fade.
104
+ * @cssstate local - The drawing shows the selected note's local graph, with `depth`.
105
+ * @cssstate panel-open - A graph with `no-panel` has the search and the list open over the drawing.
96
106
  * @cssstate ready - The graph has been drawn whole, after `helix-graph-ready`.
107
+ * @cssstate searching - The search field holds words, and the list holds only the notes they find.
108
+ * @cssstate selected - A note is selected, in the list or in the drawing.
97
109
  * @cssstate sharing - The page keeps the plain wheel and one finger, with `gestures="cooperative"` or while a graph with `gestures="activate"` waits to be pressed.
98
110
  * @cssstate using - A graph with `gestures="activate"` has been pressed and has the gestures.
99
111
  */
@@ -255,14 +267,20 @@ export declare class HelixHeadlessGraph extends HelixHeadlessGraph_base {
255
267
  * drawing: a reader moving through the list was moving the graph under it.
256
268
  */
257
269
  private readonly handleListKeydown;
258
- /** What has been typed toward a note's name, and when the last letter came. */
259
- private typed;
270
+ /** What has been typed toward a note's name. */
271
+ private readonly typed;
260
272
  /**
261
- * Moves to the next note whose name starts with what was typed, as a
262
- * listbox does. Letters within half a second of each other run together,
263
- * and a repeated letter steps through the names that start with it.
273
+ * Moves to the next note whose name starts with what was typed, through
274
+ * core's `Typeahead`, as a listbox does: letters within half a second run
275
+ * together, and a repeated letter steps through the names that start with it.
264
276
  */
265
277
  private typeahead;
278
+ /**
279
+ * How many rows Page Down and Page Up move: the rows that fit in the list's
280
+ * box, or in the window where the list does not scroll, less one, so the
281
+ * row at one edge lands at the other.
282
+ */
283
+ private pageRows;
266
284
  /**
267
285
  * The search field's keys, which belong to the field and never pan the
268
286
  * graph. Escape empties a search that has words in it, and passes through
@@ -4,14 +4,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { customElement, fillTemplate, formatNumbers, HelixElement, HelixGraphFilterEvent, HelixGraphLayoutEvent, HelixGraphPanEvent, HelixGraphPartChangeEvent, HelixGraphReadyEvent, HelixGraphSignalEvent, HelixGraphZoomEvent, MixinControllerActive, MixinViewport, scrollItemIntoView, VirtualizeController, } from '@fusion.dev/helix-core';
7
+ import { customElement, fillTemplate, formatNumbers, HelixElement, HelixGraphFilterEvent, HelixGraphLayoutEvent, HelixGraphPanEvent, HelixGraphPartChangeEvent, HelixGraphReadyEvent, HelixGraphSignalEvent, HelixGraphZoomEvent, MixinControllerActive, MixinViewport, scrollItemIntoView, scrollRoom, Typeahead, VirtualizeController, } from '@fusion.dev/helix-core';
8
8
  import { list, magnifyingGlass } from '@fusion.dev/helix-icons';
9
9
  import { html, nothing } from 'lit';
10
10
  import { property, state } from 'lit/decorators.js';
11
11
  import { repeat } from 'lit/directives/repeat.js';
12
12
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
13
13
  import { adjacencyOf, entriesOf, groupsOf, nameOf, sortedOf, within, withoutGroups, } from './graph-model.js';
14
- const PAGE = 10;
15
14
  let HelixHeadlessGraph = class HelixHeadlessGraph extends MixinViewport(MixinControllerActive(HelixElement)) {
16
15
  constructor() {
17
16
  super(...arguments);
@@ -53,8 +52,8 @@ let HelixHeadlessGraph = class HelixHeadlessGraph extends MixinViewport(MixinCon
53
52
  ArrowUp: this.cursor - 1,
54
53
  End: this.entries.length - 1,
55
54
  Home: 0,
56
- PageDown: this.cursor + PAGE,
57
- PageUp: this.cursor - PAGE,
55
+ PageDown: this.cursor + this.pageRows(),
56
+ PageUp: this.cursor - this.pageRows(),
58
57
  };
59
58
  if (event.key in moves) {
60
59
  event.preventDefault();
@@ -74,7 +73,7 @@ let HelixHeadlessGraph = class HelixHeadlessGraph extends MixinViewport(MixinCon
74
73
  this.typeahead(event.key);
75
74
  }
76
75
  };
77
- this.typed = { at: 0, text: '' };
76
+ this.typed = new Typeahead();
78
77
  this.handleSearchKeydown = (event) => {
79
78
  if (event.key === 'ArrowDown') {
80
79
  event.preventDefault();
@@ -126,6 +125,9 @@ let HelixHeadlessGraph = class HelixHeadlessGraph extends MixinViewport(MixinCon
126
125
  super.willUpdate(changed);
127
126
  this.toggleState('fullscreen', this.filled);
128
127
  this.toggleState('idle', this.resting);
128
+ this.toggleState('panel-open', this.noPanel && this.panelOpen);
129
+ this.toggleState('searching', this.query.trim() !== '');
130
+ this.toggleState('selected', this.active !== '');
129
131
  if (changed.has('links')) {
130
132
  this.adjacency = adjacencyOf(this.links);
131
133
  }
@@ -141,9 +143,11 @@ let HelixHeadlessGraph = class HelixHeadlessGraph extends MixinViewport(MixinCon
141
143
  ? within(this.adjacency, this.active, Math.max(0, this.depth))
142
144
  : undefined;
143
145
  this.kept = withoutGroups(this.nodes, local, this.hiddenGroups);
146
+ this.toggleState('local', local !== undefined);
144
147
  }
145
148
  if (['nodes', 'links', 'active', 'depth', 'hiddenGroups', 'query'].some((name) => changed.has(name))) {
146
149
  this.entries = entriesOf(this.sorted, this.adjacency, this.active, this.query, this.kept);
150
+ this.toggleState('empty', this.entries.length === 0);
147
151
  this.cursor = 0;
148
152
  const list = this.partNamed('list');
149
153
  if (list) {
@@ -272,23 +276,16 @@ let HelixHeadlessGraph = class HelixHeadlessGraph extends MixinViewport(MixinCon
272
276
  return this.entries.length > 0 && (cursor < first || cursor >= last) ? cursor : undefined;
273
277
  }
274
278
  typeahead(letter) {
275
- const now = Date.now();
276
- const text = now - this.typed.at < 500 ? this.typed.text + letter : letter;
277
- this.typed = { at: now, text };
278
- const wanted = text.toLocaleLowerCase();
279
- const repeated = [...wanted].every((one) => one === wanted[0]);
280
- const prefix = repeated ? (wanted[0] ?? '') : wanted;
281
- const entries = this.entries;
282
- const start = repeated ? this.cursor + 1 : this.cursor;
283
- for (let step = 0; step < entries.length; step += 1) {
284
- const at = (start + step) % entries.length;
285
- const entry = entries[at];
286
- if (entry && nameOf(entry.node).toLocaleLowerCase().startsWith(prefix)) {
287
- this.moveTo(at);
288
- return;
289
- }
279
+ const at = this.typed.match(letter, this.entries.map((entry) => nameOf(entry.node)), this.cursor);
280
+ if (at >= 0) {
281
+ this.moveTo(at);
290
282
  }
291
283
  }
284
+ pageRows() {
285
+ const room = scrollRoom(this.partNamed('list'));
286
+ const tall = this.virtualize.sizeOf(this.cursor) || 32;
287
+ return Math.max(1, Math.floor(room / tall) - 1);
288
+ }
292
289
  togglePanel(open = !this.panelOpen) {
293
290
  const inside = this.panelOpen && this.partNamed('panel')?.contains(this.shadowRoot?.activeElement ?? null);
294
291
  this.panelOpen = open;
@@ -155,6 +155,12 @@ export declare class HelixHeadlessHeatmap extends HelixHeadlessHeatmap_base {
155
155
  * days.
156
156
  */
157
157
  rows: number;
158
+ /**
159
+ * What the readout adds for a selected cell, under `selection-mode`, after
160
+ * where the cell stands: "Day 1: 0 (1 of 14, selected)". Empty adds
161
+ * nothing.
162
+ */
163
+ selectedLabel: string;
158
164
  /**
159
165
  * What the `selection` part says after the selection changes, with `{count}` for
160
166
  * how many cells are selected.
@@ -409,6 +415,12 @@ export declare class HelixHeadlessHeatmap extends HelixHeadlessHeatmap_base {
409
415
  * pitch is `cell + gap` and both are measured.
410
416
  */
411
417
  protected renderTooltip(): TemplateResult | typeof nothing;
418
+ /**
419
+ * The readout's cursor: the pointer, with the selected word after where a
420
+ * selected cell stands, so a reader moving through the strip hears which
421
+ * cells are in the selection and not only how many.
422
+ */
423
+ private reading;
412
424
  /**
413
425
  * Which drawn cell the pointer is over, or -1.
414
426
  *
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { AriaForwardController, byRow, CHART_PLOT, commaList, customElement, drawTooltip, fillTemplate, formatNumbers, HelixBeforeChangeEvent, HelixElement, HelixResizeEvent, MixinChartSource, markRegion, pressedValue, rangeAdd, requestChange, StatusController, searchableById, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
7
+ import { AriaForwardController, byRow, CHART_PLOT, commaList, customElement, drawTooltip, fillTemplate, formatNumbers, HelixElement, HelixResizeEvent, MixinChartSource, markRegion, pressedValue, rangeAdd, requestValue, StatusController, searchableById, writtenList, writtenNumbers, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property, state } from 'lit/decorators.js';
10
10
  import '../../tooltip/index.js';
@@ -17,6 +17,7 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartSource(H
17
17
  this.gap = 2;
18
18
  this.minCell = 8;
19
19
  this.rows = 1;
20
+ this.selectedLabel = 'selected';
20
21
  this.selectionLabel = '{count} selected';
21
22
  this.thresholds = '';
22
23
  this.tones = '';
@@ -84,15 +85,9 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartSource(H
84
85
  if (next === this.value) {
85
86
  return;
86
87
  }
87
- requestChange({
88
- apply: (value) => {
89
- this.value = value;
90
- this.dispatchEvent(new Event('change', { bubbles: true, composed: true }));
91
- this.status.say(fillTemplate(this.selectionLabel, { count: commaList(value).length }));
92
- },
93
- event: (value) => new HelixBeforeChangeEvent({ value }),
94
- host: this,
95
- next,
88
+ requestValue(this, next, (value) => {
89
+ this.value = value;
90
+ this.status.say(fillTemplate(this.selectionLabel, { count: commaList(value).length }));
96
91
  });
97
92
  }
98
93
  press(index) {
@@ -277,7 +272,24 @@ let HelixHeadlessHeatmap = class HelixHeadlessHeatmap extends MixinChartSource(H
277
272
  placement: 'top',
278
273
  x: `${column * (cell + gap) + cell / 2}px`,
279
274
  y: `${row * (cell + gap)}px`,
280
- }, undefined, this.pointer);
275
+ }, undefined, this.reading(at));
276
+ }
277
+ reading(at) {
278
+ const pointer = this.pointer;
279
+ const key = this.keysOf(this.drawn)[at] ?? '';
280
+ if (!this.selectionMode || key === '' || this.selectedLabel === '') {
281
+ return pointer;
282
+ }
283
+ if (!commaList(this.value).includes(key)) {
284
+ return pointer;
285
+ }
286
+ return {
287
+ column: pointer.column,
288
+ keyed: pointer.keyed,
289
+ position: pointer.position,
290
+ shows: (cell) => pointer.shows(cell),
291
+ state: this.selectedLabel,
292
+ };
281
293
  }
282
294
  };
283
295
  __decorate([
@@ -295,6 +307,9 @@ __decorate([
295
307
  __decorate([
296
308
  property({ type: Number })
297
309
  ], HelixHeadlessHeatmap.prototype, "rows", void 0);
310
+ __decorate([
311
+ property({ attribute: 'selected-label' })
312
+ ], HelixHeadlessHeatmap.prototype, "selectedLabel", void 0);
298
313
  __decorate([
299
314
  property({ attribute: 'selection-label' })
300
315
  ], HelixHeadlessHeatmap.prototype, "selectionLabel", void 0);
@@ -16,6 +16,17 @@ import { type PropertyValues, type TemplateResult } from 'lit';
16
16
  * its own. The fallback is read once the picture fails, after the picture's
17
17
  * `alt`, so a reader hears that it did not load, as a sighted reader sees.
18
18
  *
19
+ * **An image with no `alt` says so.** At its first render it reports a
20
+ * `missing-alt` warning, printed in the console and counted by
21
+ * `@fusion.dev/helix-diagnostics`, which names the fix: describe the picture
22
+ * in `alt`, or write `alt=""` for one that is decoration. An image hidden with
23
+ * `aria-hidden="true"` needs neither and is not reported.
24
+ *
25
+ * A sheet of yours reads the state as `:state(loading)`, `:state(loaded)`,
26
+ * `:state(error)`, and `:state(waiting)`, the last while `placeholder-delay`
27
+ * holds the placeholder back. It can also read `data-status` on the host once
28
+ * the picture has loaded or failed.
29
+ *
19
30
  * @since 0.1.0
20
31
  * @status stable
21
32
  * @category media
@@ -4,10 +4,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { ariaChord, chordParts, customElement, elementById, HelixElement, HelixShortcutEvent, matchesChord, onApple, printableChord, wordsConverter, } from '@fusion.dev/helix-core';
7
+ import { ariaChord, chordParts, customElement, elementById, HelixElement, HelixShortcutEvent, keyNames, matchesChord, onApple, printableChord, wordsConverter, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
- import { keyNames } from '../keys.js';
11
10
  import { claimShortcut, releaseShortcut } from '../shortcut.js';
12
11
  const typing = (node) => {
13
12
  if (node instanceof HTMLTextAreaElement) {