@ui-sdk/vue 0.0.0-stage → 0.1.0-beta.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/LICENSE +202 -0
- package/README.md +10 -2
- package/dist/accordion.d.ts +561 -0
- package/dist/accordion.js +24 -0
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +7 -0
- package/dist/alert-dialog.d.ts +231 -0
- package/dist/alert-dialog.js +33 -0
- package/dist/async-options.d.ts +18 -0
- package/dist/async-options.js +40 -0
- package/dist/autocomplete.d.ts +384 -0
- package/dist/autocomplete.js +344 -0
- package/dist/avatar.d.ts +40 -0
- package/dist/avatar.js +28 -0
- package/dist/button.d.ts +52 -0
- package/dist/button.js +43 -0
- package/dist/calendar-context.d.ts +10 -0
- package/dist/calendar-context.js +7 -0
- package/dist/calendar.d.ts +311 -0
- package/dist/calendar.js +349 -0
- package/dist/carousel.d.ts +236 -0
- package/dist/carousel.js +204 -0
- package/dist/checkbox.d.ts +211 -0
- package/dist/checkbox.js +151 -0
- package/dist/children.d.ts +41 -0
- package/dist/children.js +135 -0
- package/dist/collapsible.d.ts +54 -0
- package/dist/collapsible.js +18 -0
- package/dist/color-picker.d.ts +187 -0
- package/dist/color-picker.js +158 -0
- package/dist/color.d.ts +2 -0
- package/dist/color.js +21 -0
- package/dist/combobox.d.ts +517 -0
- package/dist/combobox.js +531 -0
- package/dist/command.d.ts +322 -0
- package/dist/command.js +345 -0
- package/dist/controller-target.d.ts +49 -0
- package/dist/controller-target.js +112 -0
- package/dist/create-parts.d.ts +126 -0
- package/dist/create-parts.js +206 -0
- package/dist/date-input.d.ts +133 -0
- package/dist/date-input.js +31 -0
- package/dist/date-picker.d.ts +328 -0
- package/dist/date-picker.js +354 -0
- package/dist/date.d.ts +2 -0
- package/dist/date.js +59 -0
- package/dist/dialog-parts.d.ts +259 -0
- package/dist/dialog-parts.js +300 -0
- package/dist/dialog.d.ts +251 -0
- package/dist/dialog.js +25 -0
- package/dist/drawer.d.ts +304 -0
- package/dist/drawer.js +373 -0
- package/dist/editor-context.d.ts +4 -0
- package/dist/editor-context.js +5 -0
- package/dist/field-context.d.ts +26 -0
- package/dist/field-context.js +44 -0
- package/dist/field.d.ts +154 -0
- package/dist/field.js +240 -0
- package/dist/file-input.d.ts +212 -0
- package/dist/file-input.js +255 -0
- package/dist/form-inputs.d.ts +16 -0
- package/dist/form-inputs.js +25 -0
- package/dist/gesture.d.ts +1 -0
- package/dist/gesture.js +15 -0
- package/dist/history.d.ts +2 -0
- package/dist/history.js +11 -0
- package/dist/hover-card.d.ts +137 -0
- package/dist/hover-card.js +153 -0
- package/dist/image-cropper.d.ts +74 -0
- package/dist/image-cropper.js +36 -0
- package/dist/image.d.ts +2 -0
- package/dist/image.js +5 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +60 -0
- package/dist/input.d.ts +120 -0
- package/dist/input.js +73 -0
- package/dist/item-icon.d.ts +34 -0
- package/dist/item-icon.js +63 -0
- package/dist/label.d.ts +16 -0
- package/dist/label.js +8 -0
- package/dist/lifecycle.d.ts +11 -0
- package/dist/lifecycle.js +91 -0
- package/dist/list-items.d.ts +38 -0
- package/dist/list-items.js +59 -0
- package/dist/list-text.d.ts +7 -0
- package/dist/list-text.js +15 -0
- package/dist/listbox.d.ts +273 -0
- package/dist/listbox.js +126 -0
- package/dist/menu.d.ts +678 -0
- package/dist/menu.js +607 -0
- package/dist/menubar-context.d.ts +5 -0
- package/dist/menubar-context.js +5 -0
- package/dist/menubar.d.ts +61 -0
- package/dist/menubar.js +48 -0
- package/dist/meter.d.ts +41 -0
- package/dist/meter.js +37 -0
- package/dist/navigation-menu.d.ts +228 -0
- package/dist/navigation-menu.js +195 -0
- package/dist/number-input.d.ts +176 -0
- package/dist/number-input.js +231 -0
- package/dist/number.d.ts +2 -0
- package/dist/number.js +39 -0
- package/dist/nuxt/entries.json +977 -0
- package/dist/nuxt/module.d.ts +18 -0
- package/dist/nuxt/module.js +31 -0
- package/dist/nuxt/registrations.d.ts +22 -0
- package/dist/nuxt/registrations.js +22 -0
- package/dist/observe.d.ts +2 -0
- package/dist/observe.js +7 -0
- package/dist/otp-input.d.ts +142 -0
- package/dist/otp-input.js +130 -0
- package/dist/overlays.d.ts +40 -0
- package/dist/overlays.js +118 -0
- package/dist/pagination.d.ts +201 -0
- package/dist/pagination.js +146 -0
- package/dist/password-input.d.ts +144 -0
- package/dist/password-input.js +134 -0
- package/dist/popover.d.ts +211 -0
- package/dist/popover.js +258 -0
- package/dist/popup.d.ts +60 -0
- package/dist/popup.js +89 -0
- package/dist/preferences.d.ts +44 -0
- package/dist/preferences.js +102 -0
- package/dist/primitive.d.ts +2 -0
- package/dist/primitive.js +11 -0
- package/dist/progress.d.ts +41 -0
- package/dist/progress.js +37 -0
- package/dist/radio.d.ts +164 -0
- package/dist/radio.js +145 -0
- package/dist/rating.d.ts +149 -0
- package/dist/rating.js +146 -0
- package/dist/renderless.d.ts +4 -0
- package/dist/renderless.js +28 -0
- package/dist/resizable.d.ts +54 -0
- package/dist/resizable.js +22 -0
- package/dist/scroll-area.d.ts +72 -0
- package/dist/scroll-area.js +77 -0
- package/dist/segmented-control.d.ts +151 -0
- package/dist/segmented-control.js +110 -0
- package/dist/segmented-input.d.ts +76 -0
- package/dist/segmented-input.js +115 -0
- package/dist/select.d.ts +458 -0
- package/dist/select.js +468 -0
- package/dist/separator.d.ts +14 -0
- package/dist/separator.js +8 -0
- package/dist/shortcuts.d.ts +32 -0
- package/dist/shortcuts.js +56 -0
- package/dist/slider.d.ts +65 -0
- package/dist/slider.js +194 -0
- package/dist/switch.d.ts +103 -0
- package/dist/switch.js +71 -0
- package/dist/tabs.d.ts +338 -0
- package/dist/tabs.js +27 -0
- package/dist/text-control.d.ts +89 -0
- package/dist/text-control.js +51 -0
- package/dist/text-match.d.ts +2 -0
- package/dist/text-match.js +7 -0
- package/dist/textarea.d.ts +106 -0
- package/dist/textarea.js +68 -0
- package/dist/time-input.d.ts +131 -0
- package/dist/time-input.js +32 -0
- package/dist/timeline.d.ts +81 -0
- package/dist/timeline.js +30 -0
- package/dist/toast-parts.d.ts +203 -0
- package/dist/toast-parts.js +270 -0
- package/dist/toast.d.ts +2 -0
- package/dist/toast.js +21 -0
- package/dist/toggle-props.d.ts +22 -0
- package/dist/toggle-props.js +14 -0
- package/dist/toggle.d.ts +199 -0
- package/dist/toggle.js +129 -0
- package/dist/token-input.d.ts +136 -0
- package/dist/token-input.js +214 -0
- package/dist/toolbar-context.d.ts +7 -0
- package/dist/toolbar-context.js +20 -0
- package/dist/toolbar.d.ts +120 -0
- package/dist/toolbar.js +77 -0
- package/dist/tooltip.d.ts +160 -0
- package/dist/tooltip.js +224 -0
- package/dist/tree.d.ts +300 -0
- package/dist/tree.js +209 -0
- package/dist/trigger-menu.d.ts +452 -0
- package/dist/trigger-menu.js +254 -0
- package/dist/use-primitive.d.ts +132 -0
- package/dist/use-primitive.js +462 -0
- package/dist/waterfall.d.ts +201 -0
- package/dist/waterfall.js +171 -0
- package/docs/README.md +89 -0
- package/docs/agents.md +1523 -0
- package/docs/components/accordion.md +1369 -0
- package/docs/components/alert-dialog.md +799 -0
- package/docs/components/autocomplete.md +1857 -0
- package/docs/components/avatar.md +272 -0
- package/docs/components/button.md +435 -0
- package/docs/components/calendar.md +1589 -0
- package/docs/components/carousel.md +1171 -0
- package/docs/components/checkbox.md +1008 -0
- package/docs/components/collapsible.md +536 -0
- package/docs/components/color-picker.md +706 -0
- package/docs/components/combobox.md +3504 -0
- package/docs/components/command.md +1481 -0
- package/docs/components/date-input.md +536 -0
- package/docs/components/date-picker.md +1244 -0
- package/docs/components/dialog.md +1397 -0
- package/docs/components/drawer.md +1166 -0
- package/docs/components/field.md +538 -0
- package/docs/components/file-input.md +611 -0
- package/docs/components/hover-card.md +505 -0
- package/docs/components/image-cropper.md +556 -0
- package/docs/components/input.md +306 -0
- package/docs/components/label.md +203 -0
- package/docs/components/listbox.md +1004 -0
- package/docs/components/menu.md +1229 -0
- package/docs/components/menubar.md +443 -0
- package/docs/components/meter.md +315 -0
- package/docs/components/navigation-menu.md +1523 -0
- package/docs/components/number-input.md +1029 -0
- package/docs/components/otp-input.md +512 -0
- package/docs/components/pagination.md +613 -0
- package/docs/components/password-input.md +649 -0
- package/docs/components/popover.md +1448 -0
- package/docs/components/preferences.md +208 -0
- package/docs/components/progress.md +423 -0
- package/docs/components/radio.md +785 -0
- package/docs/components/rating.md +416 -0
- package/docs/components/resizable.md +910 -0
- package/docs/components/scroll-area.md +915 -0
- package/docs/components/segmented-control.md +435 -0
- package/docs/components/select.md +2015 -0
- package/docs/components/separator.md +229 -0
- package/docs/components/slider.md +1084 -0
- package/docs/components/switch.md +565 -0
- package/docs/components/tabs.md +944 -0
- package/docs/components/textarea.md +299 -0
- package/docs/components/time-input.md +224 -0
- package/docs/components/timeline.md +654 -0
- package/docs/components/toast.md +1224 -0
- package/docs/components/toggle.md +500 -0
- package/docs/components/token-input.md +953 -0
- package/docs/components/toolbar.md +739 -0
- package/docs/components/tooltip.md +818 -0
- package/docs/components/tree.md +1306 -0
- package/docs/components/trigger-menu.md +1223 -0
- package/docs/components/waterfall.md +717 -0
- package/docs/controllers.md +71 -0
- package/docs/core.md +8027 -0
- package/docs/custom-parts.md +89 -0
- package/docs/first-component.md +83 -0
- package/docs/forms.md +122 -0
- package/docs/installation.md +72 -0
- package/docs/introduction.md +32 -0
- package/docs/lists-and-menus.md +122 -0
- package/docs/llms.txt +1502 -0
- package/docs/parts-and-composition.md +85 -0
- package/docs/popups.md +108 -0
- package/docs/rendering.md +56 -0
- package/docs/server-rendering.md +180 -0
- package/docs/state-and-events.md +100 -0
- package/docs/styling-and-animation.md +148 -0
- package/docs/utilities/async-options.md +348 -0
- package/docs/utilities/shortcuts.md +159 -0
- package/package.json +352 -3
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
import type { ChangeDetails } from "@ui-sdk/core";
|
|
2
|
+
import type { AsyncOptionsStatus } from "@ui-sdk/core/async-options";
|
|
3
|
+
import { type CommandActionDetails, type CommandController, type CommandData, type CommandPagesChangeReason, type CommandQueryChangeReason, type CommandValueChangeDetails, type ListAnnouncement, type SearchFilter } from "@ui-sdk/core/command";
|
|
4
|
+
import { type PropType, type VNode } from "vue";
|
|
5
|
+
import { type PartSlots } from "./use-primitive.js";
|
|
6
|
+
type QueryDetails = ChangeDetails<CommandQueryChangeReason>;
|
|
7
|
+
type PagesDetails = ChangeDetails<CommandPagesChangeReason>;
|
|
8
|
+
/**
|
|
9
|
+
* A search field over an always-open list of commands. Renders a `div` around them.
|
|
10
|
+
* @stable
|
|
11
|
+
*/
|
|
12
|
+
declare const Command: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
value: {
|
|
14
|
+
type: PropType<string | null>;
|
|
15
|
+
default: undefined;
|
|
16
|
+
};
|
|
17
|
+
modelValue: {
|
|
18
|
+
type: PropType<string | null>;
|
|
19
|
+
default: undefined;
|
|
20
|
+
};
|
|
21
|
+
defaultValue: {
|
|
22
|
+
type: PropType<string | null>;
|
|
23
|
+
default: undefined;
|
|
24
|
+
};
|
|
25
|
+
query: {
|
|
26
|
+
type: StringConstructor;
|
|
27
|
+
default: undefined;
|
|
28
|
+
};
|
|
29
|
+
defaultQuery: {
|
|
30
|
+
type: StringConstructor;
|
|
31
|
+
default: undefined;
|
|
32
|
+
};
|
|
33
|
+
pages: {
|
|
34
|
+
type: PropType<string[]>;
|
|
35
|
+
default: undefined;
|
|
36
|
+
};
|
|
37
|
+
defaultPages: {
|
|
38
|
+
type: PropType<string[]>;
|
|
39
|
+
default: undefined;
|
|
40
|
+
};
|
|
41
|
+
pendingAnnouncement: StringConstructor;
|
|
42
|
+
onAction: PropType<(value: string, details: CommandActionDetails) => unknown>;
|
|
43
|
+
items: PropType<CommandData>;
|
|
44
|
+
emptyItems: PropType<CommandData>;
|
|
45
|
+
filter: {
|
|
46
|
+
type: PropType<SearchFilter<string>>;
|
|
47
|
+
default: undefined;
|
|
48
|
+
};
|
|
49
|
+
announcement: PropType<(change: ListAnnouncement) => string | null | undefined>;
|
|
50
|
+
autoHighlight: {
|
|
51
|
+
type: BooleanConstructor;
|
|
52
|
+
default: undefined;
|
|
53
|
+
};
|
|
54
|
+
loop: {
|
|
55
|
+
type: BooleanConstructor;
|
|
56
|
+
default: undefined;
|
|
57
|
+
};
|
|
58
|
+
status: PropType<AsyncOptionsStatus>;
|
|
59
|
+
controller: PropType<CommandController>;
|
|
60
|
+
debug: {
|
|
61
|
+
type: BooleanConstructor;
|
|
62
|
+
default: undefined;
|
|
63
|
+
};
|
|
64
|
+
}>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
65
|
+
[key: string]: any;
|
|
66
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
67
|
+
[key: string]: any;
|
|
68
|
+
}>[] | null) & {
|
|
69
|
+
state: NoInfer<import("@ui-sdk/core/command").CommandState>;
|
|
70
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
71
|
+
"update:value": (_value: string | null) => true;
|
|
72
|
+
"update:modelValue": (_value: string | null) => true;
|
|
73
|
+
valueChange: (_value: string | null, _details: CommandValueChangeDetails) => true;
|
|
74
|
+
"update:query": (_query: string) => true;
|
|
75
|
+
queryChange: (_query: string, _details: QueryDetails) => true;
|
|
76
|
+
"update:pages": (_pages: string[]) => true;
|
|
77
|
+
pagesChange: (_pages: string[], _details: PagesDetails) => true;
|
|
78
|
+
loadMore: () => true;
|
|
79
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
80
|
+
value: {
|
|
81
|
+
type: PropType<string | null>;
|
|
82
|
+
default: undefined;
|
|
83
|
+
};
|
|
84
|
+
modelValue: {
|
|
85
|
+
type: PropType<string | null>;
|
|
86
|
+
default: undefined;
|
|
87
|
+
};
|
|
88
|
+
defaultValue: {
|
|
89
|
+
type: PropType<string | null>;
|
|
90
|
+
default: undefined;
|
|
91
|
+
};
|
|
92
|
+
query: {
|
|
93
|
+
type: StringConstructor;
|
|
94
|
+
default: undefined;
|
|
95
|
+
};
|
|
96
|
+
defaultQuery: {
|
|
97
|
+
type: StringConstructor;
|
|
98
|
+
default: undefined;
|
|
99
|
+
};
|
|
100
|
+
pages: {
|
|
101
|
+
type: PropType<string[]>;
|
|
102
|
+
default: undefined;
|
|
103
|
+
};
|
|
104
|
+
defaultPages: {
|
|
105
|
+
type: PropType<string[]>;
|
|
106
|
+
default: undefined;
|
|
107
|
+
};
|
|
108
|
+
pendingAnnouncement: StringConstructor;
|
|
109
|
+
onAction: PropType<(value: string, details: CommandActionDetails) => unknown>;
|
|
110
|
+
items: PropType<CommandData>;
|
|
111
|
+
emptyItems: PropType<CommandData>;
|
|
112
|
+
filter: {
|
|
113
|
+
type: PropType<SearchFilter<string>>;
|
|
114
|
+
default: undefined;
|
|
115
|
+
};
|
|
116
|
+
announcement: PropType<(change: ListAnnouncement) => string | null | undefined>;
|
|
117
|
+
autoHighlight: {
|
|
118
|
+
type: BooleanConstructor;
|
|
119
|
+
default: undefined;
|
|
120
|
+
};
|
|
121
|
+
loop: {
|
|
122
|
+
type: BooleanConstructor;
|
|
123
|
+
default: undefined;
|
|
124
|
+
};
|
|
125
|
+
status: PropType<AsyncOptionsStatus>;
|
|
126
|
+
controller: PropType<CommandController>;
|
|
127
|
+
debug: {
|
|
128
|
+
type: BooleanConstructor;
|
|
129
|
+
default: undefined;
|
|
130
|
+
};
|
|
131
|
+
}>> & Readonly<{
|
|
132
|
+
onLoadMore?: (() => any) | undefined;
|
|
133
|
+
"onUpdate:modelValue"?: ((_value: string | null) => any) | undefined;
|
|
134
|
+
"onUpdate:value"?: ((_value: string | null) => any) | undefined;
|
|
135
|
+
onValueChange?: ((_value: string | null, _details: CommandValueChangeDetails) => any) | undefined;
|
|
136
|
+
onQueryChange?: ((_query: string, _details: QueryDetails) => any) | undefined;
|
|
137
|
+
"onUpdate:query"?: ((_query: string) => any) | undefined;
|
|
138
|
+
"onUpdate:pages"?: ((_pages: string[]) => any) | undefined;
|
|
139
|
+
onPagesChange?: ((_pages: string[], _details: PagesDetails) => any) | undefined;
|
|
140
|
+
}>, {
|
|
141
|
+
filter: SearchFilter<string>;
|
|
142
|
+
value: string | null;
|
|
143
|
+
debug: boolean;
|
|
144
|
+
defaultValue: string | null;
|
|
145
|
+
query: string;
|
|
146
|
+
loop: boolean;
|
|
147
|
+
autoHighlight: boolean;
|
|
148
|
+
pages: string[];
|
|
149
|
+
defaultQuery: string;
|
|
150
|
+
defaultPages: string[];
|
|
151
|
+
modelValue: string | null;
|
|
152
|
+
}, PartSlots<import("@ui-sdk/core/command").CommandPrimitive, "root">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
|
|
153
|
+
/**
|
|
154
|
+
* The search field. It keeps focus while arrow keys move the highlight. Name it with `aria-label`.
|
|
155
|
+
* @stable
|
|
156
|
+
*/
|
|
157
|
+
declare const CommandInput: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/command").CommandInputState>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<import("@ui-sdk/core/command").CommandInputState>>>, "input">;
|
|
158
|
+
/**
|
|
159
|
+
* The listbox. Without content, it renders the command's `items`, ranked as the user types.
|
|
160
|
+
* @stable
|
|
161
|
+
*/
|
|
162
|
+
declare const CommandList: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
163
|
+
[key: string]: any;
|
|
164
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
165
|
+
[key: string]: any;
|
|
166
|
+
}>[] | null) & {
|
|
167
|
+
state: NoInfer<import("@ui-sdk/core/command").CommandListState>;
|
|
168
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/command").CommandPrimitive, "list">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
|
|
169
|
+
/**
|
|
170
|
+
* A command. Pressing it, or Enter while it's highlighted, runs it, with its `value` passed to the command's
|
|
171
|
+
* `@action`.
|
|
172
|
+
* @stable
|
|
173
|
+
*/
|
|
174
|
+
declare const CommandItem: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
175
|
+
value: StringConstructor;
|
|
176
|
+
label: StringConstructor;
|
|
177
|
+
keywords: PropType<string[]>;
|
|
178
|
+
disabled: {
|
|
179
|
+
type: BooleanConstructor;
|
|
180
|
+
default: undefined;
|
|
181
|
+
};
|
|
182
|
+
shortcut: StringConstructor;
|
|
183
|
+
page: StringConstructor;
|
|
184
|
+
index: NumberConstructor;
|
|
185
|
+
onSelect: PropType<(event: Event) => unknown>;
|
|
186
|
+
}>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
187
|
+
[key: string]: any;
|
|
188
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
189
|
+
[key: string]: any;
|
|
190
|
+
}>[] | null) & {
|
|
191
|
+
state: NoInfer<import("@ui-sdk/core/command").CommandItemState>;
|
|
192
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
193
|
+
value: StringConstructor;
|
|
194
|
+
label: StringConstructor;
|
|
195
|
+
keywords: PropType<string[]>;
|
|
196
|
+
disabled: {
|
|
197
|
+
type: BooleanConstructor;
|
|
198
|
+
default: undefined;
|
|
199
|
+
};
|
|
200
|
+
shortcut: StringConstructor;
|
|
201
|
+
page: StringConstructor;
|
|
202
|
+
index: NumberConstructor;
|
|
203
|
+
onSelect: PropType<(event: Event) => unknown>;
|
|
204
|
+
}>> & Readonly<{}>, {
|
|
205
|
+
disabled: boolean;
|
|
206
|
+
}, PartSlots<import("@ui-sdk/core/command").CommandPrimitive, "item">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
|
|
207
|
+
/**
|
|
208
|
+
* The command's text, with the part the search matched in `<mark>`. Without text content, it shows the command's label.
|
|
209
|
+
* @stable
|
|
210
|
+
*/
|
|
211
|
+
declare const CommandItemText: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
212
|
+
[key: string]: any;
|
|
213
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
214
|
+
[key: string]: any;
|
|
215
|
+
}>[] | null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/command").CommandPrimitive, "item-text">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "span">;
|
|
216
|
+
/**
|
|
217
|
+
* The keys of a command's shortcut, formatted for the platform. Inside a command, its `shortcut`.
|
|
218
|
+
* @stable
|
|
219
|
+
*/
|
|
220
|
+
declare const CommandShortcut: import("./create-parts.js").ElementPart<import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
221
|
+
shortcut: StringConstructor;
|
|
222
|
+
}>, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
223
|
+
[key: string]: any;
|
|
224
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
225
|
+
[key: string]: any;
|
|
226
|
+
}>[] | null) & {
|
|
227
|
+
state: NoInfer<import("@ui-sdk/core/command").CommandShortcutState>;
|
|
228
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
229
|
+
shortcut: StringConstructor;
|
|
230
|
+
}>> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/command").CommandPrimitive, "shortcut">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "span">;
|
|
231
|
+
/**
|
|
232
|
+
* Commands shown while this page is on top. Without `value`, it's the first page. Renders no element.
|
|
233
|
+
* @stable
|
|
234
|
+
*/
|
|
235
|
+
declare const CommandPage: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
236
|
+
value: StringConstructor;
|
|
237
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
238
|
+
[key: string]: any;
|
|
239
|
+
}>[] | null | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
240
|
+
value: StringConstructor;
|
|
241
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
242
|
+
/**
|
|
243
|
+
* An icon inside a command. Screen readers, typeahead and filtering
|
|
244
|
+
* skip it, and `mirror` flips it in right-to-left text.
|
|
245
|
+
* @stable
|
|
246
|
+
*/
|
|
247
|
+
declare const CommandItemIcon: Pick<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/renderer").ItemIconProps & {
|
|
248
|
+
item?: string;
|
|
249
|
+
}> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<{
|
|
250
|
+
mirror: boolean;
|
|
251
|
+
}>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<NoInfer<import("@ui-sdk/core/renderer").ItemIconProps & {
|
|
252
|
+
item?: string;
|
|
253
|
+
}> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<{
|
|
254
|
+
mirror: boolean;
|
|
255
|
+
}>>>, "span">;
|
|
256
|
+
/**
|
|
257
|
+
* A group of commands. It hides while none of its commands matches the search.
|
|
258
|
+
* @stable
|
|
259
|
+
*/
|
|
260
|
+
declare const CommandGroup: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, "div">;
|
|
261
|
+
/**
|
|
262
|
+
* A group's heading, which names it.
|
|
263
|
+
* @stable
|
|
264
|
+
*/
|
|
265
|
+
declare const CommandGroupLabel: Pick<import("vue").DefineSetupFnComponent<Omit<NoInfer<{
|
|
266
|
+
group?: string;
|
|
267
|
+
}> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<NoInfer<{
|
|
268
|
+
group?: string;
|
|
269
|
+
}> & import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, "div">;
|
|
270
|
+
/**
|
|
271
|
+
* A line between groups. Composed separators hide while the list is filtered.
|
|
272
|
+
* @stable
|
|
273
|
+
*/
|
|
274
|
+
declare const CommandSeparator: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<{}>>, "div">;
|
|
275
|
+
/**
|
|
276
|
+
* Shown while no command matches. Its message is announced when it appears. Place it outside the list.
|
|
277
|
+
* @stable
|
|
278
|
+
*/
|
|
279
|
+
declare const CommandEmpty: import("./create-parts.js").ElementPart<import("vue").DefineComponent<{}, (() => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
280
|
+
[key: string]: any;
|
|
281
|
+
}> | VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
282
|
+
[key: string]: any;
|
|
283
|
+
}>[] | null) & {
|
|
284
|
+
state: NoInfer<{
|
|
285
|
+
loading: boolean;
|
|
286
|
+
empty: boolean;
|
|
287
|
+
query: string;
|
|
288
|
+
}>;
|
|
289
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, PartSlots<import("@ui-sdk/core/command").CommandPrimitive, "empty">, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, "div">;
|
|
290
|
+
/**
|
|
291
|
+
* A polite live region for loading and result counts. Its content is yours, from the default slot's state.
|
|
292
|
+
* @stable
|
|
293
|
+
*/
|
|
294
|
+
declare const CommandStatus: Pick<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<{
|
|
295
|
+
status: AsyncOptionsStatus;
|
|
296
|
+
loading: boolean;
|
|
297
|
+
count: number;
|
|
298
|
+
}>>>, never> & import("./create-parts.js").ElementConstructor<import("vue").DefineSetupFnComponent<Omit<import("@ui-sdk/core/renderer").BaseSlotProps, never>, {} & {}, import("./use-primitive.js").StateSlots<NoInfer<{
|
|
299
|
+
status: AsyncOptionsStatus;
|
|
300
|
+
loading: boolean;
|
|
301
|
+
count: number;
|
|
302
|
+
}>>>, "div">;
|
|
303
|
+
/**
|
|
304
|
+
* Renders data commands. Used by data command lists, and available for custom layouts.
|
|
305
|
+
* @stable
|
|
306
|
+
*/
|
|
307
|
+
declare const CommandItems: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
308
|
+
items: {
|
|
309
|
+
type: PropType<CommandData>;
|
|
310
|
+
required: true;
|
|
311
|
+
};
|
|
312
|
+
}>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
313
|
+
[key: string]: any;
|
|
314
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
315
|
+
items: {
|
|
316
|
+
type: PropType<CommandData>;
|
|
317
|
+
required: true;
|
|
318
|
+
};
|
|
319
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
320
|
+
export { createCommandController } from "@ui-sdk/core/command";
|
|
321
|
+
export type { CommandActionDetails, CommandApi, CommandChangeOptions, CommandController, CommandData, CommandDataGroup, CommandDataItem, CommandEmptyState, CommandInputState, CommandItemIconProps, CommandItemIconState, CommandItemProps, CommandItemState, CommandItemTextState, CommandListState, CommandOptions, CommandPageProps, CommandPagesChangeReason, CommandPrimitive, CommandQueryChangeReason, CommandState, CommandShortcutProps, CommandShortcutState, CommandStatusState, CommandValueChangeDetails, CommandValueChangeReason, ListAnnouncement, ListFilter, ListSeparator, MatchSegment, SearchFilter, } from "@ui-sdk/core/command";
|
|
322
|
+
export { Command, CommandEmpty, CommandGroup, CommandGroupLabel, CommandInput, CommandItem, CommandItemIcon, CommandItems, CommandItemText, CommandList, CommandPage, CommandSeparator, CommandShortcut, CommandStatus, };
|
package/dist/command.js
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
// src/command.ts
|
|
2
|
+
import {
|
|
3
|
+
command as commandPrimitive
|
|
4
|
+
} from "@ui-sdk/core/command";
|
|
5
|
+
import {
|
|
6
|
+
defineComponent,
|
|
7
|
+
Fragment,
|
|
8
|
+
h,
|
|
9
|
+
inject,
|
|
10
|
+
provide,
|
|
11
|
+
useId
|
|
12
|
+
} from "vue";
|
|
13
|
+
import {
|
|
14
|
+
hasChild,
|
|
15
|
+
NotPlaced,
|
|
16
|
+
slotContent,
|
|
17
|
+
usePlaceContent,
|
|
18
|
+
usePlacedContent
|
|
19
|
+
} from "./children.js";
|
|
20
|
+
import { useControllerEntry } from "./controller-target.js";
|
|
21
|
+
import { markSegments, slotText } from "./list-text.js";
|
|
22
|
+
import { createParts, withElement } from "./create-parts.js";
|
|
23
|
+
import {
|
|
24
|
+
defaultSlot,
|
|
25
|
+
optionalBoolean,
|
|
26
|
+
orModel,
|
|
27
|
+
provideProps,
|
|
28
|
+
useHandle,
|
|
29
|
+
usePart,
|
|
30
|
+
usePrimitive,
|
|
31
|
+
useScope
|
|
32
|
+
} from "./use-primitive.js";
|
|
33
|
+
import { renderless } from "./renderless.js";
|
|
34
|
+
import { createCommandController } from "@ui-sdk/core/command";
|
|
35
|
+
var PageKey = /* @__PURE__ */ Symbol("command-page");
|
|
36
|
+
var DataKey = /* @__PURE__ */ Symbol("command-data");
|
|
37
|
+
var useCommand = () => useHandle(commandPrimitive);
|
|
38
|
+
var useItem = () => useScope(commandPrimitive)?.around.item;
|
|
39
|
+
var parts = createParts(commandPrimitive, {
|
|
40
|
+
input: "input",
|
|
41
|
+
"item-icon": "span",
|
|
42
|
+
group: "div",
|
|
43
|
+
"group-label": "div",
|
|
44
|
+
separator: "div",
|
|
45
|
+
status: "div"
|
|
46
|
+
});
|
|
47
|
+
var Command = withElement(
|
|
48
|
+
"div",
|
|
49
|
+
defineComponent({
|
|
50
|
+
name: "Command",
|
|
51
|
+
inheritAttrs: false,
|
|
52
|
+
props: {
|
|
53
|
+
value: {
|
|
54
|
+
type: null,
|
|
55
|
+
default: void 0
|
|
56
|
+
},
|
|
57
|
+
modelValue: {
|
|
58
|
+
type: null,
|
|
59
|
+
default: void 0
|
|
60
|
+
},
|
|
61
|
+
defaultValue: {
|
|
62
|
+
type: null,
|
|
63
|
+
default: void 0
|
|
64
|
+
},
|
|
65
|
+
query: { type: String, default: void 0 },
|
|
66
|
+
defaultQuery: { type: String, default: void 0 },
|
|
67
|
+
pages: { type: Array, default: void 0 },
|
|
68
|
+
defaultPages: { type: Array, default: void 0 },
|
|
69
|
+
pendingAnnouncement: String,
|
|
70
|
+
// A function prop beside the emit, so a returned Promise marks the command pending.
|
|
71
|
+
onAction: Function,
|
|
72
|
+
items: Array,
|
|
73
|
+
emptyItems: Array,
|
|
74
|
+
filter: {
|
|
75
|
+
type: [String, Boolean, Function],
|
|
76
|
+
default: void 0
|
|
77
|
+
},
|
|
78
|
+
announcement: Function,
|
|
79
|
+
autoHighlight: optionalBoolean,
|
|
80
|
+
loop: optionalBoolean,
|
|
81
|
+
status: String,
|
|
82
|
+
controller: Object,
|
|
83
|
+
debug: optionalBoolean
|
|
84
|
+
},
|
|
85
|
+
emits: {
|
|
86
|
+
"update:value": (_value) => true,
|
|
87
|
+
"update:modelValue": (_value) => true,
|
|
88
|
+
valueChange: (_value, _details) => true,
|
|
89
|
+
"update:query": (_query) => true,
|
|
90
|
+
queryChange: (_query, _details) => true,
|
|
91
|
+
"update:pages": (_pages) => true,
|
|
92
|
+
pagesChange: (_pages, _details) => true,
|
|
93
|
+
loadMore: () => true
|
|
94
|
+
},
|
|
95
|
+
slots: Object,
|
|
96
|
+
setup(props, { slots, emit }) {
|
|
97
|
+
const command = usePrimitive(commandPrimitive, () => ({
|
|
98
|
+
...props,
|
|
99
|
+
value: orModel(props.value, props.modelValue),
|
|
100
|
+
onValueChange: (value, details) => {
|
|
101
|
+
emit("valueChange", value, details);
|
|
102
|
+
if (details.canceled) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
emit("update:value", value);
|
|
106
|
+
emit("update:modelValue", value);
|
|
107
|
+
},
|
|
108
|
+
onQueryChange: (query, details) => {
|
|
109
|
+
emit("queryChange", query, details);
|
|
110
|
+
if (!details.canceled) {
|
|
111
|
+
emit("update:query", query);
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
onPagesChange: (pages, details) => {
|
|
115
|
+
emit("pagesChange", pages, details);
|
|
116
|
+
if (!details.canceled) {
|
|
117
|
+
emit("update:pages", pages);
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
onLoadMore: () => emit("loadMore")
|
|
121
|
+
}));
|
|
122
|
+
useControllerEntry(() => props.controller, command);
|
|
123
|
+
const placed = usePlacedContent();
|
|
124
|
+
return usePart(command, "root", void 0, void 0, {
|
|
125
|
+
tag: "div",
|
|
126
|
+
children: (state) => {
|
|
127
|
+
const children = slots.default?.({ state }) ?? [];
|
|
128
|
+
const own = !props.items || placed() || hasChild(children, CommandList);
|
|
129
|
+
return [
|
|
130
|
+
children,
|
|
131
|
+
props.items && !own && h(NotPlaced, () => h(CommandList))
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
);
|
|
138
|
+
var CommandInput = parts.Input;
|
|
139
|
+
var CommandList = withElement(
|
|
140
|
+
"div",
|
|
141
|
+
defineComponent({
|
|
142
|
+
name: "CommandList",
|
|
143
|
+
inheritAttrs: false,
|
|
144
|
+
slots: Object,
|
|
145
|
+
setup(_, { slots }) {
|
|
146
|
+
usePlaceContent();
|
|
147
|
+
const command = useCommand();
|
|
148
|
+
return usePart(command, "list", void 0, void 0, {
|
|
149
|
+
tag: "div",
|
|
150
|
+
children: (state) => defaultSlot(
|
|
151
|
+
slots,
|
|
152
|
+
state,
|
|
153
|
+
() => command.state.items && h(CommandItems, { items: state.items })
|
|
154
|
+
)
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
);
|
|
159
|
+
var CommandItem = withElement(
|
|
160
|
+
"div",
|
|
161
|
+
defineComponent({
|
|
162
|
+
name: "CommandItem",
|
|
163
|
+
inheritAttrs: false,
|
|
164
|
+
props: {
|
|
165
|
+
value: String,
|
|
166
|
+
label: String,
|
|
167
|
+
keywords: Array,
|
|
168
|
+
disabled: optionalBoolean,
|
|
169
|
+
shortcut: String,
|
|
170
|
+
page: String,
|
|
171
|
+
index: Number,
|
|
172
|
+
// A function prop beside the emit, so a returned Promise marks the command pending.
|
|
173
|
+
onSelect: Function
|
|
174
|
+
},
|
|
175
|
+
slots: Object,
|
|
176
|
+
setup(props) {
|
|
177
|
+
const generated = useId();
|
|
178
|
+
const group = useScope(commandPrimitive)?.around.group?.().id;
|
|
179
|
+
const inPage = inject(PageKey, void 0);
|
|
180
|
+
const data = inject(DataKey, false);
|
|
181
|
+
provideProps(commandPrimitive, "item", () => ({
|
|
182
|
+
value: props.value ?? generated,
|
|
183
|
+
label: props.label ?? props.value,
|
|
184
|
+
shortcut: props.shortcut
|
|
185
|
+
}));
|
|
186
|
+
const item = () => {
|
|
187
|
+
const key = props.value ?? generated;
|
|
188
|
+
return {
|
|
189
|
+
id: key,
|
|
190
|
+
value: key,
|
|
191
|
+
label: props.label,
|
|
192
|
+
keywords: props.keywords,
|
|
193
|
+
disabled: props.disabled,
|
|
194
|
+
shortcut: props.shortcut,
|
|
195
|
+
page: props.page,
|
|
196
|
+
index: props.index,
|
|
197
|
+
onSelect: props.onSelect,
|
|
198
|
+
group,
|
|
199
|
+
inPage,
|
|
200
|
+
data
|
|
201
|
+
};
|
|
202
|
+
};
|
|
203
|
+
return usePart(commandPrimitive, "item", item);
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
);
|
|
207
|
+
var CommandItemText = withElement(
|
|
208
|
+
"span",
|
|
209
|
+
defineComponent({
|
|
210
|
+
name: "CommandItemText",
|
|
211
|
+
inheritAttrs: false,
|
|
212
|
+
slots: Object,
|
|
213
|
+
setup(_, { slots }) {
|
|
214
|
+
const item = useItem();
|
|
215
|
+
if (!item) {
|
|
216
|
+
throw new Error("<CommandItemText> must be used inside <CommandItem>.");
|
|
217
|
+
}
|
|
218
|
+
let text = "";
|
|
219
|
+
let own;
|
|
220
|
+
let ownText;
|
|
221
|
+
const part = usePart(
|
|
222
|
+
commandPrimitive,
|
|
223
|
+
"item-text",
|
|
224
|
+
() => ({ id: item().value, text }),
|
|
225
|
+
void 0,
|
|
226
|
+
{
|
|
227
|
+
tag: "span",
|
|
228
|
+
children: (state) => own && ownText === void 0 ? own : markSegments(state.segments)
|
|
229
|
+
}
|
|
230
|
+
);
|
|
231
|
+
return () => {
|
|
232
|
+
own = slotContent(slots.default, { state: part.state });
|
|
233
|
+
ownText = slotText(own);
|
|
234
|
+
text = ownText ?? item().label ?? "";
|
|
235
|
+
return part();
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
})
|
|
239
|
+
);
|
|
240
|
+
var CommandShortcut = withElement(
|
|
241
|
+
"span",
|
|
242
|
+
defineComponent({
|
|
243
|
+
name: "CommandShortcut",
|
|
244
|
+
inheritAttrs: false,
|
|
245
|
+
props: { shortcut: String },
|
|
246
|
+
slots: Object,
|
|
247
|
+
setup(props, { slots }) {
|
|
248
|
+
const item = useItem();
|
|
249
|
+
const part = () => ({ shortcut: props.shortcut ?? item?.().shortcut });
|
|
250
|
+
return usePart(commandPrimitive, "shortcut", part, void 0, {
|
|
251
|
+
tag: "span",
|
|
252
|
+
children: (state) => slotContent(slots.default, { state }) ?? state.text
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
})
|
|
256
|
+
);
|
|
257
|
+
var CommandPage = /* @__PURE__ */ renderless(
|
|
258
|
+
defineComponent({
|
|
259
|
+
name: "CommandPage",
|
|
260
|
+
props: { value: String },
|
|
261
|
+
setup(props, { slots }) {
|
|
262
|
+
const command = useCommand();
|
|
263
|
+
provide(PageKey, props.value ?? null);
|
|
264
|
+
return () => command.present("page", { value: props.value }) ? slots.default?.() : null;
|
|
265
|
+
}
|
|
266
|
+
})
|
|
267
|
+
);
|
|
268
|
+
var CommandItemIcon = parts.ItemIcon;
|
|
269
|
+
var CommandGroup = parts.Group;
|
|
270
|
+
var CommandGroupLabel = parts.GroupLabel;
|
|
271
|
+
var CommandSeparator = parts.Separator;
|
|
272
|
+
var CommandEmpty = withElement(
|
|
273
|
+
"div",
|
|
274
|
+
defineComponent({
|
|
275
|
+
name: "CommandEmpty",
|
|
276
|
+
inheritAttrs: false,
|
|
277
|
+
slots: Object,
|
|
278
|
+
setup(_, { slots }) {
|
|
279
|
+
return usePart(commandPrimitive, "empty", void 0, void 0, {
|
|
280
|
+
tag: "div",
|
|
281
|
+
children: (state) => state.empty ? slots.default?.({ state }) : null
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
);
|
|
286
|
+
var CommandStatus = parts.Status;
|
|
287
|
+
var CommandItems = /* @__PURE__ */ renderless(
|
|
288
|
+
defineComponent({
|
|
289
|
+
name: "CommandItems",
|
|
290
|
+
props: {
|
|
291
|
+
items: { type: Array, required: true }
|
|
292
|
+
},
|
|
293
|
+
setup(props) {
|
|
294
|
+
provide(DataKey, true);
|
|
295
|
+
const render = (items) => items.map((entry, index) => {
|
|
296
|
+
if (typeof entry === "string") {
|
|
297
|
+
return h(CommandItem, { key: entry, value: entry }, () => entry);
|
|
298
|
+
}
|
|
299
|
+
if ("type" in entry && entry.type === "separator") {
|
|
300
|
+
return h(CommandSeparator, { key: `separator-${index}` });
|
|
301
|
+
}
|
|
302
|
+
if ("type" in entry && entry.type === "group") {
|
|
303
|
+
return h(
|
|
304
|
+
CommandGroup,
|
|
305
|
+
{ key: `group-${entry.label ?? index}` },
|
|
306
|
+
() => [
|
|
307
|
+
entry.label && h(CommandGroupLabel, null, () => entry.label),
|
|
308
|
+
...render(entry.items)
|
|
309
|
+
]
|
|
310
|
+
);
|
|
311
|
+
}
|
|
312
|
+
return h(
|
|
313
|
+
CommandItem,
|
|
314
|
+
{
|
|
315
|
+
key: entry.value,
|
|
316
|
+
value: entry.value,
|
|
317
|
+
label: entry.label,
|
|
318
|
+
keywords: entry.keywords,
|
|
319
|
+
disabled: entry.disabled,
|
|
320
|
+
shortcut: entry.shortcut
|
|
321
|
+
},
|
|
322
|
+
() => entry.label
|
|
323
|
+
);
|
|
324
|
+
});
|
|
325
|
+
return () => h(Fragment, render(props.items));
|
|
326
|
+
}
|
|
327
|
+
})
|
|
328
|
+
);
|
|
329
|
+
export {
|
|
330
|
+
Command,
|
|
331
|
+
CommandEmpty,
|
|
332
|
+
CommandGroup,
|
|
333
|
+
CommandGroupLabel,
|
|
334
|
+
CommandInput,
|
|
335
|
+
CommandItem,
|
|
336
|
+
CommandItemIcon,
|
|
337
|
+
CommandItemText,
|
|
338
|
+
CommandItems,
|
|
339
|
+
CommandList,
|
|
340
|
+
CommandPage,
|
|
341
|
+
CommandSeparator,
|
|
342
|
+
CommandShortcut,
|
|
343
|
+
CommandStatus,
|
|
344
|
+
createCommandController
|
|
345
|
+
};
|