@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.
Files changed (262) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +10 -2
  3. package/dist/accordion.d.ts +561 -0
  4. package/dist/accordion.js +24 -0
  5. package/dist/agent.d.ts +2 -0
  6. package/dist/agent.js +7 -0
  7. package/dist/alert-dialog.d.ts +231 -0
  8. package/dist/alert-dialog.js +33 -0
  9. package/dist/async-options.d.ts +18 -0
  10. package/dist/async-options.js +40 -0
  11. package/dist/autocomplete.d.ts +384 -0
  12. package/dist/autocomplete.js +344 -0
  13. package/dist/avatar.d.ts +40 -0
  14. package/dist/avatar.js +28 -0
  15. package/dist/button.d.ts +52 -0
  16. package/dist/button.js +43 -0
  17. package/dist/calendar-context.d.ts +10 -0
  18. package/dist/calendar-context.js +7 -0
  19. package/dist/calendar.d.ts +311 -0
  20. package/dist/calendar.js +349 -0
  21. package/dist/carousel.d.ts +236 -0
  22. package/dist/carousel.js +204 -0
  23. package/dist/checkbox.d.ts +211 -0
  24. package/dist/checkbox.js +151 -0
  25. package/dist/children.d.ts +41 -0
  26. package/dist/children.js +135 -0
  27. package/dist/collapsible.d.ts +54 -0
  28. package/dist/collapsible.js +18 -0
  29. package/dist/color-picker.d.ts +187 -0
  30. package/dist/color-picker.js +158 -0
  31. package/dist/color.d.ts +2 -0
  32. package/dist/color.js +21 -0
  33. package/dist/combobox.d.ts +517 -0
  34. package/dist/combobox.js +531 -0
  35. package/dist/command.d.ts +322 -0
  36. package/dist/command.js +345 -0
  37. package/dist/controller-target.d.ts +49 -0
  38. package/dist/controller-target.js +112 -0
  39. package/dist/create-parts.d.ts +126 -0
  40. package/dist/create-parts.js +206 -0
  41. package/dist/date-input.d.ts +133 -0
  42. package/dist/date-input.js +31 -0
  43. package/dist/date-picker.d.ts +328 -0
  44. package/dist/date-picker.js +354 -0
  45. package/dist/date.d.ts +2 -0
  46. package/dist/date.js +59 -0
  47. package/dist/dialog-parts.d.ts +259 -0
  48. package/dist/dialog-parts.js +300 -0
  49. package/dist/dialog.d.ts +251 -0
  50. package/dist/dialog.js +25 -0
  51. package/dist/drawer.d.ts +304 -0
  52. package/dist/drawer.js +373 -0
  53. package/dist/editor-context.d.ts +4 -0
  54. package/dist/editor-context.js +5 -0
  55. package/dist/field-context.d.ts +26 -0
  56. package/dist/field-context.js +44 -0
  57. package/dist/field.d.ts +154 -0
  58. package/dist/field.js +240 -0
  59. package/dist/file-input.d.ts +212 -0
  60. package/dist/file-input.js +255 -0
  61. package/dist/form-inputs.d.ts +16 -0
  62. package/dist/form-inputs.js +25 -0
  63. package/dist/gesture.d.ts +1 -0
  64. package/dist/gesture.js +15 -0
  65. package/dist/history.d.ts +2 -0
  66. package/dist/history.js +11 -0
  67. package/dist/hover-card.d.ts +137 -0
  68. package/dist/hover-card.js +153 -0
  69. package/dist/image-cropper.d.ts +74 -0
  70. package/dist/image-cropper.js +36 -0
  71. package/dist/image.d.ts +2 -0
  72. package/dist/image.js +5 -0
  73. package/dist/index.d.ts +59 -0
  74. package/dist/index.js +60 -0
  75. package/dist/input.d.ts +120 -0
  76. package/dist/input.js +73 -0
  77. package/dist/item-icon.d.ts +34 -0
  78. package/dist/item-icon.js +63 -0
  79. package/dist/label.d.ts +16 -0
  80. package/dist/label.js +8 -0
  81. package/dist/lifecycle.d.ts +11 -0
  82. package/dist/lifecycle.js +91 -0
  83. package/dist/list-items.d.ts +38 -0
  84. package/dist/list-items.js +59 -0
  85. package/dist/list-text.d.ts +7 -0
  86. package/dist/list-text.js +15 -0
  87. package/dist/listbox.d.ts +273 -0
  88. package/dist/listbox.js +126 -0
  89. package/dist/menu.d.ts +678 -0
  90. package/dist/menu.js +607 -0
  91. package/dist/menubar-context.d.ts +5 -0
  92. package/dist/menubar-context.js +5 -0
  93. package/dist/menubar.d.ts +61 -0
  94. package/dist/menubar.js +48 -0
  95. package/dist/meter.d.ts +41 -0
  96. package/dist/meter.js +37 -0
  97. package/dist/navigation-menu.d.ts +228 -0
  98. package/dist/navigation-menu.js +195 -0
  99. package/dist/number-input.d.ts +176 -0
  100. package/dist/number-input.js +231 -0
  101. package/dist/number.d.ts +2 -0
  102. package/dist/number.js +39 -0
  103. package/dist/nuxt/entries.json +977 -0
  104. package/dist/nuxt/module.d.ts +18 -0
  105. package/dist/nuxt/module.js +31 -0
  106. package/dist/nuxt/registrations.d.ts +22 -0
  107. package/dist/nuxt/registrations.js +22 -0
  108. package/dist/observe.d.ts +2 -0
  109. package/dist/observe.js +7 -0
  110. package/dist/otp-input.d.ts +142 -0
  111. package/dist/otp-input.js +130 -0
  112. package/dist/overlays.d.ts +40 -0
  113. package/dist/overlays.js +118 -0
  114. package/dist/pagination.d.ts +201 -0
  115. package/dist/pagination.js +146 -0
  116. package/dist/password-input.d.ts +144 -0
  117. package/dist/password-input.js +134 -0
  118. package/dist/popover.d.ts +211 -0
  119. package/dist/popover.js +258 -0
  120. package/dist/popup.d.ts +60 -0
  121. package/dist/popup.js +89 -0
  122. package/dist/preferences.d.ts +44 -0
  123. package/dist/preferences.js +102 -0
  124. package/dist/primitive.d.ts +2 -0
  125. package/dist/primitive.js +11 -0
  126. package/dist/progress.d.ts +41 -0
  127. package/dist/progress.js +37 -0
  128. package/dist/radio.d.ts +164 -0
  129. package/dist/radio.js +145 -0
  130. package/dist/rating.d.ts +149 -0
  131. package/dist/rating.js +146 -0
  132. package/dist/renderless.d.ts +4 -0
  133. package/dist/renderless.js +28 -0
  134. package/dist/resizable.d.ts +54 -0
  135. package/dist/resizable.js +22 -0
  136. package/dist/scroll-area.d.ts +72 -0
  137. package/dist/scroll-area.js +77 -0
  138. package/dist/segmented-control.d.ts +151 -0
  139. package/dist/segmented-control.js +110 -0
  140. package/dist/segmented-input.d.ts +76 -0
  141. package/dist/segmented-input.js +115 -0
  142. package/dist/select.d.ts +458 -0
  143. package/dist/select.js +468 -0
  144. package/dist/separator.d.ts +14 -0
  145. package/dist/separator.js +8 -0
  146. package/dist/shortcuts.d.ts +32 -0
  147. package/dist/shortcuts.js +56 -0
  148. package/dist/slider.d.ts +65 -0
  149. package/dist/slider.js +194 -0
  150. package/dist/switch.d.ts +103 -0
  151. package/dist/switch.js +71 -0
  152. package/dist/tabs.d.ts +338 -0
  153. package/dist/tabs.js +27 -0
  154. package/dist/text-control.d.ts +89 -0
  155. package/dist/text-control.js +51 -0
  156. package/dist/text-match.d.ts +2 -0
  157. package/dist/text-match.js +7 -0
  158. package/dist/textarea.d.ts +106 -0
  159. package/dist/textarea.js +68 -0
  160. package/dist/time-input.d.ts +131 -0
  161. package/dist/time-input.js +32 -0
  162. package/dist/timeline.d.ts +81 -0
  163. package/dist/timeline.js +30 -0
  164. package/dist/toast-parts.d.ts +203 -0
  165. package/dist/toast-parts.js +270 -0
  166. package/dist/toast.d.ts +2 -0
  167. package/dist/toast.js +21 -0
  168. package/dist/toggle-props.d.ts +22 -0
  169. package/dist/toggle-props.js +14 -0
  170. package/dist/toggle.d.ts +199 -0
  171. package/dist/toggle.js +129 -0
  172. package/dist/token-input.d.ts +136 -0
  173. package/dist/token-input.js +214 -0
  174. package/dist/toolbar-context.d.ts +7 -0
  175. package/dist/toolbar-context.js +20 -0
  176. package/dist/toolbar.d.ts +120 -0
  177. package/dist/toolbar.js +77 -0
  178. package/dist/tooltip.d.ts +160 -0
  179. package/dist/tooltip.js +224 -0
  180. package/dist/tree.d.ts +300 -0
  181. package/dist/tree.js +209 -0
  182. package/dist/trigger-menu.d.ts +452 -0
  183. package/dist/trigger-menu.js +254 -0
  184. package/dist/use-primitive.d.ts +132 -0
  185. package/dist/use-primitive.js +462 -0
  186. package/dist/waterfall.d.ts +201 -0
  187. package/dist/waterfall.js +171 -0
  188. package/docs/README.md +89 -0
  189. package/docs/agents.md +1523 -0
  190. package/docs/components/accordion.md +1369 -0
  191. package/docs/components/alert-dialog.md +799 -0
  192. package/docs/components/autocomplete.md +1857 -0
  193. package/docs/components/avatar.md +272 -0
  194. package/docs/components/button.md +435 -0
  195. package/docs/components/calendar.md +1589 -0
  196. package/docs/components/carousel.md +1171 -0
  197. package/docs/components/checkbox.md +1008 -0
  198. package/docs/components/collapsible.md +536 -0
  199. package/docs/components/color-picker.md +706 -0
  200. package/docs/components/combobox.md +3504 -0
  201. package/docs/components/command.md +1481 -0
  202. package/docs/components/date-input.md +536 -0
  203. package/docs/components/date-picker.md +1244 -0
  204. package/docs/components/dialog.md +1397 -0
  205. package/docs/components/drawer.md +1166 -0
  206. package/docs/components/field.md +538 -0
  207. package/docs/components/file-input.md +611 -0
  208. package/docs/components/hover-card.md +505 -0
  209. package/docs/components/image-cropper.md +556 -0
  210. package/docs/components/input.md +306 -0
  211. package/docs/components/label.md +203 -0
  212. package/docs/components/listbox.md +1004 -0
  213. package/docs/components/menu.md +1229 -0
  214. package/docs/components/menubar.md +443 -0
  215. package/docs/components/meter.md +315 -0
  216. package/docs/components/navigation-menu.md +1523 -0
  217. package/docs/components/number-input.md +1029 -0
  218. package/docs/components/otp-input.md +512 -0
  219. package/docs/components/pagination.md +613 -0
  220. package/docs/components/password-input.md +649 -0
  221. package/docs/components/popover.md +1448 -0
  222. package/docs/components/preferences.md +208 -0
  223. package/docs/components/progress.md +423 -0
  224. package/docs/components/radio.md +785 -0
  225. package/docs/components/rating.md +416 -0
  226. package/docs/components/resizable.md +910 -0
  227. package/docs/components/scroll-area.md +915 -0
  228. package/docs/components/segmented-control.md +435 -0
  229. package/docs/components/select.md +2015 -0
  230. package/docs/components/separator.md +229 -0
  231. package/docs/components/slider.md +1084 -0
  232. package/docs/components/switch.md +565 -0
  233. package/docs/components/tabs.md +944 -0
  234. package/docs/components/textarea.md +299 -0
  235. package/docs/components/time-input.md +224 -0
  236. package/docs/components/timeline.md +654 -0
  237. package/docs/components/toast.md +1224 -0
  238. package/docs/components/toggle.md +500 -0
  239. package/docs/components/token-input.md +953 -0
  240. package/docs/components/toolbar.md +739 -0
  241. package/docs/components/tooltip.md +818 -0
  242. package/docs/components/tree.md +1306 -0
  243. package/docs/components/trigger-menu.md +1223 -0
  244. package/docs/components/waterfall.md +717 -0
  245. package/docs/controllers.md +71 -0
  246. package/docs/core.md +8027 -0
  247. package/docs/custom-parts.md +89 -0
  248. package/docs/first-component.md +83 -0
  249. package/docs/forms.md +122 -0
  250. package/docs/installation.md +72 -0
  251. package/docs/introduction.md +32 -0
  252. package/docs/lists-and-menus.md +122 -0
  253. package/docs/llms.txt +1502 -0
  254. package/docs/parts-and-composition.md +85 -0
  255. package/docs/popups.md +108 -0
  256. package/docs/rendering.md +56 -0
  257. package/docs/server-rendering.md +180 -0
  258. package/docs/state-and-events.md +100 -0
  259. package/docs/styling-and-animation.md +148 -0
  260. package/docs/utilities/async-options.md +348 -0
  261. package/docs/utilities/shortcuts.md +159 -0
  262. 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, };
@@ -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
+ };