@zeyos/zx 4.4.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +447 -0
- package/README.md +44 -11
- package/dist/types/components/account-menu/account-menu.d.ts +8 -0
- package/dist/types/components/activity-list/activity-list.d.ts +31 -1
- package/dist/types/components/app-icon/app-icon.d.ts +14 -2
- package/dist/types/components/app-sidebar/app-sidebar.d.ts +293 -17
- package/dist/types/components/avatar/avatar.d.ts +46 -7
- package/dist/types/components/badge/badge.d.ts +21 -1
- package/dist/types/components/button/button.d.ts +15 -0
- package/dist/types/components/calendar/calendar.d.ts +67 -5
- package/dist/types/components/card-view/card-view.d.ts +7 -4
- package/dist/types/components/card-view/record-card.d.ts +11 -0
- package/dist/types/components/chart/chart.d.ts +10 -0
- package/dist/types/components/checklist/checklist.d.ts +9 -0
- package/dist/types/components/code-editor/code-editor.d.ts +6 -17
- package/dist/types/components/context-menu/context-menu.d.ts +6 -2
- package/dist/types/components/data-filter/data-filter.d.ts +4 -4
- package/dist/types/components/datebox/date-range-box.d.ts +5 -1
- package/dist/types/components/datebox/datebox.d.ts +7 -2
- package/dist/types/components/dialog/dialog.d.ts +46 -6
- package/dist/types/components/dropdown/dropdown.d.ts +24 -9
- package/dist/types/components/entity-ref/entity-ref.d.ts +2 -2
- package/dist/types/components/field/field.d.ts +54 -2
- package/dist/types/components/fieldset/external-adapter.d.ts +83 -0
- package/dist/types/components/fieldset/fieldset.d.ts +26 -1
- package/dist/types/components/file-item/file-item.d.ts +34 -6
- package/dist/types/components/file-list/file-list.d.ts +35 -3
- package/dist/types/components/filter/filter.d.ts +127 -3
- package/dist/types/components/filter-panel/filter-panel.d.ts +36 -7
- package/dist/types/components/form/form.d.ts +12 -1
- package/dist/types/components/kanban-view/kanban-card.d.ts +8 -0
- package/dist/types/components/launcher/launcher.d.ts +268 -15
- package/dist/types/components/list-toolbar/list-toolbar.d.ts +16 -7
- package/dist/types/components/menu-button/menu-button.d.ts +39 -5
- package/dist/types/components/message/message.d.ts +132 -17
- package/dist/types/components/modal/modal.d.ts +43 -2
- package/dist/types/components/module-bar/module-bar.d.ts +395 -0
- package/dist/types/components/pagination/pagination.d.ts +17 -3
- package/dist/types/components/select/color.d.ts +12 -0
- package/dist/types/components/select/glyphs.d.ts +124 -0
- package/dist/types/components/select/select.d.ts +17 -3
- package/dist/types/components/sheet/sheet.d.ts +15 -0
- package/dist/types/components/stat-tile/stat-tile.d.ts +16 -5
- package/dist/types/components/tabbox/tabbox.d.ts +9 -0
- package/dist/types/components/table/table.d.ts +311 -18
- package/dist/types/components/tag-picker/tag-picker.d.ts +21 -4
- package/dist/types/components/tree/tree.d.ts +13 -0
- package/dist/types/components/view/record-view.d.ts +59 -2
- package/dist/types/components/view-settings/view-settings.d.ts +879 -0
- package/dist/types/components/workspace-switcher/workspace-switcher.d.ts +327 -0
- package/dist/types/core/breakpoint.d.ts +1 -1
- package/dist/types/core/component.d.ts +12 -2
- package/dist/types/core/i18n.d.ts +27 -3
- package/dist/types/core/icons.d.ts +23 -25
- package/dist/types/core/keyboard.d.ts +98 -1
- package/dist/types/core/messages.d.ts +382 -0
- package/dist/types/core/motion.d.ts +59 -0
- package/dist/types/core/overlay-host.d.ts +42 -1
- package/dist/types/core/overlay-stack.d.ts +260 -0
- package/dist/types/index.d.ts +10 -5
- package/dist/types/internal/app-rail.d.ts +38 -0
- package/dist/types/internal/menu-items.d.ts +71 -3
- package/dist/types/zeyos/connect.d.ts +6 -0
- package/dist/types/zeyos/form.d.ts +50 -9
- package/dist/types/zeyos/index.d.ts +2 -1
- package/dist/types/zeyos/launcher.d.ts +9 -0
- package/dist/types/zeyos/module-bar.d.ts +176 -0
- package/dist/types/zeyos/query.d.ts +110 -5
- package/dist/types/zeyos/schema.d.ts +24 -1
- package/dist/types/zeyos/table.d.ts +345 -22
- package/dist/types/zeyos/view.d.ts +26 -2
- package/dist/zx-zeyos.esm.js +6178 -1008
- package/dist/zx-zeyos.esm.min.js +53 -5
- package/dist/zx.css +2861 -827
- package/dist/zx.esm.js +8909 -1480
- package/dist/zx.esm.min.js +55 -7
- package/dist/zx.global.js +8911 -1482
- package/dist/zx.global.min.js +55 -7
- package/dist/zx.min.css +1 -1
- package/docs/api.json +1079 -117
- package/docs/llms.md +956 -154
- package/docs/llms.txt +9 -5
- package/package.json +1 -1
- package/src/components/account-menu/account-menu.css +35 -10
- package/src/components/account-menu/account-menu.js +12 -0
- package/src/components/activity-item/activity-item.css +1 -1
- package/src/components/activity-item/activity-item.js +3 -0
- package/src/components/activity-list/activity-list.css +38 -3
- package/src/components/activity-list/activity-list.js +61 -1
- package/src/components/app-icon/app-icon.css +14 -3
- package/src/components/app-icon/app-icon.js +11 -1
- package/src/components/app-rail/app-rail.css +59 -79
- package/src/components/app-sidebar/app-sidebar.css +304 -168
- package/src/components/app-sidebar/app-sidebar.js +667 -46
- package/src/components/aurora/aurora.css +5 -3
- package/src/components/avatar/avatar.css +32 -7
- package/src/components/avatar/avatar.js +72 -8
- package/src/components/badge/badge.css +54 -2
- package/src/components/badge/badge.js +29 -2
- package/src/components/breadcrumb/breadcrumb.css +1 -1
- package/src/components/button/button.css +67 -9
- package/src/components/button/button.js +38 -0
- package/src/components/calendar/calendar.css +47 -47
- package/src/components/calendar/calendar.js +26 -52
- package/src/components/card/card.css +4 -4
- package/src/components/card-view/card-view.css +14 -12
- package/src/components/card-view/card-view.js +13 -9
- package/src/components/card-view/record-card.js +14 -3
- package/src/components/chart/chart.css +4 -1
- package/src/components/chart/chart.js +12 -0
- package/src/components/check-button/check-button.css +10 -2
- package/src/components/checklist/checklist.css +9 -2
- package/src/components/checklist/checklist.js +11 -5
- package/src/components/checklist/field-adapter.js +3 -1
- package/src/components/code-editor/code-editor.css +7 -6
- package/src/components/code-editor/code-editor.js +19 -1
- package/src/components/code-editor/field-adapter.js +9 -2
- package/src/components/context-menu/context-menu.css +9 -4
- package/src/components/context-menu/context-menu.js +8 -2
- package/src/components/copy/copy-button.css +6 -0
- package/src/components/copy/copy-input.css +9 -4
- package/src/components/data-filter/data-filter.css +5 -4
- package/src/components/data-filter/data-filter.js +2 -2
- package/src/components/date-picker/date-picker.css +6 -6
- package/src/components/date-picker/date-range-picker.css +3 -3
- package/src/components/date-picker/time-picker.css +3 -3
- package/src/components/datebox/date-range-box.css +79 -2
- package/src/components/datebox/date-range-box.js +13 -2
- package/src/components/datebox/datebox.css +79 -2
- package/src/components/datebox/datebox.js +13 -2
- package/src/components/dialog/dialog.css +26 -0
- package/src/components/dialog/dialog.js +99 -17
- package/src/components/dock/dock.css +5 -4
- package/src/components/dropdown/dropdown.css +1 -1
- package/src/components/dropdown/dropdown.js +159 -72
- package/src/components/empty-state/empty-state.css +2 -2
- package/src/components/entity-ref/entity-ref.css +1 -1
- package/src/components/entity-ref/entity-ref.js +1 -1
- package/src/components/field/field.css +28 -9
- package/src/components/field/field.js +101 -29
- package/src/components/field-upload/field-upload.css +1 -1
- package/src/components/fieldset/external-adapter.js +363 -0
- package/src/components/fieldset/fieldset.css +5 -3
- package/src/components/fieldset/fieldset.js +38 -64
- package/src/components/file-item/file-item.js +144 -10
- package/src/components/file-list/file-list.js +144 -21
- package/src/components/filter/filter.css +86 -2
- package/src/components/filter/filter.js +307 -11
- package/src/components/filter-panel/filter-panel.css +1 -1
- package/src/components/filter-panel/filter-panel.js +149 -32
- package/src/components/finder/finder.css +16 -14
- package/src/components/form/form.css +5 -4
- package/src/components/form/form.js +11 -2
- package/src/components/grid/grid.css +1 -1
- package/src/components/groupbox/groupbox.css +1 -1
- package/src/components/kanban-view/kanban-card.js +11 -3
- package/src/components/kanban-view/kanban-view.css +42 -18
- package/src/components/kanban-view/kanban-view.js +9 -6
- package/src/components/launcher/launcher.css +108 -26
- package/src/components/launcher/launcher.js +530 -42
- package/src/components/list-toolbar/list-toolbar.css +13 -8
- package/src/components/list-toolbar/list-toolbar.js +40 -14
- package/src/components/master-panel/master-panel.css +2 -0
- package/src/components/master-panel/master-panel.js +0 -1
- package/src/components/menu-button/menu-button.css +72 -4
- package/src/components/menu-button/menu-button.js +160 -18
- package/src/components/message/message.css +33 -3
- package/src/components/message/message.js +264 -22
- package/src/components/modal/modal.css +1 -1
- package/src/components/modal/modal.js +83 -15
- package/src/components/module-bar/module-bar.css +486 -0
- package/src/components/module-bar/module-bar.js +1074 -0
- package/src/components/multi-value-editor/multi-value-editor.css +1 -1
- package/src/components/navigation-bar/navigation-bar.css +18 -9
- package/src/components/number-field/field-adapter.js +3 -1
- package/src/components/number-field/number-field.css +70 -0
- package/src/components/number-field/number-field.js +2 -0
- package/src/components/pagination/pagination.css +13 -11
- package/src/components/pagination/pagination.js +20 -4
- package/src/components/panel/panel.css +4 -3
- package/src/components/questionnaire/questionnaire.css +4 -4
- package/src/components/rating/field-adapter.js +2 -1
- package/src/components/rating/rating.css +8 -1
- package/src/components/search/search.css +4 -1
- package/src/components/select/color.js +22 -0
- package/src/components/select/field-adapter.js +2 -0
- package/src/components/select/glyphs.js +165 -0
- package/src/components/select/select.css +138 -45
- package/src/components/select/select.js +92 -47
- package/src/components/sheet/sheet.css +12 -9
- package/src/components/sheet/sheet.js +74 -32
- package/src/components/slider/field-adapter.js +6 -1
- package/src/components/slider/slider.css +18 -4
- package/src/components/slider/slider.js +1 -1
- package/src/components/sort-control/sort-control.css +4 -1
- package/src/components/split-view/split-view.css +1 -1
- package/src/components/stat-tile/stat-tile.css +42 -47
- package/src/components/stat-tile/stat-tile.js +17 -6
- package/src/components/stepper/stepper.css +1 -1
- package/src/components/tabbox/tabbox.css +41 -32
- package/src/components/tabbox/tabbox.js +5 -1
- package/src/components/table/table.css +187 -37
- package/src/components/table/table.js +718 -73
- package/src/components/tag-picker/field-adapter.js +2 -1
- package/src/components/tag-picker/tag-picker.css +83 -5
- package/src/components/tag-picker/tag-picker.js +25 -8
- package/src/components/timebox/timebox.css +22 -2
- package/src/components/toggle/toggle.css +12 -1
- package/src/components/toolbar/toolbar.js +2 -2
- package/src/components/tooltip/tooltip.css +4 -0
- package/src/components/tooltip/tooltip.js +44 -19
- package/src/components/tree/tree.css +26 -17
- package/src/components/tree/tree.js +31 -0
- package/src/components/value-list/value-list.css +3 -3
- package/src/components/view/record-view.css +1 -1
- package/src/components/view/record-view.js +178 -18
- package/src/components/view-settings/view-settings.css +285 -0
- package/src/components/view-settings/view-settings.js +1830 -0
- package/src/components/workspace-switcher/workspace-switcher.css +188 -0
- package/src/components/workspace-switcher/workspace-switcher.js +463 -0
- package/src/core/breakpoint.js +1 -1
- package/src/core/component.js +88 -17
- package/src/core/fontawesome.js +5 -1
- package/src/core/i18n.js +47 -4
- package/src/core/icons.js +204 -61
- package/src/core/keyboard.js +206 -11
- package/src/core/messages.js +427 -0
- package/src/core/motion.js +147 -0
- package/src/core/overlay-host.js +77 -3
- package/src/core/overlay-stack.js +487 -0
- package/src/core/position.js +22 -3
- package/src/index.js +10 -5
- package/src/internal/app-rail.js +135 -55
- package/src/internal/menu-items.js +61 -3
- package/src/zeyos/connect.js +6 -2
- package/src/zeyos/form.js +69 -27
- package/src/zeyos/index.js +4 -1
- package/src/zeyos/launcher.js +8 -3
- package/src/zeyos/module-bar.js +181 -0
- package/src/zeyos/query.js +197 -13
- package/src/zeyos/schema.js +144 -27
- package/src/zeyos/table.js +287 -84
- package/src/zeyos/view.js +49 -93
- package/styles/base.css +72 -1
- package/styles/icons.css +11 -1
- package/styles/print.css +1 -1
- package/styles/tokens/dark.css +117 -37
- package/styles/tokens/global.css +121 -27
- package/styles/tokens/semantic.css +140 -43
- package/styles/tokens/themes.css +7 -6
- package/styles/zx.css +3 -1
- package/styles/tokens/density.css +0 -9
|
@@ -38,6 +38,14 @@ export type MenuButtonOptions = {
|
|
|
38
38
|
*/
|
|
39
39
|
onclose?: (event: CustomEvent<Record<string, never>>) => void;
|
|
40
40
|
};
|
|
41
|
+
export type MenuButtonOpenOptions = {
|
|
42
|
+
/**
|
|
43
|
+
* Where focus goes when this opening ends with a
|
|
44
|
+
* selection or Escape: `true` is the trigger, an element is that element (the trigger again if
|
|
45
|
+
* it has left the document), and `false` leaves focus alone.
|
|
46
|
+
*/
|
|
47
|
+
returnFocus?: boolean | HTMLElement;
|
|
48
|
+
};
|
|
41
49
|
/** @typedef {import('../../internal/menu-items.js').MenuItem} MenuItem */
|
|
42
50
|
/** @typedef {import('../../internal/menu-items.js').MenuEntry} MenuButtonItem */
|
|
43
51
|
/**
|
|
@@ -51,8 +59,18 @@ export type MenuButtonOptions = {
|
|
|
51
59
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
|
|
52
60
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close event listener.
|
|
53
61
|
*/
|
|
62
|
+
/**
|
|
63
|
+
* @typedef {Object} MenuButtonOpenOptions
|
|
64
|
+
* @property {boolean|HTMLElement} [returnFocus=true] Where focus goes when this opening ends with a
|
|
65
|
+
* selection or Escape: `true` is the trigger, an element is that element (the trigger again if
|
|
66
|
+
* it has left the document), and `false` leaves focus alone.
|
|
67
|
+
*/
|
|
54
68
|
/**
|
|
55
69
|
* APG menu-button trigger backed by an anchored Dropdown.
|
|
70
|
+
*
|
|
71
|
+
* Choosing an item closes the menu and puts focus back on the trigger before the `select` event
|
|
72
|
+
* and the item's `onselect` run, so whatever they open — a dialog, a sheet — records the trigger
|
|
73
|
+
* as the place to return to, and focus they move themselves stays where they put it.
|
|
56
74
|
* @fires MenuButton#select
|
|
57
75
|
* @fires MenuButton#open
|
|
58
76
|
* @fires MenuButton#close
|
|
@@ -82,14 +100,22 @@ export declare class MenuButton extends Component<MenuButtonOptions> {
|
|
|
82
100
|
setItems(items: MenuButtonItem[]): this;
|
|
83
101
|
/**
|
|
84
102
|
* Opens the menu.
|
|
103
|
+
* @param {MenuButtonOpenOptions} [options={}] Where focus returns when this opening ends; ignored
|
|
104
|
+
* while the menu is already open.
|
|
85
105
|
* @returns {this}
|
|
86
106
|
*/
|
|
87
|
-
open(): this;
|
|
107
|
+
open(options?: MenuButtonOpenOptions): this;
|
|
88
108
|
/**
|
|
89
109
|
* Closes the menu.
|
|
90
110
|
* @returns {this}
|
|
91
111
|
*/
|
|
92
112
|
close(): this;
|
|
113
|
+
/**
|
|
114
|
+
* Opens the menu when it is closed, and closes it when it is open. Opening this way moves no
|
|
115
|
+
* focus; `focusFirst()` opens with focus on the first item.
|
|
116
|
+
* @returns {this}
|
|
117
|
+
*/
|
|
118
|
+
toggle(): this;
|
|
93
119
|
/**
|
|
94
120
|
* Reports whether the menu is open.
|
|
95
121
|
* @returns {boolean}
|
|
@@ -99,10 +125,18 @@ export declare class MenuButton extends Component<MenuButtonOptions> {
|
|
|
99
125
|
getTrigger(): HTMLElement;
|
|
100
126
|
/** Returns the owned menu panel. @returns {HTMLElement} */
|
|
101
127
|
getPanel(): HTMLElement;
|
|
102
|
-
/**
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
128
|
+
/**
|
|
129
|
+
* Opens the menu and focuses its first enabled item.
|
|
130
|
+
* @param {MenuButtonOpenOptions} [options={}] Passed to `open()`.
|
|
131
|
+
* @returns {this}
|
|
132
|
+
*/
|
|
133
|
+
focusFirst(options?: MenuButtonOpenOptions): this;
|
|
134
|
+
/**
|
|
135
|
+
* Opens the menu and focuses its last enabled item.
|
|
136
|
+
* @param {MenuButtonOpenOptions} [options={}] Passed to `open()`.
|
|
137
|
+
* @returns {this}
|
|
138
|
+
*/
|
|
139
|
+
focusLast(options?: MenuButtonOpenOptions): this;
|
|
106
140
|
/**
|
|
107
141
|
* Sets the visible trigger label.
|
|
108
142
|
* @param {string} label Trigger label.
|
|
@@ -1,18 +1,48 @@
|
|
|
1
1
|
import { Component } from '../../core/component.js';
|
|
2
2
|
export type MessageKind = 'info' | 'success' | 'warning' | 'error';
|
|
3
|
+
export type MessageAction = {
|
|
4
|
+
/**
|
|
5
|
+
* Button text: a verb naming what happens ("Undo", "Approve", "Retry").
|
|
6
|
+
*/
|
|
7
|
+
label: string;
|
|
8
|
+
/**
|
|
9
|
+
* Runs when the button is activated, by pointer
|
|
10
|
+
* or keyboard; the message closes right after it.
|
|
11
|
+
*/
|
|
12
|
+
onclick?: (event: MouseEvent) => void;
|
|
13
|
+
/**
|
|
14
|
+
* Button kind; the default is the
|
|
15
|
+
* secondary button.
|
|
16
|
+
*/
|
|
17
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
18
|
+
};
|
|
3
19
|
export type MessageShowOptions = {
|
|
4
20
|
/**
|
|
5
21
|
* Message intent (`danger` aliases `error`).
|
|
6
22
|
*/
|
|
7
23
|
kind?: MessageKind | 'danger';
|
|
8
24
|
/**
|
|
9
|
-
* Auto-dismiss delay in milliseconds; zero persists.
|
|
25
|
+
* Auto-dismiss delay in milliseconds; zero persists. A message
|
|
26
|
+
* with an `action` stays at least 8000ms.
|
|
10
27
|
*/
|
|
11
28
|
timeout?: number;
|
|
12
29
|
/**
|
|
13
30
|
* Whether to render a close button.
|
|
14
31
|
*/
|
|
15
32
|
closable?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* A command button inside the message. The message
|
|
35
|
+
* never times out while the pointer is over it or focus is inside it.
|
|
36
|
+
*/
|
|
37
|
+
action?: MessageAction | null;
|
|
38
|
+
/**
|
|
39
|
+
* Visual shown in place of the
|
|
40
|
+
* kind icon, such as an Avatar's element. It is decorative — the message text must say what it
|
|
41
|
+
* shows.
|
|
42
|
+
*/
|
|
43
|
+
leading?: Node | {
|
|
44
|
+
toElement: () => Node | null;
|
|
45
|
+
} | null;
|
|
16
46
|
/**
|
|
17
47
|
* Element whose nearest Zx theme scope owns a floating toast.
|
|
18
48
|
*/
|
|
@@ -37,28 +67,32 @@ export type MessageOptions = {
|
|
|
37
67
|
maxVisible?: number;
|
|
38
68
|
};
|
|
39
69
|
export type MessageHandle = {
|
|
40
|
-
close: () => void;
|
|
41
|
-
};
|
|
42
|
-
export type ProgressHandle = {
|
|
43
70
|
/**
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
update: (pct: number, text?: string) => void;
|
|
47
|
-
/**
|
|
48
|
-
* Completes and dismisses the progress message.
|
|
49
|
-
*/
|
|
50
|
-
done: () => void;
|
|
51
|
-
/**
|
|
52
|
-
* Marks progress as failed and dismisses it later.
|
|
71
|
+
* Closes the message.
|
|
53
72
|
*/
|
|
54
|
-
|
|
73
|
+
close: () => void;
|
|
55
74
|
};
|
|
56
75
|
/** @typedef {'info'|'success'|'warning'|'error'} MessageKind */
|
|
76
|
+
/**
|
|
77
|
+
* The one command a message may carry, drawn as a small button beside its text.
|
|
78
|
+
* @typedef {Object} MessageAction
|
|
79
|
+
* @property {string} label Button text: a verb naming what happens ("Undo", "Approve", "Retry").
|
|
80
|
+
* @property {(event: MouseEvent) => void} [onclick] Runs when the button is activated, by pointer
|
|
81
|
+
* or keyboard; the message closes right after it.
|
|
82
|
+
* @property {'default'|'primary'|'danger'|'ghost'} [kind='default'] Button kind; the default is the
|
|
83
|
+
* secondary button.
|
|
84
|
+
*/
|
|
57
85
|
/**
|
|
58
86
|
* @typedef {Object} MessageShowOptions
|
|
59
87
|
* @property {MessageKind|'danger'} [kind='info'] Message intent (`danger` aliases `error`).
|
|
60
|
-
* @property {number} [timeout=4000] Auto-dismiss delay in milliseconds; zero persists.
|
|
88
|
+
* @property {number} [timeout=4000] Auto-dismiss delay in milliseconds; zero persists. A message
|
|
89
|
+
* with an `action` stays at least 8000ms.
|
|
61
90
|
* @property {boolean} [closable=true] Whether to render a close button.
|
|
91
|
+
* @property {MessageAction|null} [action=null] A command button inside the message. The message
|
|
92
|
+
* never times out while the pointer is over it or focus is inside it.
|
|
93
|
+
* @property {Node|{toElement: () => Node|null}|null} [leading=null] Visual shown in place of the
|
|
94
|
+
* kind icon, such as an Avatar's element. It is decorative — the message text must say what it
|
|
95
|
+
* shows.
|
|
62
96
|
* @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns a floating toast.
|
|
63
97
|
*/
|
|
64
98
|
/**
|
|
@@ -68,7 +102,28 @@ export type ProgressHandle = {
|
|
|
68
102
|
* @property {boolean} [closable=true] Default close-button visibility.
|
|
69
103
|
* @property {number} [maxVisible=5] Maximum number of visible messages.
|
|
70
104
|
*/
|
|
71
|
-
/**
|
|
105
|
+
/**
|
|
106
|
+
* Returned by every `show()`: closes that message early. Closing one that already closed, or one
|
|
107
|
+
* still waiting in the queue, is safe.
|
|
108
|
+
* @typedef {Object} MessageHandle
|
|
109
|
+
* @property {() => void} close Closes the message.
|
|
110
|
+
*/
|
|
111
|
+
/** The shortest time a message that carries an action stays, in milliseconds. */
|
|
112
|
+
export declare const MESSAGE_ACTION_MIN_TIMEOUT = 8000;
|
|
113
|
+
export type ProgressHandle = {
|
|
114
|
+
/**
|
|
115
|
+
* Updates progress and optional text.
|
|
116
|
+
*/
|
|
117
|
+
update: (pct: number, text?: string) => void;
|
|
118
|
+
/**
|
|
119
|
+
* Completes and dismisses the progress message.
|
|
120
|
+
*/
|
|
121
|
+
done: () => void;
|
|
122
|
+
/**
|
|
123
|
+
* Marks progress as failed and dismisses it later.
|
|
124
|
+
*/
|
|
125
|
+
fail: (text?: string) => void;
|
|
126
|
+
};
|
|
72
127
|
/**
|
|
73
128
|
* @typedef {Object} ProgressHandle
|
|
74
129
|
* @property {(pct: number, text?: string) => void} update Updates progress and optional text.
|
|
@@ -129,6 +184,14 @@ export declare class Message extends Component<MessageOptions> {
|
|
|
129
184
|
children: Node[];
|
|
130
185
|
};
|
|
131
186
|
_entries: Set<any>;
|
|
187
|
+
/** @type {Element|null} The theme scope this instance is the floating region of; null when inline. */
|
|
188
|
+
_floatingHost: Element | null;
|
|
189
|
+
/** @type {Element|null} Where the floating region was last put: its scope, or the topmost modal. */
|
|
190
|
+
_placedIn: Element | null;
|
|
191
|
+
/** @type {import('../../core/overlay-stack.js').OverlayHandle|null} The region's toast entry. */
|
|
192
|
+
_overlay: import('../../core/overlay-stack.js').OverlayHandle | null;
|
|
193
|
+
/** @type {(() => void)|null} Stops following the overlay stack. */
|
|
194
|
+
_unfollow: (() => void) | null;
|
|
132
195
|
_queue: MessageQueue<any>;
|
|
133
196
|
_cleaned: boolean;
|
|
134
197
|
static cssName: string;
|
|
@@ -187,13 +250,24 @@ export declare class Message extends Component<MessageOptions> {
|
|
|
187
250
|
static progress(text: string, options?: {
|
|
188
251
|
scope?: Element | string | null;
|
|
189
252
|
}): ProgressHandle;
|
|
253
|
+
/**
|
|
254
|
+
* Removes a floating region at once, toasts and all, without waiting for them to time out.
|
|
255
|
+
*
|
|
256
|
+
* A region already removes itself when its last toast closes, and one whose host has left the
|
|
257
|
+
* document is replaced on the next toast, so this is only for a host being torn down while
|
|
258
|
+
* toasts are still showing — an application view unmounting its themed shell, say.
|
|
259
|
+
* @param {Element|string} scope Element or selector whose nearest Zx theme scope owns the region,
|
|
260
|
+
* as passed to `show()`.
|
|
261
|
+
* @returns {boolean} Whether there was a region to remove.
|
|
262
|
+
*/
|
|
263
|
+
static disposeRegion(scope: Element | string): boolean;
|
|
190
264
|
/** @returns {void} */
|
|
191
265
|
destroy(): void;
|
|
192
266
|
/** @param {string} text @returns {ProgressHandle} */
|
|
193
267
|
_progress(text: string): ProgressHandle;
|
|
194
268
|
/**
|
|
195
269
|
* @param {string|Node} msg
|
|
196
|
-
* @param {{kind: MessageKind, timeout: number, closable: boolean}} settings
|
|
270
|
+
* @param {{kind: MessageKind, timeout: number, closable: boolean, action?: MessageAction|null, leading?: Node|null}} settings
|
|
197
271
|
* @param {{pct: number, text: string}|null} [progress=null]
|
|
198
272
|
* @returns {any}
|
|
199
273
|
*/
|
|
@@ -201,6 +275,8 @@ export declare class Message extends Component<MessageOptions> {
|
|
|
201
275
|
kind: MessageKind;
|
|
202
276
|
timeout: number;
|
|
203
277
|
closable: boolean;
|
|
278
|
+
action?: MessageAction | null;
|
|
279
|
+
leading?: Node | null;
|
|
204
280
|
}, progress?: {
|
|
205
281
|
pct: number;
|
|
206
282
|
text: string;
|
|
@@ -217,6 +293,24 @@ export declare class Message extends Component<MessageOptions> {
|
|
|
217
293
|
_close(entry: any): void;
|
|
218
294
|
/** @param {any} entry @returns {void} */
|
|
219
295
|
_finish(entry: any): void;
|
|
296
|
+
/**
|
|
297
|
+
* Takes a floating region out of the document once its last toast has gone, so an emptied host
|
|
298
|
+
* is not left holding a region nobody uses. Inline areas stay: their element is the caller's.
|
|
299
|
+
* @returns {void}
|
|
300
|
+
*/
|
|
301
|
+
_releaseIfEmpty(): void;
|
|
302
|
+
/**
|
|
303
|
+
* Puts a floating region where it can be seen and used: inside the topmost open modal dialog
|
|
304
|
+
* while one is open — outside it, `showModal()` would leave every toast unclickable — and in its
|
|
305
|
+
* own theme scope otherwise. Re-showing it after a move puts it back on top of the top layer.
|
|
306
|
+
* @returns {void}
|
|
307
|
+
*/
|
|
308
|
+
_rehome(): void;
|
|
309
|
+
/**
|
|
310
|
+
* Destroys a floating region and removes its element.
|
|
311
|
+
* @returns {void}
|
|
312
|
+
*/
|
|
313
|
+
_disposeFloating(): void;
|
|
220
314
|
/**
|
|
221
315
|
* Resolves a message through the host translator, falling back to the built-in English text.
|
|
222
316
|
* @param {string} key Message key.
|
|
@@ -225,3 +319,24 @@ export declare class Message extends Component<MessageOptions> {
|
|
|
225
319
|
*/
|
|
226
320
|
_message(key: string, fallback: string): string;
|
|
227
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Settles how long a message stays. A message that carries an action stays at least
|
|
324
|
+
* `MESSAGE_ACTION_MIN_TIMEOUT`, so there is time to reach it; zero still means it stays until
|
|
325
|
+
* closed, and anything that is not a finite number falls back to the 4000ms default.
|
|
326
|
+
* @param {unknown} timeout Requested auto-dismiss delay in milliseconds.
|
|
327
|
+
* @param {boolean} [hasAction=false] Whether the message carries an action.
|
|
328
|
+
* @returns {number}
|
|
329
|
+
*/
|
|
330
|
+
export declare function messageTimeout(timeout: unknown, hasAction?: boolean): number;
|
|
331
|
+
/**
|
|
332
|
+
* Copies a message action into the shape the message renders, or returns null when there is
|
|
333
|
+
* nothing to render: no object, or no label. An unknown `kind` reads as the default, secondary
|
|
334
|
+
* button, and a missing `onclick` leaves a button that only closes the message.
|
|
335
|
+
* @param {unknown} value Action descriptor.
|
|
336
|
+
* @returns {{label: string, kind: 'default'|'primary'|'danger'|'ghost', onclick: ((event: MouseEvent) => void)|null}|null}
|
|
337
|
+
*/
|
|
338
|
+
export declare function normalizeMessageAction(value: unknown): {
|
|
339
|
+
label: string;
|
|
340
|
+
kind: 'default' | 'primary' | 'danger' | 'ghost';
|
|
341
|
+
onclick: ((event: MouseEvent) => void) | null;
|
|
342
|
+
} | null;
|
|
@@ -23,7 +23,7 @@ export type ModalOptions = {
|
|
|
23
23
|
*/
|
|
24
24
|
destroyOnClose?: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
|
|
26
|
+
* Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
|
|
27
27
|
*/
|
|
28
28
|
scope?: Element | string | null;
|
|
29
29
|
/**
|
|
@@ -48,7 +48,7 @@ export type ModalOptions = {
|
|
|
48
48
|
* @property {boolean} [closable=true] Whether Escape may close the modal.
|
|
49
49
|
* @property {boolean} [lightDismiss=false] Whether a backdrop click closes the modal.
|
|
50
50
|
* @property {boolean} [destroyOnClose=false] Whether to destroy the modal after it closes.
|
|
51
|
-
* @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener.
|
|
51
|
+
* @property {Element|string|null} [scope=null] Element whose nearest Zx theme scope owns the overlay; defaults to the opener. Resolved on every open, so a scope connected after construction still owns it.
|
|
52
52
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
|
|
53
53
|
* @property {(event: CustomEvent<{result: unknown}>) => void} [onclose] Close event listener.
|
|
54
54
|
* @property {(event: CustomEvent<Record<string, never>>) => void} [oncancel] Cancel event listener.
|
|
@@ -110,6 +110,36 @@ export declare class Modal extends Component<ModalOptions> {
|
|
|
110
110
|
* @returns {void}
|
|
111
111
|
*/
|
|
112
112
|
_present(): void;
|
|
113
|
+
/**
|
|
114
|
+
* Describes the current presentation for the overlay stack, or returns null to stay off it.
|
|
115
|
+
*
|
|
116
|
+
* The kind is read from the platform like `aria-modal` is: a `showModal()` dialog is `modal`,
|
|
117
|
+
* and its Escape and backdrop stay the browser's; anything else is `non-modal`, and a subclass
|
|
118
|
+
* presenting that way adds the Escape and outside-press handling it wants.
|
|
119
|
+
* @returns {import('../../core/overlay-stack.js').OverlayEntryOptions|null}
|
|
120
|
+
* @protected
|
|
121
|
+
*/
|
|
122
|
+
protected _overlayEntry(): import('../../core/overlay-stack.js').OverlayEntryOptions | null;
|
|
123
|
+
/**
|
|
124
|
+
* Re-registers the current presentation on the overlay stack: called after every presentation,
|
|
125
|
+
* including a subclass's change of address that bypasses `open()`.
|
|
126
|
+
* @returns {void}
|
|
127
|
+
* @protected
|
|
128
|
+
*/
|
|
129
|
+
protected _syncOverlay(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Takes the overlay off the stack. Safe to call repeatedly.
|
|
132
|
+
* @returns {void}
|
|
133
|
+
* @protected
|
|
134
|
+
*/
|
|
135
|
+
protected _releaseOverlay(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Whether a node is inside this overlay or anything opened from it, as the overlay stack sees it.
|
|
138
|
+
* @param {Node|null|undefined} node Candidate.
|
|
139
|
+
* @returns {boolean}
|
|
140
|
+
* @protected
|
|
141
|
+
*/
|
|
142
|
+
protected _overlayContains(node: Node | null | undefined): boolean;
|
|
113
143
|
/**
|
|
114
144
|
* Hides the current presentation and records which generation its queued close event belongs to.
|
|
115
145
|
* @param {string} [result=''] Native string return value.
|
|
@@ -154,6 +184,17 @@ export declare class Modal extends Component<ModalOptions> {
|
|
|
154
184
|
* @returns {HTMLDialogElement}
|
|
155
185
|
*/
|
|
156
186
|
render(): HTMLDialogElement;
|
|
187
|
+
/**
|
|
188
|
+
* Gives a freshly rendered dialog its first home.
|
|
189
|
+
*
|
|
190
|
+
* A `scope` that is not in the document yet cannot say which theme it belongs to, and the
|
|
191
|
+
* `<body>` that `mountTarget()` would answer is outside it. The dialog then stays detached and
|
|
192
|
+
* `open()` places it, by which time the scope is in place. Called from `render()`, so it may
|
|
193
|
+
* read `this.options` but no instance state.
|
|
194
|
+
* @param {HTMLDialogElement} dialog The rendered dialog.
|
|
195
|
+
* @returns {void}
|
|
196
|
+
*/
|
|
197
|
+
_mountInitial(dialog: HTMLDialogElement): void;
|
|
157
198
|
/**
|
|
158
199
|
* Opens the modal in the browser top layer.
|
|
159
200
|
* @returns {this}
|