@fusion.dev/helix-headless 0.148.0 → 0.149.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 (240) hide show
  1. package/custom-elements.json +6966 -1798
  2. package/dist/announcement/root/announcement-root.d.ts +5 -0
  3. package/dist/announcement/root/announcement-root.js +5 -2
  4. package/dist/area-chart/root/area-chart-root.d.ts +11 -0
  5. package/dist/area-chart/root/area-chart-root.js +20 -7
  6. package/dist/avatar/group/avatar-group.d.ts +10 -2
  7. package/dist/avatar/group/avatar-group.js +10 -5
  8. package/dist/badge/count.d.ts +6 -1
  9. package/dist/badge/count.js +3 -3
  10. package/dist/badge/root/badge-root.d.ts +6 -2
  11. package/dist/badge/root/badge-root.js +3 -3
  12. package/dist/bar-chart/root/bar-chart-root.d.ts +13 -1
  13. package/dist/bar-chart/root/bar-chart-root.js +17 -4
  14. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +8 -1
  15. package/dist/breadcrumbs/root/breadcrumbs-root.js +5 -2
  16. package/dist/button/root/button-root.d.ts +10 -1
  17. package/dist/button/root/button-root.js +3 -2
  18. package/dist/button-group/root/button-group-root.d.ts +3 -0
  19. package/dist/button-group/root/button-group-root.js +2 -2
  20. package/dist/callout/root/callout-root.d.ts +16 -2
  21. package/dist/callout/root/callout-root.js +16 -4
  22. package/dist/canvas/describe.d.ts +10 -0
  23. package/dist/canvas/describe.js +9 -0
  24. package/dist/canvas/neighbor.d.ts +17 -0
  25. package/dist/canvas/neighbor.js +1 -0
  26. package/dist/canvas/node/canvas-node.js +3 -2
  27. package/dist/canvas/root/canvas-root.d.ts +65 -8
  28. package/dist/canvas/root/canvas-root.js +115 -49
  29. package/dist/carousel/root/carousel-root.d.ts +5 -0
  30. package/dist/carousel/root/carousel-root.js +16 -5
  31. package/dist/chat/composer/chat-composer.d.ts +5 -0
  32. package/dist/chat/composer/chat-composer.js +4 -1
  33. package/dist/chat/message/chat-message.d.ts +9 -5
  34. package/dist/chat/message/chat-message.js +8 -4
  35. package/dist/chat/naming.js +2 -2
  36. package/dist/chat/root/chat-root.d.ts +27 -1
  37. package/dist/chat/root/chat-root.js +37 -9
  38. package/dist/checkbox/root/checkbox-root.d.ts +11 -0
  39. package/dist/checkbox/root/checkbox-root.js +8 -2
  40. package/dist/checkbox-group/root/checkbox-group-root.d.ts +11 -0
  41. package/dist/checkbox-group/root/checkbox-group-root.js +11 -3
  42. package/dist/code-block/root/code-block-root.d.ts +12 -2
  43. package/dist/code-block/root/code-block-root.js +12 -2
  44. package/dist/color-input/root/color-input-root.d.ts +13 -0
  45. package/dist/color-input/root/color-input-root.js +18 -5
  46. package/dist/color-picker/root/color-picker-root.d.ts +19 -3
  47. package/dist/color-picker/root/color-picker-root.js +47 -13
  48. package/dist/combobox/root/combobox-root.d.ts +36 -7
  49. package/dist/combobox/root/combobox-root.js +37 -12
  50. package/dist/command/root/command-root.d.ts +15 -6
  51. package/dist/command/root/command-root.js +9 -4
  52. package/dist/copy-button/root/copy-button-root.d.ts +5 -0
  53. package/dist/copy-button/root/copy-button-root.js +7 -2
  54. package/dist/data-table/root/data-table-root.d.ts +171 -29
  55. package/dist/data-table/root/data-table-root.js +268 -118
  56. package/dist/date-input/root/date-input-root.d.ts +32 -9
  57. package/dist/date-input/root/date-input-root.js +66 -44
  58. package/dist/date-picker/root/date-picker-root.d.ts +38 -15
  59. package/dist/date-picker/root/date-picker-root.js +52 -33
  60. package/dist/dialog/root/dialog-root.d.ts +12 -1
  61. package/dist/dialog/root/dialog-root.js +11 -4
  62. package/dist/donut-chart/root/donut-chart-root.d.ts +5 -0
  63. package/dist/donut-chart/root/donut-chart-root.js +8 -5
  64. package/dist/drawer/root/drawer-root.d.ts +12 -1
  65. package/dist/drawer/root/drawer-root.js +9 -2
  66. package/dist/drilldown/root/drilldown-root.d.ts +5 -0
  67. package/dist/drilldown/root/drilldown-root.js +4 -1
  68. package/dist/element-events.generated.js +25 -3
  69. package/dist/file-input/root/file-input-root.d.ts +18 -3
  70. package/dist/file-input/root/file-input-root.js +34 -17
  71. package/dist/filter-input/chip/filter-chip.d.ts +13 -0
  72. package/dist/filter-input/chip/filter-chip.js +6 -1
  73. package/dist/filter-input/menu/filter-menu.d.ts +5 -0
  74. package/dist/filter-input/menu/filter-menu.js +3 -1
  75. package/dist/filter-input/root/filter-input-root.d.ts +20 -3
  76. package/dist/filter-input/root/filter-input-root.js +8 -4
  77. package/dist/format-date/root/format-date-root.d.ts +20 -2
  78. package/dist/format-date/root/format-date-root.js +5 -2
  79. package/dist/graph/root/graph-model.d.ts +11 -0
  80. package/dist/graph/root/graph-model.js +4 -0
  81. package/dist/graph/root/graph-root.d.ts +78 -9
  82. package/dist/graph/root/graph-root.js +124 -27
  83. package/dist/heatmap/root/heatmap-root.d.ts +25 -4
  84. package/dist/heatmap/root/heatmap-root.js +27 -7
  85. package/dist/icon-button/root/icon-button-root.d.ts +5 -0
  86. package/dist/icon-button/root/icon-button-root.js +1 -0
  87. package/dist/input/root/input-root.d.ts +5 -0
  88. package/dist/input/root/input-root.js +4 -1
  89. package/dist/lightbox/root/lightbox-root.d.ts +14 -4
  90. package/dist/lightbox/root/lightbox-root.js +25 -7
  91. package/dist/line-chart/root/line-chart-root.d.ts +5 -0
  92. package/dist/line-chart/root/line-chart-root.js +4 -2
  93. package/dist/list/item/list-item.d.ts +32 -0
  94. package/dist/list/item/list-item.js +34 -7
  95. package/dist/list/root/list-root.d.ts +87 -0
  96. package/dist/list/root/list-root.js +112 -2
  97. package/dist/listbox/reorder/index.d.ts +1 -0
  98. package/dist/listbox/reorder/index.js +4 -0
  99. package/dist/listbox/reorder/listbox-reorder.d.ts +83 -0
  100. package/dist/listbox/reorder/listbox-reorder.js +151 -0
  101. package/dist/listbox/root/listbox-root.d.ts +68 -11
  102. package/dist/listbox/root/listbox-root.js +41 -9
  103. package/dist/loader/root/loader-root.d.ts +5 -0
  104. package/dist/loader/root/loader-root.js +3 -1
  105. package/dist/map/area/map-area.d.ts +5 -0
  106. package/dist/map/area/map-area.js +3 -1
  107. package/dist/map/buildings/map-buildings.d.ts +5 -0
  108. package/dist/map/buildings/map-buildings.js +3 -1
  109. package/dist/map/contours/map-contours.d.ts +5 -0
  110. package/dist/map/contours/map-contours.js +3 -1
  111. package/dist/map/landcover/map-landcover.d.ts +5 -0
  112. package/dist/map/landcover/map-landcover.js +3 -1
  113. package/dist/map/marker/map-marker.d.ts +16 -1
  114. package/dist/map/marker/map-marker.js +13 -5
  115. package/dist/map/points/map-points.d.ts +5 -0
  116. package/dist/map/points/map-points.js +6 -4
  117. package/dist/map/position/map-position.d.ts +5 -0
  118. package/dist/map/position/map-position.js +3 -1
  119. package/dist/map/raster/map-raster.d.ts +5 -0
  120. package/dist/map/raster/map-raster.js +3 -1
  121. package/dist/map/root/map-root.d.ts +33 -14
  122. package/dist/map/root/map-root.js +59 -22
  123. package/dist/map/route/map-route.d.ts +5 -0
  124. package/dist/map/route/map-route.js +3 -1
  125. package/dist/map/terrain/map-terrain.d.ts +5 -0
  126. package/dist/map/terrain/map-terrain.js +3 -1
  127. package/dist/menu/root/menu-root.d.ts +5 -0
  128. package/dist/menu/root/menu-root.js +3 -1
  129. package/dist/meter/root/meter-root.d.ts +16 -3
  130. package/dist/meter/root/meter-root.js +12 -5
  131. package/dist/navigation/root/navigation-root.d.ts +5 -0
  132. package/dist/navigation/root/navigation-root.js +3 -1
  133. package/dist/notifications/notification/notification.d.ts +5 -0
  134. package/dist/notifications/notification/notification.js +3 -1
  135. package/dist/notifications/root/notifications-root.d.ts +8 -0
  136. package/dist/notifications/root/notifications-root.js +10 -2
  137. package/dist/number-input/root/number-input-root.d.ts +21 -8
  138. package/dist/number-input/root/number-input-root.js +26 -11
  139. package/dist/object-inspector/root/object-inspector-root.d.ts +51 -12
  140. package/dist/object-inspector/root/object-inspector-root.js +21 -20
  141. package/dist/outline/root/outline-root.d.ts +5 -0
  142. package/dist/outline/root/outline-root.js +3 -1
  143. package/dist/pagination/root/pagination-root.d.ts +7 -1
  144. package/dist/pagination/root/pagination-root.js +16 -7
  145. package/dist/pagination/size/pagination-size.d.ts +7 -3
  146. package/dist/pagination/size/pagination-size.js +4 -2
  147. package/dist/pagination/summary/pagination-summary.d.ts +8 -6
  148. package/dist/pagination/summary/pagination-summary.js +4 -9
  149. package/dist/pin-input/code.d.ts +6 -6
  150. package/dist/pin-input/code.js +1 -5
  151. package/dist/pin-input/root/pin-input-root.d.ts +9 -3
  152. package/dist/pin-input/root/pin-input-root.js +6 -2
  153. package/dist/popover/root/popover-root.d.ts +12 -2
  154. package/dist/popover/root/popover-root.js +10 -4
  155. package/dist/progress/root/progress-root.d.ts +7 -2
  156. package/dist/progress/root/progress-root.js +5 -2
  157. package/dist/qr-code/name.d.ts +3 -2
  158. package/dist/qr-code/name.js +2 -2
  159. package/dist/qr-code/root/qr-code-root.d.ts +12 -2
  160. package/dist/qr-code/root/qr-code-root.js +9 -2
  161. package/dist/radio/group/radio-group.d.ts +11 -0
  162. package/dist/radio/group/radio-group.js +8 -2
  163. package/dist/rating/root/rating-root.d.ts +12 -1
  164. package/dist/rating/root/rating-root.js +10 -3
  165. package/dist/scatter-chart/root/scatter-chart-root.d.ts +20 -2
  166. package/dist/scatter-chart/root/scatter-chart-root.js +20 -5
  167. package/dist/select/root/select-root.d.ts +11 -0
  168. package/dist/select/root/select-root.js +13 -3
  169. package/dist/skip-link/root/skip-link-root.d.ts +5 -0
  170. package/dist/skip-link/root/skip-link-root.js +3 -1
  171. package/dist/slider/root/slider-root.d.ts +7 -2
  172. package/dist/slider/root/slider-root.js +11 -5
  173. package/dist/sparkline/readings.d.ts +15 -5
  174. package/dist/sparkline/readings.js +3 -3
  175. package/dist/sparkline/root/sparkline-root.d.ts +9 -4
  176. package/dist/sparkline/root/sparkline-root.js +9 -3
  177. package/dist/speed-dial/root/speed-dial-root.d.ts +5 -0
  178. package/dist/speed-dial/root/speed-dial-root.js +4 -1
  179. package/dist/splitter/root/splitter-root.d.ts +6 -1
  180. package/dist/splitter/root/splitter-root.js +9 -4
  181. package/dist/steps/root/steps-root.d.ts +9 -2
  182. package/dist/steps/root/steps-root.js +6 -3
  183. package/dist/steps/step/step.d.ts +12 -0
  184. package/dist/steps/step/step.js +11 -2
  185. package/dist/switch/root/switch-root.d.ts +11 -0
  186. package/dist/switch/root/switch-root.js +8 -2
  187. package/dist/table/column/table-column.d.ts +11 -4
  188. package/dist/table/column/table-column.js +15 -10
  189. package/dist/table/grid-controller.d.ts +8 -3
  190. package/dist/table/grid-controller.js +17 -11
  191. package/dist/table/root/table-root.d.ts +107 -5
  192. package/dist/table/root/table-root.js +122 -20
  193. package/dist/table/row/table-row.d.ts +42 -0
  194. package/dist/table/row/table-row.js +40 -1
  195. package/dist/tabs/root/tabs-root.d.ts +5 -0
  196. package/dist/tabs/root/tabs-root.js +3 -1
  197. package/dist/tag/group/tag-group.d.ts +5 -0
  198. package/dist/tag/group/tag-group.js +3 -1
  199. package/dist/tag/root/tag-root.d.ts +14 -1
  200. package/dist/tag/root/tag-root.js +11 -8
  201. package/dist/textarea/root/textarea-root.d.ts +5 -0
  202. package/dist/textarea/root/textarea-root.js +3 -1
  203. package/dist/time-input/root/time-input-root.d.ts +14 -7
  204. package/dist/time-input/root/time-input-root.js +43 -32
  205. package/dist/time-picker/root/time-picker-root.d.ts +15 -7
  206. package/dist/time-picker/root/time-picker-root.js +25 -12
  207. package/dist/toast/item/toast-item.d.ts +7 -0
  208. package/dist/toast/item/toast-item.js +1 -0
  209. package/dist/toast/root/toast-root.d.ts +9 -1
  210. package/dist/toast/root/toast-root.js +5 -4
  211. package/dist/toolbar/root/toolbar-root.d.ts +5 -0
  212. package/dist/toolbar/root/toolbar-root.js +5 -2
  213. package/dist/tooltip/root/tooltip-root.d.ts +27 -17
  214. package/dist/tour/root/tour-root.d.ts +8 -2
  215. package/dist/tour/root/tour-root.js +4 -2
  216. package/dist/tour/stop/tour-stop.d.ts +5 -0
  217. package/dist/tour/stop/tour-stop.js +6 -1
  218. package/dist/tree/grip.d.ts +5 -0
  219. package/dist/tree/grip.js +1 -0
  220. package/dist/tree/item/tree-item.d.ts +24 -0
  221. package/dist/tree/item/tree-item.js +27 -5
  222. package/dist/tree/root/tree-root.d.ts +66 -1
  223. package/dist/tree/root/tree-root.js +77 -5
  224. package/dist/trend/root/trend-root.d.ts +20 -4
  225. package/dist/trend/root/trend-root.js +20 -5
  226. package/dist/video/root/video-root.d.ts +12 -3
  227. package/dist/video/root/video-root.js +41 -14
  228. package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
  229. package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
  230. package/dist/video-playlist/root/video-playlist-root.d.ts +5 -0
  231. package/dist/video-playlist/root/video-playlist-root.js +3 -1
  232. package/dist/virtual-list/root/virtual-list-root.d.ts +19 -3
  233. package/dist/virtual-list/root/virtual-list-root.js +5 -2
  234. package/lint.json +1 -1
  235. package/package.json +9 -8
  236. package/types/jsx.d.ts +4014 -1862
  237. package/types/vue.d.ts +1266 -624
  238. package/types/words.d.ts +3280 -0
  239. package/dist/toast/hotkey.d.ts +0 -22
  240. package/dist/toast/hotkey.js +0 -23
@@ -77,6 +77,11 @@ declare const HelixHeadlessAnnouncement_base: (new (...args: any[]) => import("@
77
77
  * @cssstate waiting - The announcement is `queued` behind another, and renders nothing until that one is removed.
78
78
  */
79
79
  export declare class HelixHeadlessAnnouncement extends HelixHeadlessAnnouncement_base {
80
+ /**
81
+ * The key this family's words are registered under, its styled tag:
82
+ * `registerWords('de', { 'helix-announcement': { label: 'Mitteilung' } })`.
83
+ */
84
+ static words: string;
80
85
  /**
81
86
  * How long the announcement stays, in milliseconds, before it sends
82
87
  * `helix-dismiss`. When it is not set, it stays until it is dismissed.
@@ -5,12 +5,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
7
  var HelixHeadlessAnnouncement_1;
8
- import { ArrivalController, ariaChord, CountdownController, customElement, deepActiveElement, FocusScopeController, HelixElement, hostAria, MixinDismissible, markRegion, matchesChord, onApple, reportRuntime, slottedWords, } from '@fusion.dev/helix-core';
8
+ import { ArrivalController, ariaChord, CountdownController, customElement, deepActiveElement, FocusScopeController, HelixElement, hostAria, MixinDismissible, markRegion, matchesChord, onApple, reportRuntime, slottedWords, words, } from '@fusion.dev/helix-core';
9
9
  import { x } from '@fusion.dev/helix-icons';
10
10
  import { html, nothing } from 'lit';
11
11
  import { property, state } from 'lit/decorators.js';
12
12
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
13
- let HelixHeadlessAnnouncement = HelixHeadlessAnnouncement_1 = class HelixHeadlessAnnouncement extends MixinDismissible(HelixElement) {
13
+ let HelixHeadlessAnnouncement = class HelixHeadlessAnnouncement extends MixinDismissible(HelixElement) {
14
14
  constructor() {
15
15
  super(...arguments);
16
16
  this.hotkey = 'F6';
@@ -75,6 +75,8 @@ let HelixHeadlessAnnouncement = HelixHeadlessAnnouncement_1 = class HelixHeadles
75
75
  this.countdown.release();
76
76
  };
77
77
  }
78
+ static { HelixHeadlessAnnouncement_1 = this; }
79
+ static { this.words = 'helix-announcement'; }
78
80
  behind() {
79
81
  if (!this.queued || (this.shadowRoot !== null && !this.hasUpdated)) {
80
82
  return false;
@@ -207,6 +209,7 @@ __decorate([
207
209
  property()
208
210
  ], HelixHeadlessAnnouncement.prototype, "hotkey", void 0);
209
211
  __decorate([
212
+ words,
210
213
  property()
211
214
  ], HelixHeadlessAnnouncement.prototype, "label", void 0);
212
215
  __decorate([
@@ -101,6 +101,11 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
101
101
  * @csspart tooltip-value - A column's value inside the tooltip.
102
102
  */
103
103
  export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base {
104
+ /**
105
+ * The key this family's words are registered under, its styled tag:
106
+ * `registerWords('de', { 'helix-area-chart': { totalLabel: 'Summe' } })`.
107
+ */
108
+ static words: string;
104
109
  /**
105
110
  * How a band's edge gets from one reading to the next.
106
111
  *
@@ -146,6 +151,12 @@ export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base
146
151
  * fills the height and the bands are shares of it.
147
152
  */
148
153
  share: boolean;
154
+ /**
155
+ * The summary's sentence. `{reading}` is the latest reading's name,
156
+ * `{totalLabel}` the name for the sum, `{total}` the sum, written in the
157
+ * locale, and `{shares}` each part's share, listed as the locale lists.
158
+ */
159
+ summaryLabel: string;
149
160
  /**
150
161
  * The name for the sum of the parts, shown in the tooltip and the summary.
151
162
  */
@@ -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 { CHART_PLOT, customElement, drawTooltip, formatNumbers, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, reportRuntime, seriesIndex, ticks, } from '@fusion.dev/helix-core';
7
+ import { CHART_PLOT, customElement, drawTooltip, formatNumbers, formatWords, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, reportRuntime, seriesIndex, ticks, words, wordsLocale, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing, svg } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import '../../tooltip/index.js';
@@ -25,9 +25,11 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSour
25
25
  super(...arguments);
26
26
  this.overlap = false;
27
27
  this.share = false;
28
+ this.summaryLabel = '{reading}: {totalLabel} {total}; {shares}.';
28
29
  this.totalLabel = 'Total';
29
30
  this.warnedAboutNegatives = false;
30
31
  }
32
+ static { this.words = 'helix-area-chart'; }
31
33
  get rulesValue() {
32
34
  return this.gridlines !== undefined && this.gridlines !== 'category';
33
35
  }
@@ -179,18 +181,24 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSour
179
181
  renderSummary(stack, rows) {
180
182
  const last = rows.length - 1;
181
183
  const total = stack.totals[last] ?? 0;
182
- const format = formatNumbers(this.locale);
184
+ const locale = wordsLocale(this);
183
185
  const shares = stack.names.flatMap((name, depth) => this.showsSeries(name)
184
186
  ? [
185
- `${name} ${percentIn(this.locale).format(total > 0 ? (stack.values[depth]?.[last] ?? 0) / total : 0)}`,
187
+ `${name} ${percentIn(locale).format(total > 0 ? (stack.values[depth]?.[last] ?? 0) / total : 0)}`,
186
188
  ]
187
189
  : []);
188
190
  const named = this.named ? `${this.named}, ` : '';
189
- const words = `${named}${rows[last]?.label ?? ''}: ${this.totalLabel} ${format(total)}; ${shares.join(', ')}.`;
190
- return html `<p id="helix-chart-summary" part="summary">${words}</p>`;
191
+ const said = `${named}${formatWords(this, 'summaryLabel', {
192
+ reading: rows[last]?.label ?? '',
193
+ shares: new Intl.ListFormat(locale, { style: 'short', type: 'unit' }).format(shares),
194
+ total,
195
+ totalLabel: this.totalLabel,
196
+ })}`;
197
+ return html `<p id="helix-chart-summary" part="summary">${said}</p>`;
191
198
  }
192
199
  tallied(rows, stack) {
193
- const format = formatNumbers(this.locale);
200
+ const locale = wordsLocale(this);
201
+ const format = formatNumbers(locale);
194
202
  return rows.map((row, index) => {
195
203
  const total = stack.totals[index] ?? 0;
196
204
  return {
@@ -199,7 +207,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSour
199
207
  ...row.cells.map((cell, column) => this.share && cell.value !== undefined && stack.columns.includes(column) && total > 0
200
208
  ? {
201
209
  ...cell,
202
- text: `${cell.text} (${percentIn(this.locale).format(Math.max(0, cell.value) / total)})`,
210
+ text: `${cell.text} (${percentIn(locale).format(Math.max(0, cell.value) / total)})`,
203
211
  }
204
212
  : cell),
205
213
  { name: this.totalLabel, text: format(total) },
@@ -234,6 +242,11 @@ __decorate([
234
242
  property({ reflect: true, type: Boolean })
235
243
  ], HelixHeadlessAreaChart.prototype, "share", void 0);
236
244
  __decorate([
245
+ words,
246
+ property({ attribute: 'summary-label' })
247
+ ], HelixHeadlessAreaChart.prototype, "summaryLabel", void 0);
248
+ __decorate([
249
+ words,
237
250
  property({ attribute: 'total-label' })
238
251
  ], HelixHeadlessAreaChart.prototype, "totalLabel", void 0);
239
252
  HelixHeadlessAreaChart = __decorate([
@@ -36,6 +36,11 @@ export declare const FOLDS_UP_TO = 12;
36
36
  * @csspart overflow - The count of avatars past `max`, an image named by `overflow-label`.
37
37
  */
38
38
  export declare class HelixHeadlessAvatarGroup extends HelixElement {
39
+ /**
40
+ * The key this part's words are registered under, its styled tag:
41
+ * `registerWords('de', { 'helix-avatar-group': { overflowLabel: '…' } })`.
42
+ */
43
+ static words: string;
39
44
  /**
40
45
  * Accessible name for the set, such as "Reviewers".
41
46
  */
@@ -60,8 +65,11 @@ export declare class HelixHeadlessAvatarGroup extends HelixElement {
60
65
  */
61
66
  max?: number;
62
67
  /**
63
- * What a screen reader is told the count is, with `{count}` for the number
64
- * and `{names}` for the people it stands for, by each avatar's `name`.
68
+ * What a screen reader is told the count is, with `{count}` for the number,
69
+ * written in the locale, and `{names}` for the people it stands for, by each
70
+ * avatar's `name`, listed as the locale lists. A language that needs plural
71
+ * forms writes them: `{count, plural, one {# osoba więcej: {names}} few
72
+ * {# osoby więcej: {names}} other {# osób więcej: {names}}}`.
65
73
  *
66
74
  * The count shows "+3", which reads as "plus three" and says nothing about
67
75
  * what was counted, nor who.
@@ -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, fillTemplate, HelixElement, hostAria, whenHydrated, } from '@fusion.dev/helix-core';
7
+ import { customElement, formatWords, HelixElement, hostAria, whenHydrated, words, wordsLocale, } from '@fusion.dev/helix-core';
8
8
  import { html } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  export const FOLDS_UP_TO = 12;
@@ -12,9 +12,10 @@ let HelixHeadlessAvatarGroup = class HelixHeadlessAvatarGroup extends HelixEleme
12
12
  constructor() {
13
13
  super(...arguments);
14
14
  this.label = '';
15
- this.overflowLabel = '{count} more: {names}';
15
+ this.overflowLabel = '{count, plural, one {# more: {names}} other {# more: {names}}}';
16
16
  this.folded = new WeakSet();
17
17
  }
18
+ static { this.words = 'helix-avatar-group'; }
18
19
  get avatars() {
19
20
  return this.knownChildren.filter((child) => child instanceof HTMLElement);
20
21
  }
@@ -68,9 +69,12 @@ let HelixHeadlessAvatarGroup = class HelixHeadlessAvatarGroup extends HelixEleme
68
69
  ? html `<span
69
70
  part="overflow"
70
71
  role="img"
71
- aria-label=${fillTemplate(this.overflowLabel, {
72
- count: String(past),
73
- names: this.foldedNames().join(', '),
72
+ aria-label=${formatWords(this, 'overflowLabel', {
73
+ count: past,
74
+ names: new Intl.ListFormat(wordsLocale(this), {
75
+ style: 'short',
76
+ type: 'unit',
77
+ }).format(this.foldedNames()),
74
78
  }).replace(/[\s:,]+$/, '')}
75
79
  >+${past}</span
76
80
  >`
@@ -84,6 +88,7 @@ __decorate([
84
88
  property({ reflect: true, type: Number })
85
89
  ], HelixHeadlessAvatarGroup.prototype, "max", void 0);
86
90
  __decorate([
91
+ words,
87
92
  property({ attribute: 'overflow-label' })
88
93
  ], HelixHeadlessAvatarGroup.prototype, "overflowLabel", void 0);
89
94
  HelixHeadlessAvatarGroup = __decorate([
@@ -10,5 +10,10 @@ export declare const badgeText: (given: string, max: number | undefined, locale:
10
10
  /**
11
11
  * What a reader hears for the mark: `label` with `{count}` filled, or the text
12
12
  * alone, and nothing for a blank mark or an unnamed dot.
13
+ *
14
+ * `label` is a message, so it can hold plural forms: `{count, plural, one
15
+ * {{count} unread} other {{count} unread}}`. `{count}` is the text as the mark
16
+ * shows it, such as `99+`, and the form is picked by its number in `locale`'s
17
+ * rules, `other` where the text is no number.
13
18
  */
14
- export declare const badgeWords: (text: string, label: string, blank: boolean) => string;
19
+ export declare const badgeWords: (text: string, label: string, blank: boolean, locale?: string) => string;
@@ -1,4 +1,4 @@
1
- import { fillTemplate, formatNumber } from '@fusion.dev/helix-core';
1
+ import { formatMessage, formatNumber } from '@fusion.dev/helix-core';
2
2
  export const badgeBlank = (given) => given.trim() !== '' && Number(given) === 0;
3
3
  export const badgeCapped = (given, max) => {
4
4
  const count = Number(given);
@@ -12,9 +12,9 @@ export const badgeText = (given, max, locale, options) => {
12
12
  const count = Number(given);
13
13
  return options && given.trim() !== '' && Number.isFinite(count) ? write(count) : given;
14
14
  };
15
- export const badgeWords = (text, label, blank) => {
15
+ export const badgeWords = (text, label, blank, locale = '') => {
16
16
  if (blank || (text === '' && label === '')) {
17
17
  return '';
18
18
  }
19
- return fillTemplate(label, { count: text }) || text;
19
+ return formatMessage(label, { count: text }, locale) || text;
20
20
  };
@@ -64,12 +64,16 @@ export declare class HelixHeadlessBadge extends HelixElement {
64
64
  * Required for a dot, which has no text to read. `{count}` is replaced with
65
65
  * what the badge shows, so `label="{count} unread"` reads "8 unread" and
66
66
  * stays current as `value` changes, with no label of yours to keep in step.
67
+ * A language with plural forms writes them, `{count, plural, one {{count}
68
+ * nieprzeczytana} few {{count} nieprzeczytane} other {{count}
69
+ * nieprzeczytanych}}`, picked by the count in `locale`.
67
70
  */
68
71
  label: string;
69
72
  /**
70
- * The locale a count is written in under `format-options`, such as `de`.
73
+ * The locale a count is written in under `format-options`, and whose plural
74
+ * rules `label` picks a form by, such as `de`.
71
75
  *
72
- * Absent uses the runtime's own.
76
+ * Absent reads the nearest `lang`, then the runtime's own.
73
77
  */
74
78
  locale: string;
75
79
  /**
@@ -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, focusTarget, HelixElement } from '@fusion.dev/helix-core';
7
+ import { customElement, focusTarget, HelixElement, wordsLocale } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import { badgeBlank, badgeCapped, badgeText, badgeWords } from '../count.js';
@@ -28,10 +28,10 @@ let HelixHeadlessBadge = class HelixHeadlessBadge extends HelixElement {
28
28
  return badgeCapped(this.given, this.max);
29
29
  }
30
30
  get text() {
31
- return badgeText(this.given, this.max, this.locale, this.formatOptions);
31
+ return badgeText(this.given, this.max, wordsLocale(this), this.formatOptions);
32
32
  }
33
33
  get words() {
34
- return badgeWords(this.text, this.label, this.blank);
34
+ return badgeWords(this.text, this.label, this.blank, wordsLocale(this));
35
35
  }
36
36
  wrapped() {
37
37
  const found = this.renderRoot
@@ -78,6 +78,11 @@ declare const HelixHeadlessBarChart_base: typeof HelixElement & (new (...args: a
78
78
  * `wash="gradient"` is set.
79
79
  */
80
80
  export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
81
+ /**
82
+ * The key this family's words are registered under, its styled tag:
83
+ * `registerWords('de', { 'helix-bar-chart': { highestLabel: 'Höchster Wert' } })`.
84
+ */
85
+ static words: string;
81
86
  /**
82
87
  * Which gridlines are drawn across the plot, if any.
83
88
  *
@@ -100,7 +105,8 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
100
105
  */
101
106
  gridlines?: 'both' | 'category' | 'value';
102
107
  /**
103
- * The word the summary puts before each series' highest reading.
108
+ * The name the summary gives each series' highest reading, `{highestLabel}`
109
+ * in `summary-label`.
104
110
  */
105
111
  highestLabel: string;
106
112
  /**
@@ -187,6 +193,12 @@ export declare class HelixHeadlessBarChart extends HelixHeadlessBarChart_base {
187
193
  * second scale stack among themselves.
188
194
  */
189
195
  stacked: boolean;
196
+ /**
197
+ * The summary's sentence. `{highestLabel}` is `highest-label`, and
198
+ * `{readings}` each series' highest reading: the series, the category and
199
+ * the reading as the table writes it.
200
+ */
201
+ summaryLabel: string;
190
202
  /** The series names on the second scale, lowercased and trimmed. */
191
203
  private get scaled();
192
204
  /** The series names drawn as a line, lowercased and trimmed for matching. */
@@ -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 { byRow, CHART_PLOT, customElement, drawTooltip, extent, formatNumbers, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, seriesNames, ticks, unbroken, } from '@fusion.dev/helix-core';
7
+ import { byRow, CHART_PLOT, customElement, drawTooltip, extent, formatNumbers, formatWords, HelixElement, linear, linePath, MixinChartSource, PLOT_HEIGHT, PLOT_WIDTH, seriesIndex, seriesKey, seriesNames, ticks, unbroken, words, wordsLocale, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing, svg } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import { stackEnds, stackedReadings, stackSpans } from '../stack.js';
@@ -14,7 +14,9 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartSource
14
14
  super(...arguments);
15
15
  this.highestLabel = 'Highest';
16
16
  this.stacked = false;
17
+ this.summaryLabel = '{highestLabel}: {readings}.';
17
18
  }
19
+ static { this.words = 'helix-bar-chart'; }
18
20
  get scaled() {
19
21
  return new Set(seriesNames(this.secondary));
20
22
  }
@@ -58,9 +60,10 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartSource
58
60
  const [second, top] = extent(scaled.size > 0 ? on(own) : [0]);
59
61
  const other = [Math.min(0, second), Math.max(0, top)];
60
62
  const z = scaled.size > 0 ? linear(other, range) : undefined;
63
+ const format = formatNumbers(wordsLocale(this));
61
64
  const widest = z === undefined
62
65
  ? 0
63
- : Math.max(...[...ticks(domain), ...ticks(other)].map((level) => formatNumbers(this.locale)(level).length));
66
+ : Math.max(...[...ticks(domain), ...ticks(other)].map((level) => format(level).length));
64
67
  const lone = series.filter(own);
65
68
  const tint = lone.length === 1 && lone[0] !== undefined
66
69
  ? `--bar-chart-secondary: var(--chart-series-${seriesIndex(series.indexOf(lone[0]))})`
@@ -79,7 +82,11 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartSource
79
82
  return [`${one.name} ${top.label} ${text}`];
80
83
  });
81
84
  const named = this.named ? `${this.named}. ` : '';
82
- return html `<p id="helix-chart-summary" part="summary">${named}${this.highestLabel}: ${highest.join('; ')}.</p>`;
85
+ const said = formatWords(this, 'summaryLabel', {
86
+ highestLabel: this.highestLabel,
87
+ readings: highest.join('; '),
88
+ });
89
+ return html `<p id="helix-chart-summary" part="summary">${named}${said}</p>`;
83
90
  }
84
91
  renderPlot(series, categories, y, domain, floor, z) {
85
92
  const sideways = this.orientation === 'horizontal';
@@ -188,6 +195,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartSource
188
195
  }
189
196
  renderAxis(scale, domain, which, sideways, widest, tint) {
190
197
  const sizing = sideways ? undefined : `--bar-chart-axis: ${widest}ch`;
198
+ const format = formatNumbers(wordsLocale(this));
191
199
  return html `<div
192
200
  aria-hidden="true"
193
201
  data-axis=${which}
@@ -197,7 +205,7 @@ let HelixHeadlessBarChart = class HelixHeadlessBarChart extends MixinChartSource
197
205
  ${ticks(domain).map((level) => html `<span
198
206
  part="tick"
199
207
  style=${sideways ? `inset-inline-start: ${scale(level)}%` : `inset-block-start: ${scale(level)}%`}
200
- >${formatNumbers(this.locale)(level)}</span
208
+ >${format(level)}</span
201
209
  >`)}
202
210
  </div>`;
203
211
  }
@@ -282,6 +290,7 @@ __decorate([
282
290
  property()
283
291
  ], HelixHeadlessBarChart.prototype, "gridlines", void 0);
284
292
  __decorate([
293
+ words,
285
294
  property({ attribute: 'highest-label' })
286
295
  ], HelixHeadlessBarChart.prototype, "highestLabel", void 0);
287
296
  __decorate([
@@ -296,6 +305,10 @@ __decorate([
296
305
  __decorate([
297
306
  property({ reflect: true, type: Boolean })
298
307
  ], HelixHeadlessBarChart.prototype, "stacked", void 0);
308
+ __decorate([
309
+ words,
310
+ property({ attribute: 'summary-label' })
311
+ ], HelixHeadlessBarChart.prototype, "summaryLabel", void 0);
299
312
  HelixHeadlessBarChart = __decorate([
300
313
  customElement('helix-headless-bar-chart')
301
314
  ], HelixHeadlessBarChart);
@@ -60,9 +60,16 @@ export interface BreadcrumbItem {
60
60
  * @csspart list - The ordered list.
61
61
  */
62
62
  export declare class HelixHeadlessBreadcrumbs extends HelixElement {
63
+ /**
64
+ * The key this family's words are registered under, its styled tag:
65
+ * `registerWords('de', { 'helix-breadcrumbs': { label: 'Brotkrümelpfad' } })`.
66
+ */
67
+ static words: string;
63
68
  /**
64
69
  * The name of the button that shows a folded trail's hidden crumbs. `{count}`
65
- * is replaced by how many it shows. Translate it with the page.
70
+ * is how many it shows, written in the locale, and a language with plural
71
+ * forms writes them: `{count, plural, one {# weiteren zeigen} other {#
72
+ * weitere zeigen}}`.
66
73
  */
67
74
  expandLabel: string;
68
75
  /**
@@ -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, fillTemplate, HelixElement, hostAria } from '@fusion.dev/helix-core';
7
+ import { customElement, formatWords, HelixElement, hostAria, words } from '@fusion.dev/helix-core';
8
8
  import { nothing } from 'lit';
9
9
  import { property, state } from 'lit/decorators.js';
10
10
  import { repeat } from 'lit/directives/repeat.js';
@@ -25,6 +25,7 @@ let HelixHeadlessBreadcrumbs = class HelixHeadlessBreadcrumbs extends HelixEleme
25
25
  });
26
26
  };
27
27
  }
28
+ static { this.words = 'helix-breadcrumbs'; }
28
29
  willUpdate(changed) {
29
30
  super.willUpdate(changed);
30
31
  hostAria(this.internals, { label: this.label, role: 'navigation' });
@@ -55,7 +56,7 @@ let HelixHeadlessBreadcrumbs = class HelixHeadlessBreadcrumbs extends HelixEleme
55
56
  ><button
56
57
  part="expand"
57
58
  type="button"
58
- aria-label=${fillTemplate(this.expandLabel, { count: String(folded) })}
59
+ aria-label=${formatWords(this, 'expandLabel', { count: folded })}
59
60
  @click=${this.expand}
60
61
  >
61
62
  …
@@ -81,12 +82,14 @@ let HelixHeadlessBreadcrumbs = class HelixHeadlessBreadcrumbs extends HelixEleme
81
82
  }
82
83
  };
83
84
  __decorate([
85
+ words,
84
86
  property({ attribute: 'expand-label' })
85
87
  ], HelixHeadlessBreadcrumbs.prototype, "expandLabel", void 0);
86
88
  __decorate([
87
89
  property({ attribute: false })
88
90
  ], HelixHeadlessBreadcrumbs.prototype, "items", void 0);
89
91
  __decorate([
92
+ words,
90
93
  property()
91
94
  ], HelixHeadlessBreadcrumbs.prototype, "label", void 0);
92
95
  __decorate([
@@ -59,6 +59,11 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
59
59
  * @cssstate pending - The button is pending: `pending` is set.
60
60
  */
61
61
  export declare class HelixHeadlessButton extends HelixFormElement {
62
+ /**
63
+ * The key this family's words are registered under, its styled tag:
64
+ * `registerWords('de', { 'helix-button': { pendingLabel: 'Wird geladen' } })`.
65
+ */
66
+ static words: string;
62
67
  protected readonly aria: AriaForwardController;
63
68
  /**
64
69
  * @internal Whether a host `aria-label` names the inner button. A subclass
@@ -167,8 +172,12 @@ export declare class HelixHeadlessButton extends HelixFormElement {
167
172
  * Lives here rather than only on `IconButton` so the two share one render.
168
173
  * An icon-only button without it is a control a screen reader announces as
169
174
  * "button" and nothing else.
175
+ *
176
+ * Undefaulted, so a subclass's own default, such as Copy Button's `Copy`, is
177
+ * the first value its element receives and so the English its words fall
178
+ * back to.
170
179
  */
171
- label: string;
180
+ label?: string;
172
181
  /**
173
182
  * Whether the action the button started is still running.
174
183
  *
@@ -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, defaultButton, drawStatus, elementById, HelixFallbackCommandEvent, HelixFormElement, HelixPressEvent, pressType, StatusController, submitsOnEnter, supportsInvokers, } from '@fusion.dev/helix-core';
7
+ import { AriaForwardController, customElement, defaultButton, drawStatus, elementById, HelixFallbackCommandEvent, HelixFormElement, HelixPressEvent, pressType, StatusController, submitsOnEnter, supportsInvokers, words, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import { submitAs } from '../submitter.js';
@@ -24,7 +24,6 @@ let HelixHeadlessButton = class HelixHeadlessButton extends HelixFormElement {
24
24
  this.formMethod = '';
25
25
  this.formNoValidate = false;
26
26
  this.formTarget = '';
27
- this.label = '';
28
27
  this.pending = false;
29
28
  this.pendingLabel = 'Loading';
30
29
  this.status = new StatusController(this);
@@ -64,6 +63,7 @@ let HelixHeadlessButton = class HelixHeadlessButton extends HelixFormElement {
64
63
  }
65
64
  };
66
65
  }
66
+ static { this.words = 'helix-button'; }
67
67
  get forwardsLabel() {
68
68
  return true;
69
69
  }
@@ -229,6 +229,7 @@ __decorate([
229
229
  property({ type: Boolean })
230
230
  ], HelixHeadlessButton.prototype, "pending", void 0);
231
231
  __decorate([
232
+ words,
232
233
  property({ attribute: 'pending-label' })
233
234
  ], HelixHeadlessButton.prototype, "pendingLabel", void 0);
234
235
  __decorate([
@@ -118,6 +118,9 @@ export declare class HelixHeadlessButtonGroup extends HelixElement {
118
118
  /**
119
119
  * Whether the group holds the tab stop and the arrow keys: in a selection
120
120
  * mode, and not inside a toolbar, whose own keys walk the buttons.
121
+ *
122
+ * Truthiness, as `buttons` reads it: a removed attribute leaves the property
123
+ * null, which is no selection mode.
121
124
  */
122
125
  private get roving();
123
126
  /** Whether a button is pressed: its value is among the group's. */
@@ -47,7 +47,7 @@ let HelixHeadlessButtonGroup = class HelixHeadlessButtonGroup extends HelixEleme
47
47
  return this.selectionMode && this.children ? [...this.children].filter(isGroupButton) : [];
48
48
  }
49
49
  get roving() {
50
- return this.selectionMode !== undefined && toolbarAround(this) === null;
50
+ return Boolean(this.selectionMode) && toolbarAround(this) === null;
51
51
  }
52
52
  pressed(button) {
53
53
  return button.value !== '' && commaList(this.value).includes(button.value);
@@ -142,7 +142,7 @@ let HelixHeadlessButtonGroup = class HelixHeadlessButtonGroup extends HelixEleme
142
142
  }
143
143
  willUpdate(changed) {
144
144
  super.willUpdate(changed);
145
- const toolbar = this.selectionMode !== undefined && toolbarAround(this) === null;
145
+ const toolbar = this.roving;
146
146
  hostAria(this.internals, { label: this.label, role: toolbar ? 'toolbar' : 'group' });
147
147
  this.internals.ariaOrientation = toolbar ? (this.orientation ?? null) : null;
148
148
  }
@@ -42,6 +42,11 @@ declare const HelixHeadlessCallout_base: (new (...args: any[]) => import("@fusio
42
42
  * @csspart icon-mark - The icon for the tone, shown when no icon is slotted.
43
43
  */
44
44
  export declare class HelixHeadlessCallout extends HelixHeadlessCallout_base {
45
+ /**
46
+ * The key this family's words are registered under, its styled tag:
47
+ * `registerWords('de', { 'helix-callout': { toneLabels: { danger: 'Fehler' } } })`.
48
+ */
49
+ static words: string;
45
50
  protected willUpdate(changed: PropertyValues): void;
46
51
  /**
47
52
  * What kind of attention the passage needs.
@@ -55,10 +60,19 @@ export declare class HelixHeadlessCallout extends HelixHeadlessCallout_base {
55
60
  /**
56
61
  * What a screen reader is told the tone is, such as "Fehler".
57
62
  *
58
- * Absent is the English for the tone: "Error", "Information", "Note",
59
- * "Success" or "Warning".
63
+ * Absent is the tone's words in `tone-labels`, "Error", "Information",
64
+ * "Note", "Success" or "Warning" in English.
60
65
  */
61
66
  toneLabel: string;
67
+ /**
68
+ * What a screen reader is told each tone is, by the tone's name, written as
69
+ * JSON in the attribute: `tone-labels='{"danger":"Fehler"}'`. A tone left
70
+ * out keeps its English, and `tone-label` wins over both.
71
+ *
72
+ * `danger` is said as "Error", the word a reader understands, and
73
+ * `neutral` as "Note", for what the passage is.
74
+ */
75
+ toneLabels: Partial<Record<'danger' | 'info' | 'neutral' | 'success' | 'warning', string>>;
62
76
  /**
63
77
  * The mark for the callout's tone, behind a seam.
64
78
  *
@@ -4,16 +4,23 @@ 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, drawDismiss, drawDismissGlyph, HelixElement, hostAria, MixinDismissible, TONE_MARKS, toneMark, } from '@fusion.dev/helix-core';
7
+ import { customElement, drawDismiss, drawDismissGlyph, HelixElement, hostAria, MixinDismissible, TONE_MARKS, toneMark, words, wordsConverter, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
11
- const NOTE = { icon: TONE_MARKS.info.icon, label: 'Note' };
12
11
  let HelixHeadlessCallout = class HelixHeadlessCallout extends MixinDismissible(HelixElement) {
13
12
  constructor() {
14
13
  super(...arguments);
15
14
  this.toneLabel = '';
15
+ this.toneLabels = {
16
+ danger: 'Error',
17
+ info: 'Information',
18
+ neutral: 'Note',
19
+ success: 'Success',
20
+ warning: 'Warning',
21
+ };
16
22
  }
23
+ static { this.words = 'helix-callout'; }
17
24
  willUpdate(changed) {
18
25
  super.willUpdate(changed);
19
26
  hostAria(this.internals, { role: 'note' });
@@ -31,8 +38,9 @@ let HelixHeadlessCallout = class HelixHeadlessCallout extends MixinDismissible(H
31
38
  </slot>`;
32
39
  }
33
40
  render() {
34
- const { icon, label } = this.tone === 'neutral' ? NOTE : (toneMark(this.tone) ?? TONE_MARKS.info);
35
- const named = this.toneLabel || label;
41
+ const tone = this.tone === 'neutral' ? 'neutral' : toneMark(this.tone) ? (this.tone ?? 'info') : 'info';
42
+ const { icon } = toneMark(tone) ?? TONE_MARKS.info;
43
+ const named = this.toneLabel || (this.toneLabels[tone] ?? '');
36
44
  return html `<span part="icon" role="img" aria-label=${named}>${this.renderIcon(icon, named)}</span>
37
45
  <div part="content">
38
46
  <slot name="heading"></slot>
@@ -52,6 +60,10 @@ __decorate([
52
60
  __decorate([
53
61
  property({ attribute: 'tone-label' })
54
62
  ], HelixHeadlessCallout.prototype, "toneLabel", void 0);
63
+ __decorate([
64
+ words,
65
+ property({ attribute: 'tone-labels', converter: wordsConverter })
66
+ ], HelixHeadlessCallout.prototype, "toneLabels", void 0);
55
67
  HelixHeadlessCallout = __decorate([
56
68
  customElement('helix-headless-callout')
57
69
  ], HelixHeadlessCallout);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The words that describe a card or a connection, such as whether it is
3
+ * selected, what its tone means and where its connections go, as one list in
4
+ * the way `locale` writes one: "selected, Blocked" in English, "selected und
5
+ * Blocked" in German. An empty word is left out, and nothing at all is empty.
6
+ *
7
+ * **A narrow conjunction**, which English writes with commas alone, so the
8
+ * English reads as it did when the words were joined with a comma.
9
+ */
10
+ export declare const descriptionOf: (locale: string, words: readonly (string | undefined)[]) => string;