@zeyos/zx 4.4.0 → 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.
Files changed (182) hide show
  1. package/CHANGELOG.md +283 -0
  2. package/README.md +42 -10
  3. package/dist/types/components/activity-list/activity-list.d.ts +22 -0
  4. package/dist/types/components/app-sidebar/app-sidebar.d.ts +5 -3
  5. package/dist/types/components/avatar/avatar.d.ts +46 -7
  6. package/dist/types/components/badge/badge.d.ts +21 -1
  7. package/dist/types/components/button/button.d.ts +15 -0
  8. package/dist/types/components/chart/chart.d.ts +10 -0
  9. package/dist/types/components/checklist/checklist.d.ts +9 -0
  10. package/dist/types/components/code-editor/code-editor.d.ts +6 -17
  11. package/dist/types/components/datebox/date-range-box.d.ts +5 -1
  12. package/dist/types/components/datebox/datebox.d.ts +7 -2
  13. package/dist/types/components/dialog/dialog.d.ts +46 -6
  14. package/dist/types/components/dropdown/dropdown.d.ts +2 -2
  15. package/dist/types/components/entity-ref/entity-ref.d.ts +2 -2
  16. package/dist/types/components/field/field.d.ts +24 -2
  17. package/dist/types/components/fieldset/fieldset.d.ts +19 -1
  18. package/dist/types/components/file-item/file-item.d.ts +34 -6
  19. package/dist/types/components/form/form.d.ts +12 -1
  20. package/dist/types/components/kanban-view/kanban-card.d.ts +8 -0
  21. package/dist/types/components/launcher/launcher.d.ts +260 -15
  22. package/dist/types/components/list-toolbar/list-toolbar.d.ts +1 -1
  23. package/dist/types/components/menu-button/menu-button.d.ts +33 -5
  24. package/dist/types/components/message/message.d.ts +119 -17
  25. package/dist/types/components/modal/modal.d.ts +13 -2
  26. package/dist/types/components/select/color.d.ts +12 -0
  27. package/dist/types/components/select/glyphs.d.ts +124 -0
  28. package/dist/types/components/select/select.d.ts +11 -3
  29. package/dist/types/components/stat-tile/stat-tile.d.ts +16 -5
  30. package/dist/types/components/tabbox/tabbox.d.ts +9 -0
  31. package/dist/types/components/table/table.d.ts +46 -1
  32. package/dist/types/components/tag-picker/tag-picker.d.ts +21 -4
  33. package/dist/types/components/tree/tree.d.ts +13 -0
  34. package/dist/types/core/breakpoint.d.ts +1 -1
  35. package/dist/types/core/icons.d.ts +23 -25
  36. package/dist/types/core/motion.d.ts +59 -0
  37. package/dist/types/core/overlay-host.d.ts +15 -1
  38. package/dist/types/index.d.ts +5 -3
  39. package/dist/types/zeyos/connect.d.ts +6 -0
  40. package/dist/types/zeyos/form.d.ts +50 -9
  41. package/dist/types/zeyos/index.d.ts +1 -1
  42. package/dist/types/zeyos/query.d.ts +79 -0
  43. package/dist/types/zeyos/schema.d.ts +24 -1
  44. package/dist/types/zeyos/table.d.ts +100 -14
  45. package/dist/types/zeyos/view.d.ts +10 -0
  46. package/dist/zx-zeyos.esm.js +1621 -443
  47. package/dist/zx-zeyos.esm.min.js +53 -5
  48. package/dist/zx.css +1411 -660
  49. package/dist/zx.esm.js +1976 -703
  50. package/dist/zx.esm.min.js +56 -8
  51. package/dist/zx.global.js +1978 -705
  52. package/dist/zx.global.min.js +56 -8
  53. package/dist/zx.min.css +1 -1
  54. package/docs/api.json +219 -34
  55. package/docs/llms.md +472 -110
  56. package/docs/llms.txt +3 -3
  57. package/package.json +1 -1
  58. package/src/components/account-menu/account-menu.css +35 -10
  59. package/src/components/activity-item/activity-item.css +1 -1
  60. package/src/components/activity-item/activity-item.js +3 -0
  61. package/src/components/activity-list/activity-list.css +38 -3
  62. package/src/components/activity-list/activity-list.js +34 -0
  63. package/src/components/app-icon/app-icon.css +1 -1
  64. package/src/components/app-rail/app-rail.css +40 -79
  65. package/src/components/app-sidebar/app-sidebar.css +109 -174
  66. package/src/components/app-sidebar/app-sidebar.js +21 -6
  67. package/src/components/aurora/aurora.css +5 -3
  68. package/src/components/avatar/avatar.css +32 -7
  69. package/src/components/avatar/avatar.js +72 -8
  70. package/src/components/badge/badge.css +54 -2
  71. package/src/components/badge/badge.js +29 -2
  72. package/src/components/button/button.css +67 -9
  73. package/src/components/button/button.js +38 -0
  74. package/src/components/calendar/calendar.css +46 -46
  75. package/src/components/card/card.css +2 -2
  76. package/src/components/card-view/card-view.css +9 -7
  77. package/src/components/chart/chart.css +4 -1
  78. package/src/components/chart/chart.js +12 -0
  79. package/src/components/check-button/check-button.css +10 -2
  80. package/src/components/checklist/checklist.css +9 -2
  81. package/src/components/checklist/checklist.js +11 -5
  82. package/src/components/checklist/field-adapter.js +3 -1
  83. package/src/components/code-editor/code-editor.css +6 -5
  84. package/src/components/code-editor/code-editor.js +19 -1
  85. package/src/components/context-menu/context-menu.css +9 -4
  86. package/src/components/copy/copy-button.css +6 -0
  87. package/src/components/copy/copy-input.css +8 -3
  88. package/src/components/data-filter/data-filter.css +5 -4
  89. package/src/components/date-picker/date-picker.css +6 -6
  90. package/src/components/date-picker/date-range-picker.css +3 -3
  91. package/src/components/date-picker/time-picker.css +1 -1
  92. package/src/components/datebox/date-range-box.css +79 -2
  93. package/src/components/datebox/date-range-box.js +13 -2
  94. package/src/components/datebox/datebox.css +79 -2
  95. package/src/components/datebox/datebox.js +13 -2
  96. package/src/components/dialog/dialog.css +26 -0
  97. package/src/components/dialog/dialog.js +99 -17
  98. package/src/components/dropdown/dropdown.css +1 -1
  99. package/src/components/dropdown/dropdown.js +5 -3
  100. package/src/components/empty-state/empty-state.css +2 -2
  101. package/src/components/entity-ref/entity-ref.css +1 -1
  102. package/src/components/entity-ref/entity-ref.js +1 -1
  103. package/src/components/field/field.css +28 -9
  104. package/src/components/field/field.js +68 -26
  105. package/src/components/field-upload/field-upload.css +1 -1
  106. package/src/components/fieldset/fieldset.css +5 -3
  107. package/src/components/fieldset/fieldset.js +28 -5
  108. package/src/components/file-item/file-item.js +144 -10
  109. package/src/components/filter/filter.js +7 -3
  110. package/src/components/filter-panel/filter-panel.css +1 -1
  111. package/src/components/finder/finder.css +15 -13
  112. package/src/components/form/form.css +5 -4
  113. package/src/components/form/form.js +11 -2
  114. package/src/components/grid/grid.css +1 -1
  115. package/src/components/groupbox/groupbox.css +1 -1
  116. package/src/components/kanban-view/kanban-card.js +11 -3
  117. package/src/components/kanban-view/kanban-view.css +39 -15
  118. package/src/components/kanban-view/kanban-view.js +4 -4
  119. package/src/components/launcher/launcher.css +107 -25
  120. package/src/components/launcher/launcher.js +503 -41
  121. package/src/components/list-toolbar/list-toolbar.css +13 -8
  122. package/src/components/list-toolbar/list-toolbar.js +1 -1
  123. package/src/components/master-panel/master-panel.css +2 -0
  124. package/src/components/menu-button/menu-button.css +9 -4
  125. package/src/components/menu-button/menu-button.js +65 -9
  126. package/src/components/message/message.css +33 -3
  127. package/src/components/message/message.js +217 -15
  128. package/src/components/modal/modal.js +18 -3
  129. package/src/components/navigation-bar/navigation-bar.css +18 -9
  130. package/src/components/number-field/field-adapter.js +1 -0
  131. package/src/components/number-field/number-field.css +70 -0
  132. package/src/components/number-field/number-field.js +2 -0
  133. package/src/components/pagination/pagination.css +8 -6
  134. package/src/components/panel/panel.css +1 -1
  135. package/src/components/rating/rating.css +7 -0
  136. package/src/components/select/color.js +22 -0
  137. package/src/components/select/field-adapter.js +2 -0
  138. package/src/components/select/glyphs.js +165 -0
  139. package/src/components/select/select.css +138 -45
  140. package/src/components/select/select.js +83 -47
  141. package/src/components/sheet/sheet.css +11 -8
  142. package/src/components/slider/slider.css +16 -2
  143. package/src/components/slider/slider.js +1 -1
  144. package/src/components/sort-control/sort-control.css +4 -1
  145. package/src/components/stat-tile/stat-tile.css +41 -46
  146. package/src/components/stat-tile/stat-tile.js +17 -6
  147. package/src/components/tabbox/tabbox.css +32 -27
  148. package/src/components/tabbox/tabbox.js +5 -1
  149. package/src/components/table/table.css +104 -29
  150. package/src/components/table/table.js +90 -16
  151. package/src/components/tag-picker/tag-picker.css +83 -5
  152. package/src/components/tag-picker/tag-picker.js +25 -8
  153. package/src/components/timebox/timebox.css +22 -2
  154. package/src/components/toggle/toggle.css +12 -1
  155. package/src/components/toolbar/toolbar.js +2 -2
  156. package/src/components/tooltip/tooltip.css +4 -0
  157. package/src/components/tooltip/tooltip.js +10 -3
  158. package/src/components/tree/tree.css +25 -16
  159. package/src/components/tree/tree.js +31 -0
  160. package/src/components/value-list/value-list.css +3 -3
  161. package/src/components/view/record-view.js +1 -1
  162. package/src/core/breakpoint.js +1 -1
  163. package/src/core/icons.js +193 -60
  164. package/src/core/motion.js +147 -0
  165. package/src/core/overlay-host.js +21 -2
  166. package/src/index.js +5 -3
  167. package/src/internal/app-rail.js +1 -2
  168. package/src/zeyos/connect.js +6 -2
  169. package/src/zeyos/form.js +67 -27
  170. package/src/zeyos/index.js +1 -1
  171. package/src/zeyos/query.js +153 -0
  172. package/src/zeyos/schema.js +144 -27
  173. package/src/zeyos/table.js +68 -5
  174. package/src/zeyos/view.js +6 -0
  175. package/styles/base.css +56 -0
  176. package/styles/icons.css +11 -1
  177. package/styles/tokens/dark.css +113 -37
  178. package/styles/tokens/global.css +121 -27
  179. package/styles/tokens/semantic.css +100 -31
  180. package/styles/tokens/themes.css +7 -6
  181. package/styles/zx.css +0 -1
  182. package/styles/tokens/density.css +0 -9
@@ -5,7 +5,7 @@
5
5
  * used inside a media query, so a `--zx-bp-*` token would be a value no stylesheet could read.
6
6
  * Zx's own layout utilities avoid the problem entirely — `.zx-grid` reflows on intrinsic track
7
7
  * widths, not on breakpoints — which leaves this module for the cases only script can decide:
8
- * rendering a Table as cards below a width, collapsing a MasterPanel, choosing a chart density.
8
+ * rendering a Table as cards below a width, collapsing a MasterPanel, choosing how many labels a chart shows.
9
9
  * @module zx/core/breakpoint
10
10
  */
11
11
  export type BreakpointName = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
@@ -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 stylesheet, no font.
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
  *
@@ -40,28 +41,16 @@ export type IconOptions = {
40
41
  */
41
42
  strict?: boolean;
42
43
  };
44
+ export type IconPaint = 'fill' | 'stroke';
45
+ export type IconGlyph = [string, string] | [string, string, IconPaint];
43
46
  /**
44
- * @typedef {Object} IconOptions
45
- * @property {number|string} [size=16] Rendered width and height.
46
- * @property {string|null} [label=null] Accessible label; null marks the icon decorative.
47
- * @property {string|string[]} [class] Extra class names added to the element.
48
- * @property {string} [style] Font Awesome style for this icon only (`'solid'`, `'duotone'`, …).
49
- * @property {string} [family] Font Awesome family for this icon only (`'classic'`, `'sharp'`, …).
50
- * @property {boolean} [fixedWidth] Adds Font Awesome's `fa-fw` for column-aligned glyphs.
51
- * @property {boolean} [strict=false] Throws `RangeError` on a name the bundled glyph set does not
52
- * carry, instead of returning the placeholder. For call sites that can afford to fail — a test,
53
- * a build-time check — rather than a screen rendering server data.
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
- /**
56
- * Icon glyphs from Font Awesome Free 6 (solid, plus `square` from regular), fontawesome.com,
57
- * licensed CC BY 4.0 (https://fontawesome.com/license/free). Path data is embedded unmodified so
58
- * the library carries no webfont, stylesheet, or package dependency. Each entry is
59
- * `[viewBox, path]`; Font Awesome glyphs are filled (not stroked) and use per-glyph 512-unit view
60
- * boxes — outlines such as `square` are a filled path with a counter-wound hole.
61
- * Extend the set with `registerIcons()`; read every available name with `iconNames()`.
62
- * @type {Readonly<Record<string, [string, string]>>}
63
- */
64
- export declare const icons: Readonly<Record<string, [string, string]>>;
53
+ export declare const icons: Readonly<Record<string, IconGlyph>>;
65
54
  export type IconConfig = {
66
55
  /**
67
56
  * Renderer used for bare icon names.
@@ -120,12 +109,21 @@ export declare function loadFontAwesome(options: string | (Partial<Omit<IconConf
120
109
  activate?: boolean;
121
110
  })): Promise<IconConfig>;
122
111
  /**
123
- * Adds inline SVG glyphs to the built-in set, or replaces existing ones. Entries use the same
124
- * `[viewBox, path]` shape as `icons`.
125
- * @param {Record<string, [string, string]>} glyphs Glyphs keyed by icon name.
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.
126
122
  * @returns {void}
123
+ * @throws {TypeError} When an entry is neither a `[viewBox, path]` pair nor a
124
+ * `[viewBox, path, 'fill'|'stroke']` triple.
127
125
  */
128
- export declare function registerIcons(glyphs: Record<string, [string, string]>): void;
126
+ export declare function registerIcons(glyphs: Record<string, IconGlyph>): void;
129
127
  /**
130
128
  * Lists every inline SVG glyph name available, built-in and registered.
131
129
  * @returns {string[]} Sorted icon names.
@@ -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, density, material, and product
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;
@@ -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';
@@ -53,7 +54,7 @@ export { Pagination, paginationRange } from './components/pagination/pagination.
53
54
  export { Search } from './components/search/search.js';
54
55
  export { AppIcon, appIcon } from './components/app-icon/app-icon.js';
55
56
  export { Launcher, rankLauncherItems } from './components/launcher/launcher.js';
56
- export { Avatar, avatarInitials } from './components/avatar/avatar.js';
57
+ export { AVATAR_TONES, Avatar, avatarInitials, avatarTone } from './components/avatar/avatar.js';
57
58
  export { EntityRef, normalizeEntityRef, normalizeEntityRefLink, normalizeEntityRefMetadata, normalizeEntityRefActions } from './components/entity-ref/entity-ref.js';
58
59
  export { FileItem, normalizeFileItem } from './components/file-item/file-item.js';
59
60
  export { FileList, normalizeFileListItems } from './components/file-list/file-list.js';
@@ -72,6 +73,7 @@ export { Tooltip, tooltip, describe } from './components/tooltip/tooltip.js';
72
73
  export { MenuButton } from './components/menu-button/menu-button.js';
73
74
  export { ContextMenu } from './components/context-menu/context-menu.js';
74
75
  export { Select } from './components/select/select.js';
76
+ export { statusIcon, priorityIcon } from './components/select/glyphs.js';
75
77
  export { Checklist } from './components/checklist/checklist.js';
76
78
  export { TagPicker } from './components/tag-picker/tag-picker.js';
77
79
  export { NumberField, parseNumber, snapNumber } from './components/number-field/number-field.js';
@@ -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 seconds to Date values.
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 enum values to API storage values.
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 record.
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 seconds to Date values.
109
- * @property {(values: Record<string, unknown>) => Record<string, unknown>} mapToRecord Maps Date and enum values to API storage values.
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 record.
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 Unix-second dates.
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, shows a success toast,
134
- * and invokes `onSaved(record)`. Await `ready` when `opts.id` or `opts.value` is supplied.
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.
@@ -22,6 +22,19 @@ export type ResolveFieldOptions = {
22
22
  * Per-field label overrides.
23
23
  */
24
24
  labels?: Record<string, string>;
25
+ /**
26
+ * Per-field semantic format overrides (`date`,
27
+ * `datetime`, `money`, or any registered key). The schema types a timestamp only by its storage,
28
+ * so this is how a Unix-second field the built-in rules misread is declared a calendar day
29
+ * (`date`) or an instant (`datetime`).
30
+ */
31
+ formats?: Record<string, string>;
32
+ /**
33
+ * IANA time zone of the ZeyOS instance, such as `Europe/Vienna`.
34
+ * Date-only fields store midnight of a calendar day in this zone; it is copied onto every field's
35
+ * metadata as `timeZone`. Defaults to the runtime's own zone.
36
+ */
37
+ timeZone?: string;
25
38
  };
26
39
  /** @typedef {Record<string, unknown>} FieldMeta */
27
40
  /**
@@ -34,6 +47,13 @@ export type ResolveFieldOptions = {
34
47
  * @property {string[]} [fields] Curated allow-list; its order becomes the output order.
35
48
  * @property {string[]} [exclude] Field ids to omit.
36
49
  * @property {Record<string, string>} [labels] Per-field label overrides.
50
+ * @property {Record<string, string>} [formats] Per-field semantic format overrides (`date`,
51
+ * `datetime`, `money`, or any registered key). The schema types a timestamp only by its storage,
52
+ * so this is how a Unix-second field the built-in rules misread is declared a calendar day
53
+ * (`date`) or an instant (`datetime`).
54
+ * @property {string} [timeZone] IANA time zone of the ZeyOS instance, such as `Europe/Vienna`.
55
+ * Date-only fields store midnight of a calendar day in this zone; it is copied onto every field's
56
+ * metadata as `timeZone`. Defaults to the runtime's own zone.
37
57
  */
38
58
  /**
39
59
  * Extensible ZeyOS semantic/DB type registry. Keys are normalized to lowercase. Built-in choices:
@@ -61,7 +81,8 @@ export declare function fieldToZxField(meta: FieldMeta): Record<string, unknown>
61
81
  /**
62
82
  * Converts normalized ZeyOS field metadata to a Zx Table column configuration. Renderers return
63
83
  * strings only (never DOM): references/enums show labels, numeric columns are right-aligned,
64
- * booleans show a check, and Unix seconds are formatted as dates.
84
+ * booleans show a check, and Unix seconds are formatted as dates — a date-only field as the
85
+ * calendar day it names in `meta.timeZone`, with no time; a date-time field with its time.
65
86
  * @param {FieldMeta} meta Normalized metadata containing at least `id` or `name`.
66
87
  * @returns {Record<string, unknown>} Plain Zx Table column descriptor.
67
88
  */
@@ -71,6 +92,8 @@ export declare function fieldToZxColumn(meta: FieldMeta): Record<string, unknown
71
92
  * client returns names from `schema.fields(resource)` and definitions from
72
93
  * `schema.describe(resource).fields`; embedded `enum` data is authoritative. A compatible
73
94
  * `schema.enums(resource, field)` is used when supplied by another client version/stub.
95
+ * `formats` overrides a field's semantic `format`, and `timeZone` is validated once and copied
96
+ * onto every field.
74
97
  * @param {Record<string, any>} client Injected `@zeyos/client` instance.
75
98
  * @param {string} resource Schema resource name such as `tickets`.
76
99
  * @param {ResolveFieldOptions} [opts={}] Curation options.
@@ -1,4 +1,5 @@
1
1
  import { Table } from '../index.js';
2
+ export type TableOptions = import('../components/table/table.js').TableOptions;
2
3
  export type ZeyosTableOptions = {
3
4
  /**
4
5
  * Curated ordered field allow-list.
@@ -8,6 +9,16 @@ export type ZeyosTableOptions = {
8
9
  * Per-field label overrides.
9
10
  */
10
11
  labels?: Record<string, string>;
12
+ /**
13
+ * Per-field semantic format overrides, such as
14
+ * `{ duedate: 'date' }` for a Unix-second field that holds a calendar day.
15
+ */
16
+ formats?: Record<string, string>;
17
+ /**
18
+ * IANA time zone of the ZeyOS instance. Date-only columns show the
19
+ * calendar day their stored midnight names in this zone; defaults to the runtime's own zone.
20
+ */
21
+ timeZone?: string;
11
22
  /**
12
23
  * Row id accessor.
13
24
  */
@@ -43,6 +54,91 @@ export type ZeyosTableOptions = {
43
54
  * Row activation callback.
44
55
  */
45
56
  onRowClick?: (row: Record<string, unknown>, event: CustomEvent<Record<string, unknown>>) => void;
57
+ /**
58
+ * Table frame treatment; `'plain'` for a
59
+ * table inside a pane or card that already draws the box.
60
+ */
61
+ variant?: TableOptions['variant'];
62
+ /**
63
+ * Whether alternate rows use the zebra background.
64
+ */
65
+ zebra?: boolean;
66
+ /**
67
+ * Whether column headers stick while scrolling.
68
+ */
69
+ stickyHeader?: boolean;
70
+ /**
71
+ * Width below which rows stack.
72
+ */
73
+ responsive?: TableOptions['responsive'];
74
+ /**
75
+ * Rows rendered at first from a loaded page.
76
+ */
77
+ growing?: TableOptions['growing'];
78
+ /**
79
+ * What the table shows with no rows.
80
+ */
81
+ emptyText?: TableOptions['emptyText'];
82
+ /**
83
+ * Additional row class callback.
84
+ */
85
+ rowClass?: TableOptions['rowClass'];
86
+ /**
87
+ * Row property or callback naming each row's kind.
88
+ */
89
+ rowKind?: TableOptions['rowKind'];
90
+ /**
91
+ * Presentation per row kind.
92
+ */
93
+ rowKinds?: TableOptions['rowKinds'];
94
+ /**
95
+ * Whether a column visibility chooser is rendered.
96
+ */
97
+ columnVisibility?: boolean;
98
+ /**
99
+ * Whether the column chooser exposes reorder controls.
100
+ */
101
+ columnReorder?: boolean;
102
+ /**
103
+ * Initially hidden column ids.
104
+ */
105
+ hiddenColumns?: string[];
106
+ /**
107
+ * Table `rowclick` listener, beside `onRowClick`.
108
+ */
109
+ onrowclick?: TableOptions['onrowclick'];
110
+ /**
111
+ * Table `rowdblclick` listener.
112
+ */
113
+ onrowdblclick?: TableOptions['onrowdblclick'];
114
+ /**
115
+ * Table `sort` listener; the binding reloads either way.
116
+ */
117
+ onsort?: TableOptions['onsort'];
118
+ /**
119
+ * Table `selectionchange` listener.
120
+ */
121
+ onselectionchange?: TableOptions['onselectionchange'];
122
+ /**
123
+ * Table `datachange` listener.
124
+ */
125
+ ondatachange?: TableOptions['ondatachange'];
126
+ /**
127
+ * Table `stackedchange` listener.
128
+ */
129
+ onstackedchange?: TableOptions['onstackedchange'];
130
+ /**
131
+ * Table `grow` listener.
132
+ */
133
+ ongrow?: TableOptions['ongrow'];
134
+ /**
135
+ * Table `columnvisibilitychange` listener.
136
+ */
137
+ oncolumnvisibilitychange?: TableOptions['oncolumnvisibilitychange'];
138
+ /**
139
+ * Table `columnorderchange` listener.
140
+ */
141
+ oncolumnorderchange?: TableOptions['oncolumnorderchange'];
46
142
  };
47
143
  export type ZeyosTableConfig = {
48
144
  /**
@@ -136,19 +232,6 @@ export type ZeyosTableBinding = {
136
232
  */
137
233
  destroy: () => void;
138
234
  };
139
- /**
140
- * @typedef {Object} ZeyosTableOptions
141
- * @property {string[]} [fields] Curated ordered field allow-list.
142
- * @property {Record<string, string>} [labels] Per-field label overrides.
143
- * @property {string|((row: Record<string, unknown>) => unknown)} [rowId='ID'] Row id accessor.
144
- * @property {number} [pageSize=50] Server page size.
145
- * @property {{id: string, dir: 'asc'|'desc'}|null} [sort=null] Initial server sort.
146
- * @property {Record<string, unknown>} [filters] Initial ZeyOS predicates.
147
- * @property {string} [search=''] Initial full-text query.
148
- * @property {false|'single'|'multi'} [selectable=false] Row selection mode.
149
- * @property {number|string|null} [height=null] Table scroll-region height.
150
- * @property {(row: Record<string, unknown>, event: CustomEvent<Record<string, unknown>>) => void} [onRowClick] Row activation callback.
151
- */
152
235
  /**
153
236
  * @typedef {Object} ZeyosTableConfig
154
237
  * @property {Record<string, any>[]} fieldMeta Ordered normalized schema metadata.
@@ -186,7 +269,8 @@ export type ZeyosTableBinding = {
186
269
  * Builds the DOM-free schema-derived columns and Table options used by {@link zeyosTable}. Entity
187
270
  * projections include an `<field>_label` alias from a real label field on the referenced resource.
188
271
  * Amount fields use each row's real `currency` value for display while retaining the WP14 typed
189
- * column strategy and right alignment.
272
+ * column strategy and right alignment. Enum columns show labels, date-only columns calendar days in
273
+ * `timeZone`, and Table presentation options and listeners pass through to `tableOptions`.
190
274
  * @param {Record<string, any>} client Injected ZeyOS client instance.
191
275
  * @param {string} resource Resource name such as `transactions`.
192
276
  * @param {ZeyosTableOptions} [opts={}] Schema, table, and initial query options.
@@ -197,6 +281,8 @@ export declare function buildZeyosTableConfig(client: Record<string, any>, resou
197
281
  * Generates a server-backed Zx Table. Sorting automatically reloads page zero. `load({page: 0})`
198
282
  * replaces data, higher pages append it, and `loadMore()` uses `limit`/`offset` plus the returned
199
283
  * count. DataFilter callers can map state with `dataFilterStateToFilters` before `setFilters()`.
284
+ * Table presentation options (`variant`, `zebra`, `stickyHeader`, `responsive`, `emptyText`, …) and
285
+ * listeners are passed through to the generated Table.
200
286
  * @param {Record<string, any>} client Injected ZeyOS client instance.
201
287
  * @param {string} resource Resource name such as `transactions`.
202
288
  * @param {ZeyosTableOptions} [opts={}] Schema, table, and initial query options.