claritykit-svelte
Version:
A comprehensive Svelte component library focused on accessibility, ADHD-optimized design, developer experience, and full SSR compatibility
132 lines • 4.59 kB
TypeScript
export interface Command {
id: string;
label: string;
description?: string;
category: string;
keywords?: string[];
icon?: string;
shortcut?: string;
action: () => void | Promise<void>;
href?: string;
disabled?: boolean;
loading?: boolean;
metadata?: Record<string, any>;
}
export interface CommandCategory {
id: string;
label: string;
icon?: string;
priority?: number;
description?: string;
}
export interface RouterConfig {
navigate?: (href: string) => void;
currentPath?: string;
baseUrl?: string;
}
export interface CommandHistory {
commandId: string;
timestamp: number;
executionCount: number;
}
export interface SearchResult {
command: Command;
score: number;
matches: string[];
}
type $$ComponentProps = {
commands?: Command[];
categories?: CommandCategory[];
open?: boolean;
placeholder?: string;
maxResults?: number;
showCategories?: boolean;
showRecent?: boolean;
showFavorites?: boolean;
enableFuzzySearch?: boolean;
searchThreshold?: number;
router?: RouterConfig;
className?: string;
};
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
$$bindings?: Bindings;
} & Exports;
(internal: unknown, props: Props & {
$$events?: Events;
$$slots?: Slots;
}): Exports & {
$set?: any;
$on?: any;
};
z_$$bindings?: Bindings;
}
/**
* CommandPalette
*
* A Cmd+K quick actions command palette with fuzzy search functionality,
* categorized command organization, and integration with application routing.
*
* Features:
* - Cmd+K keyboard shortcut activation
* - Fuzzy search with command scoring and ranking
* - Categorized command organization (navigation, actions, settings)
* - Recent commands history and favorites system
* - Keyboard navigation with arrow keys and tab completion
* - Command scoring based on usage patterns
* - Custom command registration and plugin support
* - Loading states for async command execution
* - Command preview and help text display
* - Integration points for application routing and state management
* - ADHD-friendly design with clear visual hierarchy
*
* @prop {Command[]} [commands=[]] - Available commands
* @prop {CommandCategory[]} [categories=[]] - Command categories
* @prop {boolean} [open=false] - Whether the palette is open
* @prop {string} [placeholder='Type a command...'] - Search input placeholder
* @prop {number} [maxResults=10] - Maximum number of results to show
* @prop {boolean} [showCategories=true] - Whether to show category headers
* @prop {boolean} [showRecent=true] - Whether to show recent commands
* @prop {boolean} [showFavorites=true] - Whether to show favorite commands
* @prop {boolean} [enableFuzzySearch=true] - Whether to enable fuzzy search
* @prop {number} [searchThreshold=0.3] - Fuzzy search threshold (0-1)
* @prop {RouterConfig} [router] - Router configuration for navigation
* @prop {string} [className] - Additional CSS classes
*
* @event command-executed - Fired when a command is executed
* @event palette-opened - Fired when palette opens
* @event palette-closed - Fired when palette closes
* @event search-changed - Fired when search query changes
* @event command-selected - Fired when a command is selected
* @event category-changed - Fired when category filter changes
*/
declare const CommandPalette: $$__sveltets_2_IsomorphicComponent<$$ComponentProps, {
'command-executed': CustomEvent<{
command: Command;
result?: any;
}>;
'palette-opened': CustomEvent<void>;
'palette-closed': CustomEvent<void>;
'search-changed': CustomEvent<{
query: string;
}>;
'command-selected': CustomEvent<{
command: Command;
index: number;
}>;
'category-changed': CustomEvent<{
category: string | null;
}>;
} & {
[evt: string]: CustomEvent<any>;
}, {}, {
show: () => void;
hide: () => void;
addCommand: (command: Command) => void;
removeCommand: (commandId: string) => void;
clearHistory: () => void;
clearFavorites: () => void;
}, "">;
type CommandPalette = InstanceType<typeof CommandPalette>;
export default CommandPalette;
//# sourceMappingURL=CommandPalette.svelte.d.ts.map