@rrstudioapps/ngx-command-palette 0.1.0 → 0.3.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.
@@ -1 +1 @@
1
- {"version":3,"file":"rrstudioapps-ngx-command-palette.mjs","names":[],"sources":["../../../projects/ngx-command-palette/src/lib/config.ts","../../../projects/ngx-command-palette/src/lib/fuzzy.ts","../../../projects/ngx-command-palette/src/lib/recent-store.ts","../../../projects/ngx-command-palette/src/lib/command-palette.service.ts","../../../projects/ngx-command-palette/src/lib/list-navigation.ts","../../../projects/ngx-command-palette/src/lib/shortcut.ts","../../../projects/ngx-command-palette/src/lib/templates.directive.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.html"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nexport type CommandPaletteTheme = 'light' | 'dark' | 'auto';\n\n/** Texts of the palette, for translations. */\nexport interface CommandPaletteLabels {\n readonly placeholder: string;\n readonly dialog: string;\n readonly listbox: string;\n readonly empty: string;\n readonly loading: string;\n readonly recent: string;\n readonly defaultGroup: string;\n /** Screen reader announcement, `{count}` is replaced by the number of results. */\n readonly results: string;\n readonly closeHint: string;\n}\n\nexport interface CommandPaletteRecentOptions {\n /** Max number of recents shown. Default: 5. */\n readonly max?: number;\n /** localStorage key. Default: `rr-cp:recent`. */\n readonly storageKey?: string;\n}\n\nexport interface CommandPaletteConfig {\n /** Shortcut(s) that toggle the palette. Default: `mod+k` (⌘K on macOS, Ctrl+K elsewhere). */\n readonly shortcut: string | readonly string[];\n /** `auto` follows `prefers-color-scheme`. Default: `auto`. */\n readonly theme: CommandPaletteTheme;\n /** \"Recent\" section shown with an empty query; `false` disables it. */\n readonly recent: CommandPaletteRecentOptions | false;\n /** Debounce for async providers, in ms. Default: 200. */\n readonly debounceMs: number;\n /** Max results of local commands for a non-empty query. Default: 50. */\n readonly maxResults: number;\n readonly labels: CommandPaletteLabels;\n}\n\nexport type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {\n readonly labels?: Partial<CommandPaletteLabels>;\n};\n\nexport const DEFAULT_COMMAND_PALETTE_LABELS: CommandPaletteLabels = {\n placeholder: 'Type a command or search…',\n dialog: 'Command palette',\n listbox: 'Commands',\n empty: 'No results found.',\n loading: 'Loading…',\n recent: 'Recent',\n defaultGroup: 'Commands',\n results: '{count} results',\n closeHint: 'Esc',\n};\n\nexport const DEFAULT_COMMAND_PALETTE_CONFIG: CommandPaletteConfig = {\n shortcut: 'mod+k',\n theme: 'auto',\n recent: { max: 5, storageKey: 'rr-cp:recent' },\n debounceMs: 200,\n maxResults: 50,\n labels: DEFAULT_COMMAND_PALETTE_LABELS,\n};\n\nexport const COMMAND_PALETTE_CONFIG = new InjectionToken<CommandPaletteConfig>(\n 'COMMAND_PALETTE_CONFIG',\n {\n providedIn: 'root',\n factory: () => DEFAULT_COMMAND_PALETTE_CONFIG,\n },\n);\n\n/** Merges options with the defaults. */\nexport function resolveConfig(options: CommandPaletteOptions = {}): CommandPaletteConfig {\n return {\n ...DEFAULT_COMMAND_PALETTE_CONFIG,\n ...options,\n recent:\n options.recent === false\n ? false\n : {\n ...(DEFAULT_COMMAND_PALETTE_CONFIG.recent as CommandPaletteRecentOptions),\n ...options.recent,\n },\n labels: { ...DEFAULT_COMMAND_PALETTE_LABELS, ...options.labels },\n };\n}\n\n/** Configures the command palette. Optional: without it the defaults are used. */\nexport function provideCommandPalette(options: CommandPaletteOptions = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: COMMAND_PALETTE_CONFIG, useValue: resolveConfig(options) },\n ]);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command, HighlightSegment } from './command.model';\n\nexport interface FuzzyMatch {\n /** Higher is better. Only meaningful to compare matches of the same query. */\n readonly score: number;\n /** Indices of `text` matched by the query, ascending. */\n readonly indices: readonly number[];\n}\n\n// Scoring weights: consecutive letters and word starts are worth more, gaps cost.\nconst SCORE_CHAR = 1;\nconst BONUS_CONSECUTIVE = 5;\nconst BONUS_WORD_START = 8;\nconst BONUS_STRING_START = 4;\nconst PENALTY_GAP = 1;\nconst PENALTY_LEADING = 0.2;\nconst SEPARATORS = new Set([' ', '-', '_', '.', '/', ':', '(', '[', ',']);\n\n/** Lowercase and without accents, one character in → one character out (keeps indices aligned). */\nfunction fold(char: string): string {\n const base = char.normalize('NFD').replace(/\\p{M}/gu, '');\n return (base[0] ?? char).toLowerCase();\n}\n\nfunction isWordStart(text: string, i: number): boolean {\n if (i === 0) return true;\n const prev = text[i - 1];\n if (SEPARATORS.has(prev)) return true;\n // camelCase: lowercase followed by uppercase\n const cur = text[i];\n return prev === prev.toLowerCase() && cur !== cur.toLowerCase() && cur === cur.toUpperCase();\n}\n\n/**\n * Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in\n * `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.\n */\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch | null {\n const q = query.replace(/\\s+/g, '').split('').map(fold);\n if (q.length === 0) return { score: 0, indices: [] };\n // Work on UTF-16 units so indices stay those of `text`.\n const t: string[] = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of -- for-of iterates code points and would shift the indices\n for (let i = 0; i < text.length; i++) t.push(fold(text[i]));\n const m = q.length;\n const n = t.length;\n if (m > n) return null;\n\n const NEG = -Infinity;\n // M[i][j]: best score with q[i] matched to t[j]\n // D[i][j]: best score with q[0..i] matched within t[0..j] (minus a penalty for characters skipped after)\n const M: Float64Array[] = [];\n const D: Float64Array[] = [];\n const bonus = new Float64Array(n);\n for (let j = 0; j < n; j++) {\n bonus[j] =\n SCORE_CHAR +\n (isWordStart(text, j) ? BONUS_WORD_START : 0) +\n (j === 0 ? BONUS_STRING_START : 0);\n }\n\n // For the traceback: where each M comes from (consecutive or jump) and which k gives each D\n const consec: Uint8Array[] = [];\n const Dk: Int32Array[] = [];\n for (let i = 0; i < m; i++) {\n const Mi = new Float64Array(n).fill(NEG);\n const Di = new Float64Array(n).fill(NEG);\n const Ci = new Uint8Array(n);\n const Ki = new Int32Array(n).fill(-1);\n for (let j = i; j < n; j++) {\n if (t[j] === q[i]) {\n if (i === 0) {\n Mi[j] = bonus[j] - PENALTY_LEADING * j;\n } else if (j > 0) {\n const consecutive = M[i - 1][j - 1] + BONUS_CONSECUTIVE;\n const jump = D[i - 1][j - 1];\n if (consecutive >= jump && consecutive > NEG) {\n Mi[j] = consecutive + bonus[j];\n Ci[j] = 1;\n } else if (jump > NEG) {\n Mi[j] = jump + bonus[j];\n }\n }\n }\n const carried = j > 0 ? Di[j - 1] - PENALTY_GAP : NEG;\n if (Mi[j] > NEG && Mi[j] >= carried) {\n Di[j] = Mi[j];\n Ki[j] = j;\n } else if (j > 0) {\n Di[j] = carried;\n Ki[j] = Ki[j - 1];\n }\n }\n M.push(Mi);\n D.push(Di);\n consec.push(Ci);\n Dk.push(Ki);\n }\n\n // End of the alignment: the best M on the last row\n let end = -1;\n let best = NEG;\n for (let j = m - 1; j < n; j++) {\n if (M[m - 1][j] > best) {\n best = M[m - 1][j];\n end = j;\n }\n }\n if (end < 0) return null;\n\n // Rebuild the indices backwards\n const indices = new Array<number>(m);\n let j = end;\n for (let i = m - 1; i >= 0; i--) {\n indices[i] = j;\n if (i === 0) break;\n j = consec[i][j] ? j - 1 : Dk[i - 1][j - 1];\n }\n\n // Small bonus for short strings: with equal matches the text closest to the query wins\n const score = best - (n - m) * 0.01;\n return { score, indices };\n}\n\n/** Splits `text` into matched / unmatched segments for highlighting. */\nexport function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[] {\n if (indices.length === 0) return text ? [{ text, match: false }] : [];\n const set = new Set(indices);\n const out: HighlightSegment[] = [];\n let buf = '';\n let bufMatch = set.has(0);\n for (let i = 0; i < text.length; i++) {\n const match = set.has(i);\n if (match !== bufMatch && buf) {\n out.push({ text: buf, match: bufMatch });\n buf = '';\n }\n bufMatch = match;\n buf += text[i];\n }\n if (buf) out.push({ text: buf, match: bufMatch });\n return out;\n}\n\n// Field weights: label first, then keywords, then description.\nconst WEIGHT_KEYWORD = 0.8;\nconst WEIGHT_DESCRIPTION = 0.5;\n/**\n * Minimum quality (average points per character) for keywords and description: long texts\n * contain almost any scattered letter sequence, so there we require word starts or close letters.\n */\nconst MIN_SECONDARY_QUALITY = 4;\n\nfunction strongEnough(match: FuzzyMatch | null, query: string): match is FuzzyMatch {\n const length = query.replace(/\\s+/g, '').length;\n return !!match && length > 0 && match.score / length >= MIN_SECONDARY_QUALITY;\n}\n\n/**\n * Matches a command against the query using label, keywords and description.\n * `indices` refer to the label (empty when only keywords/description matched).\n */\nexport function matchCommand(query: string, command: Command): FuzzyMatch | null {\n const label = fuzzyMatch(query, command.label);\n let best: FuzzyMatch | null = label;\n for (const keyword of command.keywords ?? []) {\n const m = fuzzyMatch(query, keyword);\n if (strongEnough(m, query) && (!best || m.score * WEIGHT_KEYWORD > best.score)) {\n best = { score: m.score * WEIGHT_KEYWORD, indices: label?.indices ?? [] };\n }\n }\n if (command.description) {\n const m = fuzzyMatch(query, command.description);\n if (strongEnough(m, query) && (!best || m.score * WEIGHT_DESCRIPTION > best.score)) {\n best = { score: m.score * WEIGHT_DESCRIPTION, indices: label?.indices ?? [] };\n }\n }\n return best;\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command } from './command.model';\n\n/** What is saved for a recent command: only serializable fields, never functions. */\nexport interface RecentEntry {\n readonly id: string;\n readonly label: string;\n readonly group?: string;\n readonly description?: string;\n readonly route?: string | readonly unknown[];\n}\n\n/**\n * Recent commands in `localStorage` (most recent first). Every access is guarded:\n * private windows, SSR or blocked storage just mean \"no recents\".\n */\nexport class RecentStore {\n constructor(\n private readonly storageKey: string,\n private readonly max: number,\n private readonly storage: Pick<\n Storage,\n 'getItem' | 'setItem' | 'removeItem'\n > | null = defaultStorage(),\n ) {}\n\n load(): RecentEntry[] {\n if (!this.storage || this.max <= 0) return [];\n try {\n const raw = this.storage.getItem(this.storageKey);\n if (!raw) return [];\n const parsed: unknown = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n return parsed.filter(isEntry).slice(0, this.max);\n } catch {\n return [];\n }\n }\n\n /** Moves `command` to the top and returns the new list. */\n add(command: Command, current: readonly RecentEntry[] = this.load()): RecentEntry[] {\n if (this.max <= 0) return [];\n const entry: RecentEntry = {\n id: command.id,\n label: command.label,\n ...(command.group ? { group: command.group } : {}),\n ...(command.description ? { description: command.description } : {}),\n ...(command.route !== undefined && isSerializable(command.route)\n ? { route: command.route }\n : {}),\n };\n const next = [entry, ...current.filter((e) => e.id !== command.id)].slice(0, this.max);\n this.save(next);\n return next;\n }\n\n clear(): void {\n try {\n this.storage?.removeItem(this.storageKey);\n } catch {\n /* storage not available */\n }\n }\n\n private save(entries: readonly RecentEntry[]): void {\n try {\n this.storage?.setItem(this.storageKey, JSON.stringify(entries));\n } catch {\n /* quota exceeded or storage blocked: recents stay in memory only */\n }\n }\n}\n\nfunction defaultStorage(): Storage | null {\n try {\n return typeof localStorage === 'undefined' ? null : localStorage;\n } catch {\n return null;\n }\n}\n\nfunction isEntry(value: unknown): value is RecentEntry {\n if (!value || typeof value !== 'object') return false;\n const v = value as Record<string, unknown>;\n return typeof v['id'] === 'string' && typeof v['label'] === 'string';\n}\n\nfunction isSerializable(route: unknown): boolean {\n try {\n JSON.stringify(route);\n return typeof route === 'string' || Array.isArray(route);\n } catch {\n return false;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport {\n DestroyRef,\n DOCUMENT,\n Injectable,\n Signal,\n assertInInjectionContext,\n computed,\n inject,\n isSignal,\n signal,\n} from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport type {\n Command,\n CommandProvider,\n CommandResult,\n CommandSection,\n CommandSubscribable,\n} from './command.model';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteRecentOptions } from './config';\nimport { fuzzyMatch, highlightSegments, matchCommand } from './fuzzy';\nimport { RecentStore, type RecentEntry } from './recent-store';\n\ninterface Registration {\n readonly source: () => readonly Command[];\n}\n\ninterface ProviderState {\n readonly items: readonly Command[];\n readonly loading: boolean;\n readonly error?: unknown;\n}\n\n/** In-flight provider request: debounce timer, abort controller and subscription. */\ninterface PendingRequest {\n timer?: ReturnType<typeof setTimeout>;\n controller?: AbortController;\n subscription?: { unsubscribe(): void };\n}\n\nexport const RECENT_SECTION_ID = 'recent';\n\n/**\n * State of the command palette. Register commands from any component: they are removed\n * automatically when that component is destroyed.\n */\n@Injectable({ providedIn: 'root' })\nexport class CommandPaletteService {\n private readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly router = inject(Router, { optional: true });\n private readonly document = inject(DOCUMENT);\n\n private readonly recentStore = this.config.recent\n ? new RecentStore(\n (this.config.recent as CommandPaletteRecentOptions).storageKey ?? 'rr-cp:recent',\n (this.config.recent as CommandPaletteRecentOptions).max ?? 5,\n )\n : null;\n\n private readonly _isOpen = signal(false);\n private readonly _query = signal('');\n private readonly registrations = signal<readonly Registration[]>([]);\n private readonly providers = signal<readonly CommandProvider[]>([]);\n private readonly providerState = signal<ReadonlyMap<string, ProviderState>>(new Map());\n private readonly recents = signal<readonly RecentEntry[]>(this.recentStore?.load() ?? []);\n private readonly pending = new Map<string, PendingRequest>();\n private returnFocus: HTMLElement | null = null;\n\n /** Whether the palette is open. */\n readonly isOpen = this._isOpen.asReadonly();\n /** Current search text. */\n readonly query = this._query.asReadonly();\n\n /** All registered (synchronous) commands. When two share an id, the last registered wins. */\n readonly commands: Signal<readonly Command[]> = computed(() => {\n const byId = new Map<string, Command>();\n for (const registration of this.registrations()) {\n for (const command of registration.source()) {\n byId.delete(command.id);\n byId.set(command.id, command);\n }\n }\n return [...byId.values()];\n });\n\n /** True while at least one async provider is waiting for results. */\n readonly loading = computed(() => [...this.providerState().values()].some((s) => s.loading));\n\n /** Sections shown in the list, already filtered and sorted. */\n readonly sections: Signal<readonly CommandSection[]> = computed(() =>\n this.buildSections(this._query().trim()),\n );\n\n /** Opens the palette, optionally with an initial query. */\n open(query = ''): void {\n if (!this._isOpen()) {\n const active = this.document.activeElement;\n // No instanceof HTMLElement: the class does not exist during SSR\n this.returnFocus =\n active &&\n active !== this.document.body &&\n typeof (active as HTMLElement).focus === 'function'\n ? (active as HTMLElement)\n : null;\n }\n this._isOpen.set(true);\n this.setQuery(query);\n }\n\n /** Closes the palette, cancels pending searches and restores the focus. */\n close(): void {\n if (!this._isOpen()) return;\n this._isOpen.set(false);\n this.cancelAll();\n this._query.set('');\n this.providerState.set(new Map());\n const target = this.returnFocus;\n this.returnFocus = null;\n if (target?.isConnected) target.focus({ preventScroll: true });\n }\n\n toggle(): void {\n if (this._isOpen()) this.close();\n else this.open();\n }\n\n /** Updates the search text and schedules the async providers. */\n setQuery(query: string): void {\n this._query.set(query);\n if (this._isOpen()) this.scheduleProviders();\n }\n\n /**\n * Registers commands (an array or a signal of arrays). Called in an injection context\n * (constructor, field initializer) they are removed when that context is destroyed.\n * Returns a function that removes them earlier.\n */\n register(\n commands: readonly Command[] | Signal<readonly Command[]>,\n destroyRef?: DestroyRef,\n ): () => void {\n const registration: Registration = { source: isSignal(commands) ? commands : () => commands };\n this.registrations.update((list) => [...list, registration]);\n const remove = () =>\n this.registrations.update((list) => list.filter((r) => r !== registration));\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Registers an async provider. Same lifetime rules as {@link register}. */\n registerProvider(provider: CommandProvider, destroyRef?: DestroyRef): () => void {\n this.providers.update((list) => [...list.filter((p) => p.id !== provider.id), provider]);\n if (this._isOpen()) this.scheduleProvider(provider, this._query());\n const remove = () => {\n if (!this.providers().includes(provider)) return;\n this.cancel(provider.id);\n this.providers.update((list) => list.filter((p) => p !== provider));\n this.providerState.update((map) => {\n const next = new Map(map);\n next.delete(provider.id);\n return next;\n });\n };\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Executes a command: saves it in the recents, closes the palette, then navigates or runs it. */\n async execute(command: Command): Promise<void> {\n if (command.disabled) return;\n const query = this._query();\n if (this.recentStore) this.recents.set(this.recentStore.add(command, this.recents()));\n this.close();\n if (command.route !== undefined) {\n if (!this.router) throw new Error('ngx-command-palette: route commands need provideRouter()');\n const { route, navigationExtras } = command;\n await (typeof route === 'string'\n ? this.router.navigateByUrl(route, navigationExtras)\n : this.router.navigate(route as unknown[], navigationExtras));\n } else {\n await command.run({ query });\n }\n }\n\n /** Removes all recents. */\n clearRecent(): void {\n this.recentStore?.clear();\n this.recents.set([]);\n }\n\n // ---- internals ----\n\n private bindToDestroy(remove: () => void, destroyRef?: DestroyRef): () => void {\n const ref = destroyRef ?? currentDestroyRef();\n const unsubscribe = ref?.onDestroy(remove);\n return () => {\n unsubscribe?.();\n remove();\n };\n }\n\n private buildSections(query: string): CommandSection[] {\n const defaultGroup = this.config.labels.defaultGroup;\n const commands = this.commands();\n const groups = new Map<string, CommandResult[]>();\n const push = (group: string, result: CommandResult) => {\n const list = groups.get(group);\n if (list) list.push(result);\n else groups.set(group, [result]);\n };\n const sections: CommandSection[] = [];\n\n if (!query) {\n const recent = this.recentResults(commands);\n if (recent.length)\n sections.push({ id: RECENT_SECTION_ID, label: this.config.labels.recent, items: recent });\n for (const command of commands) {\n const group = command.group ?? defaultGroup;\n push(group, toResult(command, `g:${group}:${command.id}`, 0, []));\n }\n } else {\n const scored: CommandResult[] = [];\n for (const command of commands) {\n const match = matchCommand(query, command);\n if (!match) continue;\n const group = command.group ?? defaultGroup;\n scored.push(toResult(command, `g:${group}:${command.id}`, match.score, match.indices));\n }\n // Stable sort: equal scores keep the registration order\n scored.sort((a, b) => b.score - a.score);\n for (const result of scored.slice(0, this.config.maxResults)) {\n push(result.command.group ?? defaultGroup, result);\n }\n }\n for (const [label, items] of groups) sections.push({ id: `g:${label}`, label, items });\n\n // Async results: server order, highlighted when the label matches\n const states = this.providerState();\n for (const provider of this.providers()) {\n const state = states.get(provider.id);\n if (!state?.items.length) continue;\n const items = state.items.map((command) => {\n const match = query ? fuzzyMatch(query, command.label) : null;\n return toResult(\n command,\n `p:${provider.id}:${command.id}`,\n match?.score ?? 0,\n match?.indices ?? [],\n );\n });\n sections.push({ id: `p:${provider.id}`, label: provider.group, items });\n }\n return sections;\n }\n\n private recentResults(commands: readonly Command[]): CommandResult[] {\n if (!this.recentStore) return [];\n const byId = new Map(commands.map((c) => [c.id, c]));\n const results: CommandResult[] = [];\n for (const entry of this.recents()) {\n // Still registered, or rebuilt from the saved route (e.g. a customer from an API)\n const command: Command | undefined =\n byId.get(entry.id) ??\n (entry.route !== undefined\n ? {\n id: entry.id,\n label: entry.label,\n route: entry.route,\n ...(entry.group ? { group: entry.group } : {}),\n ...(entry.description ? { description: entry.description } : {}),\n }\n : undefined);\n if (command && !command.disabled) results.push(toResult(command, `r:${entry.id}`, 0, []));\n }\n return results;\n }\n\n private scheduleProviders(): void {\n const query = this._query();\n for (const provider of this.providers()) this.scheduleProvider(provider, query);\n }\n\n private scheduleProvider(provider: CommandProvider, rawQuery: string): void {\n this.cancel(provider.id);\n const query = rawQuery.trim();\n if (query.length < (provider.minQueryLength ?? 1)) {\n this.setProviderState(provider.id, null);\n return;\n }\n const previous = this.providerState().get(provider.id);\n this.setProviderState(provider.id, { items: previous?.items ?? [], loading: true });\n const request: PendingRequest = {};\n this.pending.set(provider.id, request);\n request.timer = setTimeout(() => {\n request.timer = undefined;\n const controller = new AbortController();\n request.controller = controller;\n const done = (state: ProviderState) => {\n if (!controller.signal.aborted && this.pending.get(provider.id) === request) {\n this.setProviderState(provider.id, state);\n }\n };\n let result: ReturnType<CommandProvider['search']>;\n try {\n result = provider.search(query, controller.signal);\n } catch (error) {\n done({ items: [], loading: false, error });\n return;\n }\n if (isSubscribable(result)) {\n request.subscription = result.subscribe({\n next: (items) => done({ items, loading: false }),\n error: (error) => done({ items: [], loading: false, error }),\n complete: () => {\n const state = this.providerState().get(provider.id);\n if (state?.loading) done({ items: state.items, loading: false });\n },\n });\n } else {\n Promise.resolve(result).then(\n (items) => done({ items, loading: false }),\n (error: unknown) => done({ items: [], loading: false, error }),\n );\n }\n }, provider.debounceMs ?? this.config.debounceMs);\n }\n\n private setProviderState(id: string, state: ProviderState | null): void {\n this.providerState.update((map) => {\n const next = new Map(map);\n if (state) next.set(id, state);\n else next.delete(id);\n return next;\n });\n }\n\n private cancel(id: string): void {\n const request = this.pending.get(id);\n if (!request) return;\n this.pending.delete(id);\n if (request.timer) clearTimeout(request.timer);\n request.controller?.abort();\n request.subscription?.unsubscribe();\n }\n\n private cancelAll(): void {\n for (const id of [...this.pending.keys()]) this.cancel(id);\n }\n}\n\nfunction toResult(\n command: Command,\n key: string,\n score: number,\n indices: readonly number[],\n): CommandResult {\n return { command, key, score, indices, segments: highlightSegments(command.label, indices) };\n}\n\nfunction isSubscribable<T>(value: unknown): value is CommandSubscribable<T> {\n return !!value && typeof (value as { subscribe?: unknown }).subscribe === 'function';\n}\n\nfunction currentDestroyRef(): DestroyRef | null {\n try {\n return inject(DestroyRef, { optional: true });\n } catch {\n // Outside an injection context: removal stays manual\n return null;\n }\n}\n\n/**\n * Registers commands for the lifetime of the current component/service.\n * Must be called in an injection context.\n */\nexport function injectCommands(\n commands: readonly Command[] | Signal<readonly Command[]>,\n): () => void {\n assertInInjectionContext(injectCommands);\n return inject(CommandPaletteService).register(commands, inject(DestroyRef));\n}\n\n/** Registers an async provider for the lifetime of the current component/service. */\nexport function injectCommandProvider(provider: CommandProvider): () => void {\n assertInInjectionContext(injectCommandProvider);\n return inject(CommandPaletteService).registerProvider(provider, inject(DestroyRef));\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nexport type NavigationAction = 'next' | 'prev' | 'first' | 'last' | 'select' | 'close';\n\ntype KeyLike = Pick<\n KeyboardEvent,\n 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey' | 'isComposing'\n>;\n\n/** Maps a keydown inside the palette to a list action, or `null` to let the input handle it. */\nexport function keyToAction(event: KeyLike): NavigationAction | null {\n // During IME composition Enter and arrows belong to the text editor\n if (event.isComposing) return null;\n switch (event.key) {\n case 'ArrowDown':\n return 'next';\n case 'ArrowUp':\n return 'prev';\n case 'Home':\n return event.shiftKey ? null : 'first';\n case 'End':\n return event.shiftKey ? null : 'last';\n case 'PageUp':\n return 'first';\n case 'PageDown':\n return 'last';\n case 'Enter':\n return 'select';\n case 'Escape':\n return 'close';\n // Ctrl+N / Ctrl+P as in Emacs and many palettes (not Ctrl+J/K: Ctrl+K toggles the palette)\n case 'n':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'next' : null;\n case 'p':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'prev' : null;\n default:\n return null;\n }\n}\n\n/**\n * Index of the next selectable item. `disabled[i]` marks rows that cannot be active.\n * Returns -1 when no item is selectable. `next`/`prev` wrap around.\n */\nexport function moveIndex(\n disabled: readonly boolean[],\n current: number,\n action: 'next' | 'prev' | 'first' | 'last',\n): number {\n const count = disabled.length;\n if (count === 0) return -1;\n const findFrom = (start: number, step: 1 | -1, wrap: boolean): number => {\n for (let n = 0, i = start; n < count; n++, i += step) {\n if (wrap) i = (i + count) % count;\n else if (i < 0 || i >= count) return -1;\n if (!disabled[i]) return i;\n }\n return -1;\n };\n switch (action) {\n case 'first':\n return findFrom(0, 1, false);\n case 'last':\n return findFrom(count - 1, -1, false);\n case 'next':\n return current < 0 ? findFrom(0, 1, false) : findFrom(current + 1, 1, true);\n case 'prev':\n return current < 0 ? findFrom(count - 1, -1, false) : findFrom(current - 1, -1, true);\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\n/** A parsed keyboard shortcut such as `mod+k` or `ctrl+shift+p`. */\nexport interface ParsedShortcut {\n readonly key: string;\n readonly mod: boolean;\n readonly ctrl: boolean;\n readonly meta: boolean;\n readonly alt: boolean;\n readonly shift: boolean;\n}\n\nconst MODIFIERS: Record<string, keyof Omit<ParsedShortcut, 'key'>> = {\n mod: 'mod',\n ctrl: 'ctrl',\n control: 'ctrl',\n meta: 'meta',\n cmd: 'meta',\n command: 'meta',\n alt: 'alt',\n option: 'alt',\n shift: 'shift',\n};\n\nconst KEY_ALIASES: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n slash: '/',\n plus: '+',\n};\n\n/**\n * Parses a shortcut string. Parts are separated by `+`; `mod` means ⌘ on Apple\n * platforms and Ctrl elsewhere. Examples: `mod+k`, `ctrl+shift+p`, `/`.\n */\nexport function parseShortcut(shortcut: string): ParsedShortcut {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map((p) => p.trim())\n .filter(Boolean);\n if (shortcut.trim().endsWith('++') || shortcut.trim() === '+') parts.push('+');\n const result = { key: '', mod: false, ctrl: false, meta: false, alt: false, shift: false };\n for (const part of parts) {\n const modifier = MODIFIERS[part];\n if (modifier) result[modifier] = true;\n else result.key = KEY_ALIASES[part] ?? part;\n }\n if (!result.key) throw new Error(`ngx-command-palette: invalid shortcut \"${shortcut}\"`);\n return result;\n}\n\n/** True on macOS / iOS, where `mod` maps to the ⌘ key. */\nexport function isApplePlatform(nav: Navigator | undefined = globalThis.navigator): boolean {\n if (!nav) return false;\n const platform =\n (nav as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform ??\n nav.platform ??\n '';\n return /mac|iphone|ipad|ipod/i.test(platform);\n}\n\ntype KeyEventLike = Pick<\n KeyboardEvent,\n 'key' | 'code' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey'\n>;\n\n/** True when `event` matches `shortcut`. Letters also match by physical key (non-Latin layouts). */\nexport function matchesShortcut(\n event: KeyEventLike,\n shortcut: ParsedShortcut,\n apple: boolean,\n): boolean {\n const wantCtrl = shortcut.ctrl || (shortcut.mod && !apple);\n const wantMeta = shortcut.meta || (shortcut.mod && apple);\n if (event.ctrlKey !== wantCtrl || event.metaKey !== wantMeta || event.altKey !== shortcut.alt) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n // Shift matters only when requested or for letters (\"?\" needs Shift, but nobody writes it)\n const isLetter = /^[a-z]$/.test(shortcut.key);\n if ((shortcut.shift || isLetter) && event.shiftKey !== shortcut.shift) return false;\n if (key === shortcut.key) return true;\n // With Alt or non-Latin layouts event.key changes: fall back to the physical key\n if (isLetter && event.code === `Key${shortcut.key.toUpperCase()}`) return true;\n if (/^[0-9]$/.test(shortcut.key) && event.code === `Digit${shortcut.key}`) return true;\n return false;\n}\n\n/** Human readable label, e.g. `⌘K` on macOS and `Ctrl+K` elsewhere. */\nexport function formatShortcut(shortcut: ParsedShortcut, apple: boolean): string {\n const key =\n shortcut.key === ' '\n ? 'Space'\n : shortcut.key.length === 1\n ? shortcut.key.toUpperCase()\n : capitalize(shortcut.key);\n if (apple) {\n return (\n (shortcut.ctrl ? '⌃' : '') +\n (shortcut.alt ? '⌥' : '') +\n (shortcut.shift ? '⇧' : '') +\n (shortcut.meta || shortcut.mod ? '⌘' : '') +\n key\n );\n }\n const parts: string[] = [];\n if (shortcut.ctrl || shortcut.mod) parts.push('Ctrl');\n if (shortcut.meta) parts.push('Win');\n if (shortcut.alt) parts.push('Alt');\n if (shortcut.shift) parts.push('Shift');\n parts.push(key);\n return parts.join('+');\n}\n\nfunction capitalize(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { Directive, TemplateRef, inject } from '@angular/core';\n\nimport type { Command, CommandResult, HighlightSegment } from './command.model';\n\nexport interface CommandItemContext {\n /** The command. */\n readonly $implicit: Command;\n readonly result: CommandResult;\n /** Label split into matched / unmatched parts. */\n readonly segments: readonly HighlightSegment[];\n /** True for the row selected with the keyboard or the mouse. */\n readonly active: boolean;\n readonly query: string;\n}\n\nexport interface CommandEmptyContext {\n /** The search text. */\n readonly $implicit: string;\n}\n\n/**\n * Custom template for each row:\n * `<ng-template rrCommandItem let-command let-segments=\"segments\">…</ng-template>`\n */\n@Directive({ selector: 'ng-template[rrCommandItem]' })\nexport class CommandItemTemplate {\n readonly template = inject<TemplateRef<CommandItemContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandItemTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandItemContext {\n return true;\n }\n}\n\n/** Custom empty state: `<ng-template rrCommandEmpty let-query>…</ng-template>` */\n@Directive({ selector: 'ng-template[rrCommandEmpty]' })\nexport class CommandEmptyTemplate {\n readonly template = inject<TemplateRef<CommandEmptyContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandEmptyTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandEmptyContext {\n return true;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n DestroyRef,\n ElementRef,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n computed,\n contentChild,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport type { CommandResult } from './command.model';\nimport { CommandPaletteService } from './command-palette.service';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteTheme } from './config';\nimport { keyToAction, moveIndex } from './list-navigation';\nimport { formatShortcut, isApplePlatform, matchesShortcut, parseShortcut } from './shortcut';\nimport { CommandEmptyTemplate, CommandItemTemplate } from './templates.directive';\n\nlet nextId = 0;\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * The command palette dialog. Place it once, usually in the root component template.\n * It listens to the global shortcut and renders nothing while closed.\n */\n@Component({\n selector: 'rr-command-palette',\n imports: [NgTemplateOutlet],\n templateUrl: './command-palette.component.html',\n styleUrl: './command-palette.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'rr-cp-host',\n '(document:keydown)': 'onDocumentKeydown($event)',\n '(document:focusin)': 'onDocumentFocusin($event)',\n },\n})\nexport class CommandPaletteComponent {\n protected readonly service = inject(CommandPaletteService);\n protected readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly document = inject(DOCUMENT);\n\n /** Overrides the `theme` of `provideCommandPalette()`, e.g. to follow your app's theme toggle. */\n readonly theme = input<CommandPaletteTheme | undefined>(undefined);\n\n protected readonly itemTemplate = contentChild(CommandItemTemplate);\n protected readonly emptyTemplate = contentChild(CommandEmptyTemplate);\n private readonly input = viewChild<ElementRef<HTMLInputElement>>('input');\n private readonly dialog = viewChild<ElementRef<HTMLElement>>('dialog');\n\n protected readonly uid = `rr-cp-${nextId++}`;\n protected readonly labels = this.config.labels;\n private readonly apple = isApplePlatform();\n private readonly shortcuts = (typeof this.config.shortcut === 'string'\n ? [this.config.shortcut]\n : this.config.shortcut\n ).map(parseShortcut);\n /** Label of the first shortcut, e.g. `⌘K` or `Ctrl+K`, for a \"search\" button in your UI. */\n readonly shortcutLabel = this.shortcuts.length\n ? formatShortcut(this.shortcuts[0], this.apple)\n : '';\n\n private readonly prefersDark = signal(false);\n protected readonly resolvedTheme = computed(() => {\n const theme = this.theme() ?? this.config.theme;\n return theme === 'auto' ? (this.prefersDark() ? 'dark' : 'light') : theme;\n });\n\n /** Sections with the flat index of each row (used for ids and keyboard navigation). */\n protected readonly view = computed(() => {\n let index = 0;\n return this.service.sections().map((section, sectionIndex) => ({\n section,\n headingId: `${this.uid}-group-${sectionIndex}`,\n rows: section.items.map((item) => ({ item, index: index++ })),\n }));\n });\n protected readonly items = computed<readonly CommandResult[]>(() =>\n this.service.sections().flatMap((s) => s.items),\n );\n private readonly activeKey = signal<string | null>(null);\n protected readonly activeIndex = computed(() => {\n const items = this.items();\n const key = this.activeKey();\n const found = key === null ? -1 : items.findIndex((i) => i.key === key);\n if (found >= 0 && !items[found].command.disabled) return found;\n return moveIndex(\n items.map((i) => !!i.command.disabled),\n -1,\n 'first',\n );\n });\n protected readonly activeDescendant = computed(() => {\n const index = this.activeIndex();\n return index >= 0 ? this.optionId(index) : null;\n });\n protected readonly status = computed(() => {\n if (this.service.loading()) return this.labels.loading;\n const count = this.items().length;\n return count === 0 ? this.labels.empty : this.labels.results.replace('{count}', String(count));\n });\n\n constructor() {\n const view = this.document.defaultView;\n const media = view?.matchMedia?.('(prefers-color-scheme: dark)');\n if (media) {\n this.prefersDark.set(media.matches);\n const listener = (e: MediaQueryListEvent) => this.prefersDark.set(e.matches);\n media.addEventListener?.('change', listener);\n inject(DestroyRef).onDestroy(() => media.removeEventListener?.('change', listener));\n }\n\n // Focus the search field as soon as the dialog appears\n afterRenderEffect(() => {\n const input = this.input()?.nativeElement;\n if (input && this.document.activeElement !== input) input.focus({ preventScroll: true });\n });\n // Keep the active row visible during keyboard navigation\n afterRenderEffect(() => {\n const id = this.activeDescendant();\n if (!id) return;\n const option = this.document.getElementById(id);\n option?.scrollIntoView?.({ block: 'nearest' });\n });\n }\n\n protected optionId(index: number): string {\n return `${this.uid}-option-${index}`;\n }\n\n protected isTemplate(icon: unknown): icon is TemplateRef<unknown> {\n return icon instanceof TemplateRef;\n }\n\n protected onInput(event: Event): void {\n this.activeKey.set(null);\n this.service.setQuery((event.target as HTMLInputElement).value);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Tab') {\n this.trapTab(event);\n return;\n }\n const action = keyToAction(event);\n if (!action) return;\n event.preventDefault();\n event.stopPropagation();\n const items = this.items();\n switch (action) {\n case 'close':\n this.service.close();\n return;\n case 'select': {\n const item = items[this.activeIndex()];\n if (item) void this.service.execute(item.command);\n return;\n }\n default: {\n const next = moveIndex(\n items.map((i) => !!i.command.disabled),\n this.activeIndex(),\n action,\n );\n if (next >= 0) this.activeKey.set(items[next].key);\n }\n }\n }\n\n protected onPointerMove(item: CommandResult): void {\n if (!item.command.disabled && this.activeKey() !== item.key) this.activeKey.set(item.key);\n }\n\n protected onSelect(item: CommandResult): void {\n void this.service.execute(item.command);\n }\n\n protected onOverlayDown(event: MouseEvent): void {\n // Only a click on the backdrop, not inside the dialog\n if (event.target === event.currentTarget) this.service.close();\n }\n\n protected onDocumentKeydown(event: KeyboardEvent): void {\n if (event.repeat || event.isComposing) return;\n // Shortcuts without Ctrl/⌘/Alt (e.g. \"/\") do not fire while typing in a field\n const typing = isEditable(event.target);\n const hit = this.shortcuts.some(\n (s) =>\n (!typing || s.mod || s.ctrl || s.meta || s.alt) && matchesShortcut(event, s, this.apple),\n );\n if (hit) {\n event.preventDefault();\n this.activeKey.set(null);\n this.service.toggle();\n }\n }\n\n protected onDocumentFocusin(event: FocusEvent): void {\n if (!this.service.isOpen()) return;\n const dialog = this.dialog()?.nativeElement;\n // Focus trap: if focus leaves the dialog (e.g. an iframe click or a scripted focus) it returns to the input\n if (dialog && event.target instanceof Node && !dialog.contains(event.target)) {\n this.input()?.nativeElement.focus({ preventScroll: true });\n }\n }\n\n private trapTab(event: KeyboardEvent): void {\n const dialog = this.dialog()?.nativeElement;\n if (!dialog) return;\n const focusable = Array.from(dialog.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length <= 1) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = this.document.activeElement;\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n }\n}\n\nfunction isEditable(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el || typeof el.tagName !== 'string') return false;\n const tag = el.tagName.toLowerCase();\n return tag === 'input' || tag === 'textarea' || tag === 'select' || el.isContentEditable;\n}\n","@if (service.isOpen()) {\n <div class=\"rr-cp\" [attr.data-theme]=\"resolvedTheme()\" (mousedown)=\"onOverlayDown($event)\">\n <div\n #dialog\n class=\"rr-cp-dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"labels.dialog\"\n (keydown)=\"onKeydown($event)\"\n >\n <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n {{ labels.empty }}\n }\n </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version":3,"file":"rrstudioapps-ngx-command-palette.mjs","names":[],"sources":["../../../projects/ngx-command-palette/src/lib/fuzzy.ts","../../../projects/ngx-command-palette/src/lib/config.ts","../../../projects/ngx-command-palette/src/lib/recent-store.ts","../../../projects/ngx-command-palette/src/lib/command-palette.service.ts","../../../projects/ngx-command-palette/src/lib/list-navigation.ts","../../../projects/ngx-command-palette/src/lib/shortcut.ts","../../../projects/ngx-command-palette/src/lib/templates.directive.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.html"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command, HighlightSegment } from './command.model';\n\nexport interface FuzzyMatch {\n /** Higher is better. Only meaningful to compare matches of the same query. */\n readonly score: number;\n /** Indices of `text` matched by the query, ascending. */\n readonly indices: readonly number[];\n}\n\n// Scoring weights: consecutive letters and word starts are worth more, gaps cost.\nconst SCORE_CHAR = 1;\nconst BONUS_CONSECUTIVE = 5;\nconst BONUS_WORD_START = 8;\nconst BONUS_STRING_START = 4;\nconst PENALTY_GAP = 1;\nconst PENALTY_LEADING = 0.2;\nconst SEPARATORS = new Set([' ', '-', '_', '.', '/', ':', '(', '[', ',']);\n\n/** Lowercase and without accents, one character in → one character out (keeps indices aligned). */\nfunction fold(char: string): string {\n const base = char.normalize('NFD').replace(/\\p{M}/gu, '');\n return (base[0] ?? char).toLowerCase();\n}\n\n/**\n * Folds a whole string. ASCII (the common case) has no accents, so the native `toLowerCase`\n * does the job and keeps the length; anything else is folded character by character.\n */\nfunction foldText(text: string): string {\n // eslint-disable-next-line no-control-regex -- the range is the ASCII block on purpose\n if (/^[\\x00-\\x7f]*$/.test(text)) return text.toLowerCase();\n let out = '';\n // eslint-disable-next-line @typescript-eslint/prefer-for-of -- for-of iterates code points and would shift the indices\n for (let i = 0; i < text.length; i++) out += fold(text[i]);\n return out;\n}\n\n/** The query without spaces, folded. Do it once per search, not once per command. */\nfunction foldQuery(query: string): string {\n return foldText(query.replace(/\\s+/g, ''));\n}\n\nfunction isWordStart(text: string, i: number): boolean {\n if (i === 0) return true;\n const prev = text[i - 1];\n if (SEPARATORS.has(prev)) return true;\n // camelCase: lowercase followed by uppercase\n const cur = text[i];\n return prev === prev.toLowerCase() && cur !== cur.toLowerCase() && cur === cur.toUpperCase();\n}\n\n/**\n * Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in\n * `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.\n */\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch | null {\n return matchFolded(foldQuery(query), text);\n}\n\n// Scoring tables, reused between calls: matching runs once per command on every keystroke,\n// and allocating them each time dominated the cost with thousands of commands.\nlet tableM = new Float64Array(512);\nlet tableD = new Float64Array(512);\nlet tableC = new Uint8Array(512);\nlet tableK = new Int32Array(512);\nlet tableB = new Float64Array(128);\n\nfunction ensureTables(size: number, width: number): void {\n if (tableM.length < size) {\n const length = Math.max(size, tableM.length * 2);\n tableM = new Float64Array(length);\n tableD = new Float64Array(length);\n tableC = new Uint8Array(length);\n tableK = new Int32Array(length);\n }\n if (tableB.length < width) tableB = new Float64Array(Math.max(width, tableB.length * 2));\n}\n\n/** `fuzzyMatch` for a query that is already folded (see `foldQuery`). */\nfunction matchFolded(q: string, text: string): FuzzyMatch | null {\n if (q.length === 0) return { score: 0, indices: [] };\n // Work on UTF-16 units so indices stay those of `text`.\n const t = foldText(text);\n const m = q.length;\n const n = t.length;\n if (m > n) return null;\n // Cheap exit before the scoring tables: most commands do not contain the letters in order\n for (let i = 0, from = 0; i < m; i++) {\n from = t.indexOf(q[i], from) + 1;\n if (from === 0) return null;\n }\n\n const NEG = -Infinity;\n const size = m * n;\n ensureTables(size, n);\n // Row i starts at i * n. M: best score with q[i] matched to t[j].\n // D: best score with q[0..i] matched within t[0..j] (minus a penalty for characters skipped after).\n const M = tableM;\n const D = tableD;\n // For the traceback: where each M comes from (consecutive or jump) and which k gives each D\n const consec = tableC;\n const Dk = tableK;\n M.fill(NEG, 0, size);\n D.fill(NEG, 0, size);\n consec.fill(0, 0, size);\n Dk.fill(-1, 0, size);\n // Computed when a letter matches (always positive, so -1 means \"not yet\")\n const bonus = tableB;\n bonus.fill(-1, 0, n);\n const bonusAt = (j: number): number =>\n bonus[j] >= 0\n ? bonus[j]\n : (bonus[j] =\n SCORE_CHAR +\n (isWordStart(text, j) ? BONUS_WORD_START : 0) +\n (j === 0 ? BONUS_STRING_START : 0));\n\n for (let i = 0; i < m; i++) {\n const row = i * n;\n const prev = row - n;\n for (let j = i; j < n; j++) {\n const at = row + j;\n if (t[j] === q[i]) {\n if (i === 0) {\n M[at] = bonusAt(j) - PENALTY_LEADING * j;\n } else if (j > 0) {\n const consecutive = M[prev + j - 1] + BONUS_CONSECUTIVE;\n const jump = D[prev + j - 1];\n if (consecutive >= jump && consecutive > NEG) {\n M[at] = consecutive + bonusAt(j);\n consec[at] = 1;\n } else if (jump > NEG) {\n M[at] = jump + bonusAt(j);\n }\n }\n }\n const carried = j > 0 ? D[at - 1] - PENALTY_GAP : NEG;\n if (M[at] > NEG && M[at] >= carried) {\n D[at] = M[at];\n Dk[at] = j;\n } else if (j > 0) {\n D[at] = carried;\n Dk[at] = Dk[at - 1];\n }\n }\n }\n\n // End of the alignment: the best M on the last row\n let end = -1;\n let best = NEG;\n const last = (m - 1) * n;\n for (let j = m - 1; j < n; j++) {\n if (M[last + j] > best) {\n best = M[last + j];\n end = j;\n }\n }\n if (end < 0) return null;\n\n // Rebuild the indices backwards\n const indices = new Array<number>(m);\n let j = end;\n for (let i = m - 1; i >= 0; i--) {\n indices[i] = j;\n if (i === 0) break;\n j = consec[i * n + j] ? j - 1 : Dk[(i - 1) * n + j - 1];\n }\n\n // Small bonus for short strings: with equal matches the text closest to the query wins\n const score = best - (n - m) * 0.01;\n return { score, indices };\n}\n\n/** Splits `text` into matched / unmatched segments for highlighting. */\nexport function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[] {\n if (indices.length === 0) return text ? [{ text, match: false }] : [];\n const set = new Set(indices);\n const out: HighlightSegment[] = [];\n let buf = '';\n let bufMatch = set.has(0);\n for (let i = 0; i < text.length; i++) {\n const match = set.has(i);\n if (match !== bufMatch && buf) {\n out.push({ text: buf, match: bufMatch });\n buf = '';\n }\n bufMatch = match;\n buf += text[i];\n }\n if (buf) out.push({ text: buf, match: bufMatch });\n return out;\n}\n\n// Field weights: label first, then keywords, then description.\nconst WEIGHT_KEYWORD = 0.8;\nconst WEIGHT_DESCRIPTION = 0.5;\n/**\n * Minimum quality (average points per character) for keywords and description: long texts\n * contain almost any scattered letter sequence, so there we require word starts or close letters.\n */\nconst MIN_SECONDARY_QUALITY = 4;\n\nfunction strongEnough(match: FuzzyMatch | null, length: number): match is FuzzyMatch {\n return !!match && length > 0 && match.score / length >= MIN_SECONDARY_QUALITY;\n}\n\n/**\n * Matches a command against the query using label, keywords and description.\n * `indices` refer to the label (empty when only keywords/description matched).\n */\nexport function matchCommand(query: string, command: Command): FuzzyMatch | null {\n const q = foldQuery(query);\n const label = matchFolded(q, command.label);\n let best: FuzzyMatch | null = label;\n for (const keyword of command.keywords ?? []) {\n const m = matchFolded(q, keyword);\n if (strongEnough(m, q.length) && (!best || m.score * WEIGHT_KEYWORD > best.score)) {\n best = { score: m.score * WEIGHT_KEYWORD, indices: label?.indices ?? [] };\n }\n }\n if (command.description) {\n const m = matchFolded(q, command.description);\n if (strongEnough(m, q.length) && (!best || m.score * WEIGHT_DESCRIPTION > best.score)) {\n best = { score: m.score * WEIGHT_DESCRIPTION, indices: label?.indices ?? [] };\n }\n }\n return best;\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nimport type { Command } from './command.model';\nimport { matchCommand, type FuzzyMatch } from './fuzzy';\n\nexport type CommandPaletteTheme = 'light' | 'dark' | 'auto';\n\n/** Texts of the palette, for translations. */\nexport interface CommandPaletteLabels {\n readonly placeholder: string;\n readonly dialog: string;\n readonly listbox: string;\n readonly empty: string;\n readonly loading: string;\n readonly recent: string;\n readonly defaultGroup: string;\n /** Screen reader announcement, `{count}` is replaced by the number of results. */\n readonly results: string;\n readonly closeHint: string;\n /** Label of the button that goes back one level of a sub-palette. */\n readonly back: string;\n /** Screen reader announcement when a sub-palette is opened; `{name}` and `{count}` are replaced. */\n readonly level: string;\n /** Screen reader hint added to a command that opens a sub-palette. */\n readonly submenu: string;\n}\n\n/**\n * Decides whether `command` matches the search text and how well. Return `null` to hide the\n * command. A higher `score` ranks first; `indices` are the label characters to highlight.\n */\nexport type CommandFilter = (query: string, command: Command) => FuzzyMatch | null;\n\nexport interface CommandPaletteRecentOptions {\n /** Max number of recents shown. Default: 5. */\n readonly max?: number;\n /** localStorage key. Default: `rr-cp:recent`. */\n readonly storageKey?: string;\n}\n\nexport interface CommandPaletteConfig {\n /** Shortcut(s) that toggle the palette. Default: `mod+k` (⌘K on macOS, Ctrl+K elsewhere). */\n readonly shortcut: string | readonly string[];\n /** `auto` follows `prefers-color-scheme`. Default: `auto`. */\n readonly theme: CommandPaletteTheme;\n /** \"Recent\" section shown with an empty query; `false` disables it. */\n readonly recent: CommandPaletteRecentOptions | false;\n /** Debounce for async providers, in ms. Default: 200. */\n readonly debounceMs: number;\n /** Max results of local commands for a non-empty query. Default: 50. */\n readonly maxResults: number;\n /**\n * Max commands listed when the search is empty (the \"Recent\" section is not counted). The rest is\n * still found by searching. Default: 100. Drawing every row slows down the opening when there are\n * thousands of commands; use `Infinity` to list them all.\n */\n readonly maxEmptyResults: number;\n /** Matching and ranking of local commands for a non-empty query. Default: the built-in fuzzy search. */\n readonly filter: CommandFilter;\n readonly labels: CommandPaletteLabels;\n}\n\nexport type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {\n readonly labels?: Partial<CommandPaletteLabels>;\n};\n\nexport const DEFAULT_COMMAND_PALETTE_LABELS: CommandPaletteLabels = {\n placeholder: 'Type a command or search…',\n dialog: 'Command palette',\n listbox: 'Commands',\n empty: 'No results found.',\n loading: 'Loading…',\n recent: 'Recent',\n defaultGroup: 'Commands',\n results: '{count} results',\n closeHint: 'Esc',\n back: 'Back',\n level: '{name}: {count} results',\n submenu: 'opens a sub-palette',\n};\n\nexport const DEFAULT_COMMAND_PALETTE_CONFIG: CommandPaletteConfig = {\n shortcut: 'mod+k',\n theme: 'auto',\n recent: { max: 5, storageKey: 'rr-cp:recent' },\n debounceMs: 200,\n maxResults: 50,\n maxEmptyResults: 100,\n filter: matchCommand,\n labels: DEFAULT_COMMAND_PALETTE_LABELS,\n};\n\nexport const COMMAND_PALETTE_CONFIG = new InjectionToken<CommandPaletteConfig>(\n 'COMMAND_PALETTE_CONFIG',\n {\n providedIn: 'root',\n factory: () => DEFAULT_COMMAND_PALETTE_CONFIG,\n },\n);\n\n/** Merges options with the defaults. */\nexport function resolveConfig(options: CommandPaletteOptions = {}): CommandPaletteConfig {\n return {\n ...DEFAULT_COMMAND_PALETTE_CONFIG,\n ...options,\n recent:\n options.recent === false\n ? false\n : {\n ...(DEFAULT_COMMAND_PALETTE_CONFIG.recent as CommandPaletteRecentOptions),\n ...options.recent,\n },\n labels: { ...DEFAULT_COMMAND_PALETTE_LABELS, ...options.labels },\n };\n}\n\n/** Configures the command palette. Optional: without it the defaults are used. */\nexport function provideCommandPalette(options: CommandPaletteOptions = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: COMMAND_PALETTE_CONFIG, useValue: resolveConfig(options) },\n ]);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command } from './command.model';\n\n/** What is saved for a recent command: only serializable fields, never functions. */\nexport interface RecentEntry {\n readonly id: string;\n readonly label: string;\n readonly group?: string;\n readonly description?: string;\n readonly route?: string | readonly unknown[];\n}\n\n/**\n * Recent commands in `localStorage` (most recent first). Every access is guarded:\n * private windows, SSR or blocked storage just mean \"no recents\".\n */\nexport class RecentStore {\n constructor(\n private readonly storageKey: string,\n private readonly max: number,\n private readonly storage: Pick<\n Storage,\n 'getItem' | 'setItem' | 'removeItem'\n > | null = defaultStorage(),\n ) {}\n\n load(): RecentEntry[] {\n if (!this.storage || this.max <= 0) return [];\n try {\n const raw = this.storage.getItem(this.storageKey);\n if (!raw) return [];\n const parsed: unknown = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n return parsed.filter(isEntry).slice(0, this.max);\n } catch {\n return [];\n }\n }\n\n /** Moves `command` to the top and returns the new list. */\n add(command: Command, current: readonly RecentEntry[] = this.load()): RecentEntry[] {\n if (this.max <= 0) return [];\n const entry: RecentEntry = {\n id: command.id,\n label: command.label,\n ...(command.group ? { group: command.group } : {}),\n ...(command.description ? { description: command.description } : {}),\n ...(command.route !== undefined && isSerializable(command.route)\n ? { route: command.route }\n : {}),\n };\n const next = [entry, ...current.filter((e) => e.id !== command.id)].slice(0, this.max);\n this.save(next);\n return next;\n }\n\n clear(): void {\n try {\n this.storage?.removeItem(this.storageKey);\n } catch {\n /* storage not available */\n }\n }\n\n private save(entries: readonly RecentEntry[]): void {\n try {\n this.storage?.setItem(this.storageKey, JSON.stringify(entries));\n } catch {\n /* quota exceeded or storage blocked: recents stay in memory only */\n }\n }\n}\n\nfunction defaultStorage(): Storage | null {\n try {\n return typeof localStorage === 'undefined' ? null : localStorage;\n } catch {\n return null;\n }\n}\n\nfunction isEntry(value: unknown): value is RecentEntry {\n if (!value || typeof value !== 'object') return false;\n const v = value as Record<string, unknown>;\n return typeof v['id'] === 'string' && typeof v['label'] === 'string';\n}\n\nfunction isSerializable(route: unknown): boolean {\n try {\n JSON.stringify(route);\n return typeof route === 'string' || Array.isArray(route);\n } catch {\n return false;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport {\n DestroyRef,\n DOCUMENT,\n Injectable,\n Signal,\n assertInInjectionContext,\n computed,\n inject,\n isSignal,\n signal,\n} from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport type {\n Command,\n CommandProvider,\n CommandResult,\n CommandSection,\n CommandSubscribable,\n ParentCommand,\n} from './command.model';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteRecentOptions } from './config';\nimport { fuzzyMatch, highlightSegments } from './fuzzy';\nimport { RecentStore, type RecentEntry } from './recent-store';\n\ninterface Registration {\n readonly source: () => readonly Command[];\n}\n\ninterface ProviderState {\n readonly items: readonly Command[];\n readonly loading: boolean;\n readonly error?: unknown;\n}\n\n/** In-flight provider request: debounce timer, abort controller and subscription. */\ninterface PendingRequest {\n timer?: ReturnType<typeof setTimeout>;\n controller?: AbortController;\n subscription?: { unsubscribe(): void };\n}\n\nexport const RECENT_SECTION_ID = 'recent';\n\n/**\n * State of the command palette. Register commands from any component: they are removed\n * automatically when that component is destroyed.\n */\n@Injectable({ providedIn: 'root' })\nexport class CommandPaletteService {\n private readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly router = inject(Router, { optional: true });\n private readonly document = inject(DOCUMENT);\n\n private readonly recentStore = this.config.recent\n ? new RecentStore(\n (this.config.recent as CommandPaletteRecentOptions).storageKey ?? 'rr-cp:recent',\n (this.config.recent as CommandPaletteRecentOptions).max ?? 5,\n )\n : null;\n\n private readonly _isOpen = signal(false);\n private readonly _query = signal('');\n private readonly registrations = signal<readonly Registration[]>([]);\n private readonly providers = signal<readonly CommandProvider[]>([]);\n private readonly providerState = signal<ReadonlyMap<string, ProviderState>>(new Map());\n private readonly recents = signal<readonly RecentEntry[]>(this.recentStore?.load() ?? []);\n private readonly pending = new Map<string, PendingRequest>();\n private readonly pathIds = signal<readonly string[]>([]);\n private returnFocus: HTMLElement | null = null;\n\n /** Whether the palette is open. */\n readonly isOpen = this._isOpen.asReadonly();\n /** Current search text. */\n readonly query = this._query.asReadonly();\n\n /**\n * Sub-palettes currently open, outermost first (empty at the top level). It follows the registered\n * commands: if a parent is removed or replaced while open, the path shrinks to what still exists.\n */\n readonly path: Signal<readonly ParentCommand[]> = computed(() => {\n const path: ParentCommand[] = [];\n let level: readonly Command[] = this.commands();\n for (const id of this.pathIds()) {\n const parent = level.find((c): c is ParentCommand => c.id === id && isParent(c));\n if (!parent) break;\n path.push(parent);\n level = parent.children;\n }\n return path;\n });\n\n /** The commands of the level being shown: the top level or the children of the last parent. */\n private readonly levelCommands: Signal<readonly Command[]> = computed(() => {\n const path = this.path();\n return path.length ? path[path.length - 1].children : this.commands();\n });\n\n /** All registered (synchronous) commands. When two share an id, the last registered wins. */\n readonly commands: Signal<readonly Command[]> = computed(() => {\n const byId = new Map<string, Command>();\n for (const registration of this.registrations()) {\n for (const command of registration.source()) {\n byId.delete(command.id);\n byId.set(command.id, command);\n }\n }\n return [...byId.values()];\n });\n\n /** True while at least one async provider is waiting for results. */\n readonly loading = computed(() => [...this.providerState().values()].some((s) => s.loading));\n\n /** Sections shown in the list, already filtered and sorted. */\n readonly sections: Signal<readonly CommandSection[]> = computed(() =>\n this.buildSections(this._query().trim()),\n );\n\n /** Opens the palette, optionally with an initial query. */\n open(query = ''): void {\n if (!this._isOpen()) {\n const active = this.document.activeElement;\n // No instanceof HTMLElement: the class does not exist during SSR\n this.returnFocus =\n active &&\n active !== this.document.body &&\n typeof (active as HTMLElement).focus === 'function'\n ? (active as HTMLElement)\n : null;\n }\n this._isOpen.set(true);\n this.pathIds.set([]);\n this.setQuery(query);\n }\n\n /** Closes the palette, cancels pending searches and restores the focus. */\n close(): void {\n if (!this._isOpen()) return;\n this._isOpen.set(false);\n this.cancelAll();\n this._query.set('');\n this.pathIds.set([]);\n this.providerState.set(new Map());\n const target = this.returnFocus;\n this.returnFocus = null;\n if (target?.isConnected) target.focus({ preventScroll: true });\n }\n\n toggle(): void {\n if (this._isOpen()) this.close();\n else this.open();\n }\n\n /** Updates the search text and schedules the async providers. */\n setQuery(query: string): void {\n this._query.set(query);\n if (this._isOpen()) this.scheduleProviders();\n }\n\n /**\n * Goes back `levels` levels of a sub-palette (one by default) and clears the search.\n * Returns `false`, doing nothing, when the top level is already shown.\n */\n back(levels = 1): boolean {\n const path = this.path();\n if (!path.length || levels < 1) return false;\n this.pathIds.set(path.slice(0, Math.max(0, path.length - levels)).map((c) => c.id));\n this.setQuery('');\n return true;\n }\n\n /**\n * Registers commands (an array or a signal of arrays). Called in an injection context\n * (constructor, field initializer) they are removed when that context is destroyed.\n * Returns a function that removes them earlier.\n */\n register(\n commands: readonly Command[] | Signal<readonly Command[]>,\n destroyRef?: DestroyRef,\n ): () => void {\n const registration: Registration = { source: isSignal(commands) ? commands : () => commands };\n this.registrations.update((list) => [...list, registration]);\n const remove = () =>\n this.registrations.update((list) => list.filter((r) => r !== registration));\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Registers an async provider. Same lifetime rules as {@link register}. */\n registerProvider(provider: CommandProvider, destroyRef?: DestroyRef): () => void {\n this.providers.update((list) => [...list.filter((p) => p.id !== provider.id), provider]);\n if (this._isOpen() && !this.pathIds().length) this.scheduleProvider(provider, this._query());\n const remove = () => {\n if (!this.providers().includes(provider)) return;\n this.cancel(provider.id);\n this.providers.update((list) => list.filter((p) => p !== provider));\n this.providerState.update((map) => {\n const next = new Map(map);\n next.delete(provider.id);\n return next;\n });\n };\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Executes a command: saves it in the recents, closes the palette, then navigates or runs it. */\n async execute(command: Command): Promise<void> {\n if (command.disabled) return;\n if (isParent(command)) {\n if (!this.levelCommands().some((c) => c.id === command.id)) {\n throw new Error('ngx-command-palette: only registered commands can have children');\n }\n // Providers search the top level only: drop their requests and results while inside a sub-palette\n this.cancelAll();\n this.providerState.set(new Map());\n this.pathIds.update((ids) => [...ids, command.id]);\n this.setQuery('');\n return;\n }\n const query = this._query();\n if (this.recentStore) this.recents.set(this.recentStore.add(command, this.recents()));\n this.close();\n if (command.route !== undefined) {\n if (!this.router) throw new Error('ngx-command-palette: route commands need provideRouter()');\n const { route, navigationExtras } = command;\n await (typeof route === 'string'\n ? this.router.navigateByUrl(route, navigationExtras)\n : this.router.navigate(route as unknown[], navigationExtras));\n } else {\n await command.run({ query });\n }\n }\n\n /** Removes all recents. */\n clearRecent(): void {\n this.recentStore?.clear();\n this.recents.set([]);\n }\n\n // ---- internals ----\n\n private bindToDestroy(remove: () => void, destroyRef?: DestroyRef): () => void {\n const ref = destroyRef ?? currentDestroyRef();\n const unsubscribe = ref?.onDestroy(remove);\n return () => {\n unsubscribe?.();\n remove();\n };\n }\n\n private buildSections(query: string): CommandSection[] {\n const defaultGroup = this.config.labels.defaultGroup;\n const commands = this.levelCommands();\n const groups = new Map<string, CommandResult[]>();\n const push = (group: string, result: CommandResult) => {\n const list = groups.get(group);\n if (list) list.push(result);\n else groups.set(group, [result]);\n };\n const sections: CommandSection[] = [];\n\n const topLevel = !this.pathIds().length;\n if (!query) {\n const recent = topLevel ? this.recentResults(commands) : [];\n if (recent.length)\n sections.push({ id: RECENT_SECTION_ID, label: this.config.labels.recent, items: recent });\n let listed = 0;\n for (const command of commands) {\n if (isHidden(command)) continue;\n if (listed++ >= this.config.maxEmptyResults) break;\n const group = command.group ?? defaultGroup;\n push(group, toResult(command, `g:${group}:${command.id}`, 0, []));\n }\n } else {\n const scored: CommandResult[] = [];\n for (const command of commands) {\n if (isHidden(command)) continue;\n const match = this.config.filter(query, command);\n if (!match) continue;\n const group = command.group ?? defaultGroup;\n scored.push(toResult(command, `g:${group}:${command.id}`, match.score, match.indices));\n }\n // Stable sort: equal scores keep the registration order\n scored.sort((a, b) => b.score - a.score);\n for (const result of scored.slice(0, this.config.maxResults)) {\n push(result.command.group ?? defaultGroup, result);\n }\n }\n for (const [label, items] of groups) sections.push({ id: `g:${label}`, label, items });\n\n // Async results: server order, highlighted when the label matches\n const states = this.providerState();\n for (const provider of topLevel ? this.providers() : []) {\n const state = states.get(provider.id);\n if (!state?.items.length) continue;\n const items = state.items\n .filter((command) => !isHidden(command))\n .map((command) => {\n const match = query ? fuzzyMatch(query, command.label) : null;\n return toResult(\n command,\n `p:${provider.id}:${command.id}`,\n match?.score ?? 0,\n match?.indices ?? [],\n );\n });\n if (items.length) sections.push({ id: `p:${provider.id}`, label: provider.group, items });\n }\n return sections;\n }\n\n private recentResults(commands: readonly Command[]): CommandResult[] {\n if (!this.recentStore) return [];\n const byId = new Map(descendants(commands).map((c) => [c.id, c]));\n const results: CommandResult[] = [];\n for (const entry of this.recents()) {\n // Still registered, or rebuilt from the saved route (e.g. a customer from an API)\n const command: Command | undefined =\n byId.get(entry.id) ??\n (entry.route !== undefined\n ? {\n id: entry.id,\n label: entry.label,\n route: entry.route,\n ...(entry.group ? { group: entry.group } : {}),\n ...(entry.description ? { description: entry.description } : {}),\n }\n : undefined);\n if (command && !command.disabled && !isHidden(command)) {\n results.push(toResult(command, `r:${entry.id}`, 0, []));\n }\n }\n return results;\n }\n\n private scheduleProviders(): void {\n if (this.pathIds().length) return;\n const query = this._query();\n for (const provider of this.providers()) this.scheduleProvider(provider, query);\n }\n\n private scheduleProvider(provider: CommandProvider, rawQuery: string): void {\n this.cancel(provider.id);\n const query = rawQuery.trim();\n if (query.length < (provider.minQueryLength ?? 1)) {\n this.setProviderState(provider.id, null);\n return;\n }\n const previous = this.providerState().get(provider.id);\n this.setProviderState(provider.id, { items: previous?.items ?? [], loading: true });\n const request: PendingRequest = {};\n this.pending.set(provider.id, request);\n request.timer = setTimeout(() => {\n request.timer = undefined;\n const controller = new AbortController();\n request.controller = controller;\n const done = (state: ProviderState) => {\n if (!controller.signal.aborted && this.pending.get(provider.id) === request) {\n this.setProviderState(provider.id, state);\n }\n };\n let result: ReturnType<CommandProvider['search']>;\n try {\n result = provider.search(query, controller.signal);\n } catch (error) {\n done({ items: [], loading: false, error });\n return;\n }\n if (isSubscribable(result)) {\n request.subscription = result.subscribe({\n next: (items) => done({ items, loading: false }),\n error: (error) => done({ items: [], loading: false, error }),\n complete: () => {\n const state = this.providerState().get(provider.id);\n if (state?.loading) done({ items: state.items, loading: false });\n },\n });\n } else {\n Promise.resolve(result).then(\n (items) => done({ items, loading: false }),\n (error: unknown) => done({ items: [], loading: false, error }),\n );\n }\n }, provider.debounceMs ?? this.config.debounceMs);\n }\n\n private setProviderState(id: string, state: ProviderState | null): void {\n this.providerState.update((map) => {\n const next = new Map(map);\n if (state) next.set(id, state);\n else next.delete(id);\n return next;\n });\n }\n\n private cancel(id: string): void {\n const request = this.pending.get(id);\n if (!request) return;\n this.pending.delete(id);\n if (request.timer) clearTimeout(request.timer);\n request.controller?.abort();\n request.subscription?.unsubscribe();\n }\n\n private cancelAll(): void {\n for (const id of [...this.pending.keys()]) this.cancel(id);\n }\n}\n\nfunction toResult(\n command: Command,\n key: string,\n score: number,\n indices: readonly number[],\n): CommandResult {\n return { command, key, score, indices, segments: highlightSegments(command.label, indices) };\n}\n\nfunction isParent(command: Command): command is ParentCommand {\n return Array.isArray(command.children);\n}\n\n/** The commands and, recursively, the children of those that are not hidden (for the recents). */\nfunction descendants(commands: readonly Command[]): Command[] {\n const all: Command[] = [];\n for (const command of commands) {\n if (isHidden(command)) continue;\n all.push(command);\n if (isParent(command)) all.push(...descendants(command.children));\n }\n return all;\n}\n\n/** Reads `hidden` (a boolean, a function or a signal) so that signals are tracked by the caller. */\nfunction isHidden(command: Command): boolean {\n const { hidden } = command;\n return typeof hidden === 'function' ? hidden() : !!hidden;\n}\n\nfunction isSubscribable<T>(value: unknown): value is CommandSubscribable<T> {\n return !!value && typeof (value as { subscribe?: unknown }).subscribe === 'function';\n}\n\nfunction currentDestroyRef(): DestroyRef | null {\n try {\n return inject(DestroyRef, { optional: true });\n } catch {\n // Outside an injection context: removal stays manual\n return null;\n }\n}\n\n/**\n * Registers commands for the lifetime of the current component/service.\n * Must be called in an injection context.\n */\nexport function injectCommands(\n commands: readonly Command[] | Signal<readonly Command[]>,\n): () => void {\n assertInInjectionContext(injectCommands);\n return inject(CommandPaletteService).register(commands, inject(DestroyRef));\n}\n\n/** Registers an async provider for the lifetime of the current component/service. */\nexport function injectCommandProvider(provider: CommandProvider): () => void {\n assertInInjectionContext(injectCommandProvider);\n return inject(CommandPaletteService).registerProvider(provider, inject(DestroyRef));\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nexport type NavigationAction = 'next' | 'prev' | 'first' | 'last' | 'select' | 'close';\n\ntype KeyLike = Pick<\n KeyboardEvent,\n 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey' | 'isComposing'\n>;\n\n/** Maps a keydown inside the palette to a list action, or `null` to let the input handle it. */\nexport function keyToAction(event: KeyLike): NavigationAction | null {\n // During IME composition Enter and arrows belong to the text editor\n if (event.isComposing) return null;\n switch (event.key) {\n case 'ArrowDown':\n return 'next';\n case 'ArrowUp':\n return 'prev';\n case 'Home':\n return event.shiftKey ? null : 'first';\n case 'End':\n return event.shiftKey ? null : 'last';\n case 'PageUp':\n return 'first';\n case 'PageDown':\n return 'last';\n case 'Enter':\n return 'select';\n case 'Escape':\n return 'close';\n // Ctrl+N / Ctrl+P as in Emacs and many palettes (not Ctrl+J/K: Ctrl+K toggles the palette)\n case 'n':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'next' : null;\n case 'p':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'prev' : null;\n default:\n return null;\n }\n}\n\n/**\n * Index of the next selectable item. `disabled[i]` marks rows that cannot be active.\n * Returns -1 when no item is selectable. `next`/`prev` wrap around.\n */\nexport function moveIndex(\n disabled: readonly boolean[],\n current: number,\n action: 'next' | 'prev' | 'first' | 'last',\n): number {\n const count = disabled.length;\n if (count === 0) return -1;\n const findFrom = (start: number, step: 1 | -1, wrap: boolean): number => {\n for (let n = 0, i = start; n < count; n++, i += step) {\n if (wrap) i = (i + count) % count;\n else if (i < 0 || i >= count) return -1;\n if (!disabled[i]) return i;\n }\n return -1;\n };\n switch (action) {\n case 'first':\n return findFrom(0, 1, false);\n case 'last':\n return findFrom(count - 1, -1, false);\n case 'next':\n return current < 0 ? findFrom(0, 1, false) : findFrom(current + 1, 1, true);\n case 'prev':\n return current < 0 ? findFrom(count - 1, -1, false) : findFrom(current - 1, -1, true);\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\n/** A parsed keyboard shortcut such as `mod+k` or `ctrl+shift+p`. */\nexport interface ParsedShortcut {\n readonly key: string;\n readonly mod: boolean;\n readonly ctrl: boolean;\n readonly meta: boolean;\n readonly alt: boolean;\n readonly shift: boolean;\n}\n\nconst MODIFIERS: Record<string, keyof Omit<ParsedShortcut, 'key'>> = {\n mod: 'mod',\n ctrl: 'ctrl',\n control: 'ctrl',\n meta: 'meta',\n cmd: 'meta',\n command: 'meta',\n alt: 'alt',\n option: 'alt',\n shift: 'shift',\n};\n\nconst KEY_ALIASES: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n slash: '/',\n plus: '+',\n};\n\n/**\n * Parses a shortcut string. Parts are separated by `+`; `mod` means ⌘ on Apple\n * platforms and Ctrl elsewhere. Examples: `mod+k`, `ctrl+shift+p`, `/`.\n */\nexport function parseShortcut(shortcut: string): ParsedShortcut {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map((p) => p.trim())\n .filter(Boolean);\n if (shortcut.trim().endsWith('++') || shortcut.trim() === '+') parts.push('+');\n const result = { key: '', mod: false, ctrl: false, meta: false, alt: false, shift: false };\n for (const part of parts) {\n const modifier = MODIFIERS[part];\n if (modifier) result[modifier] = true;\n else result.key = KEY_ALIASES[part] ?? part;\n }\n if (!result.key) throw new Error(`ngx-command-palette: invalid shortcut \"${shortcut}\"`);\n return result;\n}\n\n/** True on macOS / iOS, where `mod` maps to the ⌘ key. */\nexport function isApplePlatform(nav: Navigator | undefined = globalThis.navigator): boolean {\n if (!nav) return false;\n const platform =\n (nav as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform ??\n nav.platform ??\n '';\n return /mac|iphone|ipad|ipod/i.test(platform);\n}\n\ntype KeyEventLike = Pick<\n KeyboardEvent,\n 'key' | 'code' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey'\n>;\n\n/** True when `event` matches `shortcut`. Letters also match by physical key (non-Latin layouts). */\nexport function matchesShortcut(\n event: KeyEventLike,\n shortcut: ParsedShortcut,\n apple: boolean,\n): boolean {\n const wantCtrl = shortcut.ctrl || (shortcut.mod && !apple);\n const wantMeta = shortcut.meta || (shortcut.mod && apple);\n if (event.ctrlKey !== wantCtrl || event.metaKey !== wantMeta || event.altKey !== shortcut.alt) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n // Shift matters only when requested or for letters (\"?\" needs Shift, but nobody writes it)\n const isLetter = /^[a-z]$/.test(shortcut.key);\n if ((shortcut.shift || isLetter) && event.shiftKey !== shortcut.shift) return false;\n if (key === shortcut.key) return true;\n // With Alt or non-Latin layouts event.key changes: fall back to the physical key\n if (isLetter && event.code === `Key${shortcut.key.toUpperCase()}`) return true;\n if (/^[0-9]$/.test(shortcut.key) && event.code === `Digit${shortcut.key}`) return true;\n return false;\n}\n\n/** Human readable label, e.g. `⌘K` on macOS and `Ctrl+K` elsewhere. */\nexport function formatShortcut(shortcut: ParsedShortcut, apple: boolean): string {\n const key =\n shortcut.key === ' '\n ? 'Space'\n : shortcut.key.length === 1\n ? shortcut.key.toUpperCase()\n : capitalize(shortcut.key);\n if (apple) {\n return (\n (shortcut.ctrl ? '⌃' : '') +\n (shortcut.alt ? '⌥' : '') +\n (shortcut.shift ? '⇧' : '') +\n (shortcut.meta || shortcut.mod ? '⌘' : '') +\n key\n );\n }\n const parts: string[] = [];\n if (shortcut.ctrl || shortcut.mod) parts.push('Ctrl');\n if (shortcut.meta) parts.push('Win');\n if (shortcut.alt) parts.push('Alt');\n if (shortcut.shift) parts.push('Shift');\n parts.push(key);\n return parts.join('+');\n}\n\nfunction capitalize(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { Directive, TemplateRef, inject } from '@angular/core';\n\nimport type { Command, CommandResult, HighlightSegment } from './command.model';\n\nexport interface CommandItemContext {\n /** The command. */\n readonly $implicit: Command;\n readonly result: CommandResult;\n /** Label split into matched / unmatched parts. */\n readonly segments: readonly HighlightSegment[];\n /** True for the row selected with the keyboard or the mouse. */\n readonly active: boolean;\n readonly query: string;\n}\n\nexport interface CommandEmptyContext {\n /** The search text. */\n readonly $implicit: string;\n}\n\n/**\n * Custom template for each row:\n * `<ng-template rrCommandItem let-command let-segments=\"segments\">…</ng-template>`\n */\n@Directive({ selector: 'ng-template[rrCommandItem]' })\nexport class CommandItemTemplate {\n readonly template = inject<TemplateRef<CommandItemContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandItemTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandItemContext {\n return true;\n }\n}\n\n/** Custom empty state: `<ng-template rrCommandEmpty let-query>…</ng-template>` */\n@Directive({ selector: 'ng-template[rrCommandEmpty]' })\nexport class CommandEmptyTemplate {\n readonly template = inject<TemplateRef<CommandEmptyContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandEmptyTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandEmptyContext {\n return true;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n DestroyRef,\n ElementRef,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n computed,\n contentChild,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport type { Command, CommandResult } from './command.model';\nimport { CommandPaletteService } from './command-palette.service';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteTheme } from './config';\nimport { keyToAction, moveIndex } from './list-navigation';\nimport { formatShortcut, isApplePlatform, matchesShortcut, parseShortcut } from './shortcut';\nimport { CommandEmptyTemplate, CommandItemTemplate } from './templates.directive';\n\nlet nextId = 0;\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * The command palette dialog. Place it once, usually in the root component template.\n * It listens to the global shortcut and renders nothing while closed.\n */\n@Component({\n selector: 'rr-command-palette',\n imports: [NgTemplateOutlet],\n templateUrl: './command-palette.component.html',\n styleUrl: './command-palette.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'rr-cp-host',\n '(document:keydown)': 'onDocumentKeydown($event)',\n '(document:focusin)': 'onDocumentFocusin($event)',\n },\n})\nexport class CommandPaletteComponent {\n protected readonly service = inject(CommandPaletteService);\n protected readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly document = inject(DOCUMENT);\n\n /** Overrides the `theme` of `provideCommandPalette()`, e.g. to follow your app's theme toggle. */\n readonly theme = input<CommandPaletteTheme | undefined>(undefined);\n\n protected readonly itemTemplate = contentChild(CommandItemTemplate);\n protected readonly emptyTemplate = contentChild(CommandEmptyTemplate);\n private readonly input = viewChild<ElementRef<HTMLInputElement>>('input');\n private readonly dialog = viewChild<ElementRef<HTMLElement>>('dialog');\n\n protected readonly uid = `rr-cp-${nextId++}`;\n protected readonly labels = this.config.labels;\n private readonly apple = isApplePlatform();\n private readonly shortcuts = (typeof this.config.shortcut === 'string'\n ? [this.config.shortcut]\n : this.config.shortcut\n ).map(parseShortcut);\n /** Label of the first shortcut, e.g. `⌘K` or `Ctrl+K`, for a \"search\" button in your UI. */\n readonly shortcutLabel = this.shortcuts.length\n ? formatShortcut(this.shortcuts[0], this.apple)\n : '';\n\n private readonly prefersDark = signal(false);\n protected readonly resolvedTheme = computed(() => {\n const theme = this.theme() ?? this.config.theme;\n return theme === 'auto' ? (this.prefersDark() ? 'dark' : 'light') : theme;\n });\n\n /** Sections with the flat index of each row (used for ids and keyboard navigation). */\n protected readonly view = computed(() => {\n let index = 0;\n return this.service.sections().map((section, sectionIndex) => ({\n section,\n headingId: `${this.uid}-group-${sectionIndex}`,\n rows: section.items.map((item) => ({ item, index: index++ })),\n }));\n });\n protected readonly items = computed<readonly CommandResult[]>(() =>\n this.service.sections().flatMap((s) => s.items),\n );\n private readonly activeKey = signal<string | null>(null);\n protected readonly activeIndex = computed(() => {\n const items = this.items();\n const key = this.activeKey();\n const found = key === null ? -1 : items.findIndex((i) => i.key === key);\n if (found >= 0 && !items[found].command.disabled) return found;\n return moveIndex(\n items.map((i) => !!i.command.disabled),\n -1,\n 'first',\n );\n });\n protected readonly activeDescendant = computed(() => {\n const index = this.activeIndex();\n return index >= 0 ? this.optionId(index) : null;\n });\n protected readonly status = computed(() => {\n if (this.service.loading()) return this.labels.loading;\n const count = this.items().length;\n if (count === 0) return this.labels.empty;\n const path = this.service.path();\n const template = path.length ? this.labels.level : this.labels.results;\n return template\n .replace('{name}', path[path.length - 1]?.label ?? '')\n .replace('{count}', String(count));\n });\n\n constructor() {\n const view = this.document.defaultView;\n const media = view?.matchMedia?.('(prefers-color-scheme: dark)');\n if (media) {\n this.prefersDark.set(media.matches);\n const listener = (e: MediaQueryListEvent) => this.prefersDark.set(e.matches);\n media.addEventListener?.('change', listener);\n inject(DestroyRef).onDestroy(() => media.removeEventListener?.('change', listener));\n }\n\n // Focus the search field as soon as the dialog appears\n afterRenderEffect(() => {\n const input = this.input()?.nativeElement;\n if (input && this.document.activeElement !== input) input.focus({ preventScroll: true });\n });\n // Keep the active row visible during keyboard navigation\n afterRenderEffect(() => {\n const id = this.activeDescendant();\n if (!id) return;\n const option = this.document.getElementById(id);\n option?.scrollIntoView?.({ block: 'nearest' });\n });\n }\n\n protected optionId(index: number): string {\n return `${this.uid}-option-${index}`;\n }\n\n protected hasChildren(command: Command): boolean {\n return Array.isArray(command.children);\n }\n\n protected onBack(levels: number): void {\n this.activeKey.set(null);\n this.service.back(levels);\n this.input()?.nativeElement.focus({ preventScroll: true });\n }\n\n protected isTemplate(icon: unknown): icon is TemplateRef<unknown> {\n return icon instanceof TemplateRef;\n }\n\n protected onInput(event: Event): void {\n this.activeKey.set(null);\n this.service.setQuery((event.target as HTMLInputElement).value);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Tab') {\n this.trapTab(event);\n return;\n }\n if (\n event.key === 'Backspace' &&\n !event.isComposing &&\n this.service.query() === '' &&\n this.service.path().length\n ) {\n // Like deleting the \"tag\" in front of the search text: leave the sub-palette\n event.preventDefault();\n this.activeKey.set(null);\n this.service.back();\n return;\n }\n const action = keyToAction(event);\n if (!action) return;\n event.preventDefault();\n event.stopPropagation();\n const items = this.items();\n switch (action) {\n case 'close':\n this.service.close();\n return;\n case 'select': {\n const item = items[this.activeIndex()];\n if (item) void this.service.execute(item.command);\n return;\n }\n default: {\n const next = moveIndex(\n items.map((i) => !!i.command.disabled),\n this.activeIndex(),\n action,\n );\n if (next >= 0) this.activeKey.set(items[next].key);\n }\n }\n }\n\n protected onPointerMove(item: CommandResult): void {\n if (!item.command.disabled && this.activeKey() !== item.key) this.activeKey.set(item.key);\n }\n\n protected onSelect(item: CommandResult): void {\n void this.service.execute(item.command);\n }\n\n protected onOverlayDown(event: MouseEvent): void {\n // Only a click on the backdrop, not inside the dialog\n if (event.target === event.currentTarget) this.service.close();\n }\n\n protected onDocumentKeydown(event: KeyboardEvent): void {\n if (event.repeat || event.isComposing) return;\n // Shortcuts without Ctrl/⌘/Alt (e.g. \"/\") do not fire while typing in a field\n const typing = isEditable(event.target);\n const hit = this.shortcuts.some(\n (s) =>\n (!typing || s.mod || s.ctrl || s.meta || s.alt) && matchesShortcut(event, s, this.apple),\n );\n if (hit) {\n event.preventDefault();\n this.activeKey.set(null);\n this.service.toggle();\n }\n }\n\n protected onDocumentFocusin(event: FocusEvent): void {\n if (!this.service.isOpen()) return;\n const dialog = this.dialog()?.nativeElement;\n // Focus trap: if focus leaves the dialog (e.g. an iframe click or a scripted focus) it returns to the input\n if (dialog && event.target instanceof Node && !dialog.contains(event.target)) {\n this.input()?.nativeElement.focus({ preventScroll: true });\n }\n }\n\n private trapTab(event: KeyboardEvent): void {\n const dialog = this.dialog()?.nativeElement;\n if (!dialog) return;\n const focusable = Array.from(dialog.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length <= 1) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = this.document.activeElement;\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n }\n}\n\nfunction isEditable(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el || typeof el.tagName !== 'string') return false;\n const tag = el.tagName.toLowerCase();\n return tag === 'input' || tag === 'textarea' || tag === 'select' || el.isContentEditable;\n}\n","@if (service.isOpen()) {\n <div class=\"rr-cp\" [attr.data-theme]=\"resolvedTheme()\" (mousedown)=\"onOverlayDown($event)\">\n <div\n #dialog\n class=\"rr-cp-dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"labels.dialog\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (service.path(); as path) {\n @if (path.length) {\n <nav class=\"rr-cp-path\">\n <button\n type=\"button\"\n class=\"rr-cp-path-back\"\n [attr.aria-label]=\"labels.back\"\n (click)=\"onBack(1)\"\n >\n <svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" aria-hidden=\"true\">\n <path\n d=\"m15 6-6 6 6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n @for (parent of path; track parent.id; let i = $index; let last = $last) {\n @if (last) {\n <span class=\"rr-cp-path-current\" aria-current=\"page\">{{ parent.label }}</span>\n } @else {\n <button type=\"button\" class=\"rr-cp-path-step\" (click)=\"onBack(path.length - 1 - i)\">\n {{ parent.label }}\n </button>\n <span class=\"rr-cp-path-sep\" aria-hidden=\"true\">›</span>\n }\n }\n </nav>\n }\n }\n <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (hasChildren(row.item.command)) {\n <span class=\"rr-cp-sr-only\">, {{ labels.submenu }}</span>\n <span class=\"rr-cp-chevron\" aria-hidden=\"true\">›</span>\n }\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n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UAAA;CAAA,MAAA;CAAuB,YAAA,CAAA;EAbnC,MAAA;EACW,MAAA,CAAA;GAAA,UAAA;GAAoB,SACrB,CAAC,gBAAgB;GAAC,iBAGV,wBAAwB;GAAM,eAChC,kBAAkB;GAAI,MAC/B;IACJ,OAAO;IACP,sBAAsB;IACtB,sBAAsB;GACvB;GAAA,UAAA;GAAA,QAAA,CAAA,25JAAA;EAAA,CAAA;CAU8C,CAAA;CAAA,sBAAA,CAAA;CAAA,gBAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,mBAAmB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAClB,oBAAoB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACH,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACX,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA;AA8MvE,SAAS,WAAW,QAA0B;CAC5C,MAAM,KAAK;CACX,IAAI,CAAC,MAAM,OAAO,GAAG,YAAY,UAAU,OAAO;CAClD,MAAM,MAAM,GAAG,QAAQ,YAAW;CAClC,OAAO,QAAQ,WAAW,QAAQ,cAAc,QAAQ,YAAY,GAAG;AACzE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rrstudioapps/ngx-command-palette",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Accessible ⌘K / Ctrl+K command palette for Angular: fuzzy search, sections, recents, async providers. Standalone, signals, zoneless, zero dependencies.",
5
5
  "keywords": [
6
6
  "angular",
@@ -23,19 +23,35 @@ interface CommandBase {
23
23
  readonly keywords?: readonly string[];
24
24
  /** A disabled command is shown but cannot be executed or selected. */
25
25
  readonly disabled?: boolean;
26
+ /**
27
+ * A hidden command is not listed and not searched (unlike `disabled`, which shows it greyed out).
28
+ * Pass a function or a signal to hide it depending on your app state, e.g. `hidden: () => !user()`.
29
+ */
30
+ readonly hidden?: boolean | (() => boolean);
26
31
  }
27
32
  /** A command that navigates to an Angular route. */
28
33
  interface RouteCommand extends CommandBase {
29
34
  readonly route: string | readonly unknown[];
30
35
  readonly navigationExtras?: NavigationExtras;
31
36
  readonly run?: never;
37
+ readonly children?: never;
32
38
  }
33
39
  /** A command that runs a function. */
34
40
  interface ActionCommand extends CommandBase {
35
41
  readonly run: (context: CommandRunContext) => void | Promise<unknown>;
36
42
  readonly route?: never;
43
+ readonly children?: never;
44
+ }
45
+ /**
46
+ * A command that opens a sub-palette: selecting it lists `children` (searched on their own)
47
+ * instead of running something. Children can have children too.
48
+ */
49
+ interface ParentCommand extends CommandBase {
50
+ readonly children: readonly Command[];
51
+ readonly route?: never;
52
+ readonly run?: never;
37
53
  }
38
- type Command = RouteCommand | ActionCommand;
54
+ type Command = RouteCommand | ActionCommand | ParentCommand;
39
55
  /** Minimal subscribable shape, so the library does not depend on RxJS. */
40
56
  interface CommandSubscribable<T> {
41
57
  subscribe(observer: {
@@ -82,6 +98,24 @@ interface CommandSection {
82
98
  readonly label: string;
83
99
  readonly items: readonly CommandResult[];
84
100
  }
101
+ interface FuzzyMatch {
102
+ /** Higher is better. Only meaningful to compare matches of the same query. */
103
+ readonly score: number;
104
+ /** Indices of `text` matched by the query, ascending. */
105
+ readonly indices: readonly number[];
106
+ }
107
+ /**
108
+ * Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in
109
+ * `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.
110
+ */
111
+ export declare function fuzzyMatch(query: string, text: string): FuzzyMatch | null;
112
+ /** Splits `text` into matched / unmatched segments for highlighting. */
113
+ export declare function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[];
114
+ /**
115
+ * Matches a command against the query using label, keywords and description.
116
+ * `indices` refer to the label (empty when only keywords/description matched).
117
+ */
118
+ export declare function matchCommand(query: string, command: Command): FuzzyMatch | null;
85
119
  type CommandPaletteTheme = 'light' | 'dark' | 'auto';
86
120
  /** Texts of the palette, for translations. */
87
121
  interface CommandPaletteLabels {
@@ -95,7 +129,18 @@ interface CommandPaletteLabels {
95
129
  /** Screen reader announcement, `{count}` is replaced by the number of results. */
96
130
  readonly results: string;
97
131
  readonly closeHint: string;
132
+ /** Label of the button that goes back one level of a sub-palette. */
133
+ readonly back: string;
134
+ /** Screen reader announcement when a sub-palette is opened; `{name}` and `{count}` are replaced. */
135
+ readonly level: string;
136
+ /** Screen reader hint added to a command that opens a sub-palette. */
137
+ readonly submenu: string;
98
138
  }
139
+ /**
140
+ * Decides whether `command` matches the search text and how well. Return `null` to hide the
141
+ * command. A higher `score` ranks first; `indices` are the label characters to highlight.
142
+ */
143
+ type CommandFilter = (query: string, command: Command) => FuzzyMatch | null;
99
144
  interface CommandPaletteRecentOptions {
100
145
  /** Max number of recents shown. Default: 5. */
101
146
  readonly max?: number;
@@ -113,6 +158,14 @@ interface CommandPaletteConfig {
113
158
  readonly debounceMs: number;
114
159
  /** Max results of local commands for a non-empty query. Default: 50. */
115
160
  readonly maxResults: number;
161
+ /**
162
+ * Max commands listed when the search is empty (the "Recent" section is not counted). The rest is
163
+ * still found by searching. Default: 100. Drawing every row slows down the opening when there are
164
+ * thousands of commands; use `Infinity` to list them all.
165
+ */
166
+ readonly maxEmptyResults: number;
167
+ /** Matching and ranking of local commands for a non-empty query. Default: the built-in fuzzy search. */
168
+ readonly filter: CommandFilter;
116
169
  readonly labels: CommandPaletteLabels;
117
170
  }
118
171
  type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {
@@ -140,11 +193,19 @@ export declare class CommandPaletteService {
140
193
  private readonly providerState;
141
194
  private readonly recents;
142
195
  private readonly pending;
196
+ private readonly pathIds;
143
197
  private returnFocus;
144
198
  /** Whether the palette is open. */
145
199
  readonly isOpen: Signal<boolean>;
146
200
  /** Current search text. */
147
201
  readonly query: Signal<string>;
202
+ /**
203
+ * Sub-palettes currently open, outermost first (empty at the top level). It follows the registered
204
+ * commands: if a parent is removed or replaced while open, the path shrinks to what still exists.
205
+ */
206
+ readonly path: Signal<readonly ParentCommand[]>;
207
+ /** The commands of the level being shown: the top level or the children of the last parent. */
208
+ private readonly levelCommands;
148
209
  /** All registered (synchronous) commands. When two share an id, the last registered wins. */
149
210
  readonly commands: Signal<readonly Command[]>;
150
211
  /** True while at least one async provider is waiting for results. */
@@ -158,6 +219,11 @@ export declare class CommandPaletteService {
158
219
  toggle(): void;
159
220
  /** Updates the search text and schedules the async providers. */
160
221
  setQuery(query: string): void;
222
+ /**
223
+ * Goes back `levels` levels of a sub-palette (one by default) and clears the search.
224
+ * Returns `false`, doing nothing, when the top level is already shown.
225
+ */
226
+ back(levels?: number): boolean;
161
227
  /**
162
228
  * Registers commands (an array or a signal of arrays). Called in an injection context
163
229
  * (constructor, field initializer) they are removed when that context is destroyed.
@@ -257,6 +323,8 @@ export declare class CommandPaletteComponent {
257
323
  protected readonly status: import("@angular/core").Signal<string>;
258
324
  constructor();
259
325
  protected optionId(index: number): string;
326
+ protected hasChildren(command: Command): boolean;
327
+ protected onBack(levels: number): void;
260
328
  protected isTemplate(icon: unknown): icon is TemplateRef<unknown>;
261
329
  protected onInput(event: Event): void;
262
330
  protected onKeydown(event: KeyboardEvent): void;
@@ -275,24 +343,6 @@ export declare class CommandPaletteComponent {
275
343
  };
276
344
  }, {}, ["itemTemplate", "emptyTemplate"], never, true, never>;
277
345
  }
278
- interface FuzzyMatch {
279
- /** Higher is better. Only meaningful to compare matches of the same query. */
280
- readonly score: number;
281
- /** Indices of `text` matched by the query, ascending. */
282
- readonly indices: readonly number[];
283
- }
284
- /**
285
- * Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in
286
- * `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.
287
- */
288
- export declare function fuzzyMatch(query: string, text: string): FuzzyMatch | null;
289
- /** Splits `text` into matched / unmatched segments for highlighting. */
290
- export declare function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[];
291
- /**
292
- * Matches a command against the query using label, keywords and description.
293
- * `indices` refer to the label (empty when only keywords/description matched).
294
- */
295
- export declare function matchCommand(query: string, command: Command): FuzzyMatch | null;
296
346
  /** A parsed keyboard shortcut such as `mod+k` or `ctrl+shift+p`. */
297
347
  interface ParsedShortcut {
298
348
  readonly key: string;
@@ -314,4 +364,4 @@ type KeyEventLike = Pick<KeyboardEvent, 'key' | 'code' | 'ctrlKey' | 'metaKey' |
314
364
  export declare function matchesShortcut(event: KeyEventLike, shortcut: ParsedShortcut, apple: boolean): boolean;
315
365
  /** Human readable label, e.g. `⌘K` on macOS and `Ctrl+K` elsewhere. */
316
366
  export declare function formatShortcut(shortcut: ParsedShortcut, apple: boolean): string;
317
- export type { ActionCommand, Command, CommandEmptyContext, CommandItemContext, CommandPaletteConfig, CommandPaletteLabels, CommandPaletteOptions, CommandPaletteRecentOptions, CommandPaletteTheme, CommandProvider, CommandResult, CommandRunContext, CommandSection, CommandSubscribable, FuzzyMatch, HighlightSegment, ParsedShortcut, RouteCommand };
367
+ export type { ActionCommand, Command, CommandEmptyContext, CommandFilter, CommandItemContext, CommandPaletteConfig, CommandPaletteLabels, CommandPaletteOptions, CommandPaletteRecentOptions, CommandPaletteTheme, CommandProvider, CommandResult, CommandRunContext, CommandSection, CommandSubscribable, FuzzyMatch, HighlightSegment, ParentCommand, ParsedShortcut, RouteCommand };