@macrulez/vue-command-palette 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,53 @@
1
+ import { Command, CommandGroup, SearchResult } from '../types';
2
+
3
+ declare function __VLS_template(): {
4
+ "group-header"?(_: {
5
+ group: CommandGroup;
6
+ }): any;
7
+ "item-icon"?(_: {
8
+ command: Command;
9
+ }): any;
10
+ "item-shortcut"?(_: {
11
+ command: Command;
12
+ }): any;
13
+ item?(_: {
14
+ command: Command;
15
+ active: boolean;
16
+ matches: [number, number][];
17
+ }): any;
18
+ };
19
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
20
+ group: CommandGroup;
21
+ items: SearchResult[];
22
+ activeIndex: number;
23
+ globalOffset: number;
24
+ loadingCommandId?: string | null;
25
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
26
+ execute: (command: Command) => void;
27
+ activate: (index: number) => void;
28
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
29
+ group: CommandGroup;
30
+ items: SearchResult[];
31
+ activeIndex: number;
32
+ globalOffset: number;
33
+ loadingCommandId?: string | null;
34
+ }>>> & Readonly<{
35
+ onExecute?: ((command: Command) => any) | undefined;
36
+ onActivate?: ((index: number) => any) | undefined;
37
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
38
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
39
+ export default _default;
40
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
41
+ type __VLS_TypePropsToRuntimeProps<T> = {
42
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
43
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
44
+ } : {
45
+ type: import('vue').PropType<T[K]>;
46
+ required: true;
47
+ };
48
+ };
49
+ type __VLS_WithTemplateSlots<T, S> = T & {
50
+ new (): {
51
+ $slots: S;
52
+ };
53
+ };
@@ -0,0 +1,50 @@
1
+ import { Command } from '../types';
2
+
3
+ declare function __VLS_template(): {
4
+ default?(_: {
5
+ command: Command;
6
+ active: boolean;
7
+ matches: [number, number][];
8
+ }): any;
9
+ "item-icon"?(_: {
10
+ command: Command;
11
+ }): any;
12
+ "item-shortcut"?(_: {
13
+ command: Command;
14
+ }): any;
15
+ };
16
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
17
+ command: Command;
18
+ active: boolean;
19
+ matches: Array<[number, number]>;
20
+ itemId: string;
21
+ loadingCommandId?: string | null;
22
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
23
+ execute: () => void;
24
+ activate: () => void;
25
+ }, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
26
+ command: Command;
27
+ active: boolean;
28
+ matches: Array<[number, number]>;
29
+ itemId: string;
30
+ loadingCommandId?: string | null;
31
+ }>>> & Readonly<{
32
+ onExecute?: (() => any) | undefined;
33
+ onActivate?: (() => any) | undefined;
34
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
35
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
36
+ export default _default;
37
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
38
+ type __VLS_TypePropsToRuntimeProps<T> = {
39
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
40
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
41
+ } : {
42
+ type: import('vue').PropType<T[K]>;
43
+ required: true;
44
+ };
45
+ };
46
+ type __VLS_WithTemplateSlots<T, S> = T & {
47
+ new (): {
48
+ $slots: S;
49
+ };
50
+ };
@@ -0,0 +1,97 @@
1
+ import { Command, CommandGroup as ICommandGroup } from '../types';
2
+
3
+ declare function onInput(): void;
4
+ declare function __VLS_template(): {
5
+ trigger?(_: {
6
+ open: (paletteId?: string) => void;
7
+ toggle: () => void;
8
+ }): any;
9
+ header?(_: {}): any;
10
+ input?(_: {
11
+ query: string;
12
+ onInput: typeof onInput;
13
+ }): any;
14
+ "item-icon"?(_: {
15
+ command: Command;
16
+ }): any;
17
+ "item-shortcut"?(_: {
18
+ command: Command;
19
+ }): any;
20
+ item?(_: {
21
+ command: Command;
22
+ active: boolean;
23
+ matches: [number, number][];
24
+ }): any;
25
+ "group-header"?(_: {
26
+ group: ICommandGroup;
27
+ }): any;
28
+ empty?(_: {
29
+ query: string;
30
+ }): any;
31
+ footer?(_: {}): any;
32
+ };
33
+ declare const __VLS_component: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
34
+ placeholder?: string;
35
+ maxResults?: number;
36
+ emptyText?: string;
37
+ loadingText?: string;
38
+ teleportTo?: string;
39
+ theme?: "default" | "compact";
40
+ animationDuration?: number;
41
+ }>, {
42
+ placeholder: string;
43
+ maxResults: number;
44
+ emptyText: string;
45
+ loadingText: string;
46
+ teleportTo: string;
47
+ theme: string;
48
+ animationDuration: number;
49
+ }>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
50
+ placeholder?: string;
51
+ maxResults?: number;
52
+ emptyText?: string;
53
+ loadingText?: string;
54
+ teleportTo?: string;
55
+ theme?: "default" | "compact";
56
+ animationDuration?: number;
57
+ }>, {
58
+ placeholder: string;
59
+ maxResults: number;
60
+ emptyText: string;
61
+ loadingText: string;
62
+ teleportTo: string;
63
+ theme: string;
64
+ animationDuration: number;
65
+ }>>> & Readonly<{}>, {
66
+ placeholder: string;
67
+ maxResults: number;
68
+ emptyText: string;
69
+ loadingText: string;
70
+ teleportTo: string;
71
+ theme: "default" | "compact";
72
+ animationDuration: number;
73
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
74
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
75
+ export default _default;
76
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
77
+ type __VLS_TypePropsToRuntimeProps<T> = {
78
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
79
+ type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
80
+ } : {
81
+ type: import('vue').PropType<T[K]>;
82
+ required: true;
83
+ };
84
+ };
85
+ type __VLS_WithDefaults<P, D> = {
86
+ [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
87
+ default: D[K];
88
+ }> : P[K];
89
+ };
90
+ type __VLS_Prettify<T> = {
91
+ [K in keyof T]: T[K];
92
+ } & {};
93
+ type __VLS_WithTemplateSlots<T, S> = T & {
94
+ new (): {
95
+ $slots: S;
96
+ };
97
+ };
@@ -0,0 +1,26 @@
1
+ declare const _default: <T>(__VLS_props: Awaited<typeof __VLS_setup>["props"], __VLS_ctx?: __VLS_Prettify<Pick<Awaited<typeof __VLS_setup>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
2
+ props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>) & {
3
+ items: T[];
4
+ itemHeight: number;
5
+ containerHeight: number;
6
+ overscan?: number;
7
+ }, keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
8
+ expose(exposed: import('vue').ShallowUnwrapRef<{
9
+ containerEl: import('vue').Ref<HTMLElement | undefined, HTMLElement | undefined>;
10
+ }>): void;
11
+ attrs: any;
12
+ slots: ReturnType<() => {
13
+ default?(_: {
14
+ key: number;
15
+ item: T;
16
+ index: number;
17
+ }): any;
18
+ }>;
19
+ emit: typeof __VLS_emit;
20
+ }>) => import('vue').VNode & {
21
+ __ctx?: Awaited<typeof __VLS_setup>;
22
+ };
23
+ export default _default;
24
+ type __VLS_Prettify<T> = {
25
+ [K in keyof T]: T[K];
26
+ } & {};
@@ -0,0 +1,284 @@
1
+ import { Command, CommandGroup, SearchResult } from '../types';
2
+
3
+ export interface CommandStoreState {
4
+ groups: Map<string, CommandGroup>;
5
+ commands: Map<string, Command>;
6
+ }
7
+ export declare function createCommandStore(): {
8
+ state: {
9
+ groups: Map<string, {
10
+ id: string;
11
+ label: string;
12
+ priority?: number | undefined;
13
+ commands: {
14
+ id: string;
15
+ label: string;
16
+ description?: string | undefined;
17
+ group?: string | undefined;
18
+ keywords?: string[] | undefined;
19
+ aliases?: string[] | undefined;
20
+ icon?: string | import('vue').FunctionalComponent<any, {}, any, {}> | {
21
+ new (...args: any[]): any;
22
+ __isFragment?: never;
23
+ __isTeleport?: never;
24
+ __isSuspense?: never;
25
+ } | {
26
+ [x: string]: any;
27
+ setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
28
+ attrs: import('vue').Attrs;
29
+ slots: Readonly<{
30
+ [name: string]: import('vue').Slot<any> | undefined;
31
+ }>;
32
+ emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
33
+ expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
34
+ }) => any) | undefined;
35
+ name?: string | undefined;
36
+ template?: string | object | undefined;
37
+ render?: Function | undefined;
38
+ components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
39
+ directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
40
+ inheritAttrs?: boolean | undefined;
41
+ emits?: any;
42
+ slots?: {} | undefined;
43
+ expose?: string[] | undefined;
44
+ serverPrefetch?: (() => void | Promise<any>) | undefined;
45
+ compilerOptions?: {
46
+ isCustomElement?: ((tag: string) => boolean) | undefined;
47
+ whitespace?: "preserve" | "condense" | undefined;
48
+ comments?: boolean | undefined;
49
+ delimiters?: [string, string] | undefined;
50
+ } | undefined;
51
+ call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
52
+ __isFragment?: never | undefined;
53
+ __isTeleport?: never | undefined;
54
+ __isSuspense?: never | undefined;
55
+ __defaults?: {} | undefined;
56
+ compatConfig?: {
57
+ GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
58
+ GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
59
+ GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
60
+ GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
61
+ GLOBAL_SET?: boolean | "suppress-warning" | undefined;
62
+ GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
63
+ GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
64
+ GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
65
+ CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
66
+ CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
67
+ CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
68
+ CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
69
+ CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
70
+ CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
71
+ CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
72
+ INSTANCE_SET?: boolean | "suppress-warning" | undefined;
73
+ INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
74
+ INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
75
+ INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
76
+ INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
77
+ INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
78
+ INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
79
+ INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
80
+ INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
81
+ OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
82
+ OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
83
+ OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
84
+ OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
85
+ WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
86
+ PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
87
+ V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
88
+ CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
89
+ ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
90
+ ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
91
+ TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
92
+ TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
93
+ COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
94
+ COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
95
+ COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
96
+ RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
97
+ FILTERS?: boolean | "suppress-warning" | undefined;
98
+ PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
99
+ MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
100
+ } | undefined;
101
+ data?: ((this: any, vm: any) => any) | undefined;
102
+ computed?: import('vue').ComputedOptions | undefined;
103
+ methods?: import('vue').MethodOptions | undefined;
104
+ watch?: {
105
+ [x: string]: (string | import('vue').WatchCallback | ({
106
+ handler: import('vue').WatchCallback | string;
107
+ } & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
108
+ handler: import('vue').WatchCallback | string;
109
+ } & import('vue').WatchOptions<boolean>))[];
110
+ } | undefined;
111
+ provide?: import('vue').ComponentProvideOptions | undefined;
112
+ inject?: {} | string[] | undefined;
113
+ filters?: Record<string, Function> | undefined;
114
+ mixins?: any[] | undefined;
115
+ extends?: any;
116
+ beforeCreate?: (() => any) | undefined;
117
+ created?: (() => any) | undefined;
118
+ beforeMount?: (() => any) | undefined;
119
+ mounted?: (() => any) | undefined;
120
+ beforeUpdate?: (() => any) | undefined;
121
+ updated?: (() => any) | undefined;
122
+ activated?: (() => any) | undefined;
123
+ deactivated?: (() => any) | undefined;
124
+ beforeDestroy?: (() => any) | undefined;
125
+ beforeUnmount?: (() => any) | undefined;
126
+ destroyed?: (() => any) | undefined;
127
+ unmounted?: (() => any) | undefined;
128
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
129
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
130
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
131
+ delimiters?: [string, string] | undefined;
132
+ __differentiator?: string | number | symbol | undefined;
133
+ __isBuiltIn?: boolean | undefined;
134
+ __file?: string | undefined;
135
+ __name?: string | undefined;
136
+ } | undefined;
137
+ shortcut?: string[] | undefined;
138
+ disabled?: boolean | undefined;
139
+ enabled?: (() => boolean) | undefined;
140
+ confirm?: string | undefined;
141
+ perform: () => void | Promise<void>;
142
+ subCommands?: /*elided*/ any[] | undefined;
143
+ }[];
144
+ onSearch?: ((query: string) => Promise<Command[]>) | undefined;
145
+ }> & Omit<Map<string, CommandGroup>, keyof Map<any, any>>;
146
+ commands: Map<string, {
147
+ id: string;
148
+ label: string;
149
+ description?: string | undefined;
150
+ group?: string | undefined;
151
+ keywords?: string[] | undefined;
152
+ aliases?: string[] | undefined;
153
+ icon?: string | import('vue').FunctionalComponent<any, {}, any, {}> | {
154
+ new (...args: any[]): any;
155
+ __isFragment?: never;
156
+ __isTeleport?: never;
157
+ __isSuspense?: never;
158
+ } | {
159
+ [x: string]: any;
160
+ setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
161
+ attrs: import('vue').Attrs;
162
+ slots: Readonly<{
163
+ [name: string]: import('vue').Slot<any> | undefined;
164
+ }>;
165
+ emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
166
+ expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
167
+ }) => any) | undefined;
168
+ name?: string | undefined;
169
+ template?: string | object | undefined;
170
+ render?: Function | undefined;
171
+ components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
172
+ directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
173
+ inheritAttrs?: boolean | undefined;
174
+ emits?: any;
175
+ slots?: {} | undefined;
176
+ expose?: string[] | undefined;
177
+ serverPrefetch?: (() => void | Promise<any>) | undefined;
178
+ compilerOptions?: {
179
+ isCustomElement?: ((tag: string) => boolean) | undefined;
180
+ whitespace?: "preserve" | "condense" | undefined;
181
+ comments?: boolean | undefined;
182
+ delimiters?: [string, string] | undefined;
183
+ } | undefined;
184
+ call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
185
+ __isFragment?: never | undefined;
186
+ __isTeleport?: never | undefined;
187
+ __isSuspense?: never | undefined;
188
+ __defaults?: {} | undefined;
189
+ compatConfig?: {
190
+ GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
191
+ GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
192
+ GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
193
+ GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
194
+ GLOBAL_SET?: boolean | "suppress-warning" | undefined;
195
+ GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
196
+ GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
197
+ GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
198
+ CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
199
+ CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
200
+ CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
201
+ CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
202
+ CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
203
+ CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
204
+ CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
205
+ INSTANCE_SET?: boolean | "suppress-warning" | undefined;
206
+ INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
207
+ INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
208
+ INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
209
+ INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
210
+ INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
211
+ INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
212
+ INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
213
+ INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
214
+ OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
215
+ OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
216
+ OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
217
+ OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
218
+ WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
219
+ PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
220
+ V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
221
+ CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
222
+ ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
223
+ ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
224
+ TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
225
+ TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
226
+ COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
227
+ COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
228
+ COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
229
+ RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
230
+ FILTERS?: boolean | "suppress-warning" | undefined;
231
+ PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
232
+ MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
233
+ } | undefined;
234
+ data?: ((this: any, vm: any) => any) | undefined;
235
+ computed?: import('vue').ComputedOptions | undefined;
236
+ methods?: import('vue').MethodOptions | undefined;
237
+ watch?: {
238
+ [x: string]: (string | import('vue').WatchCallback | ({
239
+ handler: import('vue').WatchCallback | string;
240
+ } & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
241
+ handler: import('vue').WatchCallback | string;
242
+ } & import('vue').WatchOptions<boolean>))[];
243
+ } | undefined;
244
+ provide?: import('vue').ComponentProvideOptions | undefined;
245
+ inject?: {} | string[] | undefined;
246
+ filters?: Record<string, Function> | undefined;
247
+ mixins?: any[] | undefined;
248
+ extends?: any;
249
+ beforeCreate?: (() => any) | undefined;
250
+ created?: (() => any) | undefined;
251
+ beforeMount?: (() => any) | undefined;
252
+ mounted?: (() => any) | undefined;
253
+ beforeUpdate?: (() => any) | undefined;
254
+ updated?: (() => any) | undefined;
255
+ activated?: (() => any) | undefined;
256
+ deactivated?: (() => any) | undefined;
257
+ beforeDestroy?: (() => any) | undefined;
258
+ beforeUnmount?: (() => any) | undefined;
259
+ destroyed?: (() => any) | undefined;
260
+ unmounted?: (() => any) | undefined;
261
+ renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
262
+ renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
263
+ errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
264
+ delimiters?: [string, string] | undefined;
265
+ __differentiator?: string | number | symbol | undefined;
266
+ __isBuiltIn?: boolean | undefined;
267
+ __file?: string | undefined;
268
+ __name?: string | undefined;
269
+ } | undefined;
270
+ shortcut?: string[] | undefined;
271
+ disabled?: boolean | undefined;
272
+ enabled?: (() => boolean) | undefined;
273
+ confirm?: string | undefined;
274
+ perform: () => void | Promise<void>;
275
+ subCommands?: /*elided*/ any[] | undefined;
276
+ }> & Omit<Map<string, Command>, keyof Map<any, any>>;
277
+ };
278
+ registerCommands: (commands: Command[], groupId?: string) => () => void;
279
+ registerGroup: (group: CommandGroup) => () => void;
280
+ search: (query: string) => SearchResult[];
281
+ getAllCommands: () => Command[];
282
+ getSortedGroups: () => CommandGroup[];
283
+ };
284
+ export type CommandStore = ReturnType<typeof createCommandStore>;
@@ -0,0 +1,5 @@
1
+ import { VNode } from 'vue';
2
+ import { Command, SearchResult } from '../types';
3
+
4
+ export declare function fuzzySearch(query: string, commands: Command[]): SearchResult[];
5
+ export declare function highlightMatches(label: string, matches: Array<[number, number]>): VNode;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ type Handler = () => void;
2
+ export declare function createKeyboardManager(): {
3
+ registerShortcut: (keys: string[], handler: Handler) => () => void;
4
+ start: () => void;
5
+ stop: () => void;
6
+ };
7
+ export type KeyboardManager = ReturnType<typeof createKeyboardManager>;
8
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
1
+ import { ComputedRef, Ref } from 'vue';
2
+ import { Command, CommandGroup, SearchResult } from '../types';
3
+ import { CommandStore } from './CommandStore';
4
+ import { KeyboardManager } from './KeyboardManager';
5
+
6
+ export interface PaletteContext {
7
+ store: CommandStore;
8
+ keyboard: KeyboardManager;
9
+ isOpen: Ref<boolean>;
10
+ query: Ref<string>;
11
+ activeIndex: Ref<number>;
12
+ history: Ref<Array<{
13
+ paletteId: string;
14
+ query: string;
15
+ activeIndex: number;
16
+ }>>;
17
+ recentIds: Ref<string[]>;
18
+ loadingCommandId: Ref<string | null>;
19
+ results: ComputedRef<SearchResult[]>;
20
+ colorTheme: Ref<'light' | 'dark' | 'system'>;
21
+ persistRecent: boolean;
22
+ maxRecent: number;
23
+ maxRecentPerGroup: number;
24
+ localStorageKey: string;
25
+ onOpen?: () => void;
26
+ onClose?: () => void;
27
+ onError?: (err: unknown, command: Command) => void;
28
+ }
29
+ export declare function useCommandPalette(): {
30
+ isOpen: Readonly<Ref<boolean, boolean>>;
31
+ query: Ref<string, string>;
32
+ results: ComputedRef<SearchResult[]>;
33
+ activeIndex: Ref<number, number>;
34
+ history: Readonly<Ref<readonly {
35
+ readonly paletteId: string;
36
+ readonly query: string;
37
+ readonly activeIndex: number;
38
+ }[], readonly {
39
+ readonly paletteId: string;
40
+ readonly query: string;
41
+ readonly activeIndex: number;
42
+ }[]>>;
43
+ loadingCommandId: Readonly<Ref<string | null, string | null>>;
44
+ colorTheme: Ref<"light" | "dark" | "system", "light" | "dark" | "system">;
45
+ open: (paletteId?: string) => void;
46
+ close: () => void;
47
+ toggle: () => void;
48
+ goBack: () => void;
49
+ executeActive: () => Promise<void>;
50
+ executeCommand: (cmd: Command) => Promise<void>;
51
+ getRecentCommands: () => Command[];
52
+ registerCommands: (commands: Command[]) => () => void;
53
+ registerGroup: (group: CommandGroup) => () => void;
54
+ addRecent: (id: string) => void;
55
+ };
56
+ export declare function useRegisterCommands(commands: Command[]): void;
57
+ export declare function useRegisterGroup(group: CommandGroup): void;
@@ -0,0 +1,13 @@
1
+ export { VCommandPalettePlugin } from './plugin';
2
+ export { useCommandPalette, useRegisterCommands, useRegisterGroup } from './core/useCommandPalette';
3
+ export { fuzzySearch, highlightMatches } from './core/FuzzySearch';
4
+ export { createCommandStore } from './core/CommandStore';
5
+ export { createKeyboardManager } from './core/KeyboardManager';
6
+ export { default as CommandPalette } from './components/CommandPalette.vue';
7
+ export { default as CommandItem } from './components/CommandItem.vue';
8
+ export { default as CommandGroup } from './components/CommandGroup.vue';
9
+ export { default as VirtualList } from './components/VirtualList.vue';
10
+ export type { Command, CommandGroup as CommandGroupType, CommandSection, PaletteState, SearchResult, PaletteOptions, } from './types';
11
+ export type { PaletteContext } from './core/useCommandPalette';
12
+ export type { CommandStore } from './core/CommandStore';
13
+ export type { KeyboardManager } from './core/KeyboardManager';
package/dist/nuxt.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,6 @@
1
+ import { App } from 'vue';
2
+ import { PaletteOptions } from './types';
3
+
4
+ export declare const VCommandPalettePlugin: {
5
+ install(app: App, options?: PaletteOptions): void;
6
+ };
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ :root{--vcp-z-index: 9999;--vcp-overlay-bg: rgba(0, 0, 0, .5);--vcp-dialog-bg: #ffffff;--vcp-dialog-color: #111111;--vcp-dialog-radius: 8px;--vcp-dialog-shadow: 0 16px 70px rgba(0, 0, 0, .2);--vcp-dialog-width: 560px;--vcp-dialog-max-height: 60vh;--vcp-dialog-padding-top: 15vh;--vcp-border-color: #eeeeee;--vcp-input-font-size: 16px;--vcp-item-height: 40px;--vcp-item-active-bg: #f0f0f0;--vcp-item-font-size: 14px;--vcp-item-radius: 4px;--vcp-group-header-color: #999999;--vcp-group-header-font-size: 11px;--vcp-kbd-bg: #eeeeee;--vcp-kbd-border: #dddddd;--vcp-match-color: inherit;--vcp-breadcrumb-color: #888888;--vcp-state-color: #999999}@media (prefers-color-scheme: dark){:root{--vcp-dialog-bg: #1a1a1a;--vcp-dialog-color: #eeeeee;--vcp-border-color: #333333;--vcp-item-active-bg: #2a2a2a;--vcp-kbd-bg: #2a2a2a;--vcp-kbd-border: #444444;--vcp-group-header-color: #666666;--vcp-scrollbar-thumb: #444444;--vcp-scrollbar-thumb-hover: #666666}}.vcp-theme-dark{--vcp-dialog-bg: #1a1a1a;--vcp-dialog-color: #eeeeee;--vcp-border-color: #333333;--vcp-item-active-bg: #2a2a2a;--vcp-kbd-bg: #2a2a2a;--vcp-kbd-border: #444444;--vcp-group-header-color: #666666;--vcp-scrollbar-thumb: #444444;--vcp-scrollbar-thumb-hover: #666666}.vcp-theme-light{--vcp-dialog-bg: #ffffff;--vcp-dialog-color: #111111;--vcp-border-color: #eeeeee;--vcp-item-active-bg: #f0f0f0;--vcp-kbd-bg: #eeeeee;--vcp-kbd-border: #dddddd;--vcp-group-header-color: #999999;--vcp-scrollbar-thumb: #d0d0d0;--vcp-scrollbar-thumb-hover: #b0b0b0}.vcp-overlay{position:fixed;inset:0;background:var(--vcp-overlay-bg);display:flex;align-items:flex-start;justify-content:center;padding-top:var(--vcp-dialog-padding-top);z-index:var(--vcp-z-index)}.vcp-dialog{background:var(--vcp-dialog-bg);color:var(--vcp-dialog-color);border-radius:var(--vcp-dialog-radius);box-shadow:var(--vcp-dialog-shadow);width:100%;max-width:var(--vcp-dialog-width);max-height:var(--vcp-dialog-max-height);display:flex;flex-direction:column;overflow:hidden}.vcp-dialog--compact{--vcp-dialog-width: 420px;--vcp-dialog-max-height: 40vh}.vcp-breadcrumb{display:flex;align-items:center;padding:6px 12px 0;font-size:12px;color:var(--vcp-breadcrumb-color);gap:4px}.vcp-breadcrumb__sep{color:var(--vcp-border-color)}.vcp-input-wrap{padding:12px;border-bottom:1px solid var(--vcp-border-color);display:flex;align-items:center;gap:8px}.vcp-input{flex:1;min-width:0;border:none;outline:none;font-size:var(--vcp-input-font-size);background:transparent;color:inherit;box-sizing:border-box}.vcp-theme-switcher{display:flex;gap:1px;flex-shrink:0}.vcp-theme-btn{border:none;background:transparent;cursor:pointer;width:26px;height:26px;border-radius:5px;font-size:13px;display:flex;align-items:center;justify-content:center;opacity:.4;transition:opacity 80ms,background 80ms;padding:0}.vcp-theme-btn:hover{opacity:.8}.vcp-theme-btn--active{opacity:1;background:var(--vcp-item-active-bg)}.vcp-theme-icon{display:block;width:14px;height:14px;background-color:currentColor;-webkit-mask-size:contain;-webkit-mask-repeat:no-repeat;-webkit-mask-position:center;mask-size:contain;mask-repeat:no-repeat;mask-position:center}.vcp-theme-icon--light{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Ccircle cx='7' cy='7' r='2.5' fill='black'/%3E%3Cpath d='M7 1v2M7 11v2M1 7h2M11 7h2M9.83 4.17L11.24 2.76M4.17 4.17L2.76 2.76M4.17 9.83L2.76 11.24M9.83 9.83L11.24 11.24' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Ccircle cx='7' cy='7' r='2.5' fill='black'/%3E%3Cpath d='M7 1v2M7 11v2M1 7h2M11 7h2M9.83 4.17L11.24 2.76M4.17 4.17L2.76 2.76M4.17 9.83L2.76 11.24M9.83 9.83L11.24 11.24' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E")}.vcp-theme-icon--system{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Crect x='1' y='1.5' width='12' height='8' rx='1.5' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M5 13h4M7 9.5v3.5' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='none'%3E%3Crect x='1' y='1.5' width='12' height='8' rx='1.5' stroke='black' stroke-width='1.5'/%3E%3Cpath d='M5 13h4M7 9.5v3.5' stroke='black' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E")}.vcp-theme-icon--dark{-webkit-mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='black'%3E%3Cpath d='M10.3 3.2A5 5 0 1 0 10.3 10.8A4 4 0 0 1 10.3 3.2Z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='black'%3E%3Cpath d='M10.3 3.2A5 5 0 1 0 10.3 10.8A4 4 0 0 1 10.3 3.2Z'/%3E%3C/svg%3E")}.vcp-list{overflow-y:auto;padding:4px 0;flex:1;scrollbar-width:thin;scrollbar-color:var(--vcp-scrollbar-thumb, #d0d0d0) transparent}.vcp-list::-webkit-scrollbar{width:4px}.vcp-list::-webkit-scrollbar-track{background:transparent}.vcp-list::-webkit-scrollbar-thumb{background:var(--vcp-scrollbar-thumb, #d0d0d0);border-radius:2px}.vcp-list::-webkit-scrollbar-thumb:hover{background:var(--vcp-scrollbar-thumb-hover, #b0b0b0)}.vcp-group__header{padding:6px 12px 2px;font-size:var(--vcp-group-header-font-size);font-weight:600;text-transform:uppercase;letter-spacing:.05em;color:var(--vcp-group-header-color)}.vcp-item{display:flex;align-items:center;gap:8px;padding:0 12px;height:var(--vcp-item-height);cursor:pointer;border-radius:var(--vcp-item-radius);margin:0 4px;transition:background 80ms;box-sizing:border-box}.vcp-item--active{background:var(--vcp-item-active-bg)}.vcp-item--disabled{opacity:.4;cursor:not-allowed}.vcp-item--loading{opacity:.7;cursor:wait}.vcp-item__icon{flex-shrink:0;font-size:16px}.vcp-item__body{flex:1;display:flex;flex-direction:column;gap:1px;overflow:hidden}.vcp-item__label{font-size:var(--vcp-item-font-size);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.vcp-item__description{font-size:11px;color:var(--vcp-group-header-color);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.vcp-item__spinner{width:14px;height:14px;border:2px solid var(--vcp-border-color);border-top-color:currentColor;border-radius:50%;animation:vcp-spin .6s linear infinite;flex-shrink:0}@keyframes vcp-spin{to{transform:rotate(360deg)}}.vcp-section{height:1px;background:var(--vcp-border-color);margin:4px 12px}.vcp-item__shortcut{display:flex;gap:3px;flex-shrink:0}.vcp-kbd{font-family:inherit;font-size:11px;padding:2px 5px;background:var(--vcp-kbd-bg);border-radius:3px;border:1px solid var(--vcp-kbd-border)}mark.vcp-match{background:transparent;color:var(--vcp-match-color);font-weight:700;text-decoration:underline}.vcp-confirm{padding:20px;display:flex;flex-direction:column;gap:12px}.vcp-confirm__text{margin:0;font-size:14px;color:var(--vcp-dialog-color)}.vcp-confirm__actions{display:flex;gap:8px}.vcp-confirm__btn{flex:1;padding:8px 12px;border-radius:var(--vcp-item-radius);border:1px solid var(--vcp-border-color);font-size:13px;cursor:pointer;background:transparent;color:inherit;transition:background 80ms}.vcp-confirm__btn:hover{background:var(--vcp-item-active-bg)}.vcp-confirm__btn--yes{background:#dc2626;color:#fff;border-color:#dc2626}.vcp-confirm__btn--yes:hover{background:#b91c1c;border-color:#b91c1c}.vcp-state{padding:24px;text-align:center;color:var(--vcp-state-color);font-size:var(--vcp-item-font-size)}.vcp-virtual{flex:1}.vcp-fade-enter-active,.vcp-fade-leave-active{transition:opacity .15s ease}.vcp-fade-enter-from,.vcp-fade-leave-to{opacity:0}@media (prefers-reduced-motion: reduce){.vcp-fade-enter-active,.vcp-fade-leave-active{transition:none}}