@zeyos/zx 4.3.0 → 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.
- package/CHANGELOG.md +266 -1
- package/README.md +7 -3
- package/dist/types/components/activity-item/activity-item.d.ts +351 -0
- package/dist/types/components/activity-list/activity-list.d.ts +195 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +28 -0
- package/dist/types/components/button/button.d.ts +8 -0
- package/dist/types/components/calendar/calendar-model.d.ts +22 -0
- package/dist/types/components/calendar/calendar.d.ts +19 -0
- package/dist/types/components/card/card.d.ts +7 -0
- package/dist/types/components/card-view/card-view.d.ts +12 -4
- package/dist/types/components/card-view/record-card.d.ts +53 -5
- package/dist/types/components/code-editor/code-editor.d.ts +160 -0
- package/dist/types/components/code-editor/field-adapter.d.ts +5 -0
- package/dist/types/components/context-menu/context-menu.d.ts +18 -2
- package/dist/types/components/date-picker/date-picker.d.ts +8 -0
- package/dist/types/components/date-picker/time-picker.d.ts +7 -0
- package/dist/types/components/dialog/dialog.d.ts +29 -0
- package/dist/types/components/entity-ref/entity-ref.d.ts +331 -0
- package/dist/types/components/file-item/file-item.d.ts +234 -0
- package/dist/types/components/file-list/file-list.d.ts +171 -0
- package/dist/types/components/filter/filter.d.ts +91 -36
- package/dist/types/components/filter-panel/filter-panel.d.ts +449 -0
- package/dist/types/components/kanban-view/kanban-card.d.ts +138 -0
- package/dist/types/components/kanban-view/kanban-policy.d.ts +268 -0
- package/dist/types/components/kanban-view/kanban-view.d.ts +837 -26
- package/dist/types/components/launcher/launcher.d.ts +19 -12
- package/dist/types/components/list-toolbar/list-toolbar.d.ts +599 -0
- package/dist/types/components/menu-button/menu-button.d.ts +4 -37
- package/dist/types/components/message/message.d.ts +7 -0
- package/dist/types/components/modal/modal.d.ts +48 -0
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +105 -21
- package/dist/types/components/panel/panel.d.ts +7 -0
- package/dist/types/components/search/search.d.ts +7 -0
- package/dist/types/components/select/select.d.ts +4 -0
- package/dist/types/components/sort-control/sort-control.d.ts +105 -0
- package/dist/types/components/stat-tile/stat-tile.d.ts +277 -0
- package/dist/types/components/tabbox/tabbox.d.ts +7 -0
- package/dist/types/components/table/table.d.ts +144 -0
- package/dist/types/components/table-view/table-view.d.ts +11 -5
- package/dist/types/components/timebox/timebox.d.ts +7 -0
- package/dist/types/components/value-list/value-list.d.ts +8 -0
- package/dist/types/components/view/record-view.d.ts +96 -5
- package/dist/types/core/component.d.ts +6 -1
- package/dist/types/core/icons.d.ts +17 -0
- package/dist/types/index.d.ts +13 -1
- package/dist/types/internal/app-rail.d.ts +10 -0
- package/dist/types/internal/menu-items.d.ts +134 -0
- package/dist/zx-zeyos.esm.js +651 -88
- package/dist/zx-zeyos.esm.min.js +8 -1
- package/dist/zx.css +6266 -3900
- package/dist/zx.esm.js +8487 -1805
- package/dist/zx.esm.min.js +10 -3
- package/dist/zx.global.js +8487 -1805
- package/dist/zx.global.min.js +10 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1811 -247
- package/docs/llms.md +345 -40
- package/docs/llms.txt +11 -7
- package/package.json +1 -2
- package/src/components/activity-item/activity-item.css +137 -0
- package/src/components/activity-item/activity-item.js +599 -0
- package/src/components/activity-list/activity-list.css +64 -0
- package/src/components/activity-list/activity-list.js +375 -0
- package/src/components/app-rail/app-rail.css +227 -19
- package/src/components/app-sidebar/app-sidebar.css +414 -24
- package/src/components/app-sidebar/app-sidebar.js +65 -5
- package/src/components/button/button.css +8 -0
- package/src/components/button/button.js +6 -1
- package/src/components/calendar/calendar-model.js +45 -0
- package/src/components/calendar/calendar.css +30 -10
- package/src/components/calendar/calendar.js +41 -13
- package/src/components/card/card.js +12 -1
- package/src/components/card-view/card-view.css +212 -9
- package/src/components/card-view/card-view.js +32 -16
- package/src/components/card-view/record-card.js +98 -21
- package/src/components/code-editor/code-editor.css +67 -0
- package/src/components/code-editor/code-editor.js +288 -0
- package/src/components/code-editor/field-adapter.js +34 -0
- package/src/components/context-menu/context-menu.css +80 -3
- package/src/components/context-menu/context-menu.js +22 -30
- package/src/components/date-picker/date-picker.js +22 -8
- package/src/components/date-picker/month-picker.js +3 -3
- package/src/components/date-picker/time-picker.js +20 -8
- package/src/components/dialog/dialog.js +88 -66
- package/src/components/dropdown/dropdown.js +2 -2
- package/src/components/entity-ref/entity-ref.css +182 -0
- package/src/components/entity-ref/entity-ref.js +496 -0
- package/src/components/file-item/file-item.css +88 -0
- package/src/components/file-item/file-item.js +371 -0
- package/src/components/file-list/file-list.css +51 -0
- package/src/components/file-list/file-list.js +320 -0
- package/src/components/filter/filter.css +27 -1
- package/src/components/filter/filter.js +199 -45
- package/src/components/filter-panel/filter-panel.css +104 -0
- package/src/components/filter-panel/filter-panel.js +964 -0
- package/src/components/kanban-view/kanban-card.js +239 -0
- package/src/components/kanban-view/kanban-policy.js +412 -0
- package/src/components/kanban-view/kanban-view.css +674 -36
- package/src/components/kanban-view/kanban-view.js +1762 -240
- package/src/components/launcher/launcher.js +59 -27
- package/src/components/list-toolbar/list-toolbar.css +189 -0
- package/src/components/list-toolbar/list-toolbar.js +851 -0
- package/src/components/menu-button/menu-button.css +80 -3
- package/src/components/menu-button/menu-button.js +21 -37
- package/src/components/message/message.css +14 -12
- package/src/components/message/message.js +13 -2
- package/src/components/modal/modal.css +15 -0
- package/src/components/modal/modal.js +141 -0
- package/src/components/navigation-bar/navigation-bar.css +77 -2
- package/src/components/navigation-bar/navigation-bar.js +171 -4
- package/src/components/panel/panel.js +13 -2
- package/src/components/search/search.js +17 -5
- package/src/components/select/field-adapter.js +4 -1
- package/src/components/select/select.js +3 -0
- package/src/components/sort-control/sort-control.css +17 -0
- package/src/components/sort-control/sort-control.js +140 -0
- package/src/components/stat-tile/stat-tile.css +213 -0
- package/src/components/stat-tile/stat-tile.js +590 -0
- package/src/components/tabbox/tabbox.js +12 -1
- package/src/components/table/table.css +51 -2
- package/src/components/table/table.js +298 -19
- package/src/components/table-view/table-view.css +8 -2
- package/src/components/table-view/table-view.js +21 -6
- package/src/components/tag-picker/tag-picker.css +3 -1
- package/src/components/timebox/timebox.js +18 -5
- package/src/components/value-list/value-list.js +22 -6
- package/src/components/view/record-view.css +5 -0
- package/src/components/view/record-view.js +100 -7
- package/src/core/component.js +8 -3
- package/src/core/icons.js +74 -5
- package/src/index.js +33 -3
- package/src/internal/app-rail.js +19 -1
- package/src/internal/menu-items.js +142 -0
- package/styles/print.css +192 -0
- package/styles/zx.css +11 -0
- package/DESIGN-SYSTEM.md +0 -182
|
@@ -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,8 @@ export type MenuButtonOptions = {
|
|
|
63
38
|
*/
|
|
64
39
|
onclose?: (event: CustomEvent<Record<string, never>>) => void;
|
|
65
40
|
};
|
|
66
|
-
/**
|
|
67
|
-
|
|
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
|
+
/** @typedef {import('../../internal/menu-items.js').MenuItem} MenuItem */
|
|
42
|
+
/** @typedef {import('../../internal/menu-items.js').MenuEntry} MenuButtonItem */
|
|
76
43
|
/**
|
|
77
44
|
* @typedef {Object} MenuButtonOptions
|
|
78
45
|
* @property {string} [label=''] Trigger label.
|
|
@@ -217,4 +217,11 @@ export declare class Message extends Component<MessageOptions> {
|
|
|
217
217
|
_close(entry: any): void;
|
|
218
218
|
/** @param {any} entry @returns {void} */
|
|
219
219
|
_finish(entry: any): void;
|
|
220
|
+
/**
|
|
221
|
+
* Resolves a message through the host translator, falling back to the built-in English text.
|
|
222
|
+
* @param {string} key Message key.
|
|
223
|
+
* @param {string} fallback English default.
|
|
224
|
+
* @returns {string}
|
|
225
|
+
*/
|
|
226
|
+
_message(key: string, fallback: string): string;
|
|
220
227
|
}
|
|
@@ -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
|
-
*
|
|
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
|
-
|
|
86
|
+
overflow?: boolean;
|
|
94
87
|
/**
|
|
95
|
-
*
|
|
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
|
-
|
|
94
|
+
overflowBelow?: string | number | false;
|
|
98
95
|
/**
|
|
99
|
-
*
|
|
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
|
-
|
|
100
|
+
minVisible?: number;
|
|
102
101
|
/**
|
|
103
|
-
*
|
|
104
|
-
*/
|
|
105
|
-
panel: HTMLElement | null;
|
|
106
|
-
/**
|
|
107
|
-
* Whether panel content has been mounted.
|
|
102
|
+
* Change callback.
|
|
108
103
|
*/
|
|
109
|
-
|
|
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
|
-
/**
|
|
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,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}>} */
|