@zeyos/zx 5.7.1 → 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 (326) hide show
  1. package/CHANGELOG.md +296 -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 +19 -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 +13 -2
  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 +11 -0
  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 +7 -0
  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 +18 -4
  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/drag-axis.d.ts +10 -5
  61. package/dist/types/core/export.d.ts +2 -2
  62. package/dist/types/core/format.d.ts +3 -1
  63. package/dist/types/core/icons.d.ts +36 -3
  64. package/dist/types/core/keyboard.d.ts +7 -3
  65. package/dist/types/core/messages.d.ts +3 -0
  66. package/dist/types/core/storage.d.ts +4 -3
  67. package/dist/types/core/util.d.ts +3 -1
  68. package/dist/types/elements/define.d.ts +5 -2
  69. package/dist/types/index.d.ts +6 -4
  70. package/dist/types/internal/agent-model.d.ts +99 -0
  71. package/dist/types/internal/app-rail.d.ts +37 -2
  72. package/dist/types/internal/collections.d.ts +18 -0
  73. package/dist/types/internal/menu-items.d.ts +27 -0
  74. package/dist/types/internal/overlay-content.d.ts +23 -0
  75. package/dist/types/internal/presence-loop.d.ts +5 -2
  76. package/dist/types/locales/index.d.ts +3 -0
  77. package/dist/types/zeyos/calendar.d.ts +43 -7
  78. package/dist/types/zeyos/connect.d.ts +4 -0
  79. package/dist/types/zeyos/form.d.ts +13 -5
  80. package/dist/types/zeyos/select.d.ts +5 -2
  81. package/dist/types/zeyos/table.d.ts +16 -8
  82. package/dist/types/zeyos/view.d.ts +2 -1
  83. package/dist/zx-zeyos.esm.js +2998 -451
  84. package/dist/zx-zeyos.esm.min.js +4 -4
  85. package/dist/zx.core.css +4 -0
  86. package/dist/zx.core.min.css +1 -1
  87. package/dist/zx.css +948 -48
  88. package/dist/zx.esm.js +7432 -3408
  89. package/dist/zx.esm.min.js +26 -26
  90. package/dist/zx.global.js +7432 -3408
  91. package/dist/zx.global.min.js +26 -26
  92. package/dist/zx.layered.css +950 -48
  93. package/dist/zx.layered.min.css +1 -1
  94. package/dist/zx.min.css +1 -1
  95. package/docs/agent-catalog.json +159 -1
  96. package/docs/agent-surfaces.md +21 -21
  97. package/docs/api.json +3122 -528
  98. package/docs/components/account-menu.md +24 -0
  99. package/docs/components/activity-item.md +23 -0
  100. package/docs/components/activity-list.md +28 -0
  101. package/docs/components/agent-avatar.md +59 -0
  102. package/docs/components/agent-thread.md +275 -0
  103. package/docs/components/app-icon.md +36 -0
  104. package/docs/components/app-sidebar.md +92 -0
  105. package/docs/components/approval-card.md +71 -0
  106. package/docs/components/aurora.md +34 -0
  107. package/docs/components/avatar.md +37 -0
  108. package/docs/components/badge.md +36 -0
  109. package/docs/components/block-view.md +34 -0
  110. package/docs/components/breadcrumb.md +20 -0
  111. package/docs/components/button.md +23 -0
  112. package/docs/components/calendar.md +68 -0
  113. package/docs/components/card-view.md +73 -0
  114. package/docs/components/card.md +25 -0
  115. package/docs/components/chart.md +109 -0
  116. package/docs/components/check-button.md +16 -0
  117. package/docs/components/checklist.md +19 -0
  118. package/docs/components/code-editor.md +38 -0
  119. package/docs/components/composer.md +107 -0
  120. package/docs/components/context-menu.md +32 -0
  121. package/docs/components/copy.md +37 -0
  122. package/docs/components/data-filter.md +16 -0
  123. package/docs/components/date-picker.md +31 -0
  124. package/docs/components/date-range.md +21 -0
  125. package/docs/components/datebox.md +31 -0
  126. package/docs/components/dialog.md +25 -0
  127. package/docs/components/dock.md +57 -0
  128. package/docs/components/dropdown.md +39 -0
  129. package/docs/components/elements.md +63 -0
  130. package/docs/components/empty-state.md +17 -0
  131. package/docs/components/entity-ref.md +26 -0
  132. package/docs/components/field-upload.md +18 -0
  133. package/docs/components/file-item.md +27 -0
  134. package/docs/components/file-list.md +23 -0
  135. package/docs/components/filter-panel.md +45 -0
  136. package/docs/components/filter.md +47 -0
  137. package/docs/components/finder.md +25 -0
  138. package/docs/components/form-widgets.md +42 -0
  139. package/docs/components/form.md +80 -0
  140. package/docs/components/grid.md +26 -0
  141. package/docs/components/groupbox.md +11 -0
  142. package/docs/components/helpers.md +359 -0
  143. package/docs/components/icons.md +87 -0
  144. package/docs/components/index.md +99 -0
  145. package/docs/components/kanban-view.md +42 -0
  146. package/docs/components/kbd.md +23 -0
  147. package/docs/components/kernel.md +41 -0
  148. package/docs/components/launcher.md +66 -0
  149. package/docs/components/layout.md +33 -0
  150. package/docs/components/list-toolbar.md +38 -0
  151. package/docs/components/loading.md +48 -0
  152. package/docs/components/menu-button.md +47 -0
  153. package/docs/components/message.md +76 -0
  154. package/docs/components/modal.md +27 -0
  155. package/docs/components/module-bar.md +71 -0
  156. package/docs/components/multi-value-editor.md +16 -0
  157. package/docs/components/navigation-bar.md +22 -0
  158. package/docs/components/number-field.md +34 -0
  159. package/docs/components/pagination.md +73 -0
  160. package/docs/components/panel.md +28 -0
  161. package/docs/components/prompt-starters.md +40 -0
  162. package/docs/components/prose.md +38 -0
  163. package/docs/components/questionnaire.md +115 -0
  164. package/docs/components/rating.md +19 -0
  165. package/docs/components/run-status.md +50 -0
  166. package/docs/components/run-trace.md +72 -0
  167. package/docs/components/search.md +11 -0
  168. package/docs/components/select.md +129 -0
  169. package/docs/components/sheet-stack.md +39 -0
  170. package/docs/components/sheet.md +77 -0
  171. package/docs/components/skeleton.md +27 -0
  172. package/docs/components/slider.md +29 -0
  173. package/docs/components/sort-control.md +21 -0
  174. package/docs/components/source-list.md +30 -0
  175. package/docs/components/split-view.md +12 -0
  176. package/docs/components/stat-tile.md +49 -0
  177. package/docs/components/stepper.md +27 -0
  178. package/docs/components/surface.md +152 -0
  179. package/docs/components/tabbox.md +33 -0
  180. package/docs/components/table-view.md +43 -0
  181. package/docs/components/table.md +232 -0
  182. package/docs/components/tag-picker.md +39 -0
  183. package/docs/components/timebox.md +16 -0
  184. package/docs/components/toggle.md +21 -0
  185. package/docs/components/tokens.md +82 -0
  186. package/docs/components/toolbar.md +26 -0
  187. package/docs/components/tooltip.md +16 -0
  188. package/docs/components/tree.md +48 -0
  189. package/docs/components/truncate.md +21 -0
  190. package/docs/components/value-list.md +14 -0
  191. package/docs/components/view-settings.md +56 -0
  192. package/docs/components/workspace-switcher.md +42 -0
  193. package/docs/components/zeyos.md +196 -0
  194. package/docs/llms-small.txt +299 -0
  195. package/docs/llms.md +697 -100
  196. package/docs/llms.txt +46 -19
  197. package/package.json +9 -4
  198. package/src/components/activity-item/activity-item.js +21 -2
  199. package/src/components/agent-avatar/agent-avatar.css +195 -0
  200. package/src/components/agent-avatar/agent-avatar.js +333 -0
  201. package/src/components/agent-avatar/agent-face.js +292 -0
  202. package/src/components/agent-thread/ag-ui.js +44 -11
  203. package/src/components/agent-thread/agent-thread.js +103 -11
  204. package/src/components/agent-thread/ui-message-stream.js +3 -1
  205. package/src/components/app-rail/app-rail.css +5 -0
  206. package/src/components/app-sidebar/app-sidebar.css +3 -0
  207. package/src/components/app-sidebar/app-sidebar.js +4 -3
  208. package/src/components/approval-card/approval-card.css +6 -0
  209. package/src/components/approval-card/approval-card.js +55 -7
  210. package/src/components/aurora/aurora.css +149 -14
  211. package/src/components/aurora/aurora.js +49 -6
  212. package/src/components/calendar/calendar.css +6 -2
  213. package/src/components/calendar/calendar.js +127 -47
  214. package/src/components/card-view/card-view.js +5 -6
  215. package/src/components/chart/chart.css +159 -1
  216. package/src/components/chart/chart.js +450 -62
  217. package/src/components/chart/color.js +297 -0
  218. package/src/components/chart/svg-adapter.js +576 -0
  219. package/src/components/chart/svg-geometry.js +323 -0
  220. package/src/components/check-button/check-button.js +3 -18
  221. package/src/components/checklist/checklist.js +46 -17
  222. package/src/components/checklist/field-adapter.js +4 -1
  223. package/src/components/code-editor/code-editor.css +33 -0
  224. package/src/components/code-editor/code-editor.js +97 -8
  225. package/src/components/code-editor/field-adapter.js +3 -0
  226. package/src/components/composer/composer.css +3 -0
  227. package/src/components/composer/composer.js +100 -22
  228. package/src/components/context-menu/context-menu.js +41 -5
  229. package/src/components/copy/copy-button.js +9 -1
  230. package/src/components/copy/copy-input.js +5 -0
  231. package/src/components/data-filter/filter-core.js +0 -1
  232. package/src/components/date-picker/date-picker.css +8 -0
  233. package/src/components/date-picker/date-picker.js +47 -8
  234. package/src/components/date-picker/date-range-picker.js +1 -1
  235. package/src/components/date-picker/month-picker.js +19 -3
  236. package/src/components/date-picker/time-picker.js +54 -19
  237. package/src/components/datebox/date-range-box.js +7 -3
  238. package/src/components/datebox/datebox.js +32 -6
  239. package/src/components/dialog/dialog.css +6 -0
  240. package/src/components/dialog/dialog.js +22 -30
  241. package/src/components/dropdown/dropdown.js +1 -18
  242. package/src/components/empty-state/empty-state.js +21 -2
  243. package/src/components/field/field.js +19 -3
  244. package/src/components/fieldset/fieldset.js +3 -1
  245. package/src/components/filter/filter.js +9 -0
  246. package/src/components/form/form.js +19 -2
  247. package/src/components/kanban-view/kanban-card.js +15 -2
  248. package/src/components/kanban-view/kanban-view.css +21 -0
  249. package/src/components/kanban-view/kanban-view.js +29 -16
  250. package/src/components/launcher/launcher.css +14 -0
  251. package/src/components/launcher/launcher.js +54 -9
  252. package/src/components/master-panel/master-panel.js +24 -22
  253. package/src/components/menu-button/menu-button.js +26 -4
  254. package/src/components/message/message.css +228 -29
  255. package/src/components/message/message.js +664 -30
  256. package/src/components/modal/modal.js +70 -25
  257. package/src/components/modal/native-dialog.js +91 -0
  258. package/src/components/module-bar/module-bar.css +3 -0
  259. package/src/components/module-bar/module-bar.js +17 -4
  260. package/src/components/multi-value-editor/multi-value-editor.css +7 -2
  261. package/src/components/multi-value-editor/multi-value-editor.js +3 -2
  262. package/src/components/navigation-bar/navigation-bar.js +13 -1
  263. package/src/components/number-field/field-adapter.js +3 -0
  264. package/src/components/number-field/number-field.js +2 -1
  265. package/src/components/pagination/pagination.css +26 -2
  266. package/src/components/pagination/pagination.js +551 -65
  267. package/src/components/prose/prose.js +7 -1
  268. package/src/components/rating/field-adapter.js +3 -0
  269. package/src/components/run-status/run-status.js +43 -3
  270. package/src/components/run-trace/run-trace.js +15 -7
  271. package/src/components/search/search.js +3 -18
  272. package/src/components/select/field-adapter.js +8 -1
  273. package/src/components/select/select.js +68 -13
  274. package/src/components/sheet/sheet.js +27 -8
  275. package/src/components/slider/field-adapter.js +3 -0
  276. package/src/components/slider/slider.js +4 -6
  277. package/src/components/stat-tile/stat-tile.js +24 -9
  278. package/src/components/stepper/stepper.css +15 -0
  279. package/src/components/stepper/stepper.js +34 -2
  280. package/src/components/surface/catalog.js +185 -28
  281. package/src/components/surface/surface.js +10 -5
  282. package/src/components/tabbox/tabbox.js +13 -1
  283. package/src/components/table/table.css +160 -2
  284. package/src/components/table/table.js +479 -52
  285. package/src/components/table/window.js +46 -4
  286. package/src/components/table-view/table-view.js +1 -10
  287. package/src/components/tag-picker/field-adapter.js +3 -0
  288. package/src/components/tag-picker/tag-picker.js +2 -0
  289. package/src/components/timebox/field-adapter.js +3 -0
  290. package/src/components/toggle/toggle.js +51 -27
  291. package/src/components/tooltip/tooltip.js +21 -14
  292. package/src/components/tree/tree.js +87 -14
  293. package/src/components/truncate/truncate.js +21 -5
  294. package/src/components/value-list/value-list.js +37 -9
  295. package/src/components/view-settings/view-settings.js +1 -5
  296. package/src/core/component.js +34 -2
  297. package/src/core/date.js +5 -4
  298. package/src/core/drag-axis.js +24 -7
  299. package/src/core/export.js +4 -4
  300. package/src/core/fontawesome.js +34 -3
  301. package/src/core/format.js +3 -1
  302. package/src/core/http.js +23 -11
  303. package/src/core/icons.js +51 -10
  304. package/src/core/keyboard.js +83 -9
  305. package/src/core/messages.js +3 -0
  306. package/src/core/position.js +2 -2
  307. package/src/core/storage.js +80 -31
  308. package/src/core/util.js +16 -5
  309. package/src/elements/define.js +82 -47
  310. package/src/elements/kit.js +46 -35
  311. package/src/index.js +8 -4
  312. package/src/internal/agent-model.js +152 -0
  313. package/src/internal/app-rail.js +53 -2
  314. package/src/internal/collections.js +25 -0
  315. package/src/internal/menu-items.js +59 -0
  316. package/src/internal/overlay-content.js +35 -0
  317. package/src/internal/presence-loop.js +61 -14
  318. package/src/locales/de.js +3 -0
  319. package/src/zeyos/calendar.js +81 -19
  320. package/src/zeyos/connect.js +5 -1
  321. package/src/zeyos/form.js +29 -10
  322. package/src/zeyos/select.js +36 -12
  323. package/src/zeyos/table.js +43 -11
  324. package/src/zeyos/view.js +2 -1
  325. package/styles/tokens/semantic.css +7 -1
  326. 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
 
@@ -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({
@@ -209,11 +209,27 @@ export const icons = Object.freeze({
209
209
  });
210
210
 
211
211
  /**
212
- * Other names for bundled glyphs: legacy gx Factory names, and the older Font Awesome names
213
- * (`archive`, `edit`) that are still the ones most code reaches for. A glyph an application
214
- * registered under the alias itself takes precedence (see `icon()`).
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>>}
215
231
  */
216
- const aliases = Object.freeze({
232
+ export const iconAliases = Object.freeze({
217
233
  archive: 'box-archive',
218
234
  edit: 'pen-to-square',
219
235
  settings: 'gear',
@@ -331,18 +347,43 @@ export function registerIcons(glyphs) {
331
347
  }
332
348
 
333
349
  /**
334
- * 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));
335
360
  * @returns {string[]} Sorted icon names.
336
361
  */
337
362
  export function iconNames() {
338
- 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;
339
378
  }
340
379
 
341
380
  /**
342
381
  * Creates an icon element.
343
382
  *
344
383
  * Bare names (`'check'`) render through the active provider: the bundled inline SVG set by
345
- * 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
346
387
  * its renderer itself — `'fa:user'`, `'duotone:user'`, `'kit:zeyos-notes'`, `'builtin:check'`, or
347
388
  * a literal Font Awesome class list such as `'fa-solid fa-user'`.
348
389
  *
@@ -363,7 +404,7 @@ export function icon(name, options = {}) {
363
404
  if (spec.classes) return faIcon(spec.classes, options);
364
405
 
365
406
  // An application that registered a glyph under an alias name keeps its own glyph.
366
- const resolved = Object.hasOwn(extraGlyphs, spec.name) ? spec.name : aliases[spec.name] ?? spec.name;
407
+ const resolved = resolveIconName(spec.name);
367
408
  if (spec.provider === 'builtin') return builtinIcon(resolved, options);
368
409
  if (spec.provider === 'fa') {
369
410
  return faIcon(faIconClasses(resolved, {
@@ -392,7 +433,7 @@ export function icon(name, options = {}) {
392
433
  * @throws {RangeError} With `options.strict`, when no glyph carries that name.
393
434
  */
394
435
  function builtinIcon(name, options) {
395
- const entry = extraGlyphs[name] ?? icons[name];
436
+ const entry = extraGlyphs[name] ?? (Object.hasOwn(icons, name) ? icons[name] : undefined);
396
437
  if (!entry) {
397
438
  if (options.strict) throw new RangeError(`Unknown icon: ${name}`);
398
439
  warnMissingIcon(name);