@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,230 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type ToolbarItemDescriptor = {
|
|
3
|
+
/**
|
|
4
|
+
* Identifier for `getItem()`, `enable()`, `disable()`, and `setActive()`.
|
|
5
|
+
*/
|
|
6
|
+
name?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Visible button label.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Icon name from `icons.js`.
|
|
13
|
+
*/
|
|
14
|
+
icon?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Button kind.
|
|
17
|
+
*/
|
|
18
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
19
|
+
/**
|
|
20
|
+
* Button size; defaults to `'sm'` in a dense toolbar.
|
|
21
|
+
*/
|
|
22
|
+
size?: 'md' | 'sm';
|
|
23
|
+
/**
|
|
24
|
+
* Whether the control starts disabled.
|
|
25
|
+
*/
|
|
26
|
+
disabled?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Native title text.
|
|
29
|
+
*/
|
|
30
|
+
title?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Renders the button as a pressed toggle (`aria-pressed`).
|
|
33
|
+
*/
|
|
34
|
+
active?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Click callback, called after the `action` event.
|
|
37
|
+
*/
|
|
38
|
+
onclick?: (event: MouseEvent) => void;
|
|
39
|
+
};
|
|
40
|
+
export type ToolbarItem = Element | ToolbarItemDescriptor | '-';
|
|
41
|
+
export type ToolbarEntry = {
|
|
42
|
+
type: 'separator';
|
|
43
|
+
} | {
|
|
44
|
+
type: 'element';
|
|
45
|
+
element: Element;
|
|
46
|
+
} | {
|
|
47
|
+
type: 'descriptor';
|
|
48
|
+
descriptor: ToolbarItemDescriptor;
|
|
49
|
+
};
|
|
50
|
+
export type ToolbarOptions = {
|
|
51
|
+
/**
|
|
52
|
+
* Controls, separators (`'-'`), and ready-made Elements.
|
|
53
|
+
*/
|
|
54
|
+
items?: ToolbarItem[];
|
|
55
|
+
/**
|
|
56
|
+
* Horizontal distribution.
|
|
57
|
+
*/
|
|
58
|
+
align?: 'start' | 'end' | 'between';
|
|
59
|
+
/**
|
|
60
|
+
* Accessible name of the toolbar.
|
|
61
|
+
*/
|
|
62
|
+
label?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Collapses items that no longer fit into a trailing menu.
|
|
65
|
+
*/
|
|
66
|
+
overflow?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Accessible name of the overflow menu trigger.
|
|
69
|
+
*/
|
|
70
|
+
overflowLabel?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Tighter spacing and small controls.
|
|
73
|
+
*/
|
|
74
|
+
dense?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Action listener.
|
|
77
|
+
*/
|
|
78
|
+
onaction?: (event: CustomEvent<{
|
|
79
|
+
name: string | null;
|
|
80
|
+
item: Element;
|
|
81
|
+
}>) => void;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* @typedef {Object} ToolbarItemDescriptor
|
|
85
|
+
* @property {string} [name] Identifier for `getItem()`, `enable()`, `disable()`, and `setActive()`.
|
|
86
|
+
* @property {string} [label] Visible button label.
|
|
87
|
+
* @property {string} [icon] Icon name from `icons.js`.
|
|
88
|
+
* @property {'default'|'primary'|'danger'|'ghost'} [kind='default'] Button kind.
|
|
89
|
+
* @property {'md'|'sm'} [size] Button size; defaults to `'sm'` in a dense toolbar.
|
|
90
|
+
* @property {boolean} [disabled=false] Whether the control starts disabled.
|
|
91
|
+
* @property {string} [title] Native title text.
|
|
92
|
+
* @property {boolean} [active=false] Renders the button as a pressed toggle (`aria-pressed`).
|
|
93
|
+
* @property {(event: MouseEvent) => void} [onclick] Click callback, called after the `action` event.
|
|
94
|
+
*/
|
|
95
|
+
/** @typedef {Element|ToolbarItemDescriptor|'-'} ToolbarItem */
|
|
96
|
+
/**
|
|
97
|
+
* @typedef {{type: 'separator'}
|
|
98
|
+
* |{type: 'element', element: Element}
|
|
99
|
+
* |{type: 'descriptor', descriptor: ToolbarItemDescriptor}} ToolbarEntry
|
|
100
|
+
*/
|
|
101
|
+
/**
|
|
102
|
+
* @typedef {Object} ToolbarOptions
|
|
103
|
+
* @property {ToolbarItem[]} [items=[]] Controls, separators (`'-'`), and ready-made Elements.
|
|
104
|
+
* @property {'start'|'end'|'between'} [align='start'] Horizontal distribution.
|
|
105
|
+
* @property {string} [label='Toolbar'] Accessible name of the toolbar.
|
|
106
|
+
* @property {boolean} [overflow=true] Collapses items that no longer fit into a trailing menu.
|
|
107
|
+
* @property {string} [overflowLabel='More'] Accessible name of the overflow menu trigger.
|
|
108
|
+
* @property {boolean} [dense=false] Tighter spacing and small controls.
|
|
109
|
+
* @property {(event: CustomEvent<{name: string|null, item: Element}>) => void} [onaction] Action listener.
|
|
110
|
+
*/
|
|
111
|
+
/**
|
|
112
|
+
* APG toolbar: one tab stop, arrow keys between controls, Home and End to the ends, and an
|
|
113
|
+
* optional overflow menu that swallows the items that no longer fit.
|
|
114
|
+
* @fires Toolbar#action
|
|
115
|
+
* @extends {Component<ToolbarOptions>}
|
|
116
|
+
*/
|
|
117
|
+
export declare class Toolbar extends Component<ToolbarOptions> {
|
|
118
|
+
#private;
|
|
119
|
+
/** @type {ToolbarRecord[]} */
|
|
120
|
+
_records: ToolbarRecord[];
|
|
121
|
+
/** @type {Map<string, ToolbarRecord>} */
|
|
122
|
+
_named: Map<string, ToolbarRecord>;
|
|
123
|
+
_createdRoot: boolean;
|
|
124
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
125
|
+
_initialItems: ToolbarItem[];
|
|
126
|
+
static cssName: string;
|
|
127
|
+
/** @type {Readonly<ToolbarOptions>} */
|
|
128
|
+
static defaults: Readonly<ToolbarOptions>;
|
|
129
|
+
/**
|
|
130
|
+
* Creates a toolbar, or turns an existing element into one.
|
|
131
|
+
* @param {Element|string|null} [target=null] Existing container, selector, or null to create one.
|
|
132
|
+
* @param {ToolbarOptions} [options={}] Toolbar options.
|
|
133
|
+
*/
|
|
134
|
+
constructor(target?: Element | string | null, options?: ToolbarOptions);
|
|
135
|
+
/**
|
|
136
|
+
* Prepares the toolbar root. Instance state is initialized here because `render()` runs inside
|
|
137
|
+
* the base constructor, before any class-field initializer.
|
|
138
|
+
* @returns {HTMLElement}
|
|
139
|
+
*/
|
|
140
|
+
render(): HTMLElement;
|
|
141
|
+
/**
|
|
142
|
+
* Replaces every item and remeasures the overflow.
|
|
143
|
+
* @param {ToolbarItem[]} list Controls, separators, and Elements.
|
|
144
|
+
* @returns {this}
|
|
145
|
+
*/
|
|
146
|
+
setItems(list: ToolbarItem[]): this;
|
|
147
|
+
/**
|
|
148
|
+
* Looks up an item element by name.
|
|
149
|
+
* @param {string} name Descriptor name, or the `data-name` of an Element item.
|
|
150
|
+
* @returns {Element|null}
|
|
151
|
+
*/
|
|
152
|
+
getItem(name: string): Element | null;
|
|
153
|
+
/**
|
|
154
|
+
* Enables an item.
|
|
155
|
+
* @param {string} name Item name.
|
|
156
|
+
* @returns {this}
|
|
157
|
+
*/
|
|
158
|
+
enable(name: string): this;
|
|
159
|
+
/**
|
|
160
|
+
* Disables an item.
|
|
161
|
+
* @param {string} name Item name.
|
|
162
|
+
* @returns {this}
|
|
163
|
+
*/
|
|
164
|
+
disable(name: string): this;
|
|
165
|
+
/**
|
|
166
|
+
* Sets the pressed state of a toggle item.
|
|
167
|
+
* @param {string} name Item name.
|
|
168
|
+
* @param {boolean} [active=true] Whether the item reads as pressed.
|
|
169
|
+
* @returns {this}
|
|
170
|
+
*/
|
|
171
|
+
setActive(name: string, active?: boolean): this;
|
|
172
|
+
/**
|
|
173
|
+
* Removes listeners, the resize observer, the overflow menu, and any DOM changes made to an
|
|
174
|
+
* adopted target.
|
|
175
|
+
* @returns {void}
|
|
176
|
+
*/
|
|
177
|
+
destroy(): void;
|
|
178
|
+
}
|
|
179
|
+
export type ToolbarRecord = {
|
|
180
|
+
/**
|
|
181
|
+
* Entry kind.
|
|
182
|
+
*/
|
|
183
|
+
type: 'separator' | 'element' | 'descriptor';
|
|
184
|
+
/**
|
|
185
|
+
* Rendered element.
|
|
186
|
+
*/
|
|
187
|
+
element: Element;
|
|
188
|
+
/**
|
|
189
|
+
* Lookup name.
|
|
190
|
+
*/
|
|
191
|
+
name: string | null;
|
|
192
|
+
/**
|
|
193
|
+
* Label mirrored into the overflow menu.
|
|
194
|
+
*/
|
|
195
|
+
label: string;
|
|
196
|
+
/**
|
|
197
|
+
* Icon name mirrored into the overflow menu.
|
|
198
|
+
*/
|
|
199
|
+
icon: string | null;
|
|
200
|
+
/**
|
|
201
|
+
* Descriptor callback.
|
|
202
|
+
*/
|
|
203
|
+
onclick: ((event: MouseEvent) => void) | null;
|
|
204
|
+
/**
|
|
205
|
+
* Whether the caller handed the item over already hidden.
|
|
206
|
+
*/
|
|
207
|
+
userHidden: boolean;
|
|
208
|
+
};
|
|
209
|
+
/**
|
|
210
|
+
* Emitted when a descriptor-built item is activated, from the toolbar or from the overflow menu.
|
|
211
|
+
* @event Toolbar#action
|
|
212
|
+
* @type {CustomEvent<{name: string|null, item: Element}>}
|
|
213
|
+
*/
|
|
214
|
+
/**
|
|
215
|
+
* @typedef {Object} ToolbarRecord
|
|
216
|
+
* @property {'separator'|'element'|'descriptor'} type Entry kind.
|
|
217
|
+
* @property {Element} element Rendered element.
|
|
218
|
+
* @property {string|null} name Lookup name.
|
|
219
|
+
* @property {string} label Label mirrored into the overflow menu.
|
|
220
|
+
* @property {string|null} icon Icon name mirrored into the overflow menu.
|
|
221
|
+
* @property {((event: MouseEvent) => void)|null} onclick Descriptor callback.
|
|
222
|
+
* @property {boolean} userHidden Whether the caller handed the item over already hidden.
|
|
223
|
+
*/
|
|
224
|
+
/**
|
|
225
|
+
* Normalizes a raw item list: drops nullish entries, classifies each item, and collapses leading,
|
|
226
|
+
* trailing, and repeated separators. Pure — it touches no DOM.
|
|
227
|
+
* @param {ToolbarItem[]} list Raw item list.
|
|
228
|
+
* @returns {ToolbarEntry[]}
|
|
229
|
+
*/
|
|
230
|
+
export declare function normalizeItems(list: ToolbarItem[]): ToolbarEntry[];
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type TooltipContentValue = string | number | Node | {
|
|
3
|
+
toElement: () => Node | null;
|
|
4
|
+
} | null;
|
|
5
|
+
export type TooltipContent = TooltipContentValue | (() => TooltipContentValue);
|
|
6
|
+
export type TooltipOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Bubble content, re-evaluated on each open when a function.
|
|
9
|
+
*/
|
|
10
|
+
content?: TooltipContent;
|
|
11
|
+
/**
|
|
12
|
+
* Preferred side; flips when it would overflow.
|
|
13
|
+
*/
|
|
14
|
+
placement?: 'top' | 'bottom' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
|
|
15
|
+
/**
|
|
16
|
+
* Gap between anchor and bubble in pixels.
|
|
17
|
+
*/
|
|
18
|
+
offset?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Delay before a hover opens the tooltip, in milliseconds.
|
|
21
|
+
*/
|
|
22
|
+
delay?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Delay before a leave or blur closes it, in milliseconds.
|
|
25
|
+
*/
|
|
26
|
+
hideDelay?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Maximum bubble width; a number is pixels, a string is any CSS length.
|
|
29
|
+
*/
|
|
30
|
+
maxWidth?: number | string;
|
|
31
|
+
/**
|
|
32
|
+
* Which interactions open the tooltip.
|
|
33
|
+
*/
|
|
34
|
+
trigger?: 'hover' | 'focus' | 'both' | 'manual';
|
|
35
|
+
/**
|
|
36
|
+
* Whether the tooltip starts suppressed.
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Open event listener.
|
|
41
|
+
*/
|
|
42
|
+
onopen?: (event: CustomEvent<Record<string, never>>) => void;
|
|
43
|
+
/**
|
|
44
|
+
* Close event listener.
|
|
45
|
+
*/
|
|
46
|
+
onclose?: (event: CustomEvent<Record<string, never>>) => void;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {string|number|Node|{toElement: () => Node|null}|null} TooltipContentValue
|
|
50
|
+
* A value the tooltip can render: text, a node, or anything exposing `toElement()`.
|
|
51
|
+
*/
|
|
52
|
+
/**
|
|
53
|
+
* @typedef {TooltipContentValue|(() => TooltipContentValue)} TooltipContent
|
|
54
|
+
* Tooltip content, or a function returning it. A function is called on every open, so a tooltip
|
|
55
|
+
* can describe state that changes between hovers.
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* @typedef {Object} TooltipOptions
|
|
59
|
+
* @property {TooltipContent} [content=''] Bubble content, re-evaluated on each open when a function.
|
|
60
|
+
* @property {'top'|'bottom'|'top-start'|'top-end'|'bottom-start'|'bottom-end'} [placement='top'] Preferred side; flips when it would overflow.
|
|
61
|
+
* @property {number} [offset=6] Gap between anchor and bubble in pixels.
|
|
62
|
+
* @property {number} [delay=400] Delay before a hover opens the tooltip, in milliseconds.
|
|
63
|
+
* @property {number} [hideDelay=80] Delay before a leave or blur closes it, in milliseconds.
|
|
64
|
+
* @property {number|string} [maxWidth=260] Maximum bubble width; a number is pixels, a string is any CSS length.
|
|
65
|
+
* @property {'hover'|'focus'|'both'|'manual'} [trigger='both'] Which interactions open the tooltip.
|
|
66
|
+
* @property {boolean} [disabled=false] Whether the tooltip starts suppressed.
|
|
67
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onopen] Open event listener.
|
|
68
|
+
* @property {(event: CustomEvent<Record<string, never>>) => void} [onclose] Close event listener.
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* A non-interactive description bubble anchored to another element.
|
|
72
|
+
*
|
|
73
|
+
* The bubble is a manual popover in the top layer, positioned by `position()` from the kernel, so
|
|
74
|
+
* it escapes clipping and stacking contexts and flips near a viewport edge. It never takes focus
|
|
75
|
+
* and never receives pointer events: it describes the anchor rather than adding a target of its
|
|
76
|
+
* own. While open, the anchor carries `aria-describedby` pointing at the bubble; closing restores
|
|
77
|
+
* whatever the anchor had before — including nothing at all.
|
|
78
|
+
*
|
|
79
|
+
* A hover opens it after `delay`; keyboard focus opens it at once, because a keyboard user has no
|
|
80
|
+
* way to "hover a little longer". Touch never opens it: a bubble that cannot be dismissed by
|
|
81
|
+
* moving the pointer away would simply stick, so touch pointers are ignored and the anchor is left
|
|
82
|
+
* to its own label.
|
|
83
|
+
* @fires Tooltip#open
|
|
84
|
+
* @fires Tooltip#close
|
|
85
|
+
* @extends {Component<TooltipOptions>}
|
|
86
|
+
*/
|
|
87
|
+
export declare class Tooltip extends Component<TooltipOptions> {
|
|
88
|
+
#private;
|
|
89
|
+
static cssName: string;
|
|
90
|
+
/** @type {Readonly<TooltipOptions>} */
|
|
91
|
+
static defaults: Readonly<TooltipOptions>;
|
|
92
|
+
/**
|
|
93
|
+
* Attaches a tooltip to an existing element.
|
|
94
|
+
* @param {Element|string} anchor Anchor element or selector.
|
|
95
|
+
* @param {TooltipOptions} [options={}] Tooltip options.
|
|
96
|
+
*/
|
|
97
|
+
constructor(anchor: Element | string, options?: TooltipOptions);
|
|
98
|
+
/**
|
|
99
|
+
* Creates the owned bubble. Runs inside the base constructor, so it touches nothing but the DOM.
|
|
100
|
+
* @returns {HTMLElement}
|
|
101
|
+
*/
|
|
102
|
+
render(): HTMLElement;
|
|
103
|
+
/**
|
|
104
|
+
* Opens the tooltip, evaluating the content first. Does nothing while disabled, already open, or
|
|
105
|
+
* when the content resolves to nothing.
|
|
106
|
+
* @returns {this}
|
|
107
|
+
* @fires Tooltip#open
|
|
108
|
+
*/
|
|
109
|
+
show(): this;
|
|
110
|
+
/**
|
|
111
|
+
* Closes the tooltip and restores the anchor's original `aria-describedby`.
|
|
112
|
+
* @returns {this}
|
|
113
|
+
* @fires Tooltip#close
|
|
114
|
+
*/
|
|
115
|
+
hide(): this;
|
|
116
|
+
/**
|
|
117
|
+
* Opens a closed tooltip, closes an open one.
|
|
118
|
+
* @returns {this}
|
|
119
|
+
*/
|
|
120
|
+
toggle(): this;
|
|
121
|
+
/**
|
|
122
|
+
* Reports whether the bubble is currently visible.
|
|
123
|
+
* @returns {boolean}
|
|
124
|
+
*/
|
|
125
|
+
isOpen(): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Replaces the content. Strings are never parsed as HTML. A function is stored, not called, and
|
|
128
|
+
* runs on every subsequent open.
|
|
129
|
+
* @param {TooltipContent} content Next content.
|
|
130
|
+
* @returns {this}
|
|
131
|
+
*/
|
|
132
|
+
setContent(content: TooltipContent): this;
|
|
133
|
+
/**
|
|
134
|
+
* Allows the tooltip to open again.
|
|
135
|
+
* @returns {this}
|
|
136
|
+
*/
|
|
137
|
+
enable(): this;
|
|
138
|
+
/**
|
|
139
|
+
* Suppresses the tooltip and closes it if it is open.
|
|
140
|
+
* @returns {this}
|
|
141
|
+
*/
|
|
142
|
+
disable(): this;
|
|
143
|
+
/**
|
|
144
|
+
* Reports whether the tooltip is currently suppressed.
|
|
145
|
+
* @returns {boolean}
|
|
146
|
+
*/
|
|
147
|
+
isDisabled(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Returns the anchor the tooltip describes.
|
|
150
|
+
* @returns {Element}
|
|
151
|
+
*/
|
|
152
|
+
getAnchor(): Element;
|
|
153
|
+
/**
|
|
154
|
+
* Closes the tooltip, removes the bubble, and puts the anchor's ARIA back as it was found.
|
|
155
|
+
* @returns {void}
|
|
156
|
+
*/
|
|
157
|
+
destroy(): void;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Fired when the bubble becomes visible. Never fired for a `show()` on an open tooltip.
|
|
161
|
+
* @event Tooltip#open
|
|
162
|
+
* @type {CustomEvent<Record<string, never>>}
|
|
163
|
+
*/
|
|
164
|
+
/**
|
|
165
|
+
* Fired when the bubble is hidden. Never fired for a `hide()` on a closed tooltip.
|
|
166
|
+
* @event Tooltip#close
|
|
167
|
+
* @type {CustomEvent<Record<string, never>>}
|
|
168
|
+
*/
|
|
169
|
+
/**
|
|
170
|
+
* Creates a tooltip from either a content value or a full option object.
|
|
171
|
+
* @param {Element|string} anchor Anchor element or selector.
|
|
172
|
+
* @param {TooltipContent|TooltipOptions} [contentOrOptions=''] Content, or tooltip options.
|
|
173
|
+
* @returns {Tooltip}
|
|
174
|
+
*/
|
|
175
|
+
export declare function tooltip(anchor: Element | string, contentOrOptions?: TooltipContent | TooltipOptions): Tooltip;
|
|
176
|
+
/**
|
|
177
|
+
* Attaches a plain-text tooltip with every default in place — the one-liner replacement for a
|
|
178
|
+
* `title` attribute.
|
|
179
|
+
* @param {Element|string} anchor Anchor element or selector.
|
|
180
|
+
* @param {string} text Description text, inserted as a text node.
|
|
181
|
+
* @returns {Tooltip}
|
|
182
|
+
*/
|
|
183
|
+
export declare function describe(anchor: Element | string, text: string): Tooltip;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared helpers for the hierarchical components (`TreeView` and `Finder`). Both take the same
|
|
3
|
+
* nested node shape and the same `valueKey` / `labelKey` / `childrenKey` readers, so the reading
|
|
4
|
+
* and walking logic lives here once.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
export type TreeNode = Record<string, any>;
|
|
8
|
+
export type NodeReader = string | ((node: TreeNode) => unknown);
|
|
9
|
+
export type NodeReaders = {
|
|
10
|
+
/**
|
|
11
|
+
* Node ID.
|
|
12
|
+
*/
|
|
13
|
+
value: (node: TreeNode) => unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Node label.
|
|
16
|
+
*/
|
|
17
|
+
label: (node: TreeNode) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Loaded children, or null when unknown.
|
|
20
|
+
*/
|
|
21
|
+
children: (node: TreeNode) => TreeNode[] | null;
|
|
22
|
+
};
|
|
23
|
+
/** @typedef {Record<string, any>} TreeNode */
|
|
24
|
+
/** @typedef {string|((node: TreeNode) => unknown)} NodeReader */
|
|
25
|
+
/**
|
|
26
|
+
* @typedef {Object} NodeReaders
|
|
27
|
+
* @property {(node: TreeNode) => unknown} value Node ID.
|
|
28
|
+
* @property {(node: TreeNode) => string} label Node label.
|
|
29
|
+
* @property {(node: TreeNode) => TreeNode[]|null} children Loaded children, or null when unknown.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* Builds reader functions for one component's key configuration.
|
|
33
|
+
* @param {{valueKey?: NodeReader, labelKey?: NodeReader, childrenKey?: string}} options Key configuration.
|
|
34
|
+
* @returns {NodeReaders}
|
|
35
|
+
*/
|
|
36
|
+
export declare function createReaders({ valueKey, labelKey, childrenKey }?: {
|
|
37
|
+
valueKey?: NodeReader;
|
|
38
|
+
labelKey?: NodeReader;
|
|
39
|
+
childrenKey?: string;
|
|
40
|
+
}): NodeReaders;
|
|
41
|
+
/**
|
|
42
|
+
* Reports whether a node can have children: it already has some, or it is explicitly marked as a
|
|
43
|
+
* branch whose children have not been loaded yet.
|
|
44
|
+
* @param {TreeNode} node Node to inspect.
|
|
45
|
+
* @param {NodeReaders} readers Node readers.
|
|
46
|
+
* @returns {boolean}
|
|
47
|
+
*/
|
|
48
|
+
export declare function isBranch(node: TreeNode, readers: NodeReaders): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Depth-first walk over every node, deepest last.
|
|
51
|
+
* @param {TreeNode[]} nodes Root nodes.
|
|
52
|
+
* @param {NodeReaders} readers Node readers.
|
|
53
|
+
* @param {(node: TreeNode, context: {level: number, parent: TreeNode|null, index: number, siblings: TreeNode[]}) => void} visit Visitor.
|
|
54
|
+
* @param {{level?: number, parent?: TreeNode|null}} [context={}] Starting context.
|
|
55
|
+
* @returns {void}
|
|
56
|
+
*/
|
|
57
|
+
export declare function walk(nodes: TreeNode[], readers: NodeReaders, visit: (node: TreeNode, context: {
|
|
58
|
+
level: number;
|
|
59
|
+
parent: TreeNode | null;
|
|
60
|
+
index: number;
|
|
61
|
+
siblings: TreeNode[];
|
|
62
|
+
}) => void, { level, parent }?: {
|
|
63
|
+
level?: number;
|
|
64
|
+
parent?: TreeNode | null;
|
|
65
|
+
}): void;
|
|
66
|
+
/**
|
|
67
|
+
* Finds a node by ID anywhere in the tree.
|
|
68
|
+
* @param {TreeNode[]} nodes Root nodes.
|
|
69
|
+
* @param {unknown} id Node ID.
|
|
70
|
+
* @param {NodeReaders} readers Node readers.
|
|
71
|
+
* @returns {TreeNode|null}
|
|
72
|
+
*/
|
|
73
|
+
export declare function findNode(nodes: TreeNode[], id: unknown, readers: NodeReaders): TreeNode | null;
|
|
74
|
+
/**
|
|
75
|
+
* Returns the chain of nodes from a root down to the node with the given ID, inclusive.
|
|
76
|
+
* @param {TreeNode[]} nodes Root nodes.
|
|
77
|
+
* @param {unknown} id Node ID.
|
|
78
|
+
* @param {NodeReaders} readers Node readers.
|
|
79
|
+
* @returns {TreeNode[]} Empty when the ID is not in the tree.
|
|
80
|
+
*/
|
|
81
|
+
export declare function pathTo(nodes: TreeNode[], id: unknown, readers: NodeReaders): TreeNode[];
|
|
82
|
+
/**
|
|
83
|
+
* Returns every descendant of a node, excluding the node itself.
|
|
84
|
+
* @param {TreeNode} node Root of the sub-tree.
|
|
85
|
+
* @param {NodeReaders} readers Node readers.
|
|
86
|
+
* @returns {TreeNode[]}
|
|
87
|
+
*/
|
|
88
|
+
export declare function descendants(node: TreeNode, readers: NodeReaders): TreeNode[];
|
|
89
|
+
/**
|
|
90
|
+
* Flattens the tree to the rows a tree view currently shows: every root, plus the children of
|
|
91
|
+
* every expanded branch. The returned rows carry the ARIA bookkeeping each row needs.
|
|
92
|
+
* @param {TreeNode[]} nodes Root nodes.
|
|
93
|
+
* @param {NodeReaders} readers Node readers.
|
|
94
|
+
* @param {Set<unknown>} expanded IDs of expanded branches.
|
|
95
|
+
* @returns {{node: TreeNode, id: unknown, level: number, parent: TreeNode|null, posinset: number, setsize: number}[]}
|
|
96
|
+
*/
|
|
97
|
+
export declare function flattenVisible(nodes: TreeNode[], readers: NodeReaders, expanded: Set<unknown>): {
|
|
98
|
+
node: TreeNode;
|
|
99
|
+
id: unknown;
|
|
100
|
+
level: number;
|
|
101
|
+
parent: TreeNode | null;
|
|
102
|
+
posinset: number;
|
|
103
|
+
setsize: number;
|
|
104
|
+
}[];
|
|
105
|
+
/**
|
|
106
|
+
* Filters a tree to the nodes matching a predicate, keeping the ancestors that lead to a match.
|
|
107
|
+
* @param {TreeNode[]} nodes Root nodes.
|
|
108
|
+
* @param {NodeReaders} readers Node readers.
|
|
109
|
+
* @param {(node: TreeNode) => boolean} matches Predicate.
|
|
110
|
+
* @param {string} childrenKey Property the filtered children are written to.
|
|
111
|
+
* @returns {TreeNode[]} New nodes; the originals are not mutated.
|
|
112
|
+
*/
|
|
113
|
+
export declare function filterTree(nodes: TreeNode[], readers: NodeReaders, matches: (node: TreeNode) => boolean, childrenKey: string): TreeNode[];
|