@zeyos/zx 5.6.0 → 5.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/CHANGELOG.md +188 -0
  2. package/README.md +73 -7
  3. package/bin/zx-css.js +328 -0
  4. package/dist/types/components/account-menu/account-menu.d.ts +4 -2
  5. package/dist/types/components/activity-list/activity-list.d.ts +14 -8
  6. package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
  7. package/dist/types/components/agent-thread/agent-thread.d.ts +142 -14
  8. package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
  9. package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
  10. package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
  11. package/dist/types/components/calendar/calendar-model.d.ts +9 -2
  12. package/dist/types/components/calendar/calendar.d.ts +12 -4
  13. package/dist/types/components/chart/chart.d.ts +25 -13
  14. package/dist/types/components/checklist/checklist.d.ts +29 -0
  15. package/dist/types/components/code-editor/code-editor.d.ts +7 -2
  16. package/dist/types/components/composer/composer.d.ts +206 -4
  17. package/dist/types/components/composer/queue.d.ts +76 -0
  18. package/dist/types/components/copy/copy-button.d.ts +6 -4
  19. package/dist/types/components/copy/copy-input.d.ts +10 -6
  20. package/dist/types/components/datebox/date-range-box.d.ts +33 -0
  21. package/dist/types/components/datebox/placeholder.d.ts +7 -0
  22. package/dist/types/components/dialog/dialog.d.ts +2 -2
  23. package/dist/types/components/dock/dock.d.ts +12 -3
  24. package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
  25. package/dist/types/components/field-upload/field-upload.d.ts +3 -2
  26. package/dist/types/components/file-item/file-item.d.ts +3 -2
  27. package/dist/types/components/file-list/file-list.d.ts +14 -8
  28. package/dist/types/components/filter/filter-model.d.ts +31 -1
  29. package/dist/types/components/filter/filter.d.ts +20 -2
  30. package/dist/types/components/finder/finder.d.ts +14 -6
  31. package/dist/types/components/flag/flag.d.ts +99 -0
  32. package/dist/types/components/grid/grid.d.ts +1 -1
  33. package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
  34. package/dist/types/components/launcher/launcher.d.ts +2 -0
  35. package/dist/types/components/modal/modal.d.ts +34 -8
  36. package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
  37. package/dist/types/components/number-field/number-field.d.ts +41 -7
  38. package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
  39. package/dist/types/components/prose/prose.d.ts +9 -6
  40. package/dist/types/components/questionnaire/conditions.d.ts +270 -0
  41. package/dist/types/components/questionnaire/items.d.ts +52 -30
  42. package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
  43. package/dist/types/components/rating/rating.d.ts +5 -3
  44. package/dist/types/components/select/country.d.ts +106 -0
  45. package/dist/types/components/select/field-adapter.d.ts +2 -1
  46. package/dist/types/components/select/locale.d.ts +102 -0
  47. package/dist/types/components/select/select.d.ts +41 -2
  48. package/dist/types/components/sheet/sheet.d.ts +2 -2
  49. package/dist/types/components/slider/slider.d.ts +1 -0
  50. package/dist/types/components/sort-control/sort-control.d.ts +7 -3
  51. package/dist/types/components/source-list/source-list.d.ts +7 -5
  52. package/dist/types/components/split-view/split-view.d.ts +5 -3
  53. package/dist/types/components/surface/catalog.d.ts +260 -0
  54. package/dist/types/components/surface/elicit.d.ts +81 -0
  55. package/dist/types/components/surface/mcp.d.ts +165 -0
  56. package/dist/types/components/surface/schema.d.ts +314 -0
  57. package/dist/types/components/surface/stream.d.ts +118 -0
  58. package/dist/types/components/surface/surface.d.ts +718 -0
  59. package/dist/types/components/surface/text.d.ts +277 -0
  60. package/dist/types/components/surface/validate.d.ts +339 -0
  61. package/dist/types/components/table/table.d.ts +55 -3
  62. package/dist/types/components/table/window.d.ts +203 -0
  63. package/dist/types/components/toolbar/toolbar.d.ts +10 -6
  64. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  65. package/dist/types/components/tree/tree.d.ts +20 -13
  66. package/dist/types/core/component.d.ts +10 -0
  67. package/dist/types/core/date.d.ts +8 -1
  68. package/dist/types/core/dom.d.ts +15 -0
  69. package/dist/types/core/http.d.ts +10 -0
  70. package/dist/types/core/i18n.d.ts +38 -0
  71. package/dist/types/core/messages.d.ts +344 -1
  72. package/dist/types/core/storage.d.ts +7 -2
  73. package/dist/types/elements/define.d.ts +21 -46
  74. package/dist/types/elements/definitions.d.ts +147 -0
  75. package/dist/types/elements/kit.d.ts +7 -0
  76. package/dist/types/elements/reflect.d.ts +6 -3
  77. package/dist/types/index.d.ts +10 -1
  78. package/dist/types/internal/date-locale.d.ts +7 -0
  79. package/dist/types/internal/json-patch.d.ts +146 -0
  80. package/dist/types/locales/de.d.ts +13 -0
  81. package/dist/types/locales/en.d.ts +2 -0
  82. package/dist/types/locales/index.d.ts +823 -0
  83. package/dist/types/zeyos/view.d.ts +8 -1
  84. package/dist/zx-zeyos.esm.js +16852 -15131
  85. package/dist/zx-zeyos.esm.min.js +5 -5
  86. package/dist/zx.core.css +1276 -0
  87. package/dist/zx.core.min.css +1 -0
  88. package/dist/zx.css +520 -143
  89. package/dist/zx.esm.js +40940 -29684
  90. package/dist/zx.esm.min.js +36 -23
  91. package/dist/zx.global.js +40940 -29684
  92. package/dist/zx.global.min.js +36 -23
  93. package/dist/zx.layered.css +17315 -0
  94. package/dist/zx.layered.min.css +1 -0
  95. package/dist/zx.min.css +1 -1
  96. package/docs/agent-catalog.json +12501 -0
  97. package/docs/agent-surfaces.md +340 -0
  98. package/docs/api.json +909 -137
  99. package/docs/llms.md +1046 -80
  100. package/docs/llms.txt +30 -9
  101. package/package.json +29 -6
  102. package/src/components/account-menu/account-menu.js +6 -3
  103. package/src/components/activity-item/activity-item.js +2 -1
  104. package/src/components/activity-list/activity-list.js +16 -10
  105. package/src/components/agent-thread/ag-ui.js +1439 -0
  106. package/src/components/agent-thread/agent-thread.js +359 -54
  107. package/src/components/agent-thread/ui-message-stream.js +1281 -0
  108. package/src/components/app-sidebar/app-sidebar.js +18 -8
  109. package/src/components/approval-card/approval-card.js +3 -2
  110. package/src/components/block-view/block-view.js +7 -6
  111. package/src/components/breadcrumb/breadcrumb.js +8 -5
  112. package/src/components/button/button.css +24 -11
  113. package/src/components/calendar/calendar-model.js +8 -2
  114. package/src/components/calendar/calendar.js +53 -18
  115. package/src/components/chart/chart.js +54 -23
  116. package/src/components/checklist/checklist.css +9 -1
  117. package/src/components/checklist/checklist.js +59 -3
  118. package/src/components/checklist/field-adapter.js +2 -11
  119. package/src/components/code-editor/code-editor.js +45 -8
  120. package/src/components/code-editor/field-adapter.js +1 -1
  121. package/src/components/composer/composer.css +80 -1
  122. package/src/components/composer/composer.js +390 -16
  123. package/src/components/composer/queue.js +78 -0
  124. package/src/components/context-menu/context-menu.js +12 -1
  125. package/src/components/copy/copy-button.js +9 -7
  126. package/src/components/copy/copy-input.js +10 -6
  127. package/src/components/date-picker/date-picker.js +2 -1
  128. package/src/components/date-picker/date-range-picker.js +8 -7
  129. package/src/components/datebox/date-range-box.js +3 -9
  130. package/src/components/datebox/datebox.js +18 -21
  131. package/src/components/datebox/placeholder.js +18 -0
  132. package/src/components/dialog/dialog.js +4 -5
  133. package/src/components/dock/dock.js +34 -13
  134. package/src/components/entity-ref/entity-ref.js +16 -5
  135. package/src/components/field-upload/field-upload.js +81 -38
  136. package/src/components/file-item/file-item.js +70 -40
  137. package/src/components/file-list/file-list.js +15 -9
  138. package/src/components/filter/filter-model.js +46 -8
  139. package/src/components/filter/filter.css +3 -3
  140. package/src/components/filter/filter.js +29 -10
  141. package/src/components/filter-panel/filter-panel.js +13 -5
  142. package/src/components/finder/finder.js +50 -26
  143. package/src/components/flag/flag.css +40 -0
  144. package/src/components/flag/flag.js +177 -0
  145. package/src/components/form/form.js +1 -1
  146. package/src/components/grid/grid.js +22 -8
  147. package/src/components/kanban-view/kanban-view.js +51 -81
  148. package/src/components/launcher/launcher.js +17 -2
  149. package/src/components/list-toolbar/list-toolbar.js +2 -1
  150. package/src/components/master-panel/master-panel.js +1 -1
  151. package/src/components/menu-button/menu-button.js +4 -0
  152. package/src/components/message/message.js +3 -0
  153. package/src/components/modal/modal.js +62 -8
  154. package/src/components/multi-value-editor/multi-value-editor.js +10 -9
  155. package/src/components/navigation-bar/navigation-bar.js +3 -3
  156. package/src/components/number-field/number-field.js +98 -29
  157. package/src/components/prompt-starters/prompt-starters.css +91 -0
  158. package/src/components/prompt-starters/prompt-starters.js +206 -0
  159. package/src/components/prose/prose.js +14 -10
  160. package/src/components/questionnaire/conditions.js +666 -0
  161. package/src/components/questionnaire/items.js +150 -41
  162. package/src/components/questionnaire/questionnaire.js +126 -32
  163. package/src/components/rating/rating.js +5 -4
  164. package/src/components/run-status/run-status.js +2 -2
  165. package/src/components/select/country.js +136 -0
  166. package/src/components/select/field-adapter.js +7 -2
  167. package/src/components/select/locale.js +219 -0
  168. package/src/components/select/select.css +20 -22
  169. package/src/components/select/select.js +94 -12
  170. package/src/components/sheet/sheet-stack.js +10 -1
  171. package/src/components/sheet/sheet.js +12 -5
  172. package/src/components/slider/slider.js +7 -2
  173. package/src/components/sort-control/sort-control.js +15 -5
  174. package/src/components/source-list/source-list.js +7 -4
  175. package/src/components/split-view/split-view.js +5 -3
  176. package/src/components/surface/catalog.js +1334 -0
  177. package/src/components/surface/elicit.js +107 -0
  178. package/src/components/surface/mcp.js +243 -0
  179. package/src/components/surface/schema.js +644 -0
  180. package/src/components/surface/stream.js +245 -0
  181. package/src/components/surface/surface.css +308 -0
  182. package/src/components/surface/surface.js +2291 -0
  183. package/src/components/surface/text.js +513 -0
  184. package/src/components/surface/validate.js +2218 -0
  185. package/src/components/tabbox/tabbox.js +9 -0
  186. package/src/components/table/table.css +63 -3
  187. package/src/components/table/table.js +167 -28
  188. package/src/components/table/window.js +317 -0
  189. package/src/components/toolbar/toolbar.js +12 -7
  190. package/src/components/tooltip/tooltip.css +2 -3
  191. package/src/components/tooltip/tooltip.js +32 -5
  192. package/src/components/tree/tree.js +53 -23
  193. package/src/core/component.js +25 -1
  194. package/src/core/date.js +62 -16
  195. package/src/core/dom.js +67 -4
  196. package/src/core/format.js +15 -13
  197. package/src/core/http.js +29 -20
  198. package/src/core/i18n.js +83 -10
  199. package/src/core/icons.js +13 -2
  200. package/src/core/keyboard.js +79 -8
  201. package/src/core/messages.js +376 -2
  202. package/src/core/overlay-host.js +1 -0
  203. package/src/core/position.js +3 -2
  204. package/src/core/storage.js +59 -6
  205. package/src/elements/define.js +178 -130
  206. package/src/elements/definitions.js +229 -0
  207. package/src/elements/kit.js +444 -0
  208. package/src/elements/reflect.js +8 -3
  209. package/src/index.js +10 -1
  210. package/src/internal/date-locale.js +11 -0
  211. package/src/internal/json-patch.js +405 -0
  212. package/src/locales/de.js +911 -0
  213. package/src/locales/en.js +2 -0
  214. package/src/locales/index.js +7 -0
  215. package/src/zeyos/calendar.js +2 -1
  216. package/src/zeyos/form.js +2 -1
  217. package/src/zeyos/launcher.js +7 -6
  218. package/src/zeyos/module-bar.js +2 -1
  219. package/src/zeyos/schema.js +37 -23
  220. package/src/zeyos/select.js +4 -3
  221. package/src/zeyos/table.js +2 -13
  222. package/src/zeyos/view.js +57 -17
  223. package/styles/core.css +11 -0
  224. package/styles/tokens/semantic.css +1 -0
  225. package/styles/zeyos.css +2 -0
  226. package/styles/zx.css +4 -8
  227. package/styles/zx.layered.css +1 -0
@@ -6,6 +6,9 @@ import { position } from '../../core/position.js';
6
6
  import { uid } from '../../core/util.js';
7
7
  import { itemColor } from './color.js';
8
8
  import { matchItems } from './filter.js';
9
+ import { canonicalLocale, localeItems, localeSelectOptions } from './locale.js';
10
+ import { countryItems, countrySelectOptions } from './country.js';
11
+ import { normalizeRegion } from '../flag/flag.js';
9
12
  import {
10
13
  DEFAULT_STATUSES, STATUS_INDICATORS, STATUS_TONES, normalizePriorityLevel, priorityIcon, statusIcon
11
14
  } from './glyphs.js';
@@ -50,7 +53,8 @@ import {
50
53
  /**
51
54
  * @typedef {Object} EntitySelectOptions
52
55
  * @property {SelectItem[]} [recent=[]] Choices pinned above ordinary results.
53
- * @property {string} [recentLabel='Recent'] Heading above recent choices.
56
+ * @property {string|null} [recentLabel] Heading above recent choices, by default the `select.recent`
57
+ * message ("Recent"); null shows none.
54
58
  * @property {boolean|SelectAction} [create=false] Optional create command at the bottom.
55
59
  * @property {string|((item: SelectItem)=>unknown)} [iconKey='icon'] Item icon reader.
56
60
  * @property {string|((item: SelectItem)=>unknown)} [colorKey='color'] Optional icon colour reader: a CSS
@@ -66,6 +70,9 @@ import {
66
70
  /** @typedef {{item: SelectItem|null, clear: boolean, action: SelectAction|null, element: HTMLElement}} SelectOptionEntry */
67
71
  /** @typedef {{silent?: boolean}} SelectSetOptions */
68
72
 
73
+ // Internal factory configuration; ordinary Select instances keep their IDs unchanged.
74
+ const NORMALIZE_VALUE = Symbol('normalizeSelectValue');
75
+
69
76
  const PRIORITY_KEYS = [
70
77
  'priority.lowest',
71
78
  'priority.low',
@@ -120,6 +127,8 @@ export class Select extends Component {
120
127
  // Instance state initialized here because render() runs inside the base
121
128
  // constructor, before class-field initializers would run (and clobber it).
122
129
  this._items = []; this._visibleItems = []; this._fixedItems = []; this._visibleFixed = []; this._actions = []; this._selected = null; this._optionEntries = []; this._activeIndex = -1; this._open = false; this._disabled = false; this._loading = false; this._requestSequence = 0; this._queryTimer = null; this._position = null; this._createdRoot = false; this._root = null; this._snapshot = null; this._pointerModality = false;
130
+ /** @private @type {(value: string) => string} */
131
+ this._normalizeValue = this.options[NORMALIZE_VALUE] ?? ((value) => value);
123
132
  this._createdRoot = this.el === null;
124
133
  const root = /** @type {HTMLElement} */ (this.el ?? h('div'));
125
134
  this.el = root;
@@ -132,7 +141,7 @@ export class Select extends Component {
132
141
  class: 'zx-select__input',
133
142
  type: 'text',
134
143
  role: 'combobox',
135
- ariaLabel: String(this.options.label || this.options.placeholder || 'Select'),
144
+ ariaLabel: String(this.options.label || this.options.placeholder || this._message('select.label', 'Select')),
136
145
  autocomplete: 'off',
137
146
  spellcheck: false,
138
147
  ariaExpanded: 'false',
@@ -274,7 +283,8 @@ export class Select extends Component {
274
283
  */
275
284
  set(idOrItem, { silent = false } = {}) {
276
285
  const previousValue = this.value;
277
- const item = idOrItem == null ? null : this._findItem(idOrItem);
286
+ const candidate = typeof idOrItem === 'string' ? this._normalizeValue(idOrItem) : idOrItem;
287
+ const item = candidate == null ? null : this._findItem(candidate);
278
288
  this._selected = item;
279
289
  this._syncInputValue();
280
290
  this._renderOptions();
@@ -292,6 +302,8 @@ export class Select extends Component {
292
302
  */
293
303
  setItems(items) {
294
304
  const selectedValue = this.value;
305
+ this._cancelQuery();
306
+ this._setLoading(false);
295
307
  this._items = Array.isArray(items) ? items.slice() : [];
296
308
  this._visibleItems = this._items.slice();
297
309
  this._selected = selectedValue == null ? null : this._findItem(selectedValue);
@@ -337,6 +349,11 @@ export class Select extends Component {
337
349
 
338
350
  /** Opens the option panel. @returns {this} @fires Select#open */
339
351
  open() {
352
+ return this._openPanel(true);
353
+ }
354
+
355
+ /** @param {boolean} selectText Whether to select the existing label. @returns {this} */
356
+ _openPanel(selectText) {
340
357
  if (this._disabled || this._open) return this;
341
358
  this._open = true;
342
359
  this.el.setAttribute('data-state', 'open');
@@ -351,7 +368,7 @@ export class Select extends Component {
351
368
  // is a no-op while the panel is still hidden.
352
369
  this._setActive(this._selectedEntryIndex());
353
370
  if (this._activeIndex < 0 && this._optionEntries.length > 0) this._setActive(0);
354
- if (this.options.filter && this._selected !== null) {
371
+ if (selectText && this.options.filter && this._selected !== null) {
355
372
  /** @type {HTMLInputElement} */ (this.refs.input).select();
356
373
  }
357
374
  if (typeof this.options.filter === 'function') this._scheduleAsyncQuery('');
@@ -399,6 +416,60 @@ export class Select extends Component {
399
416
  return this;
400
417
  }
401
418
 
419
+ /**
420
+ * Creates a locale Select with native/localized names, pinned choices, and optional flags.
421
+ * Values are canonical BCP 47 tags; initial values and `set()` accept underscores and any case.
422
+ * @param {Element|string|null} target Component target.
423
+ * @param {import('./locale.js').LocaleSelectOptions & SelectOptions} [options={}] Locale options
424
+ * and Select overrides other than items, readers, and renderers.
425
+ * @returns {Select}
426
+ */
427
+ static locale(target, options = {}) {
428
+ const select = new Select(target, {
429
+ ...localeSelectOptions(options),
430
+ [NORMALIZE_VALUE]: (value) => canonicalLocale(value) ?? value
431
+ });
432
+ select.el.setAttribute('data-preset', 'locale');
433
+ return select;
434
+ }
435
+
436
+ /**
437
+ * Builds locale items without the DOM, for lists and summaries using the same names.
438
+ * @param {Array<string|import('./locale.js').LocaleItem>} locales Locale tags or specifications.
439
+ * @param {Pick<import('./locale.js').LocaleSelectOptions, 'displayLocale'|'display'|'flagRegions'|'sort'>} [options={}] Naming options.
440
+ * @returns {ReturnType<typeof localeItems>}
441
+ */
442
+ static localeItems(locales, options = {}) {
443
+ return localeItems(locales, options);
444
+ }
445
+
446
+ /**
447
+ * Creates a country Select with localized names, pinned choices, and optional flags. Search
448
+ * includes the English name, ISO code, and descriptions; initial values and `set()` accept either case.
449
+ * @param {Element|string|null} target Component target.
450
+ * @param {import('./country.js').CountrySelectOptions & SelectOptions} [options={}] Country options
451
+ * and Select overrides other than items, readers, and renderers.
452
+ * @returns {Select}
453
+ */
454
+ static country(target, options = {}) {
455
+ const select = new Select(target, {
456
+ ...countrySelectOptions(options),
457
+ [NORMALIZE_VALUE]: (value) => normalizeRegion(value) ?? value
458
+ });
459
+ select.el.setAttribute('data-preset', 'country');
460
+ return select;
461
+ }
462
+
463
+ /**
464
+ * Builds country items without the DOM, defaulting to the ISO country catalogue.
465
+ * @param {Array<string|import('./country.js').CountryItem>} [countries] Country codes or specifications.
466
+ * @param {Pick<import('./country.js').CountrySelectOptions, 'displayLocale'|'showCode'|'sort'>} [options={}] Naming options.
467
+ * @returns {ReturnType<typeof countryItems>}
468
+ */
469
+ static countryItems(countries, options = {}) {
470
+ return countryItems(countries, options);
471
+ }
472
+
402
473
  /**
403
474
  * Creates the five-level priority preset: values 0 (lowest) to 4 (highest), each drawn as grey
404
475
  * signal bars filled to its level, except the highest, which is the one coloured level — a
@@ -480,8 +551,8 @@ export class Select extends Component {
480
551
  */
481
552
  static entity(target, options = {}) {
482
553
  const {
483
- recent = [], recentLabel = 'Recent', create = false, iconKey = 'icon', colorKey = 'color',
484
- subtitleKey = 'description', renderIcon = null,
554
+ recent = [], recentLabel = message('select.recent', options), create = false, iconKey = 'icon',
555
+ colorKey = 'color', subtitleKey = 'description', renderIcon = null,
485
556
  fixedItems = [], actions = [], renderItem = null, renderValueAdornment = null,
486
557
  ...rest
487
558
  } = options;
@@ -497,7 +568,7 @@ export class Select extends Component {
497
568
  ariaHidden: 'true'
498
569
  }, icon(value, { size: 14 }));
499
570
  };
500
- const createAction = create ? normalizeEntityCreateAction(create) : null;
571
+ const createAction = create ? normalizeEntityCreateAction(create, options) : null;
501
572
  const select = new Select(target, {
502
573
  ...rest,
503
574
  fixedItems: [...(Array.isArray(recent) ? recent : []), ...(Array.isArray(fixedItems) ? fixedItems : [])],
@@ -627,7 +698,7 @@ export class Select extends Component {
627
698
  if (!this.options.filter) return;
628
699
  const query = /** @type {HTMLInputElement} */ (this.refs.input).value;
629
700
  this._syncValueAdornment();
630
- if (!this._open) this.open();
701
+ if (!this._open) this._openPanel(false);
631
702
  if (this.options.filter === 'local') {
632
703
  this._visibleFixed = this._matchFixed(query);
633
704
  this._visibleItems = matchItems(this._items, query, this._searchKeys());
@@ -985,12 +1056,23 @@ function readSelectItem(item, reader) {
985
1056
  return null;
986
1057
  }
987
1058
 
988
- /** @param {boolean|SelectAction} value @returns {SelectAction} */
989
- function normalizeEntityCreateAction(value) {
1059
+ /**
1060
+ * Resolves a message for a preset, which hands text to the constructor before an instance exists.
1061
+ * `msg()` reads the `msg` option off whatever object borrows it, so the preset's own option counts.
1062
+ * @param {string} key Message key.
1063
+ * @param {SelectOptions} options Options the preset was given.
1064
+ * @returns {string}
1065
+ */
1066
+ function message(key, options) {
1067
+ return Component.prototype.msg.call({ options }, key);
1068
+ }
1069
+
1070
+ /** @param {boolean|SelectAction} value @param {SelectOptions} options @returns {SelectAction} */
1071
+ function normalizeEntityCreateAction(value, options) {
990
1072
  const descriptor = value === true ? {} : value;
991
1073
  return {
992
- id: descriptor.id ?? 'create', label: descriptor.label ?? 'Create new…',
993
- description: descriptor.description, group: descriptor.group ?? 'New',
1074
+ id: descriptor.id ?? 'create', label: descriptor.label ?? message('select.create', options),
1075
+ description: descriptor.description, group: descriptor.group ?? message('select.createGroup', options),
994
1076
  icon: descriptor.icon ?? 'plus', invoke: descriptor.invoke
995
1077
  };
996
1078
  }
@@ -79,7 +79,15 @@ export class SheetStack extends EventTarget {
79
79
  this.#closers.set(sheet, onClose);
80
80
  sheet.on('close', onClose);
81
81
  }
82
+ // Clear the former covered state before presenting: an inert dialog cannot take focus.
83
+ this.#sync();
82
84
  if (!sheet.isOpen()) sheet.open();
85
+ else {
86
+ // Native top-layer order follows presentation order. Rehosting uses Modal's generation
87
+ // guard so its queued close is not a stack pop or a new user-visible lifecycle.
88
+ sheet._rehost();
89
+ sheet._focusInitial();
90
+ }
83
91
  this.#sync();
84
92
  this.#emit('push', { sheet, depth: 0 });
85
93
  return this;
@@ -97,8 +105,9 @@ export class SheetStack extends EventTarget {
97
105
  pop() {
98
106
  const sheet = this.top();
99
107
  if (!sheet) return null;
100
- this.#remove(sheet);
108
+ // Dismiss this presentation before pop listeners can re-push and open a new one.
101
109
  sheet.close();
110
+ this.#remove(sheet);
102
111
  return sheet;
103
112
  }
104
113
 
@@ -48,7 +48,7 @@ const GROW_SIGN = Object.freeze({ start: 1, end: -1, top: 1, bottom: -1 });
48
48
  * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns a floating sheet; defaults to the opener.
49
49
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
50
50
  * @property {(event: CustomEvent<{result: unknown}>) => void} [onclose] Close event listener.
51
- * @property {(event: CustomEvent<Record<string, never>>) => void} [oncancel] Cancel event listener.
51
+ * @property {(event: CustomEvent<import('../modal/modal.js').ModalCancelDetail>) => void} [oncancel] Cancel event listener.
52
52
  * @property {(event: CustomEvent<{size: number, ratio: number}>) => void} [onresize] Resize listener.
53
53
  * @property {(event: CustomEvent<{docked: boolean, dock: import('../dock/dock.js').Dock|null}>) => void} [ondockchange] Dock-state listener.
54
54
  */
@@ -213,8 +213,10 @@ export class Sheet extends Dialog {
213
213
  return;
214
214
  }
215
215
  if (this.options.closable && next < min / 2) {
216
+ // Restored first, so a prevented dismissal leaves the sheet at the size it had.
216
217
  this._applySize(this.#dragStart);
217
- this.close();
218
+ this.#syncHandleAria();
219
+ this._requestDismiss('drag');
218
220
  return;
219
221
  }
220
222
  const detents = this.#detents(total);
@@ -386,11 +388,16 @@ export class Sheet extends Dialog {
386
388
  ...entry,
387
389
  // An Escape pressed outside the sheet and everything it opened is not addressed to it.
388
390
  onEscape: (event) => {
389
- if (!this.options.closable || !this._overlayContains(/** @type {Node|null} */ (event.target))) return false;
390
- if (!this.emit('cancel').defaultPrevented) this.close();
391
+ if (!this._overlayContains(/** @type {Node|null} */ (event.target))) return false;
392
+ // Refused, but still reported — and the key stays free for whatever is underneath.
393
+ if (!this.options.closable) {
394
+ this.emit('cancel', { reason: 'escape' });
395
+ return false;
396
+ }
397
+ this._requestDismiss('escape');
391
398
  return undefined;
392
399
  },
393
- onOutsidePointer: this.options.lightDismiss ? () => { this.close(); } : undefined,
400
+ onOutsidePointer: this.options.lightDismiss ? () => { this._requestDismiss('outside'); } : undefined,
394
401
  // Hosted inside a modal that has now closed, the sheet would stay open but never be seen.
395
402
  onParentClose: () => {
396
403
  const holder = this.el.parentElement?.closest('dialog');
@@ -160,6 +160,7 @@ export class Slider extends Component {
160
160
  const value = this._snap(next);
161
161
  const changed = value !== this._value;
162
162
  this._value = value;
163
+ this._committedValue = value;
163
164
  this._paint();
164
165
  if (changed && !silent) this.emit('change', { value });
165
166
  return this;
@@ -246,7 +247,7 @@ export class Slider extends Component {
246
247
  step: String(this._step),
247
248
  disabled: Boolean(this.options.disabled),
248
249
  readOnly: this._readonly,
249
- ariaLabel: String(this.options.label ?? 'Value')
250
+ ariaLabel: String(this.options.label ?? this.msg('slider.value'))
250
251
  }));
251
252
  this.listen(number, 'input', () => {
252
253
  if (this._readonly) return;
@@ -263,7 +264,10 @@ export class Slider extends Component {
263
264
  number.value = String(this._value);
264
265
  return;
265
266
  }
266
- this.set(number.value === '' ? this._min : Number(number.value));
267
+ const value = this._snap(number.value === '' ? this._min : Number(number.value));
268
+ const changed = value !== this._committedValue;
269
+ this.set(value, { silent: true });
270
+ if (changed) this.emit('change', { value });
267
271
  });
268
272
  return number;
269
273
  }
@@ -303,6 +307,7 @@ export class Slider extends Component {
303
307
  this.refs.input.value = String(this._value);
304
308
  return;
305
309
  }
310
+ this._committedValue = this._value;
306
311
  this.emit('change', { value: this._value });
307
312
  }
308
313
 
@@ -10,7 +10,8 @@ import { Select } from '../select/select.js';
10
10
  * @typedef {Object} SortControlOptions
11
11
  * @property {SortField[]} [fields=[]] Available sort fields, in display order.
12
12
  * @property {SortValue|null} [value=null] Initial sort; null chooses the first field ascending.
13
- * @property {string} [label='Sort by'] Accessible field label and direction-name prefix.
13
+ * @property {string|null} [label] Accessible field label and direction-name prefix, by default the
14
+ * `sortControl.label` message ("Sort by"). Null gives neither.
14
15
  * @property {{asc?:string,desc?:string}} [labels={}] Current/next direction labels, defaulting to Ascending/Descending.
15
16
  * @property {boolean} [disabled=false] Whether interaction is disabled.
16
17
  * @property {(event:CustomEvent<{value:SortValue}>)=>void} [onchange] Atomic field/direction change.
@@ -24,7 +25,7 @@ import { Select } from '../select/select.js';
24
25
  export class SortControl extends Component {
25
26
  static cssName = 'sort-control';
26
27
  /** @type {SortControlOptions} */
27
- static defaults = { fields: [], value: null, label: 'Sort by', labels: {}, disabled: false };
28
+ static defaults = { fields: [], value: null, label: undefined, labels: {}, disabled: false };
28
29
 
29
30
  /** @returns {HTMLElement} */
30
31
  render() {
@@ -42,7 +43,7 @@ export class SortControl extends Component {
42
43
  });
43
44
  this._select = new Select(null, {
44
45
  items: sortChoices(this.options.fields), valueKey: 'id', labelKey: 'label',
45
- value: this._value?.id ?? null, label: this.options.label,
46
+ value: this._value?.id ?? null, label: this._label(),
46
47
  filter: 'local', disabled: this._disabled,
47
48
  onchange: ({ detail }) => {
48
49
  if (!detail.item) return;
@@ -94,13 +95,22 @@ export class SortControl extends Component {
94
95
  _syncDirection() {
95
96
  const dir = this._value?.dir ?? 'asc';
96
97
  const next = dir === 'asc' ? 'desc' : 'asc';
97
- const labels = { asc: 'Ascending', desc: 'Descending', ...this.options.labels };
98
+ const labels = {
99
+ asc: this.msg('sortControl.ascending'), desc: this.msg('sortControl.descending'), ...this.options.labels
100
+ };
98
101
  this._direction.replaceChildren(icon(dir === 'asc' ? 'arrow-up-wide-short' : 'arrow-down-wide-short'));
99
102
  this._direction.dataset.direction = dir;
100
- this._direction.setAttribute('aria-label', `${this.options.label}: ${labels[dir]}`);
103
+ const label = this._label();
104
+ this._direction.setAttribute('aria-label', label === null ? labels[dir] : `${label}: ${labels[dir]}`);
101
105
  this._direction.title = `${labels[dir]} → ${labels[next]}`;
102
106
  }
103
107
 
108
+ /** @returns {string|null} The control's name: unset reads the catalogue, and null is no name. */
109
+ _label() {
110
+ const { label = this.msg('sortControl.label') } = this.options;
111
+ return label;
112
+ }
113
+
104
114
  /** Focuses the searchable control. @returns {this} */
105
115
  focus() { this._select.focus(); return this; }
106
116
  /** Releases the owned Select and restores an enhanced target. @returns {void} */
@@ -17,8 +17,9 @@ import { Tooltip } from '../tooltip/tooltip.js';
17
17
  * @typedef {Object} SourceListOptions
18
18
  * @property {Source[]} [sources=[]] The sources, in the order an answer's `[n]` citations number
19
19
  * them. Model text is data: every string reaches the page as text.
20
- * @property {string} [label='Sources'] The visible label the list is named by. Empty hides it and
21
- * names the list with the `sourceList.label` message instead.
20
+ * @property {string|null} [label] The visible label the list is named by, by default the
21
+ * `sourceList.label` message ("Sources"). Empty or null hides it and names the list with that
22
+ * message instead.
22
23
  * @property {'chips'|'list'} [layout='chips'] `'chips'` wraps short chips beside the label;
23
24
  * `'list'` gives each source a full-width row with its title and site.
24
25
  * @property {boolean} [numbered=true] Whether each source shows its number.
@@ -63,7 +64,8 @@ export class SourceList extends Component {
63
64
  /** @type {Readonly<SourceListOptions>} */
64
65
  static defaults = {
65
66
  sources: [],
66
- label: 'Sources',
67
+ // Undefined rather than null, which already hides the label.
68
+ label: undefined,
67
69
  layout: 'chips',
68
70
  numbered: true,
69
71
  icons: {},
@@ -89,7 +91,8 @@ export class SourceList extends Component {
89
91
  this._layout = this.options.layout === 'list' ? 'list' : 'chips';
90
92
  root.dataset.layout = this._layout;
91
93
 
92
- const label = typeof this.options.label === 'string' ? this.options.label.trim() : '';
94
+ const { label: option = this.msg('sourceList.label') } = this.options;
95
+ const label = typeof option === 'string' ? option.trim() : '';
93
96
  const labelId = uid('zx-source-list');
94
97
  const heading = label ? h('span', { class: 'zx-source-list__label', id: labelId }, label) : null;
95
98
  this._list = h('ol', {
@@ -29,7 +29,8 @@ const STORAGE_NAMESPACE = 'split-view';
29
29
  * @property {string|null} [storageKey=null] Key under which the size is remembered between visits.
30
30
  * Storage failures degrade to memory rather than throwing.
31
31
  * @property {boolean} [disabled=false] Whether resizing is blocked.
32
- * @property {string} [label='Resize panes'] Accessible name of the divider.
32
+ * @property {string|null} [label=null] Accessible name of the divider; null reads the
33
+ * `splitView.resize` message ("Resize panes").
33
34
  * @property {(event: CustomEvent<{size: number, ratio: number}>) => void} [onresize] Resize listener.
34
35
  * @property {(event: CustomEvent<{size: number, ratio: number}>) => void} [onresizeend] Resize-end listener.
35
36
  * @property {(event: CustomEvent<{pane: 'start'|'end'}>) => void} [oncollapse] Collapse listener.
@@ -70,7 +71,7 @@ export class SplitView extends Component {
70
71
  snap: 0,
71
72
  storageKey: null,
72
73
  disabled: false,
73
- label: 'Resize panes'
74
+ label: null
74
75
  };
75
76
 
76
77
  /** @type {ResizeObserver|null} */
@@ -91,6 +92,7 @@ export class SplitView extends Component {
91
92
  const key = this.options.storageKey;
92
93
  if (key !== null && key !== undefined && key !== '') {
93
94
  this.#store = storage(STORAGE_NAMESPACE);
95
+ this.#store.migrateLegacy([String(key)]);
94
96
  const stored = this.#store.get(String(key));
95
97
  if (typeof stored === 'number' && Number.isFinite(stored) && stored >= 0) this.setSize(stored);
96
98
  }
@@ -181,7 +183,7 @@ export class SplitView extends Component {
181
183
  // A separator's aria-orientation describes the separator itself, not the split: panes lying
182
184
  // side by side (orientation "horizontal") are parted by a vertical line.
183
185
  ariaOrientation: this._orientation === 'vertical' ? 'horizontal' : 'vertical',
184
- ariaLabel: String(options.label ?? 'Resize panes'),
186
+ ariaLabel: String(options.label ?? this.msg('splitView.resize')),
185
187
  ariaControls: startId
186
188
  });
187
189
  const end = h('div', {