@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.
- package/CHANGELOG.md +188 -0
- package/README.md +73 -7
- package/bin/zx-css.js +328 -0
- package/dist/types/components/account-menu/account-menu.d.ts +4 -2
- package/dist/types/components/activity-list/activity-list.d.ts +14 -8
- package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
- package/dist/types/components/agent-thread/agent-thread.d.ts +142 -14
- package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
- package/dist/types/components/calendar/calendar-model.d.ts +9 -2
- package/dist/types/components/calendar/calendar.d.ts +12 -4
- package/dist/types/components/chart/chart.d.ts +25 -13
- package/dist/types/components/checklist/checklist.d.ts +29 -0
- package/dist/types/components/code-editor/code-editor.d.ts +7 -2
- package/dist/types/components/composer/composer.d.ts +206 -4
- package/dist/types/components/composer/queue.d.ts +76 -0
- package/dist/types/components/copy/copy-button.d.ts +6 -4
- package/dist/types/components/copy/copy-input.d.ts +10 -6
- package/dist/types/components/datebox/date-range-box.d.ts +33 -0
- package/dist/types/components/datebox/placeholder.d.ts +7 -0
- package/dist/types/components/dialog/dialog.d.ts +2 -2
- package/dist/types/components/dock/dock.d.ts +12 -3
- package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
- package/dist/types/components/field-upload/field-upload.d.ts +3 -2
- package/dist/types/components/file-item/file-item.d.ts +3 -2
- package/dist/types/components/file-list/file-list.d.ts +14 -8
- package/dist/types/components/filter/filter-model.d.ts +31 -1
- package/dist/types/components/filter/filter.d.ts +20 -2
- package/dist/types/components/finder/finder.d.ts +14 -6
- package/dist/types/components/flag/flag.d.ts +99 -0
- package/dist/types/components/grid/grid.d.ts +1 -1
- package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
- package/dist/types/components/launcher/launcher.d.ts +2 -0
- package/dist/types/components/modal/modal.d.ts +34 -8
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
- package/dist/types/components/number-field/number-field.d.ts +41 -7
- package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
- package/dist/types/components/prose/prose.d.ts +9 -6
- package/dist/types/components/questionnaire/conditions.d.ts +270 -0
- package/dist/types/components/questionnaire/items.d.ts +52 -30
- package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
- package/dist/types/components/rating/rating.d.ts +5 -3
- package/dist/types/components/select/country.d.ts +106 -0
- package/dist/types/components/select/field-adapter.d.ts +2 -1
- package/dist/types/components/select/locale.d.ts +102 -0
- package/dist/types/components/select/select.d.ts +41 -2
- package/dist/types/components/sheet/sheet.d.ts +2 -2
- package/dist/types/components/slider/slider.d.ts +1 -0
- package/dist/types/components/sort-control/sort-control.d.ts +7 -3
- package/dist/types/components/source-list/source-list.d.ts +7 -5
- package/dist/types/components/split-view/split-view.d.ts +5 -3
- package/dist/types/components/surface/catalog.d.ts +260 -0
- package/dist/types/components/surface/elicit.d.ts +81 -0
- package/dist/types/components/surface/mcp.d.ts +165 -0
- package/dist/types/components/surface/schema.d.ts +314 -0
- package/dist/types/components/surface/stream.d.ts +118 -0
- package/dist/types/components/surface/surface.d.ts +718 -0
- package/dist/types/components/surface/text.d.ts +277 -0
- package/dist/types/components/surface/validate.d.ts +339 -0
- package/dist/types/components/table/table.d.ts +55 -3
- package/dist/types/components/table/window.d.ts +203 -0
- package/dist/types/components/toolbar/toolbar.d.ts +10 -6
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/tree/tree.d.ts +20 -13
- package/dist/types/core/component.d.ts +10 -0
- package/dist/types/core/date.d.ts +8 -1
- package/dist/types/core/dom.d.ts +15 -0
- package/dist/types/core/http.d.ts +10 -0
- package/dist/types/core/i18n.d.ts +38 -0
- package/dist/types/core/messages.d.ts +344 -1
- package/dist/types/core/storage.d.ts +7 -2
- package/dist/types/elements/define.d.ts +21 -46
- package/dist/types/elements/definitions.d.ts +147 -0
- package/dist/types/elements/kit.d.ts +7 -0
- package/dist/types/elements/reflect.d.ts +6 -3
- package/dist/types/index.d.ts +10 -1
- package/dist/types/internal/date-locale.d.ts +7 -0
- package/dist/types/internal/json-patch.d.ts +146 -0
- package/dist/types/locales/de.d.ts +13 -0
- package/dist/types/locales/en.d.ts +2 -0
- package/dist/types/locales/index.d.ts +823 -0
- package/dist/types/zeyos/view.d.ts +8 -1
- package/dist/zx-zeyos.esm.js +16852 -15131
- package/dist/zx-zeyos.esm.min.js +5 -5
- package/dist/zx.core.css +1276 -0
- package/dist/zx.core.min.css +1 -0
- package/dist/zx.css +520 -143
- package/dist/zx.esm.js +40940 -29684
- package/dist/zx.esm.min.js +36 -23
- package/dist/zx.global.js +40940 -29684
- package/dist/zx.global.min.js +36 -23
- package/dist/zx.layered.css +17315 -0
- package/dist/zx.layered.min.css +1 -0
- package/dist/zx.min.css +1 -1
- package/docs/agent-catalog.json +12501 -0
- package/docs/agent-surfaces.md +340 -0
- package/docs/api.json +909 -137
- package/docs/llms.md +1046 -80
- package/docs/llms.txt +30 -9
- package/package.json +29 -6
- package/src/components/account-menu/account-menu.js +6 -3
- package/src/components/activity-item/activity-item.js +2 -1
- package/src/components/activity-list/activity-list.js +16 -10
- package/src/components/agent-thread/ag-ui.js +1439 -0
- package/src/components/agent-thread/agent-thread.js +359 -54
- package/src/components/agent-thread/ui-message-stream.js +1281 -0
- package/src/components/app-sidebar/app-sidebar.js +18 -8
- package/src/components/approval-card/approval-card.js +3 -2
- package/src/components/block-view/block-view.js +7 -6
- package/src/components/breadcrumb/breadcrumb.js +8 -5
- package/src/components/button/button.css +24 -11
- package/src/components/calendar/calendar-model.js +8 -2
- package/src/components/calendar/calendar.js +53 -18
- package/src/components/chart/chart.js +54 -23
- package/src/components/checklist/checklist.css +9 -1
- package/src/components/checklist/checklist.js +59 -3
- package/src/components/checklist/field-adapter.js +2 -11
- package/src/components/code-editor/code-editor.js +45 -8
- package/src/components/code-editor/field-adapter.js +1 -1
- package/src/components/composer/composer.css +80 -1
- package/src/components/composer/composer.js +390 -16
- package/src/components/composer/queue.js +78 -0
- package/src/components/context-menu/context-menu.js +12 -1
- package/src/components/copy/copy-button.js +9 -7
- package/src/components/copy/copy-input.js +10 -6
- package/src/components/date-picker/date-picker.js +2 -1
- package/src/components/date-picker/date-range-picker.js +8 -7
- package/src/components/datebox/date-range-box.js +3 -9
- package/src/components/datebox/datebox.js +18 -21
- package/src/components/datebox/placeholder.js +18 -0
- package/src/components/dialog/dialog.js +4 -5
- package/src/components/dock/dock.js +34 -13
- package/src/components/entity-ref/entity-ref.js +16 -5
- package/src/components/field-upload/field-upload.js +81 -38
- package/src/components/file-item/file-item.js +70 -40
- package/src/components/file-list/file-list.js +15 -9
- package/src/components/filter/filter-model.js +46 -8
- package/src/components/filter/filter.css +3 -3
- package/src/components/filter/filter.js +29 -10
- package/src/components/filter-panel/filter-panel.js +13 -5
- package/src/components/finder/finder.js +50 -26
- package/src/components/flag/flag.css +40 -0
- package/src/components/flag/flag.js +177 -0
- package/src/components/form/form.js +1 -1
- package/src/components/grid/grid.js +22 -8
- package/src/components/kanban-view/kanban-view.js +51 -81
- package/src/components/launcher/launcher.js +17 -2
- package/src/components/list-toolbar/list-toolbar.js +2 -1
- package/src/components/master-panel/master-panel.js +1 -1
- package/src/components/menu-button/menu-button.js +4 -0
- package/src/components/message/message.js +3 -0
- package/src/components/modal/modal.js +62 -8
- package/src/components/multi-value-editor/multi-value-editor.js +10 -9
- package/src/components/navigation-bar/navigation-bar.js +3 -3
- package/src/components/number-field/number-field.js +98 -29
- package/src/components/prompt-starters/prompt-starters.css +91 -0
- package/src/components/prompt-starters/prompt-starters.js +206 -0
- package/src/components/prose/prose.js +14 -10
- package/src/components/questionnaire/conditions.js +666 -0
- package/src/components/questionnaire/items.js +150 -41
- package/src/components/questionnaire/questionnaire.js +126 -32
- package/src/components/rating/rating.js +5 -4
- package/src/components/run-status/run-status.js +2 -2
- package/src/components/select/country.js +136 -0
- package/src/components/select/field-adapter.js +7 -2
- package/src/components/select/locale.js +219 -0
- package/src/components/select/select.css +20 -22
- package/src/components/select/select.js +94 -12
- package/src/components/sheet/sheet-stack.js +10 -1
- package/src/components/sheet/sheet.js +12 -5
- package/src/components/slider/slider.js +7 -2
- package/src/components/sort-control/sort-control.js +15 -5
- package/src/components/source-list/source-list.js +7 -4
- package/src/components/split-view/split-view.js +5 -3
- package/src/components/surface/catalog.js +1334 -0
- package/src/components/surface/elicit.js +107 -0
- package/src/components/surface/mcp.js +243 -0
- package/src/components/surface/schema.js +644 -0
- package/src/components/surface/stream.js +245 -0
- package/src/components/surface/surface.css +308 -0
- package/src/components/surface/surface.js +2291 -0
- package/src/components/surface/text.js +513 -0
- package/src/components/surface/validate.js +2218 -0
- package/src/components/tabbox/tabbox.js +9 -0
- package/src/components/table/table.css +63 -3
- package/src/components/table/table.js +167 -28
- package/src/components/table/window.js +317 -0
- package/src/components/toolbar/toolbar.js +12 -7
- package/src/components/tooltip/tooltip.css +2 -3
- package/src/components/tooltip/tooltip.js +32 -5
- package/src/components/tree/tree.js +53 -23
- package/src/core/component.js +25 -1
- package/src/core/date.js +62 -16
- package/src/core/dom.js +67 -4
- package/src/core/format.js +15 -13
- package/src/core/http.js +29 -20
- package/src/core/i18n.js +83 -10
- package/src/core/icons.js +13 -2
- package/src/core/keyboard.js +79 -8
- package/src/core/messages.js +376 -2
- package/src/core/overlay-host.js +1 -0
- package/src/core/position.js +3 -2
- package/src/core/storage.js +59 -6
- package/src/elements/define.js +178 -130
- package/src/elements/definitions.js +229 -0
- package/src/elements/kit.js +444 -0
- package/src/elements/reflect.js +8 -3
- package/src/index.js +10 -1
- package/src/internal/date-locale.js +11 -0
- package/src/internal/json-patch.js +405 -0
- package/src/locales/de.js +911 -0
- package/src/locales/en.js +2 -0
- package/src/locales/index.js +7 -0
- package/src/zeyos/calendar.js +2 -1
- package/src/zeyos/form.js +2 -1
- package/src/zeyos/launcher.js +7 -6
- package/src/zeyos/module-bar.js +2 -1
- package/src/zeyos/schema.js +37 -23
- package/src/zeyos/select.js +4 -3
- package/src/zeyos/table.js +2 -13
- package/src/zeyos/view.js +57 -17
- package/styles/core.css +11 -0
- package/styles/tokens/semantic.css +1 -0
- package/styles/zeyos.css +2 -0
- package/styles/zx.css +4 -8
- package/styles/zx.layered.css +1 -0
package/src/zeyos/calendar.js
CHANGED
|
@@ -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() || '
|
|
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(
|
|
195
|
+
if (host) Message.success(translate('zeyosForm.saved', [recordLabel(record, resource)]), { scope: host });
|
|
195
196
|
return record;
|
|
196
197
|
})().finally(() => {
|
|
197
198
|
savePending = null;
|
package/src/zeyos/launcher.js
CHANGED
|
@@ -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 ?? '
|
|
336
|
-
recent: String(labels.recent ?? '
|
|
337
|
-
results: String(labels.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 ?? '
|
|
340
|
-
open: String(labels.open ?? '
|
|
341
|
-
close: String(labels.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
|
}
|
package/src/zeyos/module-bar.js
CHANGED
|
@@ -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: '
|
|
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 = [];
|
package/src/zeyos/schema.js
CHANGED
|
@@ -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
|
-
|
|
488
|
-
|
|
489
|
-
|
|
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 ? '' : `${
|
|
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
|
|
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 ?
|
|
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
|
|
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
|
|
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
|
|
package/src/zeyos/select.js
CHANGED
|
@@ -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 ?? '
|
|
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 ?? '
|
|
175
|
-
group: descriptor.group ?? '
|
|
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
|
}];
|
package/src/zeyos/table.js
CHANGED
|
@@ -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
|
-
/**
|
|
255
|
-
|
|
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
|
-
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
|
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
|
-
|
|
295
|
-
if (retryingInitialization ===
|
|
325
|
+
attempt.promise = retry.finally(() => {
|
|
326
|
+
if (retryingInitialization === attempt) retryingInitialization = null;
|
|
296
327
|
});
|
|
297
|
-
retryingInitialization =
|
|
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; },
|
package/styles/core.css
ADDED
|
@@ -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. */
|
package/styles/zeyos.css
ADDED
package/styles/zx.css
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
@import url("./
|
|
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);
|