@macrulez/vue-command-palette 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +420 -14
- package/dist/components/CommandGroup.vue.d.ts +8 -6
- package/dist/components/CommandItem.vue.d.ts +11 -3
- package/dist/components/CommandPalette.test.d.ts +1 -0
- package/dist/components/CommandPalette.vue.d.ts +336 -7
- package/dist/components/VirtualList.vue.d.ts +2 -0
- package/dist/core/CommandStore.d.ts +278 -7
- package/dist/core/CommandStore.test.d.ts +1 -0
- package/dist/core/FuzzySearch.d.ts +13 -1
- package/dist/core/generics.test.d.ts +1 -0
- package/dist/core/useCommandPalette.d.ts +40 -7
- package/dist/core/useCommandPalette.test.d.ts +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/plugin.d.ts +22 -1
- package/dist/plugin.test.d.ts +1 -0
- package/dist/testing.d.ts +281 -10
- package/dist/types.d.ts +122 -10
- package/dist/vue-command-palette.js +1457 -713
- package/dist/vue-command-palette.umd.cjs +1 -1
- package/package.json +5 -1
- package/dist/style.css +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Command, CommandGroup, SearchResult } from '../types';
|
|
1
|
+
import { Command, CommandGroup, SearchFn, SearchResult } from '../types';
|
|
2
2
|
|
|
3
3
|
export interface CommandStoreState {
|
|
4
4
|
groups: Map<string, CommandGroup>;
|
|
5
5
|
commands: Map<string, Command>;
|
|
6
6
|
}
|
|
7
|
-
export declare function createCommandStore(): {
|
|
7
|
+
export declare function createCommandStore(searchFn?: SearchFn, searchNested?: boolean, scoreBonus?: (command: Command) => number, showDisabled?: boolean): {
|
|
8
8
|
state: {
|
|
9
9
|
groups: Map<string, {
|
|
10
10
|
id: string;
|
|
@@ -137,12 +137,147 @@ export declare function createCommandStore(): {
|
|
|
137
137
|
shortcut?: string[] | undefined;
|
|
138
138
|
disabled?: boolean | undefined;
|
|
139
139
|
enabled?: (() => boolean) | undefined;
|
|
140
|
+
disabledReason?: string | undefined;
|
|
141
|
+
badge?: string | {
|
|
142
|
+
text: string;
|
|
143
|
+
color?: string | undefined;
|
|
144
|
+
} | undefined;
|
|
140
145
|
confirm?: string | undefined;
|
|
141
146
|
perform: () => void | Promise<void>;
|
|
142
147
|
subCommands?: /*elided*/ any[] | undefined;
|
|
148
|
+
page?: {
|
|
149
|
+
placeholder?: string | undefined;
|
|
150
|
+
items?: /*elided*/ any[] | undefined;
|
|
151
|
+
onSearch?: ((query: string) => Command[] | Promise<Command[]>) | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
actions?: {
|
|
154
|
+
id: string;
|
|
155
|
+
label: string;
|
|
156
|
+
icon?: string | import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
157
|
+
new (...args: any[]): any;
|
|
158
|
+
__isFragment?: never;
|
|
159
|
+
__isTeleport?: never;
|
|
160
|
+
__isSuspense?: never;
|
|
161
|
+
} | {
|
|
162
|
+
[x: string]: any;
|
|
163
|
+
setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
164
|
+
attrs: import('vue').Attrs;
|
|
165
|
+
slots: Readonly<{
|
|
166
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
167
|
+
}>;
|
|
168
|
+
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
169
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
170
|
+
}) => any) | undefined;
|
|
171
|
+
name?: string | undefined;
|
|
172
|
+
template?: string | object | undefined;
|
|
173
|
+
render?: Function | undefined;
|
|
174
|
+
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
|
|
175
|
+
directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
|
|
176
|
+
inheritAttrs?: boolean | undefined;
|
|
177
|
+
emits?: any;
|
|
178
|
+
slots?: {} | undefined;
|
|
179
|
+
expose?: string[] | undefined;
|
|
180
|
+
serverPrefetch?: (() => void | Promise<any>) | undefined;
|
|
181
|
+
compilerOptions?: {
|
|
182
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
183
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
184
|
+
comments?: boolean | undefined;
|
|
185
|
+
delimiters?: [string, string] | undefined;
|
|
186
|
+
} | undefined;
|
|
187
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
188
|
+
__isFragment?: never | undefined;
|
|
189
|
+
__isTeleport?: never | undefined;
|
|
190
|
+
__isSuspense?: never | undefined;
|
|
191
|
+
__defaults?: {} | undefined;
|
|
192
|
+
compatConfig?: {
|
|
193
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
194
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
195
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
196
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
197
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
198
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
199
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
200
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
201
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
202
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
203
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
204
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
205
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
206
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
207
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
208
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
209
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
210
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
211
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
212
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
213
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
214
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
215
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
216
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
217
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
218
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
219
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
220
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
221
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
222
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
223
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
224
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
225
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
226
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
227
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
228
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
229
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
230
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
231
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
232
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
233
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
234
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
235
|
+
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
238
|
+
computed?: import('vue').ComputedOptions | undefined;
|
|
239
|
+
methods?: import('vue').MethodOptions | undefined;
|
|
240
|
+
watch?: {
|
|
241
|
+
[x: string]: (string | import('vue').WatchCallback | ({
|
|
242
|
+
handler: import('vue').WatchCallback | string;
|
|
243
|
+
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
244
|
+
handler: import('vue').WatchCallback | string;
|
|
245
|
+
} & import('vue').WatchOptions<boolean>))[];
|
|
246
|
+
} | undefined;
|
|
247
|
+
provide?: import('vue').ComponentProvideOptions | undefined;
|
|
248
|
+
inject?: {} | string[] | undefined;
|
|
249
|
+
filters?: Record<string, Function> | undefined;
|
|
250
|
+
mixins?: any[] | undefined;
|
|
251
|
+
extends?: any;
|
|
252
|
+
beforeCreate?: (() => any) | undefined;
|
|
253
|
+
created?: (() => any) | undefined;
|
|
254
|
+
beforeMount?: (() => any) | undefined;
|
|
255
|
+
mounted?: (() => any) | undefined;
|
|
256
|
+
beforeUpdate?: (() => any) | undefined;
|
|
257
|
+
updated?: (() => any) | undefined;
|
|
258
|
+
activated?: (() => any) | undefined;
|
|
259
|
+
deactivated?: (() => any) | undefined;
|
|
260
|
+
beforeDestroy?: (() => any) | undefined;
|
|
261
|
+
beforeUnmount?: (() => any) | undefined;
|
|
262
|
+
destroyed?: (() => any) | undefined;
|
|
263
|
+
unmounted?: (() => any) | undefined;
|
|
264
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
265
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
266
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
|
|
267
|
+
delimiters?: [string, string] | undefined;
|
|
268
|
+
__differentiator?: string | number | symbol | undefined;
|
|
269
|
+
__isBuiltIn?: boolean | undefined;
|
|
270
|
+
__file?: string | undefined;
|
|
271
|
+
__name?: string | undefined;
|
|
272
|
+
} | undefined;
|
|
273
|
+
shortcut?: string[] | undefined;
|
|
274
|
+
perform: () => void | Promise<void>;
|
|
275
|
+
}[] | undefined;
|
|
276
|
+
info?: string | undefined;
|
|
277
|
+
data?: unknown;
|
|
143
278
|
}[];
|
|
144
|
-
onSearch?: ((query: string) => Promise<Command[]>) | undefined;
|
|
145
|
-
}> & Omit<Map<string, CommandGroup
|
|
279
|
+
onSearch?: ((query: string) => Promise<Command<unknown>[]>) | undefined;
|
|
280
|
+
}> & Omit<Map<string, CommandGroup<unknown>>, keyof Map<any, any>>;
|
|
146
281
|
commands: Map<string, {
|
|
147
282
|
id: string;
|
|
148
283
|
label: string;
|
|
@@ -270,15 +405,151 @@ export declare function createCommandStore(): {
|
|
|
270
405
|
shortcut?: string[] | undefined;
|
|
271
406
|
disabled?: boolean | undefined;
|
|
272
407
|
enabled?: (() => boolean) | undefined;
|
|
408
|
+
disabledReason?: string | undefined;
|
|
409
|
+
badge?: string | {
|
|
410
|
+
text: string;
|
|
411
|
+
color?: string | undefined;
|
|
412
|
+
} | undefined;
|
|
273
413
|
confirm?: string | undefined;
|
|
274
414
|
perform: () => void | Promise<void>;
|
|
275
415
|
subCommands?: /*elided*/ any[] | undefined;
|
|
276
|
-
|
|
416
|
+
page?: {
|
|
417
|
+
placeholder?: string | undefined;
|
|
418
|
+
items?: /*elided*/ any[] | undefined;
|
|
419
|
+
onSearch?: ((query: string) => Command[] | Promise<Command[]>) | undefined;
|
|
420
|
+
} | undefined;
|
|
421
|
+
actions?: {
|
|
422
|
+
id: string;
|
|
423
|
+
label: string;
|
|
424
|
+
icon?: string | import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
425
|
+
new (...args: any[]): any;
|
|
426
|
+
__isFragment?: never;
|
|
427
|
+
__isTeleport?: never;
|
|
428
|
+
__isSuspense?: never;
|
|
429
|
+
} | {
|
|
430
|
+
[x: string]: any;
|
|
431
|
+
setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
432
|
+
attrs: import('vue').Attrs;
|
|
433
|
+
slots: Readonly<{
|
|
434
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
435
|
+
}>;
|
|
436
|
+
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
437
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
438
|
+
}) => any) | undefined;
|
|
439
|
+
name?: string | undefined;
|
|
440
|
+
template?: string | object | undefined;
|
|
441
|
+
render?: Function | undefined;
|
|
442
|
+
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
|
|
443
|
+
directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
|
|
444
|
+
inheritAttrs?: boolean | undefined;
|
|
445
|
+
emits?: any;
|
|
446
|
+
slots?: {} | undefined;
|
|
447
|
+
expose?: string[] | undefined;
|
|
448
|
+
serverPrefetch?: (() => void | Promise<any>) | undefined;
|
|
449
|
+
compilerOptions?: {
|
|
450
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
451
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
452
|
+
comments?: boolean | undefined;
|
|
453
|
+
delimiters?: [string, string] | undefined;
|
|
454
|
+
} | undefined;
|
|
455
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
456
|
+
__isFragment?: never | undefined;
|
|
457
|
+
__isTeleport?: never | undefined;
|
|
458
|
+
__isSuspense?: never | undefined;
|
|
459
|
+
__defaults?: {} | undefined;
|
|
460
|
+
compatConfig?: {
|
|
461
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
462
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
463
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
464
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
465
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
466
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
467
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
468
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
469
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
470
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
471
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
472
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
473
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
474
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
475
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
476
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
477
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
478
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
479
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
480
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
481
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
482
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
483
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
484
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
485
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
486
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
487
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
488
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
489
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
490
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
491
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
492
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
493
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
494
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
495
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
496
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
497
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
498
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
499
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
500
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
501
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
502
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
503
|
+
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
|
|
504
|
+
} | undefined;
|
|
505
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
506
|
+
computed?: import('vue').ComputedOptions | undefined;
|
|
507
|
+
methods?: import('vue').MethodOptions | undefined;
|
|
508
|
+
watch?: {
|
|
509
|
+
[x: string]: (string | import('vue').WatchCallback | ({
|
|
510
|
+
handler: import('vue').WatchCallback | string;
|
|
511
|
+
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
512
|
+
handler: import('vue').WatchCallback | string;
|
|
513
|
+
} & import('vue').WatchOptions<boolean>))[];
|
|
514
|
+
} | undefined;
|
|
515
|
+
provide?: import('vue').ComponentProvideOptions | undefined;
|
|
516
|
+
inject?: {} | string[] | undefined;
|
|
517
|
+
filters?: Record<string, Function> | undefined;
|
|
518
|
+
mixins?: any[] | undefined;
|
|
519
|
+
extends?: any;
|
|
520
|
+
beforeCreate?: (() => any) | undefined;
|
|
521
|
+
created?: (() => any) | undefined;
|
|
522
|
+
beforeMount?: (() => any) | undefined;
|
|
523
|
+
mounted?: (() => any) | undefined;
|
|
524
|
+
beforeUpdate?: (() => any) | undefined;
|
|
525
|
+
updated?: (() => any) | undefined;
|
|
526
|
+
activated?: (() => any) | undefined;
|
|
527
|
+
deactivated?: (() => any) | undefined;
|
|
528
|
+
beforeDestroy?: (() => any) | undefined;
|
|
529
|
+
beforeUnmount?: (() => any) | undefined;
|
|
530
|
+
destroyed?: (() => any) | undefined;
|
|
531
|
+
unmounted?: (() => any) | undefined;
|
|
532
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
533
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
534
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
|
|
535
|
+
delimiters?: [string, string] | undefined;
|
|
536
|
+
__differentiator?: string | number | symbol | undefined;
|
|
537
|
+
__isBuiltIn?: boolean | undefined;
|
|
538
|
+
__file?: string | undefined;
|
|
539
|
+
__name?: string | undefined;
|
|
540
|
+
} | undefined;
|
|
541
|
+
shortcut?: string[] | undefined;
|
|
542
|
+
perform: () => void | Promise<void>;
|
|
543
|
+
}[] | undefined;
|
|
544
|
+
info?: string | undefined;
|
|
545
|
+
data?: unknown;
|
|
546
|
+
}> & Omit<Map<string, Command<unknown>>, keyof Map<any, any>>;
|
|
277
547
|
};
|
|
278
|
-
registerCommands: (commands: Command[], groupId?: string) => () => void;
|
|
279
|
-
registerGroup: (group: CommandGroup) => () => void;
|
|
548
|
+
registerCommands: <T = unknown>(commands: Command<T>[], groupId?: string) => () => void;
|
|
549
|
+
registerGroup: <T = unknown>(group: CommandGroup<T>) => () => void;
|
|
280
550
|
search: (query: string) => SearchResult[];
|
|
281
551
|
getAllCommands: () => Command[];
|
|
552
|
+
findCommand: (id: string) => Command | undefined;
|
|
282
553
|
getSortedGroups: () => CommandGroup[];
|
|
283
554
|
};
|
|
284
555
|
export type CommandStore = ReturnType<typeof createCommandStore>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
2
|
import { Command, SearchResult } from '../types';
|
|
3
3
|
|
|
4
|
-
export declare function fuzzySearch(query: string, commands: Command[]): SearchResult[];
|
|
4
|
+
export declare function fuzzySearch<T = unknown>(query: string, commands: Command<T>[], includeDisabled?: boolean): SearchResult<T>[];
|
|
5
|
+
/**
|
|
6
|
+
* Result ordering: a match in the command **name** (non-empty `matches`) always
|
|
7
|
+
* outranks a match found only in description/keywords/aliases; within a tier, by score.
|
|
8
|
+
* Kept as a shared comparator so frecency re-sorting and async merging stay consistent.
|
|
9
|
+
*/
|
|
10
|
+
export declare function compareByRelevance(a: SearchResult, b: SearchResult): number;
|
|
11
|
+
/**
|
|
12
|
+
* Highlight ranges for `query` within `text`, in original-string indices.
|
|
13
|
+
* Returns `[]` when there is no match. Useful for highlighting results that came
|
|
14
|
+
* from an external source (async groups, pages, modes) rather than `fuzzySearch`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function getMatchRanges(query: string, text: string): Array<[number, number]>;
|
|
5
17
|
export declare function highlightMatches(label: string, matches: Array<[number, number]>): VNode;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComputedRef, Ref } from 'vue';
|
|
2
|
-
import { Command, CommandGroup, SearchResult } from '../types';
|
|
2
|
+
import { Command, CommandGroup, CommandUsage, SearchResult } from '../types';
|
|
3
3
|
import { CommandStore } from './CommandStore';
|
|
4
4
|
import { KeyboardManager } from './KeyboardManager';
|
|
5
5
|
|
|
@@ -17,19 +17,45 @@ export interface PaletteContext {
|
|
|
17
17
|
recentIds: Ref<string[]>;
|
|
18
18
|
loadingCommandId: Ref<string | null>;
|
|
19
19
|
results: ComputedRef<SearchResult[]>;
|
|
20
|
+
/**
|
|
21
|
+
* The results currently displayed by the palette UI — includes async and
|
|
22
|
+
* sub-command results merged in. Kept in sync by `CommandPalette`; falls back
|
|
23
|
+
* to `results` when no palette is mounted. Used by `executeActive` so that
|
|
24
|
+
* programmatic execution matches what the user sees.
|
|
25
|
+
*/
|
|
26
|
+
currentResults: Ref<SearchResult[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Set by the mounted `CommandPalette` to its UI-aware `execute` handler so
|
|
29
|
+
* bound keyboard shortcuts reuse the same confirm/nested/recent flow. `null`
|
|
30
|
+
* when no palette is mounted (a minimal fallback runs instead).
|
|
31
|
+
*/
|
|
32
|
+
executeRequest: Ref<((cmd: Command) => void) | null>;
|
|
20
33
|
colorTheme: Ref<'light' | 'dark' | 'system'>;
|
|
21
34
|
persistRecent: boolean;
|
|
22
35
|
maxRecent: number;
|
|
23
36
|
maxRecentPerGroup: number;
|
|
24
37
|
localStorageKey: string;
|
|
38
|
+
frecency: boolean;
|
|
39
|
+
usage: Ref<Record<string, CommandUsage>>;
|
|
40
|
+
pinnedIds: Ref<string[]>;
|
|
41
|
+
queryHistory: Ref<string[]>;
|
|
42
|
+
showDisabled: boolean;
|
|
43
|
+
/** Async data source applied to every query (plugin-level), merged into results. */
|
|
44
|
+
globalSearch?: (query: string) => Command[] | Promise<Command[]>;
|
|
25
45
|
onOpen?: () => void;
|
|
26
46
|
onClose?: () => void;
|
|
27
47
|
onError?: (err: unknown, command: Command) => void;
|
|
48
|
+
onHighlight?: (command: Command | null) => void;
|
|
28
49
|
}
|
|
29
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Resolves a palette context by instance name. Without a name it returns the
|
|
52
|
+
* default/singleton instance; with a name it looks it up in the registry.
|
|
53
|
+
*/
|
|
54
|
+
export declare function resolvePaletteContext(name?: string): PaletteContext;
|
|
55
|
+
export declare function useCommandPalette(name?: string): {
|
|
30
56
|
isOpen: Readonly<Ref<boolean, boolean>>;
|
|
31
57
|
query: Ref<string, string>;
|
|
32
|
-
results: ComputedRef<SearchResult[]>;
|
|
58
|
+
results: ComputedRef<SearchResult<unknown>[]>;
|
|
33
59
|
activeIndex: Ref<number, number>;
|
|
34
60
|
history: Readonly<Ref<readonly {
|
|
35
61
|
readonly paletteId: string;
|
|
@@ -49,9 +75,16 @@ export declare function useCommandPalette(): {
|
|
|
49
75
|
executeActive: () => Promise<void>;
|
|
50
76
|
executeCommand: (cmd: Command) => Promise<void>;
|
|
51
77
|
getRecentCommands: () => Command[];
|
|
52
|
-
|
|
53
|
-
|
|
78
|
+
getPinnedCommands: () => Command[];
|
|
79
|
+
registerCommands: <T = unknown>(commands: Command<T>[]) => () => void;
|
|
80
|
+
registerGroup: <T = unknown>(group: CommandGroup<T>) => () => void;
|
|
54
81
|
addRecent: (id: string) => void;
|
|
82
|
+
isPinned: (id: string) => boolean;
|
|
83
|
+
pin: (id: string) => void;
|
|
84
|
+
unpin: (id: string) => void;
|
|
85
|
+
togglePin: (id: string) => void;
|
|
86
|
+
pinnedIds: Readonly<Ref<readonly string[], readonly string[]>>;
|
|
87
|
+
queryHistory: Readonly<Ref<readonly string[], readonly string[]>>;
|
|
55
88
|
};
|
|
56
|
-
export declare function useRegisterCommands(commands: Command[]): void;
|
|
57
|
-
export declare function useRegisterGroup(group: CommandGroup): void;
|
|
89
|
+
export declare function useRegisterCommands<T = unknown>(commands: Command<T>[], name?: string): void;
|
|
90
|
+
export declare function useRegisterGroup<T = unknown>(group: CommandGroup<T>, name?: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { VCommandPalettePlugin } from './plugin';
|
|
2
|
-
export { useCommandPalette, useRegisterCommands, useRegisterGroup } from './core/useCommandPalette';
|
|
3
|
-
export { fuzzySearch, highlightMatches } from './core/FuzzySearch';
|
|
1
|
+
export { VCommandPalettePlugin, createCommandPalette, installPalette } from './plugin';
|
|
2
|
+
export { useCommandPalette, useRegisterCommands, useRegisterGroup, resolvePaletteContext } from './core/useCommandPalette';
|
|
3
|
+
export { fuzzySearch, highlightMatches, getMatchRanges } from './core/FuzzySearch';
|
|
4
4
|
export { createCommandStore } from './core/CommandStore';
|
|
5
5
|
export { createKeyboardManager } from './core/KeyboardManager';
|
|
6
6
|
export { default as CommandPalette } from './components/CommandPalette.vue';
|
|
7
7
|
export { default as CommandItem } from './components/CommandItem.vue';
|
|
8
8
|
export { default as CommandGroup } from './components/CommandGroup.vue';
|
|
9
9
|
export { default as VirtualList } from './components/VirtualList.vue';
|
|
10
|
-
export type { Command, CommandGroup as CommandGroupType,
|
|
10
|
+
export type { Command, CommandGroup as CommandGroupType, CommandPage, CommandAction, PaletteState, SearchResult, SearchFn, CommandUsage, PaletteMode, PaletteOptions, PaletteLabels, } from './types';
|
|
11
11
|
export type { PaletteContext } from './core/useCommandPalette';
|
|
12
12
|
export type { CommandStore } from './core/CommandStore';
|
|
13
13
|
export type { KeyboardManager } from './core/KeyboardManager';
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
2
|
import { PaletteOptions } from './types';
|
|
3
3
|
|
|
4
|
+
export declare function installPalette(app: App, options?: PaletteOptions): void;
|
|
5
|
+
/**
|
|
6
|
+
* Default plugin — installs a single (default) palette instance.
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* app.use(VCommandPalettePlugin, { hotkey: ['$mod', 'k'] })
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
4
12
|
export declare const VCommandPalettePlugin: {
|
|
5
|
-
install
|
|
13
|
+
install: typeof installPalette;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Factory for an additional, independently-named palette instance. Each call
|
|
17
|
+
* returns a fresh plugin object, so Vue's `app.use` de-duplication does not
|
|
18
|
+
* skip it — allowing multiple palettes on one app.
|
|
19
|
+
*
|
|
20
|
+
* ```ts
|
|
21
|
+
* app.use(VCommandPalettePlugin) // default
|
|
22
|
+
* app.use(createCommandPalette({ name: 'sidebar', hotkey: ['$mod', 'j'] }))
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare function createCommandPalette(options?: PaletteOptions): {
|
|
26
|
+
install(app: App): void;
|
|
6
27
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|