@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
@@ -0,0 +1,2 @@
1
+ /** The built-in English catalogue, available through the same opt-in locale entry points. */
2
+ export { defaultMessages as en } from '../core/messages.js';
@@ -0,0 +1,7 @@
1
+ import { en } from './en.js';
2
+ import { de } from './de.js';
3
+
4
+ export { en, de };
5
+
6
+ /** Shipped locale catalogues. Import this manifest explicitly; the main entry point stays English-only. */
7
+ export const locales = Object.freeze({ en, de });
@@ -1,3 +1,4 @@
1
+ import { translate } from '../core/i18n.js';
1
2
  import { Calendar, calendarDayDifference } from '../index.js';
2
3
  import { dateToUnixSeconds, unixSecondsToDate } from './query.js';
3
4
 
@@ -31,7 +32,7 @@ export function zeyosAppointmentToEvent(record) {
31
32
  const end = unixSecondsToDate(record.dateto ?? record.datefrom);
32
33
  if (!(start instanceof Date) || !(end instanceof Date)) throw new TypeError('ZeyOS appointment requires datefrom and dateto');
33
34
  const association = String(record.assoc_name ?? '').trim();
34
- const name = String(record.name ?? '').trim() || 'Untitled appointment';
35
+ const name = String(record.name ?? '').trim() || translate('zeyosCalendar.untitled');
35
36
  const title = record.entity && association ? `${association}: ${name}` : name;
36
37
  const allDay = record.allDay != null ? Boolean(record.allDay)
37
38
  : isMidnight(start) && isMidnight(end) && calendarDayDifference(start, end) >= 1;
package/src/zeyos/form.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { translate } from '../core/i18n.js';
1
2
  import { Form, Message, Select } from '../index.js';
2
3
  import { overlayScope } from '../core/overlay-host.js';
3
4
  import { connect, errorMessage } from './connect.js';
@@ -191,7 +192,7 @@ export function zeyosForm(client, resource, opts = {}) {
191
192
  throw error;
192
193
  }
193
194
  }
194
- if (host) Message.success(`${recordLabel(record, resource)} saved successfully.`, { scope: host });
195
+ if (host) Message.success(translate('zeyosForm.saved', [recordLabel(record, resource)]), { scope: host });
195
196
  return record;
196
197
  })().finally(() => {
197
198
  savePending = null;
@@ -1,3 +1,4 @@
1
+ import { translate } from '../core/i18n.js';
1
2
  import { Launcher } from '../components/launcher/launcher.js';
2
3
  import { moduleChip, zeyosAppIcon } from './icons.js';
3
4
  import { moduleInfo } from './modules.js';
@@ -332,12 +333,12 @@ function normalizeServerColor(value) {
332
333
  function launcherLabels(input) {
333
334
  const labels = input && typeof input === 'object' ? input : {};
334
335
  return {
335
- applications: String(labels.applications ?? 'Applications'),
336
- recent: String(labels.recent ?? 'Recent'),
337
- results: String(labels.results ?? 'Top results'),
336
+ applications: String(labels.applications ?? translate('zeyosLauncher.applications')),
337
+ recent: String(labels.recent ?? translate('zeyosLauncher.recent')),
338
+ results: String(labels.results ?? translate('zeyosLauncher.results')),
338
339
  entities: labels.entities && typeof labels.entities === 'object' ? labels.entities : {},
339
- move: String(labels.move ?? 'Move'),
340
- open: String(labels.open ?? 'Open'),
341
- close: String(labels.close ?? 'Close')
340
+ move: String(labels.move ?? translate('zeyosLauncher.move')),
341
+ open: String(labels.open ?? translate('zeyosLauncher.open')),
342
+ close: String(labels.close ?? translate('zeyosLauncher.close'))
342
343
  };
343
344
  }
@@ -1,3 +1,4 @@
1
+ import { translate } from '../core/i18n.js';
1
2
  import { ModuleBar } from '../components/module-bar/module-bar.js';
2
3
  import { normalizeAppItems } from '../internal/app-rail.js';
3
4
  import { moduleIcon } from './icons.js';
@@ -57,7 +58,7 @@ export function zeyosModuleItems(state = {}, options = {}) {
57
58
  const menus = state.menus && typeof state.menus === 'object' ? state.menus : {};
58
59
  const badges = state.badges && typeof state.badges === 'object' ? state.badges : {};
59
60
  const groups = state.groups && typeof state.groups === 'object' ? state.groups : {};
60
- const labels = { forks: 'Forks', weblets: 'Weblets', ...(state.labels ?? {}) };
61
+ const labels = { forks: translate('zeyosModuleBar.forks'), weblets: translate('zeyosModuleBar.weblets'), ...(state.labels ?? {}) };
61
62
  const seen = new Set();
62
63
  /** @type {Record<string, any>[]} */
63
64
  const items = [];
@@ -1,3 +1,5 @@
1
+ import { formattingLocale } from '../core/i18n.js';
2
+ import { formatNumber, formatCurrency } from '../core/format.js';
1
3
  import { calendarZone, dateToUnixSeconds, normalizeTimeZone, unixSecondsToDate } from './query.js';
2
4
 
3
5
  /** @typedef {Record<string, unknown>} FieldMeta */
@@ -227,7 +229,7 @@ const percentColumn = {
227
229
  field: { type: 'float', props: { min: 0, max: 100 } },
228
230
  column: (meta) => ({
229
231
  align: 'right',
230
- render: (row) => formatPercent(rowValue(row, meta)),
232
+ render: (row) => formatPercent(rowValue(row, meta), meta.locale),
231
233
  sortValue: (row) => finiteNumber(rowValue(row, meta))
232
234
  })
233
235
  };
@@ -270,7 +272,7 @@ function dateStrategy(type) {
270
272
  return {
271
273
  field: { type },
272
274
  column: (meta) => {
273
- const format = type === 'datetime' ? instantFormatter() : calendarDayFormatter(meta.timeZone);
275
+ const format = type === 'datetime' ? instantFormatter(meta.locale) : calendarDayFormatter(meta.timeZone, meta.locale);
274
276
  return {
275
277
  render: (row) => format(rowValue(row, meta)),
276
278
  sortValue: (row) => unixSortValue(rowValue(row, meta))
@@ -484,18 +486,9 @@ function enumRenderer(meta, fallback = {}) {
484
486
 
485
487
  /** @param {FieldMeta} meta @param {boolean} [currency=false] @returns {(row: Record<string, unknown>) => string} */
486
488
  function numberRenderer(meta, currency = false) {
487
- let formatter;
488
- try {
489
- formatter = new Intl.NumberFormat(meta.locale, currency && meta.currency
490
- ? { style: 'currency', currency: String(meta.currency) }
491
- : {});
492
- } catch {
493
- formatter = new Intl.NumberFormat();
494
- }
495
- return (row) => {
496
- const value = finiteNumber(rowValue(row, meta));
497
- return value == null ? '' : formatter.format(value);
498
- };
489
+ return (row) => currency && meta.currency
490
+ ? formatCurrency(rowValue(row, meta), String(meta.currency), { locale: meta.locale })
491
+ : formatNumber(rowValue(row, meta), { locale: meta.locale });
499
492
  }
500
493
 
501
494
  /** @param {unknown} value @returns {number|null} */
@@ -505,21 +498,22 @@ function finiteNumber(value) {
505
498
  return Number.isFinite(number) ? number : null;
506
499
  }
507
500
 
508
- /** @param {unknown} value @returns {string} */
509
- function formatPercent(value) {
501
+ /** @param {unknown} value @param {unknown} locale @returns {string} */
502
+ function formatPercent(value, locale) {
510
503
  const number = finiteNumber(value);
511
- return number == null ? '' : `${new Intl.NumberFormat().format(number)}%`;
504
+ return number == null ? '' : `${formatNumber(number, { locale })}%`;
512
505
  }
513
506
 
514
507
  /**
515
508
  * Formats a date-time field: the instant, in the viewer's zone, with its time.
509
+ * @param {unknown} locale Explicit field locale.
516
510
  * @returns {(value: unknown) => string}
517
511
  */
518
- function instantFormatter() {
519
- const formatter = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeStyle: 'short' });
512
+ function instantFormatter(locale) {
513
+ const format = localizedDateFormatter(locale, { dateStyle: 'medium', timeStyle: 'short' });
520
514
  return (value) => {
521
515
  const date = timestampDate(value);
522
- return date ? formatter.format(date) : '';
516
+ return date ? format(date) : '';
523
517
  };
524
518
  }
525
519
 
@@ -527,12 +521,13 @@ function instantFormatter() {
527
521
  * Formats a date-only field: the calendar day the stored midnight names in the instance's zone,
528
522
  * with no time, so neither the viewer's zone nor daylight saving can move it.
529
523
  * @param {unknown} timeZone Instance zone from the field metadata; the runtime's own when absent.
524
+ * @param {unknown} locale Explicit field locale.
530
525
  * @returns {(value: unknown) => string}
531
526
  */
532
- function calendarDayFormatter(timeZone) {
527
+ function calendarDayFormatter(timeZone, locale) {
533
528
  const zone = calendarZone(/** @type {string|undefined} */ (timeZone ?? undefined));
534
529
  // The day is formatted as a UTC date so the formatter cannot shift it a second time.
535
- const formatter = new Intl.DateTimeFormat(undefined, { dateStyle: 'medium', timeZone: 'UTC' });
530
+ const format = localizedDateFormatter(locale, { dateStyle: 'medium', timeZone: 'UTC' });
536
531
  return (value) => {
537
532
  const date = timestampDate(value);
538
533
  if (!date) return '';
@@ -542,7 +537,26 @@ function calendarDayFormatter(timeZone) {
542
537
  : zone.dayOf(date.getTime());
543
538
  const utc = new Date(0);
544
539
  utc.setUTCFullYear(year, month, day);
545
- return formatter.format(utc);
540
+ return format(utc);
541
+ };
542
+ }
543
+
544
+ /**
545
+ * Keeps a field's date formatter until its effective locale changes.
546
+ * @param {unknown} locale Explicit field locale.
547
+ * @param {Intl.DateTimeFormatOptions} options Date presentation.
548
+ * @returns {(date: Date) => string}
549
+ */
550
+ function localizedDateFormatter(locale, options) {
551
+ let key;
552
+ let formatter;
553
+ return (date) => {
554
+ const effective = formattingLocale(locale, Intl.DateTimeFormat);
555
+ if (!formatter || key !== String(effective)) {
556
+ key = String(effective);
557
+ formatter = new Intl.DateTimeFormat(effective, options);
558
+ }
559
+ return formatter.format(date);
546
560
  };
547
561
  }
548
562
 
@@ -1,3 +1,4 @@
1
+ import { translate } from '../core/i18n.js';
1
2
  import { Select, h } from '../index.js';
2
3
  import { connect } from './connect.js';
3
4
  import { moduleChip } from './icons.js';
@@ -161,7 +162,7 @@ export function buildZeyosEntitySelectConfig(client, resource, opts = {}) {
161
162
  });
162
163
  base.renderValueAdornment = renderValueAdornment ?? ((item) => renderModuleIcon(item, true));
163
164
  if (none !== false) {
164
- base.noneLabel = typeof none === 'string' ? none : rest.noneLabel ?? 'No selection';
165
+ base.noneLabel = typeof none === 'string' ? none : rest.noneLabel ?? translate('select.none');
165
166
  base.renderNone = rest.renderNone ?? ((label) => h('span', { class: 'zx-select__entity-none' },
166
167
  h('span', { class: 'zx-select__entity-none-icon', ariaHidden: 'true' }),
167
168
  h('span', {}, label)));
@@ -171,8 +172,8 @@ export function buildZeyosEntitySelectConfig(client, resource, opts = {}) {
171
172
  const invoke = typeof descriptor.oninvoke === 'function' ? descriptor.oninvoke : null;
172
173
  base.actions = [...(Array.isArray(base.actions) ? base.actions : []), {
173
174
  id: descriptor.id ?? 'create',
174
- label: descriptor.label ?? 'Create new…',
175
- group: descriptor.group ?? 'New',
175
+ label: descriptor.label ?? translate('select.create'),
176
+ group: descriptor.group ?? translate('select.createGroup'),
176
177
  icon: descriptor.icon ?? 'plus',
177
178
  invoke: (detail) => invoke?.({ ...detail, resource })
178
179
  }];
@@ -1,3 +1,4 @@
1
+ import { formatCurrency } from '../core/format.js';
1
2
  import { Table } from '../index.js';
2
3
  import { connect } from './connect.js';
3
4
  import { buildListQuery } from './query.js';
@@ -182,7 +183,7 @@ export function buildZeyosTableConfig(client, resource, opts = {}) {
182
183
  const monetary = isMonetaryField(meta);
183
184
  const column = fieldToZxColumn(monetary ? { ...meta, format: 'money' } : meta);
184
185
  if (monetary) {
185
- column.render = (row) => formatCurrency(row?.[meta.id], row?.currency);
186
+ column.render = (row) => formatCurrency(row?.[meta.id], row?.currency, { locale: meta.locale });
186
187
  if (schemaHasField(client, resource, 'currency')) projection.currency = 'currency';
187
188
  }
188
189
  return column;
@@ -430,18 +431,6 @@ function isMonetaryField(meta) {
430
431
  return /money|currency|price/.test(format) || /(?:amount|price)$/.test(String(meta.id).toLowerCase());
431
432
  }
432
433
 
433
- /** @param {unknown} value @param {unknown} currency @returns {string} */
434
- function formatCurrency(value, currency) {
435
- if (value == null || value === '') return '';
436
- const number = Number(value);
437
- if (!Number.isFinite(number)) return '';
438
- const code = typeof currency === 'string' && /^[A-Z]{3}$/.test(currency) ? currency : null;
439
- try {
440
- return new Intl.NumberFormat(undefined, code ? { style: 'currency', currency: code } : {}).format(number);
441
- } catch {
442
- return new Intl.NumberFormat().format(number);
443
- }
444
- }
445
434
 
446
435
  /** @param {Record<string, any>} client @param {string} resource @param {string} id @returns {boolean} */
447
436
  function schemaHasField(client, resource, id) {
package/src/zeyos/view.js CHANGED
@@ -46,6 +46,9 @@ import { buildZeyosTableConfig, createServerPager } from './table.js';
46
46
  * @property {string|Function} [swimlaneBy] Kanban swim-lane field or resolver.
47
47
  * @property {false|Record<string,any>|ZeyosSavedViewsOptions|null} [savedViews] Existing registry or
48
48
  * injected transport/scope configuration for named saved views.
49
+ * @property {'error'|'baseline'} [savedViewFallback='error'] Allow record loads using the configured
50
+ * baseline when the saved-view registry cannot be read. `ready` still rejects and saved-view
51
+ * operations remain unavailable until a later initialization succeeds.
49
52
  * @property {(record:Record<string,unknown>,event:CustomEvent<Record<string,unknown>>)=>void} [onRecordClick]
50
53
  */
51
54
 
@@ -111,7 +114,8 @@ import { buildZeyosTableConfig, createServerPager } from './table.js';
111
114
  * @property {number} pageSize Current server page size.
112
115
  * @property {boolean} hasMore Whether another page is available.
113
116
  * @property {Record<string,any>|null} savedViews Saved-view registry when configured.
114
- * @property {Promise<SavedViewApplyResult|null>} ready Default restoration completed before loads.
117
+ * @property {Promise<SavedViewApplyResult|null>} ready Default restoration completed before loads;
118
+ * rejects on failure even when baseline record loading is enabled.
115
119
  * @property {(options?:ZeyosApplyViewOptions)=>Promise<SavedViewApplyResult|null>} restoreDefault Restores the current default.
116
120
  * @property {(details:{id?:string,name:string})=>ZeyosSavedViewCapture} captureView Captures current query/view state without persistence.
117
121
  * @property {(details:ZeyosSaveViewOptions)=>Promise<SavedViewEntry>} saveView Captures and persists the current view.
@@ -232,6 +236,7 @@ export function zeyosView(client, resource, View, opts = {}) {
232
236
  }
233
237
  let destroyed = false;
234
238
  const performLoad = pager.load;
239
+ let initializationUnsafe = false;
235
240
 
236
241
  /** @param {string} idOrName @param {{load?:boolean}} [options={}] @returns {Promise<SavedViewApplyResult>} */
237
242
  const applySaved = async (idOrName, options = {}) => {
@@ -251,16 +256,38 @@ export function zeyosView(client, resource, View, opts = {}) {
251
256
  return result;
252
257
  };
253
258
 
254
- /** @param {{load?:boolean}} [options={}] @returns {Promise<SavedViewApplyResult|null>} */
255
- const restoreDefaultInternal = async (options = {}) => {
259
+ /**
260
+ * @param {{load?:boolean}} [options={}] Apply behavior.
261
+ * @param {()=>void} [onReadFailure] Marks a registry read failure for this attempt.
262
+ * @returns {Promise<SavedViewApplyResult|null>}
263
+ */
264
+ const restoreDefaultInternal = async (options = {}, onReadFailure = () => {}) => {
256
265
  if (!savedViews) return null;
257
- await readySavedViews(savedViews);
266
+ try {
267
+ await readySavedViews(savedViews);
268
+ } catch (error) {
269
+ if (!destroyed) {
270
+ onReadFailure();
271
+ if (opts.savedViewFallback === 'baseline') {
272
+ try { facade.reportError(error, { operation: 'savedViews.read', resource }); }
273
+ catch { /* Preserve the registry failure if reporting itself fails. */ }
274
+ }
275
+ }
276
+ throw error;
277
+ }
258
278
  if (destroyed) throw new Error('ZeyOS view binding has been destroyed');
259
- const entry = await savedViews.getDefault();
260
- if (!entry) return /** @type {SavedViewApplyResult} */ ({
261
- status: 'missing', applied: false, entry: null
262
- });
263
- return applySaved(entry.id, options);
279
+ try {
280
+ const entry = await savedViews.getDefault();
281
+ if (destroyed) throw new Error('ZeyOS view binding has been destroyed');
282
+ if (!entry) return /** @type {SavedViewApplyResult} */ ({
283
+ status: 'missing', applied: false, entry: null
284
+ });
285
+ return await applySaved(entry.id, options);
286
+ } catch (error) {
287
+ // A failed application may have changed view or query state, so it is not a safe baseline.
288
+ initializationUnsafe = true;
289
+ throw error;
290
+ }
264
291
  };
265
292
 
266
293
  /** Default application starts immediately and every server load below awaits it. */
@@ -275,9 +302,11 @@ export function zeyosView(client, resource, View, opts = {}) {
275
302
  * Later operations retry a failed initial registry/default restoration instead of remaining
276
303
  * poisoned by the intentionally observable first `ready` rejection.
277
304
  * @param {{load?:boolean}} [options={load:false}] Retry apply behavior.
305
+ * @param {boolean} [allowBaseline=false] Permit record loading after a registry read failure.
278
306
  * @returns {Promise<SavedViewApplyResult|null>}
279
307
  */
280
- const ensureInitialized = async (options = { load: false }) => {
308
+ const ensureInitialized = async (options = { load: false }, allowBaseline = false) => {
309
+ if (destroyed) throw new Error('ZeyOS view binding has been destroyed');
281
310
  if (initialized) return null;
282
311
  try {
283
312
  const result = await ready;
@@ -286,27 +315,38 @@ export function zeyosView(client, resource, View, opts = {}) {
286
315
  } catch {
287
316
  // The first failure remains available through binding.ready; this operation gets a retry.
288
317
  }
318
+ if (destroyed) throw new Error('ZeyOS view binding has been destroyed');
289
319
  if (!retryingInitialization) {
290
- const retry = restoreDefaultInternal(options).then((result) => {
320
+ const attempt = { readFailed: false, promise: null };
321
+ const retry = restoreDefaultInternal(options, () => { attempt.readFailed = true; }).then((result) => {
291
322
  initialized = true;
292
323
  return result;
293
324
  });
294
- const pending = retry.finally(() => {
295
- if (retryingInitialization === pending) retryingInitialization = null;
325
+ attempt.promise = retry.finally(() => {
326
+ if (retryingInitialization === attempt) retryingInitialization = null;
296
327
  });
297
- retryingInitialization = pending;
328
+ retryingInitialization = attempt;
329
+ }
330
+ const attempt = retryingInitialization;
331
+ try {
332
+ return await attempt.promise;
333
+ } catch (error) {
334
+ if (allowBaseline && opts.savedViewFallback === 'baseline' && attempt.readFailed
335
+ && !initializationUnsafe && !destroyed) return null;
336
+ throw error;
298
337
  }
299
- return retryingInitialization;
300
338
  };
301
339
 
302
340
  const load = async (options = {}) => {
303
341
  // Rejected before saved-view initialization runs, so an invalid call has no side effect.
304
342
  pager.check(options);
305
- await ensureInitialized({ load: false });
343
+ await ensureInitialized({ load: false }, true);
306
344
  return performLoad(options);
307
345
  };
308
346
 
309
347
  const captureView = (details) => {
348
+ if (destroyed) throw new Error('ZeyOS view binding has been destroyed');
349
+ if (savedViews && !initialized) throw new Error('Saved-view initialization has not succeeded');
310
350
  if (!presentation || typeof view.getViewState !== 'function') {
311
351
  throw new Error('This view does not expose serializable saved-view state');
312
352
  }
@@ -359,7 +399,7 @@ export function zeyosView(client, resource, View, opts = {}) {
359
399
  setSearch: (search) => load({ search, page: 0 }),
360
400
  setFilters: (filters) => load({ filters, page: 0 }),
361
401
  loadMore: async () => {
362
- await ensureInitialized({ load: false });
402
+ await ensureInitialized({ load: false }, true);
363
403
  return pager.loadMore();
364
404
  },
365
405
  get count() { return pager.count; },
@@ -0,0 +1,11 @@
1
+ /*
2
+ * The core sheet: the tokens, the base rules, icons and reading type. Every component needs it, so
3
+ * it comes first in `zx.css` and first in every stylesheet `zx-css` writes.
4
+ */
5
+ @import url("./tokens/global.css");
6
+ @import url("./tokens/themes.css");
7
+ @import url("./tokens/semantic.css");
8
+ @import url("./tokens/dark.css");
9
+ @import url("./base.css");
10
+ @import url("./icons.css");
11
+ @import url("./prose.css");
@@ -28,6 +28,7 @@
28
28
  --zx-control-radius: var(--zx-radius-lg);
29
29
  --zx-control-font-size: var(--zx-text-md);
30
30
  --zx-control-font-weight: 500;
31
+ --zx-control-disabled-opacity: 0.65;
31
32
  /* A data row — a table row, a single-line list row: one rhythm for every list on a screen,
32
33
  following the control height, so a tighter or looser product is still one decision. 36px at
33
34
  the default. */
@@ -0,0 +1,2 @@
1
+ /* Optional ZeyOS product module colours, separate from the product-agnostic core. */
2
+ @import url("./tokens/modules.css");
package/styles/zx.css CHANGED
@@ -1,11 +1,4 @@
1
- @import url("./tokens/global.css");
2
- @import url("./tokens/themes.css");
3
- @import url("./tokens/semantic.css");
4
- @import url("./tokens/dark.css");
5
- @import url("./tokens/modules.css");
6
- @import url("./base.css");
7
- @import url("./icons.css");
8
- @import url("./prose.css");
1
+ @import url("./core.css");
9
2
  @import url("../src/components/kbd/kbd.css");
10
3
  @import url("../src/components/button/button.css");
11
4
  @import url("../src/components/badge/badge.css");
@@ -55,6 +48,7 @@
55
48
  @import url("../src/components/menu-button/menu-button.css");
56
49
  @import url("../src/components/context-menu/context-menu.css");
57
50
  @import url("../src/components/select/select.css");
51
+ @import url("../src/components/flag/flag.css");
58
52
  @import url("../src/components/checklist/checklist.css");
59
53
  @import url("../src/components/tag-picker/tag-picker.css");
60
54
  @import url("../src/components/number-field/number-field.css");
@@ -96,8 +90,10 @@
96
90
  @import url("../src/components/block-view/block-view.css");
97
91
  @import url("../src/components/run-status/run-status.css");
98
92
  @import url("../src/components/composer/composer.css");
93
+ @import url("../src/components/prompt-starters/prompt-starters.css");
99
94
  @import url("../src/components/approval-card/approval-card.css");
100
95
  @import url("../src/components/run-trace/run-trace.css");
101
96
  @import url("../src/components/source-list/source-list.css");
102
97
  @import url("../src/components/agent-thread/agent-thread.css");
98
+ @import url("../src/components/surface/surface.css");
103
99
  @import url("./print.css");
@@ -0,0 +1 @@
1
+ @import url("./zx.css") layer(zx);