@zeyos/zx 4.3.4 → 4.4.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 (128) hide show
  1. package/CHANGELOG.md +155 -0
  2. package/README.md +7 -0
  3. package/dist/types/components/activity-item/activity-item.d.ts +351 -0
  4. package/dist/types/components/activity-list/activity-list.d.ts +195 -0
  5. package/dist/types/components/app-sidebar/app-sidebar.d.ts +28 -0
  6. package/dist/types/components/button/button.d.ts +8 -0
  7. package/dist/types/components/calendar/calendar.d.ts +19 -0
  8. package/dist/types/components/card/card.d.ts +7 -0
  9. package/dist/types/components/card-view/card-view.d.ts +11 -3
  10. package/dist/types/components/card-view/record-card.d.ts +7 -1
  11. package/dist/types/components/code-editor/code-editor.d.ts +160 -0
  12. package/dist/types/components/code-editor/field-adapter.d.ts +5 -0
  13. package/dist/types/components/context-menu/context-menu.d.ts +18 -2
  14. package/dist/types/components/date-picker/date-picker.d.ts +8 -0
  15. package/dist/types/components/date-picker/time-picker.d.ts +7 -0
  16. package/dist/types/components/dialog/dialog.d.ts +29 -0
  17. package/dist/types/components/entity-ref/entity-ref.d.ts +331 -0
  18. package/dist/types/components/file-item/file-item.d.ts +234 -0
  19. package/dist/types/components/file-list/file-list.d.ts +171 -0
  20. package/dist/types/components/filter/filter.d.ts +91 -36
  21. package/dist/types/components/filter-panel/filter-panel.d.ts +449 -0
  22. package/dist/types/components/kanban-view/kanban-card.d.ts +138 -0
  23. package/dist/types/components/kanban-view/kanban-view.d.ts +170 -4
  24. package/dist/types/components/launcher/launcher.d.ts +19 -12
  25. package/dist/types/components/list-toolbar/list-toolbar.d.ts +599 -0
  26. package/dist/types/components/menu-button/menu-button.d.ts +4 -37
  27. package/dist/types/components/message/message.d.ts +7 -0
  28. package/dist/types/components/modal/modal.d.ts +48 -0
  29. package/dist/types/components/navigation-bar/navigation-bar.d.ts +105 -21
  30. package/dist/types/components/panel/panel.d.ts +7 -0
  31. package/dist/types/components/search/search.d.ts +7 -0
  32. package/dist/types/components/select/select.d.ts +4 -0
  33. package/dist/types/components/sort-control/sort-control.d.ts +105 -0
  34. package/dist/types/components/stat-tile/stat-tile.d.ts +277 -0
  35. package/dist/types/components/tabbox/tabbox.d.ts +7 -0
  36. package/dist/types/components/table/table.d.ts +144 -0
  37. package/dist/types/components/table-view/table-view.d.ts +11 -5
  38. package/dist/types/components/timebox/timebox.d.ts +7 -0
  39. package/dist/types/components/value-list/value-list.d.ts +8 -0
  40. package/dist/types/components/view/record-view.d.ts +96 -5
  41. package/dist/types/core/icons.d.ts +17 -0
  42. package/dist/types/index.d.ts +11 -0
  43. package/dist/types/internal/app-rail.d.ts +10 -0
  44. package/dist/types/internal/menu-items.d.ts +134 -0
  45. package/dist/zx-zeyos.esm.js +616 -77
  46. package/dist/zx-zeyos.esm.min.js +8 -1
  47. package/dist/zx.css +2085 -238
  48. package/dist/zx.esm.js +6704 -1542
  49. package/dist/zx.esm.min.js +10 -3
  50. package/dist/zx.global.js +6704 -1542
  51. package/dist/zx.global.min.js +10 -3
  52. package/dist/zx.min.css +1 -1
  53. package/docs/api.json +1479 -127
  54. package/docs/llms.md +315 -10
  55. package/docs/llms.txt +11 -5
  56. package/package.json +1 -1
  57. package/src/components/activity-item/activity-item.css +137 -0
  58. package/src/components/activity-item/activity-item.js +599 -0
  59. package/src/components/activity-list/activity-list.css +64 -0
  60. package/src/components/activity-list/activity-list.js +375 -0
  61. package/src/components/app-rail/app-rail.css +227 -19
  62. package/src/components/app-sidebar/app-sidebar.css +414 -24
  63. package/src/components/app-sidebar/app-sidebar.js +65 -5
  64. package/src/components/button/button.css +8 -0
  65. package/src/components/button/button.js +6 -1
  66. package/src/components/calendar/calendar.js +33 -3
  67. package/src/components/card/card.js +12 -1
  68. package/src/components/card-view/card-view.css +1 -0
  69. package/src/components/card-view/card-view.js +25 -9
  70. package/src/components/card-view/record-card.js +7 -3
  71. package/src/components/code-editor/code-editor.css +67 -0
  72. package/src/components/code-editor/code-editor.js +288 -0
  73. package/src/components/code-editor/field-adapter.js +34 -0
  74. package/src/components/context-menu/context-menu.css +80 -3
  75. package/src/components/context-menu/context-menu.js +22 -30
  76. package/src/components/date-picker/date-picker.js +22 -8
  77. package/src/components/date-picker/month-picker.js +3 -3
  78. package/src/components/date-picker/time-picker.js +20 -8
  79. package/src/components/dialog/dialog.js +88 -66
  80. package/src/components/dropdown/dropdown.js +2 -2
  81. package/src/components/entity-ref/entity-ref.css +182 -0
  82. package/src/components/entity-ref/entity-ref.js +496 -0
  83. package/src/components/file-item/file-item.css +88 -0
  84. package/src/components/file-item/file-item.js +371 -0
  85. package/src/components/file-list/file-list.css +51 -0
  86. package/src/components/file-list/file-list.js +320 -0
  87. package/src/components/filter/filter.css +27 -1
  88. package/src/components/filter/filter.js +199 -45
  89. package/src/components/filter-panel/filter-panel.css +104 -0
  90. package/src/components/filter-panel/filter-panel.js +964 -0
  91. package/src/components/kanban-view/kanban-card.js +239 -0
  92. package/src/components/kanban-view/kanban-view.css +194 -0
  93. package/src/components/kanban-view/kanban-view.js +251 -8
  94. package/src/components/launcher/launcher.js +59 -27
  95. package/src/components/list-toolbar/list-toolbar.css +189 -0
  96. package/src/components/list-toolbar/list-toolbar.js +851 -0
  97. package/src/components/menu-button/menu-button.css +80 -3
  98. package/src/components/menu-button/menu-button.js +21 -37
  99. package/src/components/message/message.css +5 -2
  100. package/src/components/message/message.js +13 -2
  101. package/src/components/modal/modal.css +15 -0
  102. package/src/components/modal/modal.js +141 -0
  103. package/src/components/navigation-bar/navigation-bar.css +77 -2
  104. package/src/components/navigation-bar/navigation-bar.js +171 -4
  105. package/src/components/panel/panel.js +13 -2
  106. package/src/components/search/search.js +17 -5
  107. package/src/components/select/field-adapter.js +4 -1
  108. package/src/components/select/select.js +3 -0
  109. package/src/components/sort-control/sort-control.css +17 -0
  110. package/src/components/sort-control/sort-control.js +140 -0
  111. package/src/components/stat-tile/stat-tile.css +213 -0
  112. package/src/components/stat-tile/stat-tile.js +590 -0
  113. package/src/components/tabbox/tabbox.js +12 -1
  114. package/src/components/table/table.css +51 -2
  115. package/src/components/table/table.js +298 -19
  116. package/src/components/table-view/table-view.css +8 -2
  117. package/src/components/table-view/table-view.js +21 -6
  118. package/src/components/tag-picker/tag-picker.css +3 -1
  119. package/src/components/timebox/timebox.js +18 -5
  120. package/src/components/value-list/value-list.js +22 -6
  121. package/src/components/view/record-view.css +5 -0
  122. package/src/components/view/record-view.js +100 -7
  123. package/src/core/icons.js +74 -5
  124. package/src/index.js +25 -0
  125. package/src/internal/app-rail.js +19 -1
  126. package/src/internal/menu-items.js +142 -0
  127. package/styles/print.css +192 -0
  128. package/styles/zx.css +11 -0
@@ -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,6 +138,17 @@ 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}
@@ -165,3 +185,31 @@ export declare class Modal extends Component<ModalOptions> {
165
185
  */
166
186
  destroy(): void;
167
187
  }
188
+ /**
189
+ * Fired after the modal enters the top layer.
190
+ * @event Modal#open
191
+ * @type {CustomEvent<Record<string, never>>}
192
+ */
193
+ /**
194
+ * Fired after the native dialog closes.
195
+ * @event Modal#close
196
+ * @type {CustomEvent<{result: unknown}>}
197
+ */
198
+ /**
199
+ * Fired when Escape requests cancellation. Preventing it keeps the modal open.
200
+ * @event Modal#cancel
201
+ * @type {CustomEvent<Record<string, never>>}
202
+ */
203
+ /**
204
+ * Picks the control initial focus belongs on inside an overlay panel: an `autofocus` control when
205
+ * the content named one, the first focusable descendant otherwise, and null when the panel holds
206
+ * neither and must take focus itself.
207
+ *
208
+ * Candidates in a hidden, `aria-hidden` or `inert` subtree are skipped, because `focus()` on one
209
+ * is a silent no-op: a `Dialog` whose header close button is hidden by `closable: false`, or whose
210
+ * other registered views sit hidden in the same body, would otherwise "focus" nothing at all and
211
+ * leave the reader with no way into the overlay.
212
+ * @param {Element} root Overlay panel.
213
+ * @returns {HTMLElement|null}
214
+ */
215
+ 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
  }
@@ -68,6 +68,10 @@ export type SelectOptions = {
68
68
  * Empty control text.
69
69
  */
70
70
  placeholder?: string;
71
+ /**
72
+ * Accessible combobox name; falls back to the placeholder.
73
+ */
74
+ label?: string;
71
75
  /**
72
76
  * Whether selection may be cleared.
73
77
  */
@@ -0,0 +1,105 @@
1
+ import { Component } from '../../core/component.js';
2
+ import { Select } from '../select/select.js';
3
+ export type SortField = {
4
+ id: string;
5
+ label: string;
6
+ };
7
+ export type SortValue = {
8
+ id: string;
9
+ dir: 'asc' | 'desc';
10
+ };
11
+ export type SortControlOptions = {
12
+ /**
13
+ * Available sort fields, in display order.
14
+ */
15
+ fields?: SortField[];
16
+ /**
17
+ * Initial sort; null chooses the first field ascending.
18
+ */
19
+ value?: SortValue | null;
20
+ /**
21
+ * Accessible field label and direction-name prefix.
22
+ */
23
+ label?: string;
24
+ /**
25
+ * Current/next direction labels, defaulting to Ascending/Descending.
26
+ */
27
+ labels?: {
28
+ asc?: string;
29
+ desc?: string;
30
+ };
31
+ /**
32
+ * Whether interaction is disabled.
33
+ */
34
+ disabled?: boolean;
35
+ /**
36
+ * Atomic field/direction change.
37
+ */
38
+ onchange?: (event: CustomEvent<{
39
+ value: SortValue;
40
+ }>) => void;
41
+ };
42
+ /** @typedef {{id:string,label:string}} SortField */
43
+ /** @typedef {{id:string,dir:'asc'|'desc'}} SortValue */
44
+ /**
45
+ * @typedef {Object} SortControlOptions
46
+ * @property {SortField[]} [fields=[]] Available sort fields, in display order.
47
+ * @property {SortValue|null} [value=null] Initial sort; null chooses the first field ascending.
48
+ * @property {string} [label='Sort by'] Accessible field label and direction-name prefix.
49
+ * @property {{asc?:string,desc?:string}} [labels={}] Current/next direction labels, defaulting to Ascending/Descending.
50
+ * @property {boolean} [disabled=false] Whether interaction is disabled.
51
+ * @property {(event:CustomEvent<{value:SortValue}>)=>void} [onchange] Atomic field/direction change.
52
+ */
53
+ /**
54
+ * A searchable field selector with an adjacent direction toggle and one shared sort value.
55
+ * @fires SortControl#change
56
+ * @extends {Component<SortControlOptions>}
57
+ */
58
+ export declare class SortControl extends Component<SortControlOptions> {
59
+ _createdRoot: boolean;
60
+ _snapshot: import("../../core/dom.js").TargetSnapshot;
61
+ _value: SortValue;
62
+ _disabled: boolean;
63
+ _direction: HTMLButtonElement;
64
+ _select: Select;
65
+ static cssName: string;
66
+ /** @type {SortControlOptions} */
67
+ static defaults: SortControlOptions;
68
+ /** @returns {HTMLElement} */
69
+ render(): HTMLElement;
70
+ /** Returns a defensive copy of the current sort. @returns {SortValue|null} */
71
+ getValue(): SortValue | null;
72
+ /**
73
+ * Replaces the field and direction atomically; rejects unavailable fields and directions.
74
+ * @param {SortValue|null} value Sort state, or null for the first field ascending.
75
+ * @param {{silent?:boolean}} [options={}] Suppress change when silent.
76
+ * @returns {this}
77
+ */
78
+ setValue(value: SortValue | null, { silent }?: {
79
+ silent?: boolean;
80
+ }): this;
81
+ /** Enables both controls when fields are available. @returns {this} */
82
+ enable(): this;
83
+ /** Disables both controls and closes the option panel. @returns {this} */
84
+ disable(): this;
85
+ /** Updates the icon and accessible current/next direction text. @private @returns {void} */
86
+ private _syncDirection;
87
+ /** Focuses the searchable control. @returns {this} */
88
+ focus(): this;
89
+ /** Releases the owned Select and restores an enhanced target. @returns {void} */
90
+ destroy(): void;
91
+ }
92
+ /**
93
+ * Validates a sort against available fields without retaining caller-owned state.
94
+ * @param {SortValue|null} value Requested sort.
95
+ * @param {SortField[]} fields Available fields.
96
+ * @returns {SortValue|null} Normalized sort, or null for an empty catalogue.
97
+ */
98
+ export declare function normalizeSortValue(value: SortValue | null, fields: SortField[]): SortValue | null;
99
+ /**
100
+ * Builds one searchable record per field without retaining caller-owned objects.
101
+ * @param {SortField[]} fields Available fields.
102
+ * @returns {SortField[]} Choice records.
103
+ */
104
+ export declare function sortChoices(fields: SortField[]): SortField[];
105
+ /** @event SortControl#change @type {CustomEvent<{value:SortValue}>} */
@@ -0,0 +1,277 @@
1
+ import { Component } from '../../core/component.js';
2
+ export type StatTileFormatName = 'number' | 'currency' | 'percent' | 'fileSize' | null;
3
+ export type StatTileFormat = StatTileFormatName | ((value: number | string | null | undefined) => string);
4
+ export type StatTileKind = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info';
5
+ export type StatTileDeltaKind = 'positive' | 'negative' | 'neutral';
6
+ export type StatTileDirection = 'up' | 'down' | 'flat';
7
+ export type StatTileDelta = {
8
+ /**
9
+ * Which way the metric moved, read from the sign alone.
10
+ */
11
+ direction: StatTileDirection;
12
+ /**
13
+ * `'+'`, `'−'` (U+2212), or `''` for an unchanged metric.
14
+ */
15
+ sign: string;
16
+ /**
17
+ * The formatted absolute change, without a sign.
18
+ */
19
+ magnitude: string;
20
+ /**
21
+ * The visible change: `sign` followed by `magnitude`.
22
+ */
23
+ text: string;
24
+ };
25
+ export type StatTileNameParts = {
26
+ /**
27
+ * The metric's name.
28
+ */
29
+ label?: string;
30
+ /**
31
+ * The formatted value.
32
+ */
33
+ value?: string;
34
+ /**
35
+ * The change, already worded for speech (`'up 2'`, not `'+2'`).
36
+ */
37
+ delta?: string;
38
+ /**
39
+ * What the change is measured against.
40
+ */
41
+ deltaLabel?: string;
42
+ };
43
+ export type StatTileOptions = {
44
+ /**
45
+ * The metric's name, set small above the value.
46
+ */
47
+ label?: string;
48
+ /**
49
+ * The metric. A string is rendered as given.
50
+ */
51
+ value?: number | string | null;
52
+ /**
53
+ * How a numeric value is rendered: a named mode, a
54
+ * callback receiving the raw value, or null to print the value unformatted.
55
+ */
56
+ format?: StatTileFormat;
57
+ /**
58
+ * ISO 4217 code used by `format: 'currency'`.
59
+ */
60
+ currency?: string | null;
61
+ /**
62
+ * BCP 47 tag for every formatter; defaults to the active language.
63
+ */
64
+ locale?: string;
65
+ /**
66
+ * Change against the previous period. Rendered with
67
+ * its own sign and an arrow, never with colour alone.
68
+ */
69
+ delta?: number | string | null;
70
+ /**
71
+ * Whether the change is good, bad, or merely a
72
+ * change. This — not the sign's direction — picks the delta colour: a rising ticket count is not
73
+ * a success, so "up is good" is never assumed.
74
+ */
75
+ deltaKind?: StatTileDeltaKind;
76
+ /**
77
+ * How the delta is rendered; defaults to `format`.
78
+ */
79
+ deltaFormat?: StatTileFormat;
80
+ /**
81
+ * What the change is measured against, e.g. `'vs. last week'`.
82
+ */
83
+ deltaLabel?: string;
84
+ /**
85
+ * Values for a decorative sparkline. Fewer than two usable numbers
86
+ * render nothing.
87
+ */
88
+ trend?: number[];
89
+ /**
90
+ * Icon name from `icons.js`, shown beside the label.
91
+ */
92
+ icon?: string | null;
93
+ /**
94
+ * Semantic intent. It tints the icon and the sparkline
95
+ * and never the value, which stays at full text contrast whatever intent a record carries.
96
+ */
97
+ kind?: StatTileKind;
98
+ /**
99
+ * Destination. A tile with an href is an `<a>`.
100
+ */
101
+ href?: string | null;
102
+ /**
103
+ * Renders a `<button>` without an href. Passing `onclick`
104
+ * sets this implicitly; set it directly to subscribe with `on('click', …)` instead.
105
+ */
106
+ clickable?: boolean;
107
+ /**
108
+ * Renders a skeleton shaped like the tile.
109
+ */
110
+ loading?: boolean;
111
+ /**
112
+ * Message overrides, keyed as `statTile.*`.
113
+ */
114
+ msg?: Record<string, unknown>;
115
+ /**
116
+ * Activation listener; its
117
+ * presence is what turns a tile with no href into a button. It is the tile's `click` event, as
118
+ * every Zx component's `on*` option is, so it receives the `CustomEvent` carrying the native
119
+ * event in `detail.event`.
120
+ */
121
+ onclick?: (event: CustomEvent<{
122
+ event: MouseEvent;
123
+ }>) => void;
124
+ };
125
+ /**
126
+ * Renders a metric: a label, the number it names, and — optionally — how that number moved.
127
+ *
128
+ * The value is the loudest thing on the tile; the label sits small above it and the delta and the
129
+ * sparkline are subordinate to both. Nothing here assumes a fixed set of metrics: the label, the
130
+ * intent colour, the icon and the formatting all arrive per instance, so a tile whose content
131
+ * comes from a server is the normal case rather than the exception.
132
+ *
133
+ * The element shape follows the tile's behaviour, and a tag cannot be rewritten in place, so the
134
+ * component normally builds its own root — pass `null` as the target, or use {@link statTile}. An
135
+ * existing element is adopted only when its tag already is the one the options call for; a mismatch
136
+ * throws rather than silently shipping a `<div>` with a click handler or a link that cannot
137
+ * navigate.
138
+ *
139
+ * @fires StatTile#click
140
+ * @extends {Component<StatTileOptions>}
141
+ */
142
+ export declare class StatTile extends Component<StatTileOptions> {
143
+ _createdRoot: boolean;
144
+ _snapshot: import("../../core/dom.js").TargetSnapshot;
145
+ _closed: boolean;
146
+ _state: any;
147
+ static cssName: string;
148
+ /** @type {Readonly<StatTileOptions>} */
149
+ static defaults: Readonly<StatTileOptions>;
150
+ /**
151
+ * Creates or adopts one metric tile.
152
+ * @param {Element|string|null} [target=null] Existing element of the required tag, or null.
153
+ * @param {StatTileOptions} [options={}] Tile options.
154
+ */
155
+ constructor(target?: Element | string | null, options?: StatTileOptions);
156
+ /**
157
+ * @returns {HTMLElement}
158
+ * @throws {TypeError} When an adopted target is not the tag the options require.
159
+ */
160
+ render(): HTMLElement;
161
+ /**
162
+ * Replaces any subset of the tile's content and redraws it. This is how a tile leaves
163
+ * `loading: true` behind once the server answers.
164
+ * @param {StatTileOptions} options Options to merge over the current ones.
165
+ * @returns {this}
166
+ * @throws {TypeError} When the merged options would need a different element tag.
167
+ */
168
+ update(options?: StatTileOptions): this;
169
+ /**
170
+ * Reports the tile's own accessible name, which is what assistive technology announces.
171
+ * @returns {string} Label, value, and delta, in that order.
172
+ */
173
+ getAccessibleName(): string;
174
+ /**
175
+ * Aborts listeners and restores an adopted target to the state it was found in.
176
+ * @returns {void}
177
+ */
178
+ destroy(): void;
179
+ /**
180
+ * Resolves a message through the host translator, falling back to the built-in English text.
181
+ * @param {string} key Message key.
182
+ * @param {...unknown} args Interpolation values.
183
+ * @returns {string}
184
+ */
185
+ _message(key: string, ...args: unknown[]): string;
186
+ }
187
+ /**
188
+ * Creates a tile that builds its own root: the convenience form of `new StatTile(null, options)`,
189
+ * the way `tooltip()` stands in for `new Tooltip(…)`.
190
+ *
191
+ * It returns the component, not an element, so there is one construction idiom and one click path.
192
+ * Call `.toElement()` for the node to place.
193
+ *
194
+ * @param {StatTileOptions} [opts={}] Tile options.
195
+ * @returns {StatTile} The component, whose root is an `<a>`, a `<button>`, or a `<div>`.
196
+ */
197
+ export declare function statTile(opts?: StatTileOptions): StatTile;
198
+ /**
199
+ * Formats the metric itself.
200
+ *
201
+ * A string value is the host's own final text and is passed through untouched; an explicit
202
+ * callback outranks that, because a host that supplies one has asked to decide every case.
203
+ *
204
+ * @param {number|string|null|undefined} value The metric.
205
+ * @param {{format?: StatTileFormat, locale?: string, currency?: string|null}} [options={}] Mode,
206
+ * language, and currency.
207
+ * @returns {string} The text to display; empty for a missing value.
208
+ */
209
+ export declare function formatStatValue(value: number | string | null | undefined, options?: {
210
+ format?: StatTileFormat;
211
+ locale?: string;
212
+ currency?: string | null;
213
+ }): string;
214
+ /**
215
+ * Describes a change without judging it.
216
+ *
217
+ * The direction is read from the sign and nothing else; whether that direction is good news is
218
+ * `deltaKind`'s business, not this function's. The magnitude is formatted from the absolute value
219
+ * and the sign is prepended, because no locale prints a leading `+` on its own.
220
+ *
221
+ * @param {number|string|null|undefined} delta The change.
222
+ * @param {{format?: StatTileFormat, locale?: string, currency?: string|null}} [options={}]
223
+ * Formatting, defaulting to the tile's own.
224
+ * @returns {StatTileDelta|null} The change, or null when there is none to show.
225
+ */
226
+ export declare function statDelta(delta: number | string | null | undefined, options?: {
227
+ format?: StatTileFormat;
228
+ locale?: string;
229
+ currency?: string | null;
230
+ }): StatTileDelta | null;
231
+ /**
232
+ * Chooses the element a tile must be, from what the tile does.
233
+ *
234
+ * A destination is a link, an action is a button, and a tile that does neither is a plain
235
+ * container. A `<div>` never gets a click handler, and an href that could execute script is not a
236
+ * destination at all — it falls through to whichever shape the remaining options justify.
237
+ *
238
+ * @param {{href?: string|null, clickable?: boolean, onclick?: unknown}} [options={}] The options
239
+ * that carry behaviour.
240
+ * @returns {'a'|'button'|'div'} The tag to render.
241
+ */
242
+ export declare function statTileTag(options?: {
243
+ href?: string | null;
244
+ clickable?: boolean;
245
+ onclick?: unknown;
246
+ }): 'a' | 'button' | 'div';
247
+ /**
248
+ * Composes the tile's accessible name: label, then value, then how it changed.
249
+ *
250
+ * The sparkline is decoration and contributes nothing, and the delta arrives already worded —
251
+ * `'up 2'` rather than `'+2'` — because a screen reader should not have to interpret a glyph.
252
+ *
253
+ * @param {StatTileNameParts} [parts={}] The pieces, already formatted and translated.
254
+ * @returns {string} The name, with empty pieces dropped rather than left as stray punctuation.
255
+ */
256
+ export declare function statTileName(parts?: StatTileNameParts): string;
257
+ /**
258
+ * Projects a series onto the sparkline's user-unit box.
259
+ *
260
+ * A series needs two usable numbers to be a line; a flat series is drawn down the middle rather
261
+ * than along the floor, which would read as zero.
262
+ *
263
+ * @param {unknown[]} values The series, in order. Unusable entries are dropped.
264
+ * @param {{width?: number, height?: number, inset?: number}} [box={}] The target box.
265
+ * @returns {string|null} An SVG `points` list, or null when there is no line to draw.
266
+ */
267
+ export declare function statTrendPoints(values: unknown[], box?: {
268
+ width?: number;
269
+ height?: number;
270
+ inset?: number;
271
+ }): string | null;
272
+ /**
273
+ * Fired when a linked or clickable tile is activated. A tile with neither an href nor a click
274
+ * handler is a `<div>` and never emits it.
275
+ * @event StatTile#click
276
+ * @type {CustomEvent<{event: MouseEvent}>}
277
+ */
@@ -236,4 +236,11 @@ export declare class Tabbox extends Component<TabboxOptions> {
236
236
  _require(name: string): TabRecord;
237
237
  /** @param {Element} tab @returns {TabRecord|null} */
238
238
  _recordForTab(tab: Element): TabRecord | null;
239
+ /**
240
+ * Resolves a message through the host translator, falling back to the built-in English text.
241
+ * @param {string} key Message key.
242
+ * @param {string} fallback English default.
243
+ * @returns {string}
244
+ */
245
+ _message(key: string, fallback: string): string;
239
246
  }