@rrstudioapps/ngx-command-palette 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -142,7 +142,60 @@ injectCommandProvider({
|
|
|
142
142
|
| `recent` | `{ max?, storageKey? } \| false` | `{ max: 5, storageKey: 'rr-cp:recent' }` | "Recent" section shown when the query is empty. |
|
|
143
143
|
| `debounceMs` | `number` | `200` | Debounce for async providers. |
|
|
144
144
|
| `maxResults` | `number` | `50` | Max local results for a non-empty query. |
|
|
145
|
-
| `
|
|
145
|
+
| `filter` | `(query, command) => { score, indices } \| null` | built-in fuzzy search | Your own matching and ranking of local commands. See [Custom search](#custom-search). |
|
|
146
|
+
| `labels` | `Partial<CommandPaletteLabels>` | English | All texts, for translations: `placeholder`, `dialog`, `listbox`, `empty`, `loading`, `recent`, `defaultGroup`, `results` (`'{count} results'`), `closeHint`, `back`, `level` (`'{name}: {count} results'`), `submenu`. |
|
|
147
|
+
|
|
148
|
+
### Many commands
|
|
149
|
+
|
|
150
|
+
Commands are scored on every keystroke and, with an empty search, all of them are rendered. That stays
|
|
151
|
+
smooth up to a few hundred commands (about a thousand open in roughly 0.2 s on a slow virtual server).
|
|
152
|
+
With a couple of thousand or more, group them in [sub-palettes](#sub-palettes) or load them with an async
|
|
153
|
+
[provider](#commandprovider) instead.
|
|
154
|
+
|
|
155
|
+
### Custom search
|
|
156
|
+
|
|
157
|
+
By default commands are matched with the built-in fuzzy search (label, keywords, description). Pass `filter`
|
|
158
|
+
to decide what matches and how results are ranked. Return `null` to hide a command; a higher `score` ranks first,
|
|
159
|
+
and `indices` are the label characters to highlight:
|
|
160
|
+
|
|
161
|
+
```ts
|
|
162
|
+
provideCommandPalette({
|
|
163
|
+
// Only commands whose label starts with the query
|
|
164
|
+
filter: (query, command) =>
|
|
165
|
+
command.label.toLowerCase().startsWith(query.toLowerCase())
|
|
166
|
+
? { score: 1, indices: Array.from({ length: query.length }, (_, i) => i) }
|
|
167
|
+
: null,
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
`filter` only applies to local commands with a non-empty query. Results of async providers keep the order
|
|
172
|
+
returned by your API. To build on the default behavior, call the exported `matchCommand(query, command)`.
|
|
173
|
+
|
|
174
|
+
### Sub-palettes
|
|
175
|
+
|
|
176
|
+
Give a command `children` and selecting it lists those commands instead of running something. The path of
|
|
177
|
+
opened parents shows above the search field, and the search only looks inside the current level:
|
|
178
|
+
|
|
179
|
+
```ts
|
|
180
|
+
injectCommands([
|
|
181
|
+
{
|
|
182
|
+
id: 'theme',
|
|
183
|
+
label: 'Change theme',
|
|
184
|
+
keywords: ['appearance'],
|
|
185
|
+
children: [
|
|
186
|
+
{ id: 'theme-light', label: 'Light', run: () => setTheme('light') },
|
|
187
|
+
{ id: 'theme-dark', label: 'Dark', run: () => setTheme('dark') },
|
|
188
|
+
],
|
|
189
|
+
},
|
|
190
|
+
]);
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
- **Backspace** on an empty search, the back button or a step of the path goes back; **Esc** closes the whole palette.
|
|
194
|
+
- Children can have children. They support `hidden` and `disabled` like any command.
|
|
195
|
+
- Running a child saves it in the recents, so it shows up at the top level afterwards. Parents are never saved.
|
|
196
|
+
- Async providers search the top level only, and only registered commands can have `children`
|
|
197
|
+
(not the results of a provider).
|
|
198
|
+
- Screen readers hear the level name and the number of results when a sub-palette opens.
|
|
146
199
|
|
|
147
200
|
### `Command`
|
|
148
201
|
|
|
@@ -156,6 +209,8 @@ injectCommandProvider({
|
|
|
156
209
|
| `shortcut` | `string[]?` | Keys shown on the right, e.g. `['⌘', 'S']`. Display only. |
|
|
157
210
|
| `keywords` | `string[]?` | Extra search terms, not shown. |
|
|
158
211
|
| `disabled` | `boolean?` | Shown but not selectable. |
|
|
212
|
+
| `children` | `Command[]?` | Makes it a parent: selecting it opens a sub-palette with these commands instead of running something. See [Sub-palettes](#sub-palettes). |
|
|
213
|
+
| `hidden` | `boolean \| (() => boolean)?` | Not listed and not searched. A function or a signal hides it depending on your app state, e.g. `hidden: () => !user()`. |
|
|
159
214
|
| `route` + `navigationExtras` | `string \| any[]`, `NavigationExtras?` | Navigate with the Angular router… |
|
|
160
215
|
| `run` | `(ctx: { query }) => void \| Promise` | …or run a function. |
|
|
161
216
|
|
|
@@ -164,7 +219,9 @@ injectCommandProvider({
|
|
|
164
219
|
| Member | Description |
|
|
165
220
|
| --- | --- |
|
|
166
221
|
| `isOpen`, `query`, `loading` | Read-only signals. |
|
|
167
|
-
| `commands`, `sections` | Registered commands and the filtered, grouped results (signals). |
|
|
222
|
+
| `commands`, `sections` | Registered commands and the filtered, grouped results of the current level (signals). |
|
|
223
|
+
| `path` | The sub-palettes currently open, outermost first (signal). |
|
|
224
|
+
| `back(levels?)` | Goes back one or more levels of a sub-palette; returns `false` at the top level. |
|
|
168
225
|
| `open(query?)`, `close()`, `toggle()` | Open/close programmatically (e.g. from a "Search…" button). |
|
|
169
226
|
| `setQuery(query)` | Change the search text. |
|
|
170
227
|
| `register(commands \| signal, destroyRef?)` | Returns an unregister function. Inside an injection context it unregisters on destroy. |
|
|
@@ -2,52 +2,6 @@ import * as i0 from "@angular/core";
|
|
|
2
2
|
import { ChangeDetectionStrategy, Component, DOCUMENT, DestroyRef, Directive, Injectable, InjectionToken, TemplateRef, ViewEncapsulation, afterRenderEffect, assertInInjectionContext, computed, contentChild, inject, input, isSignal, makeEnvironmentProviders, signal, viewChild } from "@angular/core";
|
|
3
3
|
import { Router } from "@angular/router";
|
|
4
4
|
import { NgTemplateOutlet } from "@angular/common";
|
|
5
|
-
const DEFAULT_COMMAND_PALETTE_LABELS = {
|
|
6
|
-
placeholder: "Type a command or search…",
|
|
7
|
-
dialog: "Command palette",
|
|
8
|
-
listbox: "Commands",
|
|
9
|
-
empty: "No results found.",
|
|
10
|
-
loading: "Loading…",
|
|
11
|
-
recent: "Recent",
|
|
12
|
-
defaultGroup: "Commands",
|
|
13
|
-
results: "{count} results",
|
|
14
|
-
closeHint: "Esc"
|
|
15
|
-
};
|
|
16
|
-
const DEFAULT_COMMAND_PALETTE_CONFIG = {
|
|
17
|
-
shortcut: "mod+k",
|
|
18
|
-
theme: "auto",
|
|
19
|
-
recent: {
|
|
20
|
-
max: 5,
|
|
21
|
-
storageKey: "rr-cp:recent"
|
|
22
|
-
},
|
|
23
|
-
debounceMs: 200,
|
|
24
|
-
maxResults: 50,
|
|
25
|
-
labels: DEFAULT_COMMAND_PALETTE_LABELS
|
|
26
|
-
};
|
|
27
|
-
const COMMAND_PALETTE_CONFIG = new InjectionToken("COMMAND_PALETTE_CONFIG", {
|
|
28
|
-
providedIn: "root",
|
|
29
|
-
factory: () => DEFAULT_COMMAND_PALETTE_CONFIG
|
|
30
|
-
});
|
|
31
|
-
function resolveConfig(options = {}) {
|
|
32
|
-
return {
|
|
33
|
-
...DEFAULT_COMMAND_PALETTE_CONFIG,
|
|
34
|
-
...options,
|
|
35
|
-
recent: options.recent === false ? false : {
|
|
36
|
-
...DEFAULT_COMMAND_PALETTE_CONFIG.recent,
|
|
37
|
-
...options.recent
|
|
38
|
-
},
|
|
39
|
-
labels: {
|
|
40
|
-
...DEFAULT_COMMAND_PALETTE_LABELS,
|
|
41
|
-
...options.labels
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
function provideCommandPalette(options = {}) {
|
|
46
|
-
return makeEnvironmentProviders([{
|
|
47
|
-
provide: COMMAND_PALETTE_CONFIG,
|
|
48
|
-
useValue: resolveConfig(options)
|
|
49
|
-
}]);
|
|
50
|
-
}
|
|
51
5
|
const SCORE_CHAR = 1;
|
|
52
6
|
const BONUS_CONSECUTIVE = 5;
|
|
53
7
|
const BONUS_WORD_START = 8;
|
|
@@ -196,6 +150,56 @@ function matchCommand(query, command) {
|
|
|
196
150
|
}
|
|
197
151
|
return best;
|
|
198
152
|
}
|
|
153
|
+
const DEFAULT_COMMAND_PALETTE_LABELS = {
|
|
154
|
+
placeholder: "Type a command or search…",
|
|
155
|
+
dialog: "Command palette",
|
|
156
|
+
listbox: "Commands",
|
|
157
|
+
empty: "No results found.",
|
|
158
|
+
loading: "Loading…",
|
|
159
|
+
recent: "Recent",
|
|
160
|
+
defaultGroup: "Commands",
|
|
161
|
+
results: "{count} results",
|
|
162
|
+
closeHint: "Esc",
|
|
163
|
+
back: "Back",
|
|
164
|
+
level: "{name}: {count} results",
|
|
165
|
+
submenu: "opens a sub-palette"
|
|
166
|
+
};
|
|
167
|
+
const DEFAULT_COMMAND_PALETTE_CONFIG = {
|
|
168
|
+
shortcut: "mod+k",
|
|
169
|
+
theme: "auto",
|
|
170
|
+
recent: {
|
|
171
|
+
max: 5,
|
|
172
|
+
storageKey: "rr-cp:recent"
|
|
173
|
+
},
|
|
174
|
+
debounceMs: 200,
|
|
175
|
+
maxResults: 50,
|
|
176
|
+
filter: matchCommand,
|
|
177
|
+
labels: DEFAULT_COMMAND_PALETTE_LABELS
|
|
178
|
+
};
|
|
179
|
+
const COMMAND_PALETTE_CONFIG = new InjectionToken("COMMAND_PALETTE_CONFIG", {
|
|
180
|
+
providedIn: "root",
|
|
181
|
+
factory: () => DEFAULT_COMMAND_PALETTE_CONFIG
|
|
182
|
+
});
|
|
183
|
+
function resolveConfig(options = {}) {
|
|
184
|
+
return {
|
|
185
|
+
...DEFAULT_COMMAND_PALETTE_CONFIG,
|
|
186
|
+
...options,
|
|
187
|
+
recent: options.recent === false ? false : {
|
|
188
|
+
...DEFAULT_COMMAND_PALETTE_CONFIG.recent,
|
|
189
|
+
...options.recent
|
|
190
|
+
},
|
|
191
|
+
labels: {
|
|
192
|
+
...DEFAULT_COMMAND_PALETTE_LABELS,
|
|
193
|
+
...options.labels
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
function provideCommandPalette(options = {}) {
|
|
198
|
+
return makeEnvironmentProviders([{
|
|
199
|
+
provide: COMMAND_PALETTE_CONFIG,
|
|
200
|
+
useValue: resolveConfig(options)
|
|
201
|
+
}]);
|
|
202
|
+
}
|
|
199
203
|
var RecentStore = class {
|
|
200
204
|
storageKey;
|
|
201
205
|
max;
|
|
@@ -273,9 +277,25 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
273
277
|
providerState = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "providerState" }] : /* istanbul ignore next */ []);
|
|
274
278
|
recents = signal(this.recentStore?.load() ?? [], ...ngDevMode ? [{ debugName: "recents" }] : /* istanbul ignore next */ []);
|
|
275
279
|
pending = /* @__PURE__ */ new Map();
|
|
280
|
+
pathIds = signal([], ...ngDevMode ? [{ debugName: "pathIds" }] : /* istanbul ignore next */ []);
|
|
276
281
|
returnFocus = null;
|
|
277
282
|
isOpen = this._isOpen.asReadonly();
|
|
278
283
|
query = this._query.asReadonly();
|
|
284
|
+
path = computed(() => {
|
|
285
|
+
const path = [];
|
|
286
|
+
let level = this.commands();
|
|
287
|
+
for (const id of this.pathIds()) {
|
|
288
|
+
const parent = level.find((c) => c.id === id && isParent(c));
|
|
289
|
+
if (!parent) break;
|
|
290
|
+
path.push(parent);
|
|
291
|
+
level = parent.children;
|
|
292
|
+
}
|
|
293
|
+
return path;
|
|
294
|
+
}, ...ngDevMode ? [{ debugName: "path" }] : /* istanbul ignore next */ []);
|
|
295
|
+
levelCommands = computed(() => {
|
|
296
|
+
const path = this.path();
|
|
297
|
+
return path.length ? path[path.length - 1].children : this.commands();
|
|
298
|
+
}, ...ngDevMode ? [{ debugName: "levelCommands" }] : /* istanbul ignore next */ []);
|
|
279
299
|
commands = computed(() => {
|
|
280
300
|
const byId = /* @__PURE__ */ new Map();
|
|
281
301
|
for (const registration of this.registrations()) for (const command of registration.source()) {
|
|
@@ -292,6 +312,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
292
312
|
this.returnFocus = active && active !== this.document.body && typeof active.focus === "function" ? active : null;
|
|
293
313
|
}
|
|
294
314
|
this._isOpen.set(true);
|
|
315
|
+
this.pathIds.set([]);
|
|
295
316
|
this.setQuery(query);
|
|
296
317
|
}
|
|
297
318
|
close() {
|
|
@@ -299,6 +320,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
299
320
|
this._isOpen.set(false);
|
|
300
321
|
this.cancelAll();
|
|
301
322
|
this._query.set("");
|
|
323
|
+
this.pathIds.set([]);
|
|
302
324
|
this.providerState.set(/* @__PURE__ */ new Map());
|
|
303
325
|
const target = this.returnFocus;
|
|
304
326
|
this.returnFocus = null;
|
|
@@ -312,6 +334,13 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
312
334
|
this._query.set(query);
|
|
313
335
|
if (this._isOpen()) this.scheduleProviders();
|
|
314
336
|
}
|
|
337
|
+
back(levels = 1) {
|
|
338
|
+
const path = this.path();
|
|
339
|
+
if (!path.length || levels < 1) return false;
|
|
340
|
+
this.pathIds.set(path.slice(0, Math.max(0, path.length - levels)).map((c) => c.id));
|
|
341
|
+
this.setQuery("");
|
|
342
|
+
return true;
|
|
343
|
+
}
|
|
315
344
|
register(commands, destroyRef) {
|
|
316
345
|
const registration = { source: isSignal(commands) ? commands : () => commands };
|
|
317
346
|
this.registrations.update((list) => [...list, registration]);
|
|
@@ -320,7 +349,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
320
349
|
}
|
|
321
350
|
registerProvider(provider, destroyRef) {
|
|
322
351
|
this.providers.update((list) => [...list.filter((p) => p.id !== provider.id), provider]);
|
|
323
|
-
if (this._isOpen()) this.scheduleProvider(provider, this._query());
|
|
352
|
+
if (this._isOpen() && !this.pathIds().length) this.scheduleProvider(provider, this._query());
|
|
324
353
|
const remove = () => {
|
|
325
354
|
if (!this.providers().includes(provider)) return;
|
|
326
355
|
this.cancel(provider.id);
|
|
@@ -335,6 +364,14 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
335
364
|
}
|
|
336
365
|
async execute(command) {
|
|
337
366
|
if (command.disabled) return;
|
|
367
|
+
if (isParent(command)) {
|
|
368
|
+
if (!this.levelCommands().some((c) => c.id === command.id)) throw new Error("ngx-command-palette: only registered commands can have children");
|
|
369
|
+
this.cancelAll();
|
|
370
|
+
this.providerState.set(/* @__PURE__ */ new Map());
|
|
371
|
+
this.pathIds.update((ids) => [...ids, command.id]);
|
|
372
|
+
this.setQuery("");
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
338
375
|
const query = this._query();
|
|
339
376
|
if (this.recentStore) this.recents.set(this.recentStore.add(command, this.recents()));
|
|
340
377
|
this.close();
|
|
@@ -357,7 +394,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
357
394
|
}
|
|
358
395
|
buildSections(query) {
|
|
359
396
|
const defaultGroup = this.config.labels.defaultGroup;
|
|
360
|
-
const commands = this.
|
|
397
|
+
const commands = this.levelCommands();
|
|
361
398
|
const groups = /* @__PURE__ */ new Map();
|
|
362
399
|
const push = (group, result) => {
|
|
363
400
|
const list = groups.get(group);
|
|
@@ -365,21 +402,24 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
365
402
|
else groups.set(group, [result]);
|
|
366
403
|
};
|
|
367
404
|
const sections = [];
|
|
405
|
+
const topLevel = !this.pathIds().length;
|
|
368
406
|
if (!query) {
|
|
369
|
-
const recent = this.recentResults(commands);
|
|
407
|
+
const recent = topLevel ? this.recentResults(commands) : [];
|
|
370
408
|
if (recent.length) sections.push({
|
|
371
409
|
id: RECENT_SECTION_ID,
|
|
372
410
|
label: this.config.labels.recent,
|
|
373
411
|
items: recent
|
|
374
412
|
});
|
|
375
413
|
for (const command of commands) {
|
|
414
|
+
if (isHidden(command)) continue;
|
|
376
415
|
const group = command.group ?? defaultGroup;
|
|
377
416
|
push(group, toResult(command, `g:${group}:${command.id}`, 0, []));
|
|
378
417
|
}
|
|
379
418
|
} else {
|
|
380
419
|
const scored = [];
|
|
381
420
|
for (const command of commands) {
|
|
382
|
-
|
|
421
|
+
if (isHidden(command)) continue;
|
|
422
|
+
const match = this.config.filter(query, command);
|
|
383
423
|
if (!match) continue;
|
|
384
424
|
const group = command.group ?? defaultGroup;
|
|
385
425
|
scored.push(toResult(command, `g:${group}:${command.id}`, match.score, match.indices));
|
|
@@ -393,14 +433,14 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
393
433
|
items
|
|
394
434
|
});
|
|
395
435
|
const states = this.providerState();
|
|
396
|
-
for (const provider of this.providers()) {
|
|
436
|
+
for (const provider of topLevel ? this.providers() : []) {
|
|
397
437
|
const state = states.get(provider.id);
|
|
398
438
|
if (!state?.items.length) continue;
|
|
399
|
-
const items = state.items.map((command) => {
|
|
439
|
+
const items = state.items.filter((command) => !isHidden(command)).map((command) => {
|
|
400
440
|
const match = query ? fuzzyMatch(query, command.label) : null;
|
|
401
441
|
return toResult(command, `p:${provider.id}:${command.id}`, match?.score ?? 0, match?.indices ?? []);
|
|
402
442
|
});
|
|
403
|
-
sections.push({
|
|
443
|
+
if (items.length) sections.push({
|
|
404
444
|
id: `p:${provider.id}`,
|
|
405
445
|
label: provider.group,
|
|
406
446
|
items
|
|
@@ -410,7 +450,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
410
450
|
}
|
|
411
451
|
recentResults(commands) {
|
|
412
452
|
if (!this.recentStore) return [];
|
|
413
|
-
const byId = new Map(commands.map((c) => [c.id, c]));
|
|
453
|
+
const byId = new Map(descendants(commands).map((c) => [c.id, c]));
|
|
414
454
|
const results = [];
|
|
415
455
|
for (const entry of this.recents()) {
|
|
416
456
|
const command = byId.get(entry.id) ?? (entry.route !== void 0 ? {
|
|
@@ -420,11 +460,12 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
420
460
|
...entry.group ? { group: entry.group } : {},
|
|
421
461
|
...entry.description ? { description: entry.description } : {}
|
|
422
462
|
} : void 0);
|
|
423
|
-
if (command && !command.disabled) results.push(toResult(command, `r:${entry.id}`, 0, []));
|
|
463
|
+
if (command && !command.disabled && !isHidden(command)) results.push(toResult(command, `r:${entry.id}`, 0, []));
|
|
424
464
|
}
|
|
425
465
|
return results;
|
|
426
466
|
}
|
|
427
467
|
scheduleProviders() {
|
|
468
|
+
if (this.pathIds().length) return;
|
|
428
469
|
const query = this._query();
|
|
429
470
|
for (const provider of this.providers()) this.scheduleProvider(provider, query);
|
|
430
471
|
}
|
|
@@ -542,6 +583,22 @@ function toResult(command, key, score, indices) {
|
|
|
542
583
|
segments: highlightSegments(command.label, indices)
|
|
543
584
|
};
|
|
544
585
|
}
|
|
586
|
+
function isParent(command) {
|
|
587
|
+
return Array.isArray(command.children);
|
|
588
|
+
}
|
|
589
|
+
function descendants(commands) {
|
|
590
|
+
const all = [];
|
|
591
|
+
for (const command of commands) {
|
|
592
|
+
if (isHidden(command)) continue;
|
|
593
|
+
all.push(command);
|
|
594
|
+
if (isParent(command)) all.push(...descendants(command.children));
|
|
595
|
+
}
|
|
596
|
+
return all;
|
|
597
|
+
}
|
|
598
|
+
function isHidden(command) {
|
|
599
|
+
const { hidden } = command;
|
|
600
|
+
return typeof hidden === "function" ? hidden() : !!hidden;
|
|
601
|
+
}
|
|
545
602
|
function isSubscribable(value) {
|
|
546
603
|
return !!value && typeof value.subscribe === "function";
|
|
547
604
|
}
|
|
@@ -773,7 +830,9 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
773
830
|
status = computed(() => {
|
|
774
831
|
if (this.service.loading()) return this.labels.loading;
|
|
775
832
|
const count = this.items().length;
|
|
776
|
-
|
|
833
|
+
if (count === 0) return this.labels.empty;
|
|
834
|
+
const path = this.service.path();
|
|
835
|
+
return (path.length ? this.labels.level : this.labels.results).replace("{name}", path[path.length - 1]?.label ?? "").replace("{count}", String(count));
|
|
777
836
|
}, ...ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []);
|
|
778
837
|
constructor() {
|
|
779
838
|
const media = this.document.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");
|
|
@@ -796,6 +855,14 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
796
855
|
optionId(index) {
|
|
797
856
|
return `${this.uid}-option-${index}`;
|
|
798
857
|
}
|
|
858
|
+
hasChildren(command) {
|
|
859
|
+
return Array.isArray(command.children);
|
|
860
|
+
}
|
|
861
|
+
onBack(levels) {
|
|
862
|
+
this.activeKey.set(null);
|
|
863
|
+
this.service.back(levels);
|
|
864
|
+
this.input()?.nativeElement.focus({ preventScroll: true });
|
|
865
|
+
}
|
|
799
866
|
isTemplate(icon) {
|
|
800
867
|
return icon instanceof TemplateRef;
|
|
801
868
|
}
|
|
@@ -808,6 +875,12 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
808
875
|
this.trapTab(event);
|
|
809
876
|
return;
|
|
810
877
|
}
|
|
878
|
+
if (event.key === "Backspace" && !event.isComposing && this.service.query() === "" && this.service.path().length) {
|
|
879
|
+
event.preventDefault();
|
|
880
|
+
this.activeKey.set(null);
|
|
881
|
+
this.service.back();
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
811
884
|
const action = keyToAction(event);
|
|
812
885
|
if (!action) return;
|
|
813
886
|
event.preventDefault();
|
|
@@ -925,8 +998,8 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
925
998
|
isSignal: true
|
|
926
999
|
}],
|
|
927
1000
|
ngImport: i0,
|
|
928
|
-
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 <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n {{ labels.empty }}\n }\n </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
929
|
-
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: #71717a;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--rr-cp-border)}.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp-input{flex:1;min-width:0;height:52px;padding:0;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:6px;scroll-padding:6px}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);box-shadow:inset 2px 0 0 var(--rr-cp-accent)}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-description{color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-match{background:var(--rr-cp-highlight-bg);color:var(--rr-cp-highlight);font-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-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"],
|
|
1001
|
+
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 (service.path(); as path) {\n @if (path.length) {\n <nav class=\"rr-cp-path\">\n <button\n type=\"button\"\n class=\"rr-cp-path-back\"\n [attr.aria-label]=\"labels.back\"\n (click)=\"onBack(1)\"\n >\n <svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" aria-hidden=\"true\">\n <path\n d=\"m15 6-6 6 6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n @for (parent of path; track parent.id; let i = $index; let last = $last) {\n @if (last) {\n <span class=\"rr-cp-path-current\" aria-current=\"page\">{{ parent.label }}</span>\n } @else {\n <button type=\"button\" class=\"rr-cp-path-step\" (click)=\"onBack(path.length - 1 - i)\">\n {{ parent.label }}\n </button>\n <span class=\"rr-cp-path-sep\" aria-hidden=\"true\">›</span>\n }\n }\n </nav>\n }\n }\n <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (hasChildren(row.item.command)) {\n <span class=\"rr-cp-sr-only\">, {{ labels.submenu }}</span>\n <span class=\"rr-cp-chevron\" aria-hidden=\"true\">›</span>\n }\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n {{ labels.empty }}\n }\n </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
1002
|
+
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: #71717a;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--rr-cp-border)}.rr-cp-path{display:flex;align-items:center;gap:4px;padding:10px 14px 0;color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-path button{display:inline-flex;align-items:center;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer}.rr-cp-path button:hover{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-fg)}.rr-cp-path button:focus-visible{outline:2px solid var(--rr-cp-accent);outline-offset:1px}.rr-cp-path-current{padding:2px 6px;color:var(--rr-cp-fg);font-weight:600}.rr-cp-chevron,.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp-input{flex:1;min-width:0;height:52px;padding:0;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:6px;scroll-padding:6px}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);box-shadow:inset 2px 0 0 var(--rr-cp-accent)}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-description{color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-match{background:var(--rr-cp-highlight-bg);color:var(--rr-cp-highlight);font-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-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"],
|
|
930
1003
|
dependencies: [{
|
|
931
1004
|
kind: "directive",
|
|
932
1005
|
type: NgTemplateOutlet,
|
|
@@ -958,8 +1031,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
958
1031
|
"(document:keydown)": "onDocumentKeydown($event)",
|
|
959
1032
|
"(document:focusin)": "onDocumentFocusin($event)"
|
|
960
1033
|
},
|
|
961
|
-
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 <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n {{ labels.empty }}\n }\n </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
962
|
-
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: #71717a;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--rr-cp-border)}.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp-input{flex:1;min-width:0;height:52px;padding:0;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:6px;scroll-padding:6px}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);box-shadow:inset 2px 0 0 var(--rr-cp-accent)}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-description{color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-match{background:var(--rr-cp-highlight-bg);color:var(--rr-cp-highlight);font-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-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"]
|
|
1034
|
+
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 (service.path(); as path) {\n @if (path.length) {\n <nav class=\"rr-cp-path\">\n <button\n type=\"button\"\n class=\"rr-cp-path-back\"\n [attr.aria-label]=\"labels.back\"\n (click)=\"onBack(1)\"\n >\n <svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" aria-hidden=\"true\">\n <path\n d=\"m15 6-6 6 6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n @for (parent of path; track parent.id; let i = $index; let last = $last) {\n @if (last) {\n <span class=\"rr-cp-path-current\" aria-current=\"page\">{{ parent.label }}</span>\n } @else {\n <button type=\"button\" class=\"rr-cp-path-step\" (click)=\"onBack(path.length - 1 - i)\">\n {{ parent.label }}\n </button>\n <span class=\"rr-cp-path-sep\" aria-hidden=\"true\">›</span>\n }\n }\n </nav>\n }\n }\n <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (hasChildren(row.item.command)) {\n <span class=\"rr-cp-sr-only\">, {{ labels.submenu }}</span>\n <span class=\"rr-cp-chevron\" aria-hidden=\"true\">›</span>\n }\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n {{ labels.empty }}\n }\n </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n",
|
|
1035
|
+
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: #71717a;--rr-cp-border: #e4e4e7;--rr-cp-accent: #4f46e5;--rr-cp-item-active-bg: #f4f4f5;--rr-cp-highlight: #4f46e5;--rr-cp-highlight-bg: transparent;--rr-cp-kbd-bg: #f4f4f5;--rr-cp-kbd-fg: #52525b;--rr-cp-backdrop: rgb(9 9 11 / .4);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .2);--rr-cp-duration: .14s}:where(.rr-cp[data-theme=dark]){--rr-cp-bg: #18181b;--rr-cp-fg: #f4f4f5;--rr-cp-muted: #a1a1aa;--rr-cp-border: #27272a;--rr-cp-accent: #818cf8;--rr-cp-item-active-bg: #27272a;--rr-cp-highlight: #a5b4fc;--rr-cp-kbd-bg: #27272a;--rr-cp-kbd-fg: #d4d4d8;--rr-cp-backdrop: rgb(0 0 0 / .6);--rr-cp-shadow: 0 16px 70px rgb(0 0 0 / .6)}.rr-cp-host{display:contents}.rr-cp{position:fixed;inset:0;z-index:var(--rr-cp-z-index);display:flex;justify-content:center;align-items:flex-start;padding:var(--rr-cp-top) 16px 16px;background:var(--rr-cp-backdrop);color-scheme:light;animation:rr-cp-fade var(--rr-cp-duration) ease-out}.rr-cp[data-theme=dark]{color-scheme:dark}.rr-cp-dialog{box-sizing:border-box;display:flex;flex-direction:column;width:100%;max-width:var(--rr-cp-width);overflow:hidden;border:1px solid var(--rr-cp-border);border-radius:var(--rr-cp-radius);background:var(--rr-cp-bg);color:var(--rr-cp-fg);box-shadow:var(--rr-cp-shadow);font-family:var(--rr-cp-font);font-size:var(--rr-cp-font-size);line-height:1.4;animation:rr-cp-pop var(--rr-cp-duration) ease-out}.rr-cp-search{display:flex;align-items:center;gap:10px;padding:0 14px;border-bottom:1px solid var(--rr-cp-border)}.rr-cp-path{display:flex;align-items:center;gap:4px;padding:10px 14px 0;color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-path button{display:inline-flex;align-items:center;padding:2px 6px;border:0;border-radius:6px;background:transparent;color:inherit;font:inherit;cursor:pointer}.rr-cp-path button:hover{background:var(--rr-cp-item-active-bg);color:var(--rr-cp-fg)}.rr-cp-path button:focus-visible{outline:2px solid var(--rr-cp-accent);outline-offset:1px}.rr-cp-path-current{padding:2px 6px;color:var(--rr-cp-fg);font-weight:600}.rr-cp-chevron,.rr-cp-search-icon{flex:none;color:var(--rr-cp-muted)}.rr-cp-input{flex:1;min-width:0;height:52px;padding:0;border:0;outline:0;background:transparent;color:inherit;font:inherit;font-size:1rem}.rr-cp-input::placeholder{color:var(--rr-cp-muted);opacity:1}.rr-cp-list{max-height:var(--rr-cp-max-height);overflow-y:auto;overscroll-behavior:contain;padding:6px;scroll-padding:6px}.rr-cp-list:empty{display:none}.rr-cp-group+.rr-cp-group{margin-top:4px}.rr-cp-group-label{padding:8px 10px 4px;color:var(--rr-cp-muted);font-size:.75rem;font-weight:600;letter-spacing:.02em}.rr-cp-item{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border-radius:var(--rr-cp-item-radius);cursor:pointer;-webkit-user-select:none;user-select:none}.rr-cp-item-active{background:var(--rr-cp-item-active-bg);box-shadow:inset 2px 0 0 var(--rr-cp-accent)}.rr-cp-item[aria-disabled=true]{cursor:default;opacity:.5}.rr-cp-icon{display:inline-flex;flex:none;align-items:center;justify-content:center;width:20px;height:20px;color:var(--rr-cp-muted)}.rr-cp-item-active .rr-cp-icon{color:var(--rr-cp-fg)}.rr-cp-text{display:flex;flex:1;flex-direction:column;min-width:0}.rr-cp-label,.rr-cp-description{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.rr-cp-description{color:var(--rr-cp-muted);font-size:.8125rem}.rr-cp-match{background:var(--rr-cp-highlight-bg);color:var(--rr-cp-highlight);font-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-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"]
|
|
963
1036
|
}]
|
|
964
1037
|
}],
|
|
965
1038
|
ctorParameters: () => [],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rrstudioapps-ngx-command-palette.mjs","names":[],"sources":["../../../projects/ngx-command-palette/src/lib/config.ts","../../../projects/ngx-command-palette/src/lib/fuzzy.ts","../../../projects/ngx-command-palette/src/lib/recent-store.ts","../../../projects/ngx-command-palette/src/lib/command-palette.service.ts","../../../projects/ngx-command-palette/src/lib/list-navigation.ts","../../../projects/ngx-command-palette/src/lib/shortcut.ts","../../../projects/ngx-command-palette/src/lib/templates.directive.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.html"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nexport type CommandPaletteTheme = 'light' | 'dark' | 'auto';\n\n/** Texts of the palette, for translations. */\nexport interface CommandPaletteLabels {\n readonly placeholder: string;\n readonly dialog: string;\n readonly listbox: string;\n readonly empty: string;\n readonly loading: string;\n readonly recent: string;\n readonly defaultGroup: string;\n /** Screen reader announcement, `{count}` is replaced by the number of results. */\n readonly results: string;\n readonly closeHint: string;\n}\n\nexport interface CommandPaletteRecentOptions {\n /** Max number of recents shown. Default: 5. */\n readonly max?: number;\n /** localStorage key. Default: `rr-cp:recent`. */\n readonly storageKey?: string;\n}\n\nexport interface CommandPaletteConfig {\n /** Shortcut(s) that toggle the palette. Default: `mod+k` (⌘K on macOS, Ctrl+K elsewhere). */\n readonly shortcut: string | readonly string[];\n /** `auto` follows `prefers-color-scheme`. Default: `auto`. */\n readonly theme: CommandPaletteTheme;\n /** \"Recent\" section shown with an empty query; `false` disables it. */\n readonly recent: CommandPaletteRecentOptions | false;\n /** Debounce for async providers, in ms. Default: 200. */\n readonly debounceMs: number;\n /** Max results of local commands for a non-empty query. Default: 50. */\n readonly maxResults: number;\n readonly labels: CommandPaletteLabels;\n}\n\nexport type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {\n readonly labels?: Partial<CommandPaletteLabels>;\n};\n\nexport const DEFAULT_COMMAND_PALETTE_LABELS: CommandPaletteLabels = {\n placeholder: 'Type a command or search…',\n dialog: 'Command palette',\n listbox: 'Commands',\n empty: 'No results found.',\n loading: 'Loading…',\n recent: 'Recent',\n defaultGroup: 'Commands',\n results: '{count} results',\n closeHint: 'Esc',\n};\n\nexport const DEFAULT_COMMAND_PALETTE_CONFIG: CommandPaletteConfig = {\n shortcut: 'mod+k',\n theme: 'auto',\n recent: { max: 5, storageKey: 'rr-cp:recent' },\n debounceMs: 200,\n maxResults: 50,\n labels: DEFAULT_COMMAND_PALETTE_LABELS,\n};\n\nexport const COMMAND_PALETTE_CONFIG = new InjectionToken<CommandPaletteConfig>(\n 'COMMAND_PALETTE_CONFIG',\n {\n providedIn: 'root',\n factory: () => DEFAULT_COMMAND_PALETTE_CONFIG,\n },\n);\n\n/** Merges options with the defaults. */\nexport function resolveConfig(options: CommandPaletteOptions = {}): CommandPaletteConfig {\n return {\n ...DEFAULT_COMMAND_PALETTE_CONFIG,\n ...options,\n recent:\n options.recent === false\n ? false\n : {\n ...(DEFAULT_COMMAND_PALETTE_CONFIG.recent as CommandPaletteRecentOptions),\n ...options.recent,\n },\n labels: { ...DEFAULT_COMMAND_PALETTE_LABELS, ...options.labels },\n };\n}\n\n/** Configures the command palette. Optional: without it the defaults are used. */\nexport function provideCommandPalette(options: CommandPaletteOptions = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: COMMAND_PALETTE_CONFIG, useValue: resolveConfig(options) },\n ]);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command, HighlightSegment } from './command.model';\n\nexport interface FuzzyMatch {\n /** Higher is better. Only meaningful to compare matches of the same query. */\n readonly score: number;\n /** Indices of `text` matched by the query, ascending. */\n readonly indices: readonly number[];\n}\n\n// Scoring weights: consecutive letters and word starts are worth more, gaps cost.\nconst SCORE_CHAR = 1;\nconst BONUS_CONSECUTIVE = 5;\nconst BONUS_WORD_START = 8;\nconst BONUS_STRING_START = 4;\nconst PENALTY_GAP = 1;\nconst PENALTY_LEADING = 0.2;\nconst SEPARATORS = new Set([' ', '-', '_', '.', '/', ':', '(', '[', ',']);\n\n/** Lowercase and without accents, one character in → one character out (keeps indices aligned). */\nfunction fold(char: string): string {\n const base = char.normalize('NFD').replace(/\\p{M}/gu, '');\n return (base[0] ?? char).toLowerCase();\n}\n\nfunction isWordStart(text: string, i: number): boolean {\n if (i === 0) return true;\n const prev = text[i - 1];\n if (SEPARATORS.has(prev)) return true;\n // camelCase: lowercase followed by uppercase\n const cur = text[i];\n return prev === prev.toLowerCase() && cur !== cur.toLowerCase() && cur === cur.toUpperCase();\n}\n\n/**\n * Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in\n * `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.\n */\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch | null {\n const q = query.replace(/\\s+/g, '').split('').map(fold);\n if (q.length === 0) return { score: 0, indices: [] };\n // Work on UTF-16 units so indices stay those of `text`.\n const t: string[] = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of -- for-of iterates code points and would shift the indices\n for (let i = 0; i < text.length; i++) t.push(fold(text[i]));\n const m = q.length;\n const n = t.length;\n if (m > n) return null;\n\n const NEG = -Infinity;\n // M[i][j]: best score with q[i] matched to t[j]\n // D[i][j]: best score with q[0..i] matched within t[0..j] (minus a penalty for characters skipped after)\n const M: Float64Array[] = [];\n const D: Float64Array[] = [];\n const bonus = new Float64Array(n);\n for (let j = 0; j < n; j++) {\n bonus[j] =\n SCORE_CHAR +\n (isWordStart(text, j) ? BONUS_WORD_START : 0) +\n (j === 0 ? BONUS_STRING_START : 0);\n }\n\n // For the traceback: where each M comes from (consecutive or jump) and which k gives each D\n const consec: Uint8Array[] = [];\n const Dk: Int32Array[] = [];\n for (let i = 0; i < m; i++) {\n const Mi = new Float64Array(n).fill(NEG);\n const Di = new Float64Array(n).fill(NEG);\n const Ci = new Uint8Array(n);\n const Ki = new Int32Array(n).fill(-1);\n for (let j = i; j < n; j++) {\n if (t[j] === q[i]) {\n if (i === 0) {\n Mi[j] = bonus[j] - PENALTY_LEADING * j;\n } else if (j > 0) {\n const consecutive = M[i - 1][j - 1] + BONUS_CONSECUTIVE;\n const jump = D[i - 1][j - 1];\n if (consecutive >= jump && consecutive > NEG) {\n Mi[j] = consecutive + bonus[j];\n Ci[j] = 1;\n } else if (jump > NEG) {\n Mi[j] = jump + bonus[j];\n }\n }\n }\n const carried = j > 0 ? Di[j - 1] - PENALTY_GAP : NEG;\n if (Mi[j] > NEG && Mi[j] >= carried) {\n Di[j] = Mi[j];\n Ki[j] = j;\n } else if (j > 0) {\n Di[j] = carried;\n Ki[j] = Ki[j - 1];\n }\n }\n M.push(Mi);\n D.push(Di);\n consec.push(Ci);\n Dk.push(Ki);\n }\n\n // End of the alignment: the best M on the last row\n let end = -1;\n let best = NEG;\n for (let j = m - 1; j < n; j++) {\n if (M[m - 1][j] > best) {\n best = M[m - 1][j];\n end = j;\n }\n }\n if (end < 0) return null;\n\n // Rebuild the indices backwards\n const indices = new Array<number>(m);\n let j = end;\n for (let i = m - 1; i >= 0; i--) {\n indices[i] = j;\n if (i === 0) break;\n j = consec[i][j] ? j - 1 : Dk[i - 1][j - 1];\n }\n\n // Small bonus for short strings: with equal matches the text closest to the query wins\n const score = best - (n - m) * 0.01;\n return { score, indices };\n}\n\n/** Splits `text` into matched / unmatched segments for highlighting. */\nexport function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[] {\n if (indices.length === 0) return text ? [{ text, match: false }] : [];\n const set = new Set(indices);\n const out: HighlightSegment[] = [];\n let buf = '';\n let bufMatch = set.has(0);\n for (let i = 0; i < text.length; i++) {\n const match = set.has(i);\n if (match !== bufMatch && buf) {\n out.push({ text: buf, match: bufMatch });\n buf = '';\n }\n bufMatch = match;\n buf += text[i];\n }\n if (buf) out.push({ text: buf, match: bufMatch });\n return out;\n}\n\n// Field weights: label first, then keywords, then description.\nconst WEIGHT_KEYWORD = 0.8;\nconst WEIGHT_DESCRIPTION = 0.5;\n/**\n * Minimum quality (average points per character) for keywords and description: long texts\n * contain almost any scattered letter sequence, so there we require word starts or close letters.\n */\nconst MIN_SECONDARY_QUALITY = 4;\n\nfunction strongEnough(match: FuzzyMatch | null, query: string): match is FuzzyMatch {\n const length = query.replace(/\\s+/g, '').length;\n return !!match && length > 0 && match.score / length >= MIN_SECONDARY_QUALITY;\n}\n\n/**\n * Matches a command against the query using label, keywords and description.\n * `indices` refer to the label (empty when only keywords/description matched).\n */\nexport function matchCommand(query: string, command: Command): FuzzyMatch | null {\n const label = fuzzyMatch(query, command.label);\n let best: FuzzyMatch | null = label;\n for (const keyword of command.keywords ?? []) {\n const m = fuzzyMatch(query, keyword);\n if (strongEnough(m, query) && (!best || m.score * WEIGHT_KEYWORD > best.score)) {\n best = { score: m.score * WEIGHT_KEYWORD, indices: label?.indices ?? [] };\n }\n }\n if (command.description) {\n const m = fuzzyMatch(query, command.description);\n if (strongEnough(m, query) && (!best || m.score * WEIGHT_DESCRIPTION > best.score)) {\n best = { score: m.score * WEIGHT_DESCRIPTION, indices: label?.indices ?? [] };\n }\n }\n return best;\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command } from './command.model';\n\n/** What is saved for a recent command: only serializable fields, never functions. */\nexport interface RecentEntry {\n readonly id: string;\n readonly label: string;\n readonly group?: string;\n readonly description?: string;\n readonly route?: string | readonly unknown[];\n}\n\n/**\n * Recent commands in `localStorage` (most recent first). Every access is guarded:\n * private windows, SSR or blocked storage just mean \"no recents\".\n */\nexport class RecentStore {\n constructor(\n private readonly storageKey: string,\n private readonly max: number,\n private readonly storage: Pick<\n Storage,\n 'getItem' | 'setItem' | 'removeItem'\n > | null = defaultStorage(),\n ) {}\n\n load(): RecentEntry[] {\n if (!this.storage || this.max <= 0) return [];\n try {\n const raw = this.storage.getItem(this.storageKey);\n if (!raw) return [];\n const parsed: unknown = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n return parsed.filter(isEntry).slice(0, this.max);\n } catch {\n return [];\n }\n }\n\n /** Moves `command` to the top and returns the new list. */\n add(command: Command, current: readonly RecentEntry[] = this.load()): RecentEntry[] {\n if (this.max <= 0) return [];\n const entry: RecentEntry = {\n id: command.id,\n label: command.label,\n ...(command.group ? { group: command.group } : {}),\n ...(command.description ? { description: command.description } : {}),\n ...(command.route !== undefined && isSerializable(command.route)\n ? { route: command.route }\n : {}),\n };\n const next = [entry, ...current.filter((e) => e.id !== command.id)].slice(0, this.max);\n this.save(next);\n return next;\n }\n\n clear(): void {\n try {\n this.storage?.removeItem(this.storageKey);\n } catch {\n /* storage not available */\n }\n }\n\n private save(entries: readonly RecentEntry[]): void {\n try {\n this.storage?.setItem(this.storageKey, JSON.stringify(entries));\n } catch {\n /* quota exceeded or storage blocked: recents stay in memory only */\n }\n }\n}\n\nfunction defaultStorage(): Storage | null {\n try {\n return typeof localStorage === 'undefined' ? null : localStorage;\n } catch {\n return null;\n }\n}\n\nfunction isEntry(value: unknown): value is RecentEntry {\n if (!value || typeof value !== 'object') return false;\n const v = value as Record<string, unknown>;\n return typeof v['id'] === 'string' && typeof v['label'] === 'string';\n}\n\nfunction isSerializable(route: unknown): boolean {\n try {\n JSON.stringify(route);\n return typeof route === 'string' || Array.isArray(route);\n } catch {\n return false;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport {\n DestroyRef,\n DOCUMENT,\n Injectable,\n Signal,\n assertInInjectionContext,\n computed,\n inject,\n isSignal,\n signal,\n} from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport type {\n Command,\n CommandProvider,\n CommandResult,\n CommandSection,\n CommandSubscribable,\n} from './command.model';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteRecentOptions } from './config';\nimport { fuzzyMatch, highlightSegments, matchCommand } from './fuzzy';\nimport { RecentStore, type RecentEntry } from './recent-store';\n\ninterface Registration {\n readonly source: () => readonly Command[];\n}\n\ninterface ProviderState {\n readonly items: readonly Command[];\n readonly loading: boolean;\n readonly error?: unknown;\n}\n\n/** In-flight provider request: debounce timer, abort controller and subscription. */\ninterface PendingRequest {\n timer?: ReturnType<typeof setTimeout>;\n controller?: AbortController;\n subscription?: { unsubscribe(): void };\n}\n\nexport const RECENT_SECTION_ID = 'recent';\n\n/**\n * State of the command palette. Register commands from any component: they are removed\n * automatically when that component is destroyed.\n */\n@Injectable({ providedIn: 'root' })\nexport class CommandPaletteService {\n private readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly router = inject(Router, { optional: true });\n private readonly document = inject(DOCUMENT);\n\n private readonly recentStore = this.config.recent\n ? new RecentStore(\n (this.config.recent as CommandPaletteRecentOptions).storageKey ?? 'rr-cp:recent',\n (this.config.recent as CommandPaletteRecentOptions).max ?? 5,\n )\n : null;\n\n private readonly _isOpen = signal(false);\n private readonly _query = signal('');\n private readonly registrations = signal<readonly Registration[]>([]);\n private readonly providers = signal<readonly CommandProvider[]>([]);\n private readonly providerState = signal<ReadonlyMap<string, ProviderState>>(new Map());\n private readonly recents = signal<readonly RecentEntry[]>(this.recentStore?.load() ?? []);\n private readonly pending = new Map<string, PendingRequest>();\n private returnFocus: HTMLElement | null = null;\n\n /** Whether the palette is open. */\n readonly isOpen = this._isOpen.asReadonly();\n /** Current search text. */\n readonly query = this._query.asReadonly();\n\n /** All registered (synchronous) commands. When two share an id, the last registered wins. */\n readonly commands: Signal<readonly Command[]> = computed(() => {\n const byId = new Map<string, Command>();\n for (const registration of this.registrations()) {\n for (const command of registration.source()) {\n byId.delete(command.id);\n byId.set(command.id, command);\n }\n }\n return [...byId.values()];\n });\n\n /** True while at least one async provider is waiting for results. */\n readonly loading = computed(() => [...this.providerState().values()].some((s) => s.loading));\n\n /** Sections shown in the list, already filtered and sorted. */\n readonly sections: Signal<readonly CommandSection[]> = computed(() =>\n this.buildSections(this._query().trim()),\n );\n\n /** Opens the palette, optionally with an initial query. */\n open(query = ''): void {\n if (!this._isOpen()) {\n const active = this.document.activeElement;\n // No instanceof HTMLElement: the class does not exist during SSR\n this.returnFocus =\n active &&\n active !== this.document.body &&\n typeof (active as HTMLElement).focus === 'function'\n ? (active as HTMLElement)\n : null;\n }\n this._isOpen.set(true);\n this.setQuery(query);\n }\n\n /** Closes the palette, cancels pending searches and restores the focus. */\n close(): void {\n if (!this._isOpen()) return;\n this._isOpen.set(false);\n this.cancelAll();\n this._query.set('');\n this.providerState.set(new Map());\n const target = this.returnFocus;\n this.returnFocus = null;\n if (target?.isConnected) target.focus({ preventScroll: true });\n }\n\n toggle(): void {\n if (this._isOpen()) this.close();\n else this.open();\n }\n\n /** Updates the search text and schedules the async providers. */\n setQuery(query: string): void {\n this._query.set(query);\n if (this._isOpen()) this.scheduleProviders();\n }\n\n /**\n * Registers commands (an array or a signal of arrays). Called in an injection context\n * (constructor, field initializer) they are removed when that context is destroyed.\n * Returns a function that removes them earlier.\n */\n register(\n commands: readonly Command[] | Signal<readonly Command[]>,\n destroyRef?: DestroyRef,\n ): () => void {\n const registration: Registration = { source: isSignal(commands) ? commands : () => commands };\n this.registrations.update((list) => [...list, registration]);\n const remove = () =>\n this.registrations.update((list) => list.filter((r) => r !== registration));\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Registers an async provider. Same lifetime rules as {@link register}. */\n registerProvider(provider: CommandProvider, destroyRef?: DestroyRef): () => void {\n this.providers.update((list) => [...list.filter((p) => p.id !== provider.id), provider]);\n if (this._isOpen()) this.scheduleProvider(provider, this._query());\n const remove = () => {\n if (!this.providers().includes(provider)) return;\n this.cancel(provider.id);\n this.providers.update((list) => list.filter((p) => p !== provider));\n this.providerState.update((map) => {\n const next = new Map(map);\n next.delete(provider.id);\n return next;\n });\n };\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Executes a command: saves it in the recents, closes the palette, then navigates or runs it. */\n async execute(command: Command): Promise<void> {\n if (command.disabled) return;\n const query = this._query();\n if (this.recentStore) this.recents.set(this.recentStore.add(command, this.recents()));\n this.close();\n if (command.route !== undefined) {\n if (!this.router) throw new Error('ngx-command-palette: route commands need provideRouter()');\n const { route, navigationExtras } = command;\n await (typeof route === 'string'\n ? this.router.navigateByUrl(route, navigationExtras)\n : this.router.navigate(route as unknown[], navigationExtras));\n } else {\n await command.run({ query });\n }\n }\n\n /** Removes all recents. */\n clearRecent(): void {\n this.recentStore?.clear();\n this.recents.set([]);\n }\n\n // ---- internals ----\n\n private bindToDestroy(remove: () => void, destroyRef?: DestroyRef): () => void {\n const ref = destroyRef ?? currentDestroyRef();\n const unsubscribe = ref?.onDestroy(remove);\n return () => {\n unsubscribe?.();\n remove();\n };\n }\n\n private buildSections(query: string): CommandSection[] {\n const defaultGroup = this.config.labels.defaultGroup;\n const commands = this.commands();\n const groups = new Map<string, CommandResult[]>();\n const push = (group: string, result: CommandResult) => {\n const list = groups.get(group);\n if (list) list.push(result);\n else groups.set(group, [result]);\n };\n const sections: CommandSection[] = [];\n\n if (!query) {\n const recent = this.recentResults(commands);\n if (recent.length)\n sections.push({ id: RECENT_SECTION_ID, label: this.config.labels.recent, items: recent });\n for (const command of commands) {\n const group = command.group ?? defaultGroup;\n push(group, toResult(command, `g:${group}:${command.id}`, 0, []));\n }\n } else {\n const scored: CommandResult[] = [];\n for (const command of commands) {\n const match = matchCommand(query, command);\n if (!match) continue;\n const group = command.group ?? defaultGroup;\n scored.push(toResult(command, `g:${group}:${command.id}`, match.score, match.indices));\n }\n // Stable sort: equal scores keep the registration order\n scored.sort((a, b) => b.score - a.score);\n for (const result of scored.slice(0, this.config.maxResults)) {\n push(result.command.group ?? defaultGroup, result);\n }\n }\n for (const [label, items] of groups) sections.push({ id: `g:${label}`, label, items });\n\n // Async results: server order, highlighted when the label matches\n const states = this.providerState();\n for (const provider of this.providers()) {\n const state = states.get(provider.id);\n if (!state?.items.length) continue;\n const items = state.items.map((command) => {\n const match = query ? fuzzyMatch(query, command.label) : null;\n return toResult(\n command,\n `p:${provider.id}:${command.id}`,\n match?.score ?? 0,\n match?.indices ?? [],\n );\n });\n sections.push({ id: `p:${provider.id}`, label: provider.group, items });\n }\n return sections;\n }\n\n private recentResults(commands: readonly Command[]): CommandResult[] {\n if (!this.recentStore) return [];\n const byId = new Map(commands.map((c) => [c.id, c]));\n const results: CommandResult[] = [];\n for (const entry of this.recents()) {\n // Still registered, or rebuilt from the saved route (e.g. a customer from an API)\n const command: Command | undefined =\n byId.get(entry.id) ??\n (entry.route !== undefined\n ? {\n id: entry.id,\n label: entry.label,\n route: entry.route,\n ...(entry.group ? { group: entry.group } : {}),\n ...(entry.description ? { description: entry.description } : {}),\n }\n : undefined);\n if (command && !command.disabled) results.push(toResult(command, `r:${entry.id}`, 0, []));\n }\n return results;\n }\n\n private scheduleProviders(): void {\n const query = this._query();\n for (const provider of this.providers()) this.scheduleProvider(provider, query);\n }\n\n private scheduleProvider(provider: CommandProvider, rawQuery: string): void {\n this.cancel(provider.id);\n const query = rawQuery.trim();\n if (query.length < (provider.minQueryLength ?? 1)) {\n this.setProviderState(provider.id, null);\n return;\n }\n const previous = this.providerState().get(provider.id);\n this.setProviderState(provider.id, { items: previous?.items ?? [], loading: true });\n const request: PendingRequest = {};\n this.pending.set(provider.id, request);\n request.timer = setTimeout(() => {\n request.timer = undefined;\n const controller = new AbortController();\n request.controller = controller;\n const done = (state: ProviderState) => {\n if (!controller.signal.aborted && this.pending.get(provider.id) === request) {\n this.setProviderState(provider.id, state);\n }\n };\n let result: ReturnType<CommandProvider['search']>;\n try {\n result = provider.search(query, controller.signal);\n } catch (error) {\n done({ items: [], loading: false, error });\n return;\n }\n if (isSubscribable(result)) {\n request.subscription = result.subscribe({\n next: (items) => done({ items, loading: false }),\n error: (error) => done({ items: [], loading: false, error }),\n complete: () => {\n const state = this.providerState().get(provider.id);\n if (state?.loading) done({ items: state.items, loading: false });\n },\n });\n } else {\n Promise.resolve(result).then(\n (items) => done({ items, loading: false }),\n (error: unknown) => done({ items: [], loading: false, error }),\n );\n }\n }, provider.debounceMs ?? this.config.debounceMs);\n }\n\n private setProviderState(id: string, state: ProviderState | null): void {\n this.providerState.update((map) => {\n const next = new Map(map);\n if (state) next.set(id, state);\n else next.delete(id);\n return next;\n });\n }\n\n private cancel(id: string): void {\n const request = this.pending.get(id);\n if (!request) return;\n this.pending.delete(id);\n if (request.timer) clearTimeout(request.timer);\n request.controller?.abort();\n request.subscription?.unsubscribe();\n }\n\n private cancelAll(): void {\n for (const id of [...this.pending.keys()]) this.cancel(id);\n }\n}\n\nfunction toResult(\n command: Command,\n key: string,\n score: number,\n indices: readonly number[],\n): CommandResult {\n return { command, key, score, indices, segments: highlightSegments(command.label, indices) };\n}\n\nfunction isSubscribable<T>(value: unknown): value is CommandSubscribable<T> {\n return !!value && typeof (value as { subscribe?: unknown }).subscribe === 'function';\n}\n\nfunction currentDestroyRef(): DestroyRef | null {\n try {\n return inject(DestroyRef, { optional: true });\n } catch {\n // Outside an injection context: removal stays manual\n return null;\n }\n}\n\n/**\n * Registers commands for the lifetime of the current component/service.\n * Must be called in an injection context.\n */\nexport function injectCommands(\n commands: readonly Command[] | Signal<readonly Command[]>,\n): () => void {\n assertInInjectionContext(injectCommands);\n return inject(CommandPaletteService).register(commands, inject(DestroyRef));\n}\n\n/** Registers an async provider for the lifetime of the current component/service. */\nexport function injectCommandProvider(provider: CommandProvider): () => void {\n assertInInjectionContext(injectCommandProvider);\n return inject(CommandPaletteService).registerProvider(provider, inject(DestroyRef));\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nexport type NavigationAction = 'next' | 'prev' | 'first' | 'last' | 'select' | 'close';\n\ntype KeyLike = Pick<\n KeyboardEvent,\n 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey' | 'isComposing'\n>;\n\n/** Maps a keydown inside the palette to a list action, or `null` to let the input handle it. */\nexport function keyToAction(event: KeyLike): NavigationAction | null {\n // During IME composition Enter and arrows belong to the text editor\n if (event.isComposing) return null;\n switch (event.key) {\n case 'ArrowDown':\n return 'next';\n case 'ArrowUp':\n return 'prev';\n case 'Home':\n return event.shiftKey ? null : 'first';\n case 'End':\n return event.shiftKey ? null : 'last';\n case 'PageUp':\n return 'first';\n case 'PageDown':\n return 'last';\n case 'Enter':\n return 'select';\n case 'Escape':\n return 'close';\n // Ctrl+N / Ctrl+P as in Emacs and many palettes (not Ctrl+J/K: Ctrl+K toggles the palette)\n case 'n':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'next' : null;\n case 'p':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'prev' : null;\n default:\n return null;\n }\n}\n\n/**\n * Index of the next selectable item. `disabled[i]` marks rows that cannot be active.\n * Returns -1 when no item is selectable. `next`/`prev` wrap around.\n */\nexport function moveIndex(\n disabled: readonly boolean[],\n current: number,\n action: 'next' | 'prev' | 'first' | 'last',\n): number {\n const count = disabled.length;\n if (count === 0) return -1;\n const findFrom = (start: number, step: 1 | -1, wrap: boolean): number => {\n for (let n = 0, i = start; n < count; n++, i += step) {\n if (wrap) i = (i + count) % count;\n else if (i < 0 || i >= count) return -1;\n if (!disabled[i]) return i;\n }\n return -1;\n };\n switch (action) {\n case 'first':\n return findFrom(0, 1, false);\n case 'last':\n return findFrom(count - 1, -1, false);\n case 'next':\n return current < 0 ? findFrom(0, 1, false) : findFrom(current + 1, 1, true);\n case 'prev':\n return current < 0 ? findFrom(count - 1, -1, false) : findFrom(current - 1, -1, true);\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\n/** A parsed keyboard shortcut such as `mod+k` or `ctrl+shift+p`. */\nexport interface ParsedShortcut {\n readonly key: string;\n readonly mod: boolean;\n readonly ctrl: boolean;\n readonly meta: boolean;\n readonly alt: boolean;\n readonly shift: boolean;\n}\n\nconst MODIFIERS: Record<string, keyof Omit<ParsedShortcut, 'key'>> = {\n mod: 'mod',\n ctrl: 'ctrl',\n control: 'ctrl',\n meta: 'meta',\n cmd: 'meta',\n command: 'meta',\n alt: 'alt',\n option: 'alt',\n shift: 'shift',\n};\n\nconst KEY_ALIASES: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n slash: '/',\n plus: '+',\n};\n\n/**\n * Parses a shortcut string. Parts are separated by `+`; `mod` means ⌘ on Apple\n * platforms and Ctrl elsewhere. Examples: `mod+k`, `ctrl+shift+p`, `/`.\n */\nexport function parseShortcut(shortcut: string): ParsedShortcut {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map((p) => p.trim())\n .filter(Boolean);\n if (shortcut.trim().endsWith('++') || shortcut.trim() === '+') parts.push('+');\n const result = { key: '', mod: false, ctrl: false, meta: false, alt: false, shift: false };\n for (const part of parts) {\n const modifier = MODIFIERS[part];\n if (modifier) result[modifier] = true;\n else result.key = KEY_ALIASES[part] ?? part;\n }\n if (!result.key) throw new Error(`ngx-command-palette: invalid shortcut \"${shortcut}\"`);\n return result;\n}\n\n/** True on macOS / iOS, where `mod` maps to the ⌘ key. */\nexport function isApplePlatform(nav: Navigator | undefined = globalThis.navigator): boolean {\n if (!nav) return false;\n const platform =\n (nav as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform ??\n nav.platform ??\n '';\n return /mac|iphone|ipad|ipod/i.test(platform);\n}\n\ntype KeyEventLike = Pick<\n KeyboardEvent,\n 'key' | 'code' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey'\n>;\n\n/** True when `event` matches `shortcut`. Letters also match by physical key (non-Latin layouts). */\nexport function matchesShortcut(\n event: KeyEventLike,\n shortcut: ParsedShortcut,\n apple: boolean,\n): boolean {\n const wantCtrl = shortcut.ctrl || (shortcut.mod && !apple);\n const wantMeta = shortcut.meta || (shortcut.mod && apple);\n if (event.ctrlKey !== wantCtrl || event.metaKey !== wantMeta || event.altKey !== shortcut.alt) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n // Shift matters only when requested or for letters (\"?\" needs Shift, but nobody writes it)\n const isLetter = /^[a-z]$/.test(shortcut.key);\n if ((shortcut.shift || isLetter) && event.shiftKey !== shortcut.shift) return false;\n if (key === shortcut.key) return true;\n // With Alt or non-Latin layouts event.key changes: fall back to the physical key\n if (isLetter && event.code === `Key${shortcut.key.toUpperCase()}`) return true;\n if (/^[0-9]$/.test(shortcut.key) && event.code === `Digit${shortcut.key}`) return true;\n return false;\n}\n\n/** Human readable label, e.g. `⌘K` on macOS and `Ctrl+K` elsewhere. */\nexport function formatShortcut(shortcut: ParsedShortcut, apple: boolean): string {\n const key =\n shortcut.key === ' '\n ? 'Space'\n : shortcut.key.length === 1\n ? shortcut.key.toUpperCase()\n : capitalize(shortcut.key);\n if (apple) {\n return (\n (shortcut.ctrl ? '⌃' : '') +\n (shortcut.alt ? '⌥' : '') +\n (shortcut.shift ? '⇧' : '') +\n (shortcut.meta || shortcut.mod ? '⌘' : '') +\n key\n );\n }\n const parts: string[] = [];\n if (shortcut.ctrl || shortcut.mod) parts.push('Ctrl');\n if (shortcut.meta) parts.push('Win');\n if (shortcut.alt) parts.push('Alt');\n if (shortcut.shift) parts.push('Shift');\n parts.push(key);\n return parts.join('+');\n}\n\nfunction capitalize(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { Directive, TemplateRef, inject } from '@angular/core';\n\nimport type { Command, CommandResult, HighlightSegment } from './command.model';\n\nexport interface CommandItemContext {\n /** The command. */\n readonly $implicit: Command;\n readonly result: CommandResult;\n /** Label split into matched / unmatched parts. */\n readonly segments: readonly HighlightSegment[];\n /** True for the row selected with the keyboard or the mouse. */\n readonly active: boolean;\n readonly query: string;\n}\n\nexport interface CommandEmptyContext {\n /** The search text. */\n readonly $implicit: string;\n}\n\n/**\n * Custom template for each row:\n * `<ng-template rrCommandItem let-command let-segments=\"segments\">…</ng-template>`\n */\n@Directive({ selector: 'ng-template[rrCommandItem]' })\nexport class CommandItemTemplate {\n readonly template = inject<TemplateRef<CommandItemContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandItemTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandItemContext {\n return true;\n }\n}\n\n/** Custom empty state: `<ng-template rrCommandEmpty let-query>…</ng-template>` */\n@Directive({ selector: 'ng-template[rrCommandEmpty]' })\nexport class CommandEmptyTemplate {\n readonly template = inject<TemplateRef<CommandEmptyContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandEmptyTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandEmptyContext {\n return true;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n DestroyRef,\n ElementRef,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n computed,\n contentChild,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport type { CommandResult } from './command.model';\nimport { CommandPaletteService } from './command-palette.service';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteTheme } from './config';\nimport { keyToAction, moveIndex } from './list-navigation';\nimport { formatShortcut, isApplePlatform, matchesShortcut, parseShortcut } from './shortcut';\nimport { CommandEmptyTemplate, CommandItemTemplate } from './templates.directive';\n\nlet nextId = 0;\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * The command palette dialog. Place it once, usually in the root component template.\n * It listens to the global shortcut and renders nothing while closed.\n */\n@Component({\n selector: 'rr-command-palette',\n imports: [NgTemplateOutlet],\n templateUrl: './command-palette.component.html',\n styleUrl: './command-palette.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'rr-cp-host',\n '(document:keydown)': 'onDocumentKeydown($event)',\n '(document:focusin)': 'onDocumentFocusin($event)',\n },\n})\nexport class CommandPaletteComponent {\n protected readonly service = inject(CommandPaletteService);\n protected readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly document = inject(DOCUMENT);\n\n /** Overrides the `theme` of `provideCommandPalette()`, e.g. to follow your app's theme toggle. */\n readonly theme = input<CommandPaletteTheme | undefined>(undefined);\n\n protected readonly itemTemplate = contentChild(CommandItemTemplate);\n protected readonly emptyTemplate = contentChild(CommandEmptyTemplate);\n private readonly input = viewChild<ElementRef<HTMLInputElement>>('input');\n private readonly dialog = viewChild<ElementRef<HTMLElement>>('dialog');\n\n protected readonly uid = `rr-cp-${nextId++}`;\n protected readonly labels = this.config.labels;\n private readonly apple = isApplePlatform();\n private readonly shortcuts = (typeof this.config.shortcut === 'string'\n ? [this.config.shortcut]\n : this.config.shortcut\n ).map(parseShortcut);\n /** Label of the first shortcut, e.g. `⌘K` or `Ctrl+K`, for a \"search\" button in your UI. */\n readonly shortcutLabel = this.shortcuts.length\n ? formatShortcut(this.shortcuts[0], this.apple)\n : '';\n\n private readonly prefersDark = signal(false);\n protected readonly resolvedTheme = computed(() => {\n const theme = this.theme() ?? this.config.theme;\n return theme === 'auto' ? (this.prefersDark() ? 'dark' : 'light') : theme;\n });\n\n /** Sections with the flat index of each row (used for ids and keyboard navigation). */\n protected readonly view = computed(() => {\n let index = 0;\n return this.service.sections().map((section, sectionIndex) => ({\n section,\n headingId: `${this.uid}-group-${sectionIndex}`,\n rows: section.items.map((item) => ({ item, index: index++ })),\n }));\n });\n protected readonly items = computed<readonly CommandResult[]>(() =>\n this.service.sections().flatMap((s) => s.items),\n );\n private readonly activeKey = signal<string | null>(null);\n protected readonly activeIndex = computed(() => {\n const items = this.items();\n const key = this.activeKey();\n const found = key === null ? -1 : items.findIndex((i) => i.key === key);\n if (found >= 0 && !items[found].command.disabled) return found;\n return moveIndex(\n items.map((i) => !!i.command.disabled),\n -1,\n 'first',\n );\n });\n protected readonly activeDescendant = computed(() => {\n const index = this.activeIndex();\n return index >= 0 ? this.optionId(index) : null;\n });\n protected readonly status = computed(() => {\n if (this.service.loading()) return this.labels.loading;\n const count = this.items().length;\n return count === 0 ? this.labels.empty : this.labels.results.replace('{count}', String(count));\n });\n\n constructor() {\n const view = this.document.defaultView;\n const media = view?.matchMedia?.('(prefers-color-scheme: dark)');\n if (media) {\n this.prefersDark.set(media.matches);\n const listener = (e: MediaQueryListEvent) => this.prefersDark.set(e.matches);\n media.addEventListener?.('change', listener);\n inject(DestroyRef).onDestroy(() => media.removeEventListener?.('change', listener));\n }\n\n // Focus the search field as soon as the dialog appears\n afterRenderEffect(() => {\n const input = this.input()?.nativeElement;\n if (input && this.document.activeElement !== input) input.focus({ preventScroll: true });\n });\n // Keep the active row visible during keyboard navigation\n afterRenderEffect(() => {\n const id = this.activeDescendant();\n if (!id) return;\n const option = this.document.getElementById(id);\n option?.scrollIntoView?.({ block: 'nearest' });\n });\n }\n\n protected optionId(index: number): string {\n return `${this.uid}-option-${index}`;\n }\n\n protected isTemplate(icon: unknown): icon is TemplateRef<unknown> {\n return icon instanceof TemplateRef;\n }\n\n protected onInput(event: Event): void {\n this.activeKey.set(null);\n this.service.setQuery((event.target as HTMLInputElement).value);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Tab') {\n this.trapTab(event);\n return;\n }\n const action = keyToAction(event);\n if (!action) return;\n event.preventDefault();\n event.stopPropagation();\n const items = this.items();\n switch (action) {\n case 'close':\n this.service.close();\n return;\n case 'select': {\n const item = items[this.activeIndex()];\n if (item) void this.service.execute(item.command);\n return;\n }\n default: {\n const next = moveIndex(\n items.map((i) => !!i.command.disabled),\n this.activeIndex(),\n action,\n );\n if (next >= 0) this.activeKey.set(items[next].key);\n }\n }\n }\n\n protected onPointerMove(item: CommandResult): void {\n if (!item.command.disabled && this.activeKey() !== item.key) this.activeKey.set(item.key);\n }\n\n protected onSelect(item: CommandResult): void {\n void this.service.execute(item.command);\n }\n\n protected onOverlayDown(event: MouseEvent): void {\n // Only a click on the backdrop, not inside the dialog\n if (event.target === event.currentTarget) this.service.close();\n }\n\n protected onDocumentKeydown(event: KeyboardEvent): void {\n if (event.repeat || event.isComposing) return;\n // Shortcuts without Ctrl/⌘/Alt (e.g. \"/\") do not fire while typing in a field\n const typing = isEditable(event.target);\n const hit = this.shortcuts.some(\n (s) =>\n (!typing || s.mod || s.ctrl || s.meta || s.alt) && matchesShortcut(event, s, this.apple),\n );\n if (hit) {\n event.preventDefault();\n this.activeKey.set(null);\n this.service.toggle();\n }\n }\n\n protected onDocumentFocusin(event: FocusEvent): void {\n if (!this.service.isOpen()) return;\n const dialog = this.dialog()?.nativeElement;\n // Focus trap: if focus leaves the dialog (e.g. an iframe click or a scripted focus) it returns to the input\n if (dialog && event.target instanceof Node && !dialog.contains(event.target)) {\n this.input()?.nativeElement.focus({ preventScroll: true });\n }\n }\n\n private trapTab(event: KeyboardEvent): void {\n const dialog = this.dialog()?.nativeElement;\n if (!dialog) return;\n const focusable = Array.from(dialog.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length <= 1) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = this.document.activeElement;\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n }\n}\n\nfunction isEditable(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el || typeof el.tagName !== 'string') return false;\n const tag = el.tagName.toLowerCase();\n return tag === 'input' || tag === 'textarea' || tag === 'select' || el.isContentEditable;\n}\n","@if (service.isOpen()) {\n <div class=\"rr-cp\" [attr.data-theme]=\"resolvedTheme()\" (mousedown)=\"onOverlayDown($event)\">\n <div\n #dialog\n class=\"rr-cp-dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"labels.dialog\"\n (keydown)=\"onKeydown($event)\"\n >\n <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n {{ labels.empty }}\n }\n </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n"],"mappings":";;;;AA8CA,MAAa,iCAAuD;CAClE,aAAa;CACb,QAAQ;CACR,SAAS;CACT,OAAO;CACP,SAAS;CACT,QAAQ;CACR,cAAc;CACd,SAAS;CACT,WAAW;AACZ;AAED,MAAa,iCAAuD;CAClE,UAAU;CACV,OAAO;CACP,QAAQ;EAAE,KAAK;EAAG,YAAY;CAAc;CAC5C,YAAY;CACZ,YAAY;CACZ,QAAQ;AACT;AAED,MAAa,yBAAyB,IAAI,eACxC,0BACA;CACE,YAAY;CACZ,eAAe;AAChB,CAAA;AAIH,SAAgB,cAAc,UAAiC,CAAA,GAAE;CAC/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AAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,cAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAAA,mBAAmB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,eAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAClB,oBAAoB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,OAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACH,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CACX,UAAQ,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA;AAmLvE,SAAS,WAAW,QAA0B;CAC5C,MAAM,KAAK;CACX,IAAI,CAAC,MAAM,OAAO,GAAG,YAAY,UAAU,OAAO;CAClD,MAAM,MAAM,GAAG,QAAQ,YAAW;CAClC,OAAO,QAAQ,WAAW,QAAQ,cAAc,QAAQ,YAAY,GAAG;AACzE"}
|
|
1
|
+
{"version":3,"file":"rrstudioapps-ngx-command-palette.mjs","names":[],"sources":["../../../projects/ngx-command-palette/src/lib/fuzzy.ts","../../../projects/ngx-command-palette/src/lib/config.ts","../../../projects/ngx-command-palette/src/lib/recent-store.ts","../../../projects/ngx-command-palette/src/lib/command-palette.service.ts","../../../projects/ngx-command-palette/src/lib/list-navigation.ts","../../../projects/ngx-command-palette/src/lib/shortcut.ts","../../../projects/ngx-command-palette/src/lib/templates.directive.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.ts","../../../projects/ngx-command-palette/src/lib/command-palette.component.html"],"sourcesContent":["// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command, HighlightSegment } from './command.model';\n\nexport interface FuzzyMatch {\n /** Higher is better. Only meaningful to compare matches of the same query. */\n readonly score: number;\n /** Indices of `text` matched by the query, ascending. */\n readonly indices: readonly number[];\n}\n\n// Scoring weights: consecutive letters and word starts are worth more, gaps cost.\nconst SCORE_CHAR = 1;\nconst BONUS_CONSECUTIVE = 5;\nconst BONUS_WORD_START = 8;\nconst BONUS_STRING_START = 4;\nconst PENALTY_GAP = 1;\nconst PENALTY_LEADING = 0.2;\nconst SEPARATORS = new Set([' ', '-', '_', '.', '/', ':', '(', '[', ',']);\n\n/** Lowercase and without accents, one character in → one character out (keeps indices aligned). */\nfunction fold(char: string): string {\n const base = char.normalize('NFD').replace(/\\p{M}/gu, '');\n return (base[0] ?? char).toLowerCase();\n}\n\nfunction isWordStart(text: string, i: number): boolean {\n if (i === 0) return true;\n const prev = text[i - 1];\n if (SEPARATORS.has(prev)) return true;\n // camelCase: lowercase followed by uppercase\n const cur = text[i];\n return prev === prev.toLowerCase() && cur !== cur.toLowerCase() && cur === cur.toUpperCase();\n}\n\n/**\n * Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in\n * `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.\n */\nexport function fuzzyMatch(query: string, text: string): FuzzyMatch | null {\n const q = query.replace(/\\s+/g, '').split('').map(fold);\n if (q.length === 0) return { score: 0, indices: [] };\n // Work on UTF-16 units so indices stay those of `text`.\n const t: string[] = [];\n // eslint-disable-next-line @typescript-eslint/prefer-for-of -- for-of iterates code points and would shift the indices\n for (let i = 0; i < text.length; i++) t.push(fold(text[i]));\n const m = q.length;\n const n = t.length;\n if (m > n) return null;\n\n const NEG = -Infinity;\n // M[i][j]: best score with q[i] matched to t[j]\n // D[i][j]: best score with q[0..i] matched within t[0..j] (minus a penalty for characters skipped after)\n const M: Float64Array[] = [];\n const D: Float64Array[] = [];\n const bonus = new Float64Array(n);\n for (let j = 0; j < n; j++) {\n bonus[j] =\n SCORE_CHAR +\n (isWordStart(text, j) ? BONUS_WORD_START : 0) +\n (j === 0 ? BONUS_STRING_START : 0);\n }\n\n // For the traceback: where each M comes from (consecutive or jump) and which k gives each D\n const consec: Uint8Array[] = [];\n const Dk: Int32Array[] = [];\n for (let i = 0; i < m; i++) {\n const Mi = new Float64Array(n).fill(NEG);\n const Di = new Float64Array(n).fill(NEG);\n const Ci = new Uint8Array(n);\n const Ki = new Int32Array(n).fill(-1);\n for (let j = i; j < n; j++) {\n if (t[j] === q[i]) {\n if (i === 0) {\n Mi[j] = bonus[j] - PENALTY_LEADING * j;\n } else if (j > 0) {\n const consecutive = M[i - 1][j - 1] + BONUS_CONSECUTIVE;\n const jump = D[i - 1][j - 1];\n if (consecutive >= jump && consecutive > NEG) {\n Mi[j] = consecutive + bonus[j];\n Ci[j] = 1;\n } else if (jump > NEG) {\n Mi[j] = jump + bonus[j];\n }\n }\n }\n const carried = j > 0 ? Di[j - 1] - PENALTY_GAP : NEG;\n if (Mi[j] > NEG && Mi[j] >= carried) {\n Di[j] = Mi[j];\n Ki[j] = j;\n } else if (j > 0) {\n Di[j] = carried;\n Ki[j] = Ki[j - 1];\n }\n }\n M.push(Mi);\n D.push(Di);\n consec.push(Ci);\n Dk.push(Ki);\n }\n\n // End of the alignment: the best M on the last row\n let end = -1;\n let best = NEG;\n for (let j = m - 1; j < n; j++) {\n if (M[m - 1][j] > best) {\n best = M[m - 1][j];\n end = j;\n }\n }\n if (end < 0) return null;\n\n // Rebuild the indices backwards\n const indices = new Array<number>(m);\n let j = end;\n for (let i = m - 1; i >= 0; i--) {\n indices[i] = j;\n if (i === 0) break;\n j = consec[i][j] ? j - 1 : Dk[i - 1][j - 1];\n }\n\n // Small bonus for short strings: with equal matches the text closest to the query wins\n const score = best - (n - m) * 0.01;\n return { score, indices };\n}\n\n/** Splits `text` into matched / unmatched segments for highlighting. */\nexport function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[] {\n if (indices.length === 0) return text ? [{ text, match: false }] : [];\n const set = new Set(indices);\n const out: HighlightSegment[] = [];\n let buf = '';\n let bufMatch = set.has(0);\n for (let i = 0; i < text.length; i++) {\n const match = set.has(i);\n if (match !== bufMatch && buf) {\n out.push({ text: buf, match: bufMatch });\n buf = '';\n }\n bufMatch = match;\n buf += text[i];\n }\n if (buf) out.push({ text: buf, match: bufMatch });\n return out;\n}\n\n// Field weights: label first, then keywords, then description.\nconst WEIGHT_KEYWORD = 0.8;\nconst WEIGHT_DESCRIPTION = 0.5;\n/**\n * Minimum quality (average points per character) for keywords and description: long texts\n * contain almost any scattered letter sequence, so there we require word starts or close letters.\n */\nconst MIN_SECONDARY_QUALITY = 4;\n\nfunction strongEnough(match: FuzzyMatch | null, query: string): match is FuzzyMatch {\n const length = query.replace(/\\s+/g, '').length;\n return !!match && length > 0 && match.score / length >= MIN_SECONDARY_QUALITY;\n}\n\n/**\n * Matches a command against the query using label, keywords and description.\n * `indices` refer to the label (empty when only keywords/description matched).\n */\nexport function matchCommand(query: string, command: Command): FuzzyMatch | null {\n const label = fuzzyMatch(query, command.label);\n let best: FuzzyMatch | null = label;\n for (const keyword of command.keywords ?? []) {\n const m = fuzzyMatch(query, keyword);\n if (strongEnough(m, query) && (!best || m.score * WEIGHT_KEYWORD > best.score)) {\n best = { score: m.score * WEIGHT_KEYWORD, indices: label?.indices ?? [] };\n }\n }\n if (command.description) {\n const m = fuzzyMatch(query, command.description);\n if (strongEnough(m, query) && (!best || m.score * WEIGHT_DESCRIPTION > best.score)) {\n best = { score: m.score * WEIGHT_DESCRIPTION, indices: label?.indices ?? [] };\n }\n }\n return best;\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '@angular/core';\n\nimport type { Command } from './command.model';\nimport { matchCommand, type FuzzyMatch } from './fuzzy';\n\nexport type CommandPaletteTheme = 'light' | 'dark' | 'auto';\n\n/** Texts of the palette, for translations. */\nexport interface CommandPaletteLabels {\n readonly placeholder: string;\n readonly dialog: string;\n readonly listbox: string;\n readonly empty: string;\n readonly loading: string;\n readonly recent: string;\n readonly defaultGroup: string;\n /** Screen reader announcement, `{count}` is replaced by the number of results. */\n readonly results: string;\n readonly closeHint: string;\n /** Label of the button that goes back one level of a sub-palette. */\n readonly back: string;\n /** Screen reader announcement when a sub-palette is opened; `{name}` and `{count}` are replaced. */\n readonly level: string;\n /** Screen reader hint added to a command that opens a sub-palette. */\n readonly submenu: string;\n}\n\n/**\n * Decides whether `command` matches the search text and how well. Return `null` to hide the\n * command. A higher `score` ranks first; `indices` are the label characters to highlight.\n */\nexport type CommandFilter = (query: string, command: Command) => FuzzyMatch | null;\n\nexport interface CommandPaletteRecentOptions {\n /** Max number of recents shown. Default: 5. */\n readonly max?: number;\n /** localStorage key. Default: `rr-cp:recent`. */\n readonly storageKey?: string;\n}\n\nexport interface CommandPaletteConfig {\n /** Shortcut(s) that toggle the palette. Default: `mod+k` (⌘K on macOS, Ctrl+K elsewhere). */\n readonly shortcut: string | readonly string[];\n /** `auto` follows `prefers-color-scheme`. Default: `auto`. */\n readonly theme: CommandPaletteTheme;\n /** \"Recent\" section shown with an empty query; `false` disables it. */\n readonly recent: CommandPaletteRecentOptions | false;\n /** Debounce for async providers, in ms. Default: 200. */\n readonly debounceMs: number;\n /** Max results of local commands for a non-empty query. Default: 50. */\n readonly maxResults: number;\n /** Matching and ranking of local commands for a non-empty query. Default: the built-in fuzzy search. */\n readonly filter: CommandFilter;\n readonly labels: CommandPaletteLabels;\n}\n\nexport type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {\n readonly labels?: Partial<CommandPaletteLabels>;\n};\n\nexport const DEFAULT_COMMAND_PALETTE_LABELS: CommandPaletteLabels = {\n placeholder: 'Type a command or search…',\n dialog: 'Command palette',\n listbox: 'Commands',\n empty: 'No results found.',\n loading: 'Loading…',\n recent: 'Recent',\n defaultGroup: 'Commands',\n results: '{count} results',\n closeHint: 'Esc',\n back: 'Back',\n level: '{name}: {count} results',\n submenu: 'opens a sub-palette',\n};\n\nexport const DEFAULT_COMMAND_PALETTE_CONFIG: CommandPaletteConfig = {\n shortcut: 'mod+k',\n theme: 'auto',\n recent: { max: 5, storageKey: 'rr-cp:recent' },\n debounceMs: 200,\n maxResults: 50,\n filter: matchCommand,\n labels: DEFAULT_COMMAND_PALETTE_LABELS,\n};\n\nexport const COMMAND_PALETTE_CONFIG = new InjectionToken<CommandPaletteConfig>(\n 'COMMAND_PALETTE_CONFIG',\n {\n providedIn: 'root',\n factory: () => DEFAULT_COMMAND_PALETTE_CONFIG,\n },\n);\n\n/** Merges options with the defaults. */\nexport function resolveConfig(options: CommandPaletteOptions = {}): CommandPaletteConfig {\n return {\n ...DEFAULT_COMMAND_PALETTE_CONFIG,\n ...options,\n recent:\n options.recent === false\n ? false\n : {\n ...(DEFAULT_COMMAND_PALETTE_CONFIG.recent as CommandPaletteRecentOptions),\n ...options.recent,\n },\n labels: { ...DEFAULT_COMMAND_PALETTE_LABELS, ...options.labels },\n };\n}\n\n/** Configures the command palette. Optional: without it the defaults are used. */\nexport function provideCommandPalette(options: CommandPaletteOptions = {}): EnvironmentProviders {\n return makeEnvironmentProviders([\n { provide: COMMAND_PALETTE_CONFIG, useValue: resolveConfig(options) },\n ]);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport type { Command } from './command.model';\n\n/** What is saved for a recent command: only serializable fields, never functions. */\nexport interface RecentEntry {\n readonly id: string;\n readonly label: string;\n readonly group?: string;\n readonly description?: string;\n readonly route?: string | readonly unknown[];\n}\n\n/**\n * Recent commands in `localStorage` (most recent first). Every access is guarded:\n * private windows, SSR or blocked storage just mean \"no recents\".\n */\nexport class RecentStore {\n constructor(\n private readonly storageKey: string,\n private readonly max: number,\n private readonly storage: Pick<\n Storage,\n 'getItem' | 'setItem' | 'removeItem'\n > | null = defaultStorage(),\n ) {}\n\n load(): RecentEntry[] {\n if (!this.storage || this.max <= 0) return [];\n try {\n const raw = this.storage.getItem(this.storageKey);\n if (!raw) return [];\n const parsed: unknown = JSON.parse(raw);\n if (!Array.isArray(parsed)) return [];\n return parsed.filter(isEntry).slice(0, this.max);\n } catch {\n return [];\n }\n }\n\n /** Moves `command` to the top and returns the new list. */\n add(command: Command, current: readonly RecentEntry[] = this.load()): RecentEntry[] {\n if (this.max <= 0) return [];\n const entry: RecentEntry = {\n id: command.id,\n label: command.label,\n ...(command.group ? { group: command.group } : {}),\n ...(command.description ? { description: command.description } : {}),\n ...(command.route !== undefined && isSerializable(command.route)\n ? { route: command.route }\n : {}),\n };\n const next = [entry, ...current.filter((e) => e.id !== command.id)].slice(0, this.max);\n this.save(next);\n return next;\n }\n\n clear(): void {\n try {\n this.storage?.removeItem(this.storageKey);\n } catch {\n /* storage not available */\n }\n }\n\n private save(entries: readonly RecentEntry[]): void {\n try {\n this.storage?.setItem(this.storageKey, JSON.stringify(entries));\n } catch {\n /* quota exceeded or storage blocked: recents stay in memory only */\n }\n }\n}\n\nfunction defaultStorage(): Storage | null {\n try {\n return typeof localStorage === 'undefined' ? null : localStorage;\n } catch {\n return null;\n }\n}\n\nfunction isEntry(value: unknown): value is RecentEntry {\n if (!value || typeof value !== 'object') return false;\n const v = value as Record<string, unknown>;\n return typeof v['id'] === 'string' && typeof v['label'] === 'string';\n}\n\nfunction isSerializable(route: unknown): boolean {\n try {\n JSON.stringify(route);\n return typeof route === 'string' || Array.isArray(route);\n } catch {\n return false;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport {\n DestroyRef,\n DOCUMENT,\n Injectable,\n Signal,\n assertInInjectionContext,\n computed,\n inject,\n isSignal,\n signal,\n} from '@angular/core';\nimport { Router } from '@angular/router';\n\nimport type {\n Command,\n CommandProvider,\n CommandResult,\n CommandSection,\n CommandSubscribable,\n ParentCommand,\n} from './command.model';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteRecentOptions } from './config';\nimport { fuzzyMatch, highlightSegments } from './fuzzy';\nimport { RecentStore, type RecentEntry } from './recent-store';\n\ninterface Registration {\n readonly source: () => readonly Command[];\n}\n\ninterface ProviderState {\n readonly items: readonly Command[];\n readonly loading: boolean;\n readonly error?: unknown;\n}\n\n/** In-flight provider request: debounce timer, abort controller and subscription. */\ninterface PendingRequest {\n timer?: ReturnType<typeof setTimeout>;\n controller?: AbortController;\n subscription?: { unsubscribe(): void };\n}\n\nexport const RECENT_SECTION_ID = 'recent';\n\n/**\n * State of the command palette. Register commands from any component: they are removed\n * automatically when that component is destroyed.\n */\n@Injectable({ providedIn: 'root' })\nexport class CommandPaletteService {\n private readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly router = inject(Router, { optional: true });\n private readonly document = inject(DOCUMENT);\n\n private readonly recentStore = this.config.recent\n ? new RecentStore(\n (this.config.recent as CommandPaletteRecentOptions).storageKey ?? 'rr-cp:recent',\n (this.config.recent as CommandPaletteRecentOptions).max ?? 5,\n )\n : null;\n\n private readonly _isOpen = signal(false);\n private readonly _query = signal('');\n private readonly registrations = signal<readonly Registration[]>([]);\n private readonly providers = signal<readonly CommandProvider[]>([]);\n private readonly providerState = signal<ReadonlyMap<string, ProviderState>>(new Map());\n private readonly recents = signal<readonly RecentEntry[]>(this.recentStore?.load() ?? []);\n private readonly pending = new Map<string, PendingRequest>();\n private readonly pathIds = signal<readonly string[]>([]);\n private returnFocus: HTMLElement | null = null;\n\n /** Whether the palette is open. */\n readonly isOpen = this._isOpen.asReadonly();\n /** Current search text. */\n readonly query = this._query.asReadonly();\n\n /**\n * Sub-palettes currently open, outermost first (empty at the top level). It follows the registered\n * commands: if a parent is removed or replaced while open, the path shrinks to what still exists.\n */\n readonly path: Signal<readonly ParentCommand[]> = computed(() => {\n const path: ParentCommand[] = [];\n let level: readonly Command[] = this.commands();\n for (const id of this.pathIds()) {\n const parent = level.find((c): c is ParentCommand => c.id === id && isParent(c));\n if (!parent) break;\n path.push(parent);\n level = parent.children;\n }\n return path;\n });\n\n /** The commands of the level being shown: the top level or the children of the last parent. */\n private readonly levelCommands: Signal<readonly Command[]> = computed(() => {\n const path = this.path();\n return path.length ? path[path.length - 1].children : this.commands();\n });\n\n /** All registered (synchronous) commands. When two share an id, the last registered wins. */\n readonly commands: Signal<readonly Command[]> = computed(() => {\n const byId = new Map<string, Command>();\n for (const registration of this.registrations()) {\n for (const command of registration.source()) {\n byId.delete(command.id);\n byId.set(command.id, command);\n }\n }\n return [...byId.values()];\n });\n\n /** True while at least one async provider is waiting for results. */\n readonly loading = computed(() => [...this.providerState().values()].some((s) => s.loading));\n\n /** Sections shown in the list, already filtered and sorted. */\n readonly sections: Signal<readonly CommandSection[]> = computed(() =>\n this.buildSections(this._query().trim()),\n );\n\n /** Opens the palette, optionally with an initial query. */\n open(query = ''): void {\n if (!this._isOpen()) {\n const active = this.document.activeElement;\n // No instanceof HTMLElement: the class does not exist during SSR\n this.returnFocus =\n active &&\n active !== this.document.body &&\n typeof (active as HTMLElement).focus === 'function'\n ? (active as HTMLElement)\n : null;\n }\n this._isOpen.set(true);\n this.pathIds.set([]);\n this.setQuery(query);\n }\n\n /** Closes the palette, cancels pending searches and restores the focus. */\n close(): void {\n if (!this._isOpen()) return;\n this._isOpen.set(false);\n this.cancelAll();\n this._query.set('');\n this.pathIds.set([]);\n this.providerState.set(new Map());\n const target = this.returnFocus;\n this.returnFocus = null;\n if (target?.isConnected) target.focus({ preventScroll: true });\n }\n\n toggle(): void {\n if (this._isOpen()) this.close();\n else this.open();\n }\n\n /** Updates the search text and schedules the async providers. */\n setQuery(query: string): void {\n this._query.set(query);\n if (this._isOpen()) this.scheduleProviders();\n }\n\n /**\n * Goes back `levels` levels of a sub-palette (one by default) and clears the search.\n * Returns `false`, doing nothing, when the top level is already shown.\n */\n back(levels = 1): boolean {\n const path = this.path();\n if (!path.length || levels < 1) return false;\n this.pathIds.set(path.slice(0, Math.max(0, path.length - levels)).map((c) => c.id));\n this.setQuery('');\n return true;\n }\n\n /**\n * Registers commands (an array or a signal of arrays). Called in an injection context\n * (constructor, field initializer) they are removed when that context is destroyed.\n * Returns a function that removes them earlier.\n */\n register(\n commands: readonly Command[] | Signal<readonly Command[]>,\n destroyRef?: DestroyRef,\n ): () => void {\n const registration: Registration = { source: isSignal(commands) ? commands : () => commands };\n this.registrations.update((list) => [...list, registration]);\n const remove = () =>\n this.registrations.update((list) => list.filter((r) => r !== registration));\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Registers an async provider. Same lifetime rules as {@link register}. */\n registerProvider(provider: CommandProvider, destroyRef?: DestroyRef): () => void {\n this.providers.update((list) => [...list.filter((p) => p.id !== provider.id), provider]);\n if (this._isOpen() && !this.pathIds().length) this.scheduleProvider(provider, this._query());\n const remove = () => {\n if (!this.providers().includes(provider)) return;\n this.cancel(provider.id);\n this.providers.update((list) => list.filter((p) => p !== provider));\n this.providerState.update((map) => {\n const next = new Map(map);\n next.delete(provider.id);\n return next;\n });\n };\n return this.bindToDestroy(remove, destroyRef);\n }\n\n /** Executes a command: saves it in the recents, closes the palette, then navigates or runs it. */\n async execute(command: Command): Promise<void> {\n if (command.disabled) return;\n if (isParent(command)) {\n if (!this.levelCommands().some((c) => c.id === command.id)) {\n throw new Error('ngx-command-palette: only registered commands can have children');\n }\n // Providers search the top level only: drop their requests and results while inside a sub-palette\n this.cancelAll();\n this.providerState.set(new Map());\n this.pathIds.update((ids) => [...ids, command.id]);\n this.setQuery('');\n return;\n }\n const query = this._query();\n if (this.recentStore) this.recents.set(this.recentStore.add(command, this.recents()));\n this.close();\n if (command.route !== undefined) {\n if (!this.router) throw new Error('ngx-command-palette: route commands need provideRouter()');\n const { route, navigationExtras } = command;\n await (typeof route === 'string'\n ? this.router.navigateByUrl(route, navigationExtras)\n : this.router.navigate(route as unknown[], navigationExtras));\n } else {\n await command.run({ query });\n }\n }\n\n /** Removes all recents. */\n clearRecent(): void {\n this.recentStore?.clear();\n this.recents.set([]);\n }\n\n // ---- internals ----\n\n private bindToDestroy(remove: () => void, destroyRef?: DestroyRef): () => void {\n const ref = destroyRef ?? currentDestroyRef();\n const unsubscribe = ref?.onDestroy(remove);\n return () => {\n unsubscribe?.();\n remove();\n };\n }\n\n private buildSections(query: string): CommandSection[] {\n const defaultGroup = this.config.labels.defaultGroup;\n const commands = this.levelCommands();\n const groups = new Map<string, CommandResult[]>();\n const push = (group: string, result: CommandResult) => {\n const list = groups.get(group);\n if (list) list.push(result);\n else groups.set(group, [result]);\n };\n const sections: CommandSection[] = [];\n\n const topLevel = !this.pathIds().length;\n if (!query) {\n const recent = topLevel ? this.recentResults(commands) : [];\n if (recent.length)\n sections.push({ id: RECENT_SECTION_ID, label: this.config.labels.recent, items: recent });\n for (const command of commands) {\n if (isHidden(command)) continue;\n const group = command.group ?? defaultGroup;\n push(group, toResult(command, `g:${group}:${command.id}`, 0, []));\n }\n } else {\n const scored: CommandResult[] = [];\n for (const command of commands) {\n if (isHidden(command)) continue;\n const match = this.config.filter(query, command);\n if (!match) continue;\n const group = command.group ?? defaultGroup;\n scored.push(toResult(command, `g:${group}:${command.id}`, match.score, match.indices));\n }\n // Stable sort: equal scores keep the registration order\n scored.sort((a, b) => b.score - a.score);\n for (const result of scored.slice(0, this.config.maxResults)) {\n push(result.command.group ?? defaultGroup, result);\n }\n }\n for (const [label, items] of groups) sections.push({ id: `g:${label}`, label, items });\n\n // Async results: server order, highlighted when the label matches\n const states = this.providerState();\n for (const provider of topLevel ? this.providers() : []) {\n const state = states.get(provider.id);\n if (!state?.items.length) continue;\n const items = state.items\n .filter((command) => !isHidden(command))\n .map((command) => {\n const match = query ? fuzzyMatch(query, command.label) : null;\n return toResult(\n command,\n `p:${provider.id}:${command.id}`,\n match?.score ?? 0,\n match?.indices ?? [],\n );\n });\n if (items.length) sections.push({ id: `p:${provider.id}`, label: provider.group, items });\n }\n return sections;\n }\n\n private recentResults(commands: readonly Command[]): CommandResult[] {\n if (!this.recentStore) return [];\n const byId = new Map(descendants(commands).map((c) => [c.id, c]));\n const results: CommandResult[] = [];\n for (const entry of this.recents()) {\n // Still registered, or rebuilt from the saved route (e.g. a customer from an API)\n const command: Command | undefined =\n byId.get(entry.id) ??\n (entry.route !== undefined\n ? {\n id: entry.id,\n label: entry.label,\n route: entry.route,\n ...(entry.group ? { group: entry.group } : {}),\n ...(entry.description ? { description: entry.description } : {}),\n }\n : undefined);\n if (command && !command.disabled && !isHidden(command)) {\n results.push(toResult(command, `r:${entry.id}`, 0, []));\n }\n }\n return results;\n }\n\n private scheduleProviders(): void {\n if (this.pathIds().length) return;\n const query = this._query();\n for (const provider of this.providers()) this.scheduleProvider(provider, query);\n }\n\n private scheduleProvider(provider: CommandProvider, rawQuery: string): void {\n this.cancel(provider.id);\n const query = rawQuery.trim();\n if (query.length < (provider.minQueryLength ?? 1)) {\n this.setProviderState(provider.id, null);\n return;\n }\n const previous = this.providerState().get(provider.id);\n this.setProviderState(provider.id, { items: previous?.items ?? [], loading: true });\n const request: PendingRequest = {};\n this.pending.set(provider.id, request);\n request.timer = setTimeout(() => {\n request.timer = undefined;\n const controller = new AbortController();\n request.controller = controller;\n const done = (state: ProviderState) => {\n if (!controller.signal.aborted && this.pending.get(provider.id) === request) {\n this.setProviderState(provider.id, state);\n }\n };\n let result: ReturnType<CommandProvider['search']>;\n try {\n result = provider.search(query, controller.signal);\n } catch (error) {\n done({ items: [], loading: false, error });\n return;\n }\n if (isSubscribable(result)) {\n request.subscription = result.subscribe({\n next: (items) => done({ items, loading: false }),\n error: (error) => done({ items: [], loading: false, error }),\n complete: () => {\n const state = this.providerState().get(provider.id);\n if (state?.loading) done({ items: state.items, loading: false });\n },\n });\n } else {\n Promise.resolve(result).then(\n (items) => done({ items, loading: false }),\n (error: unknown) => done({ items: [], loading: false, error }),\n );\n }\n }, provider.debounceMs ?? this.config.debounceMs);\n }\n\n private setProviderState(id: string, state: ProviderState | null): void {\n this.providerState.update((map) => {\n const next = new Map(map);\n if (state) next.set(id, state);\n else next.delete(id);\n return next;\n });\n }\n\n private cancel(id: string): void {\n const request = this.pending.get(id);\n if (!request) return;\n this.pending.delete(id);\n if (request.timer) clearTimeout(request.timer);\n request.controller?.abort();\n request.subscription?.unsubscribe();\n }\n\n private cancelAll(): void {\n for (const id of [...this.pending.keys()]) this.cancel(id);\n }\n}\n\nfunction toResult(\n command: Command,\n key: string,\n score: number,\n indices: readonly number[],\n): CommandResult {\n return { command, key, score, indices, segments: highlightSegments(command.label, indices) };\n}\n\nfunction isParent(command: Command): command is ParentCommand {\n return Array.isArray(command.children);\n}\n\n/** The commands and, recursively, the children of those that are not hidden (for the recents). */\nfunction descendants(commands: readonly Command[]): Command[] {\n const all: Command[] = [];\n for (const command of commands) {\n if (isHidden(command)) continue;\n all.push(command);\n if (isParent(command)) all.push(...descendants(command.children));\n }\n return all;\n}\n\n/** Reads `hidden` (a boolean, a function or a signal) so that signals are tracked by the caller. */\nfunction isHidden(command: Command): boolean {\n const { hidden } = command;\n return typeof hidden === 'function' ? hidden() : !!hidden;\n}\n\nfunction isSubscribable<T>(value: unknown): value is CommandSubscribable<T> {\n return !!value && typeof (value as { subscribe?: unknown }).subscribe === 'function';\n}\n\nfunction currentDestroyRef(): DestroyRef | null {\n try {\n return inject(DestroyRef, { optional: true });\n } catch {\n // Outside an injection context: removal stays manual\n return null;\n }\n}\n\n/**\n * Registers commands for the lifetime of the current component/service.\n * Must be called in an injection context.\n */\nexport function injectCommands(\n commands: readonly Command[] | Signal<readonly Command[]>,\n): () => void {\n assertInInjectionContext(injectCommands);\n return inject(CommandPaletteService).register(commands, inject(DestroyRef));\n}\n\n/** Registers an async provider for the lifetime of the current component/service. */\nexport function injectCommandProvider(provider: CommandProvider): () => void {\n assertInInjectionContext(injectCommandProvider);\n return inject(CommandPaletteService).registerProvider(provider, inject(DestroyRef));\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nexport type NavigationAction = 'next' | 'prev' | 'first' | 'last' | 'select' | 'close';\n\ntype KeyLike = Pick<\n KeyboardEvent,\n 'key' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey' | 'isComposing'\n>;\n\n/** Maps a keydown inside the palette to a list action, or `null` to let the input handle it. */\nexport function keyToAction(event: KeyLike): NavigationAction | null {\n // During IME composition Enter and arrows belong to the text editor\n if (event.isComposing) return null;\n switch (event.key) {\n case 'ArrowDown':\n return 'next';\n case 'ArrowUp':\n return 'prev';\n case 'Home':\n return event.shiftKey ? null : 'first';\n case 'End':\n return event.shiftKey ? null : 'last';\n case 'PageUp':\n return 'first';\n case 'PageDown':\n return 'last';\n case 'Enter':\n return 'select';\n case 'Escape':\n return 'close';\n // Ctrl+N / Ctrl+P as in Emacs and many palettes (not Ctrl+J/K: Ctrl+K toggles the palette)\n case 'n':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'next' : null;\n case 'p':\n return event.ctrlKey && !event.metaKey && !event.altKey ? 'prev' : null;\n default:\n return null;\n }\n}\n\n/**\n * Index of the next selectable item. `disabled[i]` marks rows that cannot be active.\n * Returns -1 when no item is selectable. `next`/`prev` wrap around.\n */\nexport function moveIndex(\n disabled: readonly boolean[],\n current: number,\n action: 'next' | 'prev' | 'first' | 'last',\n): number {\n const count = disabled.length;\n if (count === 0) return -1;\n const findFrom = (start: number, step: 1 | -1, wrap: boolean): number => {\n for (let n = 0, i = start; n < count; n++, i += step) {\n if (wrap) i = (i + count) % count;\n else if (i < 0 || i >= count) return -1;\n if (!disabled[i]) return i;\n }\n return -1;\n };\n switch (action) {\n case 'first':\n return findFrom(0, 1, false);\n case 'last':\n return findFrom(count - 1, -1, false);\n case 'next':\n return current < 0 ? findFrom(0, 1, false) : findFrom(current + 1, 1, true);\n case 'prev':\n return current < 0 ? findFrom(count - 1, -1, false) : findFrom(current - 1, -1, true);\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\n/** A parsed keyboard shortcut such as `mod+k` or `ctrl+shift+p`. */\nexport interface ParsedShortcut {\n readonly key: string;\n readonly mod: boolean;\n readonly ctrl: boolean;\n readonly meta: boolean;\n readonly alt: boolean;\n readonly shift: boolean;\n}\n\nconst MODIFIERS: Record<string, keyof Omit<ParsedShortcut, 'key'>> = {\n mod: 'mod',\n ctrl: 'ctrl',\n control: 'ctrl',\n meta: 'meta',\n cmd: 'meta',\n command: 'meta',\n alt: 'alt',\n option: 'alt',\n shift: 'shift',\n};\n\nconst KEY_ALIASES: Record<string, string> = {\n space: ' ',\n esc: 'escape',\n slash: '/',\n plus: '+',\n};\n\n/**\n * Parses a shortcut string. Parts are separated by `+`; `mod` means ⌘ on Apple\n * platforms and Ctrl elsewhere. Examples: `mod+k`, `ctrl+shift+p`, `/`.\n */\nexport function parseShortcut(shortcut: string): ParsedShortcut {\n const parts = shortcut\n .toLowerCase()\n .split('+')\n .map((p) => p.trim())\n .filter(Boolean);\n if (shortcut.trim().endsWith('++') || shortcut.trim() === '+') parts.push('+');\n const result = { key: '', mod: false, ctrl: false, meta: false, alt: false, shift: false };\n for (const part of parts) {\n const modifier = MODIFIERS[part];\n if (modifier) result[modifier] = true;\n else result.key = KEY_ALIASES[part] ?? part;\n }\n if (!result.key) throw new Error(`ngx-command-palette: invalid shortcut \"${shortcut}\"`);\n return result;\n}\n\n/** True on macOS / iOS, where `mod` maps to the ⌘ key. */\nexport function isApplePlatform(nav: Navigator | undefined = globalThis.navigator): boolean {\n if (!nav) return false;\n const platform =\n (nav as Navigator & { userAgentData?: { platform?: string } }).userAgentData?.platform ??\n nav.platform ??\n '';\n return /mac|iphone|ipad|ipod/i.test(platform);\n}\n\ntype KeyEventLike = Pick<\n KeyboardEvent,\n 'key' | 'code' | 'ctrlKey' | 'metaKey' | 'altKey' | 'shiftKey'\n>;\n\n/** True when `event` matches `shortcut`. Letters also match by physical key (non-Latin layouts). */\nexport function matchesShortcut(\n event: KeyEventLike,\n shortcut: ParsedShortcut,\n apple: boolean,\n): boolean {\n const wantCtrl = shortcut.ctrl || (shortcut.mod && !apple);\n const wantMeta = shortcut.meta || (shortcut.mod && apple);\n if (event.ctrlKey !== wantCtrl || event.metaKey !== wantMeta || event.altKey !== shortcut.alt) {\n return false;\n }\n const key = (event.key ?? '').toLowerCase();\n // Shift matters only when requested or for letters (\"?\" needs Shift, but nobody writes it)\n const isLetter = /^[a-z]$/.test(shortcut.key);\n if ((shortcut.shift || isLetter) && event.shiftKey !== shortcut.shift) return false;\n if (key === shortcut.key) return true;\n // With Alt or non-Latin layouts event.key changes: fall back to the physical key\n if (isLetter && event.code === `Key${shortcut.key.toUpperCase()}`) return true;\n if (/^[0-9]$/.test(shortcut.key) && event.code === `Digit${shortcut.key}`) return true;\n return false;\n}\n\n/** Human readable label, e.g. `⌘K` on macOS and `Ctrl+K` elsewhere. */\nexport function formatShortcut(shortcut: ParsedShortcut, apple: boolean): string {\n const key =\n shortcut.key === ' '\n ? 'Space'\n : shortcut.key.length === 1\n ? shortcut.key.toUpperCase()\n : capitalize(shortcut.key);\n if (apple) {\n return (\n (shortcut.ctrl ? '⌃' : '') +\n (shortcut.alt ? '⌥' : '') +\n (shortcut.shift ? '⇧' : '') +\n (shortcut.meta || shortcut.mod ? '⌘' : '') +\n key\n );\n }\n const parts: string[] = [];\n if (shortcut.ctrl || shortcut.mod) parts.push('Ctrl');\n if (shortcut.meta) parts.push('Win');\n if (shortcut.alt) parts.push('Alt');\n if (shortcut.shift) parts.push('Shift');\n parts.push(key);\n return parts.join('+');\n}\n\nfunction capitalize(s: string): string {\n return s.charAt(0).toUpperCase() + s.slice(1);\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { Directive, TemplateRef, inject } from '@angular/core';\n\nimport type { Command, CommandResult, HighlightSegment } from './command.model';\n\nexport interface CommandItemContext {\n /** The command. */\n readonly $implicit: Command;\n readonly result: CommandResult;\n /** Label split into matched / unmatched parts. */\n readonly segments: readonly HighlightSegment[];\n /** True for the row selected with the keyboard or the mouse. */\n readonly active: boolean;\n readonly query: string;\n}\n\nexport interface CommandEmptyContext {\n /** The search text. */\n readonly $implicit: string;\n}\n\n/**\n * Custom template for each row:\n * `<ng-template rrCommandItem let-command let-segments=\"segments\">…</ng-template>`\n */\n@Directive({ selector: 'ng-template[rrCommandItem]' })\nexport class CommandItemTemplate {\n readonly template = inject<TemplateRef<CommandItemContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandItemTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandItemContext {\n return true;\n }\n}\n\n/** Custom empty state: `<ng-template rrCommandEmpty let-query>…</ng-template>` */\n@Directive({ selector: 'ng-template[rrCommandEmpty]' })\nexport class CommandEmptyTemplate {\n readonly template = inject<TemplateRef<CommandEmptyContext>>(TemplateRef);\n\n static ngTemplateContextGuard(\n _dir: CommandEmptyTemplate,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars -- signature required by Angular\n ctx: unknown,\n ): ctx is CommandEmptyContext {\n return true;\n }\n}\n","// SPDX-License-Identifier: MIT\n// © 2026 rrstudio — ngx-command-palette\n\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DOCUMENT,\n DestroyRef,\n ElementRef,\n TemplateRef,\n ViewEncapsulation,\n afterRenderEffect,\n computed,\n contentChild,\n inject,\n input,\n signal,\n viewChild,\n} from '@angular/core';\n\nimport type { Command, CommandResult } from './command.model';\nimport { CommandPaletteService } from './command-palette.service';\nimport { COMMAND_PALETTE_CONFIG, type CommandPaletteTheme } from './config';\nimport { keyToAction, moveIndex } from './list-navigation';\nimport { formatShortcut, isApplePlatform, matchesShortcut, parseShortcut } from './shortcut';\nimport { CommandEmptyTemplate, CommandItemTemplate } from './templates.directive';\n\nlet nextId = 0;\n\nconst FOCUSABLE =\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])';\n\n/**\n * The command palette dialog. Place it once, usually in the root component template.\n * It listens to the global shortcut and renders nothing while closed.\n */\n@Component({\n selector: 'rr-command-palette',\n imports: [NgTemplateOutlet],\n templateUrl: './command-palette.component.html',\n styleUrl: './command-palette.component.css',\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'rr-cp-host',\n '(document:keydown)': 'onDocumentKeydown($event)',\n '(document:focusin)': 'onDocumentFocusin($event)',\n },\n})\nexport class CommandPaletteComponent {\n protected readonly service = inject(CommandPaletteService);\n protected readonly config = inject(COMMAND_PALETTE_CONFIG);\n private readonly document = inject(DOCUMENT);\n\n /** Overrides the `theme` of `provideCommandPalette()`, e.g. to follow your app's theme toggle. */\n readonly theme = input<CommandPaletteTheme | undefined>(undefined);\n\n protected readonly itemTemplate = contentChild(CommandItemTemplate);\n protected readonly emptyTemplate = contentChild(CommandEmptyTemplate);\n private readonly input = viewChild<ElementRef<HTMLInputElement>>('input');\n private readonly dialog = viewChild<ElementRef<HTMLElement>>('dialog');\n\n protected readonly uid = `rr-cp-${nextId++}`;\n protected readonly labels = this.config.labels;\n private readonly apple = isApplePlatform();\n private readonly shortcuts = (typeof this.config.shortcut === 'string'\n ? [this.config.shortcut]\n : this.config.shortcut\n ).map(parseShortcut);\n /** Label of the first shortcut, e.g. `⌘K` or `Ctrl+K`, for a \"search\" button in your UI. */\n readonly shortcutLabel = this.shortcuts.length\n ? formatShortcut(this.shortcuts[0], this.apple)\n : '';\n\n private readonly prefersDark = signal(false);\n protected readonly resolvedTheme = computed(() => {\n const theme = this.theme() ?? this.config.theme;\n return theme === 'auto' ? (this.prefersDark() ? 'dark' : 'light') : theme;\n });\n\n /** Sections with the flat index of each row (used for ids and keyboard navigation). */\n protected readonly view = computed(() => {\n let index = 0;\n return this.service.sections().map((section, sectionIndex) => ({\n section,\n headingId: `${this.uid}-group-${sectionIndex}`,\n rows: section.items.map((item) => ({ item, index: index++ })),\n }));\n });\n protected readonly items = computed<readonly CommandResult[]>(() =>\n this.service.sections().flatMap((s) => s.items),\n );\n private readonly activeKey = signal<string | null>(null);\n protected readonly activeIndex = computed(() => {\n const items = this.items();\n const key = this.activeKey();\n const found = key === null ? -1 : items.findIndex((i) => i.key === key);\n if (found >= 0 && !items[found].command.disabled) return found;\n return moveIndex(\n items.map((i) => !!i.command.disabled),\n -1,\n 'first',\n );\n });\n protected readonly activeDescendant = computed(() => {\n const index = this.activeIndex();\n return index >= 0 ? this.optionId(index) : null;\n });\n protected readonly status = computed(() => {\n if (this.service.loading()) return this.labels.loading;\n const count = this.items().length;\n if (count === 0) return this.labels.empty;\n const path = this.service.path();\n const template = path.length ? this.labels.level : this.labels.results;\n return template\n .replace('{name}', path[path.length - 1]?.label ?? '')\n .replace('{count}', String(count));\n });\n\n constructor() {\n const view = this.document.defaultView;\n const media = view?.matchMedia?.('(prefers-color-scheme: dark)');\n if (media) {\n this.prefersDark.set(media.matches);\n const listener = (e: MediaQueryListEvent) => this.prefersDark.set(e.matches);\n media.addEventListener?.('change', listener);\n inject(DestroyRef).onDestroy(() => media.removeEventListener?.('change', listener));\n }\n\n // Focus the search field as soon as the dialog appears\n afterRenderEffect(() => {\n const input = this.input()?.nativeElement;\n if (input && this.document.activeElement !== input) input.focus({ preventScroll: true });\n });\n // Keep the active row visible during keyboard navigation\n afterRenderEffect(() => {\n const id = this.activeDescendant();\n if (!id) return;\n const option = this.document.getElementById(id);\n option?.scrollIntoView?.({ block: 'nearest' });\n });\n }\n\n protected optionId(index: number): string {\n return `${this.uid}-option-${index}`;\n }\n\n protected hasChildren(command: Command): boolean {\n return Array.isArray(command.children);\n }\n\n protected onBack(levels: number): void {\n this.activeKey.set(null);\n this.service.back(levels);\n this.input()?.nativeElement.focus({ preventScroll: true });\n }\n\n protected isTemplate(icon: unknown): icon is TemplateRef<unknown> {\n return icon instanceof TemplateRef;\n }\n\n protected onInput(event: Event): void {\n this.activeKey.set(null);\n this.service.setQuery((event.target as HTMLInputElement).value);\n }\n\n protected onKeydown(event: KeyboardEvent): void {\n if (event.key === 'Tab') {\n this.trapTab(event);\n return;\n }\n if (\n event.key === 'Backspace' &&\n !event.isComposing &&\n this.service.query() === '' &&\n this.service.path().length\n ) {\n // Like deleting the \"tag\" in front of the search text: leave the sub-palette\n event.preventDefault();\n this.activeKey.set(null);\n this.service.back();\n return;\n }\n const action = keyToAction(event);\n if (!action) return;\n event.preventDefault();\n event.stopPropagation();\n const items = this.items();\n switch (action) {\n case 'close':\n this.service.close();\n return;\n case 'select': {\n const item = items[this.activeIndex()];\n if (item) void this.service.execute(item.command);\n return;\n }\n default: {\n const next = moveIndex(\n items.map((i) => !!i.command.disabled),\n this.activeIndex(),\n action,\n );\n if (next >= 0) this.activeKey.set(items[next].key);\n }\n }\n }\n\n protected onPointerMove(item: CommandResult): void {\n if (!item.command.disabled && this.activeKey() !== item.key) this.activeKey.set(item.key);\n }\n\n protected onSelect(item: CommandResult): void {\n void this.service.execute(item.command);\n }\n\n protected onOverlayDown(event: MouseEvent): void {\n // Only a click on the backdrop, not inside the dialog\n if (event.target === event.currentTarget) this.service.close();\n }\n\n protected onDocumentKeydown(event: KeyboardEvent): void {\n if (event.repeat || event.isComposing) return;\n // Shortcuts without Ctrl/⌘/Alt (e.g. \"/\") do not fire while typing in a field\n const typing = isEditable(event.target);\n const hit = this.shortcuts.some(\n (s) =>\n (!typing || s.mod || s.ctrl || s.meta || s.alt) && matchesShortcut(event, s, this.apple),\n );\n if (hit) {\n event.preventDefault();\n this.activeKey.set(null);\n this.service.toggle();\n }\n }\n\n protected onDocumentFocusin(event: FocusEvent): void {\n if (!this.service.isOpen()) return;\n const dialog = this.dialog()?.nativeElement;\n // Focus trap: if focus leaves the dialog (e.g. an iframe click or a scripted focus) it returns to the input\n if (dialog && event.target instanceof Node && !dialog.contains(event.target)) {\n this.input()?.nativeElement.focus({ preventScroll: true });\n }\n }\n\n private trapTab(event: KeyboardEvent): void {\n const dialog = this.dialog()?.nativeElement;\n if (!dialog) return;\n const focusable = Array.from(dialog.querySelectorAll<HTMLElement>(FOCUSABLE));\n if (focusable.length <= 1) {\n event.preventDefault();\n return;\n }\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n const active = this.document.activeElement;\n if (event.shiftKey && active === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && active === last) {\n event.preventDefault();\n first.focus();\n }\n }\n}\n\nfunction isEditable(target: EventTarget | null): boolean {\n const el = target as HTMLElement | null;\n if (!el || typeof el.tagName !== 'string') return false;\n const tag = el.tagName.toLowerCase();\n return tag === 'input' || tag === 'textarea' || tag === 'select' || el.isContentEditable;\n}\n","@if (service.isOpen()) {\n <div class=\"rr-cp\" [attr.data-theme]=\"resolvedTheme()\" (mousedown)=\"onOverlayDown($event)\">\n <div\n #dialog\n class=\"rr-cp-dialog\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-label]=\"labels.dialog\"\n (keydown)=\"onKeydown($event)\"\n >\n @if (service.path(); as path) {\n @if (path.length) {\n <nav class=\"rr-cp-path\">\n <button\n type=\"button\"\n class=\"rr-cp-path-back\"\n [attr.aria-label]=\"labels.back\"\n (click)=\"onBack(1)\"\n >\n <svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" aria-hidden=\"true\">\n <path\n d=\"m15 6-6 6 6 6\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n </button>\n @for (parent of path; track parent.id; let i = $index; let last = $last) {\n @if (last) {\n <span class=\"rr-cp-path-current\" aria-current=\"page\">{{ parent.label }}</span>\n } @else {\n <button type=\"button\" class=\"rr-cp-path-step\" (click)=\"onBack(path.length - 1 - i)\">\n {{ parent.label }}\n </button>\n <span class=\"rr-cp-path-sep\" aria-hidden=\"true\">›</span>\n }\n }\n </nav>\n }\n }\n <div class=\"rr-cp-search\">\n <svg\n class=\"rr-cp-search-icon\"\n viewBox=\"0 0 24 24\"\n width=\"18\"\n height=\"18\"\n aria-hidden=\"true\"\n >\n <circle cx=\"11\" cy=\"11\" r=\"7\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" />\n <path\n d=\"m20 20-3.5-3.5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n />\n </svg>\n <input\n #input\n class=\"rr-cp-input\"\n type=\"text\"\n role=\"combobox\"\n aria-expanded=\"true\"\n aria-autocomplete=\"list\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"uid + '-listbox'\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-label]=\"labels.placeholder\"\n [placeholder]=\"labels.placeholder\"\n [value]=\"service.query()\"\n (input)=\"onInput($event)\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n @if (service.loading()) {\n <span class=\"rr-cp-spinner\" aria-hidden=\"true\"></span>\n }\n <kbd class=\"rr-cp-esc\" aria-hidden=\"true\">{{ labels.closeHint }}</kbd>\n </div>\n\n <div\n class=\"rr-cp-list\"\n role=\"listbox\"\n [id]=\"uid + '-listbox'\"\n [attr.aria-label]=\"labels.listbox\"\n [attr.aria-busy]=\"service.loading()\"\n >\n @for (group of view(); track group.section.id) {\n <div class=\"rr-cp-group\" role=\"group\" [attr.aria-labelledby]=\"group.headingId\">\n <!-- prettier-ignore -->\n <div class=\"rr-cp-group-label\" [id]=\"group.headingId\" aria-hidden=\"true\">{{ group.section.label }}</div>\n @for (row of group.rows; track row.item.key) {\n <!-- Combobox pattern: options never get focus, the keyboard goes through the input (aria-activedescendant) -->\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"rr-cp-item\"\n role=\"option\"\n [id]=\"optionId(row.index)\"\n [class.rr-cp-item-active]=\"row.index === activeIndex()\"\n [attr.aria-selected]=\"row.index === activeIndex()\"\n [attr.aria-disabled]=\"row.item.command.disabled ? true : null\"\n (mousedown)=\"$event.preventDefault()\"\n (mousemove)=\"onPointerMove(row.item)\"\n (click)=\"onSelect(row.item)\"\n >\n @if (itemTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: row.item.command,\n result: row.item,\n segments: row.item.segments,\n active: row.index === activeIndex(),\n query: service.query(),\n }\"\n />\n } @else {\n @if (row.item.command.icon; as icon) {\n <span class=\"rr-cp-icon\" aria-hidden=\"true\">\n @if (isTemplate(icon)) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n {{ icon }}\n }\n </span>\n }\n <span class=\"rr-cp-text\">\n <!-- Single line: line breaks would become spaces inside the label -->\n <!-- prettier-ignore -->\n <span class=\"rr-cp-label\">@for (segment of row.item.segments; track $index) {@if (segment.match) {<mark class=\"rr-cp-match\">{{ segment.text }}</mark>} @else {{{ segment.text }}}}</span>\n @if (row.item.command.description) {\n <span class=\"rr-cp-description\">{{ row.item.command.description }}</span>\n }\n </span>\n @if (hasChildren(row.item.command)) {\n <span class=\"rr-cp-sr-only\">, {{ labels.submenu }}</span>\n <span class=\"rr-cp-chevron\" aria-hidden=\"true\">›</span>\n }\n @if (row.item.command.shortcut?.length) {\n <span class=\"rr-cp-shortcut\" aria-hidden=\"true\">\n @for (key of row.item.command.shortcut; track $index) {\n <kbd>{{ key }}</kbd>\n }\n </span>\n }\n }\n </div>\n }\n </div>\n }\n </div>\n\n @if (items().length === 0) {\n <div class=\"rr-cp-empty\">\n @if (service.loading()) {\n {{ labels.loading }}\n } @else if (emptyTemplate(); as custom) {\n <ng-container\n [ngTemplateOutlet]=\"custom.template\"\n [ngTemplateOutletContext]=\"{ $implicit: service.query() }\"\n />\n } @else {\n {{ labels.empty }}\n }\n </div>\n }\n\n <div class=\"rr-cp-sr-only\" aria-live=\"polite\" aria-atomic=\"true\">{{ status() }}</div>\n </div>\n </div>\n}\n"],"mappings":";;;;AAaA,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAC1B,MAAM,mBAAmB;AACzB,MAAM,qBAAqB;AAC3B,MAAM,cAAc;AACpB,MAAM,kBAAkB;AACxB,MAAM,6BAAa,IAAI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
{
|
|
2
2
|
"name": "@rrstudioapps/ngx-command-palette",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Accessible ⌘K / Ctrl+K command palette for Angular: fuzzy search, sections, recents, async providers. Standalone, signals, zoneless, zero dependencies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -23,19 +23,35 @@ interface CommandBase {
|
|
|
23
23
|
readonly keywords?: readonly string[];
|
|
24
24
|
/** A disabled command is shown but cannot be executed or selected. */
|
|
25
25
|
readonly disabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* A hidden command is not listed and not searched (unlike `disabled`, which shows it greyed out).
|
|
28
|
+
* Pass a function or a signal to hide it depending on your app state, e.g. `hidden: () => !user()`.
|
|
29
|
+
*/
|
|
30
|
+
readonly hidden?: boolean | (() => boolean);
|
|
26
31
|
}
|
|
27
32
|
/** A command that navigates to an Angular route. */
|
|
28
33
|
interface RouteCommand extends CommandBase {
|
|
29
34
|
readonly route: string | readonly unknown[];
|
|
30
35
|
readonly navigationExtras?: NavigationExtras;
|
|
31
36
|
readonly run?: never;
|
|
37
|
+
readonly children?: never;
|
|
32
38
|
}
|
|
33
39
|
/** A command that runs a function. */
|
|
34
40
|
interface ActionCommand extends CommandBase {
|
|
35
41
|
readonly run: (context: CommandRunContext) => void | Promise<unknown>;
|
|
36
42
|
readonly route?: never;
|
|
43
|
+
readonly children?: never;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A command that opens a sub-palette: selecting it lists `children` (searched on their own)
|
|
47
|
+
* instead of running something. Children can have children too.
|
|
48
|
+
*/
|
|
49
|
+
interface ParentCommand extends CommandBase {
|
|
50
|
+
readonly children: readonly Command[];
|
|
51
|
+
readonly route?: never;
|
|
52
|
+
readonly run?: never;
|
|
37
53
|
}
|
|
38
|
-
type Command = RouteCommand | ActionCommand;
|
|
54
|
+
type Command = RouteCommand | ActionCommand | ParentCommand;
|
|
39
55
|
/** Minimal subscribable shape, so the library does not depend on RxJS. */
|
|
40
56
|
interface CommandSubscribable<T> {
|
|
41
57
|
subscribe(observer: {
|
|
@@ -82,6 +98,24 @@ interface CommandSection {
|
|
|
82
98
|
readonly label: string;
|
|
83
99
|
readonly items: readonly CommandResult[];
|
|
84
100
|
}
|
|
101
|
+
interface FuzzyMatch {
|
|
102
|
+
/** Higher is better. Only meaningful to compare matches of the same query. */
|
|
103
|
+
readonly score: number;
|
|
104
|
+
/** Indices of `text` matched by the query, ascending. */
|
|
105
|
+
readonly indices: readonly number[];
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in
|
|
109
|
+
* `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.
|
|
110
|
+
*/
|
|
111
|
+
export declare function fuzzyMatch(query: string, text: string): FuzzyMatch | null;
|
|
112
|
+
/** Splits `text` into matched / unmatched segments for highlighting. */
|
|
113
|
+
export declare function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[];
|
|
114
|
+
/**
|
|
115
|
+
* Matches a command against the query using label, keywords and description.
|
|
116
|
+
* `indices` refer to the label (empty when only keywords/description matched).
|
|
117
|
+
*/
|
|
118
|
+
export declare function matchCommand(query: string, command: Command): FuzzyMatch | null;
|
|
85
119
|
type CommandPaletteTheme = 'light' | 'dark' | 'auto';
|
|
86
120
|
/** Texts of the palette, for translations. */
|
|
87
121
|
interface CommandPaletteLabels {
|
|
@@ -95,7 +129,18 @@ interface CommandPaletteLabels {
|
|
|
95
129
|
/** Screen reader announcement, `{count}` is replaced by the number of results. */
|
|
96
130
|
readonly results: string;
|
|
97
131
|
readonly closeHint: string;
|
|
132
|
+
/** Label of the button that goes back one level of a sub-palette. */
|
|
133
|
+
readonly back: string;
|
|
134
|
+
/** Screen reader announcement when a sub-palette is opened; `{name}` and `{count}` are replaced. */
|
|
135
|
+
readonly level: string;
|
|
136
|
+
/** Screen reader hint added to a command that opens a sub-palette. */
|
|
137
|
+
readonly submenu: string;
|
|
98
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* Decides whether `command` matches the search text and how well. Return `null` to hide the
|
|
141
|
+
* command. A higher `score` ranks first; `indices` are the label characters to highlight.
|
|
142
|
+
*/
|
|
143
|
+
type CommandFilter = (query: string, command: Command) => FuzzyMatch | null;
|
|
99
144
|
interface CommandPaletteRecentOptions {
|
|
100
145
|
/** Max number of recents shown. Default: 5. */
|
|
101
146
|
readonly max?: number;
|
|
@@ -113,6 +158,8 @@ interface CommandPaletteConfig {
|
|
|
113
158
|
readonly debounceMs: number;
|
|
114
159
|
/** Max results of local commands for a non-empty query. Default: 50. */
|
|
115
160
|
readonly maxResults: number;
|
|
161
|
+
/** Matching and ranking of local commands for a non-empty query. Default: the built-in fuzzy search. */
|
|
162
|
+
readonly filter: CommandFilter;
|
|
116
163
|
readonly labels: CommandPaletteLabels;
|
|
117
164
|
}
|
|
118
165
|
type CommandPaletteOptions = Partial<Omit<CommandPaletteConfig, 'labels'>> & {
|
|
@@ -140,11 +187,19 @@ export declare class CommandPaletteService {
|
|
|
140
187
|
private readonly providerState;
|
|
141
188
|
private readonly recents;
|
|
142
189
|
private readonly pending;
|
|
190
|
+
private readonly pathIds;
|
|
143
191
|
private returnFocus;
|
|
144
192
|
/** Whether the palette is open. */
|
|
145
193
|
readonly isOpen: Signal<boolean>;
|
|
146
194
|
/** Current search text. */
|
|
147
195
|
readonly query: Signal<string>;
|
|
196
|
+
/**
|
|
197
|
+
* Sub-palettes currently open, outermost first (empty at the top level). It follows the registered
|
|
198
|
+
* commands: if a parent is removed or replaced while open, the path shrinks to what still exists.
|
|
199
|
+
*/
|
|
200
|
+
readonly path: Signal<readonly ParentCommand[]>;
|
|
201
|
+
/** The commands of the level being shown: the top level or the children of the last parent. */
|
|
202
|
+
private readonly levelCommands;
|
|
148
203
|
/** All registered (synchronous) commands. When two share an id, the last registered wins. */
|
|
149
204
|
readonly commands: Signal<readonly Command[]>;
|
|
150
205
|
/** True while at least one async provider is waiting for results. */
|
|
@@ -158,6 +213,11 @@ export declare class CommandPaletteService {
|
|
|
158
213
|
toggle(): void;
|
|
159
214
|
/** Updates the search text and schedules the async providers. */
|
|
160
215
|
setQuery(query: string): void;
|
|
216
|
+
/**
|
|
217
|
+
* Goes back `levels` levels of a sub-palette (one by default) and clears the search.
|
|
218
|
+
* Returns `false`, doing nothing, when the top level is already shown.
|
|
219
|
+
*/
|
|
220
|
+
back(levels?: number): boolean;
|
|
161
221
|
/**
|
|
162
222
|
* Registers commands (an array or a signal of arrays). Called in an injection context
|
|
163
223
|
* (constructor, field initializer) they are removed when that context is destroyed.
|
|
@@ -257,6 +317,8 @@ export declare class CommandPaletteComponent {
|
|
|
257
317
|
protected readonly status: import("@angular/core").Signal<string>;
|
|
258
318
|
constructor();
|
|
259
319
|
protected optionId(index: number): string;
|
|
320
|
+
protected hasChildren(command: Command): boolean;
|
|
321
|
+
protected onBack(levels: number): void;
|
|
260
322
|
protected isTemplate(icon: unknown): icon is TemplateRef<unknown>;
|
|
261
323
|
protected onInput(event: Event): void;
|
|
262
324
|
protected onKeydown(event: KeyboardEvent): void;
|
|
@@ -275,24 +337,6 @@ export declare class CommandPaletteComponent {
|
|
|
275
337
|
};
|
|
276
338
|
}, {}, ["itemTemplate", "emptyTemplate"], never, true, never>;
|
|
277
339
|
}
|
|
278
|
-
interface FuzzyMatch {
|
|
279
|
-
/** Higher is better. Only meaningful to compare matches of the same query. */
|
|
280
|
-
readonly score: number;
|
|
281
|
-
/** Indices of `text` matched by the query, ascending. */
|
|
282
|
-
readonly indices: readonly number[];
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Fuzzy subsequence match: every character of `query` (spaces ignored) must appear in
|
|
286
|
-
* `text` in order. Returns the best scoring alignment or `null`. Case and accent insensitive.
|
|
287
|
-
*/
|
|
288
|
-
export declare function fuzzyMatch(query: string, text: string): FuzzyMatch | null;
|
|
289
|
-
/** Splits `text` into matched / unmatched segments for highlighting. */
|
|
290
|
-
export declare function highlightSegments(text: string, indices: readonly number[]): HighlightSegment[];
|
|
291
|
-
/**
|
|
292
|
-
* Matches a command against the query using label, keywords and description.
|
|
293
|
-
* `indices` refer to the label (empty when only keywords/description matched).
|
|
294
|
-
*/
|
|
295
|
-
export declare function matchCommand(query: string, command: Command): FuzzyMatch | null;
|
|
296
340
|
/** A parsed keyboard shortcut such as `mod+k` or `ctrl+shift+p`. */
|
|
297
341
|
interface ParsedShortcut {
|
|
298
342
|
readonly key: string;
|
|
@@ -314,4 +358,4 @@ type KeyEventLike = Pick<KeyboardEvent, 'key' | 'code' | 'ctrlKey' | 'metaKey' |
|
|
|
314
358
|
export declare function matchesShortcut(event: KeyEventLike, shortcut: ParsedShortcut, apple: boolean): boolean;
|
|
315
359
|
/** Human readable label, e.g. `⌘K` on macOS and `Ctrl+K` elsewhere. */
|
|
316
360
|
export declare function formatShortcut(shortcut: ParsedShortcut, apple: boolean): string;
|
|
317
|
-
export type { ActionCommand, Command, CommandEmptyContext, CommandItemContext, CommandPaletteConfig, CommandPaletteLabels, CommandPaletteOptions, CommandPaletteRecentOptions, CommandPaletteTheme, CommandProvider, CommandResult, CommandRunContext, CommandSection, CommandSubscribable, FuzzyMatch, HighlightSegment, ParsedShortcut, RouteCommand };
|
|
361
|
+
export type { ActionCommand, Command, CommandEmptyContext, CommandFilter, CommandItemContext, CommandPaletteConfig, CommandPaletteLabels, CommandPaletteOptions, CommandPaletteRecentOptions, CommandPaletteTheme, CommandProvider, CommandResult, CommandRunContext, CommandSection, CommandSubscribable, FuzzyMatch, HighlightSegment, ParentCommand, ParsedShortcut, RouteCommand };
|