@zeyos/zx 2.2.1 → 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.
- package/CHANGELOG.md +197 -0
- package/DESIGN-SYSTEM.md +136 -0
- package/MIGRATION.md +155 -4
- package/README.md +51 -14
- package/dist/types/compat/map/data.d.ts +3 -2
- package/dist/types/components/account-menu/account-menu.d.ts +144 -0
- package/dist/types/components/app-rail/app-rail.d.ts +250 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +169 -0
- package/dist/types/components/avatar/avatar.d.ts +100 -0
- package/dist/types/components/chart/chart.d.ts +321 -0
- package/dist/types/components/date-picker/month-picker.d.ts +6 -0
- package/dist/types/components/dialog/dialog.d.ts +9 -0
- package/dist/types/components/dock/dock.d.ts +495 -0
- package/dist/types/components/dropdown/dropdown.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +14 -0
- package/dist/types/components/field-upload/field-upload.d.ts +37 -4
- package/dist/types/components/form/form.d.ts +25 -3
- package/dist/types/components/grid/grid.d.ts +172 -0
- package/dist/types/components/launcher/launcher.d.ts +300 -0
- package/dist/types/components/layout/layout.d.ts +4 -4
- package/dist/types/components/menu-button/menu-button.d.ts +10 -2
- package/dist/types/components/modal/modal.d.ts +25 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +74 -9
- package/dist/types/components/questionnaire/items.d.ts +327 -0
- package/dist/types/components/questionnaire/questionnaire.d.ts +449 -0
- package/dist/types/components/select/select.d.ts +36 -1
- package/dist/types/components/sheet/sheet-stack.d.ts +167 -0
- package/dist/types/components/sheet/sheet.d.ts +294 -0
- package/dist/types/components/split-view/split-view.d.ts +2 -21
- package/dist/types/components/tabbox/tabbox.d.ts +12 -3
- package/dist/types/components/table/table.d.ts +219 -12
- package/dist/types/components/tooltip/tooltip.d.ts +2 -2
- package/dist/types/components/value-list/value-list.d.ts +24 -3
- package/dist/types/core/dom.d.ts +114 -0
- package/dist/types/core/drag-axis.d.ts +111 -0
- package/dist/types/core/position.d.ts +4 -2
- package/dist/types/index.d.ts +12 -2
- package/dist/zx-compat.esm.js +943 -311
- package/dist/zx-compat.esm.min.js +1 -1
- package/dist/zx-compat.global.js +7893 -2252
- package/dist/zx-compat.global.min.js +3 -3
- package/dist/zx-zeyos.esm.js +826 -114
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +1720 -243
- package/dist/zx.esm.js +8227 -2599
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +8227 -2599
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +2597 -255
- package/docs/llms.md +475 -37
- package/docs/llms.txt +21 -9
- package/package.json +4 -2
- package/src/compat/globals.js +3 -1
- package/src/compat/map/data.js +31 -9
- package/src/components/account-menu/account-menu.css +70 -0
- package/src/components/account-menu/account-menu.js +208 -0
- package/src/components/app-rail/app-rail.css +107 -0
- package/src/components/app-rail/app-rail.js +668 -0
- package/src/components/app-sidebar/app-sidebar.css +68 -0
- package/src/components/app-sidebar/app-sidebar.js +388 -0
- package/src/components/avatar/avatar.css +61 -0
- package/src/components/avatar/avatar.js +222 -0
- package/src/components/button/button.css +0 -1
- package/src/components/chart/chart.css +61 -0
- package/src/components/chart/chart.js +518 -0
- package/src/components/date-picker/date-range-picker.css +7 -0
- package/src/components/date-picker/month-picker.js +9 -0
- package/src/components/dialog/dialog.js +11 -4
- package/src/components/dock/dock.css +228 -0
- package/src/components/dock/dock.js +977 -0
- package/src/components/dropdown/dropdown.js +1 -1
- package/src/components/field/field.js +2 -0
- package/src/components/field-upload/field-upload.js +9 -4
- package/src/components/fieldset/fieldset.css +7 -0
- package/src/components/form/form.css +7 -0
- package/src/components/form/form.js +6 -3
- package/src/components/grid/grid.css +6 -0
- package/src/components/grid/grid.js +213 -0
- package/src/components/launcher/launcher.css +100 -0
- package/src/components/launcher/launcher.js +557 -0
- package/src/components/layout/layout.js +2 -2
- package/src/components/menu-button/menu-button.js +27 -2
- package/src/components/modal/modal.css +5 -1
- package/src/components/modal/modal.js +37 -2
- package/src/components/multi-value-editor/multi-value-editor.css +99 -15
- package/src/components/multi-value-editor/multi-value-editor.js +237 -19
- package/src/components/navigation-bar/navigation-bar.css +7 -0
- package/src/components/questionnaire/items.js +370 -0
- package/src/components/questionnaire/questionnaire.css +387 -0
- package/src/components/questionnaire/questionnaire.js +1033 -0
- package/src/components/search/search.css +10 -2
- package/src/components/select/select.css +6 -1
- package/src/components/select/select.js +99 -11
- package/src/components/sheet/sheet-stack.js +304 -0
- package/src/components/sheet/sheet.css +351 -0
- package/src/components/sheet/sheet.js +551 -0
- package/src/components/split-view/split-view.js +76 -161
- package/src/components/stepper/stepper.css +12 -2
- package/src/components/tabbox/tabbox.css +13 -3
- package/src/components/tabbox/tabbox.js +34 -10
- package/src/components/table/table.css +43 -0
- package/src/components/table/table.js +523 -45
- package/src/components/tooltip/tooltip.js +5 -2
- package/src/components/value-list/value-list.js +6 -3
- package/src/core/dom.js +302 -0
- package/src/core/drag-axis.js +203 -0
- package/src/core/position.js +68 -22
- package/src/index.js +19 -2
- package/styles/tokens/dark.css +15 -13
- package/styles/tokens/global.css +17 -5
- package/styles/tokens/semantic.css +14 -8
- package/styles/tokens/themes.css +72 -0
- package/styles/zx.css +11 -1
- package/dist/types/components/permission/permission.d.ts +0 -93
- package/src/components/permission/permission.css +0 -47
- package/src/components/permission/permission.js +0 -198
|
@@ -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;
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type ChartDataset = {
|
|
3
|
+
label?: string;
|
|
4
|
+
data?: unknown[];
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
export type ChartData = {
|
|
8
|
+
labels?: unknown[];
|
|
9
|
+
datasets?: ChartDataset[];
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
};
|
|
12
|
+
export type ChartSpec = {
|
|
13
|
+
/**
|
|
14
|
+
* Chart type.
|
|
15
|
+
*/
|
|
16
|
+
type: string;
|
|
17
|
+
/**
|
|
18
|
+
* Chart data.
|
|
19
|
+
*/
|
|
20
|
+
data: ChartData;
|
|
21
|
+
/**
|
|
22
|
+
* Engine-specific options.
|
|
23
|
+
*/
|
|
24
|
+
options: Record<string, unknown>;
|
|
25
|
+
/**
|
|
26
|
+
* Point-selection callback.
|
|
27
|
+
*/
|
|
28
|
+
onSelect: (detail: ChartSelectDetail) => void;
|
|
29
|
+
};
|
|
30
|
+
export type ChartHandle = {
|
|
31
|
+
/**
|
|
32
|
+
* Update the mounted chart.
|
|
33
|
+
*/
|
|
34
|
+
update: (spec: ChartSpec) => void;
|
|
35
|
+
/**
|
|
36
|
+
* Resize the mounted chart.
|
|
37
|
+
*/
|
|
38
|
+
resize: () => void;
|
|
39
|
+
/**
|
|
40
|
+
* Destroy the mounted chart.
|
|
41
|
+
*/
|
|
42
|
+
destroy: () => void;
|
|
43
|
+
/**
|
|
44
|
+
* Engine instance.
|
|
45
|
+
*/
|
|
46
|
+
instance?: unknown;
|
|
47
|
+
};
|
|
48
|
+
export type ChartAdapter = {
|
|
49
|
+
create: (canvas: HTMLCanvasElement, spec: ChartSpec) => ChartHandle;
|
|
50
|
+
};
|
|
51
|
+
export type ChartJsAdapterOptions = Object;
|
|
52
|
+
export type ChartSelectDetail = {
|
|
53
|
+
/**
|
|
54
|
+
* Dataset index.
|
|
55
|
+
*/
|
|
56
|
+
datasetIndex: number;
|
|
57
|
+
/**
|
|
58
|
+
* Data index.
|
|
59
|
+
*/
|
|
60
|
+
index: number;
|
|
61
|
+
/**
|
|
62
|
+
* Dataset definition.
|
|
63
|
+
*/
|
|
64
|
+
dataset: ChartDataset | null;
|
|
65
|
+
/**
|
|
66
|
+
* Label at the selected index.
|
|
67
|
+
*/
|
|
68
|
+
label: unknown;
|
|
69
|
+
/**
|
|
70
|
+
* Data value.
|
|
71
|
+
*/
|
|
72
|
+
value: unknown;
|
|
73
|
+
/**
|
|
74
|
+
* Engine-native event when available.
|
|
75
|
+
*/
|
|
76
|
+
nativeEvent: Event | null;
|
|
77
|
+
};
|
|
78
|
+
export type ChartOptions = {
|
|
79
|
+
/**
|
|
80
|
+
* Injected engine adapter.
|
|
81
|
+
*/
|
|
82
|
+
adapter?: ChartAdapter | null;
|
|
83
|
+
/**
|
|
84
|
+
* Chart type passed to the adapter.
|
|
85
|
+
*/
|
|
86
|
+
type?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Chart data.
|
|
89
|
+
*/
|
|
90
|
+
data?: ChartData;
|
|
91
|
+
/**
|
|
92
|
+
* Engine-specific options.
|
|
93
|
+
*/
|
|
94
|
+
chartOptions?: Record<string, unknown>;
|
|
95
|
+
/**
|
|
96
|
+
* Accessible canvas and summary label; blank text falls back to `Chart`.
|
|
97
|
+
*/
|
|
98
|
+
label?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Accessible description.
|
|
101
|
+
*/
|
|
102
|
+
description?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Semantic data-table presentation.
|
|
105
|
+
*/
|
|
106
|
+
summary?: 'hidden' | 'visible';
|
|
107
|
+
/**
|
|
108
|
+
* Initial loading state.
|
|
109
|
+
*/
|
|
110
|
+
loading?: boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Empty-state text.
|
|
113
|
+
*/
|
|
114
|
+
emptyText?: string;
|
|
115
|
+
/**
|
|
116
|
+
* Loading-state text.
|
|
117
|
+
*/
|
|
118
|
+
loadingText?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Error fallback text.
|
|
121
|
+
*/
|
|
122
|
+
errorText?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Responsive container aspect ratio.
|
|
125
|
+
*/
|
|
126
|
+
aspectRatio?: string;
|
|
127
|
+
/**
|
|
128
|
+
* Engine-ready listener.
|
|
129
|
+
*/
|
|
130
|
+
onready?: (event: CustomEvent<{
|
|
131
|
+
instance: unknown;
|
|
132
|
+
}>) => void;
|
|
133
|
+
/**
|
|
134
|
+
* Update listener.
|
|
135
|
+
*/
|
|
136
|
+
onupdate?: (event: CustomEvent<{
|
|
137
|
+
data: ChartData;
|
|
138
|
+
type: string;
|
|
139
|
+
}>) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Point-selection listener.
|
|
142
|
+
*/
|
|
143
|
+
onselect?: (event: CustomEvent<ChartSelectDetail>) => void;
|
|
144
|
+
/**
|
|
145
|
+
* Engine error listener.
|
|
146
|
+
*/
|
|
147
|
+
onerror?: (event: CustomEvent<{
|
|
148
|
+
error: unknown;
|
|
149
|
+
}>) => void;
|
|
150
|
+
};
|
|
151
|
+
/** @typedef {{label?: string, data?: unknown[], [key: string]: unknown}} ChartDataset */
|
|
152
|
+
/** @typedef {{labels?: unknown[], datasets?: ChartDataset[], [key: string]: unknown}} ChartData */
|
|
153
|
+
/**
|
|
154
|
+
* @typedef {Object} ChartSpec
|
|
155
|
+
* @property {string} type Chart type.
|
|
156
|
+
* @property {ChartData} data Chart data.
|
|
157
|
+
* @property {Record<string, unknown>} options Engine-specific options.
|
|
158
|
+
* @property {(detail: ChartSelectDetail) => void} onSelect Point-selection callback.
|
|
159
|
+
*/
|
|
160
|
+
/**
|
|
161
|
+
* @typedef {Object} ChartHandle
|
|
162
|
+
* @property {(spec: ChartSpec) => void} update Update the mounted chart.
|
|
163
|
+
* @property {() => void} resize Resize the mounted chart.
|
|
164
|
+
* @property {() => void} destroy Destroy the mounted chart.
|
|
165
|
+
* @property {unknown} [instance] Engine instance.
|
|
166
|
+
*/
|
|
167
|
+
/** @typedef {{create: (canvas: HTMLCanvasElement, spec: ChartSpec) => ChartHandle}} ChartAdapter */
|
|
168
|
+
/**
|
|
169
|
+
* @typedef {Object} ChartJsAdapterOptions
|
|
170
|
+
* Generated API marker for the adapter class; its constructor accepts an injected engine and
|
|
171
|
+
* optional defaults directly rather than a component options object.
|
|
172
|
+
*/
|
|
173
|
+
/**
|
|
174
|
+
* @typedef {Object} ChartSelectDetail
|
|
175
|
+
* @property {number} datasetIndex Dataset index.
|
|
176
|
+
* @property {number} index Data index.
|
|
177
|
+
* @property {ChartDataset|null} dataset Dataset definition.
|
|
178
|
+
* @property {unknown} label Label at the selected index.
|
|
179
|
+
* @property {unknown} value Data value.
|
|
180
|
+
* @property {Event|null} nativeEvent Engine-native event when available.
|
|
181
|
+
*/
|
|
182
|
+
/**
|
|
183
|
+
* @typedef {Object} ChartOptions
|
|
184
|
+
* @property {ChartAdapter|null} [adapter=null] Injected engine adapter.
|
|
185
|
+
* @property {string} [type='bar'] Chart type passed to the adapter.
|
|
186
|
+
* @property {ChartData} [data={labels: [], datasets: []}] Chart data.
|
|
187
|
+
* @property {Record<string, unknown>} [chartOptions={}] Engine-specific options.
|
|
188
|
+
* @property {string} [label='Chart'] Accessible canvas and summary label; blank text falls back to `Chart`.
|
|
189
|
+
* @property {string} [description=''] Accessible description.
|
|
190
|
+
* @property {'hidden'|'visible'} [summary='hidden'] Semantic data-table presentation.
|
|
191
|
+
* @property {boolean} [loading=false] Initial loading state.
|
|
192
|
+
* @property {string} [emptyText='No chart data'] Empty-state text.
|
|
193
|
+
* @property {string} [loadingText='Loading chart…'] Loading-state text.
|
|
194
|
+
* @property {string} [errorText='Unable to render chart'] Error fallback text.
|
|
195
|
+
* @property {string} [aspectRatio='16 / 9'] Responsive container aspect ratio.
|
|
196
|
+
* @property {(event: CustomEvent<{instance: unknown}>) => void} [onready] Engine-ready listener.
|
|
197
|
+
* @property {(event: CustomEvent<{data: ChartData, type: string}>) => void} [onupdate] Update listener.
|
|
198
|
+
* @property {(event: CustomEvent<ChartSelectDetail>) => void} [onselect] Point-selection listener.
|
|
199
|
+
* @property {(event: CustomEvent<{error: unknown}>) => void} [onerror] Engine error listener.
|
|
200
|
+
*/
|
|
201
|
+
/**
|
|
202
|
+
* Accessible, engine-neutral chart host with explicit adapter lifecycle.
|
|
203
|
+
* @fires Chart#ready
|
|
204
|
+
* @fires Chart#update
|
|
205
|
+
* @fires Chart#select
|
|
206
|
+
* @fires Chart#error
|
|
207
|
+
* @extends {Component<ChartOptions>}
|
|
208
|
+
*/
|
|
209
|
+
export declare class Chart extends Component<ChartOptions> {
|
|
210
|
+
_createdRoot: boolean;
|
|
211
|
+
_original: {
|
|
212
|
+
attributes: string[][];
|
|
213
|
+
children: ChildNode[];
|
|
214
|
+
};
|
|
215
|
+
_adapter: ChartAdapter;
|
|
216
|
+
_type: string;
|
|
217
|
+
_data: ChartData;
|
|
218
|
+
_label: string;
|
|
219
|
+
_chartOptions: Record<string, unknown>;
|
|
220
|
+
_loading: boolean;
|
|
221
|
+
_error: unknown;
|
|
222
|
+
_handle: ChartHandle;
|
|
223
|
+
_destroyed: boolean;
|
|
224
|
+
_observer: ResizeObserver;
|
|
225
|
+
static cssName: string;
|
|
226
|
+
/** @type {Readonly<ChartOptions>} */
|
|
227
|
+
static defaults: Readonly<ChartOptions>;
|
|
228
|
+
/**
|
|
229
|
+
* Creates or enhances a chart host.
|
|
230
|
+
* @param {Element|string|null} target Chart target.
|
|
231
|
+
* @param {ChartOptions} [options={}] Chart options.
|
|
232
|
+
*/
|
|
233
|
+
constructor(target?: Element | string | null, options?: ChartOptions);
|
|
234
|
+
/** @returns {HTMLElement} */
|
|
235
|
+
render(): HTMLElement;
|
|
236
|
+
/** Replaces chart data and updates or mounts the engine. @param {ChartData} data @returns {this} */
|
|
237
|
+
setData(data: ChartData): this;
|
|
238
|
+
/** Changes the chart type and updates/recreates the engine as needed. @param {string} type @returns {this} */
|
|
239
|
+
setType(type: string): this;
|
|
240
|
+
/** Replaces engine-specific options. @param {Record<string, unknown>} options @returns {this} */
|
|
241
|
+
update(options: Record<string, unknown>): this;
|
|
242
|
+
/** Replaces the engine adapter. @param {ChartAdapter|null} adapter @returns {this} */
|
|
243
|
+
setAdapter(adapter: ChartAdapter | null): this;
|
|
244
|
+
/** Toggles loading state. Loading charts do not keep an engine instance alive. @param {boolean} [loading=true] @returns {this} */
|
|
245
|
+
setLoading(loading?: boolean): this;
|
|
246
|
+
/** Shows an error and destroys the current engine. @param {unknown} error @returns {this} */
|
|
247
|
+
setError(error: unknown): this;
|
|
248
|
+
/** Clears the error and remounts when data and an adapter are available. @returns {this} */
|
|
249
|
+
clearError(): this;
|
|
250
|
+
/** Requests an engine resize. @returns {this} */
|
|
251
|
+
resize(): this;
|
|
252
|
+
/** Re-applies computed theme defaults through the adapter update path. @returns {this} */
|
|
253
|
+
refreshTheme(): this;
|
|
254
|
+
/** Returns the underlying engine instance when the adapter exposes it. @returns {unknown} */
|
|
255
|
+
getInstance(): unknown;
|
|
256
|
+
/** Destroys the engine/observer and restores or removes the host. @returns {void} */
|
|
257
|
+
destroy(): void;
|
|
258
|
+
/** @param {boolean} emitUpdate @returns {void} */
|
|
259
|
+
_mountOrUpdate(emitUpdate: boolean): void;
|
|
260
|
+
/** @returns {ChartSpec} */
|
|
261
|
+
_spec(): ChartSpec;
|
|
262
|
+
/** @returns {void} */
|
|
263
|
+
_destroyHandle(): void;
|
|
264
|
+
/** @returns {void} */
|
|
265
|
+
_syncState(): void;
|
|
266
|
+
/** @returns {void} */
|
|
267
|
+
_renderSummary(): void;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Adapter for an injected Chart.js 4 constructor or namespace.
|
|
271
|
+
*/
|
|
272
|
+
export declare class ChartJsAdapter {
|
|
273
|
+
engine: Function;
|
|
274
|
+
defaults: Record<string, unknown>;
|
|
275
|
+
/**
|
|
276
|
+
* @param {Function|{Chart?: Function}} engine Injected Chart.js constructor or namespace.
|
|
277
|
+
* @param {Record<string, unknown>} [defaults={}] Adapter-wide Chart.js options.
|
|
278
|
+
*/
|
|
279
|
+
constructor(engine: Function | {
|
|
280
|
+
Chart?: Function;
|
|
281
|
+
}, defaults?: Record<string, unknown>);
|
|
282
|
+
/**
|
|
283
|
+
* Creates one Chart.js lifecycle handle.
|
|
284
|
+
* @param {HTMLCanvasElement} canvas Canvas.
|
|
285
|
+
* @param {ChartSpec} spec Initial chart specification.
|
|
286
|
+
* @returns {ChartHandle}
|
|
287
|
+
*/
|
|
288
|
+
create(canvas: HTMLCanvasElement, spec: ChartSpec): ChartHandle;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Clones arrays and plain objects while preserving callbacks and engine-specific object instances.
|
|
292
|
+
* @template T
|
|
293
|
+
* @param {T} value Value.
|
|
294
|
+
* @returns {T}
|
|
295
|
+
*/
|
|
296
|
+
export declare function cloneChartValue<T>(value: T): T;
|
|
297
|
+
/** @param {ChartData} data @returns {boolean} */
|
|
298
|
+
export declare function isEmptyChartData(data: ChartData): boolean;
|
|
299
|
+
/**
|
|
300
|
+
* Builds the semantic table mirrored alongside the canvas.
|
|
301
|
+
* @param {ChartData} data Chart data.
|
|
302
|
+
* @param {string} label Caption.
|
|
303
|
+
* @returns {HTMLTableElement}
|
|
304
|
+
*/
|
|
305
|
+
export declare function chartSummaryTable(data: ChartData, label?: string): HTMLTableElement;
|
|
306
|
+
/**
|
|
307
|
+
* Produces the exact text matrix rendered by the semantic chart summary.
|
|
308
|
+
* @param {ChartData} data Chart data.
|
|
309
|
+
* @returns {{headers: string[], rows: Array<{label: string, values: string[]}>}}
|
|
310
|
+
*/
|
|
311
|
+
export declare function chartSummaryModel(data: ChartData): {
|
|
312
|
+
headers: string[];
|
|
313
|
+
rows: Array<{
|
|
314
|
+
label: string;
|
|
315
|
+
values: string[];
|
|
316
|
+
}>;
|
|
317
|
+
};
|
|
318
|
+
/** Fired after the adapter creates an engine instance. @event Chart#ready @type {CustomEvent<{instance: unknown}>} */
|
|
319
|
+
/** Fired after an existing chart updates. @event Chart#update @type {CustomEvent<{data: ChartData, type: string}>} */
|
|
320
|
+
/** Fired when the engine reports a selected point. @event Chart#select @type {CustomEvent<ChartSelectDetail>} */
|
|
321
|
+
/** Fired when adapter creation/update fails. @event Chart#error @type {CustomEvent<{error: unknown}>} */
|
|
@@ -40,6 +40,12 @@ export declare class MonthPicker extends DatePicker {
|
|
|
40
40
|
static cssName: string;
|
|
41
41
|
/** @type {MonthPickerOptions} */
|
|
42
42
|
static defaults: MonthPickerOptions;
|
|
43
|
+
/**
|
|
44
|
+
* Creates a month picker with its narrower month-based option contract.
|
|
45
|
+
* @param {Element|string|null} target Existing element, selector, or null.
|
|
46
|
+
* @param {MonthPickerOptions} [options={}] Month-picker options.
|
|
47
|
+
*/
|
|
48
|
+
constructor(target: Element | string | null, options?: MonthPickerOptions);
|
|
43
49
|
/** @returns {HTMLElement} */
|
|
44
50
|
render(): HTMLElement;
|
|
45
51
|
/** @returns {Date|null} */
|
|
@@ -281,4 +281,13 @@ export declare class Dialog extends Modal {
|
|
|
281
281
|
* @returns {Promise<string|null>}
|
|
282
282
|
*/
|
|
283
283
|
static prompt({ title, message, value, placeholder }?: PromptOptions): Promise<string | null>;
|
|
284
|
+
/**
|
|
285
|
+
* Applies the dialog width. Subclasses that size themselves on a different axis override this.
|
|
286
|
+
*
|
|
287
|
+
* Called from the constructor before any subclass field initializers have run, so an override
|
|
288
|
+
* may only touch the DOM — reading an uninitialized private field here throws.
|
|
289
|
+
* @param {'sm'|'md'|'lg'|number} size Preset or pixel width.
|
|
290
|
+
* @returns {void}
|
|
291
|
+
*/
|
|
292
|
+
_applySize(size: 'sm' | 'md' | 'lg' | number): void;
|
|
284
293
|
}
|