@rrstudioapps/ngx-command-palette 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -138,19 +138,23 @@ injectCommandProvider({
|
|
|
138
138
|
|
|
139
139
|
### `provideCommandPalette(options?)`
|
|
140
140
|
|
|
141
|
-
| Option
|
|
142
|
-
|
|
|
143
|
-
| `shortcut`
|
|
144
|
-
| `shortcutInFields`
|
|
145
|
-
| `shortcutEnabled`
|
|
146
|
-
| `theme`
|
|
147
|
-
| `recent`
|
|
148
|
-
| `debounceMs`
|
|
149
|
-
| `maxResults`
|
|
150
|
-
| `maxEmptyResults`
|
|
151
|
-
| `filter`
|
|
152
|
-
| `prefixes`
|
|
153
|
-
| `labels`
|
|
141
|
+
| Option | Type | Default | Description |
|
|
142
|
+
| ------------------- | ------------------------------------------------------------------------ | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
143
|
+
| `shortcut` | `string \| string[]` | `'mod+k'` | Toggle shortcut(s). `mod` is ⌘ on macOS/iOS and Ctrl elsewhere. Examples: `'ctrl+shift+p'`, `'/'`. Shortcuts without Ctrl/⌘/Alt are ignored while typing in a field. `[]` turns the shortcut off (`open()` still works). |
|
|
144
|
+
| `shortcutInFields` | `boolean` | `true` | With `false`, Ctrl/⌘ shortcuts (the palette's and command `hotkey`s) do not fire while typing in an input, textarea, select or contenteditable. |
|
|
145
|
+
| `shortcutEnabled` | `boolean \| (() => boolean)` | `true` | A function or a signal is read on every key press. While `false` the shortcut does not open the palette (and the key is left to the page); an open palette can still be closed with it, and `open()` always works. |
|
|
146
|
+
| `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | `auto` follows `prefers-color-scheme`. |
|
|
147
|
+
| `recent` | `{ max?, storageKey?, rank?, storage?, enabled? } \| false` | `{ max: 5, storageKey: 'rr-cp:recent' }` | "Recent" section shown when the query is empty. `rank: 'frequent'` orders it by how often and how recently commands ran (count halves every 7 days). `storage` is where they are saved and `enabled` (boolean, function or signal) turns them on or off at runtime (see below). |
|
|
148
|
+
| `debounceMs` | `number` | `200` | Debounce for async providers. |
|
|
149
|
+
| `maxResults` | `number` | `50` | Max local results for a non-empty query. |
|
|
150
|
+
| `maxEmptyResults` | `number` | `100` | Max commands listed when the search is empty (recents not counted). The rest is still found by typing. See [Many commands](#many-commands). |
|
|
151
|
+
| `filter` | `(query, command) => { score, indices } \| null` | built-in fuzzy search | Your own matching and ranking of local commands. See [Custom search](#custom-search). |
|
|
152
|
+
| `prefixes` | `{ prefix, groups?, kind? }[]` | `[]` | Search modes. See [Prefix modes](#prefix-modes). |
|
|
153
|
+
| `labels` | `Partial<CommandPaletteLabels> \| (() => Partial<CommandPaletteLabels>)` | English | All texts, for translations. A function or a signal is read reactively: when a signal it reads changes (e.g. the language), the open palette updates. The texts are: `placeholder`, `dialog`, `listbox`, `empty`, `loading`, `recent`, `pinned`, `defaultGroup`, `results` (`'{count} results'`), `resultsOne` (same, for exactly one result; default: `results`), `closeHint`, `back`, `level` (`'{name}: {count} results'`), `levelOne` (same, for one result; default: `level`), `submenu`, `prompt` (`'{name}: type a value and press Enter'`). |
|
|
154
|
+
| `showSectionLabels` | `boolean` | `true` | Shows the section headings (Recent, Pinned, groups). With `false` they are visually hidden and each group keeps its accessible name. |
|
|
155
|
+
| `showCloseHint` | `boolean` | `true` | Shows the close key (`labels.closeHint`, Esc) in the search field. |
|
|
156
|
+
| `highlightMatches` | `boolean` | `true` | Highlights the characters found by the search. |
|
|
157
|
+
| `showStatus` | `boolean` | `false` | Shows the status line (e.g. "3 results") at the bottom of the window, with the class `rr-cp-status`. It is an `aria-live` region either way. |
|
|
154
158
|
|
|
155
159
|
### Shortcut, recents and texts
|
|
156
160
|
|
|
@@ -472,6 +476,50 @@ Set them on `.rr-cp` (the overlay), and on `.rr-cp[data-theme='dark']` for the d
|
|
|
472
476
|
Class names (`rr-cp-dialog`, `rr-cp-item`, `rr-cp-item-active`, `rr-cp-match`, `rr-cp-group-label`,
|
|
473
477
|
`rr-cp-empty`, …) are stable too, if you need more than variables.
|
|
474
478
|
|
|
479
|
+
**Layout and weight variables.** These have their default as a fallback inside the rules, so they work set on `:root` or `body` as well as on `.rr-cp`. (The variables above are declared on `.rr-cp` itself: set those on `.rr-cp`, a value on `:root` is ignored.) Defaults are today's values.
|
|
480
|
+
|
|
481
|
+
| Variable | Default | Purpose |
|
|
482
|
+
| -------------------------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------------- |
|
|
483
|
+
| `--rr-cp-search-padding`, `--rr-cp-search-gap` | `0 14px`, `10px` | Padding of the search row and gap between its parts |
|
|
484
|
+
| `--rr-cp-input-height`, `--rr-cp-input-font-size` | `52px`, `1rem` | Search field |
|
|
485
|
+
| `--rr-cp-input-focus-outline` | `none` | Outline of the search field on `:focus-visible`, e.g. `2px solid #4f46e5` |
|
|
486
|
+
| `--rr-cp-list-padding` | `6px` | Padding of the list |
|
|
487
|
+
| `--rr-cp-item-padding`, `--rr-cp-item-gap` | `6px 10px`, `10px` | Padding of a row and gap between its parts |
|
|
488
|
+
| `--rr-cp-label-weight`, `--rr-cp-match-weight` | `inherit`, `600` | Weight of the label and of the matched characters |
|
|
489
|
+
| `--rr-cp-description-size`, `--rr-cp-description-color`, `--rr-cp-description-opacity` | `0.8125rem`, `var(--rr-cp-muted)`, `1` | Description under the label |
|
|
490
|
+
| `--rr-cp-item-active-fg` | `var(--rr-cp-fg)` | Text color of the active row |
|
|
491
|
+
| `--rr-cp-item-active-shadow` | `inset 2px 0 0 var(--rr-cp-accent)` | The bar on the left of the active row; `none` removes it |
|
|
492
|
+
| `--rr-cp-status-padding`, `--rr-cp-status-size` | `8px 14px`, `0.75rem` | Status line shown by `showStatus` |
|
|
493
|
+
|
|
494
|
+
**Fitting an existing theme.** The search field is protected from global `input` rules of your app (border, background, shadow, radius, appearance), so no `!important` is needed. Match the palette to your design system with options and variables:
|
|
495
|
+
|
|
496
|
+
```ts
|
|
497
|
+
provideCommandPalette({
|
|
498
|
+
showSectionLabels: false, // a flat list, no headings
|
|
499
|
+
showCloseHint: false,
|
|
500
|
+
highlightMatches: false,
|
|
501
|
+
showStatus: true, // a visible "3 results" line
|
|
502
|
+
labels: { resultsOne: '1 result' },
|
|
503
|
+
});
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
```css
|
|
507
|
+
:root {
|
|
508
|
+
--rr-cp-input-height: 44px;
|
|
509
|
+
--rr-cp-item-padding: 4px 12px;
|
|
510
|
+
--rr-cp-item-gap: 12px;
|
|
511
|
+
--rr-cp-label-weight: 500;
|
|
512
|
+
--rr-cp-description-size: 0.75rem;
|
|
513
|
+
--rr-cp-description-opacity: 0.8;
|
|
514
|
+
--rr-cp-item-active-shadow: none; /* no bar, only the background */
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.rr-cp {
|
|
518
|
+
--rr-cp-item-active-bg: #eef2ff; /* declared on .rr-cp: set it here, not on :root */
|
|
519
|
+
--rr-cp-input-focus-outline: 2px solid #4f46e5;
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
475
523
|
## Accessibility
|
|
476
524
|
|
|
477
525
|
- The palette is a modal `role="dialog"` with `aria-modal="true"` and a label.
|
|
@@ -480,7 +528,8 @@ Class names (`rr-cp-dialog`, `rr-cp-item`, `rr-cp-item-active`, `rr-cp-match`, `
|
|
|
480
528
|
so the focus never leaves the input.
|
|
481
529
|
- Disabled commands use `aria-disabled` and are skipped by the keyboard.
|
|
482
530
|
- Focus is trapped inside the dialog and **restored** to the previously focused element on close.
|
|
483
|
-
- A polite live region announces the number of results and the loading state.
|
|
531
|
+
- A polite live region announces the number of results and the loading state (visible with `showStatus`).
|
|
532
|
+
- The search field has no focus ring by default (the active row is the visible focus). If your design needs one, set `--rr-cp-input-focus-outline`. With `showSectionLabels: false` the groups keep their accessible name.
|
|
484
533
|
- Animations are disabled with `prefers-reduced-motion: reduce`, and active rows and matches
|
|
485
534
|
stay visible in Windows high contrast mode (`forced-colors`).
|
|
486
535
|
- The demo is checked with axe-core: 0 violations in light and dark themes.
|
|
@@ -212,6 +212,10 @@ const DEFAULT_COMMAND_PALETTE_CONFIG = {
|
|
|
212
212
|
maxEmptyResults: 100,
|
|
213
213
|
filter: matchCommand,
|
|
214
214
|
prefixes: [],
|
|
215
|
+
showSectionLabels: true,
|
|
216
|
+
showCloseHint: true,
|
|
217
|
+
highlightMatches: true,
|
|
218
|
+
showStatus: false,
|
|
215
219
|
labels: DEFAULT_COMMAND_PALETTE_LABELS
|
|
216
220
|
};
|
|
217
221
|
const COMMAND_PALETTE_CONFIG = new InjectionToken("COMMAND_PALETTE_CONFIG", {
|
|
@@ -999,7 +1003,8 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
999
1003
|
const path = this.service.path();
|
|
1000
1004
|
const prompt = this.service.prompt();
|
|
1001
1005
|
if (prompt) return this.labels().prompt.replace("{name}", prompt.label);
|
|
1002
|
-
|
|
1006
|
+
const { level, levelOne, results, resultsOne } = this.labels();
|
|
1007
|
+
return (path.length ? count === 1 ? levelOne ?? level : level : count === 1 ? resultsOne ?? results : results).replace("{name}", path[path.length - 1]?.label ?? "").replace("{count}", String(count));
|
|
1003
1008
|
}, ...ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []);
|
|
1004
1009
|
crumbs = computed(() => {
|
|
1005
1010
|
const prompt = this.service.prompt();
|
|
@@ -1174,8 +1179,8 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
1174
1179
|
isSignal: true
|
|
1175
1180
|
}],
|
|
1176
1181
|
ngImport: i0,
|
|
1177
|
-
template: "@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 (crumbs(); 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]=\"placeholder()\"\n [placeholder]=\"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 (keysOf(row.item.command).length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of keysOf(row.item.command); 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 </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
1178
|
-
styles: [":where(.rr-cp){--rr-cp-font: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;--rr-cp-font-size: .9375rem;--rr-cp-width: 640px;--rr-cp-max-height: min(420px, 60vh);--rr-cp-top: 12vh;--rr-cp-radius: 12px;--rr-cp-item-radius: 8px;--rr-cp-z-index: 1000;--rr-cp-bg: #ffffff;--rr-cp-fg: #18181b;--rr-cp-muted: #686872;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--rr-cp-border)}.rr-cp-path{display:flex;align-items:center;gap:4px;padding:10px 14px 0;color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-path button{display:inline-flex;align-items:center;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer}.rr-cp-path button:hover{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-fg)}.rr-cp-path button:focus-visible{outline:2px solid var(--rr-cp-accent);outline-offset:1px}.rr-cp-path-current{padding:2px 6px;color:var(--rr-cp-fg);font-weight:600}.rr-cp-chevron,.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp-input{flex:1;min-width:0;height:52px;padding:0;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:6px;scroll-padding:6px}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);box-shadow:inset 2px 0 0 var(--rr-cp-accent)}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-description{color:var(--rr-cp-muted);font-size
|
|
1182
|
+
template: "@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 (crumbs(); 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]=\"placeholder()\"\n [placeholder]=\"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 @if (config.showCloseHint) {\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels().closeHint }}</kbd>\n }\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\" [class.rr-cp-sr-only]=\"!config.showSectionLabels\" [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 && config.highlightMatches) {<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 (keysOf(row.item.command).length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of keysOf(row.item.command); 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 </div>\n }\n\n <!-- prettier-ignore -->\n <div [class.rr-cp-status]=\"config.showStatus\" [class.rr-cp-sr-only]=\"!config.showStatus\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
1183
|
+
styles: [":where(.rr-cp){--rr-cp-font: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;--rr-cp-font-size: .9375rem;--rr-cp-width: 640px;--rr-cp-max-height: min(420px, 60vh);--rr-cp-top: 12vh;--rr-cp-radius: 12px;--rr-cp-item-radius: 8px;--rr-cp-z-index: 1000;--rr-cp-bg: #ffffff;--rr-cp-fg: #18181b;--rr-cp-muted: #686872;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:var(--rr-cp-search-gap, 10px);padding:var(--rr-cp-search-padding, 0 14px);border-bottom:1px solid var(--rr-cp-border)}.rr-cp-path{display:flex;align-items:center;gap:4px;padding:10px 14px 0;color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-path button{display:inline-flex;align-items:center;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer}.rr-cp-path button:hover{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-fg)}.rr-cp-path button:focus-visible{outline:2px solid var(--rr-cp-accent);outline-offset:1px}.rr-cp-path-current{padding:2px 6px;color:var(--rr-cp-fg);font-weight:600}.rr-cp-chevron,.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp .rr-cp-input{flex:1;min-width:0;height:var(--rr-cp-input-height, 52px);margin:0;padding:0;border:0;border-radius:0;outline:0;background:transparent;box-shadow:none;appearance:none;color:inherit;font:inherit;font-size:var(--rr-cp-input-font-size, 1rem)}.rr-cp .rr-cp-input:focus-visible{outline:var(--rr-cp-input-focus-outline, none)}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:var(--rr-cp-list-padding, 6px);scroll-padding:var(--rr-cp-list-padding, 6px)}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:var(--rr-cp-item-gap, 10px);min-height:40px;padding:var(--rr-cp-item-padding, 6px 10px);border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-item-active-fg, var(--rr-cp-fg));box-shadow:var(--rr-cp-item-active-shadow, inset 2px 0 0 var(--rr-cp-accent))}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-label{font-weight:var(--rr-cp-label-weight, inherit)}.rr-cp-description{color:var(--rr-cp-description-color, var(--rr-cp-muted));font-size:var(--rr-cp-description-size, .8125rem);opacity:var(--rr-cp-description-opacity, 1)}.rr-cp-match{padding:0;background:var(--rr-cp-highlight-bg);color:var(--rr-cp-highlight);font-weight:var(--rr-cp-match-weight, 600)}.rr-cp-shortcut{display:inline-flex;flex:none;gap:4px}.rr-cp kbd{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;box-sizing:border-box;border:1px solid var(--rr-cp-border);border-radius:4px;background:var(--rr-cp-kbd-bg);color:var(--rr-cp-kbd-fg);font-family:inherit;font-size:.6875rem;font-weight:500}.rr-cp-status{padding:var(--rr-cp-status-padding, 8px 14px);border-top:1px solid var(--rr-cp-border);color:var(--rr-cp-muted);font-size:var(--rr-cp-status-size, .75rem)}.rr-cp-empty{padding:32px 16px;color:var(--rr-cp-muted);text-align:center}.rr-cp-spinner{flex:none;width:14px;height:14px;border:2px solid var(--rr-cp-border);border-top-color:var(--rr-cp-accent);border-radius:50%;animation:rr-cp-spin .7s linear infinite}.rr-cp-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}@keyframes rr-cp-fade{0%{opacity:0}}@keyframes rr-cp-pop{0%{opacity:0;transform:scale(.98) translateY(-4px)}}@keyframes rr-cp-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.rr-cp,.rr-cp-dialog{animation:none}.rr-cp-spinner{animation-duration:2s}}@media(max-width:480px){:where(.rr-cp){--rr-cp-top: 8px;--rr-cp-max-height: calc(100dvh - 90px) }.rr-cp-shortcut{display:none}}@media(forced-colors:active){.rr-cp-item-active{outline:2px solid Highlight}.rr-cp-match{text-decoration:underline}}\n"],
|
|
1179
1184
|
dependencies: [{
|
|
1180
1185
|
kind: "directive",
|
|
1181
1186
|
type: NgTemplateOutlet,
|
|
@@ -1207,8 +1212,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
1207
1212
|
"(document:keydown)": "onDocumentKeydown($event)",
|
|
1208
1213
|
"(document:focusin)": "onDocumentFocusin($event)"
|
|
1209
1214
|
},
|
|
1210
|
-
template: "@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 (crumbs(); 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]=\"placeholder()\"\n [placeholder]=\"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 (keysOf(row.item.command).length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of keysOf(row.item.command); 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 </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
1211
|
-
styles: [":where(.rr-cp){--rr-cp-font: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;--rr-cp-font-size: .9375rem;--rr-cp-width: 640px;--rr-cp-max-height: min(420px, 60vh);--rr-cp-top: 12vh;--rr-cp-radius: 12px;--rr-cp-item-radius: 8px;--rr-cp-z-index: 1000;--rr-cp-bg: #ffffff;--rr-cp-fg: #18181b;--rr-cp-muted: #686872;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--rr-cp-border)}.rr-cp-path{display:flex;align-items:center;gap:4px;padding:10px 14px 0;color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-path button{display:inline-flex;align-items:center;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer}.rr-cp-path button:hover{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-fg)}.rr-cp-path button:focus-visible{outline:2px solid var(--rr-cp-accent);outline-offset:1px}.rr-cp-path-current{padding:2px 6px;color:var(--rr-cp-fg);font-weight:600}.rr-cp-chevron,.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp-input{flex:1;min-width:0;height:52px;padding:0;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:6px;scroll-padding:6px}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);box-shadow:inset 2px 0 0 var(--rr-cp-accent)}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-description{color:var(--rr-cp-muted);font-size
|
|
1215
|
+
template: "@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 (crumbs(); 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]=\"placeholder()\"\n [placeholder]=\"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 @if (config.showCloseHint) {\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels().closeHint }}</kbd>\n }\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\" [class.rr-cp-sr-only]=\"!config.showSectionLabels\" [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 && config.highlightMatches) {<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 (keysOf(row.item.command).length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of keysOf(row.item.command); 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 </div>\n }\n\n <!-- prettier-ignore -->\n <div [class.rr-cp-status]=\"config.showStatus\" [class.rr-cp-sr-only]=\"!config.showStatus\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
1216
|
+
styles: [":where(.rr-cp){--rr-cp-font: system-ui, -apple-system, \"Segoe UI\", Roboto, sans-serif;--rr-cp-font-size: .9375rem;--rr-cp-width: 640px;--rr-cp-max-height: min(420px, 60vh);--rr-cp-top: 12vh;--rr-cp-radius: 12px;--rr-cp-item-radius: 8px;--rr-cp-z-index: 1000;--rr-cp-bg: #ffffff;--rr-cp-fg: #18181b;--rr-cp-muted: #686872;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:var(--rr-cp-search-gap, 10px);padding:var(--rr-cp-search-padding, 0 14px);border-bottom:1px solid var(--rr-cp-border)}.rr-cp-path{display:flex;align-items:center;gap:4px;padding:10px 14px 0;color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-path button{display:inline-flex;align-items:center;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer}.rr-cp-path button:hover{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-fg)}.rr-cp-path button:focus-visible{outline:2px solid var(--rr-cp-accent);outline-offset:1px}.rr-cp-path-current{padding:2px 6px;color:var(--rr-cp-fg);font-weight:600}.rr-cp-chevron,.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp .rr-cp-input{flex:1;min-width:0;height:var(--rr-cp-input-height, 52px);margin:0;padding:0;border:0;border-radius:0;outline:0;background:transparent;box-shadow:none;appearance:none;color:inherit;font:inherit;font-size:var(--rr-cp-input-font-size, 1rem)}.rr-cp .rr-cp-input:focus-visible{outline:var(--rr-cp-input-focus-outline, none)}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:var(--rr-cp-list-padding, 6px);scroll-padding:var(--rr-cp-list-padding, 6px)}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:var(--rr-cp-item-gap, 10px);min-height:40px;padding:var(--rr-cp-item-padding, 6px 10px);border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-item-active-fg, var(--rr-cp-fg));box-shadow:var(--rr-cp-item-active-shadow, inset 2px 0 0 var(--rr-cp-accent))}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-label{font-weight:var(--rr-cp-label-weight, inherit)}.rr-cp-description{color:var(--rr-cp-description-color, var(--rr-cp-muted));font-size:var(--rr-cp-description-size, .8125rem);opacity:var(--rr-cp-description-opacity, 1)}.rr-cp-match{padding:0;background:var(--rr-cp-highlight-bg);color:var(--rr-cp-highlight);font-weight:var(--rr-cp-match-weight, 600)}.rr-cp-shortcut{display:inline-flex;flex:none;gap:4px}.rr-cp kbd{display:inline-flex;align-items:center;justify-content:center;min-width:20px;height:20px;padding:0 5px;box-sizing:border-box;border:1px solid var(--rr-cp-border);border-radius:4px;background:var(--rr-cp-kbd-bg);color:var(--rr-cp-kbd-fg);font-family:inherit;font-size:.6875rem;font-weight:500}.rr-cp-status{padding:var(--rr-cp-status-padding, 8px 14px);border-top:1px solid var(--rr-cp-border);color:var(--rr-cp-muted);font-size:var(--rr-cp-status-size, .75rem)}.rr-cp-empty{padding:32px 16px;color:var(--rr-cp-muted);text-align:center}.rr-cp-spinner{flex:none;width:14px;height:14px;border:2px solid var(--rr-cp-border);border-top-color:var(--rr-cp-accent);border-radius:50%;animation:rr-cp-spin .7s linear infinite}.rr-cp-sr-only{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}@keyframes rr-cp-fade{0%{opacity:0}}@keyframes rr-cp-pop{0%{opacity:0;transform:scale(.98) translateY(-4px)}}@keyframes rr-cp-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.rr-cp,.rr-cp-dialog{animation:none}.rr-cp-spinner{animation-duration:2s}}@media(max-width:480px){:where(.rr-cp){--rr-cp-top: 8px;--rr-cp-max-height: calc(100dvh - 90px) }.rr-cp-shortcut{display:none}}@media(forced-colors:active){.rr-cp-item-active{outline:2px solid Highlight}.rr-cp-match{text-decoration:underline}}\n"]
|
|
1212
1217
|
}]
|
|
1213
1218
|
}],
|
|
1214
1219
|
ctorParameters: () => [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"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/shortcut.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/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 pinned: string;\n /** Announced when a command asks for a value. `{name}` is the command label. */\n readonly prompt: 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\n/**\n * A mode entered by starting the search with `prefix` (e.g. `>` for actions). The prefix is removed from\n * the search text and only the commands that satisfy every given condition are listed.\n */\nexport interface CommandPrefix {\n /** Text the search must start with, e.g. `>` or `/`. */\n readonly prefix: string;\n /** Only commands (and async providers) of these sections. */\n readonly groups?: readonly string[];\n /** Only route commands or only commands that run a function. */\n readonly kind?: 'route' | 'action';\n}\n\nexport interface CommandPaletteRecentOptions {\n /** Max number of recents shown. Default: 5. */\n readonly max?: number;\n /**\n * `recent` (default) lists the last executed commands. `frequent` ranks them by how often and how\n * recently they were executed (the count halves every 7 days), and drops the lowest ranked one\n * when the list is full.\n */\n readonly rank?: 'recent' | 'frequent';\n /** Storage key. Default: `rr-cp:recent`. */\n readonly storageKey?: string;\n /**\n * Where recents are saved. Default: `localStorage` (none during SSR or when it is blocked). Pass\n * `sessionStorage` or any object with the same three synchronous methods, e.g. an in-memory one.\n * Errors thrown by it are swallowed: recents just stay in memory.\n */\n readonly storage?: RecentStorage | null;\n /**\n * Turns the recents on or off at runtime (boolean, function or signal; default `true`). While off the\n * section is hidden, the list in memory is empty and executions are neither recorded nor saved. What\n * is already in the storage is kept (use `clearRecent()` to remove it); turning it on again reloads it.\n * `recent: false` disables the feature for good.\n */\n readonly enabled?: boolean | (() => boolean);\n}\n\n/** Minimal synchronous storage for recent commands. `localStorage` and `sessionStorage` fit. */\nexport type RecentStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;\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 /**\n * Whether shortcuts that use Ctrl/⌘ still fire while typing in an input, textarea, select or\n * contenteditable (this also applies to command `hotkey`s). Default: `true`.\n */\n readonly shortcutInFields: boolean;\n /**\n * Turns the shortcut off while `false`: it no longer opens the palette (an open palette can still be\n * closed with it), but `open()` keeps working. A function or a signal is read on every key press.\n * Default: `true`.\n */\n readonly shortcutEnabled: boolean | (() => boolean);\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 /** Search modes triggered by a leading character, e.g. `[{ prefix: '>', kind: 'action' }]`. Default: none. */\n readonly prefixes: readonly CommandPrefix[];\n /** The static texts (the defaults plus the `labels` object given, if any). */\n readonly labels: CommandPaletteLabels;\n /**\n * Set when `labels` was given as a function or a signal: read reactively on top of `labels`, so\n * signals read inside it (e.g. the current language) update the open palette.\n */\n readonly labelsSource?: () => Partial<CommandPaletteLabels>;\n}\n\nexport type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {\n readonly labels?: Partial<CommandPaletteLabels> | (() => 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 pinned: 'Pinned',\n prompt: '{name}: type a value and press Enter',\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 shortcutInFields: true,\n shortcutEnabled: true,\n theme: 'auto',\n recent: { max: 5, storageKey: 'rr-cp:recent' },\n debounceMs: 200,\n maxResults: 50,\n maxEmptyResults: 100,\n filter: matchCommand,\n prefixes: [],\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: {\n ...DEFAULT_COMMAND_PALETTE_LABELS,\n ...(typeof options.labels === 'function' ? undefined : options.labels),\n },\n ...(typeof options.labels === 'function' ? { labelsSource: options.labels } : {}),\n };\n}\n\n/** The labels in use: the static ones plus whatever a `labels` function returns right now. */\nexport function currentLabels(config: CommandPaletteConfig): CommandPaletteLabels {\n return config.labelsSource ? { ...config.labels, ...config.labelsSource() } : config.labels;\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\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 type { Command } from './command.model';\nimport type { RecentStorage } from './config';\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 /** Times executed (used by the `frequent` ranking). */\n readonly count?: number;\n /** When it was last executed, in ms since the epoch. */\n readonly at?: number;\n}\n\n/**\n * Recent commands in `localStorage` or a custom storage (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: RecentStorage | null = defaultStorage(),\n private readonly rank: 'recent' | 'frequent' = 'recent',\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 this.order(parsed.filter(isEntry), Date.now()).slice(0, this.max);\n } catch {\n return [];\n }\n }\n\n /** Records an execution of `command` and returns the new list (most relevant first). */\n add(\n command: Command,\n current: readonly RecentEntry[] = this.load(),\n now = Date.now(),\n ): RecentEntry[] {\n if (this.max <= 0) return [];\n const previous = current.find((e) => e.id === command.id);\n const entry: RecentEntry = {\n id: command.id,\n label: command.label,\n ...(this.rank === 'frequent'\n ? { count: (previous?.count ?? (previous ? 1 : 0)) + 1, at: now }\n : {}),\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 = this.order([entry, ...current.filter((e) => e.id !== command.id)], now).slice(\n 0,\n this.max,\n );\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 /** `recent`: the given order (newest first). `frequent`: by score, newest first on a tie. */\n private order(entries: RecentEntry[], now: number): RecentEntry[] {\n if (this.rank !== 'frequent') return entries;\n return entries\n .map((entry, index) => ({ entry, index, score: frecency(entry, now) }))\n .sort((a, b) => b.score - a.score || a.index - b.index)\n .map((x) => x.entry);\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\nconst HALF_LIFE_MS = 7 * 24 * 3600 * 1000;\n\n/** Executions weighted by recency: the weight halves every 7 days. Entries without data count once, now. */\nexport function frecency(entry: RecentEntry, now: number): number {\n const age = entry.at === undefined ? 0 : Math.max(0, now - entry.at);\n return (entry.count ?? 1) * Math.pow(0.5, age / HALF_LIFE_MS);\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 linkedSignal,\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 ActionCommand,\n ParentCommand,\n} from './command.model';\nimport {\n COMMAND_PALETTE_CONFIG,\n currentLabels,\n type CommandPaletteRecentOptions,\n type CommandPrefix,\n} from './config';\nimport { fuzzyMatch, highlightSegments } from './fuzzy';\nimport { matchesShortcut, parseShortcut } from './shortcut';\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';\nexport const PINNED_SECTION_ID = 'pinned';\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 /** The texts in use (see the `labels` option); follows a function or signal given there. */\n readonly labels = computed(() => currentLabels(this.config));\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 (this.config.recent as CommandPaletteRecentOptions).storage,\n (this.config.recent as CommandPaletteRecentOptions).rank,\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 /** Recents on: not `recent: false` and `recent.enabled` (boolean, function or signal) not false. */\n private readonly recentsOn = computed(() => {\n if (!this.recentStore) return false;\n const enabled = (this.config.recent as CommandPaletteRecentOptions).enabled ?? true;\n return typeof enabled === 'function' ? enabled() : enabled;\n });\n // Reloaded from the storage whenever the recents are switched on, emptied when switched off\n private readonly recents = linkedSignal<boolean, readonly RecentEntry[]>({\n source: this.recentsOn,\n computation: (on) => (on ? (this.recentStore?.load() ?? []) : []),\n });\n private readonly pending = new Map<string, PendingRequest>();\n private readonly pathIds = signal<readonly string[]>([]);\n private readonly promptCommand = signal<ActionCommand | null>(null);\n private returnFocus: HTMLElement | null = null;\n\n /** Whether the palette is open. */\n readonly isOpen = this._isOpen.asReadonly();\n /** The command asking for a value (see `prompt`), while its second step is shown. */\n readonly prompt = this.promptCommand.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 /** The search mode (see the `prefixes` option) the current search starts with, if any. */\n readonly activePrefix: Signal<CommandPrefix | null> = computed(\n () => this.parseQuery(this._query()).prefix,\n );\n\n /** Sections shown in the list, already filtered and sorted. */\n readonly sections: Signal<readonly CommandSection[]> = computed(() =>\n this.buildSections(this._query()),\n );\n\n /** Leaf commands with a `hotkey`, not hidden. */\n private readonly hotkeyCommands = computed(() =>\n descendants(this.commands()).filter((c) => c.hotkey && !isParent(c)),\n );\n\n /**\n * Runs the command bound to the key event, if any (called by the component for every keydown).\n * Returns true when a command matched, so the caller can `preventDefault()`.\n */\n runHotkey(event: KeyboardEvent, apple: boolean): boolean {\n if (this._isOpen()) return false;\n for (const command of this.hotkeyCommands()) {\n const keys = typeof command.hotkey === 'string' ? [command.hotkey] : (command.hotkey ?? []);\n if (!keys.some((k) => matchesShortcut(event, parseShortcut(k), apple))) continue;\n if (command.disabled) return false;\n void this.execute(command);\n return true;\n }\n return false;\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.promptCommand.set(null);\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.promptCommand.set(null);\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 or value step (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 let remaining = levels;\n if (levels < 1 || !(path.length || this.promptCommand())) return false;\n if (this.promptCommand()) {\n this.promptCommand.set(null);\n remaining--;\n }\n if (remaining > 0) {\n this.pathIds.set(path.slice(0, Math.max(0, path.length - remaining)).map((c) => c.id));\n }\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.promptCommand())\n 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 let query = this.parseQuery(this._query()).text;\n let value: string | undefined;\n if (!isParent(command) && command.prompt !== undefined) {\n if (this.promptCommand()?.id !== command.id) {\n // First step: ask for the value\n this.cancelAll();\n this.providerState.set(new Map());\n this.promptCommand.set(command as ActionCommand);\n this.setQuery('');\n return;\n }\n query = value = this._query().trim();\n if (!value) return;\n }\n if (this.recentStore && this.recentsOn())\n 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(value === undefined ? { query } : { query, value });\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 /** Splits the raw search into the mode it starts with (if any) and the text to search. */\n private parseQuery(raw: string): { prefix: CommandPrefix | null; text: string } {\n const trimmed = raw.trim();\n const prefix =\n this.config.prefixes.find((p) => p.prefix && trimmed.startsWith(p.prefix)) ?? null;\n return { prefix, text: prefix ? trimmed.slice(prefix.prefix.length).trim() : trimmed };\n }\n\n private buildSections(rawQuery: string): CommandSection[] {\n const defaultGroup = this.labels().defaultGroup;\n const prompt = this.promptCommand();\n if (prompt) {\n const items = [toResult(prompt, `x:${prompt.id}`, 0, [])];\n return [{ id: 'prompt', label: prompt.group ?? defaultGroup, items }];\n }\n const { prefix, text: query } = this.parseQuery(rawQuery);\n const levelCommands = this.levelCommands();\n const commands = prefix\n ? levelCommands.filter((c) => inPrefix(c, prefix, defaultGroup))\n : 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 pinned = prefix\n ? []\n : commands\n .filter((c) => !isHidden(c) && isPinned(c))\n .map((c) => toResult(c, `pin:${c.id}`, 0, []));\n if (pinned.length)\n sections.push({ id: PINNED_SECTION_ID, label: this.labels().pinned, items: pinned });\n const pinnedIds = new Set(pinned.map((r) => r.command.id));\n const recent =\n topLevel && !prefix\n ? this.recentResults(commands).filter((r) => !pinnedIds.has(r.command.id))\n : [];\n if (recent.length)\n sections.push({ id: RECENT_SECTION_ID, label: this.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 if (prefix && (prefix.kind || (prefix.groups && !prefix.groups.includes(provider.group))))\n continue;\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 || !this.recentsOn()) 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 || this.promptCommand()) 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 { prefix, text: query } = this.parseQuery(rawQuery);\n if (prefix && (prefix.kind || (prefix.groups && !prefix.groups.includes(provider.group)))) {\n this.setProviderState(provider.id, null);\n return;\n }\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 inPrefix(command: Command, prefix: CommandPrefix, defaultGroup: string): boolean {\n if (prefix.groups && !prefix.groups.includes(command.group ?? defaultGroup)) return false;\n if (prefix.kind === 'route') return command.route !== undefined;\n if (prefix.kind === 'action') return typeof command.run === 'function';\n return true;\n}\n\nfunction isPinned(command: Command): boolean {\n const { pinned } = command;\n return typeof pinned === 'function' ? pinned() : !!pinned;\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\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.service.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 private shortcutEnabled(): boolean {\n const enabled = this.config.shortcutEnabled;\n return typeof enabled === 'function' ? enabled() : enabled;\n }\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 /** Keys shown on a row: `shortcut`, or the formatted `hotkey` when there is no `shortcut`. */\n protected keysOf(command: Command): readonly string[] {\n if (command.shortcut?.length) return command.shortcut;\n const hotkey = typeof command.hotkey === 'string' ? command.hotkey : command.hotkey?.[0];\n return hotkey ? [formatShortcut(parseShortcut(hotkey), 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 prompt = this.service.prompt();\n if (prompt) return this.labels().prompt.replace('{name}', prompt.label);\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 /** Sub-palettes opened plus, last, the command waiting for a value. Shown as the path above the search. */\n protected readonly crumbs = computed<readonly Command[]>(() => {\n const prompt = this.service.prompt();\n return prompt ? [...this.service.path(), prompt] : this.service.path();\n });\n protected readonly placeholder = computed(\n () => this.service.prompt()?.prompt ?? this.labels().placeholder,\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.crumbs().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 // Command hotkeys need a modifier. Alt alone is ignored in a text field: on macOS it types\n // special characters (Alt+T is \"†\"), so it must not be swallowed there. Ctrl and ⌘ never type.\n const typing = isEditable(event.target);\n const fieldsAllowed = this.config.shortcutInFields || !typing;\n const hotkeyAllowed =\n fieldsAllowed && (event.ctrlKey || event.metaKey || (event.altKey && !typing));\n if (hotkeyAllowed && this.service.runHotkey(event, this.apple)) {\n event.preventDefault();\n return;\n }\n // Shortcuts without Ctrl/⌘/Alt (e.g. \"/\") never fire while typing in a field; with\n // `shortcutInFields: false` the ones with Ctrl/⌘ do not either\n const hit = this.shortcuts.some(\n (s) =>\n (!typing || (this.config.shortcutInFields && (s.mod || s.ctrl || s.meta || s.alt))) &&\n matchesShortcut(event, s, this.apple),\n );\n // `shortcutEnabled` only stops it from opening: an open palette can always be closed\n if (hit && (this.service.isOpen() || this.shortcutEnabled())) {\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 (crumbs(); 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]=\"placeholder()\"\n [placeholder]=\"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 (keysOf(row.item.command).length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of keysOf(row.item.command); 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 </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n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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;AA+OvE,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"}
|
|
1
|
+
{"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/shortcut.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/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 pinned: string;\n /** Announced when a command asks for a value. `{name}` is the command label. */\n readonly prompt: string;\n readonly defaultGroup: string;\n /** Screen reader announcement, `{count}` is replaced by the number of results. */\n readonly results: string;\n /** Same as `results` for exactly one result. Default: `results` is used. */\n readonly resultsOne?: 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 /** Same as `level` for exactly one result. Default: `level` is used. */\n readonly levelOne?: 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\n/**\n * A mode entered by starting the search with `prefix` (e.g. `>` for actions). The prefix is removed from\n * the search text and only the commands that satisfy every given condition are listed.\n */\nexport interface CommandPrefix {\n /** Text the search must start with, e.g. `>` or `/`. */\n readonly prefix: string;\n /** Only commands (and async providers) of these sections. */\n readonly groups?: readonly string[];\n /** Only route commands or only commands that run a function. */\n readonly kind?: 'route' | 'action';\n}\n\nexport interface CommandPaletteRecentOptions {\n /** Max number of recents shown. Default: 5. */\n readonly max?: number;\n /**\n * `recent` (default) lists the last executed commands. `frequent` ranks them by how often and how\n * recently they were executed (the count halves every 7 days), and drops the lowest ranked one\n * when the list is full.\n */\n readonly rank?: 'recent' | 'frequent';\n /** Storage key. Default: `rr-cp:recent`. */\n readonly storageKey?: string;\n /**\n * Where recents are saved. Default: `localStorage` (none during SSR or when it is blocked). Pass\n * `sessionStorage` or any object with the same three synchronous methods, e.g. an in-memory one.\n * Errors thrown by it are swallowed: recents just stay in memory.\n */\n readonly storage?: RecentStorage | null;\n /**\n * Turns the recents on or off at runtime (boolean, function or signal; default `true`). While off the\n * section is hidden, the list in memory is empty and executions are neither recorded nor saved. What\n * is already in the storage is kept (use `clearRecent()` to remove it); turning it on again reloads it.\n * `recent: false` disables the feature for good.\n */\n readonly enabled?: boolean | (() => boolean);\n}\n\n/** Minimal synchronous storage for recent commands. `localStorage` and `sessionStorage` fit. */\nexport type RecentStorage = Pick<Storage, 'getItem' | 'setItem' | 'removeItem'>;\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 /**\n * Whether shortcuts that use Ctrl/⌘ still fire while typing in an input, textarea, select or\n * contenteditable (this also applies to command `hotkey`s). Default: `true`.\n */\n readonly shortcutInFields: boolean;\n /**\n * Turns the shortcut off while `false`: it no longer opens the palette (an open palette can still be\n * closed with it), but `open()` keeps working. A function or a signal is read on every key press.\n * Default: `true`.\n */\n readonly shortcutEnabled: boolean | (() => boolean);\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 /** Search modes triggered by a leading character, e.g. `[{ prefix: '>', kind: 'action' }]`. Default: none. */\n readonly prefixes: readonly CommandPrefix[];\n /**\n * Shows the section headings (Recent, Pinned, groups). With `false` they are visually hidden but the\n * groups keep their accessible name. Default: `true`.\n */\n readonly showSectionLabels: boolean;\n /** Shows the close key hint (`labels.closeHint`, Esc) in the search field. Default: `true`. */\n readonly showCloseHint: boolean;\n /** Highlights the characters matched by the search. Default: `true`. */\n readonly highlightMatches: boolean;\n /**\n * Shows the status line (e.g. \"3 results\", by default only for screen readers) at the bottom of the\n * window, with the class `rr-cp-status`. It stays an `aria-live` region either way. Default: `false`.\n */\n readonly showStatus: boolean;\n /** The static texts (the defaults plus the `labels` object given, if any). */\n readonly labels: CommandPaletteLabels;\n /**\n * Set when `labels` was given as a function or a signal: read reactively on top of `labels`, so\n * signals read inside it (e.g. the current language) update the open palette.\n */\n readonly labelsSource?: () => Partial<CommandPaletteLabels>;\n}\n\nexport type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {\n readonly labels?: Partial<CommandPaletteLabels> | (() => 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 pinned: 'Pinned',\n prompt: '{name}: type a value and press Enter',\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 shortcutInFields: true,\n shortcutEnabled: true,\n theme: 'auto',\n recent: { max: 5, storageKey: 'rr-cp:recent' },\n debounceMs: 200,\n maxResults: 50,\n maxEmptyResults: 100,\n filter: matchCommand,\n prefixes: [],\n showSectionLabels: true,\n showCloseHint: true,\n highlightMatches: true,\n showStatus: false,\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: {\n ...DEFAULT_COMMAND_PALETTE_LABELS,\n ...(typeof options.labels === 'function' ? undefined : options.labels),\n },\n ...(typeof options.labels === 'function' ? { labelsSource: options.labels } : {}),\n };\n}\n\n/** The labels in use: the static ones plus whatever a `labels` function returns right now. */\nexport function currentLabels(config: CommandPaletteConfig): CommandPaletteLabels {\n return config.labelsSource ? { ...config.labels, ...config.labelsSource() } : config.labels;\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\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 type { Command } from './command.model';\nimport type { RecentStorage } from './config';\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 /** Times executed (used by the `frequent` ranking). */\n readonly count?: number;\n /** When it was last executed, in ms since the epoch. */\n readonly at?: number;\n}\n\n/**\n * Recent commands in `localStorage` or a custom storage (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: RecentStorage | null = defaultStorage(),\n private readonly rank: 'recent' | 'frequent' = 'recent',\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 this.order(parsed.filter(isEntry), Date.now()).slice(0, this.max);\n } catch {\n return [];\n }\n }\n\n /** Records an execution of `command` and returns the new list (most relevant first). */\n add(\n command: Command,\n current: readonly RecentEntry[] = this.load(),\n now = Date.now(),\n ): RecentEntry[] {\n if (this.max <= 0) return [];\n const previous = current.find((e) => e.id === command.id);\n const entry: RecentEntry = {\n id: command.id,\n label: command.label,\n ...(this.rank === 'frequent'\n ? { count: (previous?.count ?? (previous ? 1 : 0)) + 1, at: now }\n : {}),\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 = this.order([entry, ...current.filter((e) => e.id !== command.id)], now).slice(\n 0,\n this.max,\n );\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 /** `recent`: the given order (newest first). `frequent`: by score, newest first on a tie. */\n private order(entries: RecentEntry[], now: number): RecentEntry[] {\n if (this.rank !== 'frequent') return entries;\n return entries\n .map((entry, index) => ({ entry, index, score: frecency(entry, now) }))\n .sort((a, b) => b.score - a.score || a.index - b.index)\n .map((x) => x.entry);\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\nconst HALF_LIFE_MS = 7 * 24 * 3600 * 1000;\n\n/** Executions weighted by recency: the weight halves every 7 days. Entries without data count once, now. */\nexport function frecency(entry: RecentEntry, now: number): number {\n const age = entry.at === undefined ? 0 : Math.max(0, now - entry.at);\n return (entry.count ?? 1) * Math.pow(0.5, age / HALF_LIFE_MS);\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 linkedSignal,\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 ActionCommand,\n ParentCommand,\n} from './command.model';\nimport {\n COMMAND_PALETTE_CONFIG,\n currentLabels,\n type CommandPaletteRecentOptions,\n type CommandPrefix,\n} from './config';\nimport { fuzzyMatch, highlightSegments } from './fuzzy';\nimport { matchesShortcut, parseShortcut } from './shortcut';\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';\nexport const PINNED_SECTION_ID = 'pinned';\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 /** The texts in use (see the `labels` option); follows a function or signal given there. */\n readonly labels = computed(() => currentLabels(this.config));\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 (this.config.recent as CommandPaletteRecentOptions).storage,\n (this.config.recent as CommandPaletteRecentOptions).rank,\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 /** Recents on: not `recent: false` and `recent.enabled` (boolean, function or signal) not false. */\n private readonly recentsOn = computed(() => {\n if (!this.recentStore) return false;\n const enabled = (this.config.recent as CommandPaletteRecentOptions).enabled ?? true;\n return typeof enabled === 'function' ? enabled() : enabled;\n });\n // Reloaded from the storage whenever the recents are switched on, emptied when switched off\n private readonly recents = linkedSignal<boolean, readonly RecentEntry[]>({\n source: this.recentsOn,\n computation: (on) => (on ? (this.recentStore?.load() ?? []) : []),\n });\n private readonly pending = new Map<string, PendingRequest>();\n private readonly pathIds = signal<readonly string[]>([]);\n private readonly promptCommand = signal<ActionCommand | null>(null);\n private returnFocus: HTMLElement | null = null;\n\n /** Whether the palette is open. */\n readonly isOpen = this._isOpen.asReadonly();\n /** The command asking for a value (see `prompt`), while its second step is shown. */\n readonly prompt = this.promptCommand.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 /** The search mode (see the `prefixes` option) the current search starts with, if any. */\n readonly activePrefix: Signal<CommandPrefix | null> = computed(\n () => this.parseQuery(this._query()).prefix,\n );\n\n /** Sections shown in the list, already filtered and sorted. */\n readonly sections: Signal<readonly CommandSection[]> = computed(() =>\n this.buildSections(this._query()),\n );\n\n /** Leaf commands with a `hotkey`, not hidden. */\n private readonly hotkeyCommands = computed(() =>\n descendants(this.commands()).filter((c) => c.hotkey && !isParent(c)),\n );\n\n /**\n * Runs the command bound to the key event, if any (called by the component for every keydown).\n * Returns true when a command matched, so the caller can `preventDefault()`.\n */\n runHotkey(event: KeyboardEvent, apple: boolean): boolean {\n if (this._isOpen()) return false;\n for (const command of this.hotkeyCommands()) {\n const keys = typeof command.hotkey === 'string' ? [command.hotkey] : (command.hotkey ?? []);\n if (!keys.some((k) => matchesShortcut(event, parseShortcut(k), apple))) continue;\n if (command.disabled) return false;\n void this.execute(command);\n return true;\n }\n return false;\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.promptCommand.set(null);\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.promptCommand.set(null);\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 or value step (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 let remaining = levels;\n if (levels < 1 || !(path.length || this.promptCommand())) return false;\n if (this.promptCommand()) {\n this.promptCommand.set(null);\n remaining--;\n }\n if (remaining > 0) {\n this.pathIds.set(path.slice(0, Math.max(0, path.length - remaining)).map((c) => c.id));\n }\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.promptCommand())\n 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 let query = this.parseQuery(this._query()).text;\n let value: string | undefined;\n if (!isParent(command) && command.prompt !== undefined) {\n if (this.promptCommand()?.id !== command.id) {\n // First step: ask for the value\n this.cancelAll();\n this.providerState.set(new Map());\n this.promptCommand.set(command as ActionCommand);\n this.setQuery('');\n return;\n }\n query = value = this._query().trim();\n if (!value) return;\n }\n if (this.recentStore && this.recentsOn())\n 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(value === undefined ? { query } : { query, value });\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 /** Splits the raw search into the mode it starts with (if any) and the text to search. */\n private parseQuery(raw: string): { prefix: CommandPrefix | null; text: string } {\n const trimmed = raw.trim();\n const prefix =\n this.config.prefixes.find((p) => p.prefix && trimmed.startsWith(p.prefix)) ?? null;\n return { prefix, text: prefix ? trimmed.slice(prefix.prefix.length).trim() : trimmed };\n }\n\n private buildSections(rawQuery: string): CommandSection[] {\n const defaultGroup = this.labels().defaultGroup;\n const prompt = this.promptCommand();\n if (prompt) {\n const items = [toResult(prompt, `x:${prompt.id}`, 0, [])];\n return [{ id: 'prompt', label: prompt.group ?? defaultGroup, items }];\n }\n const { prefix, text: query } = this.parseQuery(rawQuery);\n const levelCommands = this.levelCommands();\n const commands = prefix\n ? levelCommands.filter((c) => inPrefix(c, prefix, defaultGroup))\n : 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 pinned = prefix\n ? []\n : commands\n .filter((c) => !isHidden(c) && isPinned(c))\n .map((c) => toResult(c, `pin:${c.id}`, 0, []));\n if (pinned.length)\n sections.push({ id: PINNED_SECTION_ID, label: this.labels().pinned, items: pinned });\n const pinnedIds = new Set(pinned.map((r) => r.command.id));\n const recent =\n topLevel && !prefix\n ? this.recentResults(commands).filter((r) => !pinnedIds.has(r.command.id))\n : [];\n if (recent.length)\n sections.push({ id: RECENT_SECTION_ID, label: this.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 if (prefix && (prefix.kind || (prefix.groups && !prefix.groups.includes(provider.group))))\n continue;\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 || !this.recentsOn()) 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 || this.promptCommand()) 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 { prefix, text: query } = this.parseQuery(rawQuery);\n if (prefix && (prefix.kind || (prefix.groups && !prefix.groups.includes(provider.group)))) {\n this.setProviderState(provider.id, null);\n return;\n }\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 inPrefix(command: Command, prefix: CommandPrefix, defaultGroup: string): boolean {\n if (prefix.groups && !prefix.groups.includes(command.group ?? defaultGroup)) return false;\n if (prefix.kind === 'route') return command.route !== undefined;\n if (prefix.kind === 'action') return typeof command.run === 'function';\n return true;\n}\n\nfunction isPinned(command: Command): boolean {\n const { pinned } = command;\n return typeof pinned === 'function' ? pinned() : !!pinned;\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\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 // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\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 // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\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.service.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 private shortcutEnabled(): boolean {\n const enabled = this.config.shortcutEnabled;\n return typeof enabled === 'function' ? enabled() : enabled;\n }\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 /** Keys shown on a row: `shortcut`, or the formatted `hotkey` when there is no `shortcut`. */\n protected keysOf(command: Command): readonly string[] {\n if (command.shortcut?.length) return command.shortcut;\n const hotkey = typeof command.hotkey === 'string' ? command.hotkey : command.hotkey?.[0];\n return hotkey ? [formatShortcut(parseShortcut(hotkey), 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 prompt = this.service.prompt();\n if (prompt) return this.labels().prompt.replace('{name}', prompt.label);\n const { level, levelOne, results, resultsOne } = this.labels();\n const template = path.length\n ? count === 1\n ? (levelOne ?? level)\n : level\n : count === 1\n ? (resultsOne ?? results)\n : results;\n return template\n .replace('{name}', path[path.length - 1]?.label ?? '')\n .replace('{count}', String(count));\n });\n /** Sub-palettes opened plus, last, the command waiting for a value. Shown as the path above the search. */\n protected readonly crumbs = computed<readonly Command[]>(() => {\n const prompt = this.service.prompt();\n return prompt ? [...this.service.path(), prompt] : this.service.path();\n });\n protected readonly placeholder = computed(\n () => this.service.prompt()?.prompt ?? this.labels().placeholder,\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.crumbs().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 // Command hotkeys need a modifier. Alt alone is ignored in a text field: on macOS it types\n // special characters (Alt+T is \"†\"), so it must not be swallowed there. Ctrl and ⌘ never type.\n const typing = isEditable(event.target);\n const fieldsAllowed = this.config.shortcutInFields || !typing;\n const hotkeyAllowed =\n fieldsAllowed && (event.ctrlKey || event.metaKey || (event.altKey && !typing));\n if (hotkeyAllowed && this.service.runHotkey(event, this.apple)) {\n event.preventDefault();\n return;\n }\n // Shortcuts without Ctrl/⌘/Alt (e.g. \"/\") never fire while typing in a field; with\n // `shortcutInFields: false` the ones with Ctrl/⌘ do not either\n const hit = this.shortcuts.some(\n (s) =>\n (!typing || (this.config.shortcutInFields && (s.mod || s.ctrl || s.meta || s.alt))) &&\n matchesShortcut(event, s, this.apple),\n );\n // `shortcutEnabled` only stops it from opening: an open palette can always be closed\n if (hit && (this.service.isOpen() || this.shortcutEnabled())) {\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 (crumbs(); 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]=\"placeholder()\"\n [placeholder]=\"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 @if (config.showCloseHint) {\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels().closeHint }}</kbd>\n }\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\" [class.rr-cp-sr-only]=\"!config.showSectionLabels\" [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 && config.highlightMatches) {<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 (keysOf(row.item.command).length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of keysOf(row.item.command); 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 </div>\n }\n\n <!-- prettier-ignore -->\n <div [class.rr-cp-status]=\"config.showStatus\" [class.rr-cp-sr-only]=\"!config.showStatus\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n"],"mappings":";;;;AAaA,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;AAC3B,MAAM,cAAc;AACpB,MAAM,kBAAkB;AACxB,MAAM,6BAAa,IAAI,IAAI;CAAC;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;CAAK;AAAG,CAAC;AAGxE,SAAS,KAAK,MAAY;CAExB,QADa,KAAK,UAAU,KAAK,CAAC,CAAC,QAAQ,WAAW,EAC9C,CAAA,CAAK,MAA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CAAA;CAAA;AAAA,CAAA;AAsPvE,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.
|
|
3
|
+
"version": "0.7.1",
|
|
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",
|
|
@@ -153,11 +153,15 @@ interface CommandPaletteLabels {
|
|
|
153
153
|
readonly defaultGroup: string;
|
|
154
154
|
/** Screen reader announcement, `{count}` is replaced by the number of results. */
|
|
155
155
|
readonly results: string;
|
|
156
|
+
/** Same as `results` for exactly one result. Default: `results` is used. */
|
|
157
|
+
readonly resultsOne?: string;
|
|
156
158
|
readonly closeHint: string;
|
|
157
159
|
/** Label of the button that goes back one level of a sub-palette. */
|
|
158
160
|
readonly back: string;
|
|
159
161
|
/** Screen reader announcement when a sub-palette is opened; `{name}` and `{count}` are replaced. */
|
|
160
162
|
readonly level: string;
|
|
163
|
+
/** Same as `level` for exactly one result. Default: `level` is used. */
|
|
164
|
+
readonly levelOne?: string;
|
|
161
165
|
/** Screen reader hint added to a command that opens a sub-palette. */
|
|
162
166
|
readonly submenu: string;
|
|
163
167
|
}
|
|
@@ -237,6 +241,20 @@ interface CommandPaletteConfig {
|
|
|
237
241
|
readonly filter: CommandFilter;
|
|
238
242
|
/** Search modes triggered by a leading character, e.g. `[{ prefix: '>', kind: 'action' }]`. Default: none. */
|
|
239
243
|
readonly prefixes: readonly CommandPrefix[];
|
|
244
|
+
/**
|
|
245
|
+
* Shows the section headings (Recent, Pinned, groups). With `false` they are visually hidden but the
|
|
246
|
+
* groups keep their accessible name. Default: `true`.
|
|
247
|
+
*/
|
|
248
|
+
readonly showSectionLabels: boolean;
|
|
249
|
+
/** Shows the close key hint (`labels.closeHint`, Esc) in the search field. Default: `true`. */
|
|
250
|
+
readonly showCloseHint: boolean;
|
|
251
|
+
/** Highlights the characters matched by the search. Default: `true`. */
|
|
252
|
+
readonly highlightMatches: boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Shows the status line (e.g. "3 results", by default only for screen readers) at the bottom of the
|
|
255
|
+
* window, with the class `rr-cp-status`. It stays an `aria-live` region either way. Default: `false`.
|
|
256
|
+
*/
|
|
257
|
+
readonly showStatus: boolean;
|
|
240
258
|
/** The static texts (the defaults plus the `labels` object given, if any). */
|
|
241
259
|
readonly labels: CommandPaletteLabels;
|
|
242
260
|
/**
|