@zeyos/zx 4.3.4 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +438 -0
- package/README.md +49 -10
- package/dist/types/components/activity-item/activity-item.d.ts +351 -0
- package/dist/types/components/activity-list/activity-list.d.ts +217 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -3
- package/dist/types/components/avatar/avatar.d.ts +46 -7
- package/dist/types/components/badge/badge.d.ts +21 -1
- package/dist/types/components/button/button.d.ts +23 -0
- package/dist/types/components/calendar/calendar.d.ts +19 -0
- package/dist/types/components/card/card.d.ts +7 -0
- package/dist/types/components/card-view/card-view.d.ts +11 -3
- package/dist/types/components/card-view/record-card.d.ts +7 -1
- package/dist/types/components/chart/chart.d.ts +10 -0
- package/dist/types/components/checklist/checklist.d.ts +9 -0
- package/dist/types/components/code-editor/code-editor.d.ts +149 -0
- package/dist/types/components/code-editor/field-adapter.d.ts +5 -0
- package/dist/types/components/context-menu/context-menu.d.ts +18 -2
- package/dist/types/components/date-picker/date-picker.d.ts +8 -0
- package/dist/types/components/date-picker/time-picker.d.ts +7 -0
- package/dist/types/components/datebox/date-range-box.d.ts +5 -1
- package/dist/types/components/datebox/datebox.d.ts +7 -2
- package/dist/types/components/dialog/dialog.d.ts +75 -6
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/entity-ref/entity-ref.d.ts +331 -0
- package/dist/types/components/field/field.d.ts +24 -2
- package/dist/types/components/fieldset/fieldset.d.ts +19 -1
- package/dist/types/components/file-item/file-item.d.ts +262 -0
- package/dist/types/components/file-list/file-list.d.ts +171 -0
- package/dist/types/components/filter/filter.d.ts +91 -36
- package/dist/types/components/filter-panel/filter-panel.d.ts +449 -0
- package/dist/types/components/form/form.d.ts +12 -1
- package/dist/types/components/kanban-view/kanban-card.d.ts +146 -0
- package/dist/types/components/kanban-view/kanban-view.d.ts +170 -4
- package/dist/types/components/launcher/launcher.d.ts +278 -26
- package/dist/types/components/list-toolbar/list-toolbar.d.ts +599 -0
- package/dist/types/components/menu-button/menu-button.d.ts +37 -42
- package/dist/types/components/message/message.d.ts +126 -17
- package/dist/types/components/modal/modal.d.ts +61 -2
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +105 -21
- package/dist/types/components/panel/panel.d.ts +7 -0
- package/dist/types/components/search/search.d.ts +7 -0
- package/dist/types/components/select/color.d.ts +12 -0
- package/dist/types/components/select/glyphs.d.ts +124 -0
- package/dist/types/components/select/select.d.ts +15 -3
- package/dist/types/components/sort-control/sort-control.d.ts +105 -0
- package/dist/types/components/stat-tile/stat-tile.d.ts +288 -0
- package/dist/types/components/tabbox/tabbox.d.ts +16 -0
- package/dist/types/components/table/table.d.ts +190 -1
- package/dist/types/components/table-view/table-view.d.ts +11 -5
- package/dist/types/components/tag-picker/tag-picker.d.ts +21 -4
- package/dist/types/components/timebox/timebox.d.ts +7 -0
- package/dist/types/components/tree/tree.d.ts +13 -0
- package/dist/types/components/value-list/value-list.d.ts +8 -0
- package/dist/types/components/view/record-view.d.ts +96 -5
- package/dist/types/core/breakpoint.d.ts +1 -1
- package/dist/types/core/icons.d.ts +37 -22
- package/dist/types/core/motion.d.ts +59 -0
- package/dist/types/core/overlay-host.d.ts +15 -1
- package/dist/types/index.d.ts +16 -3
- package/dist/types/internal/app-rail.d.ts +10 -0
- package/dist/types/internal/menu-items.d.ts +134 -0
- package/dist/types/zeyos/connect.d.ts +6 -0
- package/dist/types/zeyos/form.d.ts +50 -9
- package/dist/types/zeyos/index.d.ts +1 -1
- package/dist/types/zeyos/query.d.ts +79 -0
- package/dist/types/zeyos/schema.d.ts +24 -1
- package/dist/types/zeyos/table.d.ts +100 -14
- package/dist/types/zeyos/view.d.ts +10 -0
- package/dist/zx-zeyos.esm.js +2206 -489
- package/dist/zx-zeyos.esm.min.js +56 -1
- package/dist/zx.css +3322 -724
- package/dist/zx.esm.js +12244 -5809
- package/dist/zx.esm.min.js +58 -3
- package/dist/zx.global.js +12246 -5811
- package/dist/zx.global.min.js +58 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1683 -146
- package/docs/llms.md +777 -110
- package/docs/llms.txt +14 -8
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.css +35 -10
- package/src/components/activity-item/activity-item.css +137 -0
- package/src/components/activity-item/activity-item.js +602 -0
- package/src/components/activity-list/activity-list.css +99 -0
- package/src/components/activity-list/activity-list.js +409 -0
- package/src/components/app-icon/app-icon.css +1 -1
- package/src/components/app-rail/app-rail.css +191 -22
- package/src/components/app-sidebar/app-sidebar.css +349 -24
- package/src/components/app-sidebar/app-sidebar.js +86 -11
- package/src/components/aurora/aurora.css +5 -3
- package/src/components/avatar/avatar.css +32 -7
- package/src/components/avatar/avatar.js +72 -8
- package/src/components/badge/badge.css +54 -2
- package/src/components/badge/badge.js +29 -2
- package/src/components/button/button.css +74 -8
- package/src/components/button/button.js +44 -1
- package/src/components/calendar/calendar.css +46 -46
- package/src/components/calendar/calendar.js +33 -3
- package/src/components/card/card.css +2 -2
- package/src/components/card/card.js +12 -1
- package/src/components/card-view/card-view.css +10 -7
- package/src/components/card-view/card-view.js +25 -9
- package/src/components/card-view/record-card.js +7 -3
- package/src/components/chart/chart.css +4 -1
- package/src/components/chart/chart.js +12 -0
- package/src/components/check-button/check-button.css +10 -2
- package/src/components/checklist/checklist.css +9 -2
- package/src/components/checklist/checklist.js +11 -5
- package/src/components/checklist/field-adapter.js +3 -1
- package/src/components/code-editor/code-editor.css +68 -0
- package/src/components/code-editor/code-editor.js +306 -0
- package/src/components/code-editor/field-adapter.js +34 -0
- package/src/components/context-menu/context-menu.css +87 -5
- package/src/components/context-menu/context-menu.js +22 -30
- package/src/components/copy/copy-button.css +6 -0
- package/src/components/copy/copy-input.css +8 -3
- package/src/components/data-filter/data-filter.css +5 -4
- package/src/components/date-picker/date-picker.css +6 -6
- package/src/components/date-picker/date-picker.js +22 -8
- package/src/components/date-picker/date-range-picker.css +3 -3
- package/src/components/date-picker/month-picker.js +3 -3
- package/src/components/date-picker/time-picker.css +1 -1
- package/src/components/date-picker/time-picker.js +20 -8
- package/src/components/datebox/date-range-box.css +79 -2
- package/src/components/datebox/date-range-box.js +13 -2
- package/src/components/datebox/datebox.css +79 -2
- package/src/components/datebox/datebox.js +13 -2
- package/src/components/dialog/dialog.css +26 -0
- package/src/components/dialog/dialog.js +174 -70
- package/src/components/dropdown/dropdown.css +1 -1
- package/src/components/dropdown/dropdown.js +7 -5
- package/src/components/empty-state/empty-state.css +2 -2
- package/src/components/entity-ref/entity-ref.css +182 -0
- package/src/components/entity-ref/entity-ref.js +496 -0
- package/src/components/field/field.css +28 -9
- package/src/components/field/field.js +68 -26
- package/src/components/field-upload/field-upload.css +1 -1
- package/src/components/fieldset/fieldset.css +5 -3
- package/src/components/fieldset/fieldset.js +28 -5
- package/src/components/file-item/file-item.css +88 -0
- package/src/components/file-item/file-item.js +505 -0
- package/src/components/file-list/file-list.css +51 -0
- package/src/components/file-list/file-list.js +320 -0
- package/src/components/filter/filter.css +27 -1
- package/src/components/filter/filter.js +205 -47
- package/src/components/filter-panel/filter-panel.css +104 -0
- package/src/components/filter-panel/filter-panel.js +964 -0
- package/src/components/finder/finder.css +15 -13
- package/src/components/form/form.css +5 -4
- package/src/components/form/form.js +11 -2
- package/src/components/grid/grid.css +1 -1
- package/src/components/groupbox/groupbox.css +1 -1
- package/src/components/kanban-view/kanban-card.js +247 -0
- package/src/components/kanban-view/kanban-view.css +226 -8
- package/src/components/kanban-view/kanban-view.js +255 -12
- package/src/components/launcher/launcher.css +107 -25
- package/src/components/launcher/launcher.js +557 -63
- package/src/components/list-toolbar/list-toolbar.css +194 -0
- package/src/components/list-toolbar/list-toolbar.js +851 -0
- package/src/components/master-panel/master-panel.css +2 -0
- package/src/components/menu-button/menu-button.css +87 -5
- package/src/components/menu-button/menu-button.js +86 -46
- package/src/components/message/message.css +38 -5
- package/src/components/message/message.js +230 -17
- package/src/components/modal/modal.css +15 -0
- package/src/components/modal/modal.js +159 -3
- package/src/components/navigation-bar/navigation-bar.css +95 -11
- package/src/components/navigation-bar/navigation-bar.js +171 -4
- package/src/components/number-field/field-adapter.js +1 -0
- package/src/components/number-field/number-field.css +70 -0
- package/src/components/number-field/number-field.js +2 -0
- package/src/components/pagination/pagination.css +8 -6
- package/src/components/panel/panel.css +1 -1
- package/src/components/panel/panel.js +13 -2
- package/src/components/rating/rating.css +7 -0
- package/src/components/search/search.js +17 -5
- package/src/components/select/color.js +22 -0
- package/src/components/select/field-adapter.js +6 -1
- package/src/components/select/glyphs.js +165 -0
- package/src/components/select/select.css +138 -45
- package/src/components/select/select.js +86 -47
- package/src/components/sheet/sheet.css +11 -8
- package/src/components/slider/slider.css +16 -2
- package/src/components/slider/slider.js +1 -1
- package/src/components/sort-control/sort-control.css +20 -0
- package/src/components/sort-control/sort-control.js +140 -0
- package/src/components/stat-tile/stat-tile.css +208 -0
- package/src/components/stat-tile/stat-tile.js +601 -0
- package/src/components/tabbox/tabbox.css +32 -27
- package/src/components/tabbox/tabbox.js +17 -2
- package/src/components/table/table.css +155 -31
- package/src/components/table/table.js +386 -33
- package/src/components/table-view/table-view.css +8 -2
- package/src/components/table-view/table-view.js +21 -6
- package/src/components/tag-picker/tag-picker.css +86 -6
- package/src/components/tag-picker/tag-picker.js +25 -8
- package/src/components/timebox/timebox.css +22 -2
- package/src/components/timebox/timebox.js +18 -5
- package/src/components/toggle/toggle.css +12 -1
- package/src/components/toolbar/toolbar.js +2 -2
- package/src/components/tooltip/tooltip.css +4 -0
- package/src/components/tooltip/tooltip.js +10 -3
- package/src/components/tree/tree.css +25 -16
- package/src/components/tree/tree.js +31 -0
- package/src/components/value-list/value-list.css +3 -3
- package/src/components/value-list/value-list.js +22 -6
- package/src/components/view/record-view.css +5 -0
- package/src/components/view/record-view.js +100 -7
- package/src/core/breakpoint.js +1 -1
- package/src/core/icons.js +259 -57
- package/src/core/motion.js +147 -0
- package/src/core/overlay-host.js +21 -2
- package/src/index.js +30 -3
- package/src/internal/app-rail.js +18 -1
- package/src/internal/menu-items.js +142 -0
- package/src/zeyos/connect.js +6 -2
- package/src/zeyos/form.js +67 -27
- package/src/zeyos/index.js +1 -1
- package/src/zeyos/query.js +153 -0
- package/src/zeyos/schema.js +144 -27
- package/src/zeyos/table.js +68 -5
- package/src/zeyos/view.js +6 -0
- package/styles/base.css +56 -0
- package/styles/icons.css +11 -1
- package/styles/print.css +192 -0
- package/styles/tokens/dark.css +113 -37
- package/styles/tokens/global.css +121 -27
- package/styles/tokens/semantic.css +100 -31
- package/styles/tokens/themes.css +7 -6
- package/styles/zx.css +11 -1
- package/styles/tokens/density.css +0 -9
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The icon layer. Two renderers sit behind one `icon()` call:
|
|
3
3
|
*
|
|
4
|
-
* - **built-in** (default) — the inline SVG glyphs below, no network, no
|
|
4
|
+
* - **built-in** (default) — the inline SVG outline glyphs below (Lucide), no network, no
|
|
5
|
+
* stylesheet, no font. Applications can add their own, filled or outlined, with `registerIcons()`.
|
|
5
6
|
* - **Font Awesome** — `<i>` elements carrying Font Awesome classes, after an application opts in
|
|
6
7
|
* with `useFontAwesome()` or `loadFontAwesome(kit)`. Zx never loads a kit by itself.
|
|
7
8
|
*
|
|
@@ -33,26 +34,23 @@ export type IconOptions = {
|
|
|
33
34
|
* Adds Font Awesome's `fa-fw` for column-aligned glyphs.
|
|
34
35
|
*/
|
|
35
36
|
fixedWidth?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Throws `RangeError` on a name the bundled glyph set does not
|
|
39
|
+
* carry, instead of returning the placeholder. For call sites that can afford to fail — a test,
|
|
40
|
+
* a build-time check — rather than a screen rendering server data.
|
|
41
|
+
*/
|
|
42
|
+
strict?: boolean;
|
|
36
43
|
};
|
|
44
|
+
export type IconPaint = 'fill' | 'stroke';
|
|
45
|
+
export type IconGlyph = [string, string] | [string, string, IconPaint];
|
|
37
46
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @
|
|
43
|
-
* @property {string} [family] Font Awesome family for this icon only (`'classic'`, `'sharp'`, …).
|
|
44
|
-
* @property {boolean} [fixedWidth] Adds Font Awesome's `fa-fw` for column-aligned glyphs.
|
|
45
|
-
*/
|
|
46
|
-
/**
|
|
47
|
-
* Icon glyphs from Font Awesome Free 6 (solid, plus `square` from regular), fontawesome.com,
|
|
48
|
-
* licensed CC BY 4.0 (https://fontawesome.com/license/free). Path data is embedded unmodified so
|
|
49
|
-
* the library carries no webfont, stylesheet, or package dependency. Each entry is
|
|
50
|
-
* `[viewBox, path]`; Font Awesome glyphs are filled (not stroked) and use per-glyph 512-unit view
|
|
51
|
-
* boxes — outlines such as `square` are a filled path with a counter-wound hole.
|
|
52
|
-
* Extend the set with `registerIcons()`; read every available name with `iconNames()`.
|
|
53
|
-
* @type {Readonly<Record<string, [string, string]>>}
|
|
47
|
+
* The bundled glyph set: outline icons from Lucide (ISC; see the notice above), embedded as path
|
|
48
|
+
* data so the library carries no webfont, stylesheet, or package dependency. Every entry is
|
|
49
|
+
* `[viewBox, path, 'stroke']` in a 24-unit view box. Extend the set with `registerIcons()`; read
|
|
50
|
+
* every available name with `iconNames()`.
|
|
51
|
+
* @type {Readonly<Record<string, IconGlyph>>}
|
|
54
52
|
*/
|
|
55
|
-
export declare const icons: Readonly<Record<string,
|
|
53
|
+
export declare const icons: Readonly<Record<string, IconGlyph>>;
|
|
56
54
|
export type IconConfig = {
|
|
57
55
|
/**
|
|
58
56
|
* Renderer used for bare icon names.
|
|
@@ -111,12 +109,21 @@ export declare function loadFontAwesome(options: string | (Partial<Omit<IconConf
|
|
|
111
109
|
activate?: boolean;
|
|
112
110
|
})): Promise<IconConfig>;
|
|
113
111
|
/**
|
|
114
|
-
* Adds inline SVG glyphs to the built-in set, or replaces existing ones.
|
|
115
|
-
*
|
|
116
|
-
*
|
|
112
|
+
* Adds inline SVG glyphs to the built-in set, or replaces existing ones.
|
|
113
|
+
*
|
|
114
|
+
* An entry is `[viewBox, path]` — a filled shape, the format Font Awesome path data comes in, and
|
|
115
|
+
* how it always rendered — or `[viewBox, path, 'stroke']` — an outline drawn with the same pen as
|
|
116
|
+
* the bundled set: `currentColor`, round caps and joins, and a stroke scaled to the view box, so a
|
|
117
|
+
* glyph from a 24-unit outline set such as Lucide renders exactly like a bundled one.
|
|
118
|
+
*
|
|
119
|
+
* registerIcons({ rocket: ['0 0 512 512', 'M…'] }); // filled
|
|
120
|
+
* registerIcons({ anchor: ['0 0 24 24', 'M12 6v16…', 'stroke'] }); // outline
|
|
121
|
+
* @param {Record<string, IconGlyph>} glyphs Glyphs keyed by icon name.
|
|
117
122
|
* @returns {void}
|
|
123
|
+
* @throws {TypeError} When an entry is neither a `[viewBox, path]` pair nor a
|
|
124
|
+
* `[viewBox, path, 'fill'|'stroke']` triple.
|
|
118
125
|
*/
|
|
119
|
-
export declare function registerIcons(glyphs: Record<string,
|
|
126
|
+
export declare function registerIcons(glyphs: Record<string, IconGlyph>): void;
|
|
120
127
|
/**
|
|
121
128
|
* Lists every inline SVG glyph name available, built-in and registered.
|
|
122
129
|
* @returns {string[]} Sorted icon names.
|
|
@@ -130,8 +137,16 @@ export declare function iconNames(): string[];
|
|
|
130
137
|
* its renderer itself — `'fa:user'`, `'duotone:user'`, `'kit:zeyos-notes'`, `'builtin:check'`, or
|
|
131
138
|
* a literal Font Awesome class list such as `'fa-solid fa-user'`.
|
|
132
139
|
*
|
|
140
|
+
* **A name this cannot resolve never throws.** Icon names routinely arrive from a server, and one
|
|
141
|
+
* unconfigured name must not take down the screen it appears on. An inline glyph the bundled set
|
|
142
|
+
* does not carry renders as the placeholder described in `missingIcon()` and is reported once per
|
|
143
|
+
* distinct name through `console.warn`; pass `{ strict: true }` to get a `RangeError` instead.
|
|
144
|
+
* Only the inline-SVG path can fail this way: Font Awesome resolves names in the browser at render
|
|
145
|
+
* time, so a name under a loaded kit or stylesheet is never "unknown" here and never warns.
|
|
146
|
+
*
|
|
133
147
|
* @param {string} name Icon name or spec.
|
|
134
148
|
* @param {IconOptions} [options={}] Display and accessibility options.
|
|
135
149
|
* @returns {SVGSVGElement|HTMLElement} An `<svg>` for inline glyphs, an `<i>` for Font Awesome.
|
|
150
|
+
* @throws {RangeError} With `{ strict: true }` only, when the bundled set has no such glyph.
|
|
136
151
|
*/
|
|
137
152
|
export declare function icon(name: string, options?: IconOptions): SVGSVGElement | HTMLElement;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Motion as a setting, for the code that animates in script.
|
|
3
|
+
*
|
|
4
|
+
* CSS motion needs nothing from here: `tokens/global.css` sets every `--zx-dur-*` to 0ms and
|
|
5
|
+
* `base.css` stops animations and transitions both under the operating system's reduced-motion
|
|
6
|
+
* preference and inside any `data-zx-motion="reduced"` region. A chart engine's own tweening, a
|
|
7
|
+
* `requestAnimationFrame` loop, or `element.animate()` never sees those rules, so a component that
|
|
8
|
+
* moves things itself asks `prefersReducedMotion()` before it starts and `watchMotion()` for the
|
|
9
|
+
* moment the answer changes.
|
|
10
|
+
*
|
|
11
|
+
* There is no "full motion" value: a region can only ask for less. Someone who asked their system
|
|
12
|
+
* for reduced motion gets it whatever an application or a region says.
|
|
13
|
+
* @module zx/core/motion
|
|
14
|
+
*/
|
|
15
|
+
/** The attribute that marks a reduced-motion region. Its one meaningful value is `reduced`. */
|
|
16
|
+
export declare const MOTION_ATTRIBUTE = "data-zx-motion";
|
|
17
|
+
/**
|
|
18
|
+
* Whether motion should stop where `element` is: true under the operating system's reduced-motion
|
|
19
|
+
* preference, or when the element sits inside a `data-zx-motion="reduced"` region (the element
|
|
20
|
+
* itself included). The region check crosses shadow-root boundaries.
|
|
21
|
+
* @param {Element|null} [element] Where the motion would happen. Omitted, the document root is
|
|
22
|
+
* asked — which answers for an application that sets the attribute on `<html>`.
|
|
23
|
+
* @returns {boolean}
|
|
24
|
+
*/
|
|
25
|
+
export declare function prefersReducedMotion(element?: Element | null): boolean;
|
|
26
|
+
export type WatchMotionOptions = {
|
|
27
|
+
/**
|
|
28
|
+
* Stops watching when aborted, exactly as calling the returned
|
|
29
|
+
* disposer does. A signal that is already aborted watches nothing.
|
|
30
|
+
*/
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
/**
|
|
33
|
+
* Also calls back once, synchronously, with the current
|
|
34
|
+
* answer — convenient for a loop that starts or stays stopped in the same callback.
|
|
35
|
+
*/
|
|
36
|
+
immediate?: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* @typedef {Object} WatchMotionOptions
|
|
40
|
+
* @property {AbortSignal} [signal] Stops watching when aborted, exactly as calling the returned
|
|
41
|
+
* disposer does. A signal that is already aborted watches nothing.
|
|
42
|
+
* @property {boolean} [immediate=false] Also calls back once, synchronously, with the current
|
|
43
|
+
* answer — convenient for a loop that starts or stays stopped in the same callback.
|
|
44
|
+
*/
|
|
45
|
+
/**
|
|
46
|
+
* Calls back whenever `prefersReducedMotion(element)` changes: when the operating-system preference
|
|
47
|
+
* flips, or when a `data-zx-motion` attribute is set, changed, or removed on the element or any
|
|
48
|
+
* ancestor (in the document, or in the shadow root the element lives in). The callback receives
|
|
49
|
+
* the new answer and runs only on a real change.
|
|
50
|
+
*
|
|
51
|
+
* Moving the element into or out of a reduced region is not observed — ask
|
|
52
|
+
* `prefersReducedMotion()` again after re-parenting.
|
|
53
|
+
* @param {Element|null} element Where the motion happens. Null watches the document root.
|
|
54
|
+
* @param {(reduced: boolean) => void} fn Receives `true` when motion must stop, `false` when it may
|
|
55
|
+
* run again.
|
|
56
|
+
* @param {WatchMotionOptions} [options={}]
|
|
57
|
+
* @returns {() => void} Disposer: stops watching. Safe to call more than once.
|
|
58
|
+
*/
|
|
59
|
+
export declare function watchMotion(element: Element | null, fn: (reduced: boolean) => void, options?: WatchMotionOptions): () => void;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Finds the closest styling scope for a top-layer element.
|
|
3
3
|
*
|
|
4
4
|
* Popovers and dialogs escape clipping even when their DOM parent is inside an application shell,
|
|
5
|
-
* so keeping them below that parent preserves inherited theme,
|
|
5
|
+
* so keeping them below that parent preserves inherited theme, preset, material, and product
|
|
6
6
|
* token overrides without sacrificing top-layer behaviour. The document body remains the safe
|
|
7
7
|
* fallback for unscoped applications.
|
|
8
8
|
*
|
|
@@ -10,3 +10,17 @@
|
|
|
10
10
|
* @returns {Element}
|
|
11
11
|
*/
|
|
12
12
|
export declare function overlayHost(source?: Element | string | null): Element;
|
|
13
|
+
/**
|
|
14
|
+
* Like `overlayHost()`, but declines to guess for a source that is not in the document yet.
|
|
15
|
+
*
|
|
16
|
+
* A component created before its anchor is connected cannot know which themed region the anchor
|
|
17
|
+
* will end up in: the anchor's ancestors are not there yet, so `overlayHost()` would answer
|
|
18
|
+
* `<body>`, outside every `[data-zx-theme]` and `.zx-scope`. This returns null instead, so the
|
|
19
|
+
* overlay can stay detached until it first opens and resolve its host with `overlayHost()` then,
|
|
20
|
+
* when the anchor is in place. The focused-element default (`source` null) is always connected and
|
|
21
|
+
* resolves exactly as `overlayHost()` does.
|
|
22
|
+
*
|
|
23
|
+
* @param {Element|string|null} [source=null] Element or selector whose styling scope should own the overlay.
|
|
24
|
+
* @returns {Element|null} The host, or null while the source is not connected to the document.
|
|
25
|
+
*/
|
|
26
|
+
export declare function connectedOverlayHost(source?: Element | string | null): Element | null;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export { Component } from './core/component.js';
|
|
|
11
11
|
export { h, htmlEscape, resolveElement, highlightMatch, __, compactElement, fragment, parseCompactTag, applyCompactProperties, appendContent, appendCompact, appendCompactChild, onCompactEvent, offCompactEvent, fireCompactEvent } from './core/dom.js';
|
|
12
12
|
export { position } from './core/position.js';
|
|
13
13
|
export { breakpoints, breakpointOf, matchBreakpoint, onBreakpoint } from './core/breakpoint.js';
|
|
14
|
+
export { MOTION_ATTRIBUTE, prefersReducedMotion, watchMotion } from './core/motion.js';
|
|
14
15
|
export { Http, zeyosService, parseResult } from './core/http.js';
|
|
15
16
|
export { setTranslator, setLanguage, getLanguage, translate, printf } from './core/i18n.js';
|
|
16
17
|
export { focusTrap, rovingTabindex, typeahead } from './core/keyboard.js';
|
|
@@ -22,8 +23,8 @@ export { formatNumber, formatCurrency, formatPercent, formatFileSize, formatRela
|
|
|
22
23
|
export { storage } from './core/storage.js';
|
|
23
24
|
export { toCsv, downloadBlob, copyToClipboard } from './core/export.js';
|
|
24
25
|
export { defineElements } from './elements/define.js';
|
|
25
|
-
export { button, buttonGroup } from './components/button/button.js';
|
|
26
|
-
export { badge, badgeGroup } from './components/badge/badge.js';
|
|
26
|
+
export { button, buttonGroup, setButtonBusy } from './components/button/button.js';
|
|
27
|
+
export { BADGE_TONES, badge, badgeGroup } from './components/badge/badge.js';
|
|
27
28
|
export { CheckButton } from './components/check-button/check-button.js';
|
|
28
29
|
export { emptyState } from './components/empty-state/empty-state.js';
|
|
29
30
|
export { spinner } from './components/loading/spinner.js';
|
|
@@ -34,10 +35,12 @@ export { stack, grid, aspect } from './components/layout/layout.js';
|
|
|
34
35
|
export { truncate, isTruncated } from './components/truncate/truncate.js';
|
|
35
36
|
export { copyButton } from './components/copy/copy-button.js';
|
|
36
37
|
export { CopyInput } from './components/copy/copy-input.js';
|
|
38
|
+
export { CodeEditor, indentSelection, editorPosition } from './components/code-editor/code-editor.js';
|
|
37
39
|
export { Toolbar } from './components/toolbar/toolbar.js';
|
|
38
40
|
export { Toggle } from './components/toggle/toggle.js';
|
|
39
41
|
export { Groupbox } from './components/groupbox/groupbox.js';
|
|
40
42
|
export { Card } from './components/card/card.js';
|
|
43
|
+
export { StatTile, statTile } from './components/stat-tile/stat-tile.js';
|
|
41
44
|
export { Aurora } from './components/aurora/aurora.js';
|
|
42
45
|
export { Panel } from './components/panel/panel.js';
|
|
43
46
|
export { MasterPanel } from './components/master-panel/master-panel.js';
|
|
@@ -51,7 +54,12 @@ export { Pagination, paginationRange } from './components/pagination/pagination.
|
|
|
51
54
|
export { Search } from './components/search/search.js';
|
|
52
55
|
export { AppIcon, appIcon } from './components/app-icon/app-icon.js';
|
|
53
56
|
export { Launcher, rankLauncherItems } from './components/launcher/launcher.js';
|
|
54
|
-
export { Avatar, avatarInitials } from './components/avatar/avatar.js';
|
|
57
|
+
export { AVATAR_TONES, Avatar, avatarInitials, avatarTone } from './components/avatar/avatar.js';
|
|
58
|
+
export { EntityRef, normalizeEntityRef, normalizeEntityRefLink, normalizeEntityRefMetadata, normalizeEntityRefActions } from './components/entity-ref/entity-ref.js';
|
|
59
|
+
export { FileItem, normalizeFileItem } from './components/file-item/file-item.js';
|
|
60
|
+
export { FileList, normalizeFileListItems } from './components/file-list/file-list.js';
|
|
61
|
+
export { ActivityItem, resolveActivityActions, normalizeActivityAction, normalizeActivityTimestamp } from './components/activity-item/activity-item.js';
|
|
62
|
+
export { ActivityList, groupActivityItems, normalizeActivityItems } from './components/activity-list/activity-list.js';
|
|
55
63
|
export { AccountMenu } from './components/account-menu/account-menu.js';
|
|
56
64
|
export { normalizeAppItems } from './internal/app-rail.js';
|
|
57
65
|
export { AppSidebar } from './components/app-sidebar/app-sidebar.js';
|
|
@@ -65,6 +73,7 @@ export { Tooltip, tooltip, describe } from './components/tooltip/tooltip.js';
|
|
|
65
73
|
export { MenuButton } from './components/menu-button/menu-button.js';
|
|
66
74
|
export { ContextMenu } from './components/context-menu/context-menu.js';
|
|
67
75
|
export { Select } from './components/select/select.js';
|
|
76
|
+
export { statusIcon, priorityIcon } from './components/select/glyphs.js';
|
|
68
77
|
export { Checklist } from './components/checklist/checklist.js';
|
|
69
78
|
export { TagPicker } from './components/tag-picker/tag-picker.js';
|
|
70
79
|
export { NumberField, parseNumber, snapNumber } from './components/number-field/number-field.js';
|
|
@@ -85,11 +94,15 @@ export { TableView } from './components/table-view/table-view.js';
|
|
|
85
94
|
export { CardView } from './components/card-view/card-view.js';
|
|
86
95
|
export { KanbanView } from './components/kanban-view/kanban-view.js';
|
|
87
96
|
export { absoluteKanbanIndex, allowsKanbanTransition, createKanbanHistory, evaluateKanbanMove, kanbanSearchTerms, locateKanbanRecord, matchesKanbanSearch, normalizeKanbanRules, reorderKanbanRecords, resolveKanbanRules } from './components/kanban-view/kanban-policy.js';
|
|
97
|
+
export { createKanbanAvatars, createKanbanCardHead, createKanbanIndicator, createKanbanProgress, kanbanAvatarLimit, resolveKanbanAssignees, resolveKanbanIndicator, resolveKanbanProgress } from './components/kanban-view/kanban-card.js';
|
|
88
98
|
export { Grid, billingColumns, isBillingLine } from './components/grid/grid.js';
|
|
89
99
|
export { Chart, ChartJsAdapter, chartSummaryTable, cloneChartValue, isEmptyChartData } from './components/chart/chart.js';
|
|
90
100
|
export { TreeView } from './components/tree/tree.js';
|
|
91
101
|
export { Finder } from './components/finder/finder.js';
|
|
92
102
|
export { DataFilter } from './components/data-filter/data-filter.js';
|
|
103
|
+
export { FilterPanel, isActiveValue, pruneValue, serializeFilterValue } from './components/filter-panel/filter-panel.js';
|
|
104
|
+
export { SortControl } from './components/sort-control/sort-control.js';
|
|
105
|
+
export { ListToolbar } from './components/list-toolbar/list-toolbar.js';
|
|
93
106
|
export { Filter } from './components/filter/filter.js';
|
|
94
107
|
export { filterOperators, emptyFilterAst, filterCondition, filterGroup, parseFilterAst, cloneFilterAst, stringifyFilterAst, validateFilterAst } from './components/filter/filter-model.js';
|
|
95
108
|
export { Field } from './components/field/field.js';
|
|
@@ -238,6 +238,16 @@ export declare class AppRailPresenter extends Component<AppRailPresenterOptions>
|
|
|
238
238
|
_syncActive(): void;
|
|
239
239
|
/** @returns {void} */
|
|
240
240
|
_clearArtifacts(): void;
|
|
241
|
+
/**
|
|
242
|
+
* Resolves one message through `msg()`, which falls back to the host translator. Copied from
|
|
243
|
+
* `Pagination` rather than invented: the rail's flyout label was the last user-visible string
|
|
244
|
+
* in the navigation stack with no way to change it.
|
|
245
|
+
* @param {string} key Message key.
|
|
246
|
+
* @param {string} fallback English default.
|
|
247
|
+
* @param {...unknown} args Interpolation arguments.
|
|
248
|
+
* @returns {string}
|
|
249
|
+
*/
|
|
250
|
+
_message(key: string, fallback: string, ...args: unknown[]): string;
|
|
241
251
|
}
|
|
242
252
|
/** Owns listeners attached to one dynamic rail render so `setItems()` can release them immediately. */
|
|
243
253
|
declare class RailListenerScope extends Component {
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
export type MenuItemRole = 'menuitem' | 'menuitemcheckbox' | 'menuitemradio';
|
|
2
|
+
export type MenuController = {
|
|
3
|
+
/**
|
|
4
|
+
* Close the owning menu.
|
|
5
|
+
*/
|
|
6
|
+
close: () => unknown;
|
|
7
|
+
};
|
|
8
|
+
export type MenuItem = {
|
|
9
|
+
/**
|
|
10
|
+
* Item label.
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Kernel icon name.
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Value emitted on selection.
|
|
19
|
+
*/
|
|
20
|
+
value?: unknown;
|
|
21
|
+
/**
|
|
22
|
+
* Whether selection is disabled.
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the action is dangerous.
|
|
27
|
+
*/
|
|
28
|
+
danger?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Native-link destination.
|
|
31
|
+
*/
|
|
32
|
+
href?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Native-link target.
|
|
35
|
+
*/
|
|
36
|
+
target?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Native-link relationship.
|
|
39
|
+
*/
|
|
40
|
+
rel?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Supporting text under the label.
|
|
43
|
+
*/
|
|
44
|
+
description?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Compact trailing metadata.
|
|
47
|
+
*/
|
|
48
|
+
badge?: string | number;
|
|
49
|
+
/**
|
|
50
|
+
* Keyboard shortcut label.
|
|
51
|
+
*/
|
|
52
|
+
shortcut?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Additional trailing content.
|
|
55
|
+
*/
|
|
56
|
+
adornment?: string | number | Node;
|
|
57
|
+
/**
|
|
58
|
+
* APG role.
|
|
59
|
+
*/
|
|
60
|
+
role?: MenuItemRole;
|
|
61
|
+
/**
|
|
62
|
+
* Checked state for checkbox/radio roles.
|
|
63
|
+
*/
|
|
64
|
+
checked?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Selection callback.
|
|
67
|
+
*/
|
|
68
|
+
onselect?: (value: unknown, item: MenuItem, controller: MenuController) => void;
|
|
69
|
+
};
|
|
70
|
+
export type MenuHeading = {
|
|
71
|
+
/**
|
|
72
|
+
* Entry kind.
|
|
73
|
+
*/
|
|
74
|
+
type: 'heading';
|
|
75
|
+
/**
|
|
76
|
+
* Visible heading.
|
|
77
|
+
*/
|
|
78
|
+
label: string;
|
|
79
|
+
};
|
|
80
|
+
export type MenuSeparator = {
|
|
81
|
+
type: 'separator';
|
|
82
|
+
};
|
|
83
|
+
export type MenuEntry = MenuItem | MenuHeading | MenuSeparator | '-';
|
|
84
|
+
/** @typedef {'menuitem'|'menuitemcheckbox'|'menuitemradio'} MenuItemRole */
|
|
85
|
+
/**
|
|
86
|
+
* @typedef {Object} MenuController
|
|
87
|
+
* @property {() => unknown} close Close the owning menu.
|
|
88
|
+
*/
|
|
89
|
+
/**
|
|
90
|
+
* @typedef {Object} MenuItem
|
|
91
|
+
* @property {string} label Item label.
|
|
92
|
+
* @property {string} [icon] Kernel icon name.
|
|
93
|
+
* @property {unknown} [value] Value emitted on selection.
|
|
94
|
+
* @property {boolean} [disabled=false] Whether selection is disabled.
|
|
95
|
+
* @property {boolean} [danger=false] Whether the action is dangerous.
|
|
96
|
+
* @property {string} [href] Native-link destination.
|
|
97
|
+
* @property {string} [target] Native-link target.
|
|
98
|
+
* @property {string} [rel] Native-link relationship.
|
|
99
|
+
* @property {string} [description] Supporting text under the label.
|
|
100
|
+
* @property {string|number} [badge] Compact trailing metadata.
|
|
101
|
+
* @property {string} [shortcut] Keyboard shortcut label.
|
|
102
|
+
* @property {string|number|Node} [adornment] Additional trailing content.
|
|
103
|
+
* @property {MenuItemRole} [role='menuitem'] APG role.
|
|
104
|
+
* @property {boolean} [checked=false] Checked state for checkbox/radio roles.
|
|
105
|
+
* @property {(value: unknown, item: MenuItem, controller: MenuController) => void} [onselect]
|
|
106
|
+
* Selection callback.
|
|
107
|
+
*/
|
|
108
|
+
/**
|
|
109
|
+
* @typedef {Object} MenuHeading
|
|
110
|
+
* @property {'heading'} type Entry kind.
|
|
111
|
+
* @property {string} label Visible heading.
|
|
112
|
+
*/
|
|
113
|
+
/** @typedef {{type: 'separator'}} MenuSeparator */
|
|
114
|
+
/** @typedef {MenuItem|MenuHeading|MenuSeparator|'-'} MenuEntry */
|
|
115
|
+
export declare const MENU_ITEM_SELECTOR: string;
|
|
116
|
+
/**
|
|
117
|
+
* Reports whether an entry is an interactive menu action.
|
|
118
|
+
* @param {MenuEntry|unknown} entry Candidate entry.
|
|
119
|
+
* @returns {entry is MenuItem}
|
|
120
|
+
*/
|
|
121
|
+
export declare function isMenuItem(entry: MenuEntry | unknown): entry is MenuItem;
|
|
122
|
+
/**
|
|
123
|
+
* Resolves the only APG roles accepted by the shared action model.
|
|
124
|
+
* @param {MenuItem} item Item definition.
|
|
125
|
+
* @returns {MenuItemRole}
|
|
126
|
+
*/
|
|
127
|
+
export declare function menuItemRole(item: MenuItem): MenuItemRole;
|
|
128
|
+
/**
|
|
129
|
+
* Builds one menu's entries with shared structure and link safety.
|
|
130
|
+
* @param {MenuEntry[]} entries Entry definitions.
|
|
131
|
+
* @param {string} block CSS block name, without the `zx-` prefix.
|
|
132
|
+
* @returns {HTMLElement[]}
|
|
133
|
+
*/
|
|
134
|
+
export declare function renderMenuEntries(entries: MenuEntry[], block: string): HTMLElement[];
|
|
@@ -63,3 +63,9 @@ export type ZeyosFacade = {
|
|
|
63
63
|
* @returns {ZeyosFacade} Bound facade.
|
|
64
64
|
*/
|
|
65
65
|
export declare function connect(client: Record<string, any>, { onError, locale }?: ConnectOptions): ZeyosFacade;
|
|
66
|
+
/**
|
|
67
|
+
* The text a failed request is reported with: the error's own message, or a generic sentence.
|
|
68
|
+
* @param {unknown} error Rejection reason.
|
|
69
|
+
* @returns {string}
|
|
70
|
+
*/
|
|
71
|
+
export declare function errorMessage(error: unknown): string;
|
|
@@ -12,6 +12,17 @@ export type ZeyosFormOptions = {
|
|
|
12
12
|
* Per-field label overrides.
|
|
13
13
|
*/
|
|
14
14
|
labels?: Record<string, string>;
|
|
15
|
+
/**
|
|
16
|
+
* Per-field semantic format overrides, such as
|
|
17
|
+
* `{ duedate: 'date' }` for a Unix-second field that holds a calendar day.
|
|
18
|
+
*/
|
|
19
|
+
formats?: Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* IANA time zone of the ZeyOS instance. A date-only field's stored
|
|
22
|
+
* midnight is read as the calendar day it names in this zone, and a picked day is saved as midnight
|
|
23
|
+
* in it; defaults to the runtime's own zone.
|
|
24
|
+
*/
|
|
25
|
+
timeZone?: string;
|
|
15
26
|
/**
|
|
16
27
|
* Fieldset legend.
|
|
17
28
|
*/
|
|
@@ -32,6 +43,17 @@ export type ZeyosFormOptions = {
|
|
|
32
43
|
* Success callback.
|
|
33
44
|
*/
|
|
34
45
|
onSaved?: (record: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Element or selector whose theme scope shows the
|
|
48
|
+
* binding's toasts — the save confirmation and the report of a failed request. Null uses the form's
|
|
49
|
+
* own element, so a form inside a scoped shell or dialog toasts inside that scope.
|
|
50
|
+
*/
|
|
51
|
+
scope?: Element | string | null;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the binding raises toasts. `false` keeps it silent:
|
|
54
|
+
* `save()`, `load()`, and `ready` still resolve or reject, and reporting is the caller's.
|
|
55
|
+
*/
|
|
56
|
+
notify?: boolean;
|
|
35
57
|
};
|
|
36
58
|
export type ZeyosFormConfig = {
|
|
37
59
|
/**
|
|
@@ -54,11 +76,13 @@ export type ZeyosFormConfig = {
|
|
|
54
76
|
*/
|
|
55
77
|
formOptions: Record<string, any>;
|
|
56
78
|
/**
|
|
57
|
-
* Maps Unix
|
|
79
|
+
* Maps Unix
|
|
80
|
+
* seconds to Date values: a date-only field to local midnight of its calendar day in `timeZone`.
|
|
58
81
|
*/
|
|
59
82
|
mapFromRecord: (record: Record<string, unknown>) => Record<string, unknown>;
|
|
60
83
|
/**
|
|
61
|
-
* Maps Date and
|
|
84
|
+
* Maps Date and
|
|
85
|
+
* enum values to API storage values: a date-only field to midnight of its day in `timeZone`.
|
|
62
86
|
*/
|
|
63
87
|
mapToRecord: (values: Record<string, unknown>) => Record<string, unknown>;
|
|
64
88
|
};
|
|
@@ -76,7 +100,8 @@ export type ZeyosFormBinding = {
|
|
|
76
100
|
*/
|
|
77
101
|
load: (id: unknown) => Promise<Record<string, unknown>>;
|
|
78
102
|
/**
|
|
79
|
-
* Validates and creates or updates the
|
|
103
|
+
* Validates and creates or updates the
|
|
104
|
+
* record, then confirms with a toast in the form's scope unless `notify` is false.
|
|
80
105
|
*/
|
|
81
106
|
save: () => Promise<Record<string, unknown> | null>;
|
|
82
107
|
/**
|
|
@@ -93,11 +118,21 @@ export type ZeyosFormBinding = {
|
|
|
93
118
|
* @property {string[]} [fields] Curated ordered field allow-list.
|
|
94
119
|
* @property {string[]} [exclude] Field ids to omit.
|
|
95
120
|
* @property {Record<string, string>} [labels] Per-field label overrides.
|
|
121
|
+
* @property {Record<string, string>} [formats] Per-field semantic format overrides, such as
|
|
122
|
+
* `{ duedate: 'date' }` for a Unix-second field that holds a calendar day.
|
|
123
|
+
* @property {string} [timeZone] IANA time zone of the ZeyOS instance. A date-only field's stored
|
|
124
|
+
* midnight is read as the calendar day it names in this zone, and a picked day is saved as midnight
|
|
125
|
+
* in it; defaults to the runtime's own zone.
|
|
96
126
|
* @property {string} [title=''] Fieldset legend.
|
|
97
127
|
* @property {1|2|3} [columns=2] Fieldset column count.
|
|
98
128
|
* @property {Record<string, unknown>} [value] Initial record using ZeyOS storage values.
|
|
99
129
|
* @property {unknown} [id] Initial record id to load.
|
|
100
130
|
* @property {(record: Record<string, unknown>) => unknown|Promise<unknown>} [onSaved] Success callback.
|
|
131
|
+
* @property {Element|string|null} [scope=null] Element or selector whose theme scope shows the
|
|
132
|
+
* binding's toasts — the save confirmation and the report of a failed request. Null uses the form's
|
|
133
|
+
* own element, so a form inside a scoped shell or dialog toasts inside that scope.
|
|
134
|
+
* @property {boolean} [notify=true] Whether the binding raises toasts. `false` keeps it silent:
|
|
135
|
+
* `save()`, `load()`, and `ready` still resolve or reject, and reporting is the caller's.
|
|
101
136
|
*/
|
|
102
137
|
/**
|
|
103
138
|
* @typedef {Object} ZeyosFormConfig
|
|
@@ -105,22 +140,26 @@ export type ZeyosFormBinding = {
|
|
|
105
140
|
* @property {Record<string, Record<string, any>>} fields Field descriptors keyed by id.
|
|
106
141
|
* @property {Array<{id: string, resource: string}>} entityFields Referenced-resource fields.
|
|
107
142
|
* @property {Record<string, any>} formOptions Plain Zx Form options.
|
|
108
|
-
* @property {(record: Record<string, unknown>) => Record<string, unknown>} mapFromRecord Maps Unix
|
|
109
|
-
*
|
|
143
|
+
* @property {(record: Record<string, unknown>) => Record<string, unknown>} mapFromRecord Maps Unix
|
|
144
|
+
* seconds to Date values: a date-only field to local midnight of its calendar day in `timeZone`.
|
|
145
|
+
* @property {(values: Record<string, unknown>) => Record<string, unknown>} mapToRecord Maps Date and
|
|
146
|
+
* enum values to API storage values: a date-only field to midnight of its day in `timeZone`.
|
|
110
147
|
*/
|
|
111
148
|
/**
|
|
112
149
|
* @typedef {Object} ZeyosFormBinding
|
|
113
150
|
* @property {Form} form Generated Zx form.
|
|
114
151
|
* @property {Promise<Record<string, unknown>|null>} ready Initial value/load readiness.
|
|
115
152
|
* @property {(id: unknown) => Promise<Record<string, unknown>>} load Loads and maps one record.
|
|
116
|
-
* @property {() => Promise<Record<string, unknown>|null>} save Validates and creates or updates the
|
|
153
|
+
* @property {() => Promise<Record<string, unknown>|null>} save Validates and creates or updates the
|
|
154
|
+
* record, then confirms with a toast in the form's scope unless `notify` is false.
|
|
117
155
|
* @property {() => Form} getForm Returns the generated Zx Form.
|
|
118
156
|
* @property {() => void} destroy Destroys the form and all owned fields/selects.
|
|
119
157
|
*/
|
|
120
158
|
/**
|
|
121
159
|
* Builds the DOM-free form configuration consumed by {@link zeyosForm}. Entity descriptors retain
|
|
122
160
|
* the `zxselect` type and receive the same async options used by {@link zeyosSelect}; enum options
|
|
123
|
-
* come from normalized schema metadata, and the returned mappers handle
|
|
161
|
+
* come from normalized schema metadata with readable labels, and the returned mappers handle
|
|
162
|
+
* Unix-second dates — date-only fields as calendar days in `opts.timeZone`.
|
|
124
163
|
* @param {Record<string, any>} client Injected ZeyOS client instance.
|
|
125
164
|
* @param {string} resource Resource name such as `transactions`.
|
|
126
165
|
* @param {ZeyosFormOptions} [opts={}] Schema curation and layout options.
|
|
@@ -130,8 +169,10 @@ export declare function buildZeyosFormConfig(client: Record<string, any>, resour
|
|
|
130
169
|
/**
|
|
131
170
|
* Generates a schema-driven Zx Form and a small async binding object. `load(id)` hydrates entity
|
|
132
171
|
* labels and converts Unix seconds to Date objects. `save()` validates, maps values back to API
|
|
133
|
-
* storage types, calls create/update through the WP14 connection facade,
|
|
134
|
-
*
|
|
172
|
+
* storage types, calls create/update through the WP14 connection facade, invokes
|
|
173
|
+
* `onSaved(record)`, and shows a success toast. Its toasts — that confirmation and the report of a
|
|
174
|
+
* failed request — appear in the theme scope of `opts.scope` or of the form itself, and
|
|
175
|
+
* `notify: false` silences them. Await `ready` when `opts.id` or `opts.value` is supplied.
|
|
135
176
|
* @param {Record<string, any>} client Injected ZeyOS client instance.
|
|
136
177
|
* @param {string} resource Resource name such as `transactions`.
|
|
137
178
|
* @param {ZeyosFormOptions} [opts={}] Schema, initial value, and save options.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module zx/zeyos
|
|
4
4
|
*/
|
|
5
5
|
export { fieldToZxField, fieldToZxColumn, resolveFields, registerFieldType } from './schema.js';
|
|
6
|
-
export { buildListQuery, tableSortToQuery, dataFilterStateToFilters, dateToUnixSeconds, unixSecondsToDate } from './query.js';
|
|
6
|
+
export { buildListQuery, tableSortToQuery, dataFilterStateToFilters, dateToUnixSeconds, unixSecondsToDate, calendarDayToUnixSeconds, unixSecondsToCalendarDay } from './query.js';
|
|
7
7
|
export { connect } from './connect.js';
|
|
8
8
|
export { zeyosModules, moduleAliases, moduleInfo, moduleColor, moduleIconName, moduleKeys, moduleGlyphColor, normalizeModuleName, registerModules } from './modules.js';
|
|
9
9
|
export { ZEYOS_ICON_KIT, useZeyosIcons, moduleIcon, moduleChip, zeyosAppIcon } from './icons.js';
|
|
@@ -129,6 +129,85 @@ export declare function dateToUnixSeconds(date: Date | null | undefined): number
|
|
|
129
129
|
* @returns {Date|null} Date value, or null for a nullish input.
|
|
130
130
|
*/
|
|
131
131
|
export declare function unixSecondsToDate(seconds: number | string | null | undefined): Date | null;
|
|
132
|
+
export type CalendarDay = {
|
|
133
|
+
/**
|
|
134
|
+
* Full year.
|
|
135
|
+
*/
|
|
136
|
+
year: number;
|
|
137
|
+
/**
|
|
138
|
+
* Zero-based month, as `Date` counts them.
|
|
139
|
+
*/
|
|
140
|
+
month: number;
|
|
141
|
+
/**
|
|
142
|
+
* Day of the month.
|
|
143
|
+
*/
|
|
144
|
+
day: number;
|
|
145
|
+
};
|
|
146
|
+
export type CalendarZone = {
|
|
147
|
+
/**
|
|
148
|
+
* Canonical IANA zone, or undefined for the runtime's own zone.
|
|
149
|
+
*/
|
|
150
|
+
timeZone: string | undefined;
|
|
151
|
+
/**
|
|
152
|
+
* Calendar day an instant falls on in the zone.
|
|
153
|
+
*/
|
|
154
|
+
dayOf: (milliseconds: number) => CalendarDay;
|
|
155
|
+
/**
|
|
156
|
+
* Epoch milliseconds of
|
|
157
|
+
* the first moment of a calendar day in the zone (its midnight, or the first minute after a
|
|
158
|
+
* daylight-saving gap that swallows midnight).
|
|
159
|
+
*/
|
|
160
|
+
midnightOf: (year: number, month: number, day: number) => number;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* @typedef {Object} CalendarDay
|
|
164
|
+
* @property {number} year Full year.
|
|
165
|
+
* @property {number} month Zero-based month, as `Date` counts them.
|
|
166
|
+
* @property {number} day Day of the month.
|
|
167
|
+
*/
|
|
168
|
+
/**
|
|
169
|
+
* @typedef {Object} CalendarZone
|
|
170
|
+
* @property {string|undefined} timeZone Canonical IANA zone, or undefined for the runtime's own zone.
|
|
171
|
+
* @property {(milliseconds: number) => CalendarDay} dayOf Calendar day an instant falls on in the zone.
|
|
172
|
+
* @property {(year: number, month: number, day: number) => number} midnightOf Epoch milliseconds of
|
|
173
|
+
* the first moment of a calendar day in the zone (its midnight, or the first minute after a
|
|
174
|
+
* daylight-saving gap that swallows midnight).
|
|
175
|
+
*/
|
|
176
|
+
/**
|
|
177
|
+
* Reads a ZeyOS date-only value as the calendar day it names. Date-only fields — an invoice's
|
|
178
|
+
* `date` and `duedate`, a contact's `birthdate` — hold Unix seconds at midnight of a day in the
|
|
179
|
+
* instance's time zone: a calendar day, not an instant. The result is midnight of that same day in
|
|
180
|
+
* the runtime's own zone, which is what Datebox and DatePicker edit, so the day survives a viewer in
|
|
181
|
+
* another zone and a daylight-saving change.
|
|
182
|
+
* @param {number|string|null|undefined} seconds Unix seconds; numeric strings are accepted.
|
|
183
|
+
* @param {string} [timeZone] IANA zone of the instance, such as `Europe/Vienna`; the runtime's own
|
|
184
|
+
* zone when omitted.
|
|
185
|
+
* @returns {Date|null} Local midnight of the day, or null for a nullish or empty input.
|
|
186
|
+
*/
|
|
187
|
+
export declare function unixSecondsToCalendarDay(seconds: number | string | null | undefined, timeZone?: string): Date | null;
|
|
188
|
+
/**
|
|
189
|
+
* Converts the calendar day of a Date to the Unix seconds a ZeyOS date-only field stores: midnight
|
|
190
|
+
* of that day in the instance's time zone. Only the Date's local year, month, and day count — its
|
|
191
|
+
* time of day is ignored — so a Datebox value round-trips through {@link unixSecondsToCalendarDay}.
|
|
192
|
+
* @param {Date|null|undefined} date Day to store.
|
|
193
|
+
* @param {string} [timeZone] IANA zone of the instance; the runtime's own zone when omitted.
|
|
194
|
+
* @returns {number|null} Unix seconds, or null for a nullish input.
|
|
195
|
+
*/
|
|
196
|
+
export declare function calendarDayToUnixSeconds(date: Date | null | undefined, timeZone?: string): number | null;
|
|
197
|
+
/**
|
|
198
|
+
* Validates an IANA time-zone name.
|
|
199
|
+
* @param {unknown} timeZone Zone name; nullish or empty selects the runtime's own zone.
|
|
200
|
+
* @returns {string|undefined} The canonical zone name, or undefined for the runtime's own zone.
|
|
201
|
+
* @throws {RangeError} When the runtime does not know the zone.
|
|
202
|
+
*/
|
|
203
|
+
export declare function normalizeTimeZone(timeZone: unknown): string | undefined;
|
|
204
|
+
/**
|
|
205
|
+
* Calendar arithmetic for one time zone. The `Intl` formatter is built once, so a table column can
|
|
206
|
+
* hold one zone for all of its cells.
|
|
207
|
+
* @param {string} [timeZone] IANA zone; the runtime's own zone when omitted.
|
|
208
|
+
* @returns {CalendarZone} Day lookup and midnight construction for the zone.
|
|
209
|
+
*/
|
|
210
|
+
export declare function calendarZone(timeZone?: string): CalendarZone;
|
|
132
211
|
/**
|
|
133
212
|
* Converts one or more Zx Table sort records to the signed field notation used by ZeyOS.
|
|
134
213
|
* A missing sort produces an empty array.
|