@rrstudioapps/ngx-command-palette 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -138,23 +138,29 @@ injectCommandProvider({
138
138
 
139
139
  ### `provideCommandPalette(options?)`
140
140
 
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. |
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
+ | `shortcutPreventDefault` | `boolean` | `true` | With `false` the shortcut does not call `preventDefault()` on the key event. |
147
+ | `closeOnSelect` | `boolean` | `true` | With `false` the palette stays open after a command runs (see [Behavior and events](#behavior-and-events)). A command's `closeOnRun` wins. |
148
+ | `onOpen`, `onClose`, `onRun` | `() => void`, `(reason) => void`, `(command) => void` | none | Event callbacks. `reason` is `'escape' \| 'overlay' \| 'run' \| 'toggle' \| 'api'`. |
149
+ | `restoreFocus` | `boolean \| (() => HTMLElement \| null)` | `true` | Where the focus goes when the palette closes: back to the element that had it before opening (default), nowhere (`false`) or to the element your function returns. See [Behavior and events](#behavior-and-events). |
150
+ | `position` | `'top' \| 'center'` | `'top'` | Vertical position of the window. `--rr-cp-top` applies to `'top'`. |
151
+ | `sectionOrder` | `string[]` | `[]` | Order of the sections while the search is empty: section ids or group names. |
152
+ | `theme` | `'light' \| 'dark' \| 'auto'` | `'auto'` | `auto` follows `prefers-color-scheme`. |
153
+ | `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). |
154
+ | `debounceMs` | `number` | `200` | Debounce for async providers. |
155
+ | `maxResults` | `number` | `50` | Max local results for a non-empty query. |
156
+ | `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). |
157
+ | `filter` | `(query, command) => { score, indices } \| null` | built-in fuzzy search | Your own matching and ranking of local commands. See [Custom search](#custom-search). |
158
+ | `prefixes` | `{ prefix, groups?, kind? }[]` | `[]` | Search modes. See [Prefix modes](#prefix-modes). |
159
+ | `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'`). |
160
+ | `showSectionLabels` | `boolean` | `true` | Shows the section headings (Recent, Pinned, groups). With `false` they are visually hidden and each group keeps its accessible name. |
161
+ | `showCloseHint` | `boolean` | `true` | Shows the close key (`labels.closeHint`, Esc) in the search field. |
162
+ | `highlightMatches` | `boolean` | `true` | Highlights the characters found by the search. |
163
+ | `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. |
158
164
 
159
165
  ### Shortcut, recents and texts
160
166
 
@@ -191,6 +197,31 @@ provideCommandPalette({
191
197
  - **Recents on → off:** the section disappears, the list in memory is emptied and runs are neither recorded nor saved. What is already stored is kept (`clearRecent()` removes it).
192
198
  - **Recents off → on:** the list is loaded again from the storage. If it starts off, the storage is never read. `recent: false` turns the feature off for good.
193
199
 
200
+ ### Behavior and events
201
+
202
+ ```ts
203
+ provideCommandPalette({
204
+ closeOnSelect: false, // the palette stays open after a command runs…
205
+ position: 'center',
206
+ restoreFocus: () => document.querySelector<HTMLElement>('#main'), // or false
207
+ sectionOrder: ['Navigation', 'recent'], // empty search only; Pinned stays on top
208
+ onOpen: () => analytics.track('palette-open'),
209
+ onClose: (reason) => console.log('closed:', reason),
210
+ onRun: (command) => analytics.track('palette-run', { id: command.id }),
211
+ });
212
+
213
+ injectCommands([
214
+ { id: 'theme', label: 'Toggle theme', run: toggleTheme }, // stays open
215
+ { id: 'logout', label: 'Sign out', run: signOut, closeOnRun: true }, // …except this one
216
+ ]);
217
+ ```
218
+
219
+ - **`closeOnSelect` / `closeOnRun`:** a command's `closeOnRun` wins over the option, in both directions. Commands that open a sub-palette or ask for a value never close the palette. A `prompt` command that stays open returns to the list (empty search) after it runs. Recents are recorded either way, and the focus stays in the search field.
220
+ - **Events:** `onOpen` fires when the palette opens (not when `open()` is called while it is already open) and `onClose` when it closes, with the reason: `'escape'` (Esc key), `'overlay'` (click on the backdrop), `'run'` (a command ran), `'toggle'` (the shortcut or `toggle()`), `'api'` (`close()`). `onRun` fires after the command ran or navigated, also for route commands and when the palette stays open. It is not called if the command throws or its promise rejects (the error propagates as before).
221
+ - **`restoreFocus`:** by default the focus returns to the element that had it when the palette opened, which keeps keyboard and screen reader users where they were. `false` leaves it alone (e.g. when a command moves the focus itself). A function such as `restoreFocus: () => document.querySelector<HTMLElement>('#search')` picks the element; if it returns `null`, an element that is no longer in the page or throws (reported with `console.error`), the focus goes back to the original element.
222
+ - **Errors in callbacks** (also a rejected promise they return) are caught and reported with `console.error`: they never break the palette.
223
+ - **`sectionOrder`** lists section ids (`pinned`, `recent`, `g:<group>`, `p:<provider id>`) or plain group names. Listed sections come first in that order; Pinned and Recent stay on top unless listed; the others follow in registration order. A search is never reordered: it is ranked by score.
224
+
194
225
  ### Prefix modes
195
226
 
196
227
  Start the search with a character to narrow the list, like `>` in VS Code. The prefix is removed from the
@@ -278,6 +309,7 @@ injectCommands([
278
309
  | `hotkey` | `string \| string[]?` | Key combination(s) that run the command even when the palette is closed, e.g. `'mod+s'`. It needs Ctrl, ⌘ or Alt; Alt-only combinations do not fire while typing in a text field (on macOS Alt types special characters), Ctrl and ⌘ ones do. Ignored for parents, disabled/hidden commands and while the palette is open. Shown on the row when there is no `shortcut`. |
279
310
  | `keywords` | `string[]?` | Extra search terms, not shown. |
280
311
  | `disabled` | `boolean?` | Shown but not selectable. |
312
+ | `closeOnRun` | `boolean?` | Overrides `closeOnSelect` for this command: `false` keeps the palette open after it runs, `true` closes it even if the option is `false`. Ignored by parents. |
281
313
  | `children` | `Command[]?` | Makes it a parent: selecting it opens a sub-palette with these commands instead of running something. See [Sub-palettes](#sub-palettes). |
282
314
  | `hidden` | `boolean \| (() => boolean)?` | Not listed and not searched. A function or a signal hides it depending on your app state, e.g. `hidden: () => !user()`. |
283
315
  | `pinned` | `boolean \| (() => boolean)?` | Also listed in a "Pinned" section at the top while the search is empty (and not repeated in Recent). A function or a signal pins it depending on your app state. |
@@ -491,6 +523,34 @@ Class names (`rr-cp-dialog`, `rr-cp-item`, `rr-cp-item-active`, `rr-cp-match`, `
491
523
  | `--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
524
  | `--rr-cp-status-padding`, `--rr-cp-status-size` | `8px 14px`, `0.75rem` | Status line shown by `showStatus` |
493
525
 
526
+ **Borders, spacing and sizes.** Same rule: these work set on `:root`, `body` or `.rr-cp`. Border variables take the whole `border` shorthand (width, style, color), so `none` removes them.
527
+
528
+ | Variable | Default | Purpose |
529
+ | ---------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | ---------------------------------------------------------------- |
530
+ | `--rr-cp-gutter` | `16px` | Space between the window and the screen edges (sides and bottom) |
531
+ | `--rr-cp-border-width` | `1px` | Width of the border around the window |
532
+ | `--rr-cp-line-height` | `1.4` | Line height |
533
+ | `--rr-cp-search-border` | `1px solid var(--rr-cp-border)` | Line under the search field |
534
+ | `--rr-cp-status-border` | `1px solid var(--rr-cp-border)` | Line above the status line |
535
+ | `--rr-cp-group-gap`, `--rr-cp-group-border` | `4px`, `none` | Space and optional line (e.g. `1px solid #ddd`) between groups |
536
+ | `--rr-cp-group-label-padding`, `--rr-cp-group-label-size`, `--rr-cp-group-label-weight`, `--rr-cp-group-label-spacing` | `8px 10px 4px`, `0.75rem`, `600`, `0.02em` | Section headings |
537
+ | `--rr-cp-item-min-height`, `--rr-cp-item-disabled-opacity` | `40px`, `0.5` | Rows |
538
+ | `--rr-cp-icon-size` | `20px` | Icon of a row |
539
+ | `--rr-cp-search-icon-size`, `--rr-cp-back-icon-size` | `18px`, `16px` | Magnifier and back arrow |
540
+ | `--rr-cp-kbd-border`, `--rr-cp-kbd-radius` | `1px solid var(--rr-cp-border)`, `4px` | Keys (shortcuts and the close hint) |
541
+ | `--rr-cp-kbd-size`, `--rr-cp-kbd-padding`, `--rr-cp-kbd-gap` | `20px`, `0 5px`, `4px` | Minimum width and height, padding, gap of the keys |
542
+ | `--rr-cp-kbd-font-size`, `--rr-cp-kbd-weight` | `0.6875rem`, `500` | Text of the keys |
543
+ | `--rr-cp-path-gap`, `--rr-cp-path-padding`, `--rr-cp-path-size` | `4px`, `10px 14px 0`, `0.8125rem` | Sub-palette path above the search |
544
+ | `--rr-cp-path-button-padding`, `--rr-cp-path-button-radius`, `--rr-cp-path-current-weight` | `2px 6px`, `6px`, `600` | Buttons of the path and the current level |
545
+ | `--rr-cp-focus-outline`, `--rr-cp-focus-offset` | `2px solid var(--rr-cp-accent)`, `1px` | Focus ring of the path buttons |
546
+ | `--rr-cp-empty-padding` | `32px 16px` | "No results" message |
547
+ | `--rr-cp-spinner-size`, `--rr-cp-spinner-width`, `--rr-cp-spinner-duration` | `14px`, `2px`, `0.7s` | Loading spinner |
548
+ | `--rr-cp-spinner-color`, `--rr-cp-spinner-track` | `var(--rr-cp-accent)`, `var(--rr-cp-border)` | Spinner colors |
549
+
550
+ `position: 'center'` ignores `--rr-cp-top`. For no opening animation set `--rr-cp-duration: 0ms`.
551
+
552
+ **`inherit` does not work in a variable.** In a CSS custom property the word `inherit` means "take the parent's value of this same variable", not "inherit the property": `--rr-cp-fg: inherit` does not give the page's text color. Write `currentColor` or a real value instead (e.g. `--rr-cp-border: currentColor`, or `var(--your-app-border)`).
553
+
494
554
  **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
555
 
496
556
  ```ts
@@ -202,6 +202,11 @@ const DEFAULT_COMMAND_PALETTE_CONFIG = {
202
202
  shortcut: "mod+k",
203
203
  shortcutInFields: true,
204
204
  shortcutEnabled: true,
205
+ shortcutPreventDefault: true,
206
+ closeOnSelect: true,
207
+ restoreFocus: true,
208
+ position: "top",
209
+ sectionOrder: [],
205
210
  theme: "auto",
206
211
  recent: {
207
212
  max: 5,
@@ -249,6 +254,16 @@ function provideCommandPalette(options = {}) {
249
254
  useValue: resolveConfig(options)
250
255
  }]);
251
256
  }
257
+ function safeCall(name, callback, ...args) {
258
+ if (!callback) return;
259
+ const report = (error) => console.error(`ngx-command-palette: the ${name} callback threw`, error);
260
+ try {
261
+ const result = callback(...args);
262
+ if (result && typeof result.then === "function") result.then(void 0, report);
263
+ } catch (error) {
264
+ report(error);
265
+ }
266
+ }
252
267
  const MODIFIERS = {
253
268
  mod: "mod",
254
269
  ctrl: "ctrl",
@@ -469,7 +484,8 @@ var CommandPaletteService = class CommandPaletteService {
469
484
  return false;
470
485
  }
471
486
  open(query = "") {
472
- if (!this._isOpen()) {
487
+ const wasOpen = this._isOpen();
488
+ if (!wasOpen) {
473
489
  const active = this.document.activeElement;
474
490
  this.returnFocus = active && active !== this.document.body && typeof active.focus === "function" ? active : null;
475
491
  }
@@ -477,8 +493,24 @@ var CommandPaletteService = class CommandPaletteService {
477
493
  this.pathIds.set([]);
478
494
  this.promptCommand.set(null);
479
495
  this.setQuery(query);
496
+ if (!wasOpen) safeCall("onOpen", this.config.onOpen);
480
497
  }
481
498
  close() {
499
+ this.closeWith("api");
500
+ }
501
+ restoreFocus(previous) {
502
+ const option = this.config.restoreFocus;
503
+ if (option === false) return;
504
+ let target = previous;
505
+ if (typeof option === "function") try {
506
+ const custom = option();
507
+ if (custom?.isConnected && typeof custom.focus === "function") target = custom;
508
+ } catch (error) {
509
+ console.error("ngx-command-palette: the restoreFocus function threw", error);
510
+ }
511
+ if (target?.isConnected) target.focus({ preventScroll: true });
512
+ }
513
+ closeWith(reason) {
482
514
  if (!this._isOpen()) return;
483
515
  this._isOpen.set(false);
484
516
  this.cancelAll();
@@ -486,12 +518,13 @@ var CommandPaletteService = class CommandPaletteService {
486
518
  this.pathIds.set([]);
487
519
  this.promptCommand.set(null);
488
520
  this.providerState.set(/* @__PURE__ */ new Map());
489
- const target = this.returnFocus;
521
+ const previous = this.returnFocus;
490
522
  this.returnFocus = null;
491
- if (target?.isConnected) target.focus({ preventScroll: true });
523
+ this.restoreFocus(previous);
524
+ safeCall("onClose", this.config.onClose, reason);
492
525
  }
493
526
  toggle() {
494
- if (this._isOpen()) this.close();
527
+ if (this._isOpen()) this.closeWith("toggle");
495
528
  else this.open();
496
529
  }
497
530
  setQuery(query) {
@@ -555,7 +588,11 @@ var CommandPaletteService = class CommandPaletteService {
555
588
  if (!value) return;
556
589
  }
557
590
  if (this.recentStore && this.recentsOn()) this.recents.set(this.recentStore.add(command, this.recents()));
558
- this.close();
591
+ if (command.closeOnRun ?? this.config.closeOnSelect) this.closeWith("run");
592
+ else if (value !== void 0) {
593
+ this.promptCommand.set(null);
594
+ this.setQuery("");
595
+ }
559
596
  if (command.route !== void 0) {
560
597
  if (!this.router) throw new Error("ngx-command-palette: route commands need provideRouter()");
561
598
  const { route, navigationExtras } = command;
@@ -564,6 +601,7 @@ var CommandPaletteService = class CommandPaletteService {
564
601
  query,
565
602
  value
566
603
  });
604
+ safeCall("onRun", this.config.onRun, command);
567
605
  }
568
606
  clearRecent() {
569
607
  this.recentStore?.clear();
@@ -659,7 +697,24 @@ var CommandPaletteService = class CommandPaletteService {
659
697
  items
660
698
  });
661
699
  }
662
- return sections;
700
+ return query || prompt ? sections : this.orderSections(sections);
701
+ }
702
+ orderSections(sections) {
703
+ const order = this.config.sectionOrder;
704
+ if (!order.length) return sections;
705
+ const rank = (s) => {
706
+ let i = order.indexOf(s.id);
707
+ if (i < 0) i = order.indexOf(s.label);
708
+ return i;
709
+ };
710
+ const listed = sections.filter((s) => rank(s) >= 0).sort((a, b) => rank(a) - rank(b));
711
+ const rest = sections.filter((s) => rank(s) < 0);
712
+ const top = rest.filter((s) => s.id === "pinned" || s.id === "recent");
713
+ return [
714
+ ...top,
715
+ ...listed,
716
+ ...rest.filter((s) => !top.includes(s))
717
+ ];
663
718
  }
664
719
  recentResults(commands) {
665
720
  if (!this.recentStore || !this.recentsOn()) return [];
@@ -1065,7 +1120,7 @@ var CommandPaletteComponent = class CommandPaletteComponent {
1065
1120
  const items = this.items();
1066
1121
  switch (action) {
1067
1122
  case "close":
1068
- this.service.close();
1123
+ this.service.closeWith("escape");
1069
1124
  return;
1070
1125
  case "select": {
1071
1126
  const item = items[this.activeIndex()];
@@ -1085,7 +1140,7 @@ var CommandPaletteComponent = class CommandPaletteComponent {
1085
1140
  this.service.execute(item.command);
1086
1141
  }
1087
1142
  onOverlayDown(event) {
1088
- if (event.target === event.currentTarget) this.service.close();
1143
+ if (event.target === event.currentTarget) this.service.closeWith("overlay");
1089
1144
  }
1090
1145
  onDocumentKeydown(event) {
1091
1146
  if (event.repeat || event.isComposing) return;
@@ -1095,7 +1150,7 @@ var CommandPaletteComponent = class CommandPaletteComponent {
1095
1150
  return;
1096
1151
  }
1097
1152
  if (this.shortcuts.some((s) => (!typing || this.config.shortcutInFields && (s.mod || s.ctrl || s.meta || s.alt)) && matchesShortcut(event, s, this.apple)) && (this.service.isOpen() || this.shortcutEnabled())) {
1098
- event.preventDefault();
1153
+ if (this.config.shortcutPreventDefault) event.preventDefault();
1099
1154
  this.activeKey.set(null);
1100
1155
  this.service.toggle();
1101
1156
  }
@@ -1179,8 +1234,8 @@ var CommandPaletteComponent = class CommandPaletteComponent {
1179
1234
  isSignal: true
1180
1235
  }],
1181
1236
  ngImport: i0,
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"],
1237
+ template: "@if (service.isOpen()) {\n <div\n class=\"rr-cp\"\n [class.rr-cp-center]=\"config.position === 'center'\"\n [attr.data-theme]=\"resolvedTheme()\"\n (mousedown)=\"onOverlayDown($event)\"\n >\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",
1238
+ 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) var(--rr-cp-gutter, 16px) var(--rr-cp-gutter, 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.rr-cp-center{align-items:center;padding-top:var(--rr-cp-gutter, 16px)}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:var(--rr-cp-border-width, 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:var(--rr-cp-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:var(--rr-cp-search-border, 1px solid var(--rr-cp-border))}.rr-cp-path{display:flex;align-items:center;gap:var(--rr-cp-path-gap, 4px);padding:var(--rr-cp-path-padding, 10px 14px 0);color:var(--rr-cp-muted);font-size:var(--rr-cp-path-size, .8125rem)}.rr-cp-path button{display:inline-flex;align-items:center;padding:var(--rr-cp-path-button-padding, 2px 6px);border:0;border-radius:var(--rr-cp-path-button-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:var(--rr-cp-focus-outline, 2px solid var(--rr-cp-accent));outline-offset:var(--rr-cp-focus-offset, 1px)}.rr-cp-path-current{padding:var(--rr-cp-path-button-padding, 2px 6px);color:var(--rr-cp-fg);font-weight:var(--rr-cp-path-current-weight, 600)}.rr-cp-chevron{flex:none;color:var(--rr-cp-muted)}.rr-cp-path-back svg{width:var(--rr-cp-back-icon-size, 16px);height:var(--rr-cp-back-icon-size, 16px)}.rr-cp-search-icon{flex:none;width:var(--rr-cp-search-icon-size, 18px);height:var(--rr-cp-search-icon-size, 18px);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:var(--rr-cp-group-gap, 4px);border-top:var(--rr-cp-group-border, none)}.rr-cp-group-label{padding:var(--rr-cp-group-label-padding, 8px 10px 4px);color:var(--rr-cp-muted);font-size:var(--rr-cp-group-label-size, .75rem);font-weight:var(--rr-cp-group-label-weight, 600);letter-spacing:var(--rr-cp-group-label-spacing, .02em)}.rr-cp-item{display:flex;align-items:center;gap:var(--rr-cp-item-gap, 10px);min-height:var(--rr-cp-item-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:var(--rr-cp-item-disabled-opacity, .5)}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:var(--rr-cp-icon-size, 20px);height:var(--rr-cp-icon-size, 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:var(--rr-cp-kbd-gap, 4px)}.rr-cp kbd{display:inline-flex;align-items:center;justify-content:center;min-width:var(--rr-cp-kbd-size, 20px);height:var(--rr-cp-kbd-size, 20px);padding:var(--rr-cp-kbd-padding, 0 5px);box-sizing:border-box;border:var(--rr-cp-kbd-border, 1px solid var(--rr-cp-border));border-radius:var(--rr-cp-kbd-radius, 4px);background:var(--rr-cp-kbd-bg);color:var(--rr-cp-kbd-fg);font-family:inherit;font-size:var(--rr-cp-kbd-font-size, .6875rem);font-weight:var(--rr-cp-kbd-weight, 500)}.rr-cp-status{padding:var(--rr-cp-status-padding, 8px 14px);border-top:var(--rr-cp-status-border, 1px solid var(--rr-cp-border));color:var(--rr-cp-muted);font-size:var(--rr-cp-status-size, .75rem)}.rr-cp-empty{padding:var(--rr-cp-empty-padding, 32px 16px);color:var(--rr-cp-muted);text-align:center}.rr-cp-spinner{flex:none;width:var(--rr-cp-spinner-size, 14px);height:var(--rr-cp-spinner-size, 14px);border:var(--rr-cp-spinner-width, 2px) solid var(--rr-cp-spinner-track, var(--rr-cp-border));border-top-color:var(--rr-cp-spinner-color, var(--rr-cp-accent));border-radius:50%;animation:rr-cp-spin var(--rr-cp-spinner-duration, .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"],
1184
1239
  dependencies: [{
1185
1240
  kind: "directive",
1186
1241
  type: NgTemplateOutlet,
@@ -1212,8 +1267,8 @@ i0.ɵɵngDeclareClassMetadata({
1212
1267
  "(document:keydown)": "onDocumentKeydown($event)",
1213
1268
  "(document:focusin)": "onDocumentFocusin($event)"
1214
1269
  },
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"]
1270
+ template: "@if (service.isOpen()) {\n <div\n class=\"rr-cp\"\n [class.rr-cp-center]=\"config.position === 'center'\"\n [attr.data-theme]=\"resolvedTheme()\"\n (mousedown)=\"onOverlayDown($event)\"\n >\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",
1271
+ 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) var(--rr-cp-gutter, 16px) var(--rr-cp-gutter, 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.rr-cp-center{align-items:center;padding-top:var(--rr-cp-gutter, 16px)}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:var(--rr-cp-border-width, 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:var(--rr-cp-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:var(--rr-cp-search-border, 1px solid var(--rr-cp-border))}.rr-cp-path{display:flex;align-items:center;gap:var(--rr-cp-path-gap, 4px);padding:var(--rr-cp-path-padding, 10px 14px 0);color:var(--rr-cp-muted);font-size:var(--rr-cp-path-size, .8125rem)}.rr-cp-path button{display:inline-flex;align-items:center;padding:var(--rr-cp-path-button-padding, 2px 6px);border:0;border-radius:var(--rr-cp-path-button-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:var(--rr-cp-focus-outline, 2px solid var(--rr-cp-accent));outline-offset:var(--rr-cp-focus-offset, 1px)}.rr-cp-path-current{padding:var(--rr-cp-path-button-padding, 2px 6px);color:var(--rr-cp-fg);font-weight:var(--rr-cp-path-current-weight, 600)}.rr-cp-chevron{flex:none;color:var(--rr-cp-muted)}.rr-cp-path-back svg{width:var(--rr-cp-back-icon-size, 16px);height:var(--rr-cp-back-icon-size, 16px)}.rr-cp-search-icon{flex:none;width:var(--rr-cp-search-icon-size, 18px);height:var(--rr-cp-search-icon-size, 18px);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:var(--rr-cp-group-gap, 4px);border-top:var(--rr-cp-group-border, none)}.rr-cp-group-label{padding:var(--rr-cp-group-label-padding, 8px 10px 4px);color:var(--rr-cp-muted);font-size:var(--rr-cp-group-label-size, .75rem);font-weight:var(--rr-cp-group-label-weight, 600);letter-spacing:var(--rr-cp-group-label-spacing, .02em)}.rr-cp-item{display:flex;align-items:center;gap:var(--rr-cp-item-gap, 10px);min-height:var(--rr-cp-item-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:var(--rr-cp-item-disabled-opacity, .5)}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:var(--rr-cp-icon-size, 20px);height:var(--rr-cp-icon-size, 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:var(--rr-cp-kbd-gap, 4px)}.rr-cp kbd{display:inline-flex;align-items:center;justify-content:center;min-width:var(--rr-cp-kbd-size, 20px);height:var(--rr-cp-kbd-size, 20px);padding:var(--rr-cp-kbd-padding, 0 5px);box-sizing:border-box;border:var(--rr-cp-kbd-border, 1px solid var(--rr-cp-border));border-radius:var(--rr-cp-kbd-radius, 4px);background:var(--rr-cp-kbd-bg);color:var(--rr-cp-kbd-fg);font-family:inherit;font-size:var(--rr-cp-kbd-font-size, .6875rem);font-weight:var(--rr-cp-kbd-weight, 500)}.rr-cp-status{padding:var(--rr-cp-status-padding, 8px 14px);border-top:var(--rr-cp-status-border, 1px solid var(--rr-cp-border));color:var(--rr-cp-muted);font-size:var(--rr-cp-status-size, .75rem)}.rr-cp-empty{padding:var(--rr-cp-empty-padding, 32px 16px);color:var(--rr-cp-muted);text-align:center}.rr-cp-spinner{flex:none;width:var(--rr-cp-spinner-size, 14px);height:var(--rr-cp-spinner-size, 14px);border:var(--rr-cp-spinner-width, 2px) solid var(--rr-cp-spinner-track, var(--rr-cp-border));border-top-color:var(--rr-cp-spinner-color, var(--rr-cp-accent));border-radius:50%;animation:rr-cp-spin var(--rr-cp-spinner-duration, .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"]
1217
1272
  }]
1218
1273
  }],
1219
1274
  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 /** 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,MAAM,KAAA,CAAM,YAAW;AACtC;AAMA,SAAS,SAAS,MAAY;CAE5B,IAAI,iBAAiB,KAAK,IAAI,GAAG,OAAO,KAAK,YAAW;CACxD,IAAI,MAAM;CAEV,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,EAAE;CACzD,OAAO;AACT;AAGA,SAAS,UAAU,OAAa;CAC9B,OAAO,SAAS,MAAM,QAAQ,QAAQ,EAAE,CAAC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/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/** Vertical position of the window: near the top (`--rr-cp-top`) or centered. */\nexport type CommandPalettePosition = 'top' | 'center';\n\n/** Why the palette closed, as passed to `onClose`. */\nexport type CommandPaletteCloseReason = 'escape' | 'overlay' | 'run' | 'toggle' | 'api';\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 /**\n * Whether the shortcut calls `preventDefault()` on the key event. Set it to `false` to let the key\n * reach the browser or other listeners too. Default: `true`.\n */\n readonly shortcutPreventDefault: boolean;\n /**\n * Closes the palette after a command is executed. A command's own `closeOnRun` wins over this.\n * Commands that open a sub-palette or ask for a value never close it. Default: `true`.\n */\n readonly closeOnSelect: boolean;\n /** Called after the palette opened (not when `open()` is called while it is already open). */\n readonly onOpen?: () => void;\n /** Called after the palette closed, with the reason. */\n readonly onClose?: (reason: CommandPaletteCloseReason) => void;\n /**\n * Called after a command ran (or navigated), also for route commands and when the palette stays open.\n * Not called when the command throws or its promise rejects.\n */\n readonly onRun?: (command: Command) => void;\n /**\n * Where the focus goes when the palette closes. `true` (default) gives it back to the element that\n * had it when the palette opened, which is the accessible behavior. `false` does not move it. A\n * function returns the element to focus instead; if it returns `null`, an element that is no longer\n * in the page or throws, the focus goes back to the element that had it before opening.\n */\n readonly restoreFocus: boolean | (() => HTMLElement | null);\n /** Vertical position of the window. `--rr-cp-top` applies to `top`. Default: `top`. */\n readonly position: CommandPalettePosition;\n /**\n * Order of the sections while the search is empty: section ids (`pinned`, `recent`, `g:<group>`,\n * `p:<provider id>`) or group names. Sections not listed keep their usual order after the listed\n * ones, except Pinned and Recent, which stay on top unless listed. Default: none.\n */\n readonly sectionOrder: readonly string[];\n /** `auto` follows `prefers-color-scheme`. Default: `auto`. */\n readonly theme: CommandPaletteTheme;\n /** \"Recent\" section shown with an empty query; `false` disables it. */\n readonly recent: CommandPaletteRecentOptions | false;\n /** Debounce for async providers, in ms. Default: 200. */\n readonly debounceMs: number;\n /** Max results of local commands for a non-empty query. Default: 50. */\n readonly maxResults: number;\n /**\n * Max commands listed when the search is empty (the \"Recent\" section is not counted). The rest is\n * still found by searching. Default: 100. Drawing every row slows down the opening when there are\n * thousands of commands; use `Infinity` to list them all.\n */\n readonly maxEmptyResults: number;\n /** Matching and ranking of local commands for a non-empty query. Default: the built-in fuzzy search. */\n readonly filter: CommandFilter;\n /** 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 shortcutPreventDefault: true,\n closeOnSelect: true,\n restoreFocus: true,\n position: 'top',\n sectionOrder: [],\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\n/**\n * Runs a user callback so that an error it throws is reported but never breaks the palette.\n * Promise rejections of async callbacks are reported too.\n */\nexport function safeCall<A extends unknown[]>(\n name: string,\n callback: ((...args: A) => unknown) | undefined,\n ...args: A\n): void {\n if (!callback) return;\n const report = (error: unknown) =>\n console.error(`ngx-command-palette: the ${name} callback threw`, error);\n try {\n const result = callback(...args);\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') {\n (result as PromiseLike<unknown>).then(undefined, report);\n }\n } catch (error) {\n report(error);\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 safeCall,\n type CommandPaletteCloseReason,\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 const wasOpen = this._isOpen();\n if (!wasOpen) {\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 if (!wasOpen) safeCall('onOpen', this.config.onOpen);\n }\n\n /** Closes the palette, cancels pending searches and restores the focus. */\n close(): void {\n this.closeWith('api');\n }\n\n /** Gives the focus back as the `restoreFocus` option says. */\n private restoreFocus(previous: HTMLElement | null): void {\n const option = this.config.restoreFocus;\n if (option === false) return;\n let target: HTMLElement | null = previous;\n if (typeof option === 'function') {\n try {\n const custom = option();\n if (custom?.isConnected && typeof custom.focus === 'function') target = custom;\n } catch (error) {\n console.error('ngx-command-palette: the restoreFocus function threw', error);\n }\n }\n if (target?.isConnected) target.focus({ preventScroll: true });\n }\n\n /** Closes the palette telling `onClose` why. */\n closeWith(reason: CommandPaletteCloseReason): 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 previous = this.returnFocus;\n this.returnFocus = null;\n this.restoreFocus(previous);\n safeCall('onClose', this.config.onClose, reason);\n }\n\n toggle(): void {\n if (this._isOpen()) this.closeWith('toggle');\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 const closes = command.closeOnRun ?? this.config.closeOnSelect;\n if (closes) this.closeWith('run');\n else if (value !== undefined) {\n // Stays open: leave the value step and show the list again\n this.promptCommand.set(null);\n this.setQuery('');\n }\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 safeCall('onRun', this.config.onRun, command);\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 query || prompt ? sections : this.orderSections(sections);\n }\n\n /** Applies `sectionOrder` (empty search only): listed sections first, then Pinned/Recent, then the rest. */\n private orderSections(sections: CommandSection[]): CommandSection[] {\n const order = this.config.sectionOrder;\n if (!order.length) return sections;\n const rank = (s: CommandSection): number => {\n let i = order.indexOf(s.id);\n if (i < 0) i = order.indexOf(s.label);\n return i;\n };\n const listed = sections.filter((s) => rank(s) >= 0).sort((a, b) => rank(a) - rank(b));\n const rest = sections.filter((s) => rank(s) < 0);\n // Not listed: Pinned and Recent keep their place on top, the others follow in registration order\n const top = rest.filter((s) => s.id === PINNED_SECTION_ID || s.id === RECENT_SECTION_ID);\n return [...top, ...listed, ...rest.filter((s) => !top.includes(s))];\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.closeWith('escape');\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.closeWith('overlay');\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 if (this.config.shortcutPreventDefault) 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\n class=\"rr-cp\"\n [class.rr-cp-center]=\"config.position === 'center'\"\n [attr.data-theme]=\"resolvedTheme()\"\n (mousedown)=\"onOverlayDown($event)\"\n >\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,MAAM,KAAA,CAAM,YAAW;AACtC;AAMA,SAAS,SAAS,MAAY;CAE5B,IAAI,iBAAiB,KAAK,IAAI,GAAG,OAAO,KAAK,YAAW;CACxD,IAAI,MAAM;CAEV,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK,OAAO,KAAK,KAAK,EAAE;CACzD,OAAO;AACT;AAGA,SAAS,UAAU,OAAa;CAC9B,OAAO,SAAS,MAAM,QAAQ,QAAQ,EAAE,CAAC;AAC3C;AAEA,SAAS,YAAY,MAAc,GAAS;CAC1C,IAAI,MAAM,GAAG,OAAO;CACpB,MAAM,OAAO,KAAK,IAAI;CACtB,IAAI,WAAW,IAAI,IAAI,GAAG,OAAO;CAEjC,MAAM,MAAM,KAAK;CACjB,OAAO,SAAS,KAAK,YAAW,KAAM,QAAQ,IAAI,YAAW,KAAM,QAAQ,I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K;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.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Accessible ⌘K / Ctrl+K command palette for Angular: fuzzy search, sections, recents, async providers. Standalone, signals, zoneless, zero dependencies.",
5
5
  "keywords": [
6
6
  "angular",
@@ -30,6 +30,11 @@ interface CommandBase {
30
30
  readonly hotkey?: string | readonly string[];
31
31
  /** Extra words matched by the search but not shown. */
32
32
  readonly keywords?: readonly string[];
33
+ /**
34
+ * Overrides the `closeOnSelect` option for this command: `false` keeps the palette open after it
35
+ * runs, `true` closes it even if the option is `false`. Ignored by sub-palette parents.
36
+ */
37
+ readonly closeOnRun?: boolean;
33
38
  /** A disabled command is shown but cannot be executed or selected. */
34
39
  readonly disabled?: boolean;
35
40
  /**
@@ -139,6 +144,10 @@ export declare function highlightSegments(text: string, indices: readonly number
139
144
  */
140
145
  export declare function matchCommand(query: string, command: Command): FuzzyMatch | null;
141
146
  type CommandPaletteTheme = 'light' | 'dark' | 'auto';
147
+ /** Vertical position of the window: near the top (`--rr-cp-top`) or centered. */
148
+ type CommandPalettePosition = 'top' | 'center';
149
+ /** Why the palette closed, as passed to `onClose`. */
150
+ type CommandPaletteCloseReason = 'escape' | 'overlay' | 'run' | 'toggle' | 'api';
142
151
  /** Texts of the palette, for translations. */
143
152
  interface CommandPaletteLabels {
144
153
  readonly placeholder: string;
@@ -223,6 +232,40 @@ interface CommandPaletteConfig {
223
232
  * Default: `true`.
224
233
  */
225
234
  readonly shortcutEnabled: boolean | (() => boolean);
235
+ /**
236
+ * Whether the shortcut calls `preventDefault()` on the key event. Set it to `false` to let the key
237
+ * reach the browser or other listeners too. Default: `true`.
238
+ */
239
+ readonly shortcutPreventDefault: boolean;
240
+ /**
241
+ * Closes the palette after a command is executed. A command's own `closeOnRun` wins over this.
242
+ * Commands that open a sub-palette or ask for a value never close it. Default: `true`.
243
+ */
244
+ readonly closeOnSelect: boolean;
245
+ /** Called after the palette opened (not when `open()` is called while it is already open). */
246
+ readonly onOpen?: () => void;
247
+ /** Called after the palette closed, with the reason. */
248
+ readonly onClose?: (reason: CommandPaletteCloseReason) => void;
249
+ /**
250
+ * Called after a command ran (or navigated), also for route commands and when the palette stays open.
251
+ * Not called when the command throws or its promise rejects.
252
+ */
253
+ readonly onRun?: (command: Command) => void;
254
+ /**
255
+ * Where the focus goes when the palette closes. `true` (default) gives it back to the element that
256
+ * had it when the palette opened, which is the accessible behavior. `false` does not move it. A
257
+ * function returns the element to focus instead; if it returns `null`, an element that is no longer
258
+ * in the page or throws, the focus goes back to the element that had it before opening.
259
+ */
260
+ readonly restoreFocus: boolean | (() => HTMLElement | null);
261
+ /** Vertical position of the window. `--rr-cp-top` applies to `top`. Default: `top`. */
262
+ readonly position: CommandPalettePosition;
263
+ /**
264
+ * Order of the sections while the search is empty: section ids (`pinned`, `recent`, `g:<group>`,
265
+ * `p:<provider id>`) or group names. Sections not listed keep their usual order after the listed
266
+ * ones, except Pinned and Recent, which stay on top unless listed. Default: none.
267
+ */
268
+ readonly sectionOrder: readonly string[];
226
269
  /** `auto` follows `prefers-color-scheme`. Default: `auto`. */
227
270
  readonly theme: CommandPaletteTheme;
228
271
  /** "Recent" section shown with an empty query; `false` disables it. */
@@ -328,6 +371,10 @@ export declare class CommandPaletteService {
328
371
  open(query?: string): void;
329
372
  /** Closes the palette, cancels pending searches and restores the focus. */
330
373
  close(): void;
374
+ /** Gives the focus back as the `restoreFocus` option says. */
375
+ private restoreFocus;
376
+ /** Closes the palette telling `onClose` why. */
377
+ closeWith(reason: CommandPaletteCloseReason): void;
331
378
  toggle(): void;
332
379
  /** Updates the search text and schedules the async providers. */
333
380
  setQuery(query: string): void;
@@ -352,6 +399,8 @@ export declare class CommandPaletteService {
352
399
  /** Splits the raw search into the mode it starts with (if any) and the text to search. */
353
400
  private parseQuery;
354
401
  private buildSections;
402
+ /** Applies `sectionOrder` (empty search only): listed sections first, then Pinned/Recent, then the rest. */
403
+ private orderSections;
355
404
  private recentResults;
356
405
  private scheduleProviders;
357
406
  private scheduleProvider;
@@ -484,4 +533,4 @@ type KeyEventLike = Pick<KeyboardEvent, 'key' | 'code' | 'ctrlKey' | 'metaKey' |
484
533
  export declare function matchesShortcut(event: KeyEventLike, shortcut: ParsedShortcut, apple: boolean): boolean;
485
534
  /** Human readable label, e.g. `⌘K` on macOS and `Ctrl+K` elsewhere. */
486
535
  export declare function formatShortcut(shortcut: ParsedShortcut, apple: boolean): string;
487
- export type { ActionCommand, Command, CommandEmptyContext, CommandFilter, CommandItemContext, CommandPaletteConfig, CommandPaletteLabels, CommandPaletteOptions, CommandPaletteRecentOptions, CommandPaletteTheme, CommandPrefix, CommandProvider, CommandResult, CommandRunContext, CommandSection, CommandSubscribable, FuzzyMatch, HighlightSegment, ParentCommand, ParsedShortcut, RecentStorage, RouteCommand };
536
+ export type { ActionCommand, Command, CommandEmptyContext, CommandFilter, CommandItemContext, CommandPaletteCloseReason, CommandPaletteConfig, CommandPaletteLabels, CommandPaletteOptions, CommandPalettePosition, CommandPaletteRecentOptions, CommandPaletteTheme, CommandPrefix, CommandProvider, CommandResult, CommandRunContext, CommandSection, CommandSubscribable, FuzzyMatch, HighlightSegment, ParentCommand, ParsedShortcut, RecentStorage, RouteCommand };