@deepfuture/dui-components 0.0.21 → 1.0.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/README.md +56 -65
- package/_install.js +11 -0
- package/accordion/accordion-item.d.ts +3 -20
- package/accordion/accordion-item.js +92 -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 +87 -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 +220 -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 +82 -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 +14 -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 +23 -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 +85 -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 +40 -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 +125 -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 +16 -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 +59 -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 +306 -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 +32 -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 +93 -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 +31 -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-item.js
CHANGED
|
@@ -1,219 +1,30 @@
|
|
|
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
|
-
import { css, html, LitElement } from "lit";
|
|
37
|
-
import { property } from "lit/decorators.js";
|
|
38
|
-
import { consume } from "@lit/context";
|
|
39
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
40
|
-
import { commandContext } from "./command-context.js";
|
|
41
|
-
let itemIdCounter = 0;
|
|
42
|
-
const nextItemId = () => `dui-command-item-${++itemIdCounter}`;
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiCommandItemPrimitive } from "@deepfuture/dui-primitives/command";
|
|
3
|
+
import "../_install.js";
|
|
43
4
|
const styles = css `
|
|
44
|
-
|
|
45
|
-
|
|
5
|
+
.Item {
|
|
6
|
+
gap: var(--space-2);
|
|
7
|
+
border-radius: var(--radius-sm);
|
|
8
|
+
padding: var(--space-1_5) var(--space-2);
|
|
9
|
+
font-size: var(--text-sm); line-height: var(--text-sm--line-height);
|
|
10
|
+
font-weight: var(--font-weight-medium);
|
|
46
11
|
}
|
|
47
12
|
|
|
48
|
-
|
|
49
|
-
|
|
13
|
+
.Item[data-selected] {
|
|
14
|
+
background: oklch(from var(--foreground) l c h / 0.05);
|
|
15
|
+
color: var(--text-1);
|
|
50
16
|
}
|
|
51
17
|
|
|
52
|
-
.Item {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
18
|
+
.Item[aria-disabled="true"] {
|
|
19
|
+
opacity: 0.4;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
::slotted(dui-icon) {
|
|
23
|
+
--icon-size: var(--space-4);
|
|
24
|
+
color: var(--text-2);
|
|
59
25
|
}
|
|
60
26
|
`;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
let _value_extraInitializers = [];
|
|
66
|
-
let _keywords_decorators;
|
|
67
|
-
let _keywords_initializers = [];
|
|
68
|
-
let _keywords_extraInitializers = [];
|
|
69
|
-
let _disabled_decorators;
|
|
70
|
-
let _disabled_initializers = [];
|
|
71
|
-
let _disabled_extraInitializers = [];
|
|
72
|
-
let __ctx_decorators;
|
|
73
|
-
let __ctx_initializers = [];
|
|
74
|
-
let __ctx_extraInitializers = [];
|
|
75
|
-
return class DuiCommandItem extends _classSuper {
|
|
76
|
-
static {
|
|
77
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
78
|
-
_value_decorators = [property({ type: String })];
|
|
79
|
-
_keywords_decorators = [property({ type: Array, attribute: false })];
|
|
80
|
-
_disabled_decorators = [property({ type: Boolean })];
|
|
81
|
-
__ctx_decorators = [consume({ context: commandContext, subscribe: true })];
|
|
82
|
-
__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);
|
|
83
|
-
__esDecorate(this, null, _keywords_decorators, { kind: "accessor", name: "keywords", static: false, private: false, access: { has: obj => "keywords" in obj, get: obj => obj.keywords, set: (obj, value) => { obj.keywords = value; } }, metadata: _metadata }, _keywords_initializers, _keywords_extraInitializers);
|
|
84
|
-
__esDecorate(this, null, _disabled_decorators, { kind: "accessor", name: "disabled", static: false, private: false, access: { has: obj => "disabled" in obj, get: obj => obj.disabled, set: (obj, value) => { obj.disabled = value; } }, metadata: _metadata }, _disabled_initializers, _disabled_extraInitializers);
|
|
85
|
-
__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);
|
|
86
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
87
|
-
}
|
|
88
|
-
static tagName = "dui-command-item";
|
|
89
|
-
static styles = [base, styles];
|
|
90
|
-
#value_accessor_storage = __runInitializers(this, _value_initializers, "");
|
|
91
|
-
/** The value this item represents. */
|
|
92
|
-
get value() { return this.#value_accessor_storage; }
|
|
93
|
-
set value(value) { this.#value_accessor_storage = value; }
|
|
94
|
-
#keywords_accessor_storage = (__runInitializers(this, _value_extraInitializers), __runInitializers(this, _keywords_initializers, []));
|
|
95
|
-
/** Additional search keywords. */
|
|
96
|
-
get keywords() { return this.#keywords_accessor_storage; }
|
|
97
|
-
set keywords(value) { this.#keywords_accessor_storage = value; }
|
|
98
|
-
#disabled_accessor_storage = (__runInitializers(this, _keywords_extraInitializers), __runInitializers(this, _disabled_initializers, false));
|
|
99
|
-
/** Whether this item is disabled. */
|
|
100
|
-
get disabled() { return this.#disabled_accessor_storage; }
|
|
101
|
-
set disabled(value) { this.#disabled_accessor_storage = value; }
|
|
102
|
-
#_ctx_accessor_storage = (__runInitializers(this, _disabled_extraInitializers), __runInitializers(this, __ctx_initializers, void 0));
|
|
103
|
-
get _ctx() { return this.#_ctx_accessor_storage; }
|
|
104
|
-
set _ctx(value) { this.#_ctx_accessor_storage = value; }
|
|
105
|
-
#id = (__runInitializers(this, __ctx_extraInitializers), nextItemId());
|
|
106
|
-
// Track previous own-property values to avoid infinite update loops
|
|
107
|
-
#prevValue = undefined;
|
|
108
|
-
#prevKeywords = undefined;
|
|
109
|
-
#prevDisabled = undefined;
|
|
110
|
-
#registered = false;
|
|
111
|
-
get #isSelected() {
|
|
112
|
-
return this._ctx?.selectedItemId === this.#id;
|
|
113
|
-
}
|
|
114
|
-
get #isVisible() {
|
|
115
|
-
if (!this._ctx)
|
|
116
|
-
return true;
|
|
117
|
-
return this._ctx.getScore(this.#id) > 0;
|
|
118
|
-
}
|
|
119
|
-
#getGroupId() {
|
|
120
|
-
const groupHost = this.closest("[data-group-id]");
|
|
121
|
-
return groupHost?.getAttribute("data-group-id") ?? undefined;
|
|
122
|
-
}
|
|
123
|
-
#buildEntry() {
|
|
124
|
-
return {
|
|
125
|
-
id: this.#id,
|
|
126
|
-
value: this.value,
|
|
127
|
-
keywords: this.keywords,
|
|
128
|
-
textContent: this.textContent?.trim() ?? "",
|
|
129
|
-
disabled: this.disabled,
|
|
130
|
-
groupId: this.#getGroupId(),
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
connectedCallback() {
|
|
134
|
-
super.connectedCallback();
|
|
135
|
-
// Defer registration to next frame so context is available
|
|
136
|
-
requestAnimationFrame(() => {
|
|
137
|
-
if (!this.isConnected)
|
|
138
|
-
return;
|
|
139
|
-
this._ctx?.registerItem(this.#buildEntry());
|
|
140
|
-
this.#registered = true;
|
|
141
|
-
this.#prevValue = this.value;
|
|
142
|
-
this.#prevKeywords = this.keywords;
|
|
143
|
-
this.#prevDisabled = this.disabled;
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
disconnectedCallback() {
|
|
147
|
-
super.disconnectedCallback();
|
|
148
|
-
this._ctx?.unregisterItem(this.#id);
|
|
149
|
-
this.#registered = false;
|
|
150
|
-
}
|
|
151
|
-
willUpdate() {
|
|
152
|
-
// Only call updateItem when own properties change, not on every context update
|
|
153
|
-
if (this.#registered) {
|
|
154
|
-
const valueChanged = this.#prevValue !== this.value;
|
|
155
|
-
const keywordsChanged = this.#prevKeywords !== this.keywords;
|
|
156
|
-
const disabledChanged = this.#prevDisabled !== this.disabled;
|
|
157
|
-
if (valueChanged || keywordsChanged || disabledChanged) {
|
|
158
|
-
this._ctx?.updateItem(this.#buildEntry());
|
|
159
|
-
this.#prevValue = this.value;
|
|
160
|
-
this.#prevKeywords = this.keywords;
|
|
161
|
-
this.#prevDisabled = this.disabled;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
// Toggle data-hidden attribute
|
|
165
|
-
if (this._ctx?.shouldFilter) {
|
|
166
|
-
if (!this.#isVisible) {
|
|
167
|
-
this.setAttribute("data-hidden", "");
|
|
168
|
-
}
|
|
169
|
-
else {
|
|
170
|
-
this.removeAttribute("data-hidden");
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
this.removeAttribute("data-hidden");
|
|
175
|
-
}
|
|
176
|
-
// Update selected attribute
|
|
177
|
-
if (this.#isSelected) {
|
|
178
|
-
this.setAttribute("data-selected", "");
|
|
179
|
-
}
|
|
180
|
-
else {
|
|
181
|
-
this.removeAttribute("data-selected");
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
updated() {
|
|
185
|
-
// Scroll into view when selected
|
|
186
|
-
if (this.#isSelected) {
|
|
187
|
-
this.scrollIntoView({ block: "nearest" });
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
#handleMouseMove = () => {
|
|
191
|
-
if (!this.disabled && this._ctx?.selectedItemId !== this.#id) {
|
|
192
|
-
this._ctx?.selectItem(this.#id);
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
#handleClick = () => {
|
|
196
|
-
if (!this.disabled) {
|
|
197
|
-
this._ctx?.handleItemSelect(this.value);
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
|
-
render() {
|
|
201
|
-
return html `
|
|
202
|
-
<div
|
|
203
|
-
class="Item"
|
|
204
|
-
role="option"
|
|
205
|
-
id="${this.#id}"
|
|
206
|
-
aria-selected="${this.#isSelected}"
|
|
207
|
-
aria-disabled="${this.disabled}"
|
|
208
|
-
?data-selected="${this.#isSelected}"
|
|
209
|
-
?data-disabled="${this.disabled}"
|
|
210
|
-
@mousemove="${this.#handleMouseMove}"
|
|
211
|
-
@click="${this.#handleClick}"
|
|
212
|
-
>
|
|
213
|
-
<slot></slot>
|
|
214
|
-
</div>
|
|
215
|
-
`;
|
|
216
|
-
}
|
|
217
|
-
};
|
|
218
|
-
})();
|
|
219
|
-
export { DuiCommandItem };
|
|
27
|
+
export class DuiCommandItem extends DuiCommandItemPrimitive {
|
|
28
|
+
static styles = [...DuiCommandItemPrimitive.styles, styles];
|
|
29
|
+
}
|
|
30
|
+
customElements.define(DuiCommandItem.tagName, DuiCommandItem);
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export declare class DuiCommandList extends LitElement {
|
|
5
|
-
static tagName: "dui-command-list";
|
|
1
|
+
import { DuiCommandListPrimitive } from "@deepfuture/dui-primitives/command";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiCommandList extends DuiCommandListPrimitive {
|
|
6
4
|
static styles: import("lit").CSSResult[];
|
|
7
|
-
accessor _ctx: CommandContext;
|
|
8
|
-
render(): TemplateResult;
|
|
9
5
|
}
|
package/command/command-list.js
CHANGED
|
@@ -1,85 +1,17 @@
|
|
|
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
|
-
import { css, html, LitElement } from "lit";
|
|
37
|
-
import { consume } from "@lit/context";
|
|
38
|
-
import { base } from "@deepfuture/dui-core/base";
|
|
39
|
-
import { commandContext } from "./command-context.js";
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiCommandListPrimitive } from "@deepfuture/dui-primitives/command";
|
|
3
|
+
import "../_install.js";
|
|
40
4
|
const styles = css `
|
|
41
|
-
|
|
42
|
-
|
|
5
|
+
dui-scroll-area {
|
|
6
|
+
max-height: calc(var(--space-5) * 15);
|
|
7
|
+
height: auto;
|
|
43
8
|
}
|
|
44
9
|
|
|
45
10
|
.List {
|
|
46
|
-
|
|
11
|
+
padding: var(--space-1) 0;
|
|
47
12
|
}
|
|
48
13
|
`;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let __ctx_extraInitializers = [];
|
|
54
|
-
return class DuiCommandList extends _classSuper {
|
|
55
|
-
static {
|
|
56
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
57
|
-
__ctx_decorators = [consume({ context: commandContext, subscribe: true })];
|
|
58
|
-
__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);
|
|
59
|
-
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
60
|
-
}
|
|
61
|
-
static tagName = "dui-command-list";
|
|
62
|
-
static styles = [base, styles];
|
|
63
|
-
#_ctx_accessor_storage = __runInitializers(this, __ctx_initializers, void 0);
|
|
64
|
-
get _ctx() { return this.#_ctx_accessor_storage; }
|
|
65
|
-
set _ctx(value) { this.#_ctx_accessor_storage = value; }
|
|
66
|
-
render() {
|
|
67
|
-
return html `
|
|
68
|
-
<dui-scroll-area>
|
|
69
|
-
<div
|
|
70
|
-
class="List"
|
|
71
|
-
role="listbox"
|
|
72
|
-
id="${this._ctx?.listId ?? ""}"
|
|
73
|
-
>
|
|
74
|
-
<slot></slot>
|
|
75
|
-
</div>
|
|
76
|
-
</dui-scroll-area>
|
|
77
|
-
`;
|
|
78
|
-
}
|
|
79
|
-
constructor() {
|
|
80
|
-
super(...arguments);
|
|
81
|
-
__runInitializers(this, __ctx_extraInitializers);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
})();
|
|
85
|
-
export { DuiCommandList };
|
|
14
|
+
export class DuiCommandList extends DuiCommandListPrimitive {
|
|
15
|
+
static styles = [...DuiCommandListPrimitive.styles, styles];
|
|
16
|
+
}
|
|
17
|
+
customElements.define(DuiCommandList.tagName, DuiCommandList);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
export declare class DuiCommandSeparator extends
|
|
4
|
-
static tagName: "dui-command-separator";
|
|
1
|
+
import { DuiCommandSeparatorPrimitive } from "@deepfuture/dui-primitives/command";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiCommandSeparator extends DuiCommandSeparatorPrimitive {
|
|
5
4
|
static styles: import("lit").CSSResult[];
|
|
6
|
-
render(): TemplateResult;
|
|
7
5
|
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiCommandSeparatorPrimitive } from "@deepfuture/dui-primitives/command";
|
|
3
|
+
import "../_install.js";
|
|
4
4
|
const styles = css `
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
.Separator {
|
|
6
|
+
height: var(--border-width-thin);
|
|
7
|
+
margin-inline: calc(-1 * var(--space-1));
|
|
8
|
+
background: var(--border);
|
|
7
9
|
}
|
|
8
10
|
`;
|
|
9
|
-
export class DuiCommandSeparator extends
|
|
10
|
-
static
|
|
11
|
-
static styles = [base, styles];
|
|
12
|
-
render() {
|
|
13
|
-
return html `<div class="Separator" role="separator"></div>`;
|
|
14
|
-
}
|
|
11
|
+
export class DuiCommandSeparator extends DuiCommandSeparatorPrimitive {
|
|
12
|
+
static styles = [...DuiCommandSeparatorPrimitive.styles, styles];
|
|
15
13
|
}
|
|
14
|
+
customElements.define(DuiCommandSeparator.tagName, DuiCommandSeparator);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
export declare class DuiCommandShortcut extends
|
|
4
|
-
static tagName: "dui-command-shortcut";
|
|
1
|
+
import { DuiCommandShortcutPrimitive } from "@deepfuture/dui-primitives/command";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiCommandShortcut extends DuiCommandShortcutPrimitive {
|
|
5
4
|
static styles: import("lit").CSSResult[];
|
|
6
|
-
render(): TemplateResult;
|
|
7
5
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { DuiCommandShortcutPrimitive } from "@deepfuture/dui-primitives/command";
|
|
3
|
+
import "../_install.js";
|
|
4
4
|
const styles = css `
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
.Shortcut {
|
|
6
|
+
font-size: var(--text-xs); line-height: var(--text-xs--line-height);
|
|
7
|
+
color: var(--text-2);
|
|
8
8
|
}
|
|
9
9
|
`;
|
|
10
|
-
export class DuiCommandShortcut extends
|
|
11
|
-
static
|
|
12
|
-
static styles = [base, styles];
|
|
13
|
-
render() {
|
|
14
|
-
return html `<span class="Shortcut"><slot></slot></span>`;
|
|
15
|
-
}
|
|
10
|
+
export class DuiCommandShortcut extends DuiCommandShortcutPrimitive {
|
|
11
|
+
static styles = [...DuiCommandShortcutPrimitive.styles, styles];
|
|
16
12
|
}
|
|
13
|
+
customElements.define(DuiCommandShortcut.tagName, DuiCommandShortcut);
|
package/command/command.d.ts
CHANGED
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
export type FilterFn = (value: string, search: string, keywords?: readonly string[]) => number;
|
|
5
|
-
export declare const selectEvent: (detail: string) => CustomEvent<string>;
|
|
6
|
-
export declare const searchChangeEvent: (detail: string) => CustomEvent<string>;
|
|
7
|
-
export declare const escapeEvent: (detail: void) => CustomEvent<void>;
|
|
8
|
-
export declare class DuiCommand extends LitElement {
|
|
9
|
-
#private;
|
|
10
|
-
static tagName: "dui-command";
|
|
1
|
+
import { DuiCommandPrimitive } from "@deepfuture/dui-primitives/command";
|
|
2
|
+
import "../_install.js";
|
|
3
|
+
export declare class DuiCommand extends DuiCommandPrimitive {
|
|
11
4
|
static styles: import("lit").CSSResult[];
|
|
12
|
-
/** Whether keyboard navigation wraps from last to first and vice versa. */
|
|
13
|
-
accessor loop: boolean;
|
|
14
|
-
/** Whether items should be filtered based on search text. */
|
|
15
|
-
accessor shouldFilter: boolean;
|
|
16
|
-
/** Controlled value — the currently selected item value. */
|
|
17
|
-
accessor value: string | undefined;
|
|
18
|
-
/** Custom filter function. */
|
|
19
|
-
accessor filter: FilterFn | undefined;
|
|
20
|
-
accessor _ctx: CommandContext;
|
|
21
|
-
connectedCallback(): void;
|
|
22
|
-
disconnectedCallback(): void;
|
|
23
|
-
willUpdate(): void;
|
|
24
|
-
render(): TemplateResult;
|
|
25
5
|
}
|