@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.
Files changed (231) hide show
  1. package/CHANGELOG.md +438 -0
  2. package/README.md +49 -10
  3. package/dist/types/components/activity-item/activity-item.d.ts +351 -0
  4. package/dist/types/components/activity-list/activity-list.d.ts +217 -0
  5. package/dist/types/components/app-sidebar/app-sidebar.d.ts +33 -3
  6. package/dist/types/components/avatar/avatar.d.ts +46 -7
  7. package/dist/types/components/badge/badge.d.ts +21 -1
  8. package/dist/types/components/button/button.d.ts +23 -0
  9. package/dist/types/components/calendar/calendar.d.ts +19 -0
  10. package/dist/types/components/card/card.d.ts +7 -0
  11. package/dist/types/components/card-view/card-view.d.ts +11 -3
  12. package/dist/types/components/card-view/record-card.d.ts +7 -1
  13. package/dist/types/components/chart/chart.d.ts +10 -0
  14. package/dist/types/components/checklist/checklist.d.ts +9 -0
  15. package/dist/types/components/code-editor/code-editor.d.ts +149 -0
  16. package/dist/types/components/code-editor/field-adapter.d.ts +5 -0
  17. package/dist/types/components/context-menu/context-menu.d.ts +18 -2
  18. package/dist/types/components/date-picker/date-picker.d.ts +8 -0
  19. package/dist/types/components/date-picker/time-picker.d.ts +7 -0
  20. package/dist/types/components/datebox/date-range-box.d.ts +5 -1
  21. package/dist/types/components/datebox/datebox.d.ts +7 -2
  22. package/dist/types/components/dialog/dialog.d.ts +75 -6
  23. package/dist/types/components/dropdown/dropdown.d.ts +2 -2
  24. package/dist/types/components/entity-ref/entity-ref.d.ts +331 -0
  25. package/dist/types/components/field/field.d.ts +24 -2
  26. package/dist/types/components/fieldset/fieldset.d.ts +19 -1
  27. package/dist/types/components/file-item/file-item.d.ts +262 -0
  28. package/dist/types/components/file-list/file-list.d.ts +171 -0
  29. package/dist/types/components/filter/filter.d.ts +91 -36
  30. package/dist/types/components/filter-panel/filter-panel.d.ts +449 -0
  31. package/dist/types/components/form/form.d.ts +12 -1
  32. package/dist/types/components/kanban-view/kanban-card.d.ts +146 -0
  33. package/dist/types/components/kanban-view/kanban-view.d.ts +170 -4
  34. package/dist/types/components/launcher/launcher.d.ts +278 -26
  35. package/dist/types/components/list-toolbar/list-toolbar.d.ts +599 -0
  36. package/dist/types/components/menu-button/menu-button.d.ts +37 -42
  37. package/dist/types/components/message/message.d.ts +126 -17
  38. package/dist/types/components/modal/modal.d.ts +61 -2
  39. package/dist/types/components/navigation-bar/navigation-bar.d.ts +105 -21
  40. package/dist/types/components/panel/panel.d.ts +7 -0
  41. package/dist/types/components/search/search.d.ts +7 -0
  42. package/dist/types/components/select/color.d.ts +12 -0
  43. package/dist/types/components/select/glyphs.d.ts +124 -0
  44. package/dist/types/components/select/select.d.ts +15 -3
  45. package/dist/types/components/sort-control/sort-control.d.ts +105 -0
  46. package/dist/types/components/stat-tile/stat-tile.d.ts +288 -0
  47. package/dist/types/components/tabbox/tabbox.d.ts +16 -0
  48. package/dist/types/components/table/table.d.ts +190 -1
  49. package/dist/types/components/table-view/table-view.d.ts +11 -5
  50. package/dist/types/components/tag-picker/tag-picker.d.ts +21 -4
  51. package/dist/types/components/timebox/timebox.d.ts +7 -0
  52. package/dist/types/components/tree/tree.d.ts +13 -0
  53. package/dist/types/components/value-list/value-list.d.ts +8 -0
  54. package/dist/types/components/view/record-view.d.ts +96 -5
  55. package/dist/types/core/breakpoint.d.ts +1 -1
  56. package/dist/types/core/icons.d.ts +37 -22
  57. package/dist/types/core/motion.d.ts +59 -0
  58. package/dist/types/core/overlay-host.d.ts +15 -1
  59. package/dist/types/index.d.ts +16 -3
  60. package/dist/types/internal/app-rail.d.ts +10 -0
  61. package/dist/types/internal/menu-items.d.ts +134 -0
  62. package/dist/types/zeyos/connect.d.ts +6 -0
  63. package/dist/types/zeyos/form.d.ts +50 -9
  64. package/dist/types/zeyos/index.d.ts +1 -1
  65. package/dist/types/zeyos/query.d.ts +79 -0
  66. package/dist/types/zeyos/schema.d.ts +24 -1
  67. package/dist/types/zeyos/table.d.ts +100 -14
  68. package/dist/types/zeyos/view.d.ts +10 -0
  69. package/dist/zx-zeyos.esm.js +2206 -489
  70. package/dist/zx-zeyos.esm.min.js +56 -1
  71. package/dist/zx.css +3322 -724
  72. package/dist/zx.esm.js +12244 -5809
  73. package/dist/zx.esm.min.js +58 -3
  74. package/dist/zx.global.js +12246 -5811
  75. package/dist/zx.global.min.js +58 -3
  76. package/dist/zx.min.css +1 -1
  77. package/docs/api.json +1683 -146
  78. package/docs/llms.md +777 -110
  79. package/docs/llms.txt +14 -8
  80. package/package.json +1 -1
  81. package/src/components/account-menu/account-menu.css +35 -10
  82. package/src/components/activity-item/activity-item.css +137 -0
  83. package/src/components/activity-item/activity-item.js +602 -0
  84. package/src/components/activity-list/activity-list.css +99 -0
  85. package/src/components/activity-list/activity-list.js +409 -0
  86. package/src/components/app-icon/app-icon.css +1 -1
  87. package/src/components/app-rail/app-rail.css +191 -22
  88. package/src/components/app-sidebar/app-sidebar.css +349 -24
  89. package/src/components/app-sidebar/app-sidebar.js +86 -11
  90. package/src/components/aurora/aurora.css +5 -3
  91. package/src/components/avatar/avatar.css +32 -7
  92. package/src/components/avatar/avatar.js +72 -8
  93. package/src/components/badge/badge.css +54 -2
  94. package/src/components/badge/badge.js +29 -2
  95. package/src/components/button/button.css +74 -8
  96. package/src/components/button/button.js +44 -1
  97. package/src/components/calendar/calendar.css +46 -46
  98. package/src/components/calendar/calendar.js +33 -3
  99. package/src/components/card/card.css +2 -2
  100. package/src/components/card/card.js +12 -1
  101. package/src/components/card-view/card-view.css +10 -7
  102. package/src/components/card-view/card-view.js +25 -9
  103. package/src/components/card-view/record-card.js +7 -3
  104. package/src/components/chart/chart.css +4 -1
  105. package/src/components/chart/chart.js +12 -0
  106. package/src/components/check-button/check-button.css +10 -2
  107. package/src/components/checklist/checklist.css +9 -2
  108. package/src/components/checklist/checklist.js +11 -5
  109. package/src/components/checklist/field-adapter.js +3 -1
  110. package/src/components/code-editor/code-editor.css +68 -0
  111. package/src/components/code-editor/code-editor.js +306 -0
  112. package/src/components/code-editor/field-adapter.js +34 -0
  113. package/src/components/context-menu/context-menu.css +87 -5
  114. package/src/components/context-menu/context-menu.js +22 -30
  115. package/src/components/copy/copy-button.css +6 -0
  116. package/src/components/copy/copy-input.css +8 -3
  117. package/src/components/data-filter/data-filter.css +5 -4
  118. package/src/components/date-picker/date-picker.css +6 -6
  119. package/src/components/date-picker/date-picker.js +22 -8
  120. package/src/components/date-picker/date-range-picker.css +3 -3
  121. package/src/components/date-picker/month-picker.js +3 -3
  122. package/src/components/date-picker/time-picker.css +1 -1
  123. package/src/components/date-picker/time-picker.js +20 -8
  124. package/src/components/datebox/date-range-box.css +79 -2
  125. package/src/components/datebox/date-range-box.js +13 -2
  126. package/src/components/datebox/datebox.css +79 -2
  127. package/src/components/datebox/datebox.js +13 -2
  128. package/src/components/dialog/dialog.css +26 -0
  129. package/src/components/dialog/dialog.js +174 -70
  130. package/src/components/dropdown/dropdown.css +1 -1
  131. package/src/components/dropdown/dropdown.js +7 -5
  132. package/src/components/empty-state/empty-state.css +2 -2
  133. package/src/components/entity-ref/entity-ref.css +182 -0
  134. package/src/components/entity-ref/entity-ref.js +496 -0
  135. package/src/components/field/field.css +28 -9
  136. package/src/components/field/field.js +68 -26
  137. package/src/components/field-upload/field-upload.css +1 -1
  138. package/src/components/fieldset/fieldset.css +5 -3
  139. package/src/components/fieldset/fieldset.js +28 -5
  140. package/src/components/file-item/file-item.css +88 -0
  141. package/src/components/file-item/file-item.js +505 -0
  142. package/src/components/file-list/file-list.css +51 -0
  143. package/src/components/file-list/file-list.js +320 -0
  144. package/src/components/filter/filter.css +27 -1
  145. package/src/components/filter/filter.js +205 -47
  146. package/src/components/filter-panel/filter-panel.css +104 -0
  147. package/src/components/filter-panel/filter-panel.js +964 -0
  148. package/src/components/finder/finder.css +15 -13
  149. package/src/components/form/form.css +5 -4
  150. package/src/components/form/form.js +11 -2
  151. package/src/components/grid/grid.css +1 -1
  152. package/src/components/groupbox/groupbox.css +1 -1
  153. package/src/components/kanban-view/kanban-card.js +247 -0
  154. package/src/components/kanban-view/kanban-view.css +226 -8
  155. package/src/components/kanban-view/kanban-view.js +255 -12
  156. package/src/components/launcher/launcher.css +107 -25
  157. package/src/components/launcher/launcher.js +557 -63
  158. package/src/components/list-toolbar/list-toolbar.css +194 -0
  159. package/src/components/list-toolbar/list-toolbar.js +851 -0
  160. package/src/components/master-panel/master-panel.css +2 -0
  161. package/src/components/menu-button/menu-button.css +87 -5
  162. package/src/components/menu-button/menu-button.js +86 -46
  163. package/src/components/message/message.css +38 -5
  164. package/src/components/message/message.js +230 -17
  165. package/src/components/modal/modal.css +15 -0
  166. package/src/components/modal/modal.js +159 -3
  167. package/src/components/navigation-bar/navigation-bar.css +95 -11
  168. package/src/components/navigation-bar/navigation-bar.js +171 -4
  169. package/src/components/number-field/field-adapter.js +1 -0
  170. package/src/components/number-field/number-field.css +70 -0
  171. package/src/components/number-field/number-field.js +2 -0
  172. package/src/components/pagination/pagination.css +8 -6
  173. package/src/components/panel/panel.css +1 -1
  174. package/src/components/panel/panel.js +13 -2
  175. package/src/components/rating/rating.css +7 -0
  176. package/src/components/search/search.js +17 -5
  177. package/src/components/select/color.js +22 -0
  178. package/src/components/select/field-adapter.js +6 -1
  179. package/src/components/select/glyphs.js +165 -0
  180. package/src/components/select/select.css +138 -45
  181. package/src/components/select/select.js +86 -47
  182. package/src/components/sheet/sheet.css +11 -8
  183. package/src/components/slider/slider.css +16 -2
  184. package/src/components/slider/slider.js +1 -1
  185. package/src/components/sort-control/sort-control.css +20 -0
  186. package/src/components/sort-control/sort-control.js +140 -0
  187. package/src/components/stat-tile/stat-tile.css +208 -0
  188. package/src/components/stat-tile/stat-tile.js +601 -0
  189. package/src/components/tabbox/tabbox.css +32 -27
  190. package/src/components/tabbox/tabbox.js +17 -2
  191. package/src/components/table/table.css +155 -31
  192. package/src/components/table/table.js +386 -33
  193. package/src/components/table-view/table-view.css +8 -2
  194. package/src/components/table-view/table-view.js +21 -6
  195. package/src/components/tag-picker/tag-picker.css +86 -6
  196. package/src/components/tag-picker/tag-picker.js +25 -8
  197. package/src/components/timebox/timebox.css +22 -2
  198. package/src/components/timebox/timebox.js +18 -5
  199. package/src/components/toggle/toggle.css +12 -1
  200. package/src/components/toolbar/toolbar.js +2 -2
  201. package/src/components/tooltip/tooltip.css +4 -0
  202. package/src/components/tooltip/tooltip.js +10 -3
  203. package/src/components/tree/tree.css +25 -16
  204. package/src/components/tree/tree.js +31 -0
  205. package/src/components/value-list/value-list.css +3 -3
  206. package/src/components/value-list/value-list.js +22 -6
  207. package/src/components/view/record-view.css +5 -0
  208. package/src/components/view/record-view.js +100 -7
  209. package/src/core/breakpoint.js +1 -1
  210. package/src/core/icons.js +259 -57
  211. package/src/core/motion.js +147 -0
  212. package/src/core/overlay-host.js +21 -2
  213. package/src/index.js +30 -3
  214. package/src/internal/app-rail.js +18 -1
  215. package/src/internal/menu-items.js +142 -0
  216. package/src/zeyos/connect.js +6 -2
  217. package/src/zeyos/form.js +67 -27
  218. package/src/zeyos/index.js +1 -1
  219. package/src/zeyos/query.js +153 -0
  220. package/src/zeyos/schema.js +144 -27
  221. package/src/zeyos/table.js +68 -5
  222. package/src/zeyos/view.js +6 -0
  223. package/styles/base.css +56 -0
  224. package/styles/icons.css +11 -1
  225. package/styles/print.css +192 -0
  226. package/styles/tokens/dark.css +113 -37
  227. package/styles/tokens/global.css +121 -27
  228. package/styles/tokens/semantic.css +100 -31
  229. package/styles/tokens/themes.css +7 -6
  230. package/styles/zx.css +11 -1
  231. package/styles/tokens/density.css +0 -9
@@ -1,31 +1,6 @@
1
1
  import { Component } from '../../core/component.js';
2
- export type MenuItem = {
3
- /**
4
- * Item label.
5
- */
6
- label: string;
7
- /**
8
- * Kernel icon name.
9
- */
10
- icon?: string;
11
- /**
12
- * Value emitted on selection.
13
- */
14
- value?: unknown;
15
- /**
16
- * Whether selection is disabled.
17
- */
18
- disabled?: boolean;
19
- /**
20
- * Whether the action is dangerous.
21
- */
22
- danger?: boolean;
23
- /**
24
- * Selection callback.
25
- */
26
- onselect?: (value: unknown, item: MenuItem, menuButton: MenuButton) => void;
27
- };
28
- export type MenuButtonItem = MenuItem | '-';
2
+ export type MenuItem = import('../../internal/menu-items.js').MenuItem;
3
+ export type MenuButtonItem = import('../../internal/menu-items.js').MenuEntry;
29
4
  export type MenuButtonOptions = {
30
5
  /**
31
6
  * Trigger label.
@@ -63,16 +38,16 @@ export type MenuButtonOptions = {
63
38
  */
64
39
  onclose?: (event: CustomEvent<Record<string, never>>) => void;
65
40
  };
66
- /**
67
- * @typedef {Object} MenuItem
68
- * @property {string} label Item label.
69
- * @property {string} [icon] Kernel icon name.
70
- * @property {unknown} [value] Value emitted on selection.
71
- * @property {boolean} [disabled=false] Whether selection is disabled.
72
- * @property {boolean} [danger=false] Whether the action is dangerous.
73
- * @property {(value: unknown, item: MenuItem, menuButton: MenuButton) => void} [onselect] Selection callback.
74
- */
75
- /** @typedef {MenuItem|'-'} MenuButtonItem */
41
+ export type MenuButtonOpenOptions = {
42
+ /**
43
+ * Where focus goes when this opening ends with a
44
+ * selection or Escape: `true` is the trigger, an element is that element (the trigger again if
45
+ * it has left the document), and `false` leaves focus alone.
46
+ */
47
+ returnFocus?: boolean | HTMLElement;
48
+ };
49
+ /** @typedef {import('../../internal/menu-items.js').MenuItem} MenuItem */
50
+ /** @typedef {import('../../internal/menu-items.js').MenuEntry} MenuButtonItem */
76
51
  /**
77
52
  * @typedef {Object} MenuButtonOptions
78
53
  * @property {string} [label=''] Trigger label.
@@ -84,8 +59,18 @@ export type MenuButtonOptions = {
84
59
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
85
60
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close event listener.
86
61
  */
62
+ /**
63
+ * @typedef {Object} MenuButtonOpenOptions
64
+ * @property {boolean|HTMLElement} [returnFocus=true] Where focus goes when this opening ends with a
65
+ * selection or Escape: `true` is the trigger, an element is that element (the trigger again if
66
+ * it has left the document), and `false` leaves focus alone.
67
+ */
87
68
  /**
88
69
  * APG menu-button trigger backed by an anchored Dropdown.
70
+ *
71
+ * Choosing an item closes the menu and puts focus back on the trigger before the `select` event
72
+ * and the item's `onselect` run, so whatever they open — a dialog, a sheet — records the trigger
73
+ * as the place to return to, and focus they move themselves stays where they put it.
89
74
  * @fires MenuButton#select
90
75
  * @fires MenuButton#open
91
76
  * @fires MenuButton#close
@@ -115,9 +100,11 @@ export declare class MenuButton extends Component<MenuButtonOptions> {
115
100
  setItems(items: MenuButtonItem[]): this;
116
101
  /**
117
102
  * Opens the menu.
103
+ * @param {MenuButtonOpenOptions} [options={}] Where focus returns when this opening ends; ignored
104
+ * while the menu is already open.
118
105
  * @returns {this}
119
106
  */
120
- open(): this;
107
+ open(options?: MenuButtonOpenOptions): this;
121
108
  /**
122
109
  * Closes the menu.
123
110
  * @returns {this}
@@ -132,10 +119,18 @@ export declare class MenuButton extends Component<MenuButtonOptions> {
132
119
  getTrigger(): HTMLElement;
133
120
  /** Returns the owned menu panel. @returns {HTMLElement} */
134
121
  getPanel(): HTMLElement;
135
- /** Opens the menu and focuses its first enabled item. @returns {this} */
136
- focusFirst(): this;
137
- /** Opens the menu and focuses its last enabled item. @returns {this} */
138
- focusLast(): this;
122
+ /**
123
+ * Opens the menu and focuses its first enabled item.
124
+ * @param {MenuButtonOpenOptions} [options={}] Passed to `open()`.
125
+ * @returns {this}
126
+ */
127
+ focusFirst(options?: MenuButtonOpenOptions): this;
128
+ /**
129
+ * Opens the menu and focuses its last enabled item.
130
+ * @param {MenuButtonOpenOptions} [options={}] Passed to `open()`.
131
+ * @returns {this}
132
+ */
133
+ focusLast(options?: MenuButtonOpenOptions): this;
139
134
  /**
140
135
  * Sets the visible trigger label.
141
136
  * @param {string} label Trigger label.
@@ -1,18 +1,48 @@
1
1
  import { Component } from '../../core/component.js';
2
2
  export type MessageKind = 'info' | 'success' | 'warning' | 'error';
3
+ export type MessageAction = {
4
+ /**
5
+ * Button text: a verb naming what happens ("Undo", "Approve", "Retry").
6
+ */
7
+ label: string;
8
+ /**
9
+ * Runs when the button is activated, by pointer
10
+ * or keyboard; the message closes right after it.
11
+ */
12
+ onclick?: (event: MouseEvent) => void;
13
+ /**
14
+ * Button kind; the default is the
15
+ * secondary button.
16
+ */
17
+ kind?: 'default' | 'primary' | 'danger' | 'ghost';
18
+ };
3
19
  export type MessageShowOptions = {
4
20
  /**
5
21
  * Message intent (`danger` aliases `error`).
6
22
  */
7
23
  kind?: MessageKind | 'danger';
8
24
  /**
9
- * Auto-dismiss delay in milliseconds; zero persists.
25
+ * Auto-dismiss delay in milliseconds; zero persists. A message
26
+ * with an `action` stays at least 8000ms.
10
27
  */
11
28
  timeout?: number;
12
29
  /**
13
30
  * Whether to render a close button.
14
31
  */
15
32
  closable?: boolean;
33
+ /**
34
+ * A command button inside the message. The message
35
+ * never times out while the pointer is over it or focus is inside it.
36
+ */
37
+ action?: MessageAction | null;
38
+ /**
39
+ * Visual shown in place of the
40
+ * kind icon, such as an Avatar's element. It is decorative — the message text must say what it
41
+ * shows.
42
+ */
43
+ leading?: Node | {
44
+ toElement: () => Node | null;
45
+ } | null;
16
46
  /**
17
47
  * Element whose nearest Zx theme scope owns a floating toast.
18
48
  */
@@ -37,28 +67,32 @@ export type MessageOptions = {
37
67
  maxVisible?: number;
38
68
  };
39
69
  export type MessageHandle = {
40
- close: () => void;
41
- };
42
- export type ProgressHandle = {
43
70
  /**
44
- * Updates progress and optional text.
45
- */
46
- update: (pct: number, text?: string) => void;
47
- /**
48
- * Completes and dismisses the progress message.
49
- */
50
- done: () => void;
51
- /**
52
- * Marks progress as failed and dismisses it later.
71
+ * Closes the message.
53
72
  */
54
- fail: (text?: string) => void;
73
+ close: () => void;
55
74
  };
56
75
  /** @typedef {'info'|'success'|'warning'|'error'} MessageKind */
76
+ /**
77
+ * The one command a message may carry, drawn as a small button beside its text.
78
+ * @typedef {Object} MessageAction
79
+ * @property {string} label Button text: a verb naming what happens ("Undo", "Approve", "Retry").
80
+ * @property {(event: MouseEvent) => void} [onclick] Runs when the button is activated, by pointer
81
+ * or keyboard; the message closes right after it.
82
+ * @property {'default'|'primary'|'danger'|'ghost'} [kind='default'] Button kind; the default is the
83
+ * secondary button.
84
+ */
57
85
  /**
58
86
  * @typedef {Object} MessageShowOptions
59
87
  * @property {MessageKind|'danger'} [kind='info'] Message intent (`danger` aliases `error`).
60
- * @property {number} [timeout=4000] Auto-dismiss delay in milliseconds; zero persists.
88
+ * @property {number} [timeout=4000] Auto-dismiss delay in milliseconds; zero persists. A message
89
+ * with an `action` stays at least 8000ms.
61
90
  * @property {boolean} [closable=true] Whether to render a close button.
91
+ * @property {MessageAction|null} [action=null] A command button inside the message. The message
92
+ * never times out while the pointer is over it or focus is inside it.
93
+ * @property {Node|{toElement: () => Node|null}|null} [leading=null] Visual shown in place of the
94
+ * kind icon, such as an Avatar's element. It is decorative — the message text must say what it
95
+ * shows.
62
96
  * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns a floating toast.
63
97
  */
64
98
  /**
@@ -68,7 +102,28 @@ export type ProgressHandle = {
68
102
  * @property {boolean} [closable=true] Default close-button visibility.
69
103
  * @property {number} [maxVisible=5] Maximum number of visible messages.
70
104
  */
71
- /** @typedef {{close: () => void}} MessageHandle */
105
+ /**
106
+ * Returned by every `show()`: closes that message early. Closing one that already closed, or one
107
+ * still waiting in the queue, is safe.
108
+ * @typedef {Object} MessageHandle
109
+ * @property {() => void} close Closes the message.
110
+ */
111
+ /** The shortest time a message that carries an action stays, in milliseconds. */
112
+ export declare const MESSAGE_ACTION_MIN_TIMEOUT = 8000;
113
+ export type ProgressHandle = {
114
+ /**
115
+ * Updates progress and optional text.
116
+ */
117
+ update: (pct: number, text?: string) => void;
118
+ /**
119
+ * Completes and dismisses the progress message.
120
+ */
121
+ done: () => void;
122
+ /**
123
+ * Marks progress as failed and dismisses it later.
124
+ */
125
+ fail: (text?: string) => void;
126
+ };
72
127
  /**
73
128
  * @typedef {Object} ProgressHandle
74
129
  * @property {(pct: number, text?: string) => void} update Updates progress and optional text.
@@ -129,6 +184,8 @@ export declare class Message extends Component<MessageOptions> {
129
184
  children: Node[];
130
185
  };
131
186
  _entries: Set<any>;
187
+ /** @type {Element|null} The overlay host this instance is the floating region of; null when inline. */
188
+ _floatingHost: Element | null;
132
189
  _queue: MessageQueue<any>;
133
190
  _cleaned: boolean;
134
191
  static cssName: string;
@@ -187,13 +244,24 @@ export declare class Message extends Component<MessageOptions> {
187
244
  static progress(text: string, options?: {
188
245
  scope?: Element | string | null;
189
246
  }): ProgressHandle;
247
+ /**
248
+ * Removes a floating region at once, toasts and all, without waiting for them to time out.
249
+ *
250
+ * A region already removes itself when its last toast closes, and one whose host has left the
251
+ * document is replaced on the next toast, so this is only for a host being torn down while
252
+ * toasts are still showing — an application view unmounting its themed shell, say.
253
+ * @param {Element|string} scope Element or selector whose nearest Zx theme scope owns the region,
254
+ * as passed to `show()`.
255
+ * @returns {boolean} Whether there was a region to remove.
256
+ */
257
+ static disposeRegion(scope: Element | string): boolean;
190
258
  /** @returns {void} */
191
259
  destroy(): void;
192
260
  /** @param {string} text @returns {ProgressHandle} */
193
261
  _progress(text: string): ProgressHandle;
194
262
  /**
195
263
  * @param {string|Node} msg
196
- * @param {{kind: MessageKind, timeout: number, closable: boolean}} settings
264
+ * @param {{kind: MessageKind, timeout: number, closable: boolean, action?: MessageAction|null, leading?: Node|null}} settings
197
265
  * @param {{pct: number, text: string}|null} [progress=null]
198
266
  * @returns {any}
199
267
  */
@@ -201,6 +269,8 @@ export declare class Message extends Component<MessageOptions> {
201
269
  kind: MessageKind;
202
270
  timeout: number;
203
271
  closable: boolean;
272
+ action?: MessageAction | null;
273
+ leading?: Node | null;
204
274
  }, progress?: {
205
275
  pct: number;
206
276
  text: string;
@@ -217,4 +287,43 @@ export declare class Message extends Component<MessageOptions> {
217
287
  _close(entry: any): void;
218
288
  /** @param {any} entry @returns {void} */
219
289
  _finish(entry: any): void;
290
+ /**
291
+ * Takes a floating region out of the document once its last toast has gone, so an emptied host
292
+ * is not left holding a region nobody uses. Inline areas stay: their element is the caller's.
293
+ * @returns {void}
294
+ */
295
+ _releaseIfEmpty(): void;
296
+ /**
297
+ * Destroys a floating region and removes its element.
298
+ * @returns {void}
299
+ */
300
+ _disposeFloating(): void;
301
+ /**
302
+ * Resolves a message through the host translator, falling back to the built-in English text.
303
+ * @param {string} key Message key.
304
+ * @param {string} fallback English default.
305
+ * @returns {string}
306
+ */
307
+ _message(key: string, fallback: string): string;
220
308
  }
309
+ /**
310
+ * Settles how long a message stays. A message that carries an action stays at least
311
+ * `MESSAGE_ACTION_MIN_TIMEOUT`, so there is time to reach it; zero still means it stays until
312
+ * closed, and anything that is not a finite number falls back to the 4000ms default.
313
+ * @param {unknown} timeout Requested auto-dismiss delay in milliseconds.
314
+ * @param {boolean} [hasAction=false] Whether the message carries an action.
315
+ * @returns {number}
316
+ */
317
+ export declare function messageTimeout(timeout: unknown, hasAction?: boolean): number;
318
+ /**
319
+ * Copies a message action into the shape the message renders, or returns null when there is
320
+ * nothing to render: no object, or no label. An unknown `kind` reads as the default, secondary
321
+ * button, and a missing `onclick` leaves a button that only closes the message.
322
+ * @param {unknown} value Action descriptor.
323
+ * @returns {{label: string, kind: 'default'|'primary'|'danger'|'ghost', onclick: ((event: MouseEvent) => void)|null}|null}
324
+ */
325
+ export declare function normalizeMessageAction(value: unknown): {
326
+ label: string;
327
+ kind: 'default' | 'primary' | 'danger' | 'ghost';
328
+ onclick: ((event: MouseEvent) => void) | null;
329
+ } | null;
@@ -23,7 +23,7 @@ export type ModalOptions = {
23
23
  */
24
24
  destroyOnClose?: boolean;
25
25
  /**
26
- * Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
26
+ * Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
27
27
  */
28
28
  scope?: Element | string | null;
29
29
  /**
@@ -48,7 +48,7 @@ export type ModalOptions = {
48
48
  * @property {boolean} [closable=true] Whether Escape may close the modal.
49
49
  * @property {boolean} [lightDismiss=false] Whether a backdrop click closes the modal.
50
50
  * @property {boolean} [destroyOnClose=false] Whether to destroy the modal after it closes.
51
- * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
51
+ * @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
52
52
  * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
53
53
  * @property {(event: CustomEvent<{result: unknown}>) => void} [onclose] Close event listener.
54
54
  * @property {(event: CustomEvent<Record<string, never>>) => void} [oncancel] Cancel event listener.
@@ -56,6 +56,15 @@ export type ModalOptions = {
56
56
  /**
57
57
  * Thin native-dialog overlay with lifecycle-safe content and dismissal behavior.
58
58
  * The constructor always creates and appends a new dialog; its target argument is ignored.
59
+ *
60
+ * Accessibility is the platform's wherever the platform has an answer. The root is a real
61
+ * `<dialog>` and `_show()` presents it with `showModal()`, so focus containment, the inertness of
62
+ * everything behind it, Escape, the top layer and the implicit `dialog` role all come from the
63
+ * browser — there is no hand-written focus trap here, and adding one on top of `:modal` would be
64
+ * two traps fighting over the same Tab key. What the platform leaves undone is the rest of this
65
+ * class's accessibility work: it stops initial focus at the panel instead of the first control,
66
+ * and it restores focus to the opener only for its own native presentation, not for the popover
67
+ * one a non-modal subclass uses.
59
68
  * @fires Modal#open
60
69
  * @fires Modal#close
61
70
  * @fires Modal#cancel
@@ -129,11 +138,33 @@ export declare class Modal extends Component<ModalOptions> {
129
138
  * @returns {boolean} Whether this event closed the current presentation.
130
139
  */
131
140
  _settleClose(closingPresentation: number | undefined): boolean;
141
+ /**
142
+ * Places initial focus inside the panel.
143
+ *
144
+ * `showModal()` focuses an `autofocus` control when the content declares one and otherwise stops
145
+ * at the dialog element, which leaves a reader one Tab short of the first control. This keeps
146
+ * that preference — so a `Dialog` footer button marked `autofocus` still wins — and then falls
147
+ * through to the first focusable descendant, with the panel itself as the last resort so focus
148
+ * is never left outside the overlay.
149
+ * @returns {void}
150
+ */
151
+ _focusInitial(): void;
132
152
  /**
133
153
  * Creates the owned native dialog.
134
154
  * @returns {HTMLDialogElement}
135
155
  */
136
156
  render(): HTMLDialogElement;
157
+ /**
158
+ * Gives a freshly rendered dialog its first home.
159
+ *
160
+ * A `scope` that is not in the document yet cannot say which theme it belongs to, and the
161
+ * `<body>` that `mountTarget()` would answer is outside it. The dialog then stays detached and
162
+ * `open()` places it, by which time the scope is in place. Called from `render()`, so it may
163
+ * read `this.options` but no instance state.
164
+ * @param {HTMLDialogElement} dialog The rendered dialog.
165
+ * @returns {void}
166
+ */
167
+ _mountInitial(dialog: HTMLDialogElement): void;
137
168
  /**
138
169
  * Opens the modal in the browser top layer.
139
170
  * @returns {this}
@@ -165,3 +196,31 @@ export declare class Modal extends Component<ModalOptions> {
165
196
  */
166
197
  destroy(): void;
167
198
  }
199
+ /**
200
+ * Fired after the modal enters the top layer.
201
+ * @event Modal#open
202
+ * @type {CustomEvent<Record<string, never>>}
203
+ */
204
+ /**
205
+ * Fired after the native dialog closes.
206
+ * @event Modal#close
207
+ * @type {CustomEvent<{result: unknown}>}
208
+ */
209
+ /**
210
+ * Fired when Escape requests cancellation. Preventing it keeps the modal open.
211
+ * @event Modal#cancel
212
+ * @type {CustomEvent<Record<string, never>>}
213
+ */
214
+ /**
215
+ * Picks the control initial focus belongs on inside an overlay panel: an `autofocus` control when
216
+ * the content named one, the first focusable descendant otherwise, and null when the panel holds
217
+ * neither and must take focus itself.
218
+ *
219
+ * Candidates in a hidden, `aria-hidden` or `inert` subtree are skipped, because `focus()` on one
220
+ * is a silent no-op: a `Dialog` whose header close button is hidden by `closable: false`, or whose
221
+ * other registered views sit hidden in the same body, would otherwise "focus" nothing at all and
222
+ * leave the reader with no way into the overlay.
223
+ * @param {Element} root Overlay panel.
224
+ * @returns {HTMLElement|null}
225
+ */
226
+ export declare function initialFocusTarget(root: Element): HTMLElement | null;
@@ -80,33 +80,30 @@ export type NavigationBarOptions = {
80
80
  */
81
81
  actions?: NavigationAction[];
82
82
  /**
83
- * Change callback.
84
- */
85
- onchange?: (event: CustomEvent<{
86
- name: string;
87
- }>) => void;
88
- };
89
- export type NavigationRecord = {
90
- /**
91
- * Normalized item definition.
83
+ * Whether items collapse into the overflow menu at all.
84
+ * `false` keeps every item in the bar at every width and never shows the More button.
92
85
  */
93
- definition: NavigationItem;
86
+ overflow?: boolean;
94
87
  /**
95
- * Rendered link or button.
88
+ * Container inline size at or below which
89
+ * items collapse, as a `px` or `rem` length (a number is read as `px`); `false` disables
90
+ * collapsing exactly as `overflow: false` does. The default is the threshold the stylesheet's
91
+ * own container query carries, and a bar that keeps it collapses in CSS without measuring
92
+ * itself; any other value is watched with a `ResizeObserver`.
96
93
  */
97
- item: HTMLElement;
94
+ overflowBelow?: string | number | false;
98
95
  /**
99
- * Badge element.
96
+ * How many items, counted from the start, never collapse. The
97
+ * default collapses all of them, which is right for a top app bar and wrong for a phone bottom
98
+ * bar — `minVisible: 4` is what makes that bar usable.
100
99
  */
101
- badge: HTMLElement;
100
+ minVisible?: number;
102
101
  /**
103
- * Optional tab panel.
104
- */
105
- panel: HTMLElement | null;
106
- /**
107
- * Whether panel content has been mounted.
102
+ * Change callback.
108
103
  */
109
- built: boolean;
104
+ onchange?: (event: CustomEvent<{
105
+ name: string;
106
+ }>) => void;
110
107
  };
111
108
  /** @typedef {Node|Component|(() => Node|Component)} NavigationPanelContent */
112
109
  /**
@@ -136,8 +133,46 @@ export type NavigationRecord = {
136
133
  * @property {NavigationItem[]} [items=[]] Navigation items.
137
134
  * @property {string|null} [active=null] Initially active item, or the first enabled item.
138
135
  * @property {NavigationAction[]} [actions=[]] Right-aligned action elements or descriptors.
136
+ * @property {boolean} [overflow=true] Whether items collapse into the overflow menu at all.
137
+ * `false` keeps every item in the bar at every width and never shows the More button.
138
+ * @property {string|number|false} [overflowBelow='44rem'] Container inline size at or below which
139
+ * items collapse, as a `px` or `rem` length (a number is read as `px`); `false` disables
140
+ * collapsing exactly as `overflow: false` does. The default is the threshold the stylesheet's
141
+ * own container query carries, and a bar that keeps it collapses in CSS without measuring
142
+ * itself; any other value is watched with a `ResizeObserver`.
143
+ * @property {number} [minVisible=0] How many items, counted from the start, never collapse. The
144
+ * default collapses all of them, which is right for a top app bar and wrong for a phone bottom
145
+ * bar — `minVisible: 4` is what makes that bar usable.
139
146
  * @property {(event: CustomEvent<{name: string}>) => void} [onchange] Change callback.
140
147
  */
148
+ /**
149
+ * The container width `navigation-bar.css` collapses at. A bar that keeps this exact threshold is
150
+ * served by the stylesheet's container query, so it needs no measurement and no script at all;
151
+ * anything else has to be watched. Keep it in step with the `@container` rule.
152
+ */
153
+ export declare const OVERFLOW_BELOW = "44rem";
154
+ export type NavigationRecord = {
155
+ /**
156
+ * Normalized item definition.
157
+ */
158
+ definition: NavigationItem;
159
+ /**
160
+ * Rendered link or button.
161
+ */
162
+ item: HTMLElement;
163
+ /**
164
+ * Badge element.
165
+ */
166
+ badge: HTMLElement;
167
+ /**
168
+ * Optional tab panel.
169
+ */
170
+ panel: HTMLElement | null;
171
+ /**
172
+ * Whether panel content has been mounted.
173
+ */
174
+ built: boolean;
175
+ };
141
176
  /**
142
177
  * @typedef {Object} NavigationRecord
143
178
  * @property {NavigationItem} definition Normalized item definition.
@@ -163,6 +198,8 @@ export declare class NavigationBar extends Component<NavigationBarOptions> {
163
198
  _items: NavigationRecord[];
164
199
  _activeName: string;
165
200
  _tabMode: boolean;
201
+ _observer: ResizeObserver;
202
+ _frame: number;
166
203
  static cssName: string;
167
204
  /** @type {Readonly<NavigationBarOptions>} */
168
205
  static defaults: Readonly<NavigationBarOptions>;
@@ -216,8 +253,21 @@ export declare class NavigationBar extends Component<NavigationBarOptions> {
216
253
  _ensurePanel(record: NavigationRecord): void;
217
254
  /** @param {KeyboardEvent} event @returns {void} */
218
255
  _onTabKeydown(event: KeyboardEvent): void;
219
- /** @returns {void} */
256
+ /**
257
+ * Republishes the overflow state: which items may collapse, which mode the stylesheet should
258
+ * apply, and what the More menu contains. With the default `minVisible: 0` every item collapses
259
+ * and the menu lists them all, which is what it has always done.
260
+ * @returns {void}
261
+ */
220
262
  _syncOverflow(): void;
263
+ /**
264
+ * Watches the bar's own inline size when `overflowBelow` names a threshold the stylesheet cannot
265
+ * express. A bar on the default threshold installs nothing: its container query has already
266
+ * decided before the first frame of script, which is why the default path stays exactly as it
267
+ * was.
268
+ * @returns {void}
269
+ */
270
+ _observeWidth(): void;
221
271
  /** @param {NavigationRecord} record @returns {void} */
222
272
  _focusTab(record: NavigationRecord): void;
223
273
  /** @returns {NavigationRecord[]} */
@@ -227,3 +277,37 @@ export declare class NavigationBar extends Component<NavigationBarOptions> {
227
277
  /** @param {string} name @returns {NavigationRecord} */
228
278
  _require(name: string): NavigationRecord;
229
279
  }
280
+ /**
281
+ * Fired after the active item changes.
282
+ * @event NavigationBar#change
283
+ * @type {CustomEvent<{name: string}>}
284
+ */
285
+ /**
286
+ * Resolves the container inline size at or below which items collapse into the overflow menu.
287
+ *
288
+ * Two options can switch collapsing off, because they answer two different questions: `overflow`
289
+ * is whether the bar has an overflow menu at all, and `overflowBelow` is where it starts using it.
290
+ * Either being `false` means the same thing to the stylesheet — nothing ever collapses — so both
291
+ * resolve to `null` here and the caller has one state to handle rather than two.
292
+ * @param {NavigationBarOptions} [options={}] Navigation options, whole or partial.
293
+ * @returns {string|null} A `px` or `rem` length, or `null` when nothing ever collapses.
294
+ */
295
+ export declare function resolveOverflowBelow(options?: NavigationBarOptions): string | null;
296
+ /**
297
+ * How many items, counted from the start, stay in the bar when it collapses.
298
+ *
299
+ * Clamping to the item count is the whole arithmetic: `minVisible: 4` on a three-item bar keeps
300
+ * three, so the overflow menu is empty rather than holding a phantom fourth entry, and the bar
301
+ * hides its More button instead of opening onto nothing.
302
+ * @param {NavigationBarOptions} [options={}] Navigation options, whole or partial.
303
+ * @param {number} [count=0] How many items the bar currently has.
304
+ * @returns {number} A count between 0 and `count`.
305
+ */
306
+ export declare function resolveMinVisible(options?: NavigationBarOptions, count?: number): number;
307
+ /**
308
+ * Converts an overflow threshold to pixels, so a measured width can be compared with it.
309
+ * @param {string|number} length A `px` or `rem` length, or a number of pixels.
310
+ * @param {number} [rootFontSize=16] Computed root font size; anything unusable falls back to 16.
311
+ * @returns {number} The threshold in pixels.
312
+ */
313
+ export declare function lengthToPixels(length: string | number, rootFontSize?: number): number;
@@ -191,4 +191,11 @@ export declare class Panel extends Component<PanelOptions> {
191
191
  * @returns {Element[]}
192
192
  */
193
193
  _buildButtons(list: PanelButton[], label: string): Element[];
194
+ /**
195
+ * Resolves a message through the host translator, falling back to the built-in English text.
196
+ * @param {string} key Message key.
197
+ * @param {string} fallback English default.
198
+ * @returns {string}
199
+ */
200
+ _message(key: string, fallback: string): string;
194
201
  }
@@ -95,4 +95,11 @@ export declare class Search extends Component<SearchOptions> {
95
95
  _scheduleInput(): void;
96
96
  /** @returns {void} */
97
97
  _syncClear(): void;
98
+ /**
99
+ * Resolves a message through the host translator, falling back to the built-in English text.
100
+ * @param {string} key Message key.
101
+ * @param {string} fallback English default.
102
+ * @returns {string}
103
+ */
104
+ _message(key: string, fallback: string): string;
98
105
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Accepts an item colour for an inline custom property: a CSS colour literal (`#0b7285`, `rgb(…)`,
3
+ * `oklch(…)`, a named colour) or a reference to a design token (`var(--zx-color-tone-blue-fg)`),
4
+ * so an item can follow the theme rather than fix one colour for light and dark alike. Anything
5
+ * else — other functions, declarations, a `var()` with a fallback — is refused.
6
+ *
7
+ * Shared by `Select.entity()` and `TagPicker`, the two components that take a colour per item.
8
+ *
9
+ * @param {unknown} value Candidate colour.
10
+ * @returns {string|null} The trimmed colour, or null when the value is not one.
11
+ */
12
+ export declare function itemColor(value: unknown): string | null;