@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
@@ -1,7 +1,9 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h } from '../../core/dom.js';
3
3
  import { connectedOverlayHost, overlayScope } from '../../core/overlay-host.js';
4
- import { pushOverlay } from '../../core/overlay-stack.js';
4
+ import { overlayStack, pushOverlay } from '../../core/overlay-stack.js';
5
+ import { replaceContent } from '../../internal/overlay-content.js';
6
+ import { closeDialog, isDialogOpen, matchesState, showDialogModal } from './native-dialog.js';
5
7
 
6
8
  /**
7
9
  * Controls initial focus may be placed on: what a reader reaches with Tab, rather than everything
@@ -73,6 +75,12 @@ export class Modal extends Component {
73
75
  #opener = null;
74
76
  /** @type {import('../../core/overlay-stack.js').OverlayHandle|null} Entry on the overlay stack while shown. */
75
77
  #overlay = null;
78
+ /** Whether the `open` attribute stands in for a `showModal()` the platform does not have. */
79
+ #attributeModal = false;
80
+ /** Whether the press the next `click` completes began on the backdrop. */
81
+ #backdropPress = false;
82
+ /** Set once `destroy()` has finished; a close queued before it then settles nothing. */
83
+ #destroyed = false;
76
84
 
77
85
  /**
78
86
  * Creates a modal in the configured theme scope, or at document level when none is present.
@@ -97,9 +105,9 @@ export class Modal extends Component {
97
105
  if (typeof window !== 'undefined') this.listen(window, 'keydown', (event) => {
98
106
  const key = /** @type {KeyboardEvent} */ (event);
99
107
  if (key.key !== 'Escape' || key.defaultPrevented || key.isComposing) return;
100
- if (!this.isOpen() || !this.el.matches(':modal')) return;
101
- const modals = document.querySelectorAll('dialog:modal');
102
- if (modals[modals.length - 1] !== this.el) return;
108
+ if (!this.isOpen() || !this._isModal()) return;
109
+ const topmost = topmostModalFor(key);
110
+ if (topmost && topmost !== this.el) return;
103
111
  // Reported before the key is cancelled: a `cancel` listener may ask whether something else
104
112
  // had already claimed this keydown, and our own claim must not answer for it.
105
113
  if (this.options.closable) this._requestDismiss('escape');
@@ -118,8 +126,19 @@ export class Modal extends Component {
118
126
  this.listen(this.el, 'close', () => {
119
127
  this._settleClose(this.#nativeClosingPresentations.shift());
120
128
  });
129
+ /*
130
+ * A backdrop click is a press that starts and ends on the backdrop. The `click` alone cannot
131
+ * tell: a press inside the panel — selecting text in a field — dragged out and released over
132
+ * the backdrop dispatches its `click` on the dialog, outside the panel's box.
133
+ */
134
+ this.listen(this.el, 'pointerdown', (event) => {
135
+ this.#backdropPress = event.target === this.el && isBackdropClick(this.el, /** @type {MouseEvent} */ (event));
136
+ });
121
137
  this.listen(this.el, 'click', (event) => {
122
- if (!this.options.lightDismiss || event.target !== this.el || !isBackdropClick(this.el, event)) return;
138
+ const pressed = this.#backdropPress;
139
+ this.#backdropPress = false;
140
+ if (!this.options.lightDismiss || !pressed || event.target !== this.el
141
+ || !isBackdropClick(this.el, /** @type {MouseEvent} */ (event))) return;
123
142
  this._requestDismiss('backdrop');
124
143
  });
125
144
  /*
@@ -148,10 +167,24 @@ export class Modal extends Component {
148
167
 
149
168
  /**
150
169
  * Puts the dialog on screen. Overridden by subclasses that open non-modally.
170
+ *
171
+ * Where the platform has no `showModal()` — a DOM implementation used for unit tests — the dialog
172
+ * is presented through its `open` attribute instead: no top layer and no inertness, but `open()`,
173
+ * `close()`, Escape and the lifecycle events behave the same.
151
174
  * @returns {void}
152
175
  */
153
176
  _show() {
154
- this.el.showModal();
177
+ this.#attributeModal = !showDialogModal(this.el);
178
+ }
179
+
180
+ /**
181
+ * Whether the current presentation is the modal one: the platform's `:modal`, or the `open`
182
+ * attribute standing in for `showModal()` where that is missing.
183
+ * @returns {boolean}
184
+ * @protected
185
+ */
186
+ _isModal() {
187
+ return matchesState(this.el, ':modal') || (this.#attributeModal && isDialogOpen(this.el));
155
188
  }
156
189
 
157
190
  /**
@@ -164,7 +197,7 @@ export class Modal extends Component {
164
197
  _hide(result = '', presentation = this.#presentation) {
165
198
  this.#nativeClosingPresentations.push(presentation);
166
199
  try {
167
- this.el.close(result);
200
+ closeDialog(this.el, result);
168
201
  } catch (error) {
169
202
  this.#nativeClosingPresentations.pop();
170
203
  throw error;
@@ -178,6 +211,7 @@ export class Modal extends Component {
178
211
  * @returns {void}
179
212
  */
180
213
  _present() {
214
+ this.#attributeModal = false;
181
215
  this._show();
182
216
  this.#presentation += 1;
183
217
  this.#syncModality();
@@ -195,7 +229,7 @@ export class Modal extends Component {
195
229
  * @returns {void}
196
230
  */
197
231
  #syncModality() {
198
- if (this.el.matches(':modal')) this.el.setAttribute('aria-modal', 'true');
232
+ if (matchesState(this.el, ':modal')) this.el.setAttribute('aria-modal', 'true');
199
233
  else if (this.el.getAttribute('aria-modal') === 'true') this.el.removeAttribute('aria-modal');
200
234
  }
201
235
 
@@ -211,7 +245,7 @@ export class Modal extends Component {
211
245
  */
212
246
  _overlayEntry() {
213
247
  return {
214
- kind: this.el.matches(':modal') ? 'modal' : 'non-modal',
248
+ kind: this._isModal() ? 'modal' : 'non-modal',
215
249
  root: this.el,
216
250
  owner: this,
217
251
  anchor: this.#opener
@@ -285,7 +319,7 @@ export class Modal extends Component {
285
319
  * @returns {boolean}
286
320
  */
287
321
  _isShown() {
288
- return this.el.open;
322
+ return isDialogOpen(this.el);
289
323
  }
290
324
 
291
325
  /**
@@ -309,7 +343,7 @@ export class Modal extends Component {
309
343
  * @returns {boolean} Whether this event closed the current presentation.
310
344
  */
311
345
  _settleClose(closingPresentation) {
312
- if (!this._isRealClose(closingPresentation)) {
346
+ if (this.#destroyed || !this._isRealClose(closingPresentation)) {
313
347
  if (closingPresentation !== undefined) this.#pendingResults.delete(closingPresentation);
314
348
  return false;
315
349
  }
@@ -473,9 +507,19 @@ export class Modal extends Component {
473
507
  if (this.#destroying) return;
474
508
  this.#destroying = true;
475
509
  if (this.isOpen()) this._dismiss();
476
- // The queued close that would settle it never arrives once listeners are aborted.
510
+ /*
511
+ * A close under way — started just now, or by a `close()` called just before — settles from a
512
+ * queued event that never arrives once listeners are aborted, so it is settled here: `close` is
513
+ * emitted once with that close's result, as on every other close path, and focus goes back to
514
+ * the opener while that listener is still attached.
515
+ */
516
+ if (this.el.dataset.state === 'open') {
517
+ this.#nativeClosingPresentations.length = 0;
518
+ this._settleClose(this.#presentation);
519
+ }
477
520
  this._releaseOverlay();
478
521
  super.destroy();
522
+ this.#destroyed = true;
479
523
  }
480
524
 
481
525
  /** @param {string|number} width @returns {void} */
@@ -550,21 +594,22 @@ function isFocusable(element, root) {
550
594
  }
551
595
 
552
596
  /**
553
- * @param {Element} target
554
- * @param {Node|string|number|{toElement: () => Node|null}|null|undefined} content
555
- * @returns {void}
597
+ * The modal dialog an Escape keydown belongs to.
598
+ *
599
+ * Everything outside the topmost modal dialog is inert, so a key pressed inside an open modal
600
+ * dialog was pressed in the topmost one — whoever opened it, the library or the application.
601
+ * A key with no such dialog around it (focus on a popup above the dialog, or lost to the body)
602
+ * goes to the modal opened last, which is the overlay stack's order. Document order cannot answer
603
+ * either: a dialog constructed early sits before one constructed later wherever it opens.
604
+ * @param {KeyboardEvent} event Escape keydown.
605
+ * @returns {Element|null}
556
606
  */
557
- function replaceContent(target, content) {
558
- target.replaceChildren();
559
- if (content == null) return;
560
- if (typeof content === 'string' || typeof content === 'number') {
561
- target.append(document.createTextNode(String(content)));
562
- } else if (typeof content.toElement === 'function') {
563
- const element = content.toElement();
564
- if (element) target.append(element);
565
- } else if (typeof content.nodeType === 'number') {
566
- target.append(content);
607
+ function topmostModalFor(event) {
608
+ const path = typeof event.composedPath === 'function' ? event.composedPath() : [];
609
+ for (let node = /** @type {any} */ (path[0] ?? event.target); node; node = node.parentNode ?? node.host ?? null) {
610
+ if (node.localName === 'dialog' && matchesState(node, ':modal')) return node;
567
611
  }
612
+ return overlayStack.topmostModal();
568
613
  }
569
614
 
570
615
  /** @param {HTMLDialogElement} dialog @param {MouseEvent} event @returns {boolean} */
@@ -0,0 +1,91 @@
1
+ /*
2
+ * The platform calls the overlays are built on, each behind a support check. Where a method is
3
+ * missing — a DOM implementation used for unit tests, such as jsdom, has `<dialog>` but neither
4
+ * `showModal()` nor `showPopover()` — the overlay falls back to the `open` attribute, which is what
5
+ * the stylesheet and `isOpen()` read either way. The fallback has no top layer, no inertness and
6
+ * no backdrop; it keeps the lifecycle (`open`, `close`, the result, `destroy()`) working.
7
+ */
8
+
9
+ /**
10
+ * Asks a state pseudo-class of an element. A selector engine that does not know `:modal` or
11
+ * `:popover-open` throws on it; there the element is in neither state.
12
+ * @param {Element|null|undefined} element Element to ask.
13
+ * @param {string} selector A selector such as `':modal'` or `':popover-open'`.
14
+ * @returns {boolean}
15
+ */
16
+ export function matchesState(element, selector) {
17
+ if (!element || typeof element.matches !== 'function') return false;
18
+ try {
19
+ return element.matches(selector);
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ /**
26
+ * The open modal dialogs of a document, in document order; empty where `:modal` is unknown.
27
+ * @param {Document} doc Document to search.
28
+ * @returns {Element[]}
29
+ */
30
+ export function modalDialogs(doc) {
31
+ try {
32
+ return Array.from(doc.querySelectorAll('dialog:modal'));
33
+ } catch {
34
+ return [];
35
+ }
36
+ }
37
+
38
+ /**
39
+ * Whether a dialog is presented, by the reflected `open` property or the attribute itself.
40
+ * @param {Element} dialog Dialog element.
41
+ * @returns {boolean}
42
+ */
43
+ export function isDialogOpen(dialog) {
44
+ return Boolean(/** @type {HTMLDialogElement} */ (dialog).open) || dialog.hasAttribute('open');
45
+ }
46
+
47
+ /**
48
+ * Presents a dialog modally with `showModal()`, or with the `open` attribute where it is missing.
49
+ * @param {Element} dialog Dialog element.
50
+ * @returns {boolean} Whether the platform presented it; false for the attribute fallback.
51
+ */
52
+ export function showDialogModal(dialog) {
53
+ const element = /** @type {HTMLDialogElement} */ (dialog);
54
+ if (typeof element.showModal === 'function') {
55
+ element.showModal();
56
+ return true;
57
+ }
58
+ element.setAttribute('open', '');
59
+ return false;
60
+ }
61
+
62
+ /**
63
+ * Presents a dialog non-modally with `show()`, or with the `open` attribute where it is missing.
64
+ * @param {Element} dialog Dialog element.
65
+ * @returns {void}
66
+ */
67
+ export function showDialog(dialog) {
68
+ const element = /** @type {HTMLDialogElement} */ (dialog);
69
+ if (typeof element.show === 'function') element.show();
70
+ else element.setAttribute('open', '');
71
+ }
72
+
73
+ /**
74
+ * Closes a dialog with `close()`. Where it is missing the `open` attribute is removed and the
75
+ * `close` event the platform would queue is queued here, so one listener settles both.
76
+ * @param {Element} dialog Dialog element.
77
+ * @param {string} [result] Native string return value.
78
+ * @returns {void}
79
+ */
80
+ export function closeDialog(dialog, result) {
81
+ const element = /** @type {HTMLDialogElement} */ (dialog);
82
+ if (typeof element.close === 'function') {
83
+ if (result === undefined) element.close();
84
+ else element.close(result);
85
+ return;
86
+ }
87
+ if (!isDialogOpen(element)) return;
88
+ if (result !== undefined) element.returnValue = String(result);
89
+ element.removeAttribute('open');
90
+ queueMicrotask(() => element.dispatchEvent(new Event('close')));
91
+ }
@@ -264,6 +264,9 @@
264
264
 
265
265
  .zx-module-bar__item[aria-disabled="true"] .zx-module-bar__tile,
266
266
  .zx-module-bar__entry[aria-disabled="true"] .zx-module-bar__tile { opacity: .55; }
267
+
268
+ /* An agent module is its AgentAvatar at the size of the tile: no tint, no AppIcon behind it. */
269
+ .zx-module-bar__tile[data-agent] > .zx-agent-avatar { --zx-agent-avatar-size: var(--zx-module-bar-tile); }
267
270
  .zx-module-bar__item[aria-disabled="true"]:hover,
268
271
  .zx-module-bar__entry[aria-disabled="true"]:hover { background: transparent; }
269
272
 
@@ -1,7 +1,7 @@
1
1
  import { h } from '../../core/dom.js';
2
2
  import { icon } from '../../core/icons.js';
3
3
  import { isCssColor, uid } from '../../core/util.js';
4
- import { AppRailPresenter, appNavIcon, normalizeAppItems } from '../../internal/app-rail.js';
4
+ import { AppRailPresenter, appNavAgentWord, appNavIcon, appNavName, normalizeAppItems } from '../../internal/app-rail.js';
5
5
  import { APP_ICON_TONES, appIcon } from '../app-icon/app-icon.js';
6
6
  import { Dropdown } from '../dropdown/dropdown.js';
7
7
  import { Tooltip } from '../tooltip/tooltip.js';
@@ -15,6 +15,10 @@ import { Tooltip } from '../tooltip/tooltip.js';
15
15
  * @property {string|number} id Stable module identifier.
16
16
  * @property {string} label Module name: the tile's accessible name, tooltip, and catalogue label.
17
17
  * @property {string|Node|{toElement: () => Node|null}|((context: Record<string, any>, item: AppNavItem) => Node|null)} [icon] Icon name, node, component, or factory.
18
+ * @property {import('../../internal/app-rail.js').AppNavAgent|true} [agent] Draws the module as an
19
+ * agent: an AgentAvatar in place of the tile, whatever the `appearance`, at rest, with its
20
+ * activity's word in the tile's accessible name. `tone` and `color` then do not apply; the
21
+ * avatar's own `tone` does.
18
22
  * @property {ModuleTone} [tone] Identity colour from the theme's categorical tones.
19
23
  * @property {string} [color] Identity colour as any CSS colour; takes precedence over `tone`.
20
24
  * @property {string|number} [badge] Count or status badge.
@@ -288,7 +292,7 @@ export class ModuleBar extends AppRailPresenter {
288
292
  super.destroy();
289
293
  }
290
294
 
291
- /** @param {Node|null} node @returns {boolean} @private */
295
+ /** @param {Node|null} node @returns {boolean} @protected */
292
296
  _containsNode(node) {
293
297
  return super._containsNode(node) || Boolean(node && this._catalogue?.getPanel().contains(node));
294
298
  }
@@ -450,6 +454,10 @@ export class ModuleBar extends AppRailPresenter {
450
454
  level: 1,
451
455
  location: location === 'bar' ? 'module' : 'catalogue'
452
456
  }) ?? h('span', { class: 'zx-module-bar__initial' }, item.label.trim().charAt(0).toUpperCase());
457
+ if (visual instanceof Element && visual.classList.contains('zx-agent-avatar')) {
458
+ // An agent is its own identity: no tint, no AppIcon, the face at the size of the tile.
459
+ return h('span', { class: 'zx-module-bar__tile', ariaHidden: 'true', dataset: { agent: '' } }, visual);
460
+ }
453
461
  const { tone, color } = resolveModuleColor(item);
454
462
  const tile = h('span', {
455
463
  class: 'zx-module-bar__tile',
@@ -476,8 +484,9 @@ export class ModuleBar extends AppRailPresenter {
476
484
  _applyTileBadge(control, item) {
477
485
  control.querySelector(':scope > .zx-module-bar__badge')?.remove();
478
486
  const count = item.badge == null || item.badge === '' ? null : String(item.badge);
479
- control.setAttribute('aria-label', count === null ? item.label
480
- : this._message('moduleBar.itemBadge', '%1 (%2)', item.label, count));
487
+ const name = appNavName(item, control.querySelector('.zx-module-bar__tile > .zx-agent-avatar'));
488
+ control.setAttribute('aria-label', count === null ? name
489
+ : this._message('moduleBar.itemBadge', '%1 (%2)', name, count));
481
490
  if (count === null) return;
482
491
  control.append(h('span', {
483
492
  class: 'zx-module-bar__badge',
@@ -1030,6 +1039,10 @@ function currentState(item, activeId) {
1030
1039
  * @returns {void}
1031
1040
  */
1032
1041
  function applyRowBadge(control, item, block) {
1042
+ // An agent row is named with its activity and count, so the name follows the badge.
1043
+ const agent = control.querySelector(
1044
+ ':scope > .zx-module-bar__tile > .zx-agent-avatar, :scope > .zx-app-rail__flyout-item-icon > .zx-agent-avatar');
1045
+ if (appNavAgentWord(agent)) control.setAttribute('aria-label', appNavName(item, agent, true));
1033
1046
  const existing = control.querySelector(`:scope > .${block}-badge`);
1034
1047
  const count = item.badge == null || item.badge === '' ? null : String(item.badge);
1035
1048
  if (count === null) {
@@ -87,8 +87,13 @@
87
87
  color: var(--zx-color-text-muted);
88
88
  cursor: grab;
89
89
  touch-action: none;
90
- transition: color var(--zx-dur-fast) var(--zx-ease),
91
- background-color var(--zx-dur-fast) var(--zx-ease);
90
+ }
91
+
92
+ @media (prefers-reduced-motion: no-preference) {
93
+ .zx-multi-value-editor__handle {
94
+ transition: color var(--zx-dur-fast) var(--zx-ease),
95
+ background-color var(--zx-dur-fast) var(--zx-ease);
96
+ }
92
97
  }
93
98
 
94
99
  .zx-multi-value-editor__handle:hover:not(:disabled) {
@@ -22,6 +22,7 @@ const REORDER = Object.freeze({
22
22
  });
23
23
 
24
24
  /** Focusable parts of a row, so a re-render can put focus back where the reader left it. */
25
+ /** @typedef {'value'|'handle'|'up'|'down'} MultiValueEditorPart A row control that can take focus. */
25
26
  const PARTS = Object.freeze({
26
27
  value: '.zx-multi-value-editor__value',
27
28
  handle: '.zx-multi-value-editor__handle',
@@ -109,7 +110,7 @@ export class MultiValueEditor extends Component {
109
110
 
110
111
  /**
111
112
  * @param {number} [focusIndex=-1] Row to focus after the render, or -1 for none.
112
- * @param {keyof PARTS} [focusPart='value'] Which control of that row takes focus.
113
+ * @param {MultiValueEditorPart} [focusPart='value'] Which control of that row takes focus.
113
114
  * @returns {void}
114
115
  */
115
116
  _renderRows(focusIndex = -1, focusPart = 'value') {
@@ -346,7 +347,7 @@ export class MultiValueEditor extends Component {
346
347
  /**
347
348
  * @param {number} from Index to move.
348
349
  * @param {number} to Destination index.
349
- * @param {keyof PARTS} part Control of the moved row that takes focus.
350
+ * @param {MultiValueEditorPart} part Control of the moved row that takes focus.
350
351
  * @returns {boolean} Whether anything moved.
351
352
  */
352
353
  _move(from, to, part) {
@@ -1,5 +1,6 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  import { h } from '../../core/dom.js';
3
+ import { rovingStep } from '../../core/keyboard.js';
3
4
  import { isElement, uid } from '../../core/util.js';
4
5
  import { button } from '../button/button.js';
5
6
  import { MenuButton } from '../menu-button/menu-button.js';
@@ -394,7 +395,9 @@ export class NavigationBar extends Component {
394
395
  const enabled = this._enabledItems();
395
396
  if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
396
397
  event.preventDefault();
397
- const offset = event.key === 'ArrowRight' ? 1 : -1;
398
+ // The arrows follow the visual order, which `dir="rtl"` reverses.
399
+ const step = rovingStep(event.key, 'horizontal', isRightToLeft(this.refs.items));
400
+ const offset = step === 'next' ? 1 : -1;
398
401
  const index = enabled.indexOf(current);
399
402
  const next = enabled[(index + offset + enabled.length) % enabled.length];
400
403
  if (next) this._focusTab(next);
@@ -591,6 +594,15 @@ export function lengthToPixels(length, rootFontSize = 16) {
591
594
  return size * (Number.isFinite(root) && root > 0 ? root : 16);
592
595
  }
593
596
 
597
+ /**
598
+ * Whether an element is laid out right to left, as its computed `direction` says.
599
+ * @param {Element} element Element to ask.
600
+ * @returns {boolean}
601
+ */
602
+ function isRightToLeft(element) {
603
+ return globalThis.getComputedStyle?.(element)?.direction === 'rtl';
604
+ }
605
+
594
606
  /** @param {unknown} content @returns {content is NavigationPanelContent} */
595
607
  function isPanelContent(content) {
596
608
  if (typeof content === 'function' || content instanceof Component) return true;
@@ -23,6 +23,9 @@ export function registerNumberFieldAdapter() {
23
23
  });
24
24
  return {
25
25
  el: numberField.el,
26
+ // The spinbutton, not the frame around it and its step buttons, is what the label names and
27
+ // what the field's description and validity belong to.
28
+ labelTarget: numberField.getInput(),
26
29
  get: () => numberField.get(),
27
30
  set: (value) => {
28
31
  setting = true;
@@ -594,10 +594,11 @@ function clampNumber(value, min, max) {
594
594
 
595
595
  /**
596
596
  * Decimal places in a number's shortest exact notation, exponent form included (`2.5e-7` has 8).
597
+ * Shared with Slider, whose `stepPrecision()` is this.
597
598
  * @param {number} value Number to measure.
598
599
  * @returns {number}
599
600
  */
600
- function decimalsOf(value) {
601
+ export function decimalsOf(value) {
601
602
  const [mantissa, exponent = '0'] = String(value).toLowerCase().split('e');
602
603
  const fraction = mantissa.split('.')[1]?.length ?? 0;
603
604
  return Math.max(0, fraction - Number(exponent));
@@ -1,8 +1,8 @@
1
1
  /*
2
2
  * Pagination — the footer bar of a server-backed list.
3
3
  *
4
- * One row that wraps: the summary and the page-size select describe the slice and sit at the
5
- * start, the pager sits alone at the end. Page buttons are ordinary `.zx-btn` controls so they inherit the library's control
4
+ * One row that wraps: the summary, the page-size select, and the Auto-load switch describe the
5
+ * slice and sit at the start, the pager (or Load more) sits alone at the end. Page buttons are ordinary `.zx-btn` controls so they inherit the library's control
6
6
  * height, radius, and focus ring; the current page takes the neutral current fill — it is where
7
7
  * you are, not a call to action.
8
8
  */
@@ -95,3 +95,27 @@
95
95
  .zx-pagination[data-mode="loadmore"] .zx-pagination__more {
96
96
  flex: none;
97
97
  }
98
+
99
+ /* Both ends are built once; the one the mode does not use is hidden. Their own display rules would
100
+ otherwise outrank the attribute. */
101
+ .zx-pagination :is(.zx-pagination__controls, .zx-pagination__more)[hidden] {
102
+ display: none;
103
+ }
104
+
105
+ /* The switch reads as part of the bar's quiet description, not as a form field. */
106
+ .zx-pagination__autoload {
107
+ display: inline-flex;
108
+ align-items: center;
109
+ white-space: nowrap;
110
+ }
111
+
112
+ .zx-pagination__autoload .zx-toggle {
113
+ min-block-size: calc(var(--zx-control-height) - var(--zx-space-1));
114
+ align-items: center;
115
+ color: var(--zx-color-text-muted);
116
+ font-size: var(--zx-text-sm);
117
+ }
118
+
119
+ .zx-pagination__autoload .zx-toggle__track {
120
+ margin-block-start: 0;
121
+ }