@deepfuture/dui-components 0.0.21 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -65
- package/_install.js +11 -0
- package/accordion/accordion-item.d.ts +3 -20
- package/accordion/accordion-item.js +93 -292
- package/accordion/accordion.d.ts +3 -18
- package/accordion/accordion.js +9 -247
- package/accordion/index.d.ts +6 -6
- package/accordion/index.js +5 -5
- package/alert-dialog/alert-dialog-close.d.ts +3 -14
- package/alert-dialog/alert-dialog-close.js +4 -34
- package/alert-dialog/alert-dialog-popup.d.ts +3 -32
- package/alert-dialog/alert-dialog-popup.js +68 -317
- package/alert-dialog/alert-dialog-trigger.d.ts +3 -14
- package/alert-dialog/alert-dialog-trigger.js +4 -51
- package/alert-dialog/alert-dialog.d.ts +3 -30
- package/alert-dialog/alert-dialog.js +8 -158
- package/alert-dialog/index.d.ts +11 -11
- package/alert-dialog/index.js +9 -9
- package/all.d.ts +159 -123
- package/all.js +134 -231
- package/avatar/avatar.d.ts +3 -39
- package/avatar/avatar.js +18 -238
- package/avatar/index.d.ts +4 -4
- package/avatar/index.js +3 -3
- package/badge/badge.d.ts +3 -10
- package/badge/badge.js +88 -22
- package/badge/index.d.ts +2 -3
- package/badge/index.js +2 -3
- package/breadcrumb/breadcrumb-ellipsis.d.ts +3 -12
- package/breadcrumb/breadcrumb-ellipsis.js +8 -34
- package/breadcrumb/breadcrumb-item.d.ts +3 -11
- package/breadcrumb/breadcrumb-item.js +7 -26
- package/breadcrumb/breadcrumb-link.d.ts +3 -12
- package/breadcrumb/breadcrumb-link.js +16 -26
- package/breadcrumb/breadcrumb-page.d.ts +3 -11
- package/breadcrumb/breadcrumb-page.js +8 -31
- package/breadcrumb/breadcrumb-separator.d.ts +3 -12
- package/breadcrumb/breadcrumb-separator.js +8 -31
- package/breadcrumb/breadcrumb.d.ts +3 -12
- package/breadcrumb/breadcrumb.js +10 -33
- package/breadcrumb/index.d.ts +12 -13
- package/breadcrumb/index.js +12 -13
- package/button/button.d.ts +3 -32
- package/button/button.js +221 -165
- package/button/index.d.ts +3 -3
- package/button/index.js +3 -3
- package/calendar/calendar.d.ts +3 -31
- package/calendar/calendar.js +71 -481
- package/calendar/index.d.ts +3 -3
- package/calendar/index.js +3 -3
- package/card/card.d.ts +3 -27
- package/card/card.js +80 -163
- package/card/index.d.ts +2 -3
- package/card/index.js +2 -3
- package/card-grid/card-grid.d.ts +3 -15
- package/card-grid/card-grid.js +8 -106
- package/card-grid/index.d.ts +2 -3
- package/card-grid/index.js +2 -3
- package/checkbox/checkbox-group.d.ts +3 -34
- package/checkbox/checkbox-group.js +11 -188
- package/checkbox/checkbox.d.ts +3 -47
- package/checkbox/checkbox.js +43 -341
- package/checkbox/index.d.ts +6 -6
- package/checkbox/index.js +5 -5
- package/collapsible/collapsible.d.ts +3 -20
- package/collapsible/collapsible.js +83 -277
- package/collapsible/index.d.ts +3 -3
- package/collapsible/index.js +3 -3
- package/combobox/combobox.d.ts +3 -47
- package/combobox/combobox.js +136 -538
- package/combobox/index.d.ts +4 -4
- package/combobox/index.js +3 -3
- package/command/command-empty.d.ts +3 -8
- package/command/command-empty.js +10 -88
- package/command/command-group.d.ts +3 -13
- package/command/command-group.js +15 -114
- package/command/command-input.d.ts +3 -11
- package/command/command-input.js +20 -136
- package/command/command-item.d.ts +3 -18
- package/command/command-item.js +24 -212
- package/command/command-list.d.ts +3 -7
- package/command/command-list.js +11 -79
- package/command/command-separator.d.ts +3 -5
- package/command/command-separator.js +10 -11
- package/command/command-shortcut.d.ts +3 -5
- package/command/command-shortcut.js +9 -12
- package/command/command.d.ts +3 -23
- package/command/command.js +10 -339
- package/command/index.d.ts +17 -19
- package/command/index.js +16 -18
- package/data-table/data-table.d.ts +3 -57
- package/data-table/data-table.js +86 -449
- package/data-table/index.d.ts +3 -4
- package/data-table/index.js +2 -3
- package/dialog/dialog-close.d.ts +3 -14
- package/dialog/dialog-close.js +4 -34
- package/dialog/dialog-popup.d.ts +3 -34
- package/dialog/dialog-popup.js +70 -336
- package/dialog/dialog-trigger.d.ts +3 -14
- package/dialog/dialog-trigger.js +4 -51
- package/dialog/dialog.d.ts +3 -30
- package/dialog/dialog.js +8 -158
- package/dialog/index.d.ts +11 -11
- package/dialog/index.js +9 -9
- package/dropzone/dropzone.d.ts +3 -72
- package/dropzone/dropzone.js +29 -407
- package/dropzone/index.d.ts +4 -4
- package/dropzone/index.js +3 -3
- package/field/field.d.ts +3 -30
- package/field/field.js +34 -353
- package/field/index.d.ts +1 -0
- package/field/index.js +1 -0
- package/fieldset/fieldset.d.ts +3 -18
- package/fieldset/fieldset.js +21 -110
- package/fieldset/index.d.ts +1 -0
- package/fieldset/index.js +1 -0
- package/icon/icon.d.ts +3 -15
- package/icon/icon.js +4 -33
- package/icon/index.d.ts +2 -3
- package/icon/index.js +2 -3
- package/input/index.d.ts +3 -3
- package/input/index.js +3 -3
- package/input/input.d.ts +3 -49
- package/input/input.js +57 -238
- package/menu/index.d.ts +4 -5
- package/menu/index.js +4 -5
- package/menu/menu-item.d.ts +3 -13
- package/menu/menu-item.js +41 -91
- package/menu/menu.d.ts +3 -15
- package/menu/menu.js +27 -277
- package/menubar/index.d.ts +3 -4
- package/menubar/index.js +2 -3
- package/menubar/menubar.d.ts +3 -19
- package/menubar/menubar.js +12 -183
- package/number-field/index.d.ts +3 -3
- package/number-field/index.js +3 -3
- package/number-field/number-field.d.ts +3 -55
- package/number-field/number-field.js +205 -698
- package/package.json +126 -113
- package/popover/index.d.ts +11 -11
- package/popover/index.js +9 -9
- package/popover/popover-close.d.ts +3 -12
- package/popover/popover-close.js +4 -32
- package/popover/popover-popup.d.ts +3 -18
- package/popover/popover-popup.js +28 -205
- package/popover/popover-trigger.d.ts +3 -13
- package/popover/popover-trigger.js +4 -73
- package/popover/popover.d.ts +3 -29
- package/popover/popover.js +8 -207
- package/portal/index.d.ts +3 -4
- package/portal/index.js +2 -3
- package/portal/portal.d.ts +3 -27
- package/portal/portal.js +8 -157
- package/preview-card/index.d.ts +9 -9
- package/preview-card/index.js +7 -7
- package/preview-card/preview-card-popup.d.ts +3 -14
- package/preview-card/preview-card-popup.js +29 -194
- package/preview-card/preview-card-trigger.d.ts +3 -12
- package/preview-card/preview-card-trigger.js +4 -74
- package/preview-card/preview-card.d.ts +3 -33
- package/preview-card/preview-card.js +8 -239
- package/progress/index.d.ts +2 -3
- package/progress/index.js +2 -3
- package/progress/progress.d.ts +3 -17
- package/progress/progress.js +28 -130
- package/radio/index.d.ts +6 -6
- package/radio/index.js +5 -5
- package/radio/radio-group.d.ts +3 -37
- package/radio/radio-group.js +8 -200
- package/radio/radio.d.ts +3 -28
- package/radio/radio.js +38 -213
- package/scroll-area/index.d.ts +2 -3
- package/scroll-area/index.js +2 -3
- package/scroll-area/scroll-area.d.ts +3 -36
- package/scroll-area/scroll-area.js +25 -535
- package/select/index.d.ts +3 -4
- package/select/index.js +2 -3
- package/select/select.d.ts +3 -39
- package/select/select.js +115 -425
- package/separator/index.d.ts +2 -3
- package/separator/index.js +2 -3
- package/separator/separator.d.ts +3 -10
- package/separator/separator.js +23 -85
- package/sidebar/index.d.ts +29 -29
- package/sidebar/index.js +27 -32
- package/sidebar/sidebar-content.d.ts +3 -12
- package/sidebar/sidebar-content.js +7 -29
- package/sidebar/sidebar-footer.d.ts +3 -10
- package/sidebar/sidebar-footer.js +7 -20
- package/sidebar/sidebar-group-label.d.ts +3 -15
- package/sidebar/sidebar-group-label.js +17 -41
- package/sidebar/sidebar-group.d.ts +3 -13
- package/sidebar/sidebar-group.js +7 -24
- package/sidebar/sidebar-header.d.ts +3 -10
- package/sidebar/sidebar-header.js +7 -16
- package/sidebar/sidebar-inset.d.ts +3 -13
- package/sidebar/sidebar-inset.js +7 -28
- package/sidebar/sidebar-menu-button.d.ts +3 -26
- package/sidebar/sidebar-menu-button.js +60 -217
- package/sidebar/sidebar-menu-item.d.ts +3 -10
- package/sidebar/sidebar-menu-item.js +7 -19
- package/sidebar/sidebar-menu.d.ts +3 -12
- package/sidebar/sidebar-menu.js +7 -25
- package/sidebar/sidebar-provider.d.ts +3 -34
- package/sidebar/sidebar-provider.js +22 -232
- package/sidebar/sidebar-separator.d.ts +3 -10
- package/sidebar/sidebar-separator.js +9 -19
- package/sidebar/sidebar-trigger.d.ts +3 -14
- package/sidebar/sidebar-trigger.js +10 -46
- package/sidebar/sidebar.d.ts +3 -19
- package/sidebar/sidebar.js +65 -262
- package/slider/index.d.ts +3 -3
- package/slider/index.js +3 -3
- package/slider/slider.d.ts +3 -45
- package/slider/slider.js +97 -382
- package/spinner/index.d.ts +2 -3
- package/spinner/index.js +2 -3
- package/spinner/spinner.d.ts +3 -11
- package/spinner/spinner.js +20 -163
- package/split-button/index.d.ts +3 -1
- package/split-button/index.js +3 -1
- package/split-button/split-button.d.ts +3 -33
- package/split-button/split-button.js +307 -394
- package/stepper/index.d.ts +3 -3
- package/stepper/index.js +3 -3
- package/stepper/stepper.d.ts +3 -41
- package/stepper/stepper.js +57 -381
- package/switch/index.d.ts +3 -3
- package/switch/index.js +3 -3
- package/switch/switch.d.ts +3 -30
- package/switch/switch.js +63 -228
- package/tabs/index.d.ts +12 -12
- package/tabs/index.js +11 -11
- package/tabs/tab.d.ts +3 -14
- package/tabs/tab.js +33 -131
- package/tabs/tabs-indicator.d.ts +3 -9
- package/tabs/tabs-indicator.js +17 -22
- package/tabs/tabs-list.d.ts +3 -15
- package/tabs/tabs-list.js +14 -113
- package/tabs/tabs-panel.d.ts +3 -16
- package/tabs/tabs-panel.js +32 -114
- package/tabs/tabs.d.ts +3 -22
- package/tabs/tabs.js +8 -170
- package/textarea/index.d.ts +4 -4
- package/textarea/index.js +3 -3
- package/textarea/textarea.d.ts +3 -36
- package/textarea/textarea.js +63 -220
- package/toggle/index.d.ts +6 -6
- package/toggle/index.js +5 -5
- package/toggle/toggle-group.d.ts +3 -27
- package/toggle/toggle-group.js +9 -224
- package/toggle/toggle.d.ts +3 -26
- package/toggle/toggle.js +94 -178
- package/tokens/properties.css +361 -0
- package/tokens/prose.css +250 -0
- package/tokens/prose.d.ts +2 -0
- package/tokens/prose.js +4 -0
- package/tokens/tokens-raw.d.ts +2 -0
- package/tokens/tokens-raw.js +2 -0
- package/tokens/tokens.css +409 -0
- package/tokens/tokens.d.ts +2 -0
- package/tokens/tokens.js +5 -0
- package/toolbar/index.d.ts +2 -3
- package/toolbar/index.js +2 -3
- package/toolbar/toolbar.d.ts +3 -11
- package/toolbar/toolbar.js +25 -116
- package/tooltip/index.d.ts +9 -9
- package/tooltip/index.js +7 -7
- package/tooltip/tooltip-popup.d.ts +3 -14
- package/tooltip/tooltip-popup.js +32 -185
- package/tooltip/tooltip-trigger.d.ts +3 -14
- package/tooltip/tooltip-trigger.js +5 -148
- package/tooltip/tooltip.d.ts +3 -35
- package/tooltip/tooltip.js +8 -253
- package/trunc/index.d.ts +2 -3
- package/trunc/index.js +2 -3
- package/trunc/trunc.d.ts +3 -17
- package/trunc/trunc.js +10 -108
- package/_deprecated/center/center.d.ts +0 -14
- package/_deprecated/center/center.js +0 -37
- package/_deprecated/center/index.d.ts +0 -3
- package/_deprecated/center/index.js +0 -3
- package/_deprecated/center/register.js +0 -4
- package/_deprecated/hstack/hstack.d.ts +0 -25
- package/_deprecated/hstack/hstack.js +0 -187
- package/_deprecated/hstack/index.d.ts +0 -4
- package/_deprecated/hstack/index.js +0 -3
- package/_deprecated/hstack/register.d.ts +0 -1
- package/_deprecated/hstack/register.js +0 -4
- package/_deprecated/page-inset/index.d.ts +0 -3
- package/_deprecated/page-inset/index.js +0 -3
- package/_deprecated/page-inset/page-inset.d.ts +0 -28
- package/_deprecated/page-inset/page-inset.js +0 -151
- package/_deprecated/page-inset/register.d.ts +0 -1
- package/_deprecated/page-inset/register.js +0 -4
- package/_deprecated/vstack/index.d.ts +0 -3
- package/_deprecated/vstack/index.js +0 -3
- package/_deprecated/vstack/register.d.ts +0 -1
- package/_deprecated/vstack/register.js +0 -4
- package/_deprecated/vstack/vstack.d.ts +0 -17
- package/_deprecated/vstack/vstack.js +0 -125
- package/accordion/accordion-context.d.ts +0 -15
- package/accordion/accordion-context.js +0 -3
- package/alert-dialog/alert-dialog-context.d.ts +0 -13
- package/alert-dialog/alert-dialog-context.js +0 -3
- package/checkbox/checkbox-group-context.d.ts +0 -11
- package/checkbox/checkbox-group-context.js +0 -3
- package/command/command-context.d.ts +0 -30
- package/command/command-context.js +0 -3
- package/command/command-score.d.ts +0 -6
- package/command/command-score.js +0 -31
- package/dialog/dialog-context.d.ts +0 -13
- package/dialog/dialog-context.js +0 -3
- package/global.d.ts +0 -179
- package/menubar/menubar-context.d.ts +0 -9
- package/menubar/menubar-context.js +0 -2
- package/popover/popover-context.d.ts +0 -17
- package/popover/popover-context.js +0 -3
- package/preview-card/preview-card-context.d.ts +0 -16
- package/preview-card/preview-card-context.js +0 -3
- package/radio/radio-group-context.d.ts +0 -11
- package/radio/radio-group-context.js +0 -2
- package/sidebar/sidebar-context.d.ts +0 -15
- package/sidebar/sidebar-context.js +0 -3
- package/split-button/register.d.ts +0 -1
- package/split-button/register.js +0 -4
- package/tabs/tabs-context.d.ts +0 -8
- package/tabs/tabs-context.js +0 -2
- package/toggle/toggle-group-context.d.ts +0 -9
- package/toggle/toggle-group-context.js +0 -2
- package/tooltip/tooltip-context.d.ts +0 -17
- package/tooltip/tooltip-context.js +0 -3
- /package/{_deprecated/center/register.d.ts → _install.d.ts} +0 -0
package/command/command.js
CHANGED
|
@@ -1,343 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
5
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
6
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
7
|
-
var _, done = false;
|
|
8
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
9
|
-
var context = {};
|
|
10
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
11
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
12
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
13
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
14
|
-
if (kind === "accessor") {
|
|
15
|
-
if (result === void 0) continue;
|
|
16
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
17
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
18
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
19
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
20
|
-
}
|
|
21
|
-
else if (_ = accept(result)) {
|
|
22
|
-
if (kind === "field") initializers.unshift(_);
|
|
23
|
-
else descriptor[key] = _;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
27
|
-
done = true;
|
|
28
|
-
};
|
|
29
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
30
|
-
var useValue = arguments.length > 2;
|
|
31
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
32
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
33
|
-
}
|
|
34
|
-
return useValue ? value : void 0;
|
|
35
|
-
};
|
|
36
|
-
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
37
|
-
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
38
|
-
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
39
|
-
};
|
|
40
|
-
import { css, html, LitElement } from "lit";
|
|
41
|
-
import { property, state } from "lit/decorators.js";
|
|
42
|
-
import { provide } from "@lit/context";
|
|
43
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
44
|
-
import { customEvent } from "@deepfuture/dui-core/event";
|
|
45
|
-
import { commandContext, } from "./command-context.js";
|
|
46
|
-
import { commandScore } from "./command-score.js";
|
|
47
|
-
export const selectEvent = customEvent("select", {
|
|
48
|
-
bubbles: true,
|
|
49
|
-
composed: true,
|
|
50
|
-
});
|
|
51
|
-
export const searchChangeEvent = customEvent("search-change", {
|
|
52
|
-
bubbles: true,
|
|
53
|
-
composed: true,
|
|
54
|
-
});
|
|
55
|
-
export const escapeEvent = customEvent("escape", {
|
|
56
|
-
bubbles: true,
|
|
57
|
-
composed: true,
|
|
58
|
-
});
|
|
59
|
-
let idCounter = 0;
|
|
60
|
-
const nextId = () => `dui-command-${++idCounter}`;
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiCommandPrimitive } from "@deepfuture/dui-primitives/command";
|
|
3
|
+
import "../_install.js";
|
|
61
4
|
const styles = css `
|
|
62
5
|
:host {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
6
|
+
border-radius: var(--radius-md);
|
|
7
|
+
background: var(--surface-3);
|
|
8
|
+
color: var(--text-1);
|
|
66
9
|
}
|
|
67
10
|
`;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
let _loop_extraInitializers = [];
|
|
73
|
-
let _shouldFilter_decorators;
|
|
74
|
-
let _shouldFilter_initializers = [];
|
|
75
|
-
let _shouldFilter_extraInitializers = [];
|
|
76
|
-
let _value_decorators;
|
|
77
|
-
let _value_initializers = [];
|
|
78
|
-
let _value_extraInitializers = [];
|
|
79
|
-
let _filter_decorators;
|
|
80
|
-
let _filter_initializers = [];
|
|
81
|
-
let _filter_extraInitializers = [];
|
|
82
|
-
let _private_search_decorators;
|
|
83
|
-
let _private_search_initializers = [];
|
|
84
|
-
let _private_search_extraInitializers = [];
|
|
85
|
-
let _private_search_descriptor;
|
|
86
|
-
let _private_selectedItemId_decorators;
|
|
87
|
-
let _private_selectedItemId_initializers = [];
|
|
88
|
-
let _private_selectedItemId_extraInitializers = [];
|
|
89
|
-
let _private_selectedItemId_descriptor;
|
|
90
|
-
let __ctx_decorators;
|
|
91
|
-
let __ctx_initializers = [];
|
|
92
|
-
let __ctx_extraInitializers = [];
|
|
93
|
-
return class DuiCommand extends _classSuper {
|
|
94
|
-
static {
|
|
95
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
96
|
-
_loop_decorators = [property({ type: Boolean })];
|
|
97
|
-
_shouldFilter_decorators = [property({ type: Boolean, attribute: "should-filter" })];
|
|
98
|
-
_value_decorators = [property({ type: String })];
|
|
99
|
-
_filter_decorators = [property({ attribute: false })];
|
|
100
|
-
_private_search_decorators = [state()];
|
|
101
|
-
_private_selectedItemId_decorators = [state()];
|
|
102
|
-
__ctx_decorators = [provide({ context: commandContext }), state()];
|
|
103
|
-
__esDecorate(this, null, _loop_decorators, { kind: "accessor", name: "loop", static: false, private: false, access: { has: obj => "loop" in obj, get: obj => obj.loop, set: (obj, value) => { obj.loop = value; } }, metadata: _metadata }, _loop_initializers, _loop_extraInitializers);
|
|
104
|
-
__esDecorate(this, null, _shouldFilter_decorators, { kind: "accessor", name: "shouldFilter", static: false, private: false, access: { has: obj => "shouldFilter" in obj, get: obj => obj.shouldFilter, set: (obj, value) => { obj.shouldFilter = value; } }, metadata: _metadata }, _shouldFilter_initializers, _shouldFilter_extraInitializers);
|
|
105
|
-
__esDecorate(this, null, _value_decorators, { kind: "accessor", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value, set: (obj, value) => { obj.value = value; } }, metadata: _metadata }, _value_initializers, _value_extraInitializers);
|
|
106
|
-
__esDecorate(this, null, _filter_decorators, { kind: "accessor", name: "filter", static: false, private: false, access: { has: obj => "filter" in obj, get: obj => obj.filter, set: (obj, value) => { obj.filter = value; } }, metadata: _metadata }, _filter_initializers, _filter_extraInitializers);
|
|
107
|
-
__esDecorate(this, _private_search_descriptor = { get: __setFunctionName(function () { return this.#search_accessor_storage; }, "#search", "get"), set: __setFunctionName(function (value) { this.#search_accessor_storage = value; }, "#search", "set") }, _private_search_decorators, { kind: "accessor", name: "#search", static: false, private: true, access: { has: obj => #search in obj, get: obj => obj.#search, set: (obj, value) => { obj.#search = value; } }, metadata: _metadata }, _private_search_initializers, _private_search_extraInitializers);
|
|
108
|
-
__esDecorate(this, _private_selectedItemId_descriptor = { get: __setFunctionName(function () { return this.#selectedItemId_accessor_storage; }, "#selectedItemId", "get"), set: __setFunctionName(function (value) { this.#selectedItemId_accessor_storage = value; }, "#selectedItemId", "set") }, _private_selectedItemId_decorators, { kind: "accessor", name: "#selectedItemId", static: false, private: true, access: { has: obj => #selectedItemId in obj, get: obj => obj.#selectedItemId, set: (obj, value) => { obj.#selectedItemId = value; } }, metadata: _metadata }, _private_selectedItemId_initializers, _private_selectedItemId_extraInitializers);
|
|
109
|
-
__esDecorate(this, null, __ctx_decorators, { kind: "accessor", name: "_ctx", static: false, private: false, access: { has: obj => "_ctx" in obj, get: obj => obj._ctx, set: (obj, value) => { obj._ctx = value; } }, metadata: _metadata }, __ctx_initializers, __ctx_extraInitializers);
|
|
110
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
111
|
-
}
|
|
112
|
-
static tagName = "dui-command";
|
|
113
|
-
static styles = [base, styles];
|
|
114
|
-
#loop_accessor_storage = __runInitializers(this, _loop_initializers, false);
|
|
115
|
-
/** Whether keyboard navigation wraps from last to first and vice versa. */
|
|
116
|
-
get loop() { return this.#loop_accessor_storage; }
|
|
117
|
-
set loop(value) { this.#loop_accessor_storage = value; }
|
|
118
|
-
#shouldFilter_accessor_storage = (__runInitializers(this, _loop_extraInitializers), __runInitializers(this, _shouldFilter_initializers, true));
|
|
119
|
-
/** Whether items should be filtered based on search text. */
|
|
120
|
-
get shouldFilter() { return this.#shouldFilter_accessor_storage; }
|
|
121
|
-
set shouldFilter(value) { this.#shouldFilter_accessor_storage = value; }
|
|
122
|
-
#value_accessor_storage = (__runInitializers(this, _shouldFilter_extraInitializers), __runInitializers(this, _value_initializers, undefined));
|
|
123
|
-
/** Controlled value — the currently selected item value. */
|
|
124
|
-
get value() { return this.#value_accessor_storage; }
|
|
125
|
-
set value(value) { this.#value_accessor_storage = value; }
|
|
126
|
-
#filter_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _filter_initializers, undefined));
|
|
127
|
-
/** Custom filter function. */
|
|
128
|
-
get filter() { return this.#filter_accessor_storage; }
|
|
129
|
-
set filter(value) { this.#filter_accessor_storage = value; }
|
|
130
|
-
#search_accessor_storage = (__runInitializers(this, _filter_extraInitializers), __runInitializers(this, _private_search_initializers, ""));
|
|
131
|
-
get #search() { return _private_search_descriptor.get.call(this); }
|
|
132
|
-
set #search(value) { return _private_search_descriptor.set.call(this, value); }
|
|
133
|
-
#selectedItemId_accessor_storage = (__runInitializers(this, _private_search_extraInitializers), __runInitializers(this, _private_selectedItemId_initializers, undefined));
|
|
134
|
-
get #selectedItemId() { return _private_selectedItemId_descriptor.get.call(this); }
|
|
135
|
-
set #selectedItemId(value) { return _private_selectedItemId_descriptor.set.call(this, value); }
|
|
136
|
-
#items = (__runInitializers(this, _private_selectedItemId_extraInitializers), new Map());
|
|
137
|
-
#itemOrder = [];
|
|
138
|
-
#groups = new Set();
|
|
139
|
-
#scoresMap = new Map();
|
|
140
|
-
#listId = nextId();
|
|
141
|
-
#recomputeScores() {
|
|
142
|
-
this.#scoresMap.clear();
|
|
143
|
-
for (const [id, entry] of this.#items) {
|
|
144
|
-
const score = this.filter
|
|
145
|
-
? this.filter(entry.value, this.#search, entry.keywords)
|
|
146
|
-
: commandScore(this.#search, entry.value, entry.textContent, entry.keywords);
|
|
147
|
-
this.#scoresMap.set(id, score);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
#getScore = (itemId) => {
|
|
151
|
-
if (!this.shouldFilter)
|
|
152
|
-
return 1;
|
|
153
|
-
return this.#scoresMap.get(itemId) ?? 0;
|
|
154
|
-
};
|
|
155
|
-
#getVisibleItems() {
|
|
156
|
-
return this.#itemOrder
|
|
157
|
-
.map((id) => this.#items.get(id))
|
|
158
|
-
.filter((entry) => {
|
|
159
|
-
if (!entry)
|
|
160
|
-
return false;
|
|
161
|
-
if (!this.shouldFilter)
|
|
162
|
-
return true;
|
|
163
|
-
return (this.#scoresMap.get(entry.id) ?? 0) > 0;
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
#getVisibleCount = () => {
|
|
167
|
-
return this.#getVisibleItems().length;
|
|
168
|
-
};
|
|
169
|
-
#getGroupVisibleCount = (groupId) => {
|
|
170
|
-
return this.#getVisibleItems().filter((e) => e.groupId === groupId).length;
|
|
171
|
-
};
|
|
172
|
-
#registerItem = (entry) => {
|
|
173
|
-
this.#items.set(entry.id, entry);
|
|
174
|
-
if (!this.#itemOrder.includes(entry.id)) {
|
|
175
|
-
this.#itemOrder.push(entry.id);
|
|
176
|
-
}
|
|
177
|
-
// Recompute scores for new item
|
|
178
|
-
const score = this.filter
|
|
179
|
-
? this.filter(entry.value, this.#search, entry.keywords)
|
|
180
|
-
: commandScore(this.#search, entry.value, entry.textContent, entry.keywords);
|
|
181
|
-
this.#scoresMap.set(entry.id, score);
|
|
182
|
-
// Auto-select first visible item if nothing selected
|
|
183
|
-
if (!this.#selectedItemId) {
|
|
184
|
-
const visible = this.#getVisibleItems();
|
|
185
|
-
if (visible.length > 0 && !visible[0].disabled) {
|
|
186
|
-
this.#selectedItemId = visible[0].id;
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
this.requestUpdate();
|
|
190
|
-
};
|
|
191
|
-
#unregisterItem = (id) => {
|
|
192
|
-
this.#items.delete(id);
|
|
193
|
-
this.#itemOrder = this.#itemOrder.filter((v) => v !== id);
|
|
194
|
-
this.#scoresMap.delete(id);
|
|
195
|
-
this.requestUpdate();
|
|
196
|
-
};
|
|
197
|
-
#updateItem = (entry) => {
|
|
198
|
-
this.#items.set(entry.id, entry);
|
|
199
|
-
const score = this.filter
|
|
200
|
-
? this.filter(entry.value, this.#search, entry.keywords)
|
|
201
|
-
: commandScore(this.#search, entry.value, entry.textContent, entry.keywords);
|
|
202
|
-
this.#scoresMap.set(entry.id, score);
|
|
203
|
-
this.requestUpdate();
|
|
204
|
-
};
|
|
205
|
-
#registerGroup = (groupId) => {
|
|
206
|
-
this.#groups.add(groupId);
|
|
207
|
-
};
|
|
208
|
-
#unregisterGroup = (groupId) => {
|
|
209
|
-
this.#groups.delete(groupId);
|
|
210
|
-
};
|
|
211
|
-
#setSearch = (value) => {
|
|
212
|
-
this.#search = value;
|
|
213
|
-
this.#recomputeScores();
|
|
214
|
-
// Select first visible non-disabled item
|
|
215
|
-
const visible = this.#getVisibleItems();
|
|
216
|
-
const firstSelectable = visible.find((e) => !e.disabled);
|
|
217
|
-
this.#selectedItemId = firstSelectable?.id;
|
|
218
|
-
this.dispatchEvent(searchChangeEvent(value));
|
|
219
|
-
};
|
|
220
|
-
#selectItem = (id) => {
|
|
221
|
-
this.#selectedItemId = id;
|
|
222
|
-
};
|
|
223
|
-
#handleItemSelect = (value) => {
|
|
224
|
-
this.dispatchEvent(selectEvent(value));
|
|
225
|
-
};
|
|
226
|
-
#handleKeyDown = (event) => {
|
|
227
|
-
const visible = this.#getVisibleItems().filter((e) => !e.disabled);
|
|
228
|
-
if (visible.length === 0)
|
|
229
|
-
return;
|
|
230
|
-
const currentIndex = visible.findIndex((e) => e.id === this.#selectedItemId);
|
|
231
|
-
const selectByIndex = (index) => {
|
|
232
|
-
const item = visible[index];
|
|
233
|
-
if (item) {
|
|
234
|
-
this.#selectedItemId = item.id;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
switch (event.key) {
|
|
238
|
-
case "ArrowDown":
|
|
239
|
-
case "n":
|
|
240
|
-
case "j": {
|
|
241
|
-
// Ctrl+N and Ctrl+J for down
|
|
242
|
-
if (event.key !== "ArrowDown" &&
|
|
243
|
-
!event.ctrlKey &&
|
|
244
|
-
!event.metaKey) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
event.preventDefault();
|
|
248
|
-
if (currentIndex < visible.length - 1) {
|
|
249
|
-
selectByIndex(currentIndex + 1);
|
|
250
|
-
}
|
|
251
|
-
else if (this.loop) {
|
|
252
|
-
selectByIndex(0);
|
|
253
|
-
}
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
case "ArrowUp":
|
|
257
|
-
case "p":
|
|
258
|
-
case "k": {
|
|
259
|
-
// Ctrl+P and Ctrl+K for up
|
|
260
|
-
if (event.key !== "ArrowUp" &&
|
|
261
|
-
!event.ctrlKey &&
|
|
262
|
-
!event.metaKey) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
event.preventDefault();
|
|
266
|
-
if (currentIndex > 0) {
|
|
267
|
-
selectByIndex(currentIndex - 1);
|
|
268
|
-
}
|
|
269
|
-
else if (this.loop) {
|
|
270
|
-
selectByIndex(visible.length - 1);
|
|
271
|
-
}
|
|
272
|
-
break;
|
|
273
|
-
}
|
|
274
|
-
case "Home": {
|
|
275
|
-
event.preventDefault();
|
|
276
|
-
selectByIndex(0);
|
|
277
|
-
break;
|
|
278
|
-
}
|
|
279
|
-
case "End": {
|
|
280
|
-
event.preventDefault();
|
|
281
|
-
selectByIndex(visible.length - 1);
|
|
282
|
-
break;
|
|
283
|
-
}
|
|
284
|
-
case "Enter": {
|
|
285
|
-
event.preventDefault();
|
|
286
|
-
const selected = visible.find((e) => e.id === this.#selectedItemId);
|
|
287
|
-
if (selected) {
|
|
288
|
-
this.#handleItemSelect(selected.value);
|
|
289
|
-
}
|
|
290
|
-
break;
|
|
291
|
-
}
|
|
292
|
-
case "Escape": {
|
|
293
|
-
event.preventDefault();
|
|
294
|
-
this.dispatchEvent(escapeEvent());
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
#_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, this.#buildContext());
|
|
300
|
-
get _ctx() { return this.#_ctx_accessor_storage; }
|
|
301
|
-
set _ctx(value) { this.#_ctx_accessor_storage = value; }
|
|
302
|
-
#buildContext() {
|
|
303
|
-
return {
|
|
304
|
-
search: this.#search,
|
|
305
|
-
selectedItemId: this.#selectedItemId,
|
|
306
|
-
listId: this.#listId,
|
|
307
|
-
loop: this.loop,
|
|
308
|
-
shouldFilter: this.shouldFilter,
|
|
309
|
-
getScore: this.#getScore,
|
|
310
|
-
getVisibleCount: this.#getVisibleCount,
|
|
311
|
-
getGroupVisibleCount: this.#getGroupVisibleCount,
|
|
312
|
-
registerItem: this.#registerItem,
|
|
313
|
-
unregisterItem: this.#unregisterItem,
|
|
314
|
-
updateItem: this.#updateItem,
|
|
315
|
-
registerGroup: this.#registerGroup,
|
|
316
|
-
unregisterGroup: this.#unregisterGroup,
|
|
317
|
-
setSearch: this.#setSearch,
|
|
318
|
-
selectItem: this.#selectItem,
|
|
319
|
-
handleItemSelect: this.#handleItemSelect,
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
connectedCallback() {
|
|
323
|
-
super.connectedCallback();
|
|
324
|
-
this.addEventListener("keydown", this.#handleKeyDown);
|
|
325
|
-
this._ctx = this.#buildContext();
|
|
326
|
-
}
|
|
327
|
-
disconnectedCallback() {
|
|
328
|
-
super.disconnectedCallback();
|
|
329
|
-
this.removeEventListener("keydown", this.#handleKeyDown);
|
|
330
|
-
}
|
|
331
|
-
willUpdate() {
|
|
332
|
-
this._ctx = this.#buildContext();
|
|
333
|
-
}
|
|
334
|
-
render() {
|
|
335
|
-
return html `<slot></slot>`;
|
|
336
|
-
}
|
|
337
|
-
constructor() {
|
|
338
|
-
super(...arguments);
|
|
339
|
-
__runInitializers(this, __ctx_extraInitializers);
|
|
340
|
-
}
|
|
341
|
-
};
|
|
342
|
-
})();
|
|
343
|
-
export { DuiCommand };
|
|
11
|
+
export class DuiCommand extends DuiCommandPrimitive {
|
|
12
|
+
static styles = [...DuiCommandPrimitive.styles, styles];
|
|
13
|
+
}
|
|
14
|
+
customElements.define(DuiCommand.tagName, DuiCommand);
|
package/command/index.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
export { DuiCommandShortcut };
|
|
17
|
-
export type { CommandContext, CommandItemEntry } from "
|
|
18
|
-
export { commandScore } from "./command-score.js";
|
|
19
|
-
export declare const commandFamily: (typeof DuiCommand | typeof DuiCommandInput | typeof DuiCommandList | typeof DuiCommandGroup | typeof DuiCommandItem | typeof DuiCommandEmpty | typeof DuiCommandSeparator | typeof DuiCommandShortcut)[];
|
|
1
|
+
import "./command.js";
|
|
2
|
+
import "./command-empty.js";
|
|
3
|
+
import "./command-group.js";
|
|
4
|
+
import "./command-input.js";
|
|
5
|
+
import "./command-item.js";
|
|
6
|
+
import "./command-list.js";
|
|
7
|
+
import "./command-separator.js";
|
|
8
|
+
import "./command-shortcut.js";
|
|
9
|
+
export { DuiCommand } from "./command.js";
|
|
10
|
+
export { DuiCommandEmpty } from "./command-empty.js";
|
|
11
|
+
export { DuiCommandGroup } from "./command-group.js";
|
|
12
|
+
export { DuiCommandInput } from "./command-input.js";
|
|
13
|
+
export { DuiCommandItem } from "./command-item.js";
|
|
14
|
+
export { DuiCommandList } from "./command-list.js";
|
|
15
|
+
export { DuiCommandSeparator } from "./command-separator.js";
|
|
16
|
+
export { DuiCommandShortcut } from "./command-shortcut.js";
|
|
17
|
+
export type { CommandContext, CommandItemEntry } from "@deepfuture/dui-primitives/command";
|
package/command/index.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export {
|
|
11
|
-
|
|
12
|
-
export {
|
|
13
|
-
|
|
14
|
-
export {
|
|
15
|
-
|
|
16
|
-
export { DuiCommandShortcut };
|
|
17
|
-
export { commandScore } from "./command-score.js";
|
|
18
|
-
export const commandFamily = [DuiCommand, DuiCommandInput, DuiCommandList, DuiCommandGroup, DuiCommandItem, DuiCommandEmpty, DuiCommandSeparator, DuiCommandShortcut];
|
|
1
|
+
import "./command.js";
|
|
2
|
+
import "./command-empty.js";
|
|
3
|
+
import "./command-group.js";
|
|
4
|
+
import "./command-input.js";
|
|
5
|
+
import "./command-item.js";
|
|
6
|
+
import "./command-list.js";
|
|
7
|
+
import "./command-separator.js";
|
|
8
|
+
import "./command-shortcut.js";
|
|
9
|
+
export { DuiCommand } from "./command.js";
|
|
10
|
+
export { DuiCommandEmpty } from "./command-empty.js";
|
|
11
|
+
export { DuiCommandGroup } from "./command-group.js";
|
|
12
|
+
export { DuiCommandInput } from "./command-input.js";
|
|
13
|
+
export { DuiCommandItem } from "./command-item.js";
|
|
14
|
+
export { DuiCommandList } from "./command-list.js";
|
|
15
|
+
export { DuiCommandSeparator } from "./command-separator.js";
|
|
16
|
+
export { DuiCommandShortcut } from "./command-shortcut.js";
|
|
@@ -1,59 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
export
|
|
4
|
-
/** Unique key identifying the column (usually a key of T). */
|
|
5
|
-
key: string;
|
|
6
|
-
/** Column header label. */
|
|
7
|
-
header: string;
|
|
8
|
-
/** Whether this column is sortable. */
|
|
9
|
-
sortable?: boolean;
|
|
10
|
-
/** Fixed column width (CSS value). */
|
|
11
|
-
width?: string;
|
|
12
|
-
/** Custom render function for cell content. */
|
|
13
|
-
render?: (value: unknown, row: T) => TemplateResult | string | number;
|
|
14
|
-
};
|
|
15
|
-
export type SortDirection = "asc" | "desc";
|
|
16
|
-
export type SortState = {
|
|
17
|
-
column: string;
|
|
18
|
-
direction: SortDirection;
|
|
19
|
-
} | null;
|
|
20
|
-
export type PageState = {
|
|
21
|
-
page: number;
|
|
22
|
-
pageSize: number;
|
|
23
|
-
totalRows: number;
|
|
24
|
-
totalPages: number;
|
|
25
|
-
};
|
|
26
|
-
export declare const sortChangeEvent: (detail: {
|
|
27
|
-
column: string;
|
|
28
|
-
direction: SortDirection;
|
|
29
|
-
}) => CustomEvent<{
|
|
30
|
-
column: string;
|
|
31
|
-
direction: SortDirection;
|
|
32
|
-
}>;
|
|
33
|
-
export declare const pageChangeEvent: (detail: PageState) => CustomEvent<PageState>;
|
|
34
|
-
/**
|
|
35
|
-
* `<dui-data-table>` — A sortable, paginated data table.
|
|
36
|
-
*
|
|
37
|
-
* Accepts column definitions and row data, with optional sorting and
|
|
38
|
-
* pagination. Cells can be customized via column `render` functions.
|
|
39
|
-
*
|
|
40
|
-
* @fires sort-change - Fired when a sortable column header is clicked. Detail: SortState
|
|
41
|
-
* @fires page-change - Fired when the page changes. Detail: PageState
|
|
42
|
-
*/
|
|
43
|
-
export declare class DuiDataTable<T extends Record<string, unknown> = Record<string, unknown>> extends LitElement {
|
|
44
|
-
#private;
|
|
45
|
-
static tagName: "dui-data-table";
|
|
1
|
+
import { DuiDataTablePrimitive } from "@deepfuture/dui-primitives/data-table";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiDataTable<T extends Record<string, unknown> = Record<string, unknown>> extends DuiDataTablePrimitive<T> {
|
|
46
4
|
static styles: import("lit").CSSResult[];
|
|
47
|
-
/** Column definitions describing each visible column. */
|
|
48
|
-
accessor columns: ColumnDef<T>[];
|
|
49
|
-
/** The full data array. Sorting and pagination are applied internally. */
|
|
50
|
-
accessor data: T[];
|
|
51
|
-
/** Number of rows per page. Set to 0 to disable pagination. */
|
|
52
|
-
accessor pageSize: number;
|
|
53
|
-
/** Key function to derive a unique identifier from each row. */
|
|
54
|
-
accessor rowKey: ((row: T) => string) | undefined;
|
|
55
|
-
/** Text shown when the data array is empty. */
|
|
56
|
-
accessor emptyText: string;
|
|
57
|
-
willUpdate(changed: PropertyValues): void;
|
|
58
|
-
render(): TemplateResult;
|
|
59
5
|
}
|