@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,495 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
import { dragAxis } from '../../core/drag-axis.js';
|
|
3
|
+
import { storage } from '../../core/storage.js';
|
|
4
|
+
export type DockContentValue = string | Node | Component | null;
|
|
5
|
+
export type DockContent = DockContentValue | (() => DockContentValue);
|
|
6
|
+
export type DockTab = {
|
|
7
|
+
/**
|
|
8
|
+
* Stable tab name.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* Visible tab label.
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* Panel content, or a factory called on first reveal.
|
|
17
|
+
*/
|
|
18
|
+
content?: DockContent;
|
|
19
|
+
};
|
|
20
|
+
export type DockPane = {
|
|
21
|
+
/**
|
|
22
|
+
* Stable pane name.
|
|
23
|
+
*/
|
|
24
|
+
name: string;
|
|
25
|
+
/**
|
|
26
|
+
* Header title. For a tab group it names the collapse control only.
|
|
27
|
+
*/
|
|
28
|
+
title?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Body content, or a factory called on first reveal. Ignored
|
|
31
|
+
* when `tabs` is given.
|
|
32
|
+
*/
|
|
33
|
+
content?: DockContent;
|
|
34
|
+
/**
|
|
35
|
+
* Tabs whose strip replaces the pane's title in the header.
|
|
36
|
+
*/
|
|
37
|
+
tabs?: DockTab[];
|
|
38
|
+
/**
|
|
39
|
+
* Initially active tab name; defaults to the first tab.
|
|
40
|
+
*/
|
|
41
|
+
active?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Initial size along the dock's axis. A number is pixels.
|
|
44
|
+
*/
|
|
45
|
+
size?: number | string;
|
|
46
|
+
/**
|
|
47
|
+
* Smallest the pane may be dragged to, in pixels. Never smaller than
|
|
48
|
+
* its own header.
|
|
49
|
+
*/
|
|
50
|
+
min?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether this pane absorbs leftover space. At most one pane
|
|
53
|
+
* does; with `content` present the content absorbs it instead.
|
|
54
|
+
*/
|
|
55
|
+
grow?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the pane starts collapsed to its header.
|
|
58
|
+
*/
|
|
59
|
+
collapsed?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the pane may be collapsed at all.
|
|
62
|
+
*/
|
|
63
|
+
collapsible?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Which side of `content` the pane sits on. Ignored when
|
|
66
|
+
* the dock has no `content`.
|
|
67
|
+
*/
|
|
68
|
+
side?: 'start' | 'end';
|
|
69
|
+
};
|
|
70
|
+
export type DockState = {
|
|
71
|
+
/**
|
|
72
|
+
* Pane sizes in pixels, by pane name.
|
|
73
|
+
*/
|
|
74
|
+
sizes: Record<string, number>;
|
|
75
|
+
/**
|
|
76
|
+
* Names of collapsed panes.
|
|
77
|
+
*/
|
|
78
|
+
collapsed: string[];
|
|
79
|
+
/**
|
|
80
|
+
* Active tab name, by pane name.
|
|
81
|
+
*/
|
|
82
|
+
active: Record<string, string>;
|
|
83
|
+
};
|
|
84
|
+
export type DockOptions = {
|
|
85
|
+
/**
|
|
86
|
+
* Axis the panes stack along.
|
|
87
|
+
* `vertical` stacks them top to bottom behind horizontal dividers.
|
|
88
|
+
*/
|
|
89
|
+
orientation?: 'vertical' | 'horizontal';
|
|
90
|
+
/**
|
|
91
|
+
* Optional flexible middle. With it the dock is a region
|
|
92
|
+
* and panes sit on either `side` of it; without it the panes fill the dock.
|
|
93
|
+
*/
|
|
94
|
+
content?: DockContent;
|
|
95
|
+
/**
|
|
96
|
+
* Panes, in order.
|
|
97
|
+
*/
|
|
98
|
+
panes?: DockPane[];
|
|
99
|
+
/**
|
|
100
|
+
* Whether dividers may be dragged.
|
|
101
|
+
*/
|
|
102
|
+
resizable?: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Default for `pane.collapsible`.
|
|
105
|
+
*/
|
|
106
|
+
collapsible?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Whether content factories run on first reveal rather than up
|
|
109
|
+
* front.
|
|
110
|
+
*/
|
|
111
|
+
lazy?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Key under which sizes, collapsed panes, and active
|
|
114
|
+
* tabs are remembered. Storage failures degrade to memory rather than throwing.
|
|
115
|
+
*/
|
|
116
|
+
storageKey?: string | null;
|
|
117
|
+
/**
|
|
118
|
+
* Accessible name given to every divider.
|
|
119
|
+
*/
|
|
120
|
+
label?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Collapse listener.
|
|
123
|
+
*/
|
|
124
|
+
oncollapse?: (event: CustomEvent<{
|
|
125
|
+
name: string;
|
|
126
|
+
}>) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Expand listener.
|
|
129
|
+
*/
|
|
130
|
+
onexpand?: (event: CustomEvent<{
|
|
131
|
+
name: string;
|
|
132
|
+
}>) => void;
|
|
133
|
+
/**
|
|
134
|
+
* Resize listener.
|
|
135
|
+
*/
|
|
136
|
+
onresize?: (event: CustomEvent<{
|
|
137
|
+
name: string;
|
|
138
|
+
size: number;
|
|
139
|
+
}>) => void;
|
|
140
|
+
/**
|
|
141
|
+
* Tab listener.
|
|
142
|
+
*/
|
|
143
|
+
ontabchange?: (event: CustomEvent<{
|
|
144
|
+
pane: string;
|
|
145
|
+
tab: string;
|
|
146
|
+
previous: string | null;
|
|
147
|
+
}>) => void;
|
|
148
|
+
/**
|
|
149
|
+
* Reveal listener.
|
|
150
|
+
*/
|
|
151
|
+
onreveal?: (event: CustomEvent<{
|
|
152
|
+
name: string;
|
|
153
|
+
}>) => void;
|
|
154
|
+
};
|
|
155
|
+
/** @typedef {string|Node|Component|null} DockContentValue */
|
|
156
|
+
/** @typedef {DockContentValue|(() => DockContentValue)} DockContent */
|
|
157
|
+
/**
|
|
158
|
+
* @typedef {Object} DockTab
|
|
159
|
+
* @property {string} name Stable tab name.
|
|
160
|
+
* @property {string} title Visible tab label.
|
|
161
|
+
* @property {DockContent} [content] Panel content, or a factory called on first reveal.
|
|
162
|
+
*/
|
|
163
|
+
/**
|
|
164
|
+
* @typedef {Object} DockPane
|
|
165
|
+
* @property {string} name Stable pane name.
|
|
166
|
+
* @property {string} [title=''] Header title. For a tab group it names the collapse control only.
|
|
167
|
+
* @property {DockContent} [content] Body content, or a factory called on first reveal. Ignored
|
|
168
|
+
* when `tabs` is given.
|
|
169
|
+
* @property {DockTab[]} [tabs] Tabs whose strip replaces the pane's title in the header.
|
|
170
|
+
* @property {string} [active] Initially active tab name; defaults to the first tab.
|
|
171
|
+
* @property {number|string} [size] Initial size along the dock's axis. A number is pixels.
|
|
172
|
+
* @property {number} [min=0] Smallest the pane may be dragged to, in pixels. Never smaller than
|
|
173
|
+
* its own header.
|
|
174
|
+
* @property {boolean} [grow=false] Whether this pane absorbs leftover space. At most one pane
|
|
175
|
+
* does; with `content` present the content absorbs it instead.
|
|
176
|
+
* @property {boolean} [collapsed=false] Whether the pane starts collapsed to its header.
|
|
177
|
+
* @property {boolean} [collapsible=true] Whether the pane may be collapsed at all.
|
|
178
|
+
* @property {'start'|'end'} [side='start'] Which side of `content` the pane sits on. Ignored when
|
|
179
|
+
* the dock has no `content`.
|
|
180
|
+
*/
|
|
181
|
+
/**
|
|
182
|
+
* @typedef {Object} DockState
|
|
183
|
+
* @property {Record<string, number>} sizes Pane sizes in pixels, by pane name.
|
|
184
|
+
* @property {string[]} collapsed Names of collapsed panes.
|
|
185
|
+
* @property {Record<string, string>} active Active tab name, by pane name.
|
|
186
|
+
*/
|
|
187
|
+
/**
|
|
188
|
+
* @typedef {Object} DockOptions
|
|
189
|
+
* @property {'vertical'|'horizontal'} [orientation='vertical'] Axis the panes stack along.
|
|
190
|
+
* `vertical` stacks them top to bottom behind horizontal dividers.
|
|
191
|
+
* @property {DockContent} [content=null] Optional flexible middle. With it the dock is a region
|
|
192
|
+
* and panes sit on either `side` of it; without it the panes fill the dock.
|
|
193
|
+
* @property {DockPane[]} [panes=[]] Panes, in order.
|
|
194
|
+
* @property {boolean} [resizable=true] Whether dividers may be dragged.
|
|
195
|
+
* @property {boolean} [collapsible=true] Default for `pane.collapsible`.
|
|
196
|
+
* @property {boolean} [lazy=true] Whether content factories run on first reveal rather than up
|
|
197
|
+
* front.
|
|
198
|
+
* @property {string|null} [storageKey=null] Key under which sizes, collapsed panes, and active
|
|
199
|
+
* tabs are remembered. Storage failures degrade to memory rather than throwing.
|
|
200
|
+
* @property {string} [label='Resize panes'] Accessible name given to every divider.
|
|
201
|
+
* @property {(event: CustomEvent<{name: string}>) => void} [oncollapse] Collapse listener.
|
|
202
|
+
* @property {(event: CustomEvent<{name: string}>) => void} [onexpand] Expand listener.
|
|
203
|
+
* @property {(event: CustomEvent<{name: string, size: number}>) => void} [onresize] Resize listener.
|
|
204
|
+
* @property {(event: CustomEvent<{pane: string, tab: string, previous: string|null}>) => void} [ontabchange] Tab listener.
|
|
205
|
+
* @property {(event: CustomEvent<{name: string}>) => void} [onreveal] Reveal listener.
|
|
206
|
+
*/
|
|
207
|
+
/**
|
|
208
|
+
* A stack of collapsible, resizable panes — the docked inspector column of a design tool, and the
|
|
209
|
+
* detail side of an ERP master–detail screen.
|
|
210
|
+
*
|
|
211
|
+
* The sizing model is one custom property per pane and one flex rule: a sized pane is
|
|
212
|
+
* `flex: 0 0 var(--zx-pane-size)`, a collapsed one falls to `flex: 0 0 auto` with its body hidden,
|
|
213
|
+
* and exactly one pane (or the `content`, when there is one) grows to absorb the slack. That is
|
|
214
|
+
* what keeps a drag local — it rewrites two properties and nothing else moves — and what makes
|
|
215
|
+
* collapsing feed the grower rather than redistributing across every pane.
|
|
216
|
+
*
|
|
217
|
+
* A pane is either titled or a tab group. A tab group puts its strip where the title would go,
|
|
218
|
+
* which is the pattern every panel dock uses and the reason `tabs` is a key on a pane rather than
|
|
219
|
+
* a separate component nested inside one.
|
|
220
|
+
* @fires Dock#collapse
|
|
221
|
+
* @fires Dock#expand
|
|
222
|
+
* @fires Dock#resize
|
|
223
|
+
* @fires Dock#tabchange
|
|
224
|
+
* @fires Dock#reveal
|
|
225
|
+
* @extends {Component<DockOptions>}
|
|
226
|
+
*/
|
|
227
|
+
export declare class Dock extends Component<DockOptions> {
|
|
228
|
+
_store: ReturnType<typeof storage> | null;
|
|
229
|
+
_orientation: string;
|
|
230
|
+
_resizable: boolean;
|
|
231
|
+
_lazy: boolean;
|
|
232
|
+
_destroyed: boolean;
|
|
233
|
+
/** @type {Map<string, Record<string, any>>} */
|
|
234
|
+
_panes: Map<string, Record<string, any>>;
|
|
235
|
+
/** @type {Record<string, any>|null} */
|
|
236
|
+
_drag: Record<string, any> | null;
|
|
237
|
+
/**
|
|
238
|
+
* One controller per divider. Dividers are rebuilt on every relayout, so the old controllers
|
|
239
|
+
* have to come down with them or each relayout would leave a set behind.
|
|
240
|
+
* @type {ReturnType<typeof dragAxis>[]}
|
|
241
|
+
*/
|
|
242
|
+
_dividerDrags: ReturnType<typeof dragAxis>[];
|
|
243
|
+
_createdRoot: boolean;
|
|
244
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
245
|
+
_content: HTMLElement;
|
|
246
|
+
static cssName: string;
|
|
247
|
+
/** @type {Readonly<DockOptions>} */
|
|
248
|
+
static defaults: Readonly<DockOptions>;
|
|
249
|
+
/**
|
|
250
|
+
* Creates a dock, or turns an existing element into one.
|
|
251
|
+
* @param {Element|string|null} [target=null] Existing container, selector, or null.
|
|
252
|
+
* @param {DockOptions} [options={}] Dock options.
|
|
253
|
+
*/
|
|
254
|
+
constructor(target?: Element | string | null, options?: DockOptions);
|
|
255
|
+
/**
|
|
256
|
+
* Builds the panes, dividers, and optional content region. Runs inside the base constructor,
|
|
257
|
+
* before any class field would exist, so all state is assigned here as plain properties.
|
|
258
|
+
* @returns {HTMLElement}
|
|
259
|
+
*/
|
|
260
|
+
render(): HTMLElement;
|
|
261
|
+
/**
|
|
262
|
+
* Returns a pane's record.
|
|
263
|
+
* @param {string} name Pane name.
|
|
264
|
+
* @returns {Record<string, any>|null}
|
|
265
|
+
*/
|
|
266
|
+
pane(name: string): Record<string, any> | null;
|
|
267
|
+
/**
|
|
268
|
+
* Lists pane names in visual order.
|
|
269
|
+
* @returns {string[]}
|
|
270
|
+
*/
|
|
271
|
+
names(): string[];
|
|
272
|
+
/**
|
|
273
|
+
* Adds a pane.
|
|
274
|
+
* @param {DockPane} definition Pane definition.
|
|
275
|
+
* @param {{index?: number}} [options={}] Insertion index; omitted appends.
|
|
276
|
+
* @returns {Record<string, any>}
|
|
277
|
+
*/
|
|
278
|
+
add(definition: DockPane, options?: {
|
|
279
|
+
index?: number;
|
|
280
|
+
}): Record<string, any>;
|
|
281
|
+
/**
|
|
282
|
+
* Removes a pane and its element.
|
|
283
|
+
* @param {string} name Pane name.
|
|
284
|
+
* @returns {this}
|
|
285
|
+
*/
|
|
286
|
+
remove(name: string): this;
|
|
287
|
+
/**
|
|
288
|
+
* Collapses a pane to its header.
|
|
289
|
+
* @param {string} name Pane name.
|
|
290
|
+
* @returns {this}
|
|
291
|
+
* @fires Dock#collapse
|
|
292
|
+
*/
|
|
293
|
+
collapse(name: string): this;
|
|
294
|
+
/**
|
|
295
|
+
* Expands a pane.
|
|
296
|
+
* @param {string} name Pane name.
|
|
297
|
+
* @returns {this}
|
|
298
|
+
* @fires Dock#expand
|
|
299
|
+
*/
|
|
300
|
+
expand(name: string): this;
|
|
301
|
+
/**
|
|
302
|
+
* Toggles a pane's collapsed state.
|
|
303
|
+
* @param {string} name Pane name.
|
|
304
|
+
* @returns {this}
|
|
305
|
+
*/
|
|
306
|
+
toggle(name: string): this;
|
|
307
|
+
/**
|
|
308
|
+
* Reports whether a pane is collapsed.
|
|
309
|
+
* @param {string} name Pane name.
|
|
310
|
+
* @returns {boolean}
|
|
311
|
+
*/
|
|
312
|
+
isCollapsed(name: string): boolean;
|
|
313
|
+
/**
|
|
314
|
+
* Brings something into view by name — a pane, or a tab in one of them. Expands the pane,
|
|
315
|
+
* activates the tab where the name is a tab's, and scrolls the pane into view.
|
|
316
|
+
* @param {string} name Pane or tab name.
|
|
317
|
+
* @returns {this}
|
|
318
|
+
* @fires Dock#reveal
|
|
319
|
+
*/
|
|
320
|
+
reveal(name: string): this;
|
|
321
|
+
/**
|
|
322
|
+
* Sets a pane's size along the dock's axis.
|
|
323
|
+
* @param {string} name Pane name.
|
|
324
|
+
* @param {number|string} size Pixels, or any CSS length.
|
|
325
|
+
* @returns {this}
|
|
326
|
+
*/
|
|
327
|
+
setSize(name: string, size: number | string): this;
|
|
328
|
+
/**
|
|
329
|
+
* Returns a pane's current size in pixels.
|
|
330
|
+
* @param {string} name Pane name.
|
|
331
|
+
* @returns {number}
|
|
332
|
+
*/
|
|
333
|
+
getSize(name: string): number;
|
|
334
|
+
/**
|
|
335
|
+
* Activates a tab inside a tab-group pane.
|
|
336
|
+
* @param {string} paneName Pane name.
|
|
337
|
+
* @param {string} tabName Tab name.
|
|
338
|
+
* @returns {this}
|
|
339
|
+
* @fires Dock#tabchange
|
|
340
|
+
*/
|
|
341
|
+
activate(paneName: string, tabName: string): this;
|
|
342
|
+
/**
|
|
343
|
+
* Returns the active tab name of a tab-group pane.
|
|
344
|
+
* @param {string} paneName Pane name.
|
|
345
|
+
* @returns {string|null}
|
|
346
|
+
*/
|
|
347
|
+
getActive(paneName: string): string | null;
|
|
348
|
+
/**
|
|
349
|
+
* Captures the layout as a serialisable object.
|
|
350
|
+
* @returns {DockState}
|
|
351
|
+
*/
|
|
352
|
+
state(): DockState;
|
|
353
|
+
/**
|
|
354
|
+
* Restores a layout captured by `state()`. Unknown pane names are ignored, so a stored layout
|
|
355
|
+
* survives a release that added or removed panes.
|
|
356
|
+
* @param {DockState} state Layout state.
|
|
357
|
+
* @returns {this}
|
|
358
|
+
*/
|
|
359
|
+
setState(state: DockState): this;
|
|
360
|
+
/**
|
|
361
|
+
* Removes created nodes and restores an enhanced target.
|
|
362
|
+
* @returns {void}
|
|
363
|
+
*/
|
|
364
|
+
destroy(): void;
|
|
365
|
+
/**
|
|
366
|
+
* Builds one pane, titled or tabbed.
|
|
367
|
+
* @param {DockPane} definition Pane definition.
|
|
368
|
+
* @returns {Record<string, any>}
|
|
369
|
+
*/
|
|
370
|
+
_buildPane(definition: DockPane): Record<string, any>;
|
|
371
|
+
/**
|
|
372
|
+
* Runs any not-yet-run content factory for whatever the pane currently shows.
|
|
373
|
+
* @param {Record<string, any>} record Pane record.
|
|
374
|
+
* @returns {void}
|
|
375
|
+
*/
|
|
376
|
+
_materialize(record: Record<string, any>): void;
|
|
377
|
+
/**
|
|
378
|
+
* Re-inserts panes, dividers, and the content region in visual order.
|
|
379
|
+
* @returns {void}
|
|
380
|
+
*/
|
|
381
|
+
_layout(): void;
|
|
382
|
+
/**
|
|
383
|
+
* Creates one divider with its separator semantics and drag wiring.
|
|
384
|
+
* @returns {HTMLElement}
|
|
385
|
+
*/
|
|
386
|
+
_divider(): HTMLElement;
|
|
387
|
+
/**
|
|
388
|
+
* Whether a record currently occupies no usable space: a collapsed pane, or a closed sheet.
|
|
389
|
+
* A closed sheet differs from a collapsed pane in that it leaves nothing at all behind, not
|
|
390
|
+
* even a header — which is why the two cannot share one flag.
|
|
391
|
+
* @param {Record<string, any>} record Pane or sheet record.
|
|
392
|
+
* @returns {boolean}
|
|
393
|
+
*/
|
|
394
|
+
_isHidden(record: Record<string, any>): boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Hands a Sheet's positioning to this dock. The sheet becomes a track in the dock's flow: the
|
|
397
|
+
* dock owns its side, size, and resizing, while the sheet keeps its own content and lifecycle.
|
|
398
|
+
*
|
|
399
|
+
* Nothing about the sheet is rebuilt — adoption moves the element and reopens it in place, so
|
|
400
|
+
* listeners and DOM state survive the handoff.
|
|
401
|
+
* @param {Object} sheet Sheet to adopt.
|
|
402
|
+
* @param {{name?: string, side?: 'start'|'end', index?: number, size?: number|string,
|
|
403
|
+
* min?: number, dockAt?: 'sm'|'md'|'lg'|'xl'|null}} [options={}] Placement options.
|
|
404
|
+
* `dockAt` floats the sheet back to a free overlay below that breakpoint, measured on the
|
|
405
|
+
* dock's own width.
|
|
406
|
+
* @returns {Record<string, any>}
|
|
407
|
+
*/
|
|
408
|
+
adopt(sheet: any, options?: {
|
|
409
|
+
name?: string;
|
|
410
|
+
side?: 'start' | 'end';
|
|
411
|
+
index?: number;
|
|
412
|
+
size?: number | string;
|
|
413
|
+
min?: number;
|
|
414
|
+
dockAt?: 'sm' | 'md' | 'lg' | 'xl' | null;
|
|
415
|
+
}): Record<string, any>;
|
|
416
|
+
/**
|
|
417
|
+
* Hands a sheet back. It becomes a free overlay again, still open if it was open.
|
|
418
|
+
* @param {Object} sheet Sheet to release.
|
|
419
|
+
* @returns {this}
|
|
420
|
+
*/
|
|
421
|
+
release(sheet: any): this;
|
|
422
|
+
/**
|
|
423
|
+
* Drops a sheet that destroyed itself while adopted, without re-hosting a dead element.
|
|
424
|
+
* @param {Object} sheet Sheet being destroyed.
|
|
425
|
+
* @returns {void}
|
|
426
|
+
*/
|
|
427
|
+
_forget(sheet: any): void;
|
|
428
|
+
/**
|
|
429
|
+
* Docks or floats one adopted sheet, per its breakpoint.
|
|
430
|
+
* @param {Record<string, any>} record Sheet record.
|
|
431
|
+
* @param {boolean} docked Whether the dock is wide enough to hold it.
|
|
432
|
+
* @returns {void}
|
|
433
|
+
*/
|
|
434
|
+
_applyDockAt(record: Record<string, any>, docked: boolean): void;
|
|
435
|
+
/**
|
|
436
|
+
* Picks which element absorbs leftover space. The content always wins where there is one;
|
|
437
|
+
* otherwise the declared `grow` pane, or the last expanded pane so the stack still fills.
|
|
438
|
+
* @returns {void}
|
|
439
|
+
*/
|
|
440
|
+
_syncGrow(): void;
|
|
441
|
+
/**
|
|
442
|
+
* Refreshes every divider's live separator values and disables the ones with nothing to resize.
|
|
443
|
+
* @returns {void}
|
|
444
|
+
*/
|
|
445
|
+
_syncDividers(): void;
|
|
446
|
+
/**
|
|
447
|
+
* Applies the collapsed flag to the DOM.
|
|
448
|
+
* @param {Record<string, any>} record Pane record.
|
|
449
|
+
* @returns {void}
|
|
450
|
+
*/
|
|
451
|
+
_syncPaneState(record: Record<string, any>): void;
|
|
452
|
+
/** @returns {HTMLElement[]} */
|
|
453
|
+
_dividers(): HTMLElement[];
|
|
454
|
+
/**
|
|
455
|
+
* @param {HTMLElement} divider
|
|
456
|
+
* @returns {{before: Record<string, any>|null, after: Record<string, any>|null}}
|
|
457
|
+
*/
|
|
458
|
+
_neighbours(divider: HTMLElement): {
|
|
459
|
+
before: Record<string, any> | null;
|
|
460
|
+
after: Record<string, any> | null;
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* Decides which pane a divider actually resizes. A pane that grows or is collapsed is not a
|
|
464
|
+
* candidate, and neither is the content region — dragging beside those resizes the other side.
|
|
465
|
+
* @param {Record<string, any>|null} before
|
|
466
|
+
* @param {Record<string, any>|null} after
|
|
467
|
+
* @returns {{element: HTMLElement, record: Record<string, any>, sign: number, opposite: Record<string, any>|null}|null}
|
|
468
|
+
*/
|
|
469
|
+
_resizeSubject(before: Record<string, any> | null, after: Record<string, any> | null): {
|
|
470
|
+
element: HTMLElement;
|
|
471
|
+
record: Record<string, any>;
|
|
472
|
+
sign: number;
|
|
473
|
+
opposite: Record<string, any> | null;
|
|
474
|
+
} | null;
|
|
475
|
+
/** @param {Record<string, any>} subject @returns {number} */
|
|
476
|
+
_minSize(subject: Record<string, any>): number;
|
|
477
|
+
/** @param {Element} element @returns {number} */
|
|
478
|
+
_axisSize(element: Element): number;
|
|
479
|
+
/**
|
|
480
|
+
* Applies a pointer delta to the pane the divider resizes, and to its neighbour where the pair
|
|
481
|
+
* shares a fixed budget.
|
|
482
|
+
* @param {number} delta Pixels travelled along the axis since the drag began.
|
|
483
|
+
* @returns {void}
|
|
484
|
+
*/
|
|
485
|
+
_trackDelta(delta: number): void;
|
|
486
|
+
/**
|
|
487
|
+
* Moves a divider by a keyboard step.
|
|
488
|
+
* @param {HTMLElement} divider Divider being driven.
|
|
489
|
+
* @param {number} amount Signed pixels.
|
|
490
|
+
* @returns {void}
|
|
491
|
+
*/
|
|
492
|
+
_stepDivider(divider: HTMLElement, amount: number): void;
|
|
493
|
+
/** @returns {void} */
|
|
494
|
+
_persist(): void;
|
|
495
|
+
}
|
|
@@ -11,7 +11,7 @@ export type DropdownOptions = {
|
|
|
11
11
|
/**
|
|
12
12
|
* Panel placement.
|
|
13
13
|
*/
|
|
14
|
-
placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top';
|
|
14
|
+
placement?: 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end' | 'bottom' | 'top' | 'right-start' | 'right-end' | 'left-start' | 'left-end' | 'right' | 'left';
|
|
15
15
|
/**
|
|
16
16
|
* Gap between anchor and panel in pixels.
|
|
17
17
|
*/
|
|
@@ -40,7 +40,7 @@ export type DropdownOptions = {
|
|
|
40
40
|
/**
|
|
41
41
|
* @typedef {Object} DropdownOptions
|
|
42
42
|
* @property {Node|string|number|{toElement: () => Node|null}|null} [content=null] Panel content.
|
|
43
|
-
* @property {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'} [placement='bottom-start'] Panel placement.
|
|
43
|
+
* @property {'bottom-start'|'bottom-end'|'top-start'|'top-end'|'bottom'|'top'|'right-start'|'right-end'|'left-start'|'left-end'|'right'|'left'} [placement='bottom-start'] Panel placement.
|
|
44
44
|
* @property {number} [offset=4] Gap between anchor and panel in pixels.
|
|
45
45
|
* @property {boolean} [matchWidth=false] Whether the panel matches the anchor width.
|
|
46
46
|
* @property {'click'|'manual'} [openOn='click'] Trigger behavior.
|
|
@@ -48,6 +48,18 @@ export type FieldOptions = {
|
|
|
48
48
|
* Adapter used by the `custom` type.
|
|
49
49
|
*/
|
|
50
50
|
adapter?: FieldAdapterFactory;
|
|
51
|
+
/**
|
|
52
|
+
* Value change listener.
|
|
53
|
+
*/
|
|
54
|
+
onchange?: (event: CustomEvent<{
|
|
55
|
+
value: unknown;
|
|
56
|
+
}>) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Validation failure listener.
|
|
59
|
+
*/
|
|
60
|
+
oninvalid?: (event: CustomEvent<{
|
|
61
|
+
message: string;
|
|
62
|
+
}>) => void;
|
|
51
63
|
};
|
|
52
64
|
export type FieldAdapter = {
|
|
53
65
|
/**
|
|
@@ -96,6 +108,8 @@ export type NumericCoercion = {
|
|
|
96
108
|
* @property {'stack'|'inline'} [layout='stack'] Label/control layout.
|
|
97
109
|
* @property {Record<string, unknown>} [props={}] Adapter-specific control properties.
|
|
98
110
|
* @property {FieldAdapterFactory} [adapter] Adapter used by the `custom` type.
|
|
111
|
+
* @property {(event: CustomEvent<{value: unknown}>) => void} [onchange] Value change listener.
|
|
112
|
+
* @property {(event: CustomEvent<{message: string}>) => void} [oninvalid] Validation failure listener.
|
|
99
113
|
*/
|
|
100
114
|
/**
|
|
101
115
|
* @typedef {Object} FieldAdapter
|
|
@@ -76,6 +76,34 @@ export type FieldUploadOptions = {
|
|
|
76
76
|
* Injected Http-compatible or stub upload transport.
|
|
77
77
|
*/
|
|
78
78
|
http?: UploadTransport | null;
|
|
79
|
+
/**
|
|
80
|
+
* File selection listener.
|
|
81
|
+
*/
|
|
82
|
+
onselect?: (event: CustomEvent<{
|
|
83
|
+
files: File[];
|
|
84
|
+
}>) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Upload progress listener.
|
|
87
|
+
*/
|
|
88
|
+
onprogress?: (event: CustomEvent<{
|
|
89
|
+
percent: number;
|
|
90
|
+
}>) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Upload success listener.
|
|
93
|
+
*/
|
|
94
|
+
onsuccess?: (event: CustomEvent<{
|
|
95
|
+
response: unknown;
|
|
96
|
+
}>) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Upload failure listener.
|
|
99
|
+
*/
|
|
100
|
+
onerror?: (event: CustomEvent<{
|
|
101
|
+
error: Error;
|
|
102
|
+
}>) => void;
|
|
103
|
+
/**
|
|
104
|
+
* Upload abort listener.
|
|
105
|
+
*/
|
|
106
|
+
onabort?: (event: CustomEvent<Record<string, never>>) => void;
|
|
79
107
|
};
|
|
80
108
|
/**
|
|
81
109
|
* @typedef {Object} UploadTransport
|
|
@@ -103,6 +131,11 @@ export type FieldUploadOptions = {
|
|
|
103
131
|
* @property {boolean} [autoUpload=true] Upload immediately after selection.
|
|
104
132
|
* @property {boolean} [preview=true] Show a preview for the first selected image.
|
|
105
133
|
* @property {UploadTransport|null} [http=null] Injected Http-compatible or stub upload transport.
|
|
134
|
+
* @property {(event: CustomEvent<{files: File[]}>) => void} [onselect] File selection listener.
|
|
135
|
+
* @property {(event: CustomEvent<{percent: number}>) => void} [onprogress] Upload progress listener.
|
|
136
|
+
* @property {(event: CustomEvent<{response: unknown}>) => void} [onsuccess] Upload success listener.
|
|
137
|
+
* @property {(event: CustomEvent<{error: Error}>) => void} [onerror] Upload failure listener.
|
|
138
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onabort] Upload abort listener.
|
|
106
139
|
*/
|
|
107
140
|
/**
|
|
108
141
|
* Accessible click/drop upload area. Native requests intentionally use XMLHttpRequest because
|
|
@@ -189,22 +222,22 @@ export declare class FieldUpload extends Component<FieldUploadOptions> {
|
|
|
189
222
|
/**
|
|
190
223
|
* Files selected event.
|
|
191
224
|
* @event FieldUpload#select
|
|
192
|
-
* @type {CustomEvent<{files: File[]}>
|
|
225
|
+
* @type {CustomEvent<{files: File[]}>}
|
|
193
226
|
*/
|
|
194
227
|
/**
|
|
195
228
|
* Upload progress event.
|
|
196
229
|
* @event FieldUpload#progress
|
|
197
|
-
* @type {CustomEvent<{percent: number}>
|
|
230
|
+
* @type {CustomEvent<{percent: number}>}
|
|
198
231
|
*/
|
|
199
232
|
/**
|
|
200
233
|
* Upload success event.
|
|
201
234
|
* @event FieldUpload#success
|
|
202
|
-
* @type {CustomEvent<{response: unknown}>
|
|
235
|
+
* @type {CustomEvent<{response: unknown}>}
|
|
203
236
|
*/
|
|
204
237
|
/**
|
|
205
238
|
* Upload failure event.
|
|
206
239
|
* @event FieldUpload#error
|
|
207
|
-
* @type {CustomEvent<{error: Error}>
|
|
240
|
+
* @type {CustomEvent<{error: Error}>}
|
|
208
241
|
*/
|
|
209
242
|
/**
|
|
210
243
|
* Upload aborted event.
|
|
@@ -51,6 +51,25 @@ export type FormOptions = {
|
|
|
51
51
|
* Native `novalidate` state.
|
|
52
52
|
*/
|
|
53
53
|
novalidate?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Submit listener.
|
|
56
|
+
*/
|
|
57
|
+
onsubmit?: (event: CustomEvent<{
|
|
58
|
+
values: Record<string, unknown>;
|
|
59
|
+
}>) => void;
|
|
60
|
+
/**
|
|
61
|
+
* Invalid listener.
|
|
62
|
+
*/
|
|
63
|
+
oninvalid?: (event: CustomEvent<{
|
|
64
|
+
errors: Record<string, string>;
|
|
65
|
+
}>) => void;
|
|
66
|
+
/**
|
|
67
|
+
* Field change listener.
|
|
68
|
+
*/
|
|
69
|
+
onchange?: (event: CustomEvent<{
|
|
70
|
+
id: string;
|
|
71
|
+
value: unknown;
|
|
72
|
+
}>) => void;
|
|
54
73
|
};
|
|
55
74
|
/**
|
|
56
75
|
* @typedef {Object} FormAction
|
|
@@ -69,6 +88,9 @@ export type FormOptions = {
|
|
|
69
88
|
* @property {Array<Fieldset|import('../fieldset/fieldset.js').FieldsetOptions>} [fieldsets=[]] Initial fieldsets.
|
|
70
89
|
* @property {FormAction[]} [actions=[]] Form action descriptors.
|
|
71
90
|
* @property {boolean} [novalidate=true] Native `novalidate` state.
|
|
91
|
+
* @property {(event: CustomEvent<{values: Record<string, unknown>}>) => void} [onsubmit] Submit listener.
|
|
92
|
+
* @property {(event: CustomEvent<{errors: Record<string, string>}>) => void} [oninvalid] Invalid listener.
|
|
93
|
+
* @property {(event: CustomEvent<{id: string, value: unknown}>) => void} [onchange] Field change listener.
|
|
72
94
|
*/
|
|
73
95
|
/**
|
|
74
96
|
* Real form element coordinating fieldsets, validation, and actions.
|
|
@@ -180,15 +202,15 @@ export declare class Form extends Component<FormOptions> {
|
|
|
180
202
|
/**
|
|
181
203
|
* Successful form submission event.
|
|
182
204
|
* @event Form#submit
|
|
183
|
-
* @type {CustomEvent<{values: Record<string, unknown>}>
|
|
205
|
+
* @type {CustomEvent<{values: Record<string, unknown>}>}
|
|
184
206
|
*/
|
|
185
207
|
/**
|
|
186
208
|
* Form validation failure event.
|
|
187
209
|
* @event Form#invalid
|
|
188
|
-
* @type {CustomEvent<{errors: Record<string, string>}>
|
|
210
|
+
* @type {CustomEvent<{errors: Record<string, string>}>}
|
|
189
211
|
*/
|
|
190
212
|
/**
|
|
191
213
|
* Delegated field value change event.
|
|
192
214
|
* @event Form#change
|
|
193
|
-
* @type {CustomEvent<{id: string, value: unknown}>
|
|
215
|
+
* @type {CustomEvent<{id: string, value: unknown}>}
|
|
194
216
|
*/
|