@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,200 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
import { MenuButton } from '../menu-button/menu-button.js';
|
|
3
|
+
export type BreadcrumbSeparator = 'chevron' | 'slash';
|
|
4
|
+
export type BreadcrumbItem = {
|
|
5
|
+
/**
|
|
6
|
+
* Stable item name, unique within the trail.
|
|
7
|
+
*/
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Visible label.
|
|
11
|
+
*/
|
|
12
|
+
label: string;
|
|
13
|
+
/**
|
|
14
|
+
* Icon name passed to `icon()`, rendered before the label.
|
|
15
|
+
*/
|
|
16
|
+
icon?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Link destination; items without one render as buttons.
|
|
19
|
+
*/
|
|
20
|
+
href?: string;
|
|
21
|
+
};
|
|
22
|
+
export type NormalizedBreadcrumbItem = {
|
|
23
|
+
/**
|
|
24
|
+
* Stable item name.
|
|
25
|
+
*/
|
|
26
|
+
name: string;
|
|
27
|
+
/**
|
|
28
|
+
* Visible label.
|
|
29
|
+
*/
|
|
30
|
+
label: string;
|
|
31
|
+
/**
|
|
32
|
+
* Icon name, or null.
|
|
33
|
+
*/
|
|
34
|
+
icon: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Link destination, or null.
|
|
37
|
+
*/
|
|
38
|
+
href: string | null;
|
|
39
|
+
};
|
|
40
|
+
export type BreadcrumbOptions = {
|
|
41
|
+
/**
|
|
42
|
+
* Trail from the root to the current page.
|
|
43
|
+
*/
|
|
44
|
+
items?: BreadcrumbItem[];
|
|
45
|
+
/**
|
|
46
|
+
* Number of items rendered inline; 0 renders all of them.
|
|
47
|
+
* Anything in between collapses into an ellipsis menu, always keeping the first and last item.
|
|
48
|
+
* Values below 2 behave as 2.
|
|
49
|
+
*/
|
|
50
|
+
maxVisible?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Glyph drawn between items.
|
|
53
|
+
*/
|
|
54
|
+
separator?: BreadcrumbSeparator;
|
|
55
|
+
/**
|
|
56
|
+
* Icon for the first item when it carries none itself.
|
|
57
|
+
*/
|
|
58
|
+
rootIcon?: string | null;
|
|
59
|
+
/**
|
|
60
|
+
* Localized messages.
|
|
61
|
+
*/
|
|
62
|
+
msg?: Record<string, string> | Record<string, Record<string, string>>;
|
|
63
|
+
/**
|
|
64
|
+
* Selection listener.
|
|
65
|
+
*/
|
|
66
|
+
onselect?: (event: CustomEvent<BreadcrumbSelectDetail>) => void;
|
|
67
|
+
};
|
|
68
|
+
export type BreadcrumbSelectDetail = {
|
|
69
|
+
/**
|
|
70
|
+
* Selected item name.
|
|
71
|
+
*/
|
|
72
|
+
name: string;
|
|
73
|
+
/**
|
|
74
|
+
* Copy of the selected item.
|
|
75
|
+
*/
|
|
76
|
+
item: NormalizedBreadcrumbItem;
|
|
77
|
+
/**
|
|
78
|
+
* Zero-based index in the full trail, collapsed items included.
|
|
79
|
+
*/
|
|
80
|
+
index: number;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The trail of ancestors above the current page. Pairs with {@link Finder} and {@link TreeView}:
|
|
84
|
+
* feed `setItems()` from a `change` event's `nodes`, and turn a `select` back into a path.
|
|
85
|
+
*
|
|
86
|
+
* The last item is the page you are on, so it is plain text marked `aria-current="page"` and never
|
|
87
|
+
* interactive. Every other item is a real `<a>` when it carries an `href` — its navigation is left
|
|
88
|
+
* alone — and a `<button>` otherwise, for trails an application resolves in JavaScript.
|
|
89
|
+
* @fires Breadcrumb#select
|
|
90
|
+
* @extends {Component<BreadcrumbOptions>}
|
|
91
|
+
*/
|
|
92
|
+
export declare class Breadcrumb extends Component<BreadcrumbOptions> {
|
|
93
|
+
_createdRoot: boolean;
|
|
94
|
+
_snapshot: import("../../core/dom.js").TargetSnapshot;
|
|
95
|
+
_destroyed: boolean;
|
|
96
|
+
/** @type {NormalizedBreadcrumbItem[]} */
|
|
97
|
+
_items: NormalizedBreadcrumbItem[];
|
|
98
|
+
/** @type {MenuButton|null} */
|
|
99
|
+
_overflow: MenuButton | null;
|
|
100
|
+
static cssName: string;
|
|
101
|
+
/** @type {Readonly<BreadcrumbOptions>} */
|
|
102
|
+
static defaults: Readonly<BreadcrumbOptions>;
|
|
103
|
+
/**
|
|
104
|
+
* Creates or enhances a breadcrumb trail.
|
|
105
|
+
* @param {Element|string|null} target Existing container, selector, or null.
|
|
106
|
+
* @param {BreadcrumbOptions} [options={}] Breadcrumb options.
|
|
107
|
+
*/
|
|
108
|
+
constructor(target: Element | string | null, options?: BreadcrumbOptions);
|
|
109
|
+
/**
|
|
110
|
+
* Builds the trail. Runs inside the base constructor, so instance state is initialized here.
|
|
111
|
+
* @returns {HTMLElement}
|
|
112
|
+
*/
|
|
113
|
+
render(): HTMLElement;
|
|
114
|
+
/**
|
|
115
|
+
* Replaces the whole trail.
|
|
116
|
+
* @param {BreadcrumbItem[]} list Items from the root to the current page.
|
|
117
|
+
* @returns {this}
|
|
118
|
+
* @throws {TypeError} When the list or an item is malformed.
|
|
119
|
+
* @throws {RangeError} When two items share a name.
|
|
120
|
+
*/
|
|
121
|
+
setItems(list: BreadcrumbItem[]): this;
|
|
122
|
+
/**
|
|
123
|
+
* Returns a copy of the trail.
|
|
124
|
+
* @returns {NormalizedBreadcrumbItem[]}
|
|
125
|
+
*/
|
|
126
|
+
getItems(): NormalizedBreadcrumbItem[];
|
|
127
|
+
/**
|
|
128
|
+
* Appends one level, which becomes the current page.
|
|
129
|
+
* @param {BreadcrumbItem} item Item to append.
|
|
130
|
+
* @returns {this}
|
|
131
|
+
*/
|
|
132
|
+
push(item: BreadcrumbItem): this;
|
|
133
|
+
/**
|
|
134
|
+
* Removes the deepest level.
|
|
135
|
+
* @returns {NormalizedBreadcrumbItem|null} The removed item, or null when the trail was empty.
|
|
136
|
+
*/
|
|
137
|
+
pop(): NormalizedBreadcrumbItem | null;
|
|
138
|
+
/**
|
|
139
|
+
* Drops every level below a named item, making it the current page.
|
|
140
|
+
* @param {string} name Item name.
|
|
141
|
+
* @returns {this}
|
|
142
|
+
* @throws {RangeError} When no item carries that name.
|
|
143
|
+
*/
|
|
144
|
+
truncateTo(name: string): this;
|
|
145
|
+
/**
|
|
146
|
+
* Destroys the overflow menu, aborts listeners, and restores an enhanced target.
|
|
147
|
+
* @returns {void}
|
|
148
|
+
*/
|
|
149
|
+
destroy(): void;
|
|
150
|
+
/**
|
|
151
|
+
* Rebuilds the list from the current items.
|
|
152
|
+
* @returns {void}
|
|
153
|
+
*/
|
|
154
|
+
_build(): void;
|
|
155
|
+
/**
|
|
156
|
+
* Splits the trail into the inline head, the collapsed middle, and the inline tail.
|
|
157
|
+
* @returns {{head: NormalizedBreadcrumbItem[], hidden: NormalizedBreadcrumbItem[], tail: NormalizedBreadcrumbItem[]}}
|
|
158
|
+
*/
|
|
159
|
+
_split(): {
|
|
160
|
+
head: NormalizedBreadcrumbItem[];
|
|
161
|
+
hidden: NormalizedBreadcrumbItem[];
|
|
162
|
+
tail: NormalizedBreadcrumbItem[];
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* @param {NormalizedBreadcrumbItem} item Item to render.
|
|
166
|
+
* @param {boolean} current Whether this is the page the user is on.
|
|
167
|
+
* @returns {HTMLElement}
|
|
168
|
+
*/
|
|
169
|
+
_renderItem(item: NormalizedBreadcrumbItem, current: boolean): HTMLElement;
|
|
170
|
+
/**
|
|
171
|
+
* Renders (and, on first use, creates) the ellipsis menu holding the collapsed levels. The
|
|
172
|
+
* MenuButton is kept for the component's lifetime because its dropdown panel lives on
|
|
173
|
+
* `document.body`; rebuilding the trail only refills its items.
|
|
174
|
+
* @param {NormalizedBreadcrumbItem[]} hidden Collapsed items.
|
|
175
|
+
* @returns {HTMLElement}
|
|
176
|
+
*/
|
|
177
|
+
_renderOverflow(hidden: NormalizedBreadcrumbItem[]): HTMLElement;
|
|
178
|
+
/** @returns {HTMLElement} */
|
|
179
|
+
_renderSeparator(): HTMLElement;
|
|
180
|
+
/**
|
|
181
|
+
* @param {string|undefined} name Item name from a control's `data-crumb`.
|
|
182
|
+
* @returns {void}
|
|
183
|
+
* @fires Breadcrumb#select
|
|
184
|
+
*/
|
|
185
|
+
_select(name: string | undefined): void;
|
|
186
|
+
/**
|
|
187
|
+
* Resolves a message through the host translator, falling back to the built-in English text.
|
|
188
|
+
* @param {string} key Message key.
|
|
189
|
+
* @param {string} fallback Built-in text, with `%1`-style placeholders.
|
|
190
|
+
* @param {...unknown} args Interpolation values.
|
|
191
|
+
* @returns {string}
|
|
192
|
+
*/
|
|
193
|
+
_message(key: string, fallback: string, ...args: unknown[]): string;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Fired when an interactive crumb is chosen, from the trail itself or from the overflow menu. A
|
|
197
|
+
* crumb with an `href` still navigates: the event reports the choice, it does not gate it.
|
|
198
|
+
* @event Breadcrumb#select
|
|
199
|
+
* @type {CustomEvent<BreadcrumbSelectDetail>}
|
|
200
|
+
*/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type ButtonOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Visible button label.
|
|
4
|
+
*/
|
|
5
|
+
label?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Icon name from `icons.js`.
|
|
8
|
+
*/
|
|
9
|
+
icon?: string | null;
|
|
10
|
+
/**
|
|
11
|
+
* Visual intent.
|
|
12
|
+
*/
|
|
13
|
+
kind?: 'default' | 'primary' | 'danger' | 'ghost';
|
|
14
|
+
/**
|
|
15
|
+
* Control size.
|
|
16
|
+
*/
|
|
17
|
+
size?: 'md' | 'sm';
|
|
18
|
+
/**
|
|
19
|
+
* Whether the button is disabled.
|
|
20
|
+
*/
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Native title text.
|
|
24
|
+
*/
|
|
25
|
+
title?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Click callback.
|
|
28
|
+
*/
|
|
29
|
+
onclick?: (event: MouseEvent) => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Creates a styled native button.
|
|
33
|
+
* @param {ButtonOptions} [opts={}] Button options.
|
|
34
|
+
* @returns {HTMLButtonElement}
|
|
35
|
+
*/
|
|
36
|
+
export declare function button(opts?: ButtonOptions): HTMLButtonElement;
|
|
37
|
+
/**
|
|
38
|
+
* Groups buttons into a joined control.
|
|
39
|
+
* @param {HTMLButtonElement[]} buttons Buttons to group.
|
|
40
|
+
* @returns {HTMLDivElement}
|
|
41
|
+
*/
|
|
42
|
+
export declare function buttonGroup(buttons: HTMLButtonElement[]): HTMLDivElement;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type CheckButtonOptions = {
|
|
3
|
+
/**
|
|
4
|
+
* A shared label or `[onLabel, offLabel]`.
|
|
5
|
+
*/
|
|
6
|
+
label?: string | [string, string];
|
|
7
|
+
/**
|
|
8
|
+
* Initial pressed state.
|
|
9
|
+
*/
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Whether to show the check indicator.
|
|
13
|
+
*/
|
|
14
|
+
icon?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Initial disabled state.
|
|
17
|
+
*/
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Change callback.
|
|
21
|
+
*/
|
|
22
|
+
onchange?: (event: CustomEvent<{
|
|
23
|
+
checked: boolean;
|
|
24
|
+
}>) => void;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} CheckButtonOptions
|
|
28
|
+
* @property {string|[string, string]} [label=''] A shared label or `[onLabel, offLabel]`.
|
|
29
|
+
* @property {boolean} [checked=false] Initial pressed state.
|
|
30
|
+
* @property {boolean} [icon=true] Whether to show the check indicator.
|
|
31
|
+
* @property {boolean} [disabled=false] Initial disabled state.
|
|
32
|
+
* @property {(event: CustomEvent<{checked: boolean}>) => void} [onchange] Change callback.
|
|
33
|
+
*/
|
|
34
|
+
/**
|
|
35
|
+
* Two-state native press button.
|
|
36
|
+
* @fires CheckButton#change
|
|
37
|
+
* @extends {Component<CheckButtonOptions>}
|
|
38
|
+
*/
|
|
39
|
+
export declare class CheckButton extends Component<CheckButtonOptions> {
|
|
40
|
+
_createdRoot: boolean;
|
|
41
|
+
_original: {
|
|
42
|
+
attributes: [string, string][];
|
|
43
|
+
children: Node[];
|
|
44
|
+
};
|
|
45
|
+
_checked: any;
|
|
46
|
+
_disabled: boolean;
|
|
47
|
+
_labels: {
|
|
48
|
+
on: string;
|
|
49
|
+
off: string;
|
|
50
|
+
};
|
|
51
|
+
_cleaned: boolean;
|
|
52
|
+
static cssName: string;
|
|
53
|
+
/** @type {Readonly<CheckButtonOptions>} */
|
|
54
|
+
static defaults: Readonly<CheckButtonOptions>;
|
|
55
|
+
/** @returns {HTMLButtonElement} */
|
|
56
|
+
render(): HTMLButtonElement;
|
|
57
|
+
/**
|
|
58
|
+
* Returns the current pressed state.
|
|
59
|
+
* @returns {boolean}
|
|
60
|
+
*/
|
|
61
|
+
get(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the pressed state.
|
|
64
|
+
* @param {boolean} checked Next state.
|
|
65
|
+
* @param {{silent?: boolean}} [options={}] Set `silent` to suppress `change`.
|
|
66
|
+
* @returns {this}
|
|
67
|
+
* @fires CheckButton#change
|
|
68
|
+
*/
|
|
69
|
+
set(checked: boolean, { silent }?: {
|
|
70
|
+
silent?: boolean;
|
|
71
|
+
}): this;
|
|
72
|
+
/**
|
|
73
|
+
* Toggles the pressed state.
|
|
74
|
+
* @returns {this}
|
|
75
|
+
* @fires CheckButton#change
|
|
76
|
+
*/
|
|
77
|
+
toggle(): this;
|
|
78
|
+
/**
|
|
79
|
+
* Replaces the state labels.
|
|
80
|
+
* @param {string|[string, string]} label A shared label or `[onLabel, offLabel]`.
|
|
81
|
+
* @returns {this}
|
|
82
|
+
*/
|
|
83
|
+
setLabel(label: string | [string, string]): this;
|
|
84
|
+
/**
|
|
85
|
+
* Enables user interaction.
|
|
86
|
+
* @returns {this}
|
|
87
|
+
*/
|
|
88
|
+
enable(): this;
|
|
89
|
+
/**
|
|
90
|
+
* Disables user interaction.
|
|
91
|
+
* @returns {this}
|
|
92
|
+
*/
|
|
93
|
+
disable(): this;
|
|
94
|
+
/** @returns {void} */
|
|
95
|
+
destroy(): void;
|
|
96
|
+
/** @returns {void} */
|
|
97
|
+
_sync(): void;
|
|
98
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type ChecklistItem = Record<string, any> | string | number | boolean | symbol | bigint | null | undefined;
|
|
3
|
+
export type ChecklistOptions = {
|
|
4
|
+
/**
|
|
5
|
+
* Available checkbox items.
|
|
6
|
+
*/
|
|
7
|
+
items?: ChecklistItem[];
|
|
8
|
+
/**
|
|
9
|
+
* Item ID property or reader.
|
|
10
|
+
*/
|
|
11
|
+
valueKey?: string | ((item: ChecklistItem) => unknown);
|
|
12
|
+
/**
|
|
13
|
+
* Item label property or reader.
|
|
14
|
+
*/
|
|
15
|
+
labelKey?: string | ((item: ChecklistItem) => string);
|
|
16
|
+
/**
|
|
17
|
+
* Initial checked-state property or reader.
|
|
18
|
+
*/
|
|
19
|
+
checkedKey?: string | ((item: ChecklistItem) => unknown);
|
|
20
|
+
/**
|
|
21
|
+
* Whether the search field is shown.
|
|
22
|
+
*/
|
|
23
|
+
search?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum list height in pixels.
|
|
26
|
+
*/
|
|
27
|
+
height?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Fallback initial checked state.
|
|
30
|
+
*/
|
|
31
|
+
defaultChecked?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Async item loader.
|
|
34
|
+
*/
|
|
35
|
+
load?: (() => Promise<ChecklistItem[]> | ChecklistItem[]) | null;
|
|
36
|
+
/**
|
|
37
|
+
* Localized messages.
|
|
38
|
+
*/
|
|
39
|
+
msg?: Record<string, string> | Record<string, Record<string, string>>;
|
|
40
|
+
/**
|
|
41
|
+
* Change listener.
|
|
42
|
+
*/
|
|
43
|
+
onchange?: (event: CustomEvent<ChecklistChangeDetail>) => void;
|
|
44
|
+
/**
|
|
45
|
+
* Loaded listener.
|
|
46
|
+
*/
|
|
47
|
+
onloaded?: (event: CustomEvent<ChecklistLoadedDetail>) => void;
|
|
48
|
+
};
|
|
49
|
+
export type ChecklistChangeDetail = {
|
|
50
|
+
values: unknown[];
|
|
51
|
+
};
|
|
52
|
+
export type ChecklistLoadedDetail = {
|
|
53
|
+
items: ChecklistItem[];
|
|
54
|
+
};
|
|
55
|
+
/** @typedef {Record<string, any>|string|number|boolean|symbol|bigint|null|undefined} ChecklistItem */
|
|
56
|
+
/**
|
|
57
|
+
* @typedef {Object} ChecklistOptions
|
|
58
|
+
* @property {ChecklistItem[]} [items=[]] Available checkbox items.
|
|
59
|
+
* @property {string|((item: ChecklistItem) => unknown)} [valueKey='ID'] Item ID property or reader.
|
|
60
|
+
* @property {string|((item: ChecklistItem) => string)} [labelKey='name'] Item label property or reader.
|
|
61
|
+
* @property {string|((item: ChecklistItem) => unknown)} [checkedKey='on'] Initial checked-state property or reader.
|
|
62
|
+
* @property {boolean} [search=true] Whether the search field is shown.
|
|
63
|
+
* @property {number} [height=280] Maximum list height in pixels.
|
|
64
|
+
* @property {boolean} [defaultChecked=false] Fallback initial checked state.
|
|
65
|
+
* @property {(() => Promise<ChecklistItem[]>|ChecklistItem[])|null} [load=null] Async item loader.
|
|
66
|
+
* @property {Record<string, string>|Record<string, Record<string, string>>} [msg] Localized messages.
|
|
67
|
+
* @property {(event: CustomEvent<ChecklistChangeDetail>) => void} [onchange] Change listener.
|
|
68
|
+
* @property {(event: CustomEvent<ChecklistLoadedDetail>) => void} [onloaded] Loaded listener.
|
|
69
|
+
*/
|
|
70
|
+
/** @typedef {{values: unknown[]}} ChecklistChangeDetail */
|
|
71
|
+
/** @typedef {{items: ChecklistItem[]}} ChecklistLoadedDetail */
|
|
72
|
+
/**
|
|
73
|
+
* Searchable native-checkbox group.
|
|
74
|
+
*
|
|
75
|
+
* @fires Checklist#change
|
|
76
|
+
* @fires Checklist#loaded
|
|
77
|
+
* @extends {Component<ChecklistOptions>}
|
|
78
|
+
*/
|
|
79
|
+
export declare class Checklist extends Component<ChecklistOptions> {
|
|
80
|
+
_items: any[] | ChecklistItem[];
|
|
81
|
+
_visibleItems: any[];
|
|
82
|
+
_checked: Set<any> | Set<unknown>;
|
|
83
|
+
_query: string;
|
|
84
|
+
_loadSequence: number;
|
|
85
|
+
_createdRoot: boolean;
|
|
86
|
+
_active: boolean;
|
|
87
|
+
_originalChildren: any[] | ChildNode[];
|
|
88
|
+
_originalAttributes: Map<any, any>;
|
|
89
|
+
static cssName: string;
|
|
90
|
+
/** @type {ChecklistOptions} */
|
|
91
|
+
static defaults: ChecklistOptions;
|
|
92
|
+
/** @returns {HTMLElement} */
|
|
93
|
+
render(): HTMLElement;
|
|
94
|
+
/**
|
|
95
|
+
* Replaces items and derives checked state from `checkedKey` and `defaultChecked`.
|
|
96
|
+
* @param {ChecklistItem[]} items New items.
|
|
97
|
+
* @returns {this}
|
|
98
|
+
*/
|
|
99
|
+
setItems(items: ChecklistItem[]): this;
|
|
100
|
+
/** Returns checked IDs in item order. @returns {unknown[]} */
|
|
101
|
+
getValues(): unknown[];
|
|
102
|
+
/**
|
|
103
|
+
* Replaces the checked IDs.
|
|
104
|
+
* @param {Iterable<unknown>|unknown[]} ids Checked item IDs.
|
|
105
|
+
* @returns {this}
|
|
106
|
+
* @fires Checklist#change
|
|
107
|
+
*/
|
|
108
|
+
setValues(ids: Iterable<unknown> | unknown[]): this;
|
|
109
|
+
/** Checks every item. @returns {this} @fires Checklist#change */
|
|
110
|
+
checkAll(): this;
|
|
111
|
+
/** Unchecks every item. @returns {this} @fires Checklist#change */
|
|
112
|
+
uncheckAll(): this;
|
|
113
|
+
/**
|
|
114
|
+
* Filters visible items by label.
|
|
115
|
+
* @param {string} query Search text.
|
|
116
|
+
* @returns {this}
|
|
117
|
+
*/
|
|
118
|
+
search(query: string): this;
|
|
119
|
+
/**
|
|
120
|
+
* Reloads items through the configured async loader.
|
|
121
|
+
* @returns {Promise<this>}
|
|
122
|
+
* @fires Checklist#loaded
|
|
123
|
+
*/
|
|
124
|
+
reload(): Promise<this>;
|
|
125
|
+
/** Restores an enhanced target and invalidates pending loads. @returns {void} */
|
|
126
|
+
destroy(): void;
|
|
127
|
+
/** @param {ChecklistItem[]} items @returns {void} */
|
|
128
|
+
_replaceItems(items: ChecklistItem[]): void;
|
|
129
|
+
/** @returns {void} */
|
|
130
|
+
_renderItems(): void;
|
|
131
|
+
/** @param {Set<unknown>} next @returns {void} */
|
|
132
|
+
_replaceChecked(next: Set<unknown>): void;
|
|
133
|
+
/** @param {ChecklistItem} item @returns {unknown} */
|
|
134
|
+
_itemValue(item: ChecklistItem): unknown;
|
|
135
|
+
/** @param {ChecklistItem} item @returns {string} */
|
|
136
|
+
_itemLabel(item: ChecklistItem): string;
|
|
137
|
+
/** @param {ChecklistItem} item @returns {unknown} */
|
|
138
|
+
_initialChecked(item: ChecklistItem): unknown;
|
|
139
|
+
/** @param {ChecklistItem} item @param {string|((item: ChecklistItem) => unknown)} reader @returns {unknown} */
|
|
140
|
+
_read(item: ChecklistItem, reader: string | ((item: ChecklistItem) => unknown)): unknown;
|
|
141
|
+
/** @param {string} key @param {string} fallback @returns {string} */
|
|
142
|
+
_message(key: string, fallback: string): string;
|
|
143
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Component } from '../../core/component.js';
|
|
2
|
+
export type MenuItem = import('../menu-button/menu-button.js').MenuItem;
|
|
3
|
+
export type ContextMenuEntry = MenuItem | '-';
|
|
4
|
+
export type ContextMenuOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Menu
|
|
7
|
+
* items and `'-'` separators, or a function returning them for the element the menu is opening
|
|
8
|
+
* on — which is how a row menu disables the actions that row does not allow. Returning an empty
|
|
9
|
+
* array cancels the opening.
|
|
10
|
+
*/
|
|
11
|
+
items?: ContextMenuEntry[] | ((context: Element | null) => ContextMenuEntry[]);
|
|
12
|
+
/**
|
|
13
|
+
* Restricts the menu to descendants matching this
|
|
14
|
+
* selector, and reports the matched element as the context of the selection. A table passes
|
|
15
|
+
* `'tbody tr'` here to get a per-row menu from one listener.
|
|
16
|
+
*/
|
|
17
|
+
selector?: string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Selection listener.
|
|
20
|
+
*/
|
|
21
|
+
onselect?: (event: CustomEvent<{
|
|
22
|
+
value: unknown;
|
|
23
|
+
item: MenuItem;
|
|
24
|
+
context: Element | null;
|
|
25
|
+
}>) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Open listener.
|
|
28
|
+
*/
|
|
29
|
+
onopen?: (event: CustomEvent<{
|
|
30
|
+
context: Element | null;
|
|
31
|
+
}>) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Close listener.
|
|
34
|
+
*/
|
|
35
|
+
onclose?: (event: CustomEvent<Record<string, never>>) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Right-click menu for a region, implementing the APG menu pattern.
|
|
39
|
+
*
|
|
40
|
+
* Attaches to an existing element and never changes it: the menu itself lives in the top layer,
|
|
41
|
+
* anchored to a zero-sized element parked at the pointer. `selector` turns one instance into a
|
|
42
|
+
* per-row menu — the listener stays on the container, and the row that was clicked arrives with
|
|
43
|
+
* the selection as `context`.
|
|
44
|
+
*
|
|
45
|
+
* Reachable from the keyboard as the platform expects: the Menu key or Shift+F10 opens the menu at
|
|
46
|
+
* the focused element, and closing returns focus to where it came from. Pointer-only context
|
|
47
|
+
* menus are a common accessibility failure, so both routes are wired here rather than left to the
|
|
48
|
+
* application.
|
|
49
|
+
*
|
|
50
|
+
* Note that the component's root is the anchor, which lives on `<body>` — so the bubbling `zx-*`
|
|
51
|
+
* DOM events land there, not in the target's tree. Listen with `on('select')` or `onselect`.
|
|
52
|
+
*
|
|
53
|
+
* @fires ContextMenu#select
|
|
54
|
+
* @fires ContextMenu#open
|
|
55
|
+
* @fires ContextMenu#close
|
|
56
|
+
* @extends {Component<ContextMenuOptions>}
|
|
57
|
+
*/
|
|
58
|
+
export declare class ContextMenu extends Component<ContextMenuOptions> {
|
|
59
|
+
#private;
|
|
60
|
+
/** @type {ContextMenuOptions} */
|
|
61
|
+
static defaults: ContextMenuOptions;
|
|
62
|
+
/**
|
|
63
|
+
* Attaches a context menu to an existing element.
|
|
64
|
+
* @param {Element|string} target Element or selector the menu belongs to.
|
|
65
|
+
* @param {ContextMenuOptions} [options={}] Context-menu options.
|
|
66
|
+
*/
|
|
67
|
+
constructor(target: Element | string, options?: ContextMenuOptions);
|
|
68
|
+
/**
|
|
69
|
+
* Creates the zero-sized element the menu is anchored to.
|
|
70
|
+
* @returns {HTMLElement}
|
|
71
|
+
*/
|
|
72
|
+
render(): HTMLElement;
|
|
73
|
+
/**
|
|
74
|
+
* Replaces the menu items.
|
|
75
|
+
* @param {ContextMenuEntry[]} items Menu definitions.
|
|
76
|
+
* @returns {this}
|
|
77
|
+
*/
|
|
78
|
+
setItems(items: ContextMenuEntry[]): this;
|
|
79
|
+
/**
|
|
80
|
+
* Opens the menu at a point in viewport coordinates.
|
|
81
|
+
* @param {number} x Client X.
|
|
82
|
+
* @param {number} y Client Y.
|
|
83
|
+
* @param {Element|null} [context=null] Element the menu applies to.
|
|
84
|
+
* @returns {this}
|
|
85
|
+
* @fires ContextMenu#open
|
|
86
|
+
*/
|
|
87
|
+
openAt(x: number, y: number, context?: Element | null): this;
|
|
88
|
+
/**
|
|
89
|
+
* Opens the menu against an element's box, which is where a keyboard invocation puts it.
|
|
90
|
+
* @param {Element} element Element to anchor to.
|
|
91
|
+
* @returns {this}
|
|
92
|
+
* @fires ContextMenu#open
|
|
93
|
+
*/
|
|
94
|
+
openAtElement(element: Element): this;
|
|
95
|
+
/**
|
|
96
|
+
* Closes the menu.
|
|
97
|
+
* @returns {this}
|
|
98
|
+
*/
|
|
99
|
+
close(): this;
|
|
100
|
+
/**
|
|
101
|
+
* Reports whether the menu is open.
|
|
102
|
+
* @returns {boolean}
|
|
103
|
+
*/
|
|
104
|
+
isOpen(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The element the open menu applies to — the `selector` match under the pointer, or the target.
|
|
107
|
+
* @returns {Element|null}
|
|
108
|
+
*/
|
|
109
|
+
getContext(): Element | null;
|
|
110
|
+
/**
|
|
111
|
+
* Detaches the menu and removes its anchor.
|
|
112
|
+
* @returns {void}
|
|
113
|
+
*/
|
|
114
|
+
destroy(): void;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Fired when an enabled item is activated. `context` is the element the menu was opened on.
|
|
118
|
+
* @event ContextMenu#select
|
|
119
|
+
* @type {CustomEvent<{value: unknown, item: MenuItem, context: Element|null}>}
|
|
120
|
+
*/
|
|
121
|
+
/**
|
|
122
|
+
* Fired when the menu opens.
|
|
123
|
+
* @event ContextMenu#open
|
|
124
|
+
* @type {CustomEvent<{context: Element|null}>}
|
|
125
|
+
*/
|
|
126
|
+
/**
|
|
127
|
+
* Fired when the menu closes.
|
|
128
|
+
* @event ContextMenu#close
|
|
129
|
+
* @type {CustomEvent<Record<string, never>>}
|
|
130
|
+
*/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export type CopyButtonOptions = {
|
|
2
|
+
/**
|
|
3
|
+
* Text to copy, or a function returning it — a
|
|
4
|
+
* function is what a button beside a live value wants, so the copy is never stale.
|
|
5
|
+
*/
|
|
6
|
+
text?: string | (() => string);
|
|
7
|
+
/**
|
|
8
|
+
* Visible label. Empty renders an icon-only ghost button.
|
|
9
|
+
*/
|
|
10
|
+
label?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Accessible name, and the native tooltip on the icon-only form.
|
|
13
|
+
*/
|
|
14
|
+
title?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Confirmation announced and shown after a copy.
|
|
17
|
+
*/
|
|
18
|
+
feedback?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Milliseconds the confirmation stays.
|
|
21
|
+
*/
|
|
22
|
+
feedbackDuration?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Control size.
|
|
25
|
+
*/
|
|
26
|
+
size?: 'md' | 'sm';
|
|
27
|
+
/**
|
|
28
|
+
* Visual intent.
|
|
29
|
+
*/
|
|
30
|
+
kind?: 'default' | 'primary' | 'ghost';
|
|
31
|
+
/**
|
|
32
|
+
* Called with the text and whether
|
|
33
|
+
* the clipboard accepted it.
|
|
34
|
+
*/
|
|
35
|
+
oncopy?: (text: string, copied: boolean) => void;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Creates a button that copies a string and confirms it in place.
|
|
39
|
+
*
|
|
40
|
+
* The confirmation is the point: a clipboard write is silent, so without it nobody knows whether
|
|
41
|
+
* the click worked. It swaps the glyph for a tick and speaks through a live region, then reverts.
|
|
42
|
+
* A failed write — no permission, an insecure context — leaves the button untouched and reports
|
|
43
|
+
* `false` to `oncopy`, rather than claiming a copy that did not happen.
|
|
44
|
+
*
|
|
45
|
+
* @param {CopyButtonOptions} [opts={}] Copy-button options.
|
|
46
|
+
* @returns {HTMLButtonElement}
|
|
47
|
+
*/
|
|
48
|
+
export declare function copyButton(opts?: CopyButtonOptions): HTMLButtonElement;
|