@zeyos/zx 5.0.0 → 5.2.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 (154) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/README.md +2 -1
  3. package/dist/types/components/account-menu/account-menu.d.ts +8 -0
  4. package/dist/types/components/activity-list/activity-list.d.ts +9 -1
  5. package/dist/types/components/app-icon/app-icon.d.ts +14 -2
  6. package/dist/types/components/app-sidebar/app-sidebar.d.ts +288 -14
  7. package/dist/types/components/calendar/calendar.d.ts +67 -5
  8. package/dist/types/components/card-view/card-view.d.ts +7 -4
  9. package/dist/types/components/card-view/record-card.d.ts +11 -0
  10. package/dist/types/components/context-menu/context-menu.d.ts +6 -2
  11. package/dist/types/components/data-filter/data-filter.d.ts +4 -4
  12. package/dist/types/components/dropdown/dropdown.d.ts +22 -7
  13. package/dist/types/components/field/field.d.ts +30 -0
  14. package/dist/types/components/fieldset/external-adapter.d.ts +83 -0
  15. package/dist/types/components/fieldset/fieldset.d.ts +7 -0
  16. package/dist/types/components/file-list/file-list.d.ts +35 -3
  17. package/dist/types/components/filter/filter.d.ts +127 -3
  18. package/dist/types/components/filter-panel/filter-panel.d.ts +36 -7
  19. package/dist/types/components/launcher/launcher.d.ts +8 -0
  20. package/dist/types/components/list-toolbar/list-toolbar.d.ts +15 -6
  21. package/dist/types/components/menu-button/menu-button.d.ts +6 -0
  22. package/dist/types/components/message/message.d.ts +14 -1
  23. package/dist/types/components/modal/modal.d.ts +30 -0
  24. package/dist/types/components/module-bar/module-bar.d.ts +395 -0
  25. package/dist/types/components/pagination/pagination.d.ts +17 -3
  26. package/dist/types/components/select/select.d.ts +6 -0
  27. package/dist/types/components/sheet/sheet.d.ts +15 -0
  28. package/dist/types/components/table/table.d.ts +265 -17
  29. package/dist/types/components/view/record-view.d.ts +59 -2
  30. package/dist/types/components/view-settings/view-settings.d.ts +879 -0
  31. package/dist/types/components/workspace-switcher/workspace-switcher.d.ts +327 -0
  32. package/dist/types/core/component.d.ts +12 -2
  33. package/dist/types/core/i18n.d.ts +27 -3
  34. package/dist/types/core/keyboard.d.ts +98 -1
  35. package/dist/types/core/messages.d.ts +382 -0
  36. package/dist/types/core/overlay-host.d.ts +28 -1
  37. package/dist/types/core/overlay-stack.d.ts +260 -0
  38. package/dist/types/index.d.ts +5 -2
  39. package/dist/types/internal/app-rail.d.ts +38 -0
  40. package/dist/types/internal/menu-items.d.ts +71 -3
  41. package/dist/types/zeyos/index.d.ts +1 -0
  42. package/dist/types/zeyos/launcher.d.ts +9 -0
  43. package/dist/types/zeyos/module-bar.d.ts +176 -0
  44. package/dist/types/zeyos/query.d.ts +31 -5
  45. package/dist/types/zeyos/table.d.ts +245 -8
  46. package/dist/types/zeyos/view.d.ts +16 -2
  47. package/dist/zx-zeyos.esm.js +4422 -430
  48. package/dist/zx-zeyos.esm.min.js +5 -5
  49. package/dist/zx.css +1417 -134
  50. package/dist/zx.esm.js +6986 -830
  51. package/dist/zx.esm.min.js +8 -8
  52. package/dist/zx.global.js +6986 -830
  53. package/dist/zx.global.min.js +8 -8
  54. package/dist/zx.min.css +1 -1
  55. package/docs/api.json +794 -17
  56. package/docs/llms.md +503 -63
  57. package/docs/llms.txt +6 -2
  58. package/package.json +1 -1
  59. package/src/components/account-menu/account-menu.js +12 -0
  60. package/src/components/activity-list/activity-list.js +27 -1
  61. package/src/components/app-icon/app-icon.css +13 -2
  62. package/src/components/app-icon/app-icon.js +11 -1
  63. package/src/components/app-rail/app-rail.css +19 -0
  64. package/src/components/app-sidebar/app-sidebar.css +204 -3
  65. package/src/components/app-sidebar/app-sidebar.js +646 -40
  66. package/src/components/breadcrumb/breadcrumb.css +1 -1
  67. package/src/components/calendar/calendar.css +1 -1
  68. package/src/components/calendar/calendar.js +26 -52
  69. package/src/components/card/card.css +2 -2
  70. package/src/components/card-view/card-view.css +5 -5
  71. package/src/components/card-view/card-view.js +13 -9
  72. package/src/components/card-view/record-card.js +14 -3
  73. package/src/components/code-editor/code-editor.css +1 -1
  74. package/src/components/code-editor/field-adapter.js +9 -2
  75. package/src/components/context-menu/context-menu.js +8 -2
  76. package/src/components/copy/copy-input.css +1 -1
  77. package/src/components/data-filter/data-filter.js +2 -2
  78. package/src/components/date-picker/time-picker.css +2 -2
  79. package/src/components/dock/dock.css +5 -4
  80. package/src/components/dropdown/dropdown.js +157 -72
  81. package/src/components/field/field.js +33 -3
  82. package/src/components/fieldset/external-adapter.js +363 -0
  83. package/src/components/fieldset/fieldset.js +10 -59
  84. package/src/components/file-list/file-list.js +144 -21
  85. package/src/components/filter/filter.css +86 -2
  86. package/src/components/filter/filter.js +300 -8
  87. package/src/components/filter-panel/filter-panel.js +149 -32
  88. package/src/components/finder/finder.css +1 -1
  89. package/src/components/kanban-view/kanban-view.css +3 -3
  90. package/src/components/kanban-view/kanban-view.js +5 -2
  91. package/src/components/launcher/launcher.css +1 -1
  92. package/src/components/launcher/launcher.js +29 -3
  93. package/src/components/list-toolbar/list-toolbar.js +39 -13
  94. package/src/components/master-panel/master-panel.js +0 -1
  95. package/src/components/menu-button/menu-button.css +63 -0
  96. package/src/components/menu-button/menu-button.js +97 -11
  97. package/src/components/message/message.js +60 -20
  98. package/src/components/modal/modal.css +1 -1
  99. package/src/components/modal/modal.js +66 -13
  100. package/src/components/module-bar/module-bar.css +486 -0
  101. package/src/components/module-bar/module-bar.js +1074 -0
  102. package/src/components/multi-value-editor/multi-value-editor.css +1 -1
  103. package/src/components/number-field/field-adapter.js +2 -1
  104. package/src/components/pagination/pagination.css +5 -5
  105. package/src/components/pagination/pagination.js +20 -4
  106. package/src/components/panel/panel.css +3 -2
  107. package/src/components/questionnaire/questionnaire.css +4 -4
  108. package/src/components/rating/field-adapter.js +2 -1
  109. package/src/components/rating/rating.css +1 -1
  110. package/src/components/search/search.css +4 -1
  111. package/src/components/select/select.js +9 -0
  112. package/src/components/sheet/sheet.css +1 -1
  113. package/src/components/sheet/sheet.js +74 -32
  114. package/src/components/slider/field-adapter.js +6 -1
  115. package/src/components/slider/slider.css +2 -2
  116. package/src/components/split-view/split-view.css +1 -1
  117. package/src/components/stat-tile/stat-tile.css +1 -1
  118. package/src/components/stepper/stepper.css +1 -1
  119. package/src/components/tabbox/tabbox.css +9 -5
  120. package/src/components/table/table.css +86 -11
  121. package/src/components/table/table.js +628 -57
  122. package/src/components/tag-picker/field-adapter.js +2 -1
  123. package/src/components/tooltip/tooltip.js +35 -17
  124. package/src/components/tree/tree.css +1 -1
  125. package/src/components/view/record-view.css +1 -1
  126. package/src/components/view/record-view.js +178 -18
  127. package/src/components/view-settings/view-settings.css +285 -0
  128. package/src/components/view-settings/view-settings.js +1830 -0
  129. package/src/components/workspace-switcher/workspace-switcher.css +188 -0
  130. package/src/components/workspace-switcher/workspace-switcher.js +463 -0
  131. package/src/core/component.js +88 -17
  132. package/src/core/fontawesome.js +5 -1
  133. package/src/core/i18n.js +47 -4
  134. package/src/core/icons.js +12 -2
  135. package/src/core/keyboard.js +206 -11
  136. package/src/core/messages.js +427 -0
  137. package/src/core/overlay-host.js +64 -9
  138. package/src/core/overlay-stack.js +487 -0
  139. package/src/core/position.js +22 -3
  140. package/src/index.js +5 -2
  141. package/src/internal/app-rail.js +134 -53
  142. package/src/internal/menu-items.js +61 -3
  143. package/src/zeyos/form.js +5 -3
  144. package/src/zeyos/index.js +3 -0
  145. package/src/zeyos/launcher.js +8 -3
  146. package/src/zeyos/module-bar.js +181 -0
  147. package/src/zeyos/query.js +44 -13
  148. package/src/zeyos/table.js +220 -80
  149. package/src/zeyos/view.js +43 -93
  150. package/styles/base.css +16 -1
  151. package/styles/print.css +1 -1
  152. package/styles/tokens/dark.css +4 -0
  153. package/styles/tokens/semantic.css +56 -28
  154. package/styles/zx.css +3 -0
@@ -0,0 +1,327 @@
1
+ import { Component } from '../../core/component.js';
2
+ import { MenuButton } from '../menu-button/menu-button.js';
3
+ export type MenuButtonItem = import('../menu-button/menu-button.js').MenuButtonItem;
4
+ export type AppIconTone = import('../app-icon/app-icon.js').AppIconTone;
5
+ export type WorkspaceItem = {
6
+ /**
7
+ * Stable identifier; the `active` option and `setActive()` name it.
8
+ */
9
+ id: string | number;
10
+ /**
11
+ * Workspace name.
12
+ */
13
+ label: string;
14
+ /**
15
+ * Secondary line: plan, role, domain.
16
+ */
17
+ secondary?: string;
18
+ /**
19
+ * Icon name or node drawn on the tile instead of the initial. A node
20
+ * is cloned for each place the tile appears.
21
+ */
22
+ icon?: string | Node;
23
+ /**
24
+ * Tile colour from the theme's categorical palette. Without `tone`
25
+ * or `color` the tone is derived from the label, so a workspace keeps its colour everywhere.
26
+ */
27
+ tone?: AppIconTone;
28
+ /**
29
+ * Tile colour, any CSS colour; takes precedence over `tone`.
30
+ */
31
+ color?: string;
32
+ /**
33
+ * Image drawn as the tile instead of the initial or icon.
34
+ */
35
+ src?: string | null;
36
+ /**
37
+ * Explicit tile initials; derived from the label when omitted.
38
+ */
39
+ initials?: string;
40
+ /**
41
+ * Compact trailing metadata in the menu, such as an unread count.
42
+ */
43
+ badge?: string | number;
44
+ /**
45
+ * Whether the workspace is listed but cannot be chosen.
46
+ */
47
+ disabled?: boolean;
48
+ };
49
+ export type WorkspaceSwitcherSelectDetail = {
50
+ /**
51
+ * The workspace being switched to.
52
+ */
53
+ workspace: WorkspaceItem;
54
+ /**
55
+ * Its id.
56
+ */
57
+ id: string | number;
58
+ /**
59
+ * The workspace active until now.
60
+ */
61
+ previous: WorkspaceItem | null;
62
+ };
63
+ export type WorkspaceSwitcherOptions = {
64
+ /**
65
+ * Workspaces in menu order. Entries without an id are
66
+ * skipped, and a repeated id keeps its first entry.
67
+ */
68
+ workspaces?: WorkspaceItem[];
69
+ /**
70
+ * Active workspace id. Defaults to the first enabled
71
+ * workspace, which also stands in for an id that is not listed or is disabled.
72
+ */
73
+ active?: string | number | null;
74
+ /**
75
+ * Extra actions listed after the workspaces — "Create
76
+ * workspace", "Workspace settings", `'-'` separators, "Sign out". A separator is inserted
77
+ * between the workspaces and the actions automatically.
78
+ */
79
+ items?: MenuButtonItem[];
80
+ /**
81
+ * Whether the trigger shows the tile alone.
82
+ */
83
+ compact?: boolean;
84
+ /**
85
+ * Group label above the workspaces; null resolves message
86
+ * `workspaceSwitcher.heading` ("Workspaces"), and an empty string leaves the label out.
87
+ */
88
+ heading?: string | null;
89
+ /**
90
+ * Trigger accessible name, in which `%1` is the active
91
+ * workspace's name and is filled in again after every switch. Null resolves message
92
+ * `workspaceSwitcher.label` ("Switch workspace: %1"), or `workspaceSwitcher.labelEmpty`
93
+ * ("Switch workspace") while no workspace is active.
94
+ */
95
+ label?: string | null;
96
+ /**
97
+ * Popup placement.
98
+ */
99
+ placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top' | 'right-start' | 'right-end' | 'left-start' | 'left-end' | 'right' | 'left';
100
+ /**
101
+ * Preventable
102
+ * workspace switch; `preventDefault()` keeps the previous workspace active and the menu open.
103
+ */
104
+ onselect?: (event: CustomEvent<WorkspaceSwitcherSelectDetail>) => void;
105
+ /**
106
+ * Preventable
107
+ * extra action; `preventDefault()` skips the item's own callback and keeps the menu open.
108
+ */
109
+ onaction?: (event: CustomEvent<{
110
+ value: unknown;
111
+ item: object;
112
+ }>) => void;
113
+ /**
114
+ * Open listener.
115
+ */
116
+ onopen?: (event: CustomEvent<Record<string, never>>) => void;
117
+ /**
118
+ * Close listener.
119
+ */
120
+ onclose?: (event: CustomEvent<Record<string, never>>) => void;
121
+ /**
122
+ * Component-local message overrides, by key:
123
+ * `workspaceSwitcher.heading` ("Workspaces"), `workspaceSwitcher.label` ("Switch workspace: %1",
124
+ * `%1` the active workspace's name), and `workspaceSwitcher.labelEmpty` ("Switch workspace",
125
+ * the trigger's name while no workspace is active).
126
+ */
127
+ msg?: Record<string, unknown>;
128
+ };
129
+ /** @typedef {import('../menu-button/menu-button.js').MenuButtonItem} MenuButtonItem */
130
+ /** @typedef {import('../app-icon/app-icon.js').AppIconTone} AppIconTone */
131
+ /**
132
+ * One workspace, account, or organisation the user can switch to.
133
+ * @typedef {Object} WorkspaceItem
134
+ * @property {string|number} id Stable identifier; the `active` option and `setActive()` name it.
135
+ * @property {string} label Workspace name.
136
+ * @property {string} [secondary] Secondary line: plan, role, domain.
137
+ * @property {string|Node} [icon] Icon name or node drawn on the tile instead of the initial. A node
138
+ * is cloned for each place the tile appears.
139
+ * @property {AppIconTone} [tone] Tile colour from the theme's categorical palette. Without `tone`
140
+ * or `color` the tone is derived from the label, so a workspace keeps its colour everywhere.
141
+ * @property {string} [color] Tile colour, any CSS colour; takes precedence over `tone`.
142
+ * @property {string|null} [src] Image drawn as the tile instead of the initial or icon.
143
+ * @property {string} [initials] Explicit tile initials; derived from the label when omitted.
144
+ * @property {string|number} [badge] Compact trailing metadata in the menu, such as an unread count.
145
+ * @property {boolean} [disabled=false] Whether the workspace is listed but cannot be chosen.
146
+ */
147
+ /**
148
+ * @typedef {Object} WorkspaceSwitcherSelectDetail
149
+ * @property {WorkspaceItem} workspace The workspace being switched to.
150
+ * @property {string|number} id Its id.
151
+ * @property {WorkspaceItem|null} previous The workspace active until now.
152
+ */
153
+ /**
154
+ * @typedef {Object} WorkspaceSwitcherOptions
155
+ * @property {WorkspaceItem[]} [workspaces=[]] Workspaces in menu order. Entries without an id are
156
+ * skipped, and a repeated id keeps its first entry.
157
+ * @property {string|number|null} [active=null] Active workspace id. Defaults to the first enabled
158
+ * workspace, which also stands in for an id that is not listed or is disabled.
159
+ * @property {MenuButtonItem[]} [items=[]] Extra actions listed after the workspaces — "Create
160
+ * workspace", "Workspace settings", `'-'` separators, "Sign out". A separator is inserted
161
+ * between the workspaces and the actions automatically.
162
+ * @property {boolean} [compact=false] Whether the trigger shows the tile alone.
163
+ * @property {string|null} [heading=null] Group label above the workspaces; null resolves message
164
+ * `workspaceSwitcher.heading` ("Workspaces"), and an empty string leaves the label out.
165
+ * @property {string|null} [label=null] Trigger accessible name, in which `%1` is the active
166
+ * workspace's name and is filled in again after every switch. Null resolves message
167
+ * `workspaceSwitcher.label` ("Switch workspace: %1"), or `workspaceSwitcher.labelEmpty`
168
+ * ("Switch workspace") while no workspace is active.
169
+ * @property {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'|'right-start'|'right-end'|'left-start'|'left-end'|'right'|'left'} [placement='bottom-start'] Popup placement.
170
+ * @property {(event: CustomEvent<WorkspaceSwitcherSelectDetail>) => void} [onselect] Preventable
171
+ * workspace switch; `preventDefault()` keeps the previous workspace active and the menu open.
172
+ * @property {(event: CustomEvent<{value: unknown, item: object}>) => void} [onaction] Preventable
173
+ * extra action; `preventDefault()` skips the item's own callback and keeps the menu open.
174
+ * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open listener.
175
+ * @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close listener.
176
+ * @property {Record<string, unknown>} [msg] Component-local message overrides, by key:
177
+ * `workspaceSwitcher.heading` ("Workspaces"), `workspaceSwitcher.label` ("Switch workspace: %1",
178
+ * `%1` the active workspace's name), and `workspaceSwitcher.labelEmpty` ("Switch workspace",
179
+ * the trigger's name while no workspace is active).
180
+ */
181
+ /**
182
+ * Workspace switcher for the head of an application's navigation: a trigger with the current
183
+ * workspace's tile, name, and secondary line, opening an APG menu of the workspaces — the current
184
+ * one checked — followed by the application's own actions. Which workspaces a user may see, and
185
+ * what switching means, stay application-owned.
186
+ * @fires WorkspaceSwitcher#select
187
+ * @fires WorkspaceSwitcher#action
188
+ * @fires WorkspaceSwitcher#open
189
+ * @fires WorkspaceSwitcher#close
190
+ * @extends {Component<WorkspaceSwitcherOptions>}
191
+ */
192
+ export declare class WorkspaceSwitcher extends Component<WorkspaceSwitcherOptions> {
193
+ _menu: MenuButton;
194
+ _createdRoot: boolean;
195
+ _snapshot: import("../../core/dom.js").TargetSnapshot;
196
+ _workspaces: WorkspaceItem[];
197
+ _activeId: string | number;
198
+ _items: import("../../internal/menu-items.js").MenuEntry[];
199
+ /** @type {Map<object, WorkspaceItem>} Menu entries that stand for a workspace. */
200
+ _entries: Map<object, WorkspaceItem>;
201
+ static cssName: string;
202
+ /** @type {Readonly<WorkspaceSwitcherOptions>} */
203
+ static defaults: Readonly<WorkspaceSwitcherOptions>;
204
+ /**
205
+ * Creates or enhances a workspace-switcher host.
206
+ * @param {Element|string|null} target Host target.
207
+ * @param {WorkspaceSwitcherOptions} [options={}] Workspace-switcher options.
208
+ */
209
+ constructor(target?: Element | string | null, options?: WorkspaceSwitcherOptions);
210
+ /** @returns {HTMLElement} */
211
+ render(): HTMLElement;
212
+ /** Returns the active workspace, or null when no workspace is enabled. @returns {WorkspaceItem|null} */
213
+ getActive(): WorkspaceItem | null;
214
+ /**
215
+ * Makes another workspace active. An unknown or disabled id changes nothing.
216
+ * @param {string|number} id Workspace id.
217
+ * @param {{silent?: boolean}} [options={}] `silent: false` emits the preventable `select` first;
218
+ * by default the change is silent, as a change the application made itself.
219
+ * @returns {this}
220
+ * @fires WorkspaceSwitcher#select
221
+ */
222
+ setActive(id: string | number, { silent }?: {
223
+ silent?: boolean;
224
+ }): this;
225
+ /**
226
+ * Replaces the workspaces. The active workspace stays active while it is still listed and
227
+ * enabled; otherwise the first enabled workspace becomes active, silently.
228
+ * @param {WorkspaceItem[]} workspaces Workspaces in menu order.
229
+ * @returns {this}
230
+ */
231
+ setWorkspaces(workspaces: WorkspaceItem[]): this;
232
+ /** Replaces the extra actions after the workspaces. @param {MenuButtonItem[]} items @returns {this} */
233
+ setItems(items: MenuButtonItem[]): this;
234
+ /**
235
+ * Shows the tile alone, or the tile with the name, secondary line, and chevron — for a navigation
236
+ * column that narrows to icons and widens again. The trigger keeps its full accessible name and
237
+ * gains the workspace name as a tooltip while compact.
238
+ * @param {boolean} compact
239
+ * @returns {this}
240
+ */
241
+ setCompact(compact: boolean): this;
242
+ /** Opens the menu. @returns {this} */
243
+ open(): this;
244
+ /** Closes the menu. @returns {this} */
245
+ close(): this;
246
+ /** Toggles the menu. @returns {this} */
247
+ toggle(): this;
248
+ /** Reports whether the menu is open. @returns {boolean} */
249
+ isOpen(): boolean;
250
+ /** Focuses the trigger. @returns {this} */
251
+ focus(): this;
252
+ /** Returns the menu panel for shell hover and focus coordination. @returns {HTMLElement} */
253
+ getPanel(): HTMLElement;
254
+ /** Destroys the menu and restores or removes the host. @returns {void} */
255
+ destroy(): void;
256
+ /** @returns {void} */
257
+ _sync(): void;
258
+ /** @returns {void} */
259
+ _renderTrigger(): void;
260
+ /** @returns {void} */
261
+ _renderMenu(): void;
262
+ /** @param {CustomEvent<{value: unknown, item: object}>} event @returns {void} */
263
+ _onMenuSelect(event: CustomEvent<{
264
+ value: unknown;
265
+ item: object;
266
+ }>): void;
267
+ /** @param {WorkspaceItem} workspace @returns {CustomEvent<WorkspaceSwitcherSelectDetail>} */
268
+ _emitSelect(workspace: WorkspaceItem): CustomEvent<WorkspaceSwitcherSelectDetail>;
269
+ /**
270
+ * Resolves a message, falling back to English when no translation is registered.
271
+ * @param {string} key Message key.
272
+ * @param {string} fallback English fallback with `%1` placeholders.
273
+ * @param {...unknown} args Interpolation values.
274
+ * @returns {string}
275
+ */
276
+ _message(key: string, fallback: string, ...args: unknown[]): string;
277
+ }
278
+ /**
279
+ * Normalises one workspace definition: a string id or label, a tone the palette knows, a colour
280
+ * only when no tone was asked for, and initials derived from the label when none were given.
281
+ * @param {unknown} value Candidate workspace.
282
+ * @returns {(WorkspaceItem & {label: string, secondary: string, initials: string, disabled: boolean, tone: AppIconTone|null, color: string|null, src: string|null}) | null}
283
+ * The workspace, or null when it has no usable id.
284
+ */
285
+ export declare function normalizeWorkspace(value: unknown): (WorkspaceItem & {
286
+ label: string;
287
+ secondary: string;
288
+ initials: string;
289
+ disabled: boolean;
290
+ tone: AppIconTone | null;
291
+ color: string | null;
292
+ src: string | null;
293
+ }) | null;
294
+ /**
295
+ * Normalises a workspace list, skipping entries without an id and repeats of an id already listed.
296
+ * @param {unknown} list Candidate workspaces.
297
+ * @returns {WorkspaceItem[]}
298
+ */
299
+ export declare function normalizeWorkspaces(list: unknown): WorkspaceItem[];
300
+ /**
301
+ * Resolves the active workspace id: the requested one when it is listed and enabled, otherwise the
302
+ * first enabled workspace, otherwise null. Ids compare as strings, so `3` finds `'3'`.
303
+ * @param {WorkspaceItem[]} workspaces Normalised workspaces.
304
+ * @param {string|number|null|undefined} active Requested id.
305
+ * @returns {string|number|null}
306
+ */
307
+ export declare function resolveActive(workspaces: WorkspaceItem[], active: string | number | null | undefined): string | number | null;
308
+ /**
309
+ * The tile initials for a workspace: explicit initials trimmed to two characters, otherwise the
310
+ * first letter of the label, uppercased.
311
+ * @param {unknown} label Workspace name.
312
+ * @param {unknown} [initials] Explicit initials.
313
+ * @returns {string}
314
+ */
315
+ export declare function workspaceInitials(label: unknown, initials?: unknown): string;
316
+ /**
317
+ * Fills a custom trigger label: `%1` becomes the active workspace's name (empty while none is
318
+ * active), so the label follows every switch.
319
+ * @param {unknown} template Label, with an optional `%1`.
320
+ * @param {unknown} name Active workspace name.
321
+ * @returns {string}
322
+ */
323
+ export declare function formatWorkspaceLabel(template: unknown, name: unknown): string;
324
+ /** Fired before the active workspace changes; preventable. @event WorkspaceSwitcher#select @type {CustomEvent<WorkspaceSwitcherSelectDetail>} */
325
+ /** Fired when an extra action is chosen; preventable. @event WorkspaceSwitcher#action @type {CustomEvent<{value: unknown, item: object}>} */
326
+ /** Fired after the menu opens. @event WorkspaceSwitcher#open @type {CustomEvent<Record<string, never>>} */
327
+ /** Fired after the menu closes. @event WorkspaceSwitcher#close @type {CustomEvent<Record<string, never>>} */
@@ -99,9 +99,19 @@ export declare class Component<TOptions extends ComponentOptions = ComponentOpti
99
99
  */
100
100
  toElement(): Element;
101
101
  /**
102
- * Resolves and interpolates a component-local or global translation.
102
+ * Resolves and interpolates one of the component's messages. The first answer wins:
103
+ *
104
+ * 1. the `msg` option this instance was given — a `{[lang]: {key: text}}` table for the active
105
+ * language (the `lang` option, else `getLanguage()`), then a flat `{key: text}` entry;
106
+ * 2. the host translator installed with `setTranslator()`;
107
+ * 3. the `msg` defaults the component class declares;
108
+ * 4. the default English catalogue (`defaultMessages`);
109
+ * 5. the key itself.
110
+ *
111
+ * A renamed key (`calendar.today`, formerly `today`) is also looked up under its former name,
112
+ * right after the new one, in steps 1 and 2.
103
113
  * @param {string} key Message key.
104
- * @param {...unknown} args Positional interpolation values.
114
+ * @param {...unknown} args Positional interpolation values (`%1`, `%2`, …).
105
115
  * @returns {string}
106
116
  */
107
117
  msg(key: string, ...args: unknown[]): string;
@@ -1,7 +1,10 @@
1
- /** @typedef {(key: string) => string|null|undefined} Translator */
1
+ import { defaultMessages } from './messages.js';
2
+ export { defaultMessages };
2
3
  export type Translator = (key: string) => string | null | undefined;
3
4
  /**
4
- * Installs the host application's translation function, or clears it with null.
5
+ * Installs the host application's translation function, or clears it with null. The function
6
+ * answers one key at a time; returning null, undefined, or the key itself means "no translation",
7
+ * and resolution moves on to the default English catalogue (`defaultMessages`).
5
8
  * @param {Translator|null} fn Translator function.
6
9
  * @returns {void}
7
10
  */
@@ -18,7 +21,28 @@ export declare function setLanguage(lang: string): void;
18
21
  */
19
22
  export declare function getLanguage(): string;
20
23
  /**
21
- * Translates a key through the injected host translator and interpolates arguments.
24
+ * Asks the host translator for one key, without interpolating. A translator that returns null,
25
+ * undefined, or the key itself has no answer.
26
+ * @param {string} key Message key.
27
+ * @returns {string|null} The translation, or null when there is none.
28
+ */
29
+ export declare function hostMessage(key: string): string | null;
30
+ /**
31
+ * Looks one key up in the default English catalogue.
32
+ * @param {string} key Message key.
33
+ * @returns {string|null} The English text, or null when the catalogue has no entry.
34
+ */
35
+ export declare function defaultMessage(key: string): string | null;
36
+ /**
37
+ * The key a renamed message key replaced, which is still honoured for one major version.
38
+ * @param {string} key Current message key.
39
+ * @returns {string|null} The former key, or null when the key was never renamed.
40
+ */
41
+ export declare function legacyMessageKey(key: string): string | null;
42
+ /**
43
+ * Translates a key and interpolates arguments. The host translator answers first (then, for a
44
+ * renamed key, the translator again under its former name), then the default English catalogue;
45
+ * a key neither knows comes back unchanged.
22
46
  * @param {string} key Translation key.
23
47
  * @param {unknown[]|Record<string, unknown>|string|number} [args] Interpolation arguments.
24
48
  * @returns {string}
@@ -7,6 +7,12 @@ export type RovingOptions = {
7
7
  * Whether navigation wraps at either end.
8
8
  */
9
9
  wrap?: boolean;
10
+ /**
11
+ * Whether ArrowLeft and ArrowRight swap meaning in a
12
+ * horizontal group. `'auto'` reads the container's computed `direction` on every key press, so
13
+ * a group inside `dir="rtl"` moves to the visually next item; `true`/`false` force it.
14
+ */
15
+ rtl?: 'auto' | boolean;
10
16
  };
11
17
  export type FocusTrapController = {
12
18
  /**
@@ -36,6 +42,9 @@ export type RovingController = {
36
42
  * @typedef {Object} RovingOptions
37
43
  * @property {'vertical'|'horizontal'} [orientation='vertical'] Arrow-key axis.
38
44
  * @property {boolean} [wrap=true] Whether navigation wraps at either end.
45
+ * @property {'auto'|boolean} [rtl='auto'] Whether ArrowLeft and ArrowRight swap meaning in a
46
+ * horizontal group. `'auto'` reads the container's computed `direction` on every key press, so
47
+ * a group inside `dir="rtl"` moves to the visually next item; `true`/`false` force it.
39
48
  */
40
49
  /**
41
50
  * @typedef {Object} FocusTrapController
@@ -56,12 +65,74 @@ export type RovingController = {
56
65
  export declare function focusTrap(container: Element): FocusTrapController;
57
66
  /**
58
67
  * Applies the ARIA roving-tabindex keyboard pattern to matching descendants.
68
+ *
69
+ * Editable items keep the keys they need, as the APG toolbar pattern asks: Home and End always
70
+ * stay with a text field, select, or contenteditable region, and so do the arrow keys — except
71
+ * that a text field whose caret already sits at the edge the arrow points past hands focus on to
72
+ * the neighbouring item, so a reader is never trapped in it. Under `dir="rtl"` the horizontal
73
+ * arrows follow the visual order.
74
+ *
75
+ * The group re-reads its items when children are added or removed and when an availability
76
+ * attribute (`hidden`, `disabled`, `aria-disabled`, `aria-hidden`) changes on an item or on an
77
+ * element inside the container that holds items — a `<fieldset disabled>` toggled around them; its
78
+ * own `tabindex` writes and unrelated attribute churn are not observed.
59
79
  * @param {Element} container Event and query container.
60
80
  * @param {string} itemSelector Selector for roving items.
61
81
  * @param {RovingOptions} [options={}] Behavior options.
62
82
  * @returns {RovingController}
63
83
  */
64
- export declare function rovingTabindex(container: Element, itemSelector: string, { orientation, wrap }?: RovingOptions): RovingController;
84
+ export declare function rovingTabindex(container: Element, itemSelector: string, { orientation, wrap, rtl }?: RovingOptions): RovingController;
85
+ export type ItemFocusMemo = {
86
+ /**
87
+ * The item's key.
88
+ */
89
+ key: unknown;
90
+ /**
91
+ * Whether the item element itself held focus.
92
+ */
93
+ self: boolean;
94
+ /**
95
+ * Position of the focused control among the item's focusable controls.
96
+ */
97
+ index: number;
98
+ /**
99
+ * Tag, data attributes, and name of the focused control, which
100
+ * identify its replacement after a rebuild.
101
+ */
102
+ signature: string;
103
+ };
104
+ /**
105
+ * Where focus sat inside one keyed item of a collection, recorded before the collection re-renders.
106
+ * @typedef {Object} ItemFocusMemo
107
+ * @property {unknown} key The item's key.
108
+ * @property {boolean} self Whether the item element itself held focus.
109
+ * @property {number} index Position of the focused control among the item's focusable controls.
110
+ * @property {string} signature Tag, data attributes, and name of the focused control, which
111
+ * identify its replacement after a rebuild.
112
+ */
113
+ /**
114
+ * Records which control of which keyed item holds focus, so a collection that rebuilds an item
115
+ * can put focus back on the equivalent control afterwards. Returns null when focus is elsewhere.
116
+ * @param {Element} root Collection root.
117
+ * @param {(element: Element) => ({key: unknown, element: Element}|null)} locate Finds the keyed
118
+ * item an element belongs to.
119
+ * @returns {ItemFocusMemo|null}
120
+ */
121
+ export declare function captureItemFocus(root: Element, locate: (element: Element) => ({
122
+ key: unknown;
123
+ element: Element;
124
+ } | null)): ItemFocusMemo | null;
125
+ /**
126
+ * Puts focus back on the control a {@link captureItemFocus} memo describes, unless focus is still
127
+ * on a live element inside the collection (nothing was lost). The replacement is the control with
128
+ * the same signature, else the one at the same position, else the item's last control, else the
129
+ * item itself when it is focusable. Scrolling is suppressed: the reader did not move.
130
+ * @param {Element} root Collection root.
131
+ * @param {ItemFocusMemo|null} memo Recorded focus.
132
+ * @param {(key: unknown) => Element|null} resolve Finds the item element for a key after the update.
133
+ * @returns {boolean} Whether focus was moved.
134
+ */
135
+ export declare function restoreItemFocus(root: Element, memo: ItemFocusMemo | null, resolve: (key: unknown) => Element | null): boolean;
65
136
  /**
66
137
  * Creates a 500 ms buffered, case-insensitive first-letter typeahead handler.
67
138
  * @template T
@@ -70,3 +141,29 @@ export declare function rovingTabindex(container: Element, itemSelector: string,
70
141
  * @returns {(event: KeyboardEvent|string) => void}
71
142
  */
72
143
  export declare function typeahead<T>(getItems: () => T[], onMatch: (item: T, index: number) => void): (event: KeyboardEvent | string) => void;
144
+ /**
145
+ * Maps a key to a roving step, or null for a key the group does not handle.
146
+ * @param {string} key `KeyboardEvent.key`.
147
+ * @param {'vertical'|'horizontal'} orientation Arrow-key axis.
148
+ * @param {boolean} reversed Whether the horizontal arrows are swapped (right-to-left).
149
+ * @returns {'first'|'last'|'previous'|'next'|null}
150
+ */
151
+ export declare function rovingStep(key: string, orientation: 'vertical' | 'horizontal', reversed?: boolean): 'first' | 'last' | 'previous' | 'next' | null;
152
+ /**
153
+ * Whether an element takes keyboard text input, so that arrow keys and Home/End move its caret
154
+ * or its value: a text-like `<input>`, `<textarea>`, `<select>`, or a contenteditable region.
155
+ * @param {Element|null} element Candidate, normally a key event's target.
156
+ * @returns {boolean}
157
+ */
158
+ export declare function isEditableTarget(element: Element | null): boolean;
159
+ /**
160
+ * Whether a roving step may leave the event target. Non-editable targets always may. An editable
161
+ * one keeps Home/End, and keeps the arrows unless it is a single-line text field whose collapsed
162
+ * caret already sits at the edge the step points past: position 0 for `previous`, the end of the
163
+ * value for `next`. The steps are logical, so under right-to-left the caret check still matches
164
+ * the direction the caret would have moved.
165
+ * @param {Element|null} target Key event target.
166
+ * @param {'first'|'last'|'previous'|'next'} step Roving step.
167
+ * @returns {boolean}
168
+ */
169
+ export declare function editableAllowsRoving(target: Element | null, step: 'first' | 'last' | 'previous' | 'next'): boolean;