@zeyos/zx 2.1.0 → 2.2.1
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 +51 -0
- package/README.md +15 -0
- package/dist/types/compat/base.d.ts +156 -0
- package/dist/types/compat/globals.d.ts +20 -0
- package/dist/types/compat/index.d.ts +128 -0
- package/dist/types/compat/map/basic.d.ts +175 -0
- package/dist/types/compat/map/data.d.ts +102 -0
- package/dist/types/compat/map/date-time.d.ts +80 -0
- package/dist/types/compat/map/factory.d.ts +9 -0
- package/dist/types/compat/map/form.d.ts +98 -0
- package/dist/types/compat/map/helpers.d.ts +12 -0
- package/dist/types/compat/map/http.d.ts +36 -0
- package/dist/types/compat/map/layout.d.ts +106 -0
- package/dist/types/compat/map/options.d.ts +80 -0
- package/dist/types/compat/map/select.d.ts +95 -0
- package/dist/types/compat/map/stubs.d.ts +32 -0
- package/dist/types/compat/map/utilities.d.ts +37 -0
- package/dist/types/compat-entry.d.ts +5 -0
- package/dist/types/components/badge/badge.d.ts +46 -0
- package/dist/types/components/breadcrumb/breadcrumb.d.ts +200 -0
- package/dist/types/components/button/button.d.ts +42 -0
- package/dist/types/components/check-button/check-button.d.ts +98 -0
- package/dist/types/components/checklist/checklist.d.ts +143 -0
- package/dist/types/components/checklist/field-adapter.d.ts +5 -0
- package/dist/types/components/context-menu/context-menu.d.ts +130 -0
- package/dist/types/components/copy/copy-button.d.ts +48 -0
- package/dist/types/components/copy/copy-input.d.ts +91 -0
- package/dist/types/components/data-filter/data-filter.d.ts +250 -0
- package/dist/types/components/data-filter/filter-core.d.ts +52 -0
- package/dist/types/components/date-picker/date-picker.d.ts +137 -0
- package/dist/types/components/date-picker/date-range-picker.d.ts +350 -0
- package/dist/types/components/date-picker/field-adapter.d.ts +6 -0
- package/dist/types/components/date-picker/month-picker.d.ts +75 -0
- package/dist/types/components/date-picker/range-field-adapter.d.ts +7 -0
- package/dist/types/components/date-picker/time-picker.d.ts +127 -0
- package/dist/types/components/datebox/date-range-box.d.ts +218 -0
- package/dist/types/components/datebox/datebox.d.ts +160 -0
- package/dist/types/components/datebox/field-adapter.d.ts +5 -0
- package/dist/types/components/dialog/dialog.d.ts +284 -0
- package/dist/types/components/dropdown/dropdown.d.ts +118 -0
- package/dist/types/components/empty-state/empty-state.d.ts +38 -0
- package/dist/types/components/field/field.d.ts +231 -0
- package/dist/types/components/field-upload/field-adapter.d.ts +5 -0
- package/dist/types/components/field-upload/field-upload.d.ts +213 -0
- package/dist/types/components/fieldset/fieldset.d.ts +125 -0
- package/dist/types/components/finder/finder.d.ts +252 -0
- package/dist/types/components/form/form.d.ts +194 -0
- package/dist/types/components/groupbox/groupbox.d.ts +89 -0
- package/dist/types/components/layout/layout.d.ts +132 -0
- package/dist/types/components/loading/inline-loading.d.ts +86 -0
- package/dist/types/components/loading/progress-bar.d.ts +168 -0
- package/dist/types/components/loading/spinner.d.ts +34 -0
- package/dist/types/components/master-panel/master-panel.d.ts +112 -0
- package/dist/types/components/menu-button/menu-button.d.ts +142 -0
- package/dist/types/components/message/message.d.ts +212 -0
- package/dist/types/components/modal/modal.d.ts +105 -0
- package/dist/types/components/multi-value-editor/field-adapter.d.ts +5 -0
- package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +66 -0
- package/dist/types/components/navigation-bar/navigation-bar.d.ts +229 -0
- package/dist/types/components/number-field/field-adapter.d.ts +5 -0
- package/dist/types/components/number-field/number-field.d.ts +292 -0
- package/dist/types/components/pagination/pagination.d.ts +267 -0
- package/dist/types/components/panel/panel.d.ts +194 -0
- package/dist/types/components/permission/permission.d.ts +93 -0
- package/dist/types/components/rating/field-adapter.d.ts +5 -0
- package/dist/types/components/rating/rating.d.ts +213 -0
- package/dist/types/components/search/search.d.ts +98 -0
- package/dist/types/components/select/field-adapter.d.ts +5 -0
- package/dist/types/components/select/filter.d.ts +11 -0
- package/dist/types/components/select/select.d.ts +235 -0
- package/dist/types/components/skeleton/skeleton.d.ts +97 -0
- package/dist/types/components/slider/field-adapter.d.ts +5 -0
- package/dist/types/components/slider/slider.d.ts +216 -0
- package/dist/types/components/split-view/split-view.d.ts +335 -0
- package/dist/types/components/stepper/stepper.d.ts +314 -0
- package/dist/types/components/stepper/steps.d.ts +131 -0
- package/dist/types/components/tabbox/tabbox.d.ts +230 -0
- package/dist/types/components/table/sort.d.ts +49 -0
- package/dist/types/components/table/table.d.ts +872 -0
- package/dist/types/components/tag-picker/field-adapter.d.ts +5 -0
- package/dist/types/components/tag-picker/tag-picker.d.ts +375 -0
- package/dist/types/components/timebox/field-adapter.d.ts +5 -0
- package/dist/types/components/timebox/timebox.d.ts +121 -0
- package/dist/types/components/toggle/field-adapter.d.ts +5 -0
- package/dist/types/components/toggle/toggle.d.ts +94 -0
- package/dist/types/components/toolbar/toolbar.d.ts +230 -0
- package/dist/types/components/tooltip/tooltip.d.ts +183 -0
- package/dist/types/components/tree/hierarchy.d.ts +113 -0
- package/dist/types/components/tree/tree.d.ts +383 -0
- package/dist/types/components/truncate/truncate.d.ts +61 -0
- package/dist/types/components/value-list/field-adapter.d.ts +5 -0
- package/dist/types/components/value-list/value-list.d.ts +143 -0
- package/dist/types/core/breakpoint.d.ts +68 -0
- package/dist/types/core/component.d.ts +115 -0
- package/dist/types/core/date.d.ts +50 -0
- package/dist/types/core/dom.d.ts +86 -0
- package/dist/types/core/export.d.ts +70 -0
- package/dist/types/core/fontawesome.d.ts +107 -0
- package/dist/types/core/format.d.ts +107 -0
- package/dist/types/core/http.d.ts +122 -0
- package/dist/types/core/i18n.d.ts +35 -0
- package/dist/types/core/icons.d.ts +137 -0
- package/dist/types/core/keyboard.d.ts +72 -0
- package/dist/types/core/position.d.ts +45 -0
- package/dist/types/core/storage.d.ts +46 -0
- package/dist/types/core/util.d.ts +117 -0
- package/dist/types/elements/define.d.ts +73 -0
- package/dist/types/elements/reflect.d.ts +27 -0
- package/dist/types/index.d.ts +79 -0
- package/dist/types/zeyos/connect.d.ts +65 -0
- package/dist/types/zeyos/form.d.ts +140 -0
- package/dist/types/zeyos/icons.d.ts +104 -0
- package/dist/types/zeyos/index.d.ts +12 -0
- package/dist/types/zeyos/modules.d.ts +110 -0
- package/dist/types/zeyos/query.d.ts +157 -0
- package/dist/types/zeyos/schema.d.ts +79 -0
- package/dist/types/zeyos/select.d.ts +167 -0
- package/dist/types/zeyos/table.d.ts +205 -0
- package/dist/zx-compat.esm.js +375 -39
- package/dist/zx-compat.esm.min.js +1 -1
- package/dist/zx-compat.global.js +372 -73
- package/dist/zx-compat.global.min.js +3 -3
- package/dist/zx-zeyos.esm.js +355 -49
- package/dist/zx-zeyos.esm.min.js +1 -1
- package/dist/zx.css +68 -6
- package/dist/zx.esm.js +359 -73
- package/dist/zx.esm.min.js +3 -3
- package/dist/zx.global.js +359 -73
- package/dist/zx.global.min.js +3 -3
- package/dist/zx.min.css +1 -1
- package/docs/api.json +48 -2
- package/docs/llms.md +31 -0
- package/package.json +37 -9
- package/src/compat/base.js +291 -0
- package/src/compat/globals.js +165 -0
- package/src/compat/index.js +84 -0
- package/src/compat/map/basic.js +464 -0
- package/src/compat/map/data.js +232 -0
- package/src/compat/map/date-time.js +177 -0
- package/src/compat/map/factory.js +45 -0
- package/src/compat/map/form.js +330 -0
- package/src/compat/map/helpers.js +46 -0
- package/src/compat/map/http.js +117 -0
- package/src/compat/map/layout.js +256 -0
- package/src/compat/map/options.js +267 -0
- package/src/compat/map/select.js +198 -0
- package/src/compat/map/stubs.js +26 -0
- package/src/compat/map/utilities.js +113 -0
- package/src/compat-entry.js +11 -0
- package/src/components/badge/badge.css +147 -0
- package/src/components/badge/badge.js +92 -0
- package/src/components/breadcrumb/breadcrumb.css +105 -0
- package/src/components/breadcrumb/breadcrumb.js +331 -0
- package/src/components/button/button.css +104 -0
- package/src/components/button/button.js +76 -0
- package/src/components/check-button/check-button.css +66 -0
- package/src/components/check-button/check-button.js +167 -0
- package/src/components/checklist/checklist.css +65 -0
- package/src/components/checklist/checklist.js +282 -0
- package/src/components/checklist/field-adapter.js +46 -0
- package/src/components/context-menu/context-menu.css +54 -0
- package/src/components/context-menu/context-menu.js +334 -0
- package/src/components/copy/copy-button.css +27 -0
- package/src/components/copy/copy-button.js +78 -0
- package/src/components/copy/copy-input.css +59 -0
- package/src/components/copy/copy-input.js +123 -0
- package/src/components/data-filter/data-filter.css +53 -0
- package/src/components/data-filter/data-filter.js +400 -0
- package/src/components/data-filter/filter-core.js +128 -0
- package/src/components/date-picker/date-picker.css +181 -0
- package/src/components/date-picker/date-picker.js +500 -0
- package/src/components/date-picker/date-range-picker.css +264 -0
- package/src/components/date-picker/date-range-picker.js +990 -0
- package/src/components/date-picker/field-adapter.js +36 -0
- package/src/components/date-picker/month-picker.js +223 -0
- package/src/components/date-picker/range-field-adapter.js +31 -0
- package/src/components/date-picker/time-picker.css +191 -0
- package/src/components/date-picker/time-picker.js +406 -0
- package/src/components/datebox/date-range-box.css +128 -0
- package/src/components/datebox/date-range-box.js +492 -0
- package/src/components/datebox/datebox.css +108 -0
- package/src/components/datebox/datebox.js +358 -0
- package/src/components/datebox/field-adapter.js +34 -0
- package/src/components/dialog/dialog.css +74 -0
- package/src/components/dialog/dialog.js +450 -0
- package/src/components/dropdown/dropdown.css +24 -0
- package/src/components/dropdown/dropdown.js +288 -0
- package/src/components/empty-state/empty-state.css +80 -0
- package/src/components/empty-state/empty-state.js +92 -0
- package/src/components/field/field.css +127 -0
- package/src/components/field/field.js +605 -0
- package/src/components/field-upload/field-adapter.js +21 -0
- package/src/components/field-upload/field-upload.css +108 -0
- package/src/components/field-upload/field-upload.js +475 -0
- package/src/components/fieldset/fieldset.css +37 -0
- package/src/components/fieldset/fieldset.js +307 -0
- package/src/components/finder/finder.css +98 -0
- package/src/components/finder/finder.js +509 -0
- package/src/components/form/form.css +32 -0
- package/src/components/form/form.js +302 -0
- package/src/components/groupbox/groupbox.css +51 -0
- package/src/components/groupbox/groupbox.js +199 -0
- package/src/components/layout/layout.css +117 -0
- package/src/components/layout/layout.js +136 -0
- package/src/components/loading/inline-loading.css +34 -0
- package/src/components/loading/inline-loading.js +140 -0
- package/src/components/loading/progress-bar.css +115 -0
- package/src/components/loading/progress-bar.js +259 -0
- package/src/components/loading/spinner.css +58 -0
- package/src/components/loading/spinner.js +57 -0
- package/src/components/master-panel/master-panel.css +51 -0
- package/src/components/master-panel/master-panel.js +203 -0
- package/src/components/menu-button/menu-button.css +49 -0
- package/src/components/menu-button/menu-button.js +294 -0
- package/src/components/message/message.css +122 -0
- package/src/components/message/message.js +499 -0
- package/src/components/modal/modal.css +47 -0
- package/src/components/modal/modal.js +203 -0
- package/src/components/multi-value-editor/field-adapter.js +44 -0
- package/src/components/multi-value-editor/multi-value-editor.css +56 -0
- package/src/components/multi-value-editor/multi-value-editor.js +170 -0
- package/src/components/navigation-bar/navigation-bar.css +130 -0
- package/src/components/navigation-bar/navigation-bar.js +450 -0
- package/src/components/number-field/field-adapter.js +40 -0
- package/src/components/number-field/number-field.css +77 -0
- package/src/components/number-field/number-field.js +545 -0
- package/src/components/pagination/pagination.css +95 -0
- package/src/components/pagination/pagination.js +481 -0
- package/src/components/panel/panel.css +123 -0
- package/src/components/panel/panel.js +336 -0
- package/src/components/permission/permission.css +47 -0
- package/src/components/permission/permission.js +198 -0
- package/src/components/rating/field-adapter.js +34 -0
- package/src/components/rating/rating.css +97 -0
- package/src/components/rating/rating.js +395 -0
- package/src/components/search/search.css +70 -0
- package/src/components/search/search.js +193 -0
- package/src/components/select/field-adapter.js +24 -0
- package/src/components/select/filter.js +39 -0
- package/src/components/select/select.css +180 -0
- package/src/components/select/select.js +663 -0
- package/src/components/skeleton/skeleton.css +76 -0
- package/src/components/skeleton/skeleton.js +139 -0
- package/src/components/slider/field-adapter.js +36 -0
- package/src/components/slider/slider.css +181 -0
- package/src/components/slider/slider.js +399 -0
- package/src/components/split-view/split-view.css +139 -0
- package/src/components/split-view/split-view.js +806 -0
- package/src/components/stepper/stepper.css +234 -0
- package/src/components/stepper/stepper.js +459 -0
- package/src/components/stepper/steps.js +131 -0
- package/src/components/tabbox/tabbox.css +281 -0
- package/src/components/tabbox/tabbox.js +484 -0
- package/src/components/table/sort.js +85 -0
- package/src/components/table/table.css +364 -0
- package/src/components/table/table.js +1711 -0
- package/src/components/tag-picker/field-adapter.js +35 -0
- package/src/components/tag-picker/tag-picker.css +169 -0
- package/src/components/tag-picker/tag-picker.js +837 -0
- package/src/components/timebox/field-adapter.js +24 -0
- package/src/components/timebox/timebox.css +51 -0
- package/src/components/timebox/timebox.js +276 -0
- package/src/components/toggle/field-adapter.js +24 -0
- package/src/components/toggle/toggle.css +66 -0
- package/src/components/toggle/toggle.js +150 -0
- package/src/components/toolbar/toolbar.css +81 -0
- package/src/components/toolbar/toolbar.js +511 -0
- package/src/components/tooltip/tooltip.css +36 -0
- package/src/components/tooltip/tooltip.js +420 -0
- package/src/components/tree/hierarchy.js +151 -0
- package/src/components/tree/tree.css +99 -0
- package/src/components/tree/tree.js +784 -0
- package/src/components/truncate/truncate.css +20 -0
- package/src/components/truncate/truncate.js +92 -0
- package/src/components/value-list/field-adapter.js +24 -0
- package/src/components/value-list/value-list.css +108 -0
- package/src/components/value-list/value-list.js +336 -0
- package/src/core/breakpoint.js +150 -0
- package/src/core/component.js +292 -0
- package/src/core/date.js +216 -0
- package/src/core/dom.js +260 -0
- package/src/core/export.js +204 -0
- package/src/core/fontawesome.js +177 -0
- package/src/core/format.js +283 -0
- package/src/core/http.js +246 -0
- package/src/core/i18n.js +83 -0
- package/src/core/icons.js +283 -0
- package/src/core/keyboard.js +240 -0
- package/src/core/position.js +177 -0
- package/src/core/storage.js +175 -0
- package/src/core/util.js +336 -0
- package/src/elements/define.js +715 -0
- package/src/elements/reflect.js +79 -0
- package/src/index.js +131 -0
- package/src/zeyos/connect.js +142 -0
- package/src/zeyos/form.js +254 -0
- package/src/zeyos/icons.js +92 -0
- package/src/zeyos/index.js +21 -0
- package/src/zeyos/modules.js +269 -0
- package/src/zeyos/query.js +199 -0
- package/src/zeyos/schema.js +474 -0
- package/src/zeyos/select.js +175 -0
- package/src/zeyos/table.js +272 -0
- package/styles/base.css +124 -0
- package/styles/icons.css +34 -0
- package/styles/tokens/dark.css +84 -0
- package/styles/tokens/density.css +9 -0
- package/styles/tokens/global.css +80 -0
- package/styles/tokens/modules.css +109 -0
- package/styles/tokens/semantic.css +49 -0
- package/styles/zx.css +61 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOM-free step-list logic shared by {@link Stepper}: validation, normalization, and the
|
|
3
|
+
* index arithmetic behind `next()` / `previous()`.
|
|
4
|
+
* @module components/stepper/steps
|
|
5
|
+
*/
|
|
6
|
+
export type StepDefinition = {
|
|
7
|
+
/**
|
|
8
|
+
* Stable step name, unique within the stepper.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
/**
|
|
12
|
+
* Visible step title.
|
|
13
|
+
*/
|
|
14
|
+
title: string;
|
|
15
|
+
/**
|
|
16
|
+
* Secondary line rendered under the title.
|
|
17
|
+
*/
|
|
18
|
+
description?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Marks the step as skippable.
|
|
21
|
+
*/
|
|
22
|
+
optional?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Whether the step can be activated.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export type NormalizedStep = {
|
|
29
|
+
/**
|
|
30
|
+
* Stable step name.
|
|
31
|
+
*/
|
|
32
|
+
name: string;
|
|
33
|
+
/**
|
|
34
|
+
* Visible step title.
|
|
35
|
+
*/
|
|
36
|
+
title: string;
|
|
37
|
+
/**
|
|
38
|
+
* Secondary line, or null.
|
|
39
|
+
*/
|
|
40
|
+
description: string | null;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the step is skippable.
|
|
43
|
+
*/
|
|
44
|
+
optional: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the step can be activated.
|
|
47
|
+
*/
|
|
48
|
+
disabled: boolean;
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* @typedef {Object} StepDefinition
|
|
52
|
+
* @property {string} name Stable step name, unique within the stepper.
|
|
53
|
+
* @property {string} title Visible step title.
|
|
54
|
+
* @property {string} [description] Secondary line rendered under the title.
|
|
55
|
+
* @property {boolean} [optional=false] Marks the step as skippable.
|
|
56
|
+
* @property {boolean} [disabled=false] Whether the step can be activated.
|
|
57
|
+
*/
|
|
58
|
+
/**
|
|
59
|
+
* @typedef {Object} NormalizedStep
|
|
60
|
+
* @property {string} name Stable step name.
|
|
61
|
+
* @property {string} title Visible step title.
|
|
62
|
+
* @property {string|null} description Secondary line, or null.
|
|
63
|
+
* @property {boolean} optional Whether the step is skippable.
|
|
64
|
+
* @property {boolean} disabled Whether the step can be activated.
|
|
65
|
+
*/
|
|
66
|
+
/**
|
|
67
|
+
* Validates and normalizes a step list. Every step needs a unique non-empty name; every other
|
|
68
|
+
* property is coerced to its documented type.
|
|
69
|
+
* @param {StepDefinition[]} list Step definitions.
|
|
70
|
+
* @returns {NormalizedStep[]} Normalized copies — the input objects are never mutated.
|
|
71
|
+
* @throws {TypeError} When the list or a step is malformed.
|
|
72
|
+
* @throws {RangeError} When two steps share a name.
|
|
73
|
+
*/
|
|
74
|
+
export declare function normalizeSteps(list: StepDefinition[]): NormalizedStep[];
|
|
75
|
+
/**
|
|
76
|
+
* Returns the index of a step by name.
|
|
77
|
+
* @param {NormalizedStep[]} steps Normalized steps.
|
|
78
|
+
* @param {string|null} name Step name.
|
|
79
|
+
* @returns {number} Zero-based index, or -1 when the name is unknown or null.
|
|
80
|
+
*/
|
|
81
|
+
export declare function stepIndex(steps: NormalizedStep[], name: string | null): number;
|
|
82
|
+
/**
|
|
83
|
+
* Resolves the next enabled step in a direction, skipping disabled steps. Starting from -1 walks
|
|
84
|
+
* in from the matching end, so `resolveStepIndex(steps, -1, 1)` is the first enabled step.
|
|
85
|
+
* @param {NormalizedStep[]} steps Normalized steps.
|
|
86
|
+
* @param {number} from Zero-based index to start from, or -1 for "outside the list".
|
|
87
|
+
* @param {number} direction Positive to move forward, negative to move backward.
|
|
88
|
+
* @returns {number} Zero-based index, or -1 when no enabled step lies that way.
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolveStepIndex(steps: NormalizedStep[], from: number, direction: number): number;
|
|
91
|
+
/**
|
|
92
|
+
* Names of the steps a move marks complete. Advancing past a step completes it — including every
|
|
93
|
+
* step skipped over by a jump — while moving backwards completes nothing, so a user can walk back
|
|
94
|
+
* through a wizard without erasing their progress.
|
|
95
|
+
* @param {NormalizedStep[]} steps Normalized steps.
|
|
96
|
+
* @param {number} from Zero-based index being left, or -1 when nothing was active.
|
|
97
|
+
* @param {number} to Zero-based index being activated.
|
|
98
|
+
* @returns {string[]} Names to add to the completed set, in step order.
|
|
99
|
+
*/
|
|
100
|
+
export declare function completedByAdvance(steps: NormalizedStep[], from: number, to: number): string[];
|
|
101
|
+
export type StepStateContext = {
|
|
102
|
+
/**
|
|
103
|
+
* Zero-based active index, or -1 when nothing is active.
|
|
104
|
+
*/
|
|
105
|
+
activeIndex?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Completed step names.
|
|
108
|
+
*/
|
|
109
|
+
completed?: Set<string> | string[];
|
|
110
|
+
/**
|
|
111
|
+
* Errored step names.
|
|
112
|
+
*/
|
|
113
|
+
errored?: Set<string> | string[];
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* @typedef {Object} StepStateContext
|
|
117
|
+
* @property {number} [activeIndex=-1] Zero-based active index, or -1 when nothing is active.
|
|
118
|
+
* @property {Set<string>|string[]} [completed] Completed step names.
|
|
119
|
+
* @property {Set<string>|string[]} [errored] Errored step names.
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Resolves the rendered state of one step. Errors win over everything, so a step the user has to
|
|
123
|
+
* come back and fix stays visible as a problem even while it is the active one; being active in
|
|
124
|
+
* turn wins over being complete, because where the user stands matters more than where they have
|
|
125
|
+
* already been.
|
|
126
|
+
* @param {NormalizedStep} step Normalized step.
|
|
127
|
+
* @param {number} index Zero-based index of the step.
|
|
128
|
+
* @param {StepStateContext} [context={}] Rail state.
|
|
129
|
+
* @returns {'upcoming'|'active'|'complete'|'error'}
|
|
130
|
+
*/
|
|
131
|
+
export declare function stepState(step: NormalizedStep, index: number, context?: StepStateContext): 'upcoming' | 'active' | 'complete' | 'error';
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type TabContent = Node | Component | (() => Node | Component);
|
|
3
|
+
export type TabDefinition = {
|
|
4
|
+
/**
|
|
5
|
+
* Stable tab name.
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Visible tab label.
|
|
10
|
+
*/
|
|
11
|
+
title: string;
|
|
12
|
+
/**
|
|
13
|
+
* Panel content or a lazy content factory.
|
|
14
|
+
*/
|
|
15
|
+
content: TabContent;
|
|
16
|
+
/**
|
|
17
|
+
* Icon name passed to `icon()`, shown before the title.
|
|
18
|
+
*/
|
|
19
|
+
icon?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Whether Delete can close the tab.
|
|
22
|
+
*/
|
|
23
|
+
closable?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the tab is unavailable.
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type TabboxVariant = 'divided' | 'bracket' | 'line' | 'segmented';
|
|
30
|
+
export type TabInsertOptions = {
|
|
31
|
+
/**
|
|
32
|
+
* Zero-based insertion index; omitted appends.
|
|
33
|
+
*/
|
|
34
|
+
index?: number;
|
|
35
|
+
};
|
|
36
|
+
export type TabboxOptions = {
|
|
37
|
+
/**
|
|
38
|
+
* Initial tabs.
|
|
39
|
+
*/
|
|
40
|
+
tabs?: TabDefinition[];
|
|
41
|
+
/**
|
|
42
|
+
* Initially active tab name, or the first enabled tab.
|
|
43
|
+
*/
|
|
44
|
+
active?: string | null;
|
|
45
|
+
/**
|
|
46
|
+
* `divided` sets flat blocks on a muted track above
|
|
47
|
+
* a bordered panel; `bracket` outlines folder tabs that fuse into that panel; `line` underlines
|
|
48
|
+
* the active tab across a full-width rule; `segmented` renders a compact group that reads as one
|
|
49
|
+
* control, for a toolbar or card header.
|
|
50
|
+
*/
|
|
51
|
+
variant?: TabboxVariant;
|
|
52
|
+
/**
|
|
53
|
+
* Keep inactive panel elements mounted.
|
|
54
|
+
*/
|
|
55
|
+
keepAlive?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Change callback.
|
|
58
|
+
*/
|
|
59
|
+
onchange?: (event: CustomEvent<{
|
|
60
|
+
name: string;
|
|
61
|
+
previous: string | null;
|
|
62
|
+
}>) => void;
|
|
63
|
+
/**
|
|
64
|
+
* Close callback.
|
|
65
|
+
*/
|
|
66
|
+
onclose?: (event: CustomEvent<{
|
|
67
|
+
name: string;
|
|
68
|
+
}>) => void;
|
|
69
|
+
};
|
|
70
|
+
export type TabRecord = {
|
|
71
|
+
/**
|
|
72
|
+
* Normalized definition.
|
|
73
|
+
*/
|
|
74
|
+
definition: TabDefinition;
|
|
75
|
+
/**
|
|
76
|
+
* Tab element.
|
|
77
|
+
*/
|
|
78
|
+
tab: HTMLButtonElement;
|
|
79
|
+
/**
|
|
80
|
+
* Title element.
|
|
81
|
+
*/
|
|
82
|
+
title: HTMLElement;
|
|
83
|
+
/**
|
|
84
|
+
* Badge element.
|
|
85
|
+
*/
|
|
86
|
+
badge: HTMLElement;
|
|
87
|
+
/**
|
|
88
|
+
* Tab panel.
|
|
89
|
+
*/
|
|
90
|
+
panel: HTMLElement;
|
|
91
|
+
/**
|
|
92
|
+
* Whether content has been mounted.
|
|
93
|
+
*/
|
|
94
|
+
built: boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {Object} TabInsertOptions
|
|
98
|
+
* @property {number} [index] Zero-based insertion index; omitted appends.
|
|
99
|
+
*/
|
|
100
|
+
/**
|
|
101
|
+
* @typedef {Object} TabboxOptions
|
|
102
|
+
* @property {TabDefinition[]} [tabs=[]] Initial tabs.
|
|
103
|
+
* @property {string|null} [active=null] Initially active tab name, or the first enabled tab.
|
|
104
|
+
* @property {TabboxVariant} [variant='divided'] `divided` sets flat blocks on a muted track above
|
|
105
|
+
* a bordered panel; `bracket` outlines folder tabs that fuse into that panel; `line` underlines
|
|
106
|
+
* the active tab across a full-width rule; `segmented` renders a compact group that reads as one
|
|
107
|
+
* control, for a toolbar or card header.
|
|
108
|
+
* @property {boolean} [keepAlive=true] Keep inactive panel elements mounted.
|
|
109
|
+
* @property {(event: CustomEvent<{name: string, previous: string|null}>) => void} [onchange] Change callback.
|
|
110
|
+
* @property {(event: CustomEvent<{name: string}>) => void} [onclose] Close callback.
|
|
111
|
+
*/
|
|
112
|
+
/**
|
|
113
|
+
* @typedef {Object} TabRecord
|
|
114
|
+
* @property {TabDefinition} definition Normalized definition.
|
|
115
|
+
* @property {HTMLButtonElement} tab Tab element.
|
|
116
|
+
* @property {HTMLElement} title Title element.
|
|
117
|
+
* @property {HTMLElement} badge Badge element.
|
|
118
|
+
* @property {HTMLElement} panel Tab panel.
|
|
119
|
+
* @property {boolean} built Whether content has been mounted.
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* APG tabs with roving focus and manual activation.
|
|
123
|
+
* @fires Tabbox#change
|
|
124
|
+
* @fires Tabbox#close
|
|
125
|
+
* @extends {Component<TabboxOptions>}
|
|
126
|
+
*/
|
|
127
|
+
export declare class Tabbox extends Component<TabboxOptions> {
|
|
128
|
+
_createdRoot: boolean;
|
|
129
|
+
_original: {
|
|
130
|
+
attributes: Array<[string, string]>;
|
|
131
|
+
children: Node[];
|
|
132
|
+
};
|
|
133
|
+
_cleaned: boolean;
|
|
134
|
+
/** @type {TabRecord[]} */
|
|
135
|
+
_tabs: TabRecord[];
|
|
136
|
+
/** @type {TabRecord|null} */
|
|
137
|
+
_active: TabRecord | null;
|
|
138
|
+
_keepAlive: boolean;
|
|
139
|
+
_initializing: boolean;
|
|
140
|
+
static cssName: string;
|
|
141
|
+
/** @type {Readonly<TabboxOptions>} */
|
|
142
|
+
static defaults: Readonly<TabboxOptions>;
|
|
143
|
+
/**
|
|
144
|
+
* Creates or enhances a tabbox.
|
|
145
|
+
* @param {Element|string|null} target Existing container, selector, or null.
|
|
146
|
+
* @param {TabboxOptions} [options={}] Tabbox options.
|
|
147
|
+
*/
|
|
148
|
+
constructor(target: Element | string | null, options?: TabboxOptions);
|
|
149
|
+
/** @returns {HTMLElement} */
|
|
150
|
+
render(): HTMLElement;
|
|
151
|
+
/**
|
|
152
|
+
* Adds a tab.
|
|
153
|
+
* @param {TabDefinition} definition Tab definition.
|
|
154
|
+
* @param {TabInsertOptions} [insert={}] Insertion options.
|
|
155
|
+
* @returns {this}
|
|
156
|
+
*/
|
|
157
|
+
addTab(definition: TabDefinition, insert?: TabInsertOptions): this;
|
|
158
|
+
/**
|
|
159
|
+
* Removes a tab by name.
|
|
160
|
+
* @param {string} name Tab name.
|
|
161
|
+
* @returns {this}
|
|
162
|
+
*/
|
|
163
|
+
removeTab(name: string): this;
|
|
164
|
+
/**
|
|
165
|
+
* Activates an enabled tab unless its change event is vetoed.
|
|
166
|
+
* @param {string} name Tab name.
|
|
167
|
+
* @returns {this}
|
|
168
|
+
* @fires Tabbox#change
|
|
169
|
+
*/
|
|
170
|
+
openTab(name: string): this;
|
|
171
|
+
/**
|
|
172
|
+
* Alias of `openTab()`.
|
|
173
|
+
* @param {string} name Tab name.
|
|
174
|
+
* @returns {this}
|
|
175
|
+
* @fires Tabbox#change
|
|
176
|
+
*/
|
|
177
|
+
show(name: string): this;
|
|
178
|
+
/**
|
|
179
|
+
* Returns the active tab name.
|
|
180
|
+
* @returns {string|null}
|
|
181
|
+
*/
|
|
182
|
+
getActive(): string | null;
|
|
183
|
+
/**
|
|
184
|
+
* Changes a tab title.
|
|
185
|
+
* @param {string} name Tab name.
|
|
186
|
+
* @param {string} title Next title.
|
|
187
|
+
* @returns {this}
|
|
188
|
+
*/
|
|
189
|
+
setTitle(name: string, title: string): this;
|
|
190
|
+
/**
|
|
191
|
+
* Sets or clears a tab badge.
|
|
192
|
+
* @param {string} name Tab name.
|
|
193
|
+
* @param {string|null} text Badge text, or null to remove it.
|
|
194
|
+
* @returns {this}
|
|
195
|
+
*/
|
|
196
|
+
setBadge(name: string, text: string | null): this;
|
|
197
|
+
/**
|
|
198
|
+
* Enables a tab.
|
|
199
|
+
* @param {string} name Tab name.
|
|
200
|
+
* @returns {this}
|
|
201
|
+
*/
|
|
202
|
+
enableTab(name: string): this;
|
|
203
|
+
/**
|
|
204
|
+
* Disables a tab, moving selection when it is active.
|
|
205
|
+
* @param {string} name Tab name.
|
|
206
|
+
* @returns {this}
|
|
207
|
+
* @fires Tabbox#change
|
|
208
|
+
*/
|
|
209
|
+
disableTab(name: string): this;
|
|
210
|
+
/** @returns {void} */
|
|
211
|
+
destroy(): void;
|
|
212
|
+
/** @param {KeyboardEvent} event @returns {void} */
|
|
213
|
+
_onKeydown(event: KeyboardEvent): void;
|
|
214
|
+
/** @param {string} name @param {boolean} emitClose @returns {boolean} */
|
|
215
|
+
_removeTab(name: string, emitClose: boolean): boolean;
|
|
216
|
+
/** @param {TabRecord} record @returns {void} */
|
|
217
|
+
_applyActive(record: TabRecord): void;
|
|
218
|
+
/** @param {TabRecord} record @returns {void} */
|
|
219
|
+
_ensureContent(record: TabRecord): void;
|
|
220
|
+
/** @param {TabRecord} record @param {boolean} [focus=true] @returns {void} */
|
|
221
|
+
_setFocused(record: TabRecord, focus?: boolean): void;
|
|
222
|
+
/** @returns {TabRecord[]} */
|
|
223
|
+
_enabledTabs(): TabRecord[];
|
|
224
|
+
/** @param {string} name @returns {TabRecord|null} */
|
|
225
|
+
_find(name: string): TabRecord | null;
|
|
226
|
+
/** @param {string} name @returns {TabRecord} */
|
|
227
|
+
_require(name: string): TabRecord;
|
|
228
|
+
/** @param {Element} tab @returns {TabRecord|null} */
|
|
229
|
+
_recordForTab(tab: Element): TabRecord | null;
|
|
230
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** @typedef {'asc'|'desc'} SortDirection */
|
|
2
|
+
export type SortDirection = 'asc' | 'desc';
|
|
3
|
+
/**
|
|
4
|
+
* Compares strings with the host locale's collation rules.
|
|
5
|
+
* @param {unknown} left Left value.
|
|
6
|
+
* @param {unknown} right Right value.
|
|
7
|
+
* @returns {number} Negative, zero, or positive comparison result.
|
|
8
|
+
*/
|
|
9
|
+
export declare function compareStrings(left: unknown, right: unknown): number;
|
|
10
|
+
/**
|
|
11
|
+
* Compares numeric values.
|
|
12
|
+
* @param {number} left Left value.
|
|
13
|
+
* @param {number} right Right value.
|
|
14
|
+
* @returns {number} Negative, zero, or positive comparison result.
|
|
15
|
+
*/
|
|
16
|
+
export declare function compareNumbers(left: number, right: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* Compares Date values by their timestamps.
|
|
19
|
+
* @param {Date} left Left date.
|
|
20
|
+
* @param {Date} right Right date.
|
|
21
|
+
* @returns {number} Negative, zero, or positive comparison result.
|
|
22
|
+
*/
|
|
23
|
+
export declare function compareDates(left: Date, right: Date): number;
|
|
24
|
+
/**
|
|
25
|
+
* Compares values according to their runtime type. Nullish values are always placed last,
|
|
26
|
+
* including for descending sorts.
|
|
27
|
+
* @param {unknown} left Left value.
|
|
28
|
+
* @param {unknown} right Right value.
|
|
29
|
+
* @param {SortDirection} [direction='asc'] Sort direction.
|
|
30
|
+
* @returns {number} Negative, zero, or positive comparison result.
|
|
31
|
+
*/
|
|
32
|
+
export declare function compareValues(left: unknown, right: unknown, direction?: SortDirection): number;
|
|
33
|
+
/**
|
|
34
|
+
* Creates a row comparator for a sort-value accessor.
|
|
35
|
+
* @template T
|
|
36
|
+
* @param {(row: T) => unknown} getValue Sort-value accessor.
|
|
37
|
+
* @param {SortDirection} [direction='asc'] Sort direction.
|
|
38
|
+
* @returns {(left: T, right: T) => number} Row comparator.
|
|
39
|
+
*/
|
|
40
|
+
export declare function createComparator<T>(getValue: (row: T) => unknown, direction?: SortDirection): (left: T, right: T) => number;
|
|
41
|
+
/**
|
|
42
|
+
* Returns a stably sorted copy of an array without mutating the input.
|
|
43
|
+
* @template T
|
|
44
|
+
* @param {T[]} rows Rows to sort.
|
|
45
|
+
* @param {(row: T) => unknown} getValue Sort-value accessor.
|
|
46
|
+
* @param {SortDirection} [direction='asc'] Sort direction.
|
|
47
|
+
* @returns {T[]} Sorted copy.
|
|
48
|
+
*/
|
|
49
|
+
export declare function sortRows<T>(rows: T[], getValue: (row: T) => unknown, direction?: SortDirection): T[];
|