@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
@@ -154,8 +154,16 @@
154
154
  display: none;
155
155
  }
156
156
 
157
+ /* Four rows of three months. Each row is its own three-column grid, so the cells line up exactly
158
+ as one 3 × 4 grid would while the row elements stay in the accessibility tree. */
157
159
  .zx-date-picker__quick-grid,
158
160
  .zx-month-picker__grid {
161
+ display: grid;
162
+ gap: var(--zx-space-2);
163
+ }
164
+
165
+ .zx-date-picker__quick-row,
166
+ .zx-month-picker__row {
159
167
  display: grid;
160
168
  grid-template-columns: repeat(3, minmax(0, 1fr));
161
169
  gap: var(--zx-space-2);
@@ -234,11 +234,12 @@ export class DatePicker extends Component {
234
234
  const rowStart = addDays(start, week * 7);
235
235
  const row = h('tr');
236
236
  if (this.options.showWeekNumbers) {
237
+ const weekNumber = rowWeekNumber(rowStart);
237
238
  row.append(h('th', {
238
239
  class: 'zx-date-picker__week',
239
240
  scope: 'row',
240
- ariaLabel: this._message('datePicker.week', 'Week %1', isoWeekNumber(rowStart))
241
- }, String(isoWeekNumber(rowStart))));
241
+ ariaLabel: this._message('datePicker.week', 'Week %1', weekNumber)
242
+ }, String(weekNumber)));
242
243
  }
243
244
  for (let column = 0; column < 7; column += 1) {
244
245
  const date = addDays(rowStart, column);
@@ -262,7 +263,11 @@ export class DatePicker extends Component {
262
263
  }
263
264
  rows.push(row);
264
265
  }
266
+ // Redrawing replaces the focused day's button; focus follows to its replacement so the arrow
267
+ // keys keep working after a selection (and before `change`, so a host can still move it on).
268
+ const hadFocus = hasFocusWithin(this.refs.days);
265
269
  this.refs.days.replaceChildren(...rows);
270
+ if (hadFocus) this._buttonForDate(this._focused)?.focus();
266
271
  if (this._quickOpen) this._renderQuickPick();
267
272
  }
268
273
 
@@ -365,15 +370,25 @@ export class DatePicker extends Component {
365
370
  this._quickOpen = false;
366
371
  this.refs.quickPanel.hidden = true;
367
372
  this.refs.heading.setAttribute('aria-expanded', 'false');
373
+ // Stepping the year in the panel already moved the view and announced it with `monthchange`:
374
+ // however the panel closes, the calendar shows that month, with the roving day inside it.
375
+ if (this._focused.getFullYear() !== this._viewYear || this._focused.getMonth() !== this._viewMonth) {
376
+ this._focused = new Date(this._viewYear, this._viewMonth, Math.min(
377
+ this._focused.getDate(), new Date(this._viewYear, this._viewMonth + 1, 0).getDate()
378
+ ));
379
+ }
380
+ this._renderCalendar();
368
381
  }
369
382
 
370
383
  /** @returns {void} */
371
384
  _renderQuickPick() {
372
385
  this.refs.quickYear.textContent = String(this._viewYear);
373
- const months = [];
386
+ const rows = [];
374
387
  for (let month = 0; month < 12; month += 1) {
375
388
  const date = new Date(this._viewYear, month, 1);
376
- months.push(h('button', {
389
+ // Three months to a row, so the grid's cells sit in rows as the grid role requires.
390
+ if (month % 3 === 0) rows.push(h('div', { class: 'zx-date-picker__quick-row', role: 'row' }));
391
+ rows[rows.length - 1].append(h('button', {
377
392
  class: 'zx-date-picker__quick-month',
378
393
  type: 'button',
379
394
  role: 'gridcell',
@@ -382,7 +397,7 @@ export class DatePicker extends Component {
382
397
  dataset: { month }
383
398
  }, formatDate(date, '%b')));
384
399
  }
385
- this.refs.quickGrid.replaceChildren(...months);
400
+ this.refs.quickGrid.replaceChildren(...rows);
386
401
  }
387
402
 
388
403
  /** @param {number} amount @returns {void} */
@@ -438,7 +453,6 @@ export class DatePicker extends Component {
438
453
  this._focused = dayOnly(date);
439
454
  this._viewMonth = month;
440
455
  this._closeQuickPick();
441
- this._renderCalendar();
442
456
  this._emitMonthChange();
443
457
  this.focus();
444
458
  }
@@ -489,6 +503,16 @@ function dayOnly(date) {
489
503
  return new Date(date.getFullYear(), date.getMonth(), date.getDate());
490
504
  }
491
505
 
506
+ /**
507
+ * Whether focus is on `element` or inside it, judged in its own document or shadow root.
508
+ * @param {Element} element Container to test.
509
+ * @returns {boolean}
510
+ */
511
+ function hasFocusWithin(element) {
512
+ const active = /** @type {Document|ShadowRoot|undefined} */ (element.getRootNode?.())?.activeElement;
513
+ return Boolean(active) && element.contains(active);
514
+ }
515
+
492
516
  /** @param {Date|null} date @returns {Date|null} */
493
517
  function cloneDate(date) {
494
518
  return date ? new Date(date.getTime()) : null;
@@ -505,11 +529,26 @@ function normalizeWeekStart(value) {
505
529
  return Number.isInteger(number) && number >= 0 && number <= 6 ? number : getWeekStart();
506
530
  }
507
531
 
508
- /** @param {Date} date @returns {number} */
509
- function isoWeekNumber(date) {
532
+ /**
533
+ * ISO 8601 week number of a local calendar day.
534
+ * @param {Date} date Any time on the day.
535
+ * @returns {number}
536
+ */
537
+ export function isoWeekNumber(date) {
510
538
  const utc = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate()));
511
539
  const weekday = utc.getUTCDay() || 7;
512
540
  utc.setUTCDate(utc.getUTCDate() + 4 - weekday);
513
541
  const yearStart = new Date(Date.UTC(utc.getUTCFullYear(), 0, 1));
514
542
  return Math.ceil((((utc.getTime() - yearStart.getTime()) / 86400000) + 1) / 7);
515
543
  }
544
+
545
+ /**
546
+ * ISO week number for a calendar row of seven days starting on `rowStart`. A row that does not
547
+ * start on Monday straddles two ISO weeks; its Thursday always falls in the week that holds most of
548
+ * the row (for a Sunday start, Monday to Saturday), which is the week the row is labelled with.
549
+ * @param {Date} rowStart First day of the row.
550
+ * @returns {number}
551
+ */
552
+ export function rowWeekNumber(rowStart) {
553
+ return isoWeekNumber(addDays(rowStart, (4 - rowStart.getDay() + 7) % 7));
554
+ }
@@ -152,7 +152,7 @@ export class DateRangePicker extends Component {
152
152
  };
153
153
 
154
154
  // Every field below is initialized here rather than as a class field: render() runs inside the
155
- // base constructor, before class-field initializers would overwrite it (see AGENTS.md).
155
+ // base constructor, before class-field initializers would overwrite it.
156
156
 
157
157
  /** @returns {HTMLElement} */
158
158
  render() {
@@ -122,11 +122,13 @@ export class MonthPicker extends DatePicker {
122
122
  _renderMonths() {
123
123
  if (!this.refs?.grid) return;
124
124
  this.refs.year.textContent = String(this._year);
125
- const months = [];
125
+ const rows = [];
126
126
  for (let month = 0; month < 12; month += 1) {
127
127
  const date = new Date(this._year, month, 1);
128
128
  const selected = Boolean(this._value && sameMonth(date, this._value));
129
- months.push(h('button', {
129
+ // Three months to a row, so the grid's cells sit in rows as the grid role requires.
130
+ if (month % 3 === 0) rows.push(h('div', { class: 'zx-month-picker__row', role: 'row' }));
131
+ rows[rows.length - 1].append(h('button', {
130
132
  class: 'zx-month-picker__month',
131
133
  type: 'button',
132
134
  role: 'gridcell',
@@ -137,7 +139,11 @@ export class MonthPicker extends DatePicker {
137
139
  dataset: { month }
138
140
  }, formatDate(date, '%b')));
139
141
  }
140
- this.refs.grid.replaceChildren(...months);
142
+ // Redrawing replaces the focused month's button; focus follows to its replacement so the arrow
143
+ // keys keep working after a selection (and before `change`, so a host can still move it on).
144
+ const hadFocus = hasFocusWithin(this.refs.grid);
145
+ this.refs.grid.replaceChildren(...rows);
146
+ if (hadFocus) this._button(this._focusedMonth)?.focus();
141
147
  }
142
148
 
143
149
  /** @param {number} amount @returns {void} */
@@ -226,6 +232,16 @@ function firstOfMonth(date) {
226
232
  return date ? new Date(date.getFullYear(), date.getMonth(), 1) : null;
227
233
  }
228
234
 
235
+ /**
236
+ * Whether focus is on `element` or inside it, judged in its own document or shadow root.
237
+ * @param {Element} element Container to test.
238
+ * @returns {boolean}
239
+ */
240
+ function hasFocusWithin(element) {
241
+ const active = /** @type {Document|ShadowRoot|undefined} */ (element.getRootNode?.())?.activeElement;
242
+ return Boolean(active) && element.contains(active);
243
+ }
244
+
229
245
  /** @param {Date} a @param {Date} b @returns {boolean} */
230
246
  function sameMonth(a, b) {
231
247
  return a.getFullYear() === b.getFullYear() && a.getMonth() === b.getMonth();
@@ -156,7 +156,13 @@ export class TimePicker extends Component {
156
156
  this.listen(input, 'focus', () => input.select());
157
157
  this.listen(input, 'keydown', (event) => this._onKeydown(event, segment, max));
158
158
  this.listen(input, 'input', () => this._onInput(input, segment, max));
159
- this.listen(input, 'blur', () => this._commitFromInputs());
159
+ // Leaving a field the reader did not edit commits nothing: tabbing through an empty picker
160
+ // must not choose 00:00, nor round away the seconds of a value whose seconds are not shown.
161
+ this.listen(input, 'blur', () => {
162
+ if (this._inputs.some((field) => field.value !== pad(this._display[field.dataset.segment]))) {
163
+ this._commitFromInputs();
164
+ }
165
+ });
160
166
  }
161
167
 
162
168
  /** @param {KeyboardEvent} event @param {'h'|'m'|'s'} segment @param {number} max @returns {void} */
@@ -184,7 +190,8 @@ export class TimePicker extends Component {
184
190
 
185
191
  /** @returns {void} */
186
192
  _commitFromInputs() {
187
- const next = { h: 0, m: 0, s: 0 };
193
+ // Start from what is shown, so a segment that is not rendered (seconds) keeps its value.
194
+ const next = { ...this._display };
188
195
  for (const input of this._inputs) {
189
196
  const segment = input.dataset.segment;
190
197
  const max = segment === 'h' ? 23 : 59;
@@ -249,16 +256,18 @@ export class TimePicker extends Component {
249
256
  }
250
257
 
251
258
  /**
252
- * Applies a mark's value to the active unit, then moves on to the minutes so a whole time can
253
- * be set with two clicks.
259
+ * Applies a mark's value to the active unit. An explicit pick (click, Enter, Space) of an hour
260
+ * then moves on to the minutes so a whole time can be set with two clicks; arrowing through the
261
+ * radio group passes `advance: false` and stays on the dial it is in.
254
262
  * @param {number} value Hour or minute the mark stands for.
263
+ * @param {{advance?: boolean}} [options={}] Whether an hour pick opens the minute dial.
255
264
  * @returns {void}
256
265
  */
257
- _pick(value) {
266
+ _pick(value, { advance = true } = {}) {
258
267
  const next = { ...this._display, [this._clockUnit]: value };
259
- const advance = this._clockUnit === 'h';
268
+ const toMinutes = advance && this._clockUnit === 'h';
260
269
  this.set(next);
261
- if (advance) this.openClock('m');
270
+ if (toMinutes) this.openClock('m');
262
271
  }
263
272
 
264
273
  /** @param {KeyboardEvent} event @returns {void} */
@@ -275,8 +284,8 @@ export class TimePicker extends Component {
275
284
  else if (event.key === 'End') next = marks.length - 1;
276
285
  if (next === null) return;
277
286
  event.preventDefault();
278
- // Selection follows focus, the APG behaviour for a radio group.
279
- this._pick(Number(marks[next].dataset.value));
287
+ // Selection follows focus, the APG behaviour for a radio group — within this group only.
288
+ this._pick(Number(marks[next].dataset.value), { advance: false });
280
289
  this.refs.dial.querySelector(`[data-value="${marks[next].dataset.value}"]`)?.focus();
281
290
  }
282
291
 
@@ -296,14 +305,15 @@ export class TimePicker extends Component {
296
305
 
297
306
  const selected = hours ? this._display.h : this._display.m;
298
307
  const marks = hours ? hourMarks() : minuteMarks();
308
+ const stop = tabStop(marks, selected, hours ? 24 : 60);
299
309
  const rendered = this.refs.dial.querySelectorAll('.zx-time-picker__mark');
300
310
  // Rebuild only when the dial switches unit; otherwise just restate which mark is checked.
301
311
  if (rendered.length !== marks.length || this.refs.dial.dataset.unit !== this._clockUnit) {
302
312
  for (const mark of rendered) mark.remove();
303
313
  this.refs.dial.dataset.unit = this._clockUnit;
304
- this.refs.dial.append(...marks.map((mark) => this._buildMark(mark, selected)));
314
+ this.refs.dial.append(...marks.map((mark) => this._buildMark(mark, selected, stop)));
305
315
  } else {
306
- marks.forEach((mark, index) => this._syncMark(rendered[index], mark, selected));
316
+ marks.forEach((mark, index) => this._syncMark(rendered[index], mark, selected, stop));
307
317
  }
308
318
 
309
319
  const ring = hours && !isOuterHour(selected) ? 'inner' : 'outer';
@@ -312,8 +322,8 @@ export class TimePicker extends Component {
312
322
  this.refs.hand.style.setProperty('--zx-clock-angle', `${angle}deg`);
313
323
  }
314
324
 
315
- /** @param {ClockMark} mark @param {number} selected @returns {HTMLElement} */
316
- _buildMark(mark, selected) {
325
+ /** @param {ClockMark} mark @param {number} selected @param {number} stop @returns {HTMLElement} */
326
+ _buildMark(mark, selected, stop) {
317
327
  const element = h('button', {
318
328
  class: 'zx-time-picker__mark',
319
329
  type: 'button',
@@ -321,15 +331,18 @@ export class TimePicker extends Component {
321
331
  dataset: { value: String(mark.value), ring: mark.ring }
322
332
  }, mark.label);
323
333
  element.style.setProperty('--zx-clock-angle', `${mark.angle}deg`);
324
- this._syncMark(element, mark, selected);
334
+ this._syncMark(element, mark, selected, stop);
325
335
  return element;
326
336
  }
327
337
 
328
- /** @param {HTMLElement} element @param {ClockMark} mark @param {number} selected @returns {void} */
329
- _syncMark(element, mark, selected) {
330
- const checked = mark.value === selected;
331
- element.setAttribute('aria-checked', String(checked));
332
- element.tabIndex = checked ? 0 : -1;
338
+ /**
339
+ * @param {HTMLElement} element @param {ClockMark} mark @param {number} selected
340
+ * @param {number} stop Value of the one mark in the Tab order.
341
+ * @returns {void}
342
+ */
343
+ _syncMark(element, mark, selected, stop) {
344
+ element.setAttribute('aria-checked', String(mark.value === selected));
345
+ element.tabIndex = mark.value === stop ? 0 : -1;
333
346
  }
334
347
 
335
348
  /**
@@ -376,6 +389,28 @@ function minuteMarks() {
376
389
  return marks;
377
390
  }
378
391
 
392
+ /**
393
+ * The mark that takes the dial's Tab stop: the checked one, or — when the value falls between
394
+ * marks, as 12:07 does on a five-minute dial — the nearest, so the group is always reachable.
395
+ * @param {ClockMark[]} marks Marks on the dial.
396
+ * @param {number} selected Current hour or minute.
397
+ * @param {number} cycle Values around the dial (24 or 60).
398
+ * @returns {number}
399
+ */
400
+ export function tabStop(marks, selected, cycle) {
401
+ let best = marks[0]?.value ?? 0;
402
+ let distance = Infinity;
403
+ for (const { value } of marks) {
404
+ const gap = Math.abs(value - selected);
405
+ const around = Math.min(gap, cycle - gap);
406
+ if (around < distance) {
407
+ best = value;
408
+ distance = around;
409
+ }
410
+ }
411
+ return best;
412
+ }
413
+
379
414
  /** @param {number} hour @returns {boolean} */
380
415
  function isOuterHour(hour) {
381
416
  return hour >= 1 && hour <= 12;
@@ -123,7 +123,7 @@ export class DateRangeBox extends Component {
123
123
  };
124
124
 
125
125
  // State used by render() is initialized inside it, never as class fields: render() runs from the
126
- // base constructor, before field initializers would reset it (see AGENTS.md).
126
+ // base constructor, before field initializers would reset it.
127
127
 
128
128
  /** @returns {HTMLElement} */
129
129
  render() {
@@ -145,13 +145,15 @@ export class DateRangeBox extends Component {
145
145
 
146
146
  const content = h('div', { class: 'zx-date-range-box__content' },
147
147
  h('div', { ref: 'control', class: 'zx-date-range-box__control' },
148
+ // APG date picker combobox: the text field owns the expanded state of the calendar dialog.
148
149
  h('input', {
149
150
  ref: 'input',
150
151
  class: 'zx-date-range-box__input',
151
152
  type: 'text',
153
+ role: 'combobox',
152
154
  autocomplete: 'off',
153
155
  placeholder: this.options.placeholder ?? this._placeholder(),
154
- 'aria-haspopup': 'grid',
156
+ 'aria-haspopup': 'dialog',
155
157
  ariaControls: popoverId,
156
158
  ariaExpanded: 'false'
157
159
  }),
@@ -166,7 +168,7 @@ export class DateRangeBox extends Component {
166
168
  class: 'zx-date-range-box__toggle',
167
169
  type: 'button',
168
170
  ariaLabel: text('daterange.choose', 'Choose date range'),
169
- 'aria-haspopup': 'grid',
171
+ 'aria-haspopup': 'dialog',
170
172
  ariaControls: popoverId,
171
173
  ariaExpanded: 'false'
172
174
  }, icon('calendar'))
@@ -175,6 +177,8 @@ export class DateRangeBox extends Component {
175
177
  ref: 'popover',
176
178
  id: popoverId,
177
179
  class: 'zx-date-range-box__popover',
180
+ role: 'dialog',
181
+ ariaLabel: text('daterange.choose', 'Choose date range'),
178
182
  popover: 'manual',
179
183
  dataset: { state: 'closed' }
180
184
  })
@@ -1,5 +1,5 @@
1
1
  import { Component } from '../../core/component.js';
2
- import { clampDate, formatDate, parseDate } from '../../core/date.js';
2
+ import { formatDate, parseDate } from '../../core/date.js';
3
3
  import { h } from '../../core/dom.js';
4
4
  import { ICON_SIZE, icon } from '../../core/icons.js';
5
5
  import { position } from '../../core/position.js';
@@ -16,8 +16,10 @@ import { placeholderTokens } from './placeholder.js';
16
16
  * so a date reads as the rest of the screen writes dates. It is never parsed, so it may use any
17
17
  * `formatDate()` token, month and weekday names included. Null shows `format`.
18
18
  * @property {boolean} [time=false] Append `%H:%M` and show time controls.
19
- * @property {Date|null} [min=null] Earliest selectable date.
20
- * @property {Date|null} [max=null] Latest selectable date.
19
+ * @property {Date|null} [min=null] Earliest selectable date. Bounds are whole local calendar days,
20
+ * as in the calendar: with `time`, any time on the `min` day is allowed.
21
+ * @property {Date|null} [max=null] Latest selectable date, the whole local calendar day: with
22
+ * `time`, any time on the `max` day is allowed.
21
23
  * @property {string|null} [placeholder=null] Input placeholder; null derives one from the format.
22
24
  * @property {boolean} [clearable=true] Show a clear button while a value is present and the box is
23
25
  * enabled; without it the input keeps no room for one.
@@ -76,13 +78,15 @@ export class Datebox extends Component {
76
78
 
77
79
  const content = h('div', { class: 'zx-datebox__content' },
78
80
  h('div', { ref: 'control', class: 'zx-datebox__control' },
81
+ // APG date picker combobox: the text field owns the expanded state of the calendar dialog.
79
82
  h('input', {
80
83
  ref: 'input',
81
84
  class: 'zx-datebox__input',
82
85
  type: 'text',
86
+ role: 'combobox',
83
87
  autocomplete: 'off',
84
88
  placeholder: this.options.placeholder ?? placeholderFromFormat(this._format, (key) => this.msg(key)),
85
- 'aria-haspopup': 'grid',
89
+ 'aria-haspopup': 'dialog',
86
90
  ariaControls: popoverId,
87
91
  ariaExpanded: 'false'
88
92
  }),
@@ -97,7 +101,7 @@ export class Datebox extends Component {
97
101
  class: 'zx-datebox__toggle',
98
102
  type: 'button',
99
103
  ariaLabel: this.msg('datebox.choose'),
100
- 'aria-haspopup': 'grid',
104
+ 'aria-haspopup': 'dialog',
101
105
  ariaControls: popoverId,
102
106
  ariaExpanded: 'false'
103
107
  }, icon('calendar'))
@@ -106,6 +110,8 @@ export class Datebox extends Component {
106
110
  ref: 'popover',
107
111
  id: popoverId,
108
112
  class: 'zx-datebox__popover',
113
+ role: 'dialog',
114
+ ariaLabel: this.msg('datebox.choose'),
109
115
  popover: 'manual',
110
116
  dataset: { state: 'closed' }
111
117
  })
@@ -298,7 +304,7 @@ export class Datebox extends Component {
298
304
  else if (typeof value === 'number' && Number.isFinite(value)) date = new Date(value * 1000);
299
305
  else if (typeof value === 'string') date = parseDate(value, this._format);
300
306
  if (!date || Number.isNaN(date.getTime())) return null;
301
- return clampDate(date, this._min, this._max);
307
+ return clampDay(date, this._min, this._max);
302
308
  }
303
309
 
304
310
  /**
@@ -376,6 +382,26 @@ function validDate(value) {
376
382
  return value instanceof Date && !Number.isNaN(value.getTime()) ? new Date(value.getTime()) : null;
377
383
  }
378
384
 
385
+ /**
386
+ * Keeps a date inside the bounds by local calendar day, as the calendar does: a date on a day
387
+ * outside them moves to the nearest bound's day and keeps its time of day. Mutates `date`.
388
+ * @param {Date} date Date to clamp.
389
+ * @param {Date|null} min Earliest allowed day.
390
+ * @param {Date|null} max Latest allowed day.
391
+ * @returns {Date}
392
+ */
393
+ function clampDay(date, min, max) {
394
+ const day = startOfDay(date);
395
+ const bound = min && day < startOfDay(min) ? min : max && day > startOfDay(max) ? max : null;
396
+ if (bound) date.setFullYear(bound.getFullYear(), bound.getMonth(), bound.getDate());
397
+ return date;
398
+ }
399
+
400
+ /** @param {Date} date @returns {number} */
401
+ function startOfDay(date) {
402
+ return new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime();
403
+ }
404
+
379
405
  /**
380
406
  * Resolves the two formats a Datebox works with: `format`, which the reader types and the field
381
407
  * shows while focused, and `display`, which the field shows at rest. A missing format is
@@ -35,6 +35,12 @@
35
35
  padding-inline: 0;
36
36
  }
37
37
 
38
+ /* `closable: false` (a sheet's `closeButton: false`) switches the header button off; the button's
39
+ own display rule must not show it. */
40
+ .zx-dialog .zx-dialog__close[hidden] {
41
+ display: none;
42
+ }
43
+
38
44
  .zx-dialog__body {
39
45
  min-block-size: 0;
40
46
  overflow: auto;
@@ -1,6 +1,7 @@
1
1
  import { h } from '../../core/dom.js';
2
2
  import { ICON_SIZE, icon } from '../../core/icons.js';
3
3
  import { uid } from '../../core/util.js';
4
+ import { appendContent, replaceContent } from '../../internal/overlay-content.js';
4
5
  import { Modal } from '../modal/modal.js';
5
6
  import { button } from '../button/button.js';
6
7
 
@@ -19,12 +20,12 @@ import { button } from '../button/button.js';
19
20
  * @property {string} [title=''] Dialog title.
20
21
  * @property {'sm'|'md'|'lg'|number} [size='md'] Preset or pixel width.
21
22
  * @property {DialogButton[]} [buttons=[]] Footer buttons.
22
- * @property {boolean} [closable=true] Whether Escape and the header button may close the dialog.
23
+ * @property {boolean} [closable=true] Whether Escape and the header button may close the dialog. When false the header button is not rendered as a control at all: it is not displayed, not focusable, and closes nothing.
23
24
  * @property {Node|string|number|{toElement: () => Node|null}|null} [content=null] Body content.
24
25
  * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
25
26
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
26
27
  * @property {(event: CustomEvent<{result: unknown}>) => void} [onclose] Close event listener.
27
- * @property {(event: CustomEvent<Record<string, never>>) => void} [oncancel] Cancel event listener.
28
+ * @property {(event: CustomEvent<import('../modal/modal.js').ModalCancelDetail>) => void} [oncancel] Cancel event listener.
28
29
  */
29
30
  /**
30
31
  * @typedef {Object} DialogViewOptions
@@ -105,9 +106,13 @@ export class Dialog extends Modal {
105
106
  this.#applyTitle(this.#baseTitle);
106
107
  this.#baseButtons = normalizeDialogButtons(this.options.buttons);
107
108
  this.#renderButtons(this.#baseButtons);
108
- this.refs.close.hidden = !this.options.closable;
109
+ this.refs.close.hidden = !this._hasCloseButton();
109
110
 
110
- this.listen(this.refs.close, 'click', () => this.close());
111
+ this.listen(this.refs.close, 'click', () => {
112
+ // Switched off, the button is not displayed; a click dispatched at it all the same — by a
113
+ // script, or by a stylesheet that shows it again — must not close what was made unclosable.
114
+ if (this._hasCloseButton()) this._requestDismiss('close-button');
115
+ });
111
116
  this.listen(this.refs.footer, 'click', (event) => {
112
117
  const button = event.target.closest?.('[data-dialog-button]');
113
118
  if (!button || !this.refs.footer.contains(button)) return;
@@ -416,6 +421,20 @@ export class Dialog extends Modal {
416
421
  });
417
422
  }
418
423
 
424
+ /**
425
+ * Whether the header close button is offered. Switched off, it is not displayed, not focusable,
426
+ * and does not dismiss the dialog. A dialog shows it while it is `closable`; a subclass with a
427
+ * setting of its own for the button overrides this.
428
+ *
429
+ * Called from the constructor before any subclass field initializers have run, so an override
430
+ * may read `this.options` but no instance state.
431
+ * @returns {boolean}
432
+ * @protected
433
+ */
434
+ _hasCloseButton() {
435
+ return Boolean(this.options.closable);
436
+ }
437
+
419
438
  /**
420
439
  * Applies the dialog width. Subclasses that size themselves on a different axis override this.
421
440
  *
@@ -473,8 +492,7 @@ export class Dialog extends Modal {
473
492
  if (action === 'close') {
474
493
  this.close();
475
494
  } else if (action === 'cancel') {
476
- const event = this.emit('cancel');
477
- if (!event.defaultPrevented) this.close();
495
+ this._requestDismiss('button');
478
496
  } else if (typeof action === 'function') {
479
497
  action(this);
480
498
  }
@@ -534,30 +552,3 @@ export function normalizeDialogButtons(list) {
534
552
  };
535
553
  });
536
554
  }
537
-
538
- /**
539
- * @param {Element} target
540
- * @param {Node|string|number|{toElement: () => Node|null}|null|undefined} content
541
- * @returns {void}
542
- */
543
- function replaceContent(target, content) {
544
- target.replaceChildren();
545
- appendContent(target, content);
546
- }
547
-
548
- /**
549
- * @param {Element} target
550
- * @param {Node|string|number|{toElement: () => Node|null}|null|undefined} content
551
- * @returns {void}
552
- */
553
- function appendContent(target, content) {
554
- if (content == null) return;
555
- if (typeof content === 'string' || typeof content === 'number') {
556
- target.append(document.createTextNode(String(content)));
557
- } else if (typeof content.toElement === 'function') {
558
- const element = content.toElement();
559
- if (element) target.append(element);
560
- } else if (typeof content.nodeType === 'number') {
561
- target.append(content);
562
- }
563
- }
@@ -4,6 +4,7 @@ import { connectedOverlayHost, openDialogOf, overlayHost, overlayScope } from '.
4
4
  import { pushOverlay } from '../../core/overlay-stack.js';
5
5
  import { position } from '../../core/position.js';
6
6
  import { uid } from '../../core/util.js';
7
+ import { replaceContent } from '../../internal/overlay-content.js';
7
8
 
8
9
  /** What Tab may land on inside a panel: the controls a reader reaches in sequence. */
9
10
  const TABBABLE_SELECTOR = [
@@ -305,24 +306,6 @@ export class Dropdown extends Component {
305
306
  * @type {CustomEvent<Record<string, never>>}
306
307
  */
307
308
 
308
- /**
309
- * @param {Element} target
310
- * @param {Node|string|number|{toElement: () => Node|null}|null|undefined} content
311
- * @returns {void}
312
- */
313
- function replaceContent(target, content) {
314
- target.replaceChildren();
315
- if (content == null) return;
316
- if (typeof content === 'string' || typeof content === 'number') {
317
- target.append(document.createTextNode(String(content)));
318
- } else if (typeof content.toElement === 'function') {
319
- const element = content.toElement();
320
- if (element) target.append(element);
321
- } else if (typeof content.nodeType === 'number') {
322
- target.append(content);
323
- }
324
- }
325
-
326
309
  /**
327
310
  * The controls inside a container Tab would visit, in document order.
328
311
  * @param {Element} container