@macrulez/vue-command-palette 0.1.1 → 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 +432 -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
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Command, CommandGroup, PaletteOptions } from './types';
|
|
1
|
+
import { Command, CommandGroup, PaletteOptions, SearchResult } from './types';
|
|
2
2
|
import { PaletteContext } from './core/useCommandPalette';
|
|
3
3
|
|
|
4
4
|
export interface PaletteTestOptions extends PaletteOptions {
|
|
@@ -148,12 +148,147 @@ export declare function createPaletteContext(options?: PaletteTestOptions): {
|
|
|
148
148
|
shortcut?: string[] | undefined;
|
|
149
149
|
disabled?: boolean | undefined;
|
|
150
150
|
enabled?: (() => boolean) | undefined;
|
|
151
|
+
disabledReason?: string | undefined;
|
|
152
|
+
badge?: string | {
|
|
153
|
+
text: string;
|
|
154
|
+
color?: string | undefined;
|
|
155
|
+
} | undefined;
|
|
151
156
|
confirm?: string | undefined;
|
|
152
157
|
perform: () => void | Promise<void>;
|
|
153
158
|
subCommands?: /*elided*/ any[] | undefined;
|
|
159
|
+
page?: {
|
|
160
|
+
placeholder?: string | undefined;
|
|
161
|
+
items?: /*elided*/ any[] | undefined;
|
|
162
|
+
onSearch?: ((query: string) => Command[] | Promise<Command[]>) | undefined;
|
|
163
|
+
} | undefined;
|
|
164
|
+
actions?: {
|
|
165
|
+
id: string;
|
|
166
|
+
label: string;
|
|
167
|
+
icon?: string | import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
168
|
+
new (...args: any[]): any;
|
|
169
|
+
__isFragment?: never;
|
|
170
|
+
__isTeleport?: never;
|
|
171
|
+
__isSuspense?: never;
|
|
172
|
+
} | {
|
|
173
|
+
[x: string]: any;
|
|
174
|
+
setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
175
|
+
attrs: import('vue').Attrs;
|
|
176
|
+
slots: Readonly<{
|
|
177
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
178
|
+
}>;
|
|
179
|
+
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
180
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
181
|
+
}) => any) | undefined;
|
|
182
|
+
name?: string | undefined;
|
|
183
|
+
template?: string | object | undefined;
|
|
184
|
+
render?: Function | undefined;
|
|
185
|
+
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
|
|
186
|
+
directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
|
|
187
|
+
inheritAttrs?: boolean | undefined;
|
|
188
|
+
emits?: any;
|
|
189
|
+
slots?: {} | undefined;
|
|
190
|
+
expose?: string[] | undefined;
|
|
191
|
+
serverPrefetch?: (() => void | Promise<any>) | undefined;
|
|
192
|
+
compilerOptions?: {
|
|
193
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
194
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
195
|
+
comments?: boolean | undefined;
|
|
196
|
+
delimiters?: [string, string] | undefined;
|
|
197
|
+
} | undefined;
|
|
198
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
199
|
+
__isFragment?: never | undefined;
|
|
200
|
+
__isTeleport?: never | undefined;
|
|
201
|
+
__isSuspense?: never | undefined;
|
|
202
|
+
__defaults?: {} | undefined;
|
|
203
|
+
compatConfig?: {
|
|
204
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
205
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
206
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
207
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
208
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
209
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
210
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
211
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
212
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
213
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
214
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
215
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
216
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
217
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
218
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
219
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
220
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
221
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
222
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
223
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
224
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
225
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
226
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
227
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
228
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
229
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
230
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
231
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
232
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
233
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
234
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
235
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
236
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
237
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
238
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
239
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
240
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
241
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
242
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
243
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
244
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
245
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
246
|
+
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
|
|
247
|
+
} | undefined;
|
|
248
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
249
|
+
computed?: import('vue').ComputedOptions | undefined;
|
|
250
|
+
methods?: import('vue').MethodOptions | undefined;
|
|
251
|
+
watch?: {
|
|
252
|
+
[x: string]: (string | import('vue').WatchCallback | ({
|
|
253
|
+
handler: import('vue').WatchCallback | string;
|
|
254
|
+
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
255
|
+
handler: import('vue').WatchCallback | string;
|
|
256
|
+
} & import('vue').WatchOptions<boolean>))[];
|
|
257
|
+
} | undefined;
|
|
258
|
+
provide?: import('vue').ComponentProvideOptions | undefined;
|
|
259
|
+
inject?: {} | string[] | undefined;
|
|
260
|
+
filters?: Record<string, Function> | undefined;
|
|
261
|
+
mixins?: any[] | undefined;
|
|
262
|
+
extends?: any;
|
|
263
|
+
beforeCreate?: (() => any) | undefined;
|
|
264
|
+
created?: (() => any) | undefined;
|
|
265
|
+
beforeMount?: (() => any) | undefined;
|
|
266
|
+
mounted?: (() => any) | undefined;
|
|
267
|
+
beforeUpdate?: (() => any) | undefined;
|
|
268
|
+
updated?: (() => any) | undefined;
|
|
269
|
+
activated?: (() => any) | undefined;
|
|
270
|
+
deactivated?: (() => any) | undefined;
|
|
271
|
+
beforeDestroy?: (() => any) | undefined;
|
|
272
|
+
beforeUnmount?: (() => any) | undefined;
|
|
273
|
+
destroyed?: (() => any) | undefined;
|
|
274
|
+
unmounted?: (() => any) | undefined;
|
|
275
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
276
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
277
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
|
|
278
|
+
delimiters?: [string, string] | undefined;
|
|
279
|
+
__differentiator?: string | number | symbol | undefined;
|
|
280
|
+
__isBuiltIn?: boolean | undefined;
|
|
281
|
+
__file?: string | undefined;
|
|
282
|
+
__name?: string | undefined;
|
|
283
|
+
} | undefined;
|
|
284
|
+
shortcut?: string[] | undefined;
|
|
285
|
+
perform: () => void | Promise<void>;
|
|
286
|
+
}[] | undefined;
|
|
287
|
+
info?: string | undefined;
|
|
288
|
+
data?: unknown;
|
|
154
289
|
}[];
|
|
155
|
-
onSearch?: ((query: string) => Promise<Command[]>) | undefined;
|
|
156
|
-
}> & Omit<Map<string, CommandGroup
|
|
290
|
+
onSearch?: ((query: string) => Promise<Command<unknown>[]>) | undefined;
|
|
291
|
+
}> & Omit<Map<string, CommandGroup<unknown>>, keyof Map<any, any>>;
|
|
157
292
|
commands: Map<string, {
|
|
158
293
|
id: string;
|
|
159
294
|
label: string;
|
|
@@ -281,22 +416,158 @@ export declare function createPaletteContext(options?: PaletteTestOptions): {
|
|
|
281
416
|
shortcut?: string[] | undefined;
|
|
282
417
|
disabled?: boolean | undefined;
|
|
283
418
|
enabled?: (() => boolean) | undefined;
|
|
419
|
+
disabledReason?: string | undefined;
|
|
420
|
+
badge?: string | {
|
|
421
|
+
text: string;
|
|
422
|
+
color?: string | undefined;
|
|
423
|
+
} | undefined;
|
|
284
424
|
confirm?: string | undefined;
|
|
285
425
|
perform: () => void | Promise<void>;
|
|
286
426
|
subCommands?: /*elided*/ any[] | undefined;
|
|
287
|
-
|
|
427
|
+
page?: {
|
|
428
|
+
placeholder?: string | undefined;
|
|
429
|
+
items?: /*elided*/ any[] | undefined;
|
|
430
|
+
onSearch?: ((query: string) => Command[] | Promise<Command[]>) | undefined;
|
|
431
|
+
} | undefined;
|
|
432
|
+
actions?: {
|
|
433
|
+
id: string;
|
|
434
|
+
label: string;
|
|
435
|
+
icon?: string | import('vue').FunctionalComponent<any, {}, any, {}> | {
|
|
436
|
+
new (...args: any[]): any;
|
|
437
|
+
__isFragment?: never;
|
|
438
|
+
__isTeleport?: never;
|
|
439
|
+
__isSuspense?: never;
|
|
440
|
+
} | {
|
|
441
|
+
[x: string]: any;
|
|
442
|
+
setup?: ((this: void, props: import('@vue/shared').LooseRequired<any>, ctx: {
|
|
443
|
+
attrs: import('vue').Attrs;
|
|
444
|
+
slots: Readonly<{
|
|
445
|
+
[name: string]: import('vue').Slot<any> | undefined;
|
|
446
|
+
}>;
|
|
447
|
+
emit: ((event: unknown, ...args: any[]) => void) | ((event: string, ...args: any[]) => void);
|
|
448
|
+
expose: <Exposed extends Record<string, any> = Record<string, any>>(exposed?: Exposed) => void;
|
|
449
|
+
}) => any) | undefined;
|
|
450
|
+
name?: string | undefined;
|
|
451
|
+
template?: string | object | undefined;
|
|
452
|
+
render?: Function | undefined;
|
|
453
|
+
components?: Record<string, import('vue').Component<any, any, any, import('vue').ComputedOptions, import('vue').MethodOptions, {}, any>> | undefined;
|
|
454
|
+
directives?: Record<string, import('vue').Directive<any, any, string, any>> | undefined;
|
|
455
|
+
inheritAttrs?: boolean | undefined;
|
|
456
|
+
emits?: any;
|
|
457
|
+
slots?: {} | undefined;
|
|
458
|
+
expose?: string[] | undefined;
|
|
459
|
+
serverPrefetch?: (() => void | Promise<any>) | undefined;
|
|
460
|
+
compilerOptions?: {
|
|
461
|
+
isCustomElement?: ((tag: string) => boolean) | undefined;
|
|
462
|
+
whitespace?: "preserve" | "condense" | undefined;
|
|
463
|
+
comments?: boolean | undefined;
|
|
464
|
+
delimiters?: [string, string] | undefined;
|
|
465
|
+
} | undefined;
|
|
466
|
+
call?: ((this: unknown, ...args: unknown[]) => never) | undefined;
|
|
467
|
+
__isFragment?: never | undefined;
|
|
468
|
+
__isTeleport?: never | undefined;
|
|
469
|
+
__isSuspense?: never | undefined;
|
|
470
|
+
__defaults?: {} | undefined;
|
|
471
|
+
compatConfig?: {
|
|
472
|
+
GLOBAL_MOUNT?: boolean | "suppress-warning" | undefined;
|
|
473
|
+
GLOBAL_MOUNT_CONTAINER?: boolean | "suppress-warning" | undefined;
|
|
474
|
+
GLOBAL_EXTEND?: boolean | "suppress-warning" | undefined;
|
|
475
|
+
GLOBAL_PROTOTYPE?: boolean | "suppress-warning" | undefined;
|
|
476
|
+
GLOBAL_SET?: boolean | "suppress-warning" | undefined;
|
|
477
|
+
GLOBAL_DELETE?: boolean | "suppress-warning" | undefined;
|
|
478
|
+
GLOBAL_OBSERVABLE?: boolean | "suppress-warning" | undefined;
|
|
479
|
+
GLOBAL_PRIVATE_UTIL?: boolean | "suppress-warning" | undefined;
|
|
480
|
+
CONFIG_SILENT?: boolean | "suppress-warning" | undefined;
|
|
481
|
+
CONFIG_DEVTOOLS?: boolean | "suppress-warning" | undefined;
|
|
482
|
+
CONFIG_KEY_CODES?: boolean | "suppress-warning" | undefined;
|
|
483
|
+
CONFIG_PRODUCTION_TIP?: boolean | "suppress-warning" | undefined;
|
|
484
|
+
CONFIG_IGNORED_ELEMENTS?: boolean | "suppress-warning" | undefined;
|
|
485
|
+
CONFIG_WHITESPACE?: boolean | "suppress-warning" | undefined;
|
|
486
|
+
CONFIG_OPTION_MERGE_STRATS?: boolean | "suppress-warning" | undefined;
|
|
487
|
+
INSTANCE_SET?: boolean | "suppress-warning" | undefined;
|
|
488
|
+
INSTANCE_DELETE?: boolean | "suppress-warning" | undefined;
|
|
489
|
+
INSTANCE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
490
|
+
INSTANCE_EVENT_EMITTER?: boolean | "suppress-warning" | undefined;
|
|
491
|
+
INSTANCE_EVENT_HOOKS?: boolean | "suppress-warning" | undefined;
|
|
492
|
+
INSTANCE_CHILDREN?: boolean | "suppress-warning" | undefined;
|
|
493
|
+
INSTANCE_LISTENERS?: boolean | "suppress-warning" | undefined;
|
|
494
|
+
INSTANCE_SCOPED_SLOTS?: boolean | "suppress-warning" | undefined;
|
|
495
|
+
INSTANCE_ATTRS_CLASS_STYLE?: boolean | "suppress-warning" | undefined;
|
|
496
|
+
OPTIONS_DATA_FN?: boolean | "suppress-warning" | undefined;
|
|
497
|
+
OPTIONS_DATA_MERGE?: boolean | "suppress-warning" | undefined;
|
|
498
|
+
OPTIONS_BEFORE_DESTROY?: boolean | "suppress-warning" | undefined;
|
|
499
|
+
OPTIONS_DESTROYED?: boolean | "suppress-warning" | undefined;
|
|
500
|
+
WATCH_ARRAY?: boolean | "suppress-warning" | undefined;
|
|
501
|
+
PROPS_DEFAULT_THIS?: boolean | "suppress-warning" | undefined;
|
|
502
|
+
V_ON_KEYCODE_MODIFIER?: boolean | "suppress-warning" | undefined;
|
|
503
|
+
CUSTOM_DIR?: boolean | "suppress-warning" | undefined;
|
|
504
|
+
ATTR_FALSE_VALUE?: boolean | "suppress-warning" | undefined;
|
|
505
|
+
ATTR_ENUMERATED_COERCION?: boolean | "suppress-warning" | undefined;
|
|
506
|
+
TRANSITION_CLASSES?: boolean | "suppress-warning" | undefined;
|
|
507
|
+
TRANSITION_GROUP_ROOT?: boolean | "suppress-warning" | undefined;
|
|
508
|
+
COMPONENT_ASYNC?: boolean | "suppress-warning" | undefined;
|
|
509
|
+
COMPONENT_FUNCTIONAL?: boolean | "suppress-warning" | undefined;
|
|
510
|
+
COMPONENT_V_MODEL?: boolean | "suppress-warning" | undefined;
|
|
511
|
+
RENDER_FUNCTION?: boolean | "suppress-warning" | undefined;
|
|
512
|
+
FILTERS?: boolean | "suppress-warning" | undefined;
|
|
513
|
+
PRIVATE_APIS?: boolean | "suppress-warning" | undefined;
|
|
514
|
+
MODE?: 2 | 3 | ((comp: import('vue').Component | null) => 2 | 3) | undefined;
|
|
515
|
+
} | undefined;
|
|
516
|
+
data?: ((this: any, vm: any) => any) | undefined;
|
|
517
|
+
computed?: import('vue').ComputedOptions | undefined;
|
|
518
|
+
methods?: import('vue').MethodOptions | undefined;
|
|
519
|
+
watch?: {
|
|
520
|
+
[x: string]: (string | import('vue').WatchCallback | ({
|
|
521
|
+
handler: import('vue').WatchCallback | string;
|
|
522
|
+
} & import('vue').WatchOptions<boolean>)) | (string | import('vue').WatchCallback | ({
|
|
523
|
+
handler: import('vue').WatchCallback | string;
|
|
524
|
+
} & import('vue').WatchOptions<boolean>))[];
|
|
525
|
+
} | undefined;
|
|
526
|
+
provide?: import('vue').ComponentProvideOptions | undefined;
|
|
527
|
+
inject?: {} | string[] | undefined;
|
|
528
|
+
filters?: Record<string, Function> | undefined;
|
|
529
|
+
mixins?: any[] | undefined;
|
|
530
|
+
extends?: any;
|
|
531
|
+
beforeCreate?: (() => any) | undefined;
|
|
532
|
+
created?: (() => any) | undefined;
|
|
533
|
+
beforeMount?: (() => any) | undefined;
|
|
534
|
+
mounted?: (() => any) | undefined;
|
|
535
|
+
beforeUpdate?: (() => any) | undefined;
|
|
536
|
+
updated?: (() => any) | undefined;
|
|
537
|
+
activated?: (() => any) | undefined;
|
|
538
|
+
deactivated?: (() => any) | undefined;
|
|
539
|
+
beforeDestroy?: (() => any) | undefined;
|
|
540
|
+
beforeUnmount?: (() => any) | undefined;
|
|
541
|
+
destroyed?: (() => any) | undefined;
|
|
542
|
+
unmounted?: (() => any) | undefined;
|
|
543
|
+
renderTracked?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
544
|
+
renderTriggered?: ((e: import('vue').DebuggerEvent) => void) | undefined;
|
|
545
|
+
errorCaptured?: ((err: unknown, instance: import('vue').ComponentPublicInstance | null, info: string) => boolean | void) | undefined;
|
|
546
|
+
delimiters?: [string, string] | undefined;
|
|
547
|
+
__differentiator?: string | number | symbol | undefined;
|
|
548
|
+
__isBuiltIn?: boolean | undefined;
|
|
549
|
+
__file?: string | undefined;
|
|
550
|
+
__name?: string | undefined;
|
|
551
|
+
} | undefined;
|
|
552
|
+
shortcut?: string[] | undefined;
|
|
553
|
+
perform: () => void | Promise<void>;
|
|
554
|
+
}[] | undefined;
|
|
555
|
+
info?: string | undefined;
|
|
556
|
+
data?: unknown;
|
|
557
|
+
}> & Omit<Map<string, Command<unknown>>, keyof Map<any, any>>;
|
|
288
558
|
};
|
|
289
|
-
registerCommands: (commands: Command[], groupId?: string) => () => void;
|
|
290
|
-
registerGroup: (group: CommandGroup) => () => void;
|
|
291
|
-
search: (query: string) =>
|
|
559
|
+
registerCommands: <T = unknown>(commands: Command<T>[], groupId?: string) => () => void;
|
|
560
|
+
registerGroup: <T = unknown>(group: CommandGroup<T>) => () => void;
|
|
561
|
+
search: (query: string) => SearchResult[];
|
|
292
562
|
getAllCommands: () => Command[];
|
|
563
|
+
findCommand: (id: string) => Command | undefined;
|
|
293
564
|
getSortedGroups: () => CommandGroup[];
|
|
294
565
|
};
|
|
295
566
|
isOpen: import('vue').Ref<boolean, boolean>;
|
|
296
567
|
query: import('vue').Ref<string, string>;
|
|
297
568
|
activeIndex: import('vue').Ref<number, number>;
|
|
298
569
|
provide: {
|
|
299
|
-
[x: string]: PaletteContext
|
|
570
|
+
[x: string]: PaletteContext | Map<string, PaletteContext>;
|
|
300
571
|
};
|
|
301
572
|
};
|
|
302
573
|
/**
|
|
@@ -330,6 +601,6 @@ export declare const PaletteProvider: import('vue').DefineComponent<import('vue'
|
|
|
330
601
|
default: () => never[];
|
|
331
602
|
};
|
|
332
603
|
}>> & Readonly<{}>, {
|
|
333
|
-
groups: CommandGroup[];
|
|
334
|
-
commands: Command[];
|
|
604
|
+
groups: CommandGroup<unknown>[];
|
|
605
|
+
commands: Command<unknown>[];
|
|
335
606
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* A dedicated "page" a command can open — like a sub-palette, but with its own
|
|
5
|
+
* input placeholder and an async search handler driven by the query. Useful for
|
|
6
|
+
* filters, remote pickers, and multi-step flows.
|
|
7
|
+
*/
|
|
8
|
+
export interface CommandPage {
|
|
9
|
+
/** Placeholder shown in the input while on this page. */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** Static items shown when the query is empty. */
|
|
12
|
+
items?: Command[];
|
|
13
|
+
/** Query-driven results (debounced). Falls back to filtering `items` if omitted. */
|
|
14
|
+
onSearch?: (query: string) => Command[] | Promise<Command[]>;
|
|
15
|
+
}
|
|
16
|
+
/** A secondary action available on a command (opened via the actions menu). */
|
|
17
|
+
export interface CommandAction {
|
|
18
|
+
id: string;
|
|
19
|
+
label: string;
|
|
20
|
+
icon?: Component | string;
|
|
21
|
+
shortcut?: string[];
|
|
22
|
+
perform: () => void | Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export interface Command<T = unknown> {
|
|
4
25
|
id: string;
|
|
5
26
|
label: string;
|
|
6
27
|
description?: string;
|
|
@@ -11,20 +32,42 @@ export interface Command {
|
|
|
11
32
|
shortcut?: string[];
|
|
12
33
|
disabled?: boolean;
|
|
13
34
|
enabled?: () => boolean;
|
|
35
|
+
/** Explanation shown (tooltip) when the command is disabled. */
|
|
36
|
+
disabledReason?: string;
|
|
37
|
+
/** Small label rendered next to the command (e.g. "New", "Pro", a count). */
|
|
38
|
+
badge?: string | {
|
|
39
|
+
text: string;
|
|
40
|
+
color?: string;
|
|
41
|
+
};
|
|
14
42
|
confirm?: string;
|
|
15
43
|
perform: () => void | Promise<void>;
|
|
16
|
-
subCommands?: Command[];
|
|
44
|
+
subCommands?: Command<T>[];
|
|
45
|
+
/** Opens a nested page with its own input/async search when selected. */
|
|
46
|
+
page?: CommandPage;
|
|
47
|
+
/** Secondary actions, opened with `Tab` from the active item. */
|
|
48
|
+
actions?: CommandAction[];
|
|
49
|
+
/** Extra detail (plain text or HTML) shown in the preview pane for this command. */
|
|
50
|
+
info?: string;
|
|
51
|
+
/** Arbitrary, type-safe payload carried by the command (e.g. for previews/handlers). */
|
|
52
|
+
data?: T;
|
|
17
53
|
}
|
|
18
|
-
export interface CommandGroup {
|
|
54
|
+
export interface CommandGroup<T = unknown> {
|
|
19
55
|
id: string;
|
|
20
56
|
label: string;
|
|
21
57
|
priority?: number;
|
|
22
|
-
commands: Command[];
|
|
23
|
-
onSearch?: (query: string) => Promise<Command[]>;
|
|
58
|
+
commands: Command<T>[];
|
|
59
|
+
onSearch?: (query: string) => Promise<Command<T>[]>;
|
|
24
60
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
61
|
+
/**
|
|
62
|
+
* A search scope activated by a prefix in the query (e.g. `>` commands, `@` symbols).
|
|
63
|
+
* While active, the prefix is stripped and results come from `onSearch` (or, if
|
|
64
|
+
* omitted, the regular fuzzy search over the stripped query).
|
|
65
|
+
*/
|
|
66
|
+
export interface PaletteMode {
|
|
67
|
+
prefix: string;
|
|
68
|
+
placeholder?: string;
|
|
69
|
+
label?: string;
|
|
70
|
+
onSearch?: (query: string) => Command[] | Promise<Command[]>;
|
|
28
71
|
}
|
|
29
72
|
export interface PaletteState {
|
|
30
73
|
isOpen: boolean;
|
|
@@ -37,21 +80,90 @@ export interface PaletteState {
|
|
|
37
80
|
}>;
|
|
38
81
|
recentIds: string[];
|
|
39
82
|
}
|
|
40
|
-
export interface SearchResult {
|
|
41
|
-
command: Command
|
|
83
|
+
export interface SearchResult<T = unknown> {
|
|
84
|
+
command: Command<T>;
|
|
42
85
|
score: number;
|
|
43
86
|
matches: Array<[start: number, end: number]>;
|
|
44
87
|
groupId?: string;
|
|
88
|
+
/** Ancestor commands when this result is a nested sub-command (for breadcrumb context). */
|
|
89
|
+
parents?: Command<T>[];
|
|
90
|
+
/** Which field produced the winning score. */
|
|
91
|
+
matchedField?: 'label' | 'description' | 'keyword' | 'alias';
|
|
92
|
+
/** The matching keyword/alias text (for an explanatory hint when the label itself didn't match). */
|
|
93
|
+
matchedText?: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Pluggable search strategy. Receives the raw query and all available commands,
|
|
97
|
+
* returns ranked results (highest score first). `groupId` is filled in by the
|
|
98
|
+
* store afterwards, so a custom scorer can leave it undefined.
|
|
99
|
+
*/
|
|
100
|
+
export type SearchFn<T = unknown> = (query: string, commands: Command<T>[]) => SearchResult<T>[];
|
|
101
|
+
/** Per-command usage statistics powering frecency ranking. */
|
|
102
|
+
export interface CommandUsage {
|
|
103
|
+
count: number;
|
|
104
|
+
lastUsed: number;
|
|
105
|
+
}
|
|
106
|
+
export interface PaletteLabels {
|
|
107
|
+
/** Header above the recent-commands section (empty query). */
|
|
108
|
+
recent: string;
|
|
109
|
+
/** Header above the pinned-commands section (empty query). */
|
|
110
|
+
pinned: string;
|
|
111
|
+
/** `title`/`aria-label` of the pin affordance (not yet pinned). */
|
|
112
|
+
pin: string;
|
|
113
|
+
/** `title`/`aria-label` of the pin affordance (already pinned). */
|
|
114
|
+
unpin: string;
|
|
115
|
+
/** Confirm dialog — proceed button. */
|
|
116
|
+
confirmYes: string;
|
|
117
|
+
/** Confirm dialog — cancel button. */
|
|
118
|
+
confirmCancel: string;
|
|
119
|
+
/** Theme switcher button titles. */
|
|
120
|
+
themeLight: string;
|
|
121
|
+
themeDark: string;
|
|
122
|
+
themeSystem: string;
|
|
123
|
+
/** `aria-label` of the dialog element. */
|
|
124
|
+
dialogLabel: string;
|
|
125
|
+
/** `aria-label` of the per-item loading spinner. */
|
|
126
|
+
loading: string;
|
|
127
|
+
/** Screen-reader announcement of the result count (aria-live). */
|
|
128
|
+
resultsCount: (n: number) => string;
|
|
129
|
+
/** Header of the secondary-actions menu. */
|
|
130
|
+
actions: string;
|
|
131
|
+
/** "Back" affordance label (actions menu, etc.). */
|
|
132
|
+
back: string;
|
|
133
|
+
/** `title`/`aria-label` of the preview-pane toggle button. */
|
|
134
|
+
togglePreview: string;
|
|
45
135
|
}
|
|
46
136
|
export interface PaletteOptions {
|
|
137
|
+
/** Instance name for running multiple independent palettes (default `'default'`). */
|
|
138
|
+
name?: string;
|
|
47
139
|
hotkey?: string[];
|
|
48
140
|
persistRecent?: boolean;
|
|
49
141
|
maxRecent?: number;
|
|
50
142
|
maxRecentPerGroup?: number;
|
|
51
143
|
localStorageKey?: string;
|
|
52
144
|
colorTheme?: 'light' | 'dark' | 'system';
|
|
145
|
+
/** Replace the built-in fuzzy search with a custom strategy (e.g. Fuse.js). */
|
|
146
|
+
search?: SearchFn;
|
|
147
|
+
/** Include nested `subCommands` in search results (default `true`). */
|
|
148
|
+
searchNested?: boolean;
|
|
149
|
+
/** Show disabled commands (greyed, non-executable) instead of hiding them (default `false`). */
|
|
150
|
+
showDisabled?: boolean;
|
|
151
|
+
/** Boost frequently & recently used commands in the ranking (default `false`). */
|
|
152
|
+
frecency?: boolean;
|
|
153
|
+
/** Async data source applied to every query, merged with regular results. */
|
|
154
|
+
onSearch?: (query: string) => Command[] | Promise<Command[]>;
|
|
155
|
+
/** Auto-register each command's `shortcut` as a real global hotkey. */
|
|
156
|
+
bindShortcuts?: boolean;
|
|
53
157
|
onOpen?: () => void;
|
|
54
158
|
onClose?: () => void;
|
|
55
159
|
onError?: (err: unknown, command: Command) => void;
|
|
160
|
+
/** Called when the keyboard-active command changes (useful for previews/analytics). */
|
|
161
|
+
onHighlight?: (command: Command | null) => void;
|
|
56
162
|
}
|
|
57
163
|
export declare const PALETTE_INJECT_KEY: unique symbol;
|
|
164
|
+
export declare const PALETTE_LABELS_KEY: unique symbol;
|
|
165
|
+
export declare const PALETTE_SELECTION_KEY: unique symbol;
|
|
166
|
+
export declare const PALETTE_QUERY_KEY: unique symbol;
|
|
167
|
+
export declare const PALETTE_PINNED_KEY: unique symbol;
|
|
168
|
+
/** Registry of all named palette instances installed on the app. */
|
|
169
|
+
export declare const PALETTE_REGISTRY_KEY: unique symbol;
|