@zeyos/zx 5.7.0 → 5.8.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 (330) hide show
  1. package/CHANGELOG.md +330 -0
  2. package/README.md +47 -9
  3. package/dist/types/components/activity-item/activity-item.d.ts +14 -3
  4. package/dist/types/components/agent-avatar/agent-avatar.d.ts +165 -0
  5. package/dist/types/components/agent-avatar/agent-face.d.ts +93 -0
  6. package/dist/types/components/agent-thread/ag-ui.d.ts +21 -9
  7. package/dist/types/components/agent-thread/agent-thread.d.ts +26 -0
  8. package/dist/types/components/agent-thread/ui-message-stream.d.ts +3 -1
  9. package/dist/types/components/approval-card/approval-card.d.ts +31 -2
  10. package/dist/types/components/aurora/aurora.d.ts +31 -5
  11. package/dist/types/components/calendar/calendar.d.ts +39 -26
  12. package/dist/types/components/chart/chart.d.ts +250 -20
  13. package/dist/types/components/chart/color.d.ts +66 -0
  14. package/dist/types/components/chart/svg-adapter.d.ts +103 -0
  15. package/dist/types/components/chart/svg-geometry.d.ts +203 -0
  16. package/dist/types/components/check-button/check-button.d.ts +1 -4
  17. package/dist/types/components/checklist/checklist.d.ts +48 -5
  18. package/dist/types/components/code-editor/code-editor.d.ts +55 -1
  19. package/dist/types/components/composer/composer.d.ts +41 -6
  20. package/dist/types/components/context-menu/context-menu.d.ts +36 -8
  21. package/dist/types/components/copy/copy-button.d.ts +6 -0
  22. package/dist/types/components/copy/copy-input.d.ts +1 -0
  23. package/dist/types/components/date-picker/date-picker.d.ts +14 -0
  24. package/dist/types/components/date-picker/time-picker.d.ts +26 -17
  25. package/dist/types/components/datebox/datebox.d.ts +8 -4
  26. package/dist/types/components/dialog/dialog.d.ts +15 -4
  27. package/dist/types/components/empty-state/empty-state.d.ts +10 -1
  28. package/dist/types/components/field/field.d.ts +4 -2
  29. package/dist/types/components/form/form.d.ts +2 -1
  30. package/dist/types/components/kanban-view/kanban-card.d.ts +7 -0
  31. package/dist/types/components/kanban-view/kanban-view.d.ts +15 -3
  32. package/dist/types/components/launcher/launcher.d.ts +26 -0
  33. package/dist/types/components/master-panel/master-panel.d.ts +9 -4
  34. package/dist/types/components/menu-button/menu-button.d.ts +29 -5
  35. package/dist/types/components/message/message.d.ts +308 -5
  36. package/dist/types/components/modal/modal.d.ts +45 -8
  37. package/dist/types/components/modal/native-dialog.d.ts +40 -0
  38. package/dist/types/components/module-bar/module-bar.d.ts +9 -2
  39. package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +5 -4
  40. package/dist/types/components/number-field/number-field.d.ts +31 -1
  41. package/dist/types/components/pagination/pagination.d.ts +341 -19
  42. package/dist/types/components/run-status/run-status.d.ts +26 -0
  43. package/dist/types/components/run-trace/run-trace.d.ts +10 -6
  44. package/dist/types/components/search/search.d.ts +16 -4
  45. package/dist/types/components/select/select.d.ts +19 -1
  46. package/dist/types/components/sheet/sheet.d.ts +20 -6
  47. package/dist/types/components/slider/slider.d.ts +2 -1
  48. package/dist/types/components/stat-tile/stat-tile.d.ts +20 -3
  49. package/dist/types/components/stepper/stepper.d.ts +17 -4
  50. package/dist/types/components/surface/catalog.d.ts +61 -17
  51. package/dist/types/components/surface/surface.d.ts +6 -4
  52. package/dist/types/components/table/table.d.ts +207 -5
  53. package/dist/types/components/table/window.d.ts +25 -1
  54. package/dist/types/components/toggle/toggle.d.ts +38 -6
  55. package/dist/types/components/tooltip/tooltip.d.ts +5 -4
  56. package/dist/types/components/tree/tree.d.ts +43 -6
  57. package/dist/types/components/truncate/truncate.d.ts +4 -2
  58. package/dist/types/components/value-list/value-list.d.ts +9 -2
  59. package/dist/types/core/date.d.ts +2 -1
  60. package/dist/types/core/dom.d.ts +14 -0
  61. package/dist/types/core/drag-axis.d.ts +10 -5
  62. package/dist/types/core/export.d.ts +2 -2
  63. package/dist/types/core/format.d.ts +3 -1
  64. package/dist/types/core/icons.d.ts +36 -3
  65. package/dist/types/core/keyboard.d.ts +7 -3
  66. package/dist/types/core/messages.d.ts +3 -0
  67. package/dist/types/core/storage.d.ts +4 -3
  68. package/dist/types/core/util.d.ts +3 -1
  69. package/dist/types/elements/define.d.ts +5 -2
  70. package/dist/types/index.d.ts +6 -4
  71. package/dist/types/internal/agent-model.d.ts +99 -0
  72. package/dist/types/internal/app-rail.d.ts +37 -2
  73. package/dist/types/internal/collections.d.ts +18 -0
  74. package/dist/types/internal/menu-items.d.ts +27 -0
  75. package/dist/types/internal/overlay-content.d.ts +23 -0
  76. package/dist/types/internal/presence-loop.d.ts +5 -2
  77. package/dist/types/locales/index.d.ts +3 -0
  78. package/dist/types/zeyos/calendar.d.ts +43 -7
  79. package/dist/types/zeyos/connect.d.ts +4 -0
  80. package/dist/types/zeyos/form.d.ts +13 -5
  81. package/dist/types/zeyos/select.d.ts +5 -2
  82. package/dist/types/zeyos/table.d.ts +16 -8
  83. package/dist/types/zeyos/view.d.ts +2 -1
  84. package/dist/zx-zeyos.esm.js +3161 -515
  85. package/dist/zx-zeyos.esm.min.js +4 -4
  86. package/dist/zx.core.css +4 -0
  87. package/dist/zx.core.min.css +1 -1
  88. package/dist/zx.css +970 -57
  89. package/dist/zx.esm.js +6405 -2249
  90. package/dist/zx.esm.min.js +26 -26
  91. package/dist/zx.global.js +6405 -2249
  92. package/dist/zx.global.min.js +26 -26
  93. package/dist/zx.layered.css +972 -57
  94. package/dist/zx.layered.min.css +1 -1
  95. package/dist/zx.min.css +1 -1
  96. package/docs/agent-catalog.json +159 -1
  97. package/docs/agent-surfaces.md +21 -21
  98. package/docs/api.json +3154 -518
  99. package/docs/components/account-menu.md +24 -0
  100. package/docs/components/activity-item.md +23 -0
  101. package/docs/components/activity-list.md +28 -0
  102. package/docs/components/agent-avatar.md +59 -0
  103. package/docs/components/agent-thread.md +275 -0
  104. package/docs/components/app-icon.md +36 -0
  105. package/docs/components/app-sidebar.md +92 -0
  106. package/docs/components/approval-card.md +71 -0
  107. package/docs/components/aurora.md +34 -0
  108. package/docs/components/avatar.md +37 -0
  109. package/docs/components/badge.md +36 -0
  110. package/docs/components/block-view.md +34 -0
  111. package/docs/components/breadcrumb.md +20 -0
  112. package/docs/components/button.md +23 -0
  113. package/docs/components/calendar.md +68 -0
  114. package/docs/components/card-view.md +73 -0
  115. package/docs/components/card.md +25 -0
  116. package/docs/components/chart.md +109 -0
  117. package/docs/components/check-button.md +16 -0
  118. package/docs/components/checklist.md +19 -0
  119. package/docs/components/code-editor.md +38 -0
  120. package/docs/components/composer.md +107 -0
  121. package/docs/components/context-menu.md +32 -0
  122. package/docs/components/copy.md +37 -0
  123. package/docs/components/data-filter.md +16 -0
  124. package/docs/components/date-picker.md +31 -0
  125. package/docs/components/date-range.md +21 -0
  126. package/docs/components/datebox.md +31 -0
  127. package/docs/components/dialog.md +25 -0
  128. package/docs/components/dock.md +57 -0
  129. package/docs/components/dropdown.md +39 -0
  130. package/docs/components/elements.md +63 -0
  131. package/docs/components/empty-state.md +17 -0
  132. package/docs/components/entity-ref.md +26 -0
  133. package/docs/components/field-upload.md +18 -0
  134. package/docs/components/file-item.md +27 -0
  135. package/docs/components/file-list.md +23 -0
  136. package/docs/components/filter-panel.md +45 -0
  137. package/docs/components/filter.md +47 -0
  138. package/docs/components/finder.md +25 -0
  139. package/docs/components/form-widgets.md +42 -0
  140. package/docs/components/form.md +80 -0
  141. package/docs/components/grid.md +26 -0
  142. package/docs/components/groupbox.md +11 -0
  143. package/docs/components/helpers.md +359 -0
  144. package/docs/components/icons.md +87 -0
  145. package/docs/components/index.md +99 -0
  146. package/docs/components/kanban-view.md +42 -0
  147. package/docs/components/kbd.md +23 -0
  148. package/docs/components/kernel.md +41 -0
  149. package/docs/components/launcher.md +66 -0
  150. package/docs/components/layout.md +33 -0
  151. package/docs/components/list-toolbar.md +38 -0
  152. package/docs/components/loading.md +48 -0
  153. package/docs/components/menu-button.md +47 -0
  154. package/docs/components/message.md +76 -0
  155. package/docs/components/modal.md +27 -0
  156. package/docs/components/module-bar.md +71 -0
  157. package/docs/components/multi-value-editor.md +16 -0
  158. package/docs/components/navigation-bar.md +22 -0
  159. package/docs/components/number-field.md +34 -0
  160. package/docs/components/pagination.md +73 -0
  161. package/docs/components/panel.md +28 -0
  162. package/docs/components/prompt-starters.md +40 -0
  163. package/docs/components/prose.md +38 -0
  164. package/docs/components/questionnaire.md +115 -0
  165. package/docs/components/rating.md +19 -0
  166. package/docs/components/run-status.md +50 -0
  167. package/docs/components/run-trace.md +72 -0
  168. package/docs/components/search.md +11 -0
  169. package/docs/components/select.md +129 -0
  170. package/docs/components/sheet-stack.md +39 -0
  171. package/docs/components/sheet.md +77 -0
  172. package/docs/components/skeleton.md +27 -0
  173. package/docs/components/slider.md +29 -0
  174. package/docs/components/sort-control.md +21 -0
  175. package/docs/components/source-list.md +30 -0
  176. package/docs/components/split-view.md +12 -0
  177. package/docs/components/stat-tile.md +49 -0
  178. package/docs/components/stepper.md +27 -0
  179. package/docs/components/surface.md +152 -0
  180. package/docs/components/tabbox.md +33 -0
  181. package/docs/components/table-view.md +43 -0
  182. package/docs/components/table.md +232 -0
  183. package/docs/components/tag-picker.md +39 -0
  184. package/docs/components/timebox.md +16 -0
  185. package/docs/components/toggle.md +21 -0
  186. package/docs/components/tokens.md +82 -0
  187. package/docs/components/toolbar.md +26 -0
  188. package/docs/components/tooltip.md +16 -0
  189. package/docs/components/tree.md +48 -0
  190. package/docs/components/truncate.md +21 -0
  191. package/docs/components/value-list.md +14 -0
  192. package/docs/components/view-settings.md +56 -0
  193. package/docs/components/workspace-switcher.md +42 -0
  194. package/docs/components/zeyos.md +196 -0
  195. package/docs/llms-small.txt +299 -0
  196. package/docs/llms.md +725 -109
  197. package/docs/llms.txt +46 -19
  198. package/package.json +9 -4
  199. package/src/components/activity-item/activity-item.js +21 -2
  200. package/src/components/agent-avatar/agent-avatar.css +195 -0
  201. package/src/components/agent-avatar/agent-avatar.js +333 -0
  202. package/src/components/agent-avatar/agent-face.js +292 -0
  203. package/src/components/agent-thread/ag-ui.js +44 -11
  204. package/src/components/agent-thread/agent-thread.js +103 -11
  205. package/src/components/agent-thread/ui-message-stream.js +3 -1
  206. package/src/components/app-rail/app-rail.css +5 -0
  207. package/src/components/app-sidebar/app-sidebar.css +3 -0
  208. package/src/components/app-sidebar/app-sidebar.js +4 -3
  209. package/src/components/approval-card/approval-card.css +6 -0
  210. package/src/components/approval-card/approval-card.js +55 -7
  211. package/src/components/aurora/aurora.css +149 -14
  212. package/src/components/aurora/aurora.js +49 -6
  213. package/src/components/button/button.css +24 -11
  214. package/src/components/calendar/calendar.css +6 -2
  215. package/src/components/calendar/calendar.js +127 -47
  216. package/src/components/card-view/card-view.js +5 -6
  217. package/src/components/chart/chart.css +159 -1
  218. package/src/components/chart/chart.js +450 -62
  219. package/src/components/chart/color.js +297 -0
  220. package/src/components/chart/svg-adapter.js +576 -0
  221. package/src/components/chart/svg-geometry.js +323 -0
  222. package/src/components/check-button/check-button.js +3 -18
  223. package/src/components/checklist/checklist.css +9 -1
  224. package/src/components/checklist/checklist.js +105 -20
  225. package/src/components/checklist/field-adapter.js +6 -12
  226. package/src/components/code-editor/code-editor.css +33 -0
  227. package/src/components/code-editor/code-editor.js +97 -8
  228. package/src/components/code-editor/field-adapter.js +3 -0
  229. package/src/components/composer/composer.css +3 -0
  230. package/src/components/composer/composer.js +100 -22
  231. package/src/components/context-menu/context-menu.js +41 -5
  232. package/src/components/copy/copy-button.js +9 -1
  233. package/src/components/copy/copy-input.js +5 -0
  234. package/src/components/data-filter/filter-core.js +0 -1
  235. package/src/components/date-picker/date-picker.css +8 -0
  236. package/src/components/date-picker/date-picker.js +47 -8
  237. package/src/components/date-picker/date-range-picker.js +1 -1
  238. package/src/components/date-picker/month-picker.js +19 -3
  239. package/src/components/date-picker/time-picker.js +54 -19
  240. package/src/components/datebox/date-range-box.js +7 -3
  241. package/src/components/datebox/datebox.js +32 -6
  242. package/src/components/dialog/dialog.css +6 -0
  243. package/src/components/dialog/dialog.js +24 -33
  244. package/src/components/dropdown/dropdown.js +1 -18
  245. package/src/components/empty-state/empty-state.js +21 -2
  246. package/src/components/field/field.js +19 -3
  247. package/src/components/fieldset/fieldset.js +3 -1
  248. package/src/components/filter/filter.js +9 -0
  249. package/src/components/form/form.js +19 -2
  250. package/src/components/kanban-view/kanban-card.js +15 -2
  251. package/src/components/kanban-view/kanban-view.css +21 -0
  252. package/src/components/kanban-view/kanban-view.js +29 -16
  253. package/src/components/launcher/launcher.css +14 -0
  254. package/src/components/launcher/launcher.js +54 -9
  255. package/src/components/master-panel/master-panel.js +24 -22
  256. package/src/components/menu-button/menu-button.js +26 -4
  257. package/src/components/message/message.css +228 -29
  258. package/src/components/message/message.js +664 -30
  259. package/src/components/modal/modal.js +129 -30
  260. package/src/components/modal/native-dialog.js +91 -0
  261. package/src/components/module-bar/module-bar.css +3 -0
  262. package/src/components/module-bar/module-bar.js +17 -4
  263. package/src/components/multi-value-editor/multi-value-editor.css +7 -2
  264. package/src/components/multi-value-editor/multi-value-editor.js +3 -2
  265. package/src/components/navigation-bar/navigation-bar.js +13 -1
  266. package/src/components/number-field/field-adapter.js +3 -0
  267. package/src/components/number-field/number-field.js +70 -16
  268. package/src/components/pagination/pagination.css +26 -2
  269. package/src/components/pagination/pagination.js +551 -65
  270. package/src/components/prose/prose.js +7 -1
  271. package/src/components/rating/field-adapter.js +3 -0
  272. package/src/components/run-status/run-status.js +43 -3
  273. package/src/components/run-trace/run-trace.js +15 -7
  274. package/src/components/search/search.js +3 -18
  275. package/src/components/select/field-adapter.js +8 -1
  276. package/src/components/select/select.js +68 -13
  277. package/src/components/sheet/sheet.js +39 -13
  278. package/src/components/slider/field-adapter.js +3 -0
  279. package/src/components/slider/slider.js +4 -6
  280. package/src/components/stat-tile/stat-tile.js +24 -9
  281. package/src/components/stepper/stepper.css +15 -0
  282. package/src/components/stepper/stepper.js +34 -2
  283. package/src/components/surface/catalog.js +185 -28
  284. package/src/components/surface/surface.js +10 -5
  285. package/src/components/tabbox/tabbox.js +13 -1
  286. package/src/components/table/table.css +160 -2
  287. package/src/components/table/table.js +479 -52
  288. package/src/components/table/window.js +46 -4
  289. package/src/components/table-view/table-view.js +1 -10
  290. package/src/components/tag-picker/field-adapter.js +3 -0
  291. package/src/components/tag-picker/tag-picker.js +2 -0
  292. package/src/components/timebox/field-adapter.js +3 -0
  293. package/src/components/toggle/toggle.js +51 -27
  294. package/src/components/tooltip/tooltip.js +21 -14
  295. package/src/components/tree/tree.js +87 -14
  296. package/src/components/truncate/truncate.js +21 -5
  297. package/src/components/value-list/value-list.js +37 -9
  298. package/src/components/view-settings/view-settings.js +1 -5
  299. package/src/core/component.js +34 -2
  300. package/src/core/date.js +5 -4
  301. package/src/core/dom.js +45 -2
  302. package/src/core/drag-axis.js +24 -7
  303. package/src/core/export.js +4 -4
  304. package/src/core/fontawesome.js +34 -3
  305. package/src/core/format.js +3 -1
  306. package/src/core/http.js +23 -11
  307. package/src/core/icons.js +60 -8
  308. package/src/core/keyboard.js +83 -9
  309. package/src/core/messages.js +3 -0
  310. package/src/core/position.js +4 -3
  311. package/src/core/storage.js +80 -31
  312. package/src/core/util.js +16 -5
  313. package/src/elements/define.js +82 -47
  314. package/src/elements/kit.js +46 -35
  315. package/src/index.js +8 -4
  316. package/src/internal/agent-model.js +152 -0
  317. package/src/internal/app-rail.js +53 -2
  318. package/src/internal/collections.js +25 -0
  319. package/src/internal/menu-items.js +59 -0
  320. package/src/internal/overlay-content.js +35 -0
  321. package/src/internal/presence-loop.js +61 -14
  322. package/src/locales/de.js +3 -0
  323. package/src/zeyos/calendar.js +81 -19
  324. package/src/zeyos/connect.js +5 -1
  325. package/src/zeyos/form.js +29 -10
  326. package/src/zeyos/select.js +36 -12
  327. package/src/zeyos/table.js +43 -11
  328. package/src/zeyos/view.js +2 -1
  329. package/styles/tokens/semantic.css +7 -1
  330. package/styles/zx.css +1 -0
@@ -2,6 +2,7 @@ import { Component } from '../../core/component.js';
2
2
  import { h } from '../../core/dom.js';
3
3
  import { ICON_SIZE, icon } from '../../core/icons.js';
4
4
  import { printf } from '../../core/i18n.js';
5
+ import { rovingTabindex } from '../../core/keyboard.js';
5
6
  import { uid } from '../../core/util.js';
6
7
 
7
8
  /**
@@ -18,8 +19,9 @@ import { uid } from '../../core/util.js';
18
19
  */
19
20
 
20
21
  /**
21
- * Tag/chip editor. It uses the APG listbox/option focus model: each chip is an option, arrow keys
22
- * move focus, Ctrl+Left/Right reorders, and Delete/Backspace removes the focused option.
22
+ * Tag/chip editor. It uses the APG listbox/option focus model: the list is one tab stop (a roving
23
+ * tabindex), each chip is an option, arrow keys move focus, Home/End go to the first and last
24
+ * chip, Ctrl+Left/Right reorders, and Delete/Backspace removes the focused option.
23
25
  * @fires ValueList#change
24
26
  * @fires ValueList#add
25
27
  * @fires ValueList#remove
@@ -43,6 +45,7 @@ export class ValueList extends Component {
43
45
  const root = /** @type {HTMLElement} */ (this.el ?? h('div'));
44
46
  this._ownedNodes = [];
45
47
  this._disabled = false;
48
+ this._roving = null;
46
49
  this._dragIndex = -1;
47
50
  this._initialState = root.getAttribute('data-state');
48
51
  this._initialDisabled = root.getAttribute('data-disabled');
@@ -87,6 +90,7 @@ export class ValueList extends Component {
87
90
  if (event.target === root && !this._disabled) this.focus();
88
91
  });
89
92
  this._renderChips();
93
+ this._syncRoving();
90
94
  return root;
91
95
  }
92
96
 
@@ -176,6 +180,7 @@ export class ValueList extends Component {
176
180
  this._input.disabled = false;
177
181
  this.el.dataset.disabled = 'false';
178
182
  this._renderChips();
183
+ this._syncRoving();
179
184
  return this;
180
185
  }
181
186
 
@@ -187,16 +192,33 @@ export class ValueList extends Component {
187
192
  this._disabled = true;
188
193
  this._input.disabled = true;
189
194
  this.el.dataset.disabled = 'true';
195
+ this._syncRoving();
190
196
  this._renderChips();
191
197
  return this;
192
198
  }
193
199
 
200
+ /**
201
+ * Keeps the chips one tab stop while the list is editable; a disabled list keeps none.
202
+ * @returns {void}
203
+ */
204
+ _syncRoving() {
205
+ if (this._disabled) {
206
+ this._roving?.destroy();
207
+ this._roving = null;
208
+ } else {
209
+ this._roving ??= rovingTabindex(this._list, '.zx-value-list__chip', { orientation: 'horizontal', wrap: false });
210
+ }
211
+ }
212
+
194
213
  /** @returns {void} */
195
214
  _renderChips(focusIndex = -1) {
215
+ // The chip that held the tab stop keeps it across a redraw, unless focus moves to another.
216
+ const previous = [...this._list.children].findIndex((chip) => /** @type {HTMLElement} */ (chip).tabIndex === 0);
217
+ const tabStop = Math.min(focusIndex >= 0 ? focusIndex : Math.max(0, previous), this._values.length - 1);
196
218
  const chips = this._values.map((value, index) => h('li', {
197
219
  class: 'zx-value-list__chip',
198
220
  role: 'option',
199
- tabIndex: this._disabled ? -1 : 0,
221
+ tabIndex: !this._disabled && index === tabStop ? 0 : -1,
200
222
  draggable: Boolean(this.options.sortable) && !this._disabled,
201
223
  ariaSelected: 'false',
202
224
  ariaDisabled: String(this._disabled),
@@ -237,12 +259,16 @@ export class ValueList extends Component {
237
259
  }
238
260
  const horizontal = event.key === 'ArrowLeft' ? -1 : event.key === 'ArrowRight' ? 1 : 0;
239
261
  const vertical = event.key === 'ArrowUp' ? -1 : event.key === 'ArrowDown' ? 1 : 0;
240
- const direction = horizontal || vertical;
241
- if (!direction) return;
242
- event.preventDefault();
243
- const next = Math.max(0, Math.min(this._values.length - 1, index + direction));
244
- if (event.ctrlKey && horizontal && this.options.sortable) this._move(index, next, true);
245
- else this._list.querySelector(`[data-index="${next}"]`)?.focus();
262
+ const next = Math.max(0, Math.min(this._values.length - 1, index + (horizontal || vertical)));
263
+ if (event.ctrlKey && horizontal && this.options.sortable) {
264
+ event.preventDefault();
265
+ // Redrawn under the key: the roving group finds the event's chip gone and leaves it alone.
266
+ this._move(index, next, true);
267
+ } else if (vertical) {
268
+ // Left, Right, Home, and End are the roving group's; Up and Down step the same way.
269
+ event.preventDefault();
270
+ this._list.querySelector(`[data-index="${next}"]`)?.focus();
271
+ }
246
272
  }
247
273
 
248
274
  /** @param {MouseEvent} event @returns {void} */
@@ -321,6 +347,8 @@ export class ValueList extends Component {
321
347
 
322
348
  /** @returns {void} */
323
349
  destroy() {
350
+ this._roving?.destroy();
351
+ this._roving = null;
324
352
  for (const node of this._ownedNodes ?? []) node.remove();
325
353
  if (this._initialState === null) this.el.removeAttribute('data-state');
326
354
  else this.el.setAttribute('data-state', this._initialState);
@@ -3,6 +3,7 @@ import { h, highlightMatch, restoreTarget, snapshotTarget } from '../../core/dom
3
3
  import { printf } from '../../core/i18n.js';
4
4
  import { icon } from '../../core/icons.js';
5
5
  import { uid } from '../../core/util.js';
6
+ import { sameSet } from '../../internal/collections.js';
6
7
  import { Search } from '../search/search.js';
7
8
  import { Select } from '../select/select.js';
8
9
  import { Toggle } from '../toggle/toggle.js';
@@ -1817,11 +1818,6 @@ function sameList(left, right) {
1817
1818
  return left.length === right.length && left.every((value, index) => value === right[index]);
1818
1819
  }
1819
1820
 
1820
- /** @param {Set<string>} left @param {Set<string>} right @returns {boolean} */
1821
- function sameSet(left, right) {
1822
- return left.size === right.size && [...left].every((value) => right.has(value));
1823
- }
1824
-
1825
1821
  /** @param {ViewSettingsBoard|null} left @param {ViewSettingsBoard|null} right @returns {boolean} */
1826
1822
  function sameBoard(left, right) {
1827
1823
  if (!left || !right) return left === right;
@@ -320,15 +320,47 @@ function mergeOptions(constructor, options) {
320
320
  messages = deepMerge(messages, defaults.msg);
321
321
  }
322
322
  }
323
- Object.assign(result, options && typeof options === 'object' ? options : {});
323
+ /*
324
+ * An option passed as `undefined` is an option not passed: a wrapper that forwards
325
+ * `{ value: props.value }` means "whatever the default is" when the prop is unset, the way a
326
+ * destructuring default reads it. `null` is a value and still overrides.
327
+ */
328
+ if (options && typeof options === 'object') {
329
+ // Object.assign's own key set — enumerable own properties, symbol keys included (Select's
330
+ // presets pass one) — so only the `undefined` values differ from a plain assignment.
331
+ /** @type {Record<PropertyKey, any>} */
332
+ const passed = Object.assign({}, options);
333
+ /** @type {Record<PropertyKey, any>} */
334
+ const merged = result;
335
+ for (const key of Reflect.ownKeys(passed)) {
336
+ if (passed[key] !== undefined) merged[key] = passed[key];
337
+ }
338
+ }
324
339
  if (options?.msg && typeof options.msg === 'object') {
325
340
  hasMessages = true;
326
- messages = deepMerge(messages, options.msg);
341
+ messages = deepMerge(messages, withoutUndefined(options.msg));
327
342
  }
328
343
  if (hasMessages) result.msg = messages;
329
344
  return result;
330
345
  }
331
346
 
347
+ /**
348
+ * Copies a `msg` table without the entries that are `undefined`, at any depth, so that merging it
349
+ * over the declared defaults leaves those defaults in place. The table passed in is not changed.
350
+ * @param {Record<string, any>} table Message table, flat or keyed by language.
351
+ * @returns {Record<string, any>}
352
+ */
353
+ function withoutUndefined(table) {
354
+ if (!isMessageTable(table)) return table;
355
+ /** @type {Record<string, any>} */
356
+ const result = {};
357
+ for (const [key, value] of Object.entries(table)) {
358
+ if (value === undefined) continue;
359
+ result[key] = isMessageTable(value) ? withoutUndefined(value) : value;
360
+ }
361
+ return result;
362
+ }
363
+
332
364
  /**
333
365
  * The `defaults` objects a class and its ancestors declare, base class first.
334
366
  * @param {typeof Component} constructor
package/src/core/date.js CHANGED
@@ -54,7 +54,8 @@ export function formatDate(date, fmt, options) {
54
54
 
55
55
  /**
56
56
  * Parses numeric date tokens from a string, returning null for mismatches or invalid dates.
57
- * Unspecified fields default to 1970-01-01 00:00:00 local time.
57
+ * Unspecified fields default to 1970-01-01 00:00:00 local time. A time that the local clock skips
58
+ * at a daylight-saving change is accepted and moved forward, as `Date` does.
58
59
  * @param {string} str Date text.
59
60
  * @param {string} fmt Matching numeric format.
60
61
  * @returns {Date|null}
@@ -94,6 +95,9 @@ export function parseDate(str, fmt) {
94
95
  const hour = values['%H'] ?? 0;
95
96
  const minute = values['%M'] ?? 0;
96
97
  const second = values['%S'] ?? 0;
98
+ // The time is checked by range rather than read back: a wall-clock time inside a daylight-saving
99
+ // gap (02:30 on the night clocks jump to 03:00) is valid input, which Date moves forward.
100
+ if (hour > 23 || minute > 59 || second > 59) return null;
97
101
  const parsed = new Date(0);
98
102
  parsed.setHours(0, 0, 0, 0);
99
103
  parsed.setFullYear(year, month, day);
@@ -105,9 +109,6 @@ export function parseDate(str, fmt) {
105
109
  if (values['%m'] !== undefined && parsed.getMonth() !== month) return null;
106
110
  if (values['%d'] !== undefined && parsed.getDate() !== day) return null;
107
111
  if (values['%e'] !== undefined && parsed.getDate() !== day) return null;
108
- if (values['%H'] !== undefined && parsed.getHours() !== hour) return null;
109
- if (values['%M'] !== undefined && parsed.getMinutes() !== minute) return null;
110
- if (values['%S'] !== undefined && parsed.getSeconds() !== second) return null;
111
112
  return parsed;
112
113
  }
113
114
 
package/src/core/dom.js CHANGED
@@ -286,11 +286,54 @@ export function snapshotTarget(element) {
286
286
  */
287
287
  export function restoreTarget(element, snapshot) {
288
288
  if (!snapshot) return;
289
- for (const attribute of Array.from(element.attributes)) element.removeAttribute(attribute.name);
290
- for (const [name, value] of snapshot.attributes) element.setAttribute(name, value);
289
+ /*
290
+ * `style` goes back through the CSSOM (see `restoreInlineStyle`), so restoring a target never
291
+ * writes an inline style attribute that a strict Content Security Policy would block. While
292
+ * every captured attribute is still present they are corrected in place, which keeps their
293
+ * order and leaves an untouched `style` byte for byte as it was; only a target that lost one is
294
+ * rebuilt from nothing, in captured order.
295
+ */
296
+ const styled = /** @type {Element & ElementCSSInlineStyle} */ (element);
297
+ const cssom = typeof styled.style?.cssText === 'string';
298
+ const saved = new Map(snapshot.attributes);
299
+ const intact = snapshot.attributes.every(([name]) => element.hasAttribute(name));
300
+ for (const attribute of Array.from(element.attributes)) {
301
+ if (!intact || !saved.has(attribute.name)) {
302
+ if (attribute.name === 'style' && cssom) restoreInlineStyle(styled, null);
303
+ else element.removeAttribute(attribute.name);
304
+ }
305
+ }
306
+ for (const [name, value] of snapshot.attributes) {
307
+ if (name === 'style' && cssom) restoreInlineStyle(styled, value);
308
+ else if (element.getAttribute(name) !== value) element.setAttribute(name, value);
309
+ }
291
310
  element.replaceChildren(...snapshot.children);
292
311
  }
293
312
 
313
+ /**
314
+ * Puts an element's inline style back to a captured attribute value.
315
+ *
316
+ * Written through the CSSOM, never the attribute: under a `style-src` policy without
317
+ * `'unsafe-inline'`, setting the `style` attribute is an inline style the browser blocks and
318
+ * reports, while `style.cssText` is not governed by it. A style that was absent (or empty) is
319
+ * cleared and its attribute removed — after a read, because Chrome reflects CSSOM changes into the
320
+ * attribute lazily, and a removal it has not reflected yet comes back as an empty `style=""`,
321
+ * which the next capture would then try to restore.
322
+ * @param {Element & ElementCSSInlineStyle} element Element whose inline style to restore.
323
+ * @param {string|null} value Attribute value captured earlier, or null when it was absent.
324
+ * @returns {void}
325
+ */
326
+ export function restoreInlineStyle(element, value) {
327
+ // The read is also the flush: it makes the attribute current before anything compares or removes.
328
+ const current = element.getAttribute('style');
329
+ // Untouched styles keep their exact text; `cssText` would re-serialize `color:red` as `color: red;`.
330
+ if (current === value || (!value && current === null)) return;
331
+ element.style.cssText = value ?? '';
332
+ // Read either way: it places a restored attribute now, in order, and flushes before a removal.
333
+ element.getAttribute('style');
334
+ if (!value) element.removeAttribute('style');
335
+ }
336
+
294
337
  /**
295
338
  * Escapes text for safe insertion into an HTML string.
296
339
  * @param {unknown} str Value to escape.
@@ -13,11 +13,13 @@ export const STEP_LARGE = 64;
13
13
  * drag begins. Return `false` to refuse it — the usual reason being that there is nothing to
14
14
  * resize on either side of the handle.
15
15
  * @property {(delta: number) => void} onMove Called at most once per frame with the signed pixel
16
- * distance travelled along the axis since pointer-down.
16
+ * distance travelled along the axis since pointer-down. A horizontal distance is logical: positive
17
+ * towards the inline end, which is leftwards when the handle's computed `direction` is `rtl`.
17
18
  * @property {(delta: number, moved: boolean) => void} [onEnd] Called once the pointer is released.
18
19
  * `moved` is false for a press that never travelled, which is a click rather than a drag.
19
20
  * @property {(direction: -1|1, large: boolean) => void} [onStep] Called for an arrow key along the
20
- * axis. `large` is true while Shift is held.
21
+ * axis. `large` is true while Shift is held. `1` is ArrowDown, or towards the inline end:
22
+ * ArrowRight, and ArrowLeft under `rtl`, so the handle moves the way the arrow points.
21
23
  * @property {(edge: 'min'|'max') => void} [onJump] Called for Home and End.
22
24
  * @property {() => void} [onActivate] Called for Enter and Space, which components use for the
23
25
  * collapse affordance a splitter is expected to offer.
@@ -41,7 +43,8 @@ export const STEP_LARGE = 64;
41
43
  * sheet grows in the opposite direction depending on which edge it is attached to. What they do
42
44
  * share is the fiddly part — pointer capture that survives the pointer leaving the handle, one
43
45
  * write per frame however fast the pointer reports, telling a click apart from a zero-distance
44
- * drag, and the WAI-ARIA keyboard map.
46
+ * drag, and the WAI-ARIA keyboard map. Its distances are logical, like the layouts it serves:
47
+ * under `dir="rtl"` a horizontal handle mirrors both the pointer and the arrow keys.
45
48
  *
46
49
  * @param {Element} handle Element the pointer grabs; also the keyboard target.
47
50
  * @param {DragAxisOptions} options Axis and callbacks.
@@ -60,6 +63,8 @@ export function dragAxis(handle, options) {
60
63
  let pointerId = null;
61
64
  let startClient = 0;
62
65
  let client = 0;
66
+ /** `-1` while a horizontal drag runs right to left, which turns physical distance into logical. */
67
+ let sign = 1;
63
68
  let moved = false;
64
69
  /** Handle of the frame a pending update is scheduled in; `0` if none. */
65
70
  let frame = 0;
@@ -70,6 +75,16 @@ export function dragAxis(handle, options) {
70
75
  /** @returns {boolean} */
71
76
  const blocked = () => Boolean(options.disabled?.());
72
77
 
78
+ /** @returns {boolean} Whether a horizontal handle lays out right to left. */
79
+ const rightToLeft = () => {
80
+ if (vertical) return false;
81
+ try {
82
+ return globalThis.getComputedStyle?.(handle)?.direction === 'rtl';
83
+ } catch {
84
+ return false;
85
+ }
86
+ };
87
+
73
88
  /** @returns {void} */
74
89
  const releasePointer = () => {
75
90
  const id = pointerId;
@@ -108,6 +123,7 @@ export function dragAxis(handle, options) {
108
123
  */
109
124
  dragging = true;
110
125
  pointerId = pointer.pointerId;
126
+ sign = rightToLeft() ? -1 : 1;
111
127
  startClient = axis(pointer);
112
128
  client = startClient;
113
129
  moved = false;
@@ -127,7 +143,7 @@ export function dragAxis(handle, options) {
127
143
  if (frame !== 0) return;
128
144
  frame = requestAnimationFrame(() => {
129
145
  frame = 0;
130
- if (dragging) options.onMove(client - startClient);
146
+ if (dragging) options.onMove(sign * (client - startClient));
131
147
  });
132
148
  }, { signal });
133
149
 
@@ -138,7 +154,7 @@ export function dragAxis(handle, options) {
138
154
  cancelFrame();
139
155
  client = axis(pointer);
140
156
  const travelled = moved;
141
- const delta = client - startClient;
157
+ const delta = sign * (client - startClient);
142
158
  finish();
143
159
  options.onEnd?.(delta, travelled);
144
160
  };
@@ -159,8 +175,9 @@ export function dragAxis(handle, options) {
159
175
  options.onJump(key.key === 'Home' ? 'min' : 'max');
160
176
  return;
161
177
  }
162
- const decrease = vertical ? 'ArrowUp' : 'ArrowLeft';
163
- const increase = vertical ? 'ArrowDown' : 'ArrowRight';
178
+ const reversed = rightToLeft();
179
+ const decrease = vertical ? 'ArrowUp' : reversed ? 'ArrowRight' : 'ArrowLeft';
180
+ const increase = vertical ? 'ArrowDown' : reversed ? 'ArrowLeft' : 'ArrowRight';
164
181
  if (key.key !== decrease && key.key !== increase) return;
165
182
  if (!options.onStep) return;
166
183
  key.preventDefault();
@@ -18,8 +18,8 @@
18
18
  * @property {string} [type='text/plain;charset=utf-8'] MIME type of the generated blob.
19
19
  */
20
20
 
21
- /** Characters that make a spreadsheet treat a text cell as a formula. */
22
- const FORMULA_STARTERS = ['=', '+', '-', '@'];
21
+ /** Leading characters that can make a spreadsheet treat a text cell as a formula (OWASP list). */
22
+ const FORMULA_STARTERS = ['=', '+', '-', '@', '\t', '\r'];
23
23
  /** Object URLs are revoked late so the browser has started the download before they disappear. */
24
24
  const REVOKE_DELAY = 1000;
25
25
 
@@ -28,8 +28,8 @@ const REVOKE_DELAY = 1000;
28
28
  *
29
29
  * Fields containing the delimiter, a double quote, CR, or LF are quoted with inner quotes doubled.
30
30
  * Dates become ISO strings, null and undefined become empty fields, and text that starts with
31
- * `=`, `+`, `-`, or `@` is prefixed with a tab so spreadsheets treat it as text rather than a
32
- * formula. Numbers are never prefixed, so negative amounts survive intact.
31
+ * `=`, `+`, `-`, `@`, a tab, or a carriage return is prefixed with a tab so spreadsheets treat it
32
+ * as text rather than a formula. Numbers are never prefixed, so negative amounts survive intact.
33
33
  *
34
34
  * @param {Iterable<any>|null|undefined} rows Row objects.
35
35
  * @param {Array<string|CsvColumn>} columns Column ids, or descriptors with a label and accessor.
@@ -158,9 +158,16 @@ export function loadFontAwesomeKit(kit) {
158
158
  const promise = /** @type {Promise<void>} */ (new Promise((resolve, reject) => {
159
159
  const absolute = new URL(url, document.baseURI).href;
160
160
  const existing = [...document.scripts].find((script) => script.src === absolute);
161
- if (existing && globalThis.FontAwesomeKitConfig) {
162
- resolve();
163
- return;
161
+ if (existing) {
162
+ // A script element cannot be asked whether it has run, and one that already has never fires
163
+ // `load` again. What it leaves behind can: a hosted kit's config, the API a self-hosted
164
+ // build defines, or the finished fetch in resource timing. Without any of them it is still on
165
+ // its way, and its own `load` or `error` settles this. A finished document is no proof — a
166
+ // script inserted after it finished may still be loading.
167
+ if (scriptHasLoaded(absolute)) {
168
+ resolve();
169
+ return;
170
+ }
164
171
  }
165
172
 
166
173
  const script = existing ?? document.createElement('script');
@@ -179,3 +186,27 @@ export function loadFontAwesomeKit(kit) {
179
186
  kitLoads.set(url, promise);
180
187
  return promise;
181
188
  }
189
+
190
+ /**
191
+ * Whether a script already on the page has visibly finished: Font Awesome's kit config or API is
192
+ * defined, or the browser recorded a successful load of that URL by a script element — not a
193
+ * `fetch()` or a preload, which say nothing about the script having run, and not a failed attempt,
194
+ * which a retry would otherwise be mistaken for.
195
+ * @param {string} url Absolute script URL.
196
+ * @returns {boolean}
197
+ */
198
+ function scriptHasLoaded(url) {
199
+ if (globalThis.FontAwesomeKitConfig || globalThis.FontAwesome) return true;
200
+ try {
201
+ return globalThis.performance?.getEntriesByName?.(url, 'resource').some((entry) => {
202
+ const timing = /** @type {PerformanceResourceTiming & {responseStatus?: number}} */ (entry);
203
+ if (timing.initiatorType !== 'script' || !(timing.responseEnd > 0)) return false;
204
+ // The status where the browser reports one; otherwise a body that arrived.
205
+ return typeof timing.responseStatus === 'number' && timing.responseStatus > 0
206
+ ? timing.responseStatus >= 200 && timing.responseStatus < 300
207
+ : timing.decodedBodySize > 0;
208
+ }) ?? false;
209
+ } catch {
210
+ return false;
211
+ }
212
+ }
@@ -31,7 +31,9 @@ import { formattingLocale } from './i18n.js';
31
31
 
32
32
  /**
33
33
  * @typedef {Object} RelativeTimeFormatOptions
34
- * @property {Date|number|string} [now=new Date()] Reference point the date is measured against.
34
+ * @property {Date|number|string} [now=new Date()] Reference point the date is measured against: a
35
+ * Date, a Unix timestamp in seconds (not milliseconds — wrap `Date.now()` in a Date), or a date
36
+ * string, read the same way as the date itself.
35
37
  * @property {string} [locale=getLanguage()] BCP 47 language tag.
36
38
  * @property {'auto'|'always'} [numeric='auto'] `auto` produces "yesterday", `always` "1 day ago".
37
39
  */
package/src/core/http.js CHANGED
@@ -79,24 +79,25 @@ export class Http {
79
79
  const text = await response.text();
80
80
  controller.signal.throwIfAborted();
81
81
  let json = null;
82
+ let parseError = null;
82
83
  if (text !== '') {
83
84
  try {
84
85
  json = JSON.parse(text);
85
86
  } catch (cause) {
86
- const error = /** @type {Error & {response?: Response}} */ (
87
- new Error('Invalid JSON response', { cause })
88
- );
89
- error.response = response;
90
- throw error;
87
+ parseError = cause;
91
88
  }
92
89
  }
93
90
 
94
91
  if (!response.ok) {
95
- try {
96
- parseResult(json);
97
- } catch (error) {
98
- /** @type {Error & {response?: Response}} */ (error).response = response;
99
- throw error;
92
+ // A failed response is reported as the HTTP error it is: a gateway's HTML error page is
93
+ // not an invalid JSON response. Only a JSON body can carry a more specific legacy error.
94
+ if (parseError === null) {
95
+ try {
96
+ parseResult(json);
97
+ } catch (error) {
98
+ /** @type {Error & {response?: Response}} */ (error).response = response;
99
+ throw error;
100
+ }
100
101
  }
101
102
  const error = /** @type {Error & {response?: Response}} */ (
102
103
  new Error(`HTTP ${response.status} ${response.statusText}`.trim())
@@ -104,6 +105,13 @@ export class Http {
104
105
  error.response = response;
105
106
  throw error;
106
107
  }
108
+ if (parseError !== null) {
109
+ const error = /** @type {Error & {response?: Response}} */ (
110
+ new Error('Invalid JSON response', { cause: parseError })
111
+ );
112
+ error.response = response;
113
+ throw error;
114
+ }
107
115
  return parseResult(json);
108
116
  } catch (caught) {
109
117
  const error = caught instanceof Error ? caught : new Error(String(caught));
@@ -209,7 +217,11 @@ function appendQuery(url, query) {
209
217
  encoded = parameters.toString();
210
218
  }
211
219
  if (!encoded) return url;
212
- return url + (url.includes('?') ? '&' : '?') + encoded;
220
+ // Parameters belong to the query, which ends where a fragment begins.
221
+ const hash = url.indexOf('#');
222
+ const target = hash < 0 ? url : url.slice(0, hash);
223
+ const fragment = hash < 0 ? '' : url.slice(hash);
224
+ return target + (target.includes('?') ? '&' : '?') + encoded + fragment;
213
225
  }
214
226
 
215
227
  /** @param {URLSearchParams} parameters @param {string} key @param {unknown} value @returns {void} */
package/src/core/icons.js CHANGED
@@ -148,7 +148,7 @@ const outline = (path) => [VIEW_BOX, path, 'stroke'];
148
148
  * The bundled glyph set: outline icons from Lucide (ISC; see the notice above), embedded as path
149
149
  * data so the library carries no webfont, stylesheet, or package dependency. Every entry is
150
150
  * `[viewBox, path, 'stroke']` in a 24-unit view box. Extend the set with `registerIcons()`; read
151
- * every available name with `iconNames()`.
151
+ * every available name with `iconNames()`, and the other names a glyph answers to in `iconAliases`.
152
152
  * @type {Readonly<Record<string, IconGlyph>>}
153
153
  */
154
154
  export const icons = Object.freeze({
@@ -181,6 +181,10 @@ export const icons = Object.freeze({
181
181
  error: outline('M2 12a10 10 0 1 0 20 0a10 10 0 1 0-20 0zM12 8V12M12 16H12.01'), // circle-alert
182
182
  success: outline('M2 12a10 10 0 1 0 20 0a10 10 0 1 0-20 0zM16 9l-5.5 5.5L8 12'), // circle-check
183
183
  upload: outline('M12 3v12M17 8l-5-5-5 5M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'),
184
+ download: outline('M12 15V3M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5'),
185
+ 'box-archive': outline('M3 3h18a1 1 0 0 1 1 1v3a1 1 0 0 1-1 1h-18a1 1 0 0 1-1-1v-3a1 1 0 0 1 1-1zM4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8M10 12h4'), // archive
186
+ pencil: outline('M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4'),
187
+ 'pen-to-square': outline('M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z'), // square-pen
184
188
  drag: outline('M8 12a1 1 0 1 0 2 0a1 1 0 1 0-2 0zM8 5a1 1 0 1 0 2 0a1 1 0 1 0-2 0zM8 19a1 1 0 1 0 2 0a1 1 0 1 0-2 0zM14 12a1 1 0 1 0 2 0a1 1 0 1 0-2 0zM14 5a1 1 0 1 0 2 0a1 1 0 1 0-2 0zM14 19a1 1 0 1 0 2 0a1 1 0 1 0-2 0z'), // grip-vertical
185
189
  star: outline('M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z'),
186
190
  heart: outline('M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5'),
@@ -204,8 +208,30 @@ export const icons = Object.freeze({
204
208
  // </lucide-glyphs>
205
209
  });
206
210
 
207
- /** Legacy gx Factory icon names mapped to their Zx equivalents. */
208
- const aliases = Object.freeze({
211
+ /**
212
+ * Other names for bundled glyphs, as `alias → bundled name`: legacy gx Factory names, and the
213
+ * older Font Awesome names (`archive`, `edit`) that are still the ones most code reaches for.
214
+ *
215
+ * | Alias | Renders |
216
+ * | --- | --- |
217
+ * | `archive` | `box-archive` |
218
+ * | `edit` | `pen-to-square` |
219
+ * | `settings` | `gear` |
220
+ * | `clear` | `x` |
221
+ * | `checked` | `check` |
222
+ * | `question` | `info` |
223
+ * | `range` | `filter` |
224
+ * | `fields` | `list` |
225
+ * | `grid` | `table-cells-large` |
226
+ *
227
+ * `icon()` accepts an alias wherever it accepts the bundled name, under either renderer, and
228
+ * `iconNames()` lists them. A glyph an application registered under the alias itself takes
229
+ * precedence (see `icon()`); the table is frozen, so that registration is how an alias is changed.
230
+ * @type {Readonly<Record<string, string>>}
231
+ */
232
+ export const iconAliases = Object.freeze({
233
+ archive: 'box-archive',
234
+ edit: 'pen-to-square',
209
235
  settings: 'gear',
210
236
  clear: 'x',
211
237
  checked: 'check',
@@ -321,18 +347,43 @@ export function registerIcons(glyphs) {
321
347
  }
322
348
 
323
349
  /**
324
- * Lists every inline SVG glyph name available, built-in and registered.
350
+ * Lists every name `icon()` renders as an inline SVG glyph: the bundled set, the glyphs added with
351
+ * `registerIcons()`, and the aliases in `iconAliases`. The two agree — a name listed here renders
352
+ * a glyph, and a bare name that is not listed renders the placeholder (or throws with
353
+ * `{ strict: true }`). Font Awesome is not part of the answer: it resolves names in the browser,
354
+ * so under that renderer any name may draw.
355
+ *
356
+ * An alias is listed beside the glyph it draws, so the list holds more names than glyphs. For one
357
+ * entry per glyph — an icon gallery — leave the aliases out:
358
+ *
359
+ * iconNames().filter((name) => !Object.hasOwn(iconAliases, name));
325
360
  * @returns {string[]} Sorted icon names.
326
361
  */
327
362
  export function iconNames() {
328
- return [...new Set([...Object.keys(icons), ...Object.keys(extraGlyphs)])].sort();
363
+ return [...new Set([
364
+ ...Object.keys(icons), ...Object.keys(extraGlyphs), ...Object.keys(iconAliases)
365
+ ])].sort();
366
+ }
367
+
368
+ /**
369
+ * Resolves a bare icon name to the glyph name it is drawn from: a registered glyph keeps its own
370
+ * name, an alias resolves to its bundled glyph, and anything else is returned unchanged. Own
371
+ * properties only, so a name such as `constructor` is an unknown icon and nothing else.
372
+ * @param {string} name Bare icon name.
373
+ * @returns {string}
374
+ */
375
+ function resolveIconName(name) {
376
+ if (Object.hasOwn(extraGlyphs, name)) return name;
377
+ return Object.hasOwn(iconAliases, name) ? iconAliases[name] : name;
329
378
  }
330
379
 
331
380
  /**
332
381
  * Creates an icon element.
333
382
  *
334
383
  * Bare names (`'check'`) render through the active provider: the bundled inline SVG set by
335
- * default, or Font Awesome after `useFontAwesome()` / `loadFontAwesome()`. A name can also select
384
+ * default, or Font Awesome after `useFontAwesome()` / `loadFontAwesome()`. A bare name may be an
385
+ * alias from `iconAliases` (`'edit'` draws `pen-to-square`, `'settings'` draws `gear`); a glyph
386
+ * registered under the alias name wins over the alias. A name can also select
336
387
  * its renderer itself — `'fa:user'`, `'duotone:user'`, `'kit:zeyos-notes'`, `'builtin:check'`, or
337
388
  * a literal Font Awesome class list such as `'fa-solid fa-user'`.
338
389
  *
@@ -352,7 +403,8 @@ export function icon(name, options = {}) {
352
403
  const spec = parseIconSpec(name);
353
404
  if (spec.classes) return faIcon(spec.classes, options);
354
405
 
355
- const resolved = aliases[spec.name] ?? spec.name;
406
+ // An application that registered a glyph under an alias name keeps its own glyph.
407
+ const resolved = resolveIconName(spec.name);
356
408
  if (spec.provider === 'builtin') return builtinIcon(resolved, options);
357
409
  if (spec.provider === 'fa') {
358
410
  return faIcon(faIconClasses(resolved, {
@@ -381,7 +433,7 @@ export function icon(name, options = {}) {
381
433
  * @throws {RangeError} With `options.strict`, when no glyph carries that name.
382
434
  */
383
435
  function builtinIcon(name, options) {
384
- const entry = extraGlyphs[name] ?? icons[name];
436
+ const entry = extraGlyphs[name] ?? (Object.hasOwn(icons, name) ? icons[name] : undefined);
385
437
  if (!entry) {
386
438
  if (options.strict) throw new RangeError(`Unknown icon: ${name}`);
387
439
  warnMissingIcon(name);