@zeyos/zx 2.3.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/DESIGN-SYSTEM.md +136 -0
  3. package/MIGRATION.md +155 -4
  4. package/README.md +24 -13
  5. package/dist/types/compat/map/data.d.ts +3 -2
  6. package/dist/types/components/account-menu/account-menu.d.ts +144 -0
  7. package/dist/types/components/app-rail/app-rail.d.ts +250 -0
  8. package/dist/types/components/app-sidebar/app-sidebar.d.ts +169 -0
  9. package/dist/types/components/avatar/avatar.d.ts +100 -0
  10. package/dist/types/components/chart/chart.d.ts +321 -0
  11. package/dist/types/components/date-picker/month-picker.d.ts +6 -0
  12. package/dist/types/components/dialog/dialog.d.ts +9 -0
  13. package/dist/types/components/dock/dock.d.ts +495 -0
  14. package/dist/types/components/dropdown/dropdown.d.ts +2 -2
  15. package/dist/types/components/field/field.d.ts +14 -0
  16. package/dist/types/components/field-upload/field-upload.d.ts +37 -4
  17. package/dist/types/components/form/form.d.ts +25 -3
  18. package/dist/types/components/grid/grid.d.ts +172 -0
  19. package/dist/types/components/launcher/launcher.d.ts +300 -0
  20. package/dist/types/components/layout/layout.d.ts +4 -4
  21. package/dist/types/components/menu-button/menu-button.d.ts +10 -2
  22. package/dist/types/components/modal/modal.d.ts +25 -0
  23. package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +7 -1
  24. package/dist/types/components/questionnaire/items.d.ts +327 -0
  25. package/dist/types/components/questionnaire/questionnaire.d.ts +449 -0
  26. package/dist/types/components/sheet/sheet-stack.d.ts +167 -0
  27. package/dist/types/components/sheet/sheet.d.ts +294 -0
  28. package/dist/types/components/split-view/split-view.d.ts +2 -21
  29. package/dist/types/components/table/table.d.ts +219 -12
  30. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  31. package/dist/types/components/value-list/value-list.d.ts +24 -3
  32. package/dist/types/core/dom.d.ts +114 -0
  33. package/dist/types/core/drag-axis.d.ts +111 -0
  34. package/dist/types/core/position.d.ts +4 -2
  35. package/dist/types/index.d.ts +12 -2
  36. package/dist/zx-compat.esm.js +641 -277
  37. package/dist/zx-compat.esm.min.js +1 -1
  38. package/dist/zx-compat.global.js +7609 -2236
  39. package/dist/zx-compat.global.min.js +3 -3
  40. package/dist/zx-zeyos.esm.js +546 -87
  41. package/dist/zx-zeyos.esm.min.js +1 -1
  42. package/dist/zx.css +1452 -101
  43. package/dist/zx.esm.js +7952 -2592
  44. package/dist/zx.esm.min.js +3 -3
  45. package/dist/zx.global.js +7952 -2592
  46. package/dist/zx.global.min.js +3 -3
  47. package/dist/zx.min.css +1 -1
  48. package/docs/api.json +2276 -337
  49. package/docs/llms.md +426 -30
  50. package/docs/llms.txt +21 -9
  51. package/package.json +4 -2
  52. package/src/compat/globals.js +3 -1
  53. package/src/compat/map/data.js +31 -9
  54. package/src/components/account-menu/account-menu.css +70 -0
  55. package/src/components/account-menu/account-menu.js +208 -0
  56. package/src/components/app-rail/app-rail.css +107 -0
  57. package/src/components/app-rail/app-rail.js +668 -0
  58. package/src/components/app-sidebar/app-sidebar.css +68 -0
  59. package/src/components/app-sidebar/app-sidebar.js +388 -0
  60. package/src/components/avatar/avatar.css +61 -0
  61. package/src/components/avatar/avatar.js +222 -0
  62. package/src/components/button/button.css +0 -1
  63. package/src/components/chart/chart.css +61 -0
  64. package/src/components/chart/chart.js +518 -0
  65. package/src/components/date-picker/month-picker.js +9 -0
  66. package/src/components/dialog/dialog.js +11 -4
  67. package/src/components/dock/dock.css +228 -0
  68. package/src/components/dock/dock.js +977 -0
  69. package/src/components/dropdown/dropdown.js +1 -1
  70. package/src/components/field/field.js +2 -0
  71. package/src/components/field-upload/field-upload.js +9 -4
  72. package/src/components/form/form.js +6 -3
  73. package/src/components/grid/grid.css +6 -0
  74. package/src/components/grid/grid.js +213 -0
  75. package/src/components/launcher/launcher.css +100 -0
  76. package/src/components/launcher/launcher.js +557 -0
  77. package/src/components/layout/layout.js +2 -2
  78. package/src/components/menu-button/menu-button.js +27 -2
  79. package/src/components/modal/modal.css +5 -1
  80. package/src/components/modal/modal.js +37 -2
  81. package/src/components/multi-value-editor/multi-value-editor.js +2 -1
  82. package/src/components/questionnaire/items.js +370 -0
  83. package/src/components/questionnaire/questionnaire.css +387 -0
  84. package/src/components/questionnaire/questionnaire.js +1033 -0
  85. package/src/components/select/select.css +0 -1
  86. package/src/components/sheet/sheet-stack.js +304 -0
  87. package/src/components/sheet/sheet.css +351 -0
  88. package/src/components/sheet/sheet.js +551 -0
  89. package/src/components/split-view/split-view.js +76 -161
  90. package/src/components/table/table.css +43 -0
  91. package/src/components/table/table.js +523 -45
  92. package/src/components/tooltip/tooltip.js +5 -2
  93. package/src/components/value-list/value-list.js +6 -3
  94. package/src/core/dom.js +302 -0
  95. package/src/core/drag-axis.js +203 -0
  96. package/src/core/position.js +68 -22
  97. package/src/index.js +19 -2
  98. package/styles/tokens/dark.css +2 -3
  99. package/styles/tokens/global.css +5 -5
  100. package/styles/tokens/semantic.css +5 -3
  101. package/styles/tokens/themes.css +1 -1
  102. package/styles/zx.css +10 -1
  103. package/dist/types/components/permission/permission.d.ts +0 -96
  104. package/src/components/permission/permission.css +0 -47
  105. package/src/components/permission/permission.js +0 -201
@@ -0,0 +1,144 @@
1
+ import { Component } from '../../core/component.js';
2
+ import { Avatar } from '../avatar/avatar.js';
3
+ import { MenuButton } from '../menu-button/menu-button.js';
4
+ export type MenuButtonItem = import('../menu-button/menu-button.js').MenuButtonItem;
5
+ export type AccountIdentity = {
6
+ /**
7
+ * Primary identity.
8
+ */
9
+ name?: string;
10
+ /**
11
+ * Email, company, or other secondary identity.
12
+ */
13
+ secondary?: string;
14
+ /**
15
+ * Avatar image URL.
16
+ */
17
+ src?: string | null;
18
+ /**
19
+ * Explicit avatar initials.
20
+ */
21
+ initials?: string | null;
22
+ /**
23
+ * Presence state.
24
+ */
25
+ status?: 'online' | 'away' | 'busy' | 'offline' | null;
26
+ /**
27
+ * Presence text alternative.
28
+ */
29
+ statusLabel?: string | null;
30
+ };
31
+ export type AccountMenuOptions = {
32
+ /**
33
+ * Account presentation supplied by the application.
34
+ */
35
+ account?: AccountIdentity;
36
+ /**
37
+ * Account actions and `'-'` separators.
38
+ */
39
+ items?: MenuButtonItem[];
40
+ /**
41
+ * Whether only the avatar is visually shown in the trigger.
42
+ */
43
+ compact?: boolean;
44
+ /**
45
+ * Trigger label; defaults to `Account menu for <name>`.
46
+ */
47
+ label?: string | null;
48
+ /**
49
+ * Popup placement.
50
+ */
51
+ placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top' | 'right-start' | 'right-end' | 'left-start' | 'left-end' | 'right' | 'left';
52
+ /**
53
+ * Preventable action listener.
54
+ */
55
+ onselect?: (event: CustomEvent<{
56
+ value: unknown;
57
+ item: object;
58
+ }>) => void;
59
+ /**
60
+ * Open listener.
61
+ */
62
+ onopen?: (event: CustomEvent<Record<string, never>>) => void;
63
+ /**
64
+ * Close listener.
65
+ */
66
+ onclose?: (event: CustomEvent<Record<string, never>>) => void;
67
+ };
68
+ /** @typedef {import('../menu-button/menu-button.js').MenuButtonItem} MenuButtonItem */
69
+ /**
70
+ * @typedef {Object} AccountIdentity
71
+ * @property {string} [name=''] Primary identity.
72
+ * @property {string} [secondary=''] Email, company, or other secondary identity.
73
+ * @property {string|null} [src=null] Avatar image URL.
74
+ * @property {string|null} [initials=null] Explicit avatar initials.
75
+ * @property {'online'|'away'|'busy'|'offline'|null} [status=null] Presence state.
76
+ * @property {string|null} [statusLabel=null] Presence text alternative.
77
+ */
78
+ /**
79
+ * @typedef {Object} AccountMenuOptions
80
+ * @property {AccountIdentity} [account={}] Account presentation supplied by the application.
81
+ * @property {MenuButtonItem[]} [items=[]] Account actions and `'-'` separators.
82
+ * @property {boolean} [compact=false] Whether only the avatar is visually shown in the trigger.
83
+ * @property {string|null} [label=null] Trigger label; defaults to `Account menu for <name>`.
84
+ * @property {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'|'right-start'|'right-end'|'left-start'|'left-end'|'right'|'left'} [placement='top-start'] Popup placement.
85
+ * @property {(event: CustomEvent<{value: unknown, item: object}>) => void} [onselect] Preventable action listener.
86
+ * @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open listener.
87
+ * @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close listener.
88
+ */
89
+ /**
90
+ * Avatar-backed APG account action menu; session/authentication behavior remains application-owned.
91
+ * @fires AccountMenu#select
92
+ * @fires AccountMenu#open
93
+ * @fires AccountMenu#close
94
+ * @extends {Component<AccountMenuOptions>}
95
+ */
96
+ export declare class AccountMenu extends Component<AccountMenuOptions> {
97
+ _avatar: Avatar;
98
+ _menu: MenuButton;
99
+ _createdRoot: boolean;
100
+ _original: {
101
+ attributes: string[][];
102
+ children: ChildNode[];
103
+ };
104
+ _account: AccountIdentity & {
105
+ name: string;
106
+ secondary: string;
107
+ };
108
+ static cssName: string;
109
+ /** @type {Readonly<AccountMenuOptions>} */
110
+ static defaults: Readonly<AccountMenuOptions>;
111
+ /**
112
+ * Creates or enhances an account-menu host.
113
+ * @param {Element|string|null} target Host target.
114
+ * @param {AccountMenuOptions} [options={}] Account-menu options.
115
+ */
116
+ constructor(target?: Element | string | null, options?: AccountMenuOptions);
117
+ /** @returns {HTMLElement} */
118
+ render(): HTMLElement;
119
+ /** Opens the account menu. @returns {this} */
120
+ open(): this;
121
+ /** Closes the account menu. @returns {this} */
122
+ close(): this;
123
+ /** Toggles the account menu. @returns {this} */
124
+ toggle(): this;
125
+ /** Reports whether the menu is open. @returns {boolean} */
126
+ isOpen(): boolean;
127
+ /** Replaces account presentation without touching session state. @param {AccountIdentity} account @returns {this} */
128
+ setAccount(account: AccountIdentity): this;
129
+ /** Replaces account actions. @param {MenuButtonItem[]} items @returns {this} */
130
+ setItems(items: MenuButtonItem[]): this;
131
+ /** Focuses the account trigger. @returns {this} */
132
+ focus(): this;
133
+ /** Returns the underlying menu panel for shell hover/focus coordination. @returns {HTMLElement} */
134
+ getPanel(): HTMLElement;
135
+ /** Destroys child components and restores/removes the host. @returns {void} */
136
+ destroy(): void;
137
+ /** @returns {void} */
138
+ _renderIdentity(): void;
139
+ /** @returns {void} */
140
+ _renderPanelHeader(): void;
141
+ }
142
+ /** Fired when an action is activated. @event AccountMenu#select @type {CustomEvent<{value: unknown, item: object}>} */
143
+ /** Fired after the popup opens. @event AccountMenu#open @type {CustomEvent<Record<string, never>>} */
144
+ /** Fired after the popup closes. @event AccountMenu#close @type {CustomEvent<Record<string, never>>} */
@@ -0,0 +1,250 @@
1
+ import { Component } from '../../core/component.js';
2
+ import { Dropdown } from '../dropdown/dropdown.js';
3
+ export type AppNavItem = {
4
+ /**
5
+ * Stable item identifier.
6
+ */
7
+ id: string | number;
8
+ /**
9
+ * Visible/accessibility label.
10
+ */
11
+ label: string;
12
+ /**
13
+ * Kernel icon name.
14
+ */
15
+ icon?: string;
16
+ /**
17
+ * Count or status badge.
18
+ */
19
+ badge?: string | number;
20
+ /**
21
+ * Emitted value; defaults to `id`.
22
+ */
23
+ value?: unknown;
24
+ /**
25
+ * Native navigation target.
26
+ */
27
+ href?: string;
28
+ /**
29
+ * Native link browsing context.
30
+ */
31
+ target?: string;
32
+ /**
33
+ * Application-owned non-link action.
34
+ */
35
+ invoke?: () => void;
36
+ /**
37
+ * Whether activation is unavailable.
38
+ */
39
+ disabled?: boolean;
40
+ /**
41
+ * Child destinations/actions.
42
+ */
43
+ children?: AppNavItem[];
44
+ };
45
+ export type AppRailOptions = {
46
+ /**
47
+ * Application navigation tree.
48
+ */
49
+ items?: AppNavItem[];
50
+ /**
51
+ * Active item id.
52
+ */
53
+ active?: string | number | null;
54
+ /**
55
+ * Rail flow.
56
+ */
57
+ orientation?: 'vertical' | 'horizontal';
58
+ /**
59
+ * Workspace edge occupied by the rail.
60
+ */
61
+ side?: 'left' | 'right' | 'top' | 'bottom';
62
+ /**
63
+ * Navigation accessible label.
64
+ */
65
+ label?: string;
66
+ /**
67
+ * Leading rail content.
68
+ */
69
+ header?: Node | string | number | {
70
+ toElement: () => Node | null;
71
+ } | null;
72
+ /**
73
+ * Trailing rail content.
74
+ */
75
+ footer?: Node | string | number | {
76
+ toElement: () => Node | null;
77
+ } | null;
78
+ /**
79
+ * Hover-open delay in milliseconds.
80
+ */
81
+ openDelay?: number;
82
+ /**
83
+ * Pointer/focus crossing grace in milliseconds.
84
+ */
85
+ closeDelay?: number;
86
+ /**
87
+ * Preventable action listener.
88
+ */
89
+ onselect?: (event: CustomEvent<AppNavSelectDetail>) => void;
90
+ /**
91
+ * Flyout-state listener.
92
+ */
93
+ onflyoutchange?: (event: CustomEvent<{
94
+ item: AppNavItem;
95
+ id: string | number;
96
+ open: boolean;
97
+ }>) => void;
98
+ };
99
+ export type AppNavSelectDetail = {
100
+ item: AppNavItem;
101
+ id: string | number;
102
+ value: unknown;
103
+ href: string | null;
104
+ event: Event;
105
+ };
106
+ export type RailFlyout = {
107
+ key: string;
108
+ parentKey: string | null;
109
+ item: AppNavItem;
110
+ trigger: HTMLElement;
111
+ panel: HTMLElement;
112
+ dropdown: Dropdown;
113
+ };
114
+ /**
115
+ * @typedef {Object} AppNavItem
116
+ * @property {string|number} id Stable item identifier.
117
+ * @property {string} label Visible/accessibility label.
118
+ * @property {string} [icon] Kernel icon name.
119
+ * @property {string|number} [badge] Count or status badge.
120
+ * @property {unknown} [value] Emitted value; defaults to `id`.
121
+ * @property {string} [href] Native navigation target.
122
+ * @property {string} [target] Native link browsing context.
123
+ * @property {() => void} [invoke] Application-owned non-link action.
124
+ * @property {boolean} [disabled] Whether activation is unavailable.
125
+ * @property {AppNavItem[]} [children] Child destinations/actions.
126
+ */
127
+ /**
128
+ * @typedef {Object} AppRailOptions
129
+ * @property {AppNavItem[]} [items=[]] Application navigation tree.
130
+ * @property {string|number|null} [active=null] Active item id.
131
+ * @property {'vertical'|'horizontal'} [orientation='vertical'] Rail flow.
132
+ * @property {'left'|'right'|'top'|'bottom'} [side='left'] Workspace edge occupied by the rail.
133
+ * @property {string} [label='Applications'] Navigation accessible label.
134
+ * @property {Node|string|number|{toElement: () => Node|null}|null} [header=null] Leading rail content.
135
+ * @property {Node|string|number|{toElement: () => Node|null}|null} [footer=null] Trailing rail content.
136
+ * @property {number} [openDelay=80] Hover-open delay in milliseconds.
137
+ * @property {number} [closeDelay=160] Pointer/focus crossing grace in milliseconds.
138
+ * @property {(event: CustomEvent<AppNavSelectDetail>) => void} [onselect] Preventable action listener.
139
+ * @property {(event: CustomEvent<{item: AppNavItem, id: string|number, open: boolean}>) => void} [onflyoutchange] Flyout-state listener.
140
+ */
141
+ /** @typedef {{item: AppNavItem, id: string|number, value: unknown, href: string|null, event: Event}} AppNavSelectDetail */
142
+ /** @typedef {{key: string, parentKey: string|null, item: AppNavItem, trigger: HTMLElement, panel: HTMLElement, dropdown: Dropdown}} RailFlyout */
143
+ /**
144
+ * Minimized application navigation; descendants always open in hover/focus flyouts, never inline.
145
+ * @fires AppRail#select
146
+ * @fires AppRail#flyoutchange
147
+ * @extends {Component<AppRailOptions>}
148
+ */
149
+ export declare class AppRail extends Component<AppRailOptions> {
150
+ _createdRoot: boolean;
151
+ _original: {
152
+ attributes: string[][];
153
+ children: ChildNode[];
154
+ };
155
+ _items: AppNavItem[];
156
+ _active: string | number;
157
+ _flyouts: Map<any, any>;
158
+ _tooltips: any[];
159
+ _tooltipById: Map<any, any>;
160
+ _interaction: RailListenerScope;
161
+ _openTimers: Map<any, any>;
162
+ _closeTimers: Map<any, any>;
163
+ _pointerFocus: WeakSet<object>;
164
+ _silenceFlyoutEvents: boolean;
165
+ static cssName: string;
166
+ /** @type {Readonly<AppRailOptions>} */
167
+ static defaults: Readonly<AppRailOptions>;
168
+ /**
169
+ * Creates or enhances a rail host.
170
+ * @param {Element|string|null} target Rail target.
171
+ * @param {AppRailOptions} [options={}] Rail options.
172
+ */
173
+ constructor(target?: Element | string | null, options?: AppRailOptions);
174
+ /** @returns {HTMLElement} */
175
+ render(): HTMLElement;
176
+ /** Replaces navigation items and closes removed flyouts. @param {AppNavItem[]} items @returns {this} */
177
+ setItems(items: AppNavItem[]): this;
178
+ /** Sets the active item without routing. @param {string|number|null} id @returns {this} */
179
+ setActive(id: string | number | null): this;
180
+ /** Returns a shallow copy of normalized items. @returns {AppNavItem[]} */
181
+ getItems(): AppNavItem[];
182
+ /** Opens one item's flyout, optionally focusing its first action. @param {string|number} id @param {{focus?: boolean}} [options={}] @returns {this} */
183
+ openFlyout(id: string | number, { focus }?: {
184
+ focus?: boolean;
185
+ }): this;
186
+ /** Closes one flyout. @param {string|number} id @returns {this} */
187
+ closeFlyout(id: string | number): this;
188
+ /** Closes every flyout and cancels pending hover/focus transitions. @returns {this} */
189
+ closeAllFlyouts(): this;
190
+ /** Reports whether an item's flyout is open. @param {string|number} id @returns {boolean} */
191
+ isFlyoutOpen(id: string | number): boolean;
192
+ /** Focuses the first top-level rail item. @returns {this} */
193
+ focus(): this;
194
+ /** Reports whether a node belongs to this rail, including detached flyout panels. @param {Node|null} node @returns {boolean} @private */
195
+ private _containsNode;
196
+ /** Destroys body popovers/tooltips and restores or removes the root. @returns {void} */
197
+ destroy(): void;
198
+ /** @returns {void} */
199
+ _rebuild(): void;
200
+ /** @param {AppNavItem} item @param {HTMLElement} trigger @param {string} key @param {string|null} parentKey @returns {void} */
201
+ _buildFlyout(item: AppNavItem, trigger: HTMLElement, key: string, parentKey: string | null): void;
202
+ /** @param {AppNavItem} item @param {Event} event @returns {Event} */
203
+ _select(item: AppNavItem, event: Event): Event;
204
+ /** @param {KeyboardEvent} event @returns {void} */
205
+ _onRailKeydown(event: KeyboardEvent): void;
206
+ /** @param {KeyboardEvent} event @param {RailFlyout} flyout @returns {void} */
207
+ _onFlyoutKeydown(event: KeyboardEvent, flyout: RailFlyout): void;
208
+ /** @param {string|number} id @returns {void} */
209
+ _scheduleOpen(id: string | number): void;
210
+ /** @param {string|number} id @returns {void} */
211
+ _scheduleClose(id: string | number): void;
212
+ /** Schedules a flyout and, when leaving a detached panel, each owning flyout for re-evaluation. @param {RailFlyout} flyout @param {boolean} ancestors @returns {void} */
213
+ _scheduleFlyoutClose(flyout: RailFlyout, ancestors: boolean): void;
214
+ /** Resolves a public id or internal descendant path. @param {string|number} id @returns {RailFlyout|null} */
215
+ _resolveFlyout(id: string | number): RailFlyout | null;
216
+ /** Closes the root flyout that owns a selected descendant. @param {string} key @returns {void} */
217
+ _closeFlyoutChain(key: string): void;
218
+ /** Reports whether one flyout owns another through its parent chain. @param {RailFlyout} ancestor @param {RailFlyout} descendant @returns {boolean} */
219
+ _isAncestor(ancestor: RailFlyout, descendant: RailFlyout): boolean;
220
+ /** Cancels crossing timers for a flyout and optionally every owning flyout. @param {RailFlyout} flyout @param {boolean} ancestors @returns {void} */
221
+ _cancelFlyoutTimers(flyout: RailFlyout, ancestors: boolean): void;
222
+ /** Reports pointer/focus presence in a flyout branch, including detached descendant panels. @param {RailFlyout} flyout @returns {boolean} */
223
+ _branchInteracting(flyout: RailFlyout): boolean;
224
+ /** Restores trigger focus without immediately reopening the flyout through its focus handler. @param {HTMLElement} trigger @returns {void} */
225
+ _restoreFocus(trigger: HTMLElement): void;
226
+ /** @param {string} key @returns {void} */
227
+ _cancelTimers(key: string): void;
228
+ /** @param {Map<string, ReturnType<typeof setTimeout>>} timers @param {string} key @returns {void} */
229
+ _cancelTimer(timers: Map<string, ReturnType<typeof setTimeout>>, key: string): void;
230
+ /** @returns {void} */
231
+ _syncActive(): void;
232
+ /** @returns {void} */
233
+ _clearArtifacts(): void;
234
+ }
235
+ /** Owns listeners attached to one dynamic rail render so `setItems()` can release them immediately. */
236
+ declare class RailListenerScope extends Component {
237
+ /** @param {HTMLElement} host Rail host. */
238
+ constructor(host: HTMLElement);
239
+ /** @returns {HTMLElement} */
240
+ render(): HTMLElement;
241
+ }
242
+ /**
243
+ * Normalizes an application navigation tree without mutating caller data.
244
+ * @param {unknown} items Candidate tree.
245
+ * @returns {AppNavItem[]}
246
+ */
247
+ export declare function normalizeAppItems(items: unknown): AppNavItem[];
248
+ export {};
249
+ /** Fired when a destination/action is activated. @event AppRail#select @type {CustomEvent<AppNavSelectDetail>} */
250
+ /** Fired when a flyout opens or closes. @event AppRail#flyoutchange @type {CustomEvent<{item: AppNavItem, id: string|number, open: boolean}>} */
@@ -0,0 +1,169 @@
1
+ import { Component } from '../../core/component.js';
2
+ import { AppRail } from '../app-rail/app-rail.js';
3
+ export type AppNavItem = import('../app-rail/app-rail.js').AppNavItem;
4
+ export type AppNavSelectDetail = import('../app-rail/app-rail.js').AppNavSelectDetail;
5
+ export type AppSidebarOptions = {
6
+ /**
7
+ * Application navigation tree.
8
+ */
9
+ items?: AppNavItem[];
10
+ /**
11
+ * Active item id.
12
+ */
13
+ active?: string | number | null;
14
+ /**
15
+ * Initially expanded branch ids.
16
+ */
17
+ expanded?: Array<string | number>;
18
+ /**
19
+ * Whether the minimized AppRail is shown.
20
+ */
21
+ collapsed?: boolean;
22
+ /**
23
+ * Workspace side.
24
+ */
25
+ side?: 'left' | 'right';
26
+ /**
27
+ * Navigation accessible label.
28
+ */
29
+ label?: string;
30
+ /**
31
+ * Expanded header content.
32
+ */
33
+ header?: Node | string | number | {
34
+ toElement: () => Node | null;
35
+ } | null;
36
+ /**
37
+ * Expanded sticky footer content.
38
+ */
39
+ footer?: Node | string | number | {
40
+ toElement: () => Node | null;
41
+ } | null;
42
+ /**
43
+ * Minimized rail header content.
44
+ */
45
+ railHeader?: Node | string | number | {
46
+ toElement: () => Node | null;
47
+ } | null;
48
+ /**
49
+ * Minimized rail footer content.
50
+ */
51
+ railFooter?: Node | string | number | {
52
+ toElement: () => Node | null;
53
+ } | null;
54
+ /**
55
+ * Preventable action listener.
56
+ */
57
+ onselect?: (event: CustomEvent<AppNavSelectDetail>) => void;
58
+ /**
59
+ * Branch-state listener; bulk replacement reports null state.
60
+ */
61
+ onbranchchange?: (event: CustomEvent<{
62
+ item: AppNavItem | null;
63
+ id: string | number | null;
64
+ expanded: boolean | null;
65
+ ids: Array<string | number>;
66
+ }>) => void;
67
+ /**
68
+ * Presentation-state listener.
69
+ */
70
+ oncollapsechange?: (event: CustomEvent<{
71
+ collapsed: boolean;
72
+ }>) => void;
73
+ };
74
+ /** @typedef {import('../app-rail/app-rail.js').AppNavItem} AppNavItem */
75
+ /** @typedef {import('../app-rail/app-rail.js').AppNavSelectDetail} AppNavSelectDetail */
76
+ /**
77
+ * @typedef {Object} AppSidebarOptions
78
+ * @property {AppNavItem[]} [items=[]] Application navigation tree.
79
+ * @property {string|number|null} [active=null] Active item id.
80
+ * @property {Array<string|number>} [expanded=[]] Initially expanded branch ids.
81
+ * @property {boolean} [collapsed=false] Whether the minimized AppRail is shown.
82
+ * @property {'left'|'right'} [side='left'] Workspace side.
83
+ * @property {string} [label='Applications'] Navigation accessible label.
84
+ * @property {Node|string|number|{toElement: () => Node|null}|null} [header=null] Expanded header content.
85
+ * @property {Node|string|number|{toElement: () => Node|null}|null} [footer=null] Expanded sticky footer content.
86
+ * @property {Node|string|number|{toElement: () => Node|null}|null} [railHeader=null] Minimized rail header content.
87
+ * @property {Node|string|number|{toElement: () => Node|null}|null} [railFooter=null] Minimized rail footer content.
88
+ * @property {(event: CustomEvent<AppNavSelectDetail>) => void} [onselect] Preventable action listener.
89
+ * @property {(event: CustomEvent<{item: AppNavItem|null, id: string|number|null, expanded: boolean|null, ids: Array<string|number>}>) => void} [onbranchchange] Branch-state listener; bulk replacement reports null state.
90
+ * @property {(event: CustomEvent<{collapsed: boolean}>) => void} [oncollapsechange] Presentation-state listener.
91
+ */
92
+ /**
93
+ * Expanded vertical application navigation; the only Xenon shell mode with inline descendants.
94
+ * @fires AppSidebar#select
95
+ * @fires AppSidebar#branchchange
96
+ * @fires AppSidebar#collapsechange
97
+ * @extends {Component<AppSidebarOptions>}
98
+ */
99
+ export declare class AppSidebar extends Component<AppSidebarOptions> {
100
+ _railExpandButton: HTMLElement;
101
+ _rail: AppRail;
102
+ _createdRoot: boolean;
103
+ _original: {
104
+ attributes: string[][];
105
+ children: ChildNode[];
106
+ };
107
+ _items: import("../app-rail/app-rail.js").AppNavItem[];
108
+ _active: string | number;
109
+ _expanded: Set<string>;
110
+ _collapsed: boolean;
111
+ static cssName: string;
112
+ /** @type {Readonly<AppSidebarOptions>} */
113
+ static defaults: Readonly<AppSidebarOptions>;
114
+ /**
115
+ * Creates or enhances an application-sidebar host.
116
+ * @param {Element|string|null} target Sidebar target.
117
+ * @param {AppSidebarOptions} [options={}] Sidebar options.
118
+ */
119
+ constructor(target?: Element | string | null, options?: AppSidebarOptions);
120
+ /** @returns {HTMLElement} */
121
+ render(): HTMLElement;
122
+ /** Replaces the navigation tree in both expanded and rail presentations. @param {AppNavItem[]} items @returns {this} */
123
+ setItems(items: AppNavItem[]): this;
124
+ /** Sets the active id in both presentations without routing. @param {string|number|null} id @returns {this} */
125
+ setActive(id: string | number | null): this;
126
+ /** Replaces expanded branch ids. @param {Array<string|number>} ids @param {{silent?: boolean}} [options={}] @returns {this} */
127
+ setExpanded(ids: Array<string | number>, { silent }?: {
128
+ silent?: boolean;
129
+ }): this;
130
+ /** Returns expanded branch ids in navigation order. @returns {Array<string|number>} */
131
+ getExpanded(): Array<string | number>;
132
+ /** Toggles one inline branch. @param {string|number} id @param {{silent?: boolean}} [options={}] @returns {this} */
133
+ toggleBranch(id: string | number, { silent }?: {
134
+ silent?: boolean;
135
+ }): this;
136
+ /** Shows the expanded sidebar presentation. @param {{silent?: boolean}} [options={}] @returns {this} */
137
+ expand(options?: {
138
+ silent?: boolean;
139
+ }): this;
140
+ /** Shows the minimized AppRail presentation. @param {{silent?: boolean}} [options={}] @returns {this} */
141
+ collapse(options?: {
142
+ silent?: boolean;
143
+ }): this;
144
+ /** Sets expanded/minimized presentation while preserving branch state. @param {boolean} collapsed @param {{silent?: boolean}} [options={}] @returns {this} */
145
+ setCollapsed(collapsed: boolean, { silent }?: {
146
+ silent?: boolean;
147
+ }): this;
148
+ /** Reports whether the rail presentation is active. @returns {boolean} */
149
+ isCollapsed(): boolean;
150
+ /** Returns the composed minimized rail. @returns {AppRail} */
151
+ getRail(): AppRail;
152
+ /** Destroys the rail and restores/removes the sidebar host. @returns {void} */
153
+ destroy(): void;
154
+ /** @returns {void} */
155
+ _renderTree(): void;
156
+ /** @param {AppNavItem} item @param {number} level @returns {HTMLElement} */
157
+ _treeRow(item: AppNavItem, level: number): HTMLElement;
158
+ /** Handles dynamic tree controls without retaining detached nodes after a rerender. @param {Event} event @returns {void} */
159
+ _onTreeClick(event: Event): void;
160
+ /** @param {AppNavItem} item @param {Event} event @returns {void} */
161
+ _select(item: AppNavItem, event: Event): void;
162
+ /** @returns {void} */
163
+ _syncActive(): void;
164
+ /** @returns {void} */
165
+ _reconcileExpanded(): void;
166
+ }
167
+ /** Fired when a destination/action is activated. @event AppSidebar#select @type {CustomEvent<AppNavSelectDetail>} */
168
+ /** Fired when an inline branch changes. @event AppSidebar#branchchange @type {CustomEvent<{item: AppNavItem|null, id: string|number|null, expanded: boolean|null, ids: Array<string|number>}>} */
169
+ /** Fired when expanded/minimized presentation changes. @event AppSidebar#collapsechange @type {CustomEvent<{collapsed: boolean}>} */
@@ -0,0 +1,100 @@
1
+ import { Component } from '../../core/component.js';
2
+ export type AvatarOptions = {
3
+ /**
4
+ * Image URL.
5
+ */
6
+ src?: string | null;
7
+ /**
8
+ * Name used to derive fallback initials.
9
+ */
10
+ name?: string;
11
+ /**
12
+ * Explicit fallback initials.
13
+ */
14
+ initials?: string | null;
15
+ /**
16
+ * Accessible label; null makes the avatar decorative.
17
+ */
18
+ label?: string | null;
19
+ /**
20
+ * Preset (`sm`, `md`, `lg`) or pixel size.
21
+ */
22
+ size?: string | number;
23
+ /**
24
+ * Avatar shape.
25
+ */
26
+ shape?: 'circle' | 'rounded' | 'square';
27
+ /**
28
+ * Optional presence state.
29
+ */
30
+ status?: 'online' | 'away' | 'busy' | 'offline' | null;
31
+ /**
32
+ * Text alternative for the presence state.
33
+ */
34
+ statusLabel?: string | null;
35
+ };
36
+ /**
37
+ * @typedef {Object} AvatarOptions
38
+ * @property {string|null} [src=null] Image URL.
39
+ * @property {string} [name=''] Name used to derive fallback initials.
40
+ * @property {string|null} [initials=null] Explicit fallback initials.
41
+ * @property {string|null} [label=null] Accessible label; null makes the avatar decorative.
42
+ * @property {string|number} [size='md'] Preset (`sm`, `md`, `lg`) or pixel size.
43
+ * @property {'circle'|'rounded'|'square'} [shape='circle'] Avatar shape.
44
+ * @property {'online'|'away'|'busy'|'offline'|null} [status=null] Optional presence state.
45
+ * @property {string|null} [statusLabel=null] Text alternative for the presence state.
46
+ */
47
+ /**
48
+ * Stable-size user image with deterministic initials fallback and optional presence state.
49
+ * @extends {Component<AvatarOptions>}
50
+ */
51
+ export declare class Avatar extends Component<AvatarOptions> {
52
+ _createdRoot: boolean;
53
+ _original: {
54
+ attributes: string[][];
55
+ children: ChildNode[];
56
+ };
57
+ _state: {
58
+ src: string;
59
+ name: string;
60
+ initials: string;
61
+ label: string;
62
+ size: string | number;
63
+ shape: "circle" | "rounded" | "square";
64
+ status: "away" | "busy" | "offline" | "online";
65
+ statusLabel: string;
66
+ };
67
+ static cssName: string;
68
+ /** @type {Readonly<AvatarOptions>} */
69
+ static defaults: Readonly<AvatarOptions>;
70
+ /** @returns {HTMLElement} */
71
+ render(): HTMLElement;
72
+ /**
73
+ * Replaces avatar identity and presentation values.
74
+ * @param {Partial<AvatarOptions>} values New values.
75
+ * @returns {this}
76
+ */
77
+ set(values?: Partial<AvatarOptions>): this;
78
+ /** Sets the presence state and its text alternative. @param {AvatarOptions['status']} status @param {string|null} [label=null] @returns {this} */
79
+ setStatus(status: AvatarOptions['status'], label?: string | null): this;
80
+ /** Returns whether the image is currently visible. @returns {boolean} */
81
+ hasImage(): boolean;
82
+ /** Restores an enhanced target or removes an owned root. @returns {void} */
83
+ destroy(): void;
84
+ /** @returns {void} */
85
+ _sync(): void;
86
+ /** Synchronizes the standalone accessible name, including valid presence text. @returns {void} */
87
+ _syncLabel(): void;
88
+ /** @param {boolean} visible @returns {void} */
89
+ _showImage(visible: boolean): void;
90
+ /** Ignores a late load/error from a source that has already been replaced. @returns {boolean} */
91
+ _isCurrentImageSource(): boolean;
92
+ /** @returns {void} */
93
+ _syncStatus(): void;
94
+ }
95
+ /**
96
+ * Derives at most two uppercase initials from the first and last words of a name.
97
+ * @param {unknown} name Name-like value.
98
+ * @returns {string}
99
+ */
100
+ export declare function avatarInitials(name: unknown): string;