@zeyos/zx 2.3.0 → 4.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 +138 -0
- package/DESIGN-SYSTEM.md +96 -0
- package/README.md +29 -39
- package/dist/types/components/account-menu/account-menu.d.ts +144 -0
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +243 -0
- package/dist/types/components/avatar/avatar.d.ts +100 -0
- package/dist/types/components/card/card.d.ts +128 -0
- package/dist/types/components/chart/chart.d.ts +322 -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 +359 -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 +7 -1
- 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 +51 -0
- 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/table/table.d.ts +223 -15
- 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 +122 -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 +13 -2
- package/dist/types/internal/app-rail.d.ts +265 -0
- package/dist/types/zeyos/icons.d.ts +5 -0
- package/dist/types/zeyos/index.d.ts +2 -1
- package/dist/types/zeyos/launcher.d.ts +147 -0
- package/dist/types/zeyos/select.d.ts +39 -0
- package/dist/zx-zeyos.esm.js +1870 -133
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +2006 -267
- package/dist/zx.esm.js +8987 -2757
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +8987 -2757
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +4396 -2344
- package/docs/llms.md +463 -86
- package/docs/llms.txt +32 -19
- package/package.json +10 -17
- 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-sidebar/app-sidebar.css +80 -0
- package/src/components/app-sidebar/app-sidebar.js +588 -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/card/card.css +149 -0
- package/src/components/card/card.js +285 -0
- package/src/components/chart/chart.css +61 -0
- package/src/components/chart/chart.js +523 -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/form/form.js +6 -3
- package/src/components/grid/grid.css +6 -0
- package/src/components/grid/grid.js +220 -0
- package/src/components/launcher/launcher.css +210 -0
- package/src/components/launcher/launcher.js +765 -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.js +2 -1
- 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/select/field-adapter.js +9 -4
- package/src/components/select/select.css +144 -11
- package/src/components/select/select.js +259 -27
- 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/table/table.css +43 -0
- package/src/components/table/table.js +531 -52
- package/src/components/tooltip/tooltip.js +5 -2
- package/src/components/value-list/value-list.js +6 -3
- package/src/core/dom.js +322 -0
- package/src/core/drag-axis.js +203 -0
- package/src/core/position.js +68 -22
- package/src/index.js +20 -2
- package/src/internal/app-rail.js +718 -0
- package/src/zeyos/icons.js +8 -3
- package/src/zeyos/index.js +7 -1
- package/src/zeyos/launcher.js +338 -0
- package/src/zeyos/modules.js +1 -0
- package/src/zeyos/select.js +115 -1
- package/styles/tokens/dark.css +2 -3
- package/styles/tokens/global.css +6 -6
- package/styles/tokens/modules.css +1 -0
- package/styles/tokens/semantic.css +5 -3
- package/styles/tokens/themes.css +1 -1
- package/styles/zx.css +11 -1
- package/MIGRATION.md +0 -598
- package/dist/types/compat/base.d.ts +0 -156
- package/dist/types/compat/globals.d.ts +0 -20
- package/dist/types/compat/index.d.ts +0 -128
- package/dist/types/compat/map/basic.d.ts +0 -175
- package/dist/types/compat/map/data.d.ts +0 -102
- package/dist/types/compat/map/date-time.d.ts +0 -80
- package/dist/types/compat/map/factory.d.ts +0 -9
- package/dist/types/compat/map/form.d.ts +0 -98
- package/dist/types/compat/map/helpers.d.ts +0 -12
- package/dist/types/compat/map/http.d.ts +0 -36
- package/dist/types/compat/map/layout.d.ts +0 -106
- package/dist/types/compat/map/options.d.ts +0 -80
- package/dist/types/compat/map/select.d.ts +0 -95
- package/dist/types/compat/map/stubs.d.ts +0 -32
- package/dist/types/compat/map/utilities.d.ts +0 -37
- package/dist/types/compat-entry.d.ts +0 -5
- package/dist/types/components/permission/permission.d.ts +0 -96
- package/dist/zx-compat.esm.js +0 -17484
- package/dist/zx-compat.esm.min.js +0 -1
- package/dist/zx-compat.global.js +0 -23635
- package/dist/zx-compat.global.min.js +0 -3
- package/src/compat/base.js +0 -291
- package/src/compat/globals.js +0 -165
- package/src/compat/index.js +0 -84
- package/src/compat/map/basic.js +0 -464
- package/src/compat/map/data.js +0 -232
- package/src/compat/map/date-time.js +0 -177
- package/src/compat/map/factory.js +0 -45
- package/src/compat/map/form.js +0 -330
- package/src/compat/map/helpers.js +0 -46
- package/src/compat/map/http.js +0 -117
- package/src/compat/map/layout.js +0 -256
- package/src/compat/map/options.js +0 -267
- package/src/compat/map/select.js +0 -198
- package/src/compat/map/stubs.js +0 -26
- package/src/compat/map/utilities.js +0 -113
- package/src/compat-entry.js +0 -11
- package/src/components/permission/permission.css +0 -47
- package/src/components/permission/permission.js +0 -201
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/** @typedef {import('./sheet.js').Sheet} Sheet */
|
|
2
|
+
export type Sheet = import('./sheet.js').Sheet;
|
|
3
|
+
export type SheetStackOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* How depth is expressed. `stack` slides each
|
|
6
|
+
* covered sheet back toward its edge and scales it down, leaving only the top one usable —
|
|
7
|
+
* the drill-down feel. `cascade` shifts each covered sheet clear of the ones in front so they
|
|
8
|
+
* sit side by side and all stay usable, which is what an ERP screen usually wants: the parent
|
|
9
|
+
* record stays readable while a line item is edited.
|
|
10
|
+
*/
|
|
11
|
+
layout?: 'stack' | 'cascade';
|
|
12
|
+
/**
|
|
13
|
+
* Pixels a `stack` layout moves per depth step.
|
|
14
|
+
*/
|
|
15
|
+
offset?: number;
|
|
16
|
+
/**
|
|
17
|
+
* How much a `stack` layout shrinks per depth step, as a fraction.
|
|
18
|
+
*/
|
|
19
|
+
scale?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Depth at which a sheet stops being drawn. Deeper sheets stay open and
|
|
22
|
+
* in the stack; they are simply no longer visible behind the ones in front.
|
|
23
|
+
*/
|
|
24
|
+
max?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Push listener.
|
|
27
|
+
*/
|
|
28
|
+
onpush?: (event: CustomEvent<{
|
|
29
|
+
sheet: Sheet;
|
|
30
|
+
depth: number;
|
|
31
|
+
}>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Pop listener.
|
|
34
|
+
*/
|
|
35
|
+
onpop?: (event: CustomEvent<{
|
|
36
|
+
sheet: Sheet;
|
|
37
|
+
}>) => void;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {Object} SheetStackOptions
|
|
41
|
+
* @property {'stack'|'cascade'} [layout='stack'] How depth is expressed. `stack` slides each
|
|
42
|
+
* covered sheet back toward its edge and scales it down, leaving only the top one usable —
|
|
43
|
+
* the drill-down feel. `cascade` shifts each covered sheet clear of the ones in front so they
|
|
44
|
+
* sit side by side and all stay usable, which is what an ERP screen usually wants: the parent
|
|
45
|
+
* record stays readable while a line item is edited.
|
|
46
|
+
* @property {number} [offset=24] Pixels a `stack` layout moves per depth step.
|
|
47
|
+
* @property {number} [scale=0.04] How much a `stack` layout shrinks per depth step, as a fraction.
|
|
48
|
+
* @property {number} [max=3] Depth at which a sheet stops being drawn. Deeper sheets stay open and
|
|
49
|
+
* in the stack; they are simply no longer visible behind the ones in front.
|
|
50
|
+
* @property {(event: CustomEvent<{sheet: Sheet, depth: number}>) => void} [onpush] Push listener.
|
|
51
|
+
* @property {(event: CustomEvent<{sheet: Sheet}>) => void} [onpop] Pop listener.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* An ordered group of Sheets that read as one drill-down.
|
|
55
|
+
*
|
|
56
|
+
* Deliberately tiny, because the browser already does the hard part: nested dialogs stack in the
|
|
57
|
+
* top layer by open order, so there is no z-index bookkeeping here, and Escape closes only the
|
|
58
|
+
* topmost, so unwinding one level at a time is native behaviour rather than something to
|
|
59
|
+
* implement. What is left is bookkeeping — which sheet is at which depth — written onto the
|
|
60
|
+
* elements as `data-depth` and `--zx-sheet-depth` for CSS to interpret.
|
|
61
|
+
*
|
|
62
|
+
* Owns no element of its own, so it is a controller rather than a `Component`: there is nothing
|
|
63
|
+
* to render, only sheets to arrange.
|
|
64
|
+
*
|
|
65
|
+
* @fires SheetStack#push
|
|
66
|
+
* @fires SheetStack#pop
|
|
67
|
+
*/
|
|
68
|
+
export declare class SheetStack extends EventTarget {
|
|
69
|
+
#private;
|
|
70
|
+
options: Readonly<{
|
|
71
|
+
layout?: 'stack' | 'cascade';
|
|
72
|
+
offset?: number;
|
|
73
|
+
scale?: number;
|
|
74
|
+
max?: number;
|
|
75
|
+
onpush?: (event: CustomEvent<{
|
|
76
|
+
sheet: Sheet;
|
|
77
|
+
depth: number;
|
|
78
|
+
}>) => void;
|
|
79
|
+
onpop?: (event: CustomEvent<{
|
|
80
|
+
sheet: Sheet;
|
|
81
|
+
}>) => void;
|
|
82
|
+
}>;
|
|
83
|
+
/** @type {Readonly<SheetStackOptions>} */
|
|
84
|
+
static defaults: Readonly<SheetStackOptions>;
|
|
85
|
+
/**
|
|
86
|
+
* Creates a sheet stack.
|
|
87
|
+
* @param {SheetStackOptions} [options={}] Stack options.
|
|
88
|
+
*/
|
|
89
|
+
constructor(options?: SheetStackOptions);
|
|
90
|
+
/**
|
|
91
|
+
* Adds a sheet to the top of the stack, opening it if it is closed. A sheet already in the stack
|
|
92
|
+
* is raised rather than added twice.
|
|
93
|
+
* @param {Sheet} sheet Sheet to push.
|
|
94
|
+
* @returns {this}
|
|
95
|
+
* @fires SheetStack#push
|
|
96
|
+
*/
|
|
97
|
+
push(sheet: Sheet): this;
|
|
98
|
+
/**
|
|
99
|
+
* Closes the top sheet and removes it from the stack.
|
|
100
|
+
*
|
|
101
|
+
* The removal is synchronous while the close is not — a dialog dispatches `close` in a queued
|
|
102
|
+
* task — so the stack updates itself here rather than waiting for the event. The close listener
|
|
103
|
+
* is left to handle the other direction: a sheet dismissed by Escape or its own button.
|
|
104
|
+
* @returns {Sheet|null} The sheet that was closed, or null on an empty stack.
|
|
105
|
+
* @fires SheetStack#pop
|
|
106
|
+
*/
|
|
107
|
+
pop(): Sheet | null;
|
|
108
|
+
/**
|
|
109
|
+
* Closes everything above a sheet, leaving it on top.
|
|
110
|
+
* @param {Sheet} sheet Sheet to return to.
|
|
111
|
+
* @returns {this}
|
|
112
|
+
*/
|
|
113
|
+
popTo(sheet: Sheet): this;
|
|
114
|
+
/**
|
|
115
|
+
* Closes every sheet, from the top down.
|
|
116
|
+
* @returns {this}
|
|
117
|
+
*/
|
|
118
|
+
clear(): this;
|
|
119
|
+
/**
|
|
120
|
+
* The sheet currently on top.
|
|
121
|
+
* @returns {Sheet|null}
|
|
122
|
+
*/
|
|
123
|
+
top(): Sheet | null;
|
|
124
|
+
/**
|
|
125
|
+
* How many sheets the stack holds.
|
|
126
|
+
* @returns {number}
|
|
127
|
+
*/
|
|
128
|
+
size(): number;
|
|
129
|
+
/**
|
|
130
|
+
* The sheets, bottom first.
|
|
131
|
+
* @returns {Sheet[]}
|
|
132
|
+
*/
|
|
133
|
+
sheets(): Sheet[];
|
|
134
|
+
/**
|
|
135
|
+
* Whether a sheet is in this stack.
|
|
136
|
+
* @param {Sheet} sheet Sheet to look for.
|
|
137
|
+
* @returns {boolean}
|
|
138
|
+
*/
|
|
139
|
+
has(sheet: Sheet): boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Subscribes to a stack event.
|
|
142
|
+
* @param {string} type Event name.
|
|
143
|
+
* @param {(event: any) => void} fn Listener.
|
|
144
|
+
* @returns {this}
|
|
145
|
+
*/
|
|
146
|
+
on(type: string, fn: (event: any) => void): this;
|
|
147
|
+
/**
|
|
148
|
+
* Removes a stack event listener.
|
|
149
|
+
* @param {string} type Event name.
|
|
150
|
+
* @param {(event: any) => void} fn Listener.
|
|
151
|
+
* @returns {this}
|
|
152
|
+
*/
|
|
153
|
+
off(type: string, fn: (event: any) => void): this;
|
|
154
|
+
/**
|
|
155
|
+
* Subscribes to one occurrence of a stack event.
|
|
156
|
+
* @param {string} type Event name.
|
|
157
|
+
* @param {(event: any) => void} fn Listener.
|
|
158
|
+
* @returns {this}
|
|
159
|
+
*/
|
|
160
|
+
once(type: string, fn: (event: any) => void): this;
|
|
161
|
+
/**
|
|
162
|
+
* Empties the stack without closing anything. The sheets are not the stack's to destroy, so
|
|
163
|
+
* they are simply released with their depth styling removed.
|
|
164
|
+
* @returns {void}
|
|
165
|
+
*/
|
|
166
|
+
destroy(): void;
|
|
167
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { Dialog } from '../dialog/dialog.js';
|
|
2
|
+
export type SheetSide = 'start' | 'end' | 'top' | 'bottom';
|
|
3
|
+
export type SheetModality = true | 'trap-focus' | false;
|
|
4
|
+
export type SheetBackdrop = 'dim' | 'blur' | 'none';
|
|
5
|
+
export type SheetOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* Edge the sheet is anchored to. Logical, so `start` and `end`
|
|
8
|
+
* follow the writing direction.
|
|
9
|
+
*/
|
|
10
|
+
side?: SheetSide;
|
|
11
|
+
/**
|
|
12
|
+
* `true` traps focus, locks page scroll, and blocks pointer
|
|
13
|
+
* interaction behind a backdrop; `'trap-focus'` traps focus only; `false` leaves the page fully
|
|
14
|
+
* interactive. Only `true` renders a backdrop — that is what makes the other two non-modal.
|
|
15
|
+
*/
|
|
16
|
+
modal?: SheetModality;
|
|
17
|
+
/**
|
|
18
|
+
* Backdrop treatment, applied only when `modal` is
|
|
19
|
+
* `true`. `'blur'` reads `--zx-overlay-blur`.
|
|
20
|
+
*/
|
|
21
|
+
backdrop?: SheetBackdrop;
|
|
22
|
+
/**
|
|
23
|
+
* Size along the sheet's own axis — width for
|
|
24
|
+
* `start`/`end`, height for `top`/`bottom`. A number is pixels, a string is any CSS length. Null
|
|
25
|
+
* keeps the per-side default.
|
|
26
|
+
*/
|
|
27
|
+
size?: string | number | null;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the header shows its close control. Independent of
|
|
30
|
+
* `closable`, so a sheet can offer Escape without an ✕, or the reverse.
|
|
31
|
+
*/
|
|
32
|
+
closeButton?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether the inner edge may be dragged to resize the sheet.
|
|
35
|
+
*/
|
|
36
|
+
resizable?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Smallest the sheet may be dragged to, in pixels.
|
|
39
|
+
*/
|
|
40
|
+
min?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Largest it may be dragged to; null means the viewport.
|
|
43
|
+
*/
|
|
44
|
+
max?: number | null;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to show a grab handle on the inner edge.
|
|
47
|
+
* `'auto'` shows one for `top` and `bottom` sheets, which is what makes them read as drawers.
|
|
48
|
+
*/
|
|
49
|
+
handle?: boolean | 'auto';
|
|
50
|
+
/**
|
|
51
|
+
* Detents the sheet settles on. A number at or
|
|
52
|
+
* below 1 is a fraction of the viewport along the sheet's axis, anything larger is pixels, and a
|
|
53
|
+
* string is any CSS length `resolveSize` understands (`'320px'`, `'90%'`).
|
|
54
|
+
*/
|
|
55
|
+
snap?: Array<number | string> | null;
|
|
56
|
+
/**
|
|
57
|
+
* Header title.
|
|
58
|
+
*/
|
|
59
|
+
title?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Body content.
|
|
62
|
+
*/
|
|
63
|
+
content?: Node | string | number | {
|
|
64
|
+
toElement: () => Node | null;
|
|
65
|
+
} | null;
|
|
66
|
+
/**
|
|
67
|
+
* Footer buttons.
|
|
68
|
+
*/
|
|
69
|
+
buttons?: import('../dialog/dialog.js').DialogButton[];
|
|
70
|
+
/**
|
|
71
|
+
* Whether Escape may close the sheet.
|
|
72
|
+
*/
|
|
73
|
+
closable?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether a click outside closes the sheet — the backdrop
|
|
76
|
+
* when modal, a document-level pointer press when not.
|
|
77
|
+
*/
|
|
78
|
+
lightDismiss?: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether to destroy the sheet after it closes.
|
|
81
|
+
*/
|
|
82
|
+
destroyOnClose?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Open event listener.
|
|
85
|
+
*/
|
|
86
|
+
onopen?: (event: CustomEvent<Record<string, never>>) => void;
|
|
87
|
+
/**
|
|
88
|
+
* Close event listener.
|
|
89
|
+
*/
|
|
90
|
+
onclose?: (event: CustomEvent<{
|
|
91
|
+
result: unknown;
|
|
92
|
+
}>) => void;
|
|
93
|
+
/**
|
|
94
|
+
* Cancel event listener.
|
|
95
|
+
*/
|
|
96
|
+
oncancel?: (event: CustomEvent<Record<string, never>>) => void;
|
|
97
|
+
/**
|
|
98
|
+
* Resize listener.
|
|
99
|
+
*/
|
|
100
|
+
onresize?: (event: CustomEvent<{
|
|
101
|
+
size: number;
|
|
102
|
+
ratio: number;
|
|
103
|
+
}>) => void;
|
|
104
|
+
/**
|
|
105
|
+
* Dock-state listener.
|
|
106
|
+
*/
|
|
107
|
+
ondockchange?: (event: CustomEvent<{
|
|
108
|
+
docked: boolean;
|
|
109
|
+
dock: import('../dock/dock.js').Dock | null;
|
|
110
|
+
}>) => void;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* @typedef {Object} SheetOptions
|
|
114
|
+
* @property {SheetSide} [side='end'] Edge the sheet is anchored to. Logical, so `start` and `end`
|
|
115
|
+
* follow the writing direction.
|
|
116
|
+
* @property {SheetModality} [modal=true] `true` traps focus, locks page scroll, and blocks pointer
|
|
117
|
+
* interaction behind a backdrop; `'trap-focus'` traps focus only; `false` leaves the page fully
|
|
118
|
+
* interactive. Only `true` renders a backdrop — that is what makes the other two non-modal.
|
|
119
|
+
* @property {SheetBackdrop} [backdrop='dim'] Backdrop treatment, applied only when `modal` is
|
|
120
|
+
* `true`. `'blur'` reads `--zx-overlay-blur`.
|
|
121
|
+
* @property {string|number|null} [size=null] Size along the sheet's own axis — width for
|
|
122
|
+
* `start`/`end`, height for `top`/`bottom`. A number is pixels, a string is any CSS length. Null
|
|
123
|
+
* keeps the per-side default.
|
|
124
|
+
* @property {boolean} [closeButton=true] Whether the header shows its close control. Independent of
|
|
125
|
+
* `closable`, so a sheet can offer Escape without an ✕, or the reverse.
|
|
126
|
+
* @property {boolean} [resizable=false] Whether the inner edge may be dragged to resize the sheet.
|
|
127
|
+
* @property {number} [min=160] Smallest the sheet may be dragged to, in pixels.
|
|
128
|
+
* @property {number|null} [max=null] Largest it may be dragged to; null means the viewport.
|
|
129
|
+
* @property {boolean|'auto'} [handle='auto'] Whether to show a grab handle on the inner edge.
|
|
130
|
+
* `'auto'` shows one for `top` and `bottom` sheets, which is what makes them read as drawers.
|
|
131
|
+
* @property {Array<number|string>|null} [snap=null] Detents the sheet settles on. A number at or
|
|
132
|
+
* below 1 is a fraction of the viewport along the sheet's axis, anything larger is pixels, and a
|
|
133
|
+
* string is any CSS length `resolveSize` understands (`'320px'`, `'90%'`).
|
|
134
|
+
* @property {string} [title=''] Header title.
|
|
135
|
+
* @property {Node|string|number|{toElement: () => Node|null}|null} [content=null] Body content.
|
|
136
|
+
* @property {import('../dialog/dialog.js').DialogButton[]} [buttons=[]] Footer buttons.
|
|
137
|
+
* @property {boolean} [closable=true] Whether Escape may close the sheet.
|
|
138
|
+
* @property {boolean} [lightDismiss=true] Whether a click outside closes the sheet — the backdrop
|
|
139
|
+
* when modal, a document-level pointer press when not.
|
|
140
|
+
* @property {boolean} [destroyOnClose=false] Whether to destroy the sheet after it closes.
|
|
141
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
|
|
142
|
+
* @property {(event: CustomEvent<{result: unknown}>) => void} [onclose] Close event listener.
|
|
143
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [oncancel] Cancel event listener.
|
|
144
|
+
* @property {(event: CustomEvent<{size: number, ratio: number}>) => void} [onresize] Resize listener.
|
|
145
|
+
* @property {(event: CustomEvent<{docked: boolean, dock: import('../dock/dock.js').Dock|null}>) => void} [ondockchange] Dock-state listener.
|
|
146
|
+
*/
|
|
147
|
+
/**
|
|
148
|
+
* Edge-anchored surface: a Dialog that attaches to one side of the viewport instead of floating in
|
|
149
|
+
* the middle. One primitive covers both side sheets and mobile drawers; only the edge differs.
|
|
150
|
+
*
|
|
151
|
+
* Extends `Dialog` rather than reimplementing it, so the header, footer buttons, switchable views,
|
|
152
|
+
* and focus restoration all come from the same structured-dialog foundation.
|
|
153
|
+
*
|
|
154
|
+
* Modality is a three-way choice rather than a boolean because the three real behaviours do not
|
|
155
|
+
* collapse into two: a modal sheet delegates focus containment, page inertness, and Escape to the
|
|
156
|
+
* browser via `showModal()`; the other two open with `show()` and re-implement only what they still
|
|
157
|
+
* want. That is also why `backdrop` applies only to `modal: true` — `::backdrop` does not render
|
|
158
|
+
* for a non-modal dialog, and painting a fake one would make a sheet look blocking while it is not.
|
|
159
|
+
* @fires Sheet#open
|
|
160
|
+
* @fires Sheet#close
|
|
161
|
+
* @fires Sheet#cancel
|
|
162
|
+
* @fires Sheet#resize
|
|
163
|
+
* @fires Sheet#dockchange
|
|
164
|
+
*/
|
|
165
|
+
export declare class Sheet extends Dialog {
|
|
166
|
+
#private;
|
|
167
|
+
_dock: any;
|
|
168
|
+
_handoff: boolean;
|
|
169
|
+
static cssName: string;
|
|
170
|
+
/** @type {Readonly<SheetOptions>} */
|
|
171
|
+
static defaults: Readonly<SheetOptions>;
|
|
172
|
+
/**
|
|
173
|
+
* Creates an edge-anchored sheet.
|
|
174
|
+
* @param {Element|string|null} [_target=null] Ignored; Sheet always owns its root.
|
|
175
|
+
* @param {SheetOptions} [options={}] Sheet options.
|
|
176
|
+
*/
|
|
177
|
+
constructor(_target?: Element | string | null, options?: SheetOptions);
|
|
178
|
+
/**
|
|
179
|
+
* Moves to one of the configured detents.
|
|
180
|
+
* @param {number|string} target Detent index, or one of the `snap` values.
|
|
181
|
+
* @returns {this}
|
|
182
|
+
* @fires Sheet#resize
|
|
183
|
+
*/
|
|
184
|
+
snapTo(target: number | string): this;
|
|
185
|
+
/**
|
|
186
|
+
* Returns the sheet's current size along its own axis, in pixels.
|
|
187
|
+
* @returns {number}
|
|
188
|
+
*/
|
|
189
|
+
getSize(): number;
|
|
190
|
+
/**
|
|
191
|
+
* Resolves a translated string, falling back to English when no translator knows the key.
|
|
192
|
+
* @param {string} key Message key.
|
|
193
|
+
* @param {string} fallback English default.
|
|
194
|
+
* @returns {string}
|
|
195
|
+
*/
|
|
196
|
+
_message(key: string, fallback: string): string;
|
|
197
|
+
/**
|
|
198
|
+
* Where the dialog lives: the owning dock while adopted, the document otherwise.
|
|
199
|
+
* @returns {Element}
|
|
200
|
+
*/
|
|
201
|
+
mountTarget(): Element;
|
|
202
|
+
/**
|
|
203
|
+
* Reports whether a dock currently owns this sheet's positioning.
|
|
204
|
+
* @returns {boolean}
|
|
205
|
+
*/
|
|
206
|
+
isDocked(): boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Hands positioning to a dock, or takes it back. Called by `Dock.adopt()` and `Dock.release()`;
|
|
209
|
+
* applications go through those rather than here.
|
|
210
|
+
* @param {{el: Element}|null} dock Owning dock, or null to float again.
|
|
211
|
+
* @returns {void}
|
|
212
|
+
* @fires Sheet#dockchange
|
|
213
|
+
*/
|
|
214
|
+
_setDock(dock: {
|
|
215
|
+
el: Element;
|
|
216
|
+
} | null): void;
|
|
217
|
+
/**
|
|
218
|
+
* Moves the dialog to its current mount and, when it was open, reopens it there.
|
|
219
|
+
*
|
|
220
|
+
* The close is unavoidable — a dialog cannot cross between the top layer and the flow while
|
|
221
|
+
* open — but it is invisible: `_isRealClose()` drops the stale event, and reopening bypasses
|
|
222
|
+
* `open()` so no lifecycle event is emitted for what is only a change of address.
|
|
223
|
+
* @returns {void}
|
|
224
|
+
*/
|
|
225
|
+
_rehost(): void;
|
|
226
|
+
/**
|
|
227
|
+
* Drops the stale `close` a re-hosting handoff leaves behind.
|
|
228
|
+
* @returns {boolean}
|
|
229
|
+
*/
|
|
230
|
+
_isRealClose(): boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Opens the sheet, trapping focus first where the modality asks for it.
|
|
233
|
+
* @returns {this}
|
|
234
|
+
* @fires Modal#open
|
|
235
|
+
*/
|
|
236
|
+
open(): this;
|
|
237
|
+
/**
|
|
238
|
+
* Closes the sheet with an optional result.
|
|
239
|
+
* @param {unknown} [result] Result included in the close event.
|
|
240
|
+
* @returns {this}
|
|
241
|
+
*/
|
|
242
|
+
close(result?: unknown): this;
|
|
243
|
+
/**
|
|
244
|
+
* Moves the sheet to another edge. Takes effect immediately, open or closed.
|
|
245
|
+
* @param {SheetSide} side Edge to anchor to.
|
|
246
|
+
* @returns {this}
|
|
247
|
+
*/
|
|
248
|
+
setSide(side: SheetSide): this;
|
|
249
|
+
/**
|
|
250
|
+
* Returns the edge the sheet is anchored to.
|
|
251
|
+
* @returns {SheetSide}
|
|
252
|
+
*/
|
|
253
|
+
getSide(): SheetSide;
|
|
254
|
+
/**
|
|
255
|
+
* Resizes the sheet along its own axis.
|
|
256
|
+
* @param {string|number|null} size CSS length, pixel number, or null for the per-side default.
|
|
257
|
+
* @returns {this}
|
|
258
|
+
*/
|
|
259
|
+
setSize(size: string | number | null): this;
|
|
260
|
+
/**
|
|
261
|
+
* Reports whether focus containment is active.
|
|
262
|
+
* @returns {boolean}
|
|
263
|
+
*/
|
|
264
|
+
isModal(): boolean;
|
|
265
|
+
/**
|
|
266
|
+
* Sizes the sheet along whichever axis its side implies, by custom property rather than a fixed
|
|
267
|
+
* dimension so the per-side CSS default survives a null.
|
|
268
|
+
*
|
|
269
|
+
* Runs from `Dialog`'s constructor, before this class's field initializers — DOM only.
|
|
270
|
+
* @param {string|number|null} size CSS length, pixel number, or null.
|
|
271
|
+
* @returns {void}
|
|
272
|
+
*/
|
|
273
|
+
_applySize(size: string | number | null): void;
|
|
274
|
+
/**
|
|
275
|
+
* Opens the sheet modally or not, as `modal` asks.
|
|
276
|
+
* @returns {void}
|
|
277
|
+
*/
|
|
278
|
+
_show(): void;
|
|
279
|
+
/**
|
|
280
|
+
* Releases the focus trap and the owned dialog.
|
|
281
|
+
* @returns {void}
|
|
282
|
+
*/
|
|
283
|
+
destroy(): void;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Sheet resize event.
|
|
287
|
+
* @event Sheet#resize
|
|
288
|
+
* @type {CustomEvent<{size: number, ratio: number}>}
|
|
289
|
+
*/
|
|
290
|
+
/**
|
|
291
|
+
* Sheet dock-state event.
|
|
292
|
+
* @event Sheet#dockchange
|
|
293
|
+
* @type {CustomEvent<{docked: boolean, dock: import('../dock/dock.js').Dock|null}>}
|
|
294
|
+
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
|
+
export { resolveSize } from '../../core/drag-axis.js';
|
|
2
3
|
export type SplitViewContent = string | Node | Component | null;
|
|
3
4
|
export type SplitViewOptions = {
|
|
4
5
|
/**
|
|
@@ -126,6 +127,7 @@ export type SplitViewOptions = {
|
|
|
126
127
|
*/
|
|
127
128
|
export declare class SplitView extends Component<SplitViewOptions> {
|
|
128
129
|
#private;
|
|
130
|
+
_startSize: number;
|
|
129
131
|
_orientation: string;
|
|
130
132
|
/** Current start size in pixels, or null while the CSS value in the property is in charge. */
|
|
131
133
|
_size: number;
|
|
@@ -133,16 +135,6 @@ export declare class SplitView extends Component<SplitViewOptions> {
|
|
|
133
135
|
_collapsed: 'start' | 'end' | null;
|
|
134
136
|
_disabled: boolean;
|
|
135
137
|
_destroyed: boolean;
|
|
136
|
-
_dragging: boolean;
|
|
137
|
-
/** Handle of the frame a pending drag update is scheduled in; `0` if none. */
|
|
138
|
-
_frame: number;
|
|
139
|
-
/** @type {number|null} */
|
|
140
|
-
_pointerId: number | null;
|
|
141
|
-
_startClient: number;
|
|
142
|
-
_startSize: number;
|
|
143
|
-
_pointerClient: number;
|
|
144
|
-
/** Whether the pointer left its starting position, which separates a drag from a click. */
|
|
145
|
-
_moved: boolean;
|
|
146
138
|
/** Container size of the last observer pass; `-1` forces the next one to run. */
|
|
147
139
|
_lastTotal: any;
|
|
148
140
|
_createdRoot: boolean;
|
|
@@ -312,17 +304,6 @@ export type ClampSizeInput = {
|
|
|
312
304
|
* @returns {number} A size in pixels, never negative.
|
|
313
305
|
*/
|
|
314
306
|
export declare function clampSize({ size, min, max, total, divider }: ClampSizeInput): number;
|
|
315
|
-
/**
|
|
316
|
-
* Resolves a size option to pixels without touching the DOM.
|
|
317
|
-
*
|
|
318
|
-
* Numbers, bare numeric strings, and `px` lengths are pixels; a percentage resolves against
|
|
319
|
-
* `total`. Every other CSS length — `rem`, `vh`, `calc()` — needs the browser, so it returns `NaN`
|
|
320
|
-
* and the caller hands the value to CSS instead of guessing at it.
|
|
321
|
-
* @param {number|string} value Size option.
|
|
322
|
-
* @param {number} total Container size along the split axis, in pixels.
|
|
323
|
-
* @returns {number} Pixels, or `NaN` when only the browser can resolve the value.
|
|
324
|
-
*/
|
|
325
|
-
export declare function resolveSize(value: number | string, total: number): number;
|
|
326
307
|
/**
|
|
327
308
|
* Pulls a size onto the nearest target within a radius, leaving it alone when nothing is close.
|
|
328
309
|
* The radius is inclusive, ties go to the target listed first, and a radius of zero or less turns
|