@rrstudioapps/ngx-command-palette 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -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;
|
|
@@ -68,6 +22,15 @@ const SEPARATORS = /* @__PURE__ */ new Set([
|
|
|
68
22
|
function fold(char) {
|
|
69
23
|
return (char.normalize("NFD").replace(/\p{M}/gu, "")[0] ?? char).toLowerCase();
|
|
70
24
|
}
|
|
25
|
+
function foldText(text) {
|
|
26
|
+
if (/^[\x00-\x7f]*$/.test(text)) return text.toLowerCase();
|
|
27
|
+
let out = "";
|
|
28
|
+
for (let i = 0; i < text.length; i++) out += fold(text[i]);
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
function foldQuery(query) {
|
|
32
|
+
return foldText(query.replace(/\s+/g, ""));
|
|
33
|
+
}
|
|
71
34
|
function isWordStart(text, i) {
|
|
72
35
|
if (i === 0) return true;
|
|
73
36
|
const prev = text[i - 1];
|
|
@@ -76,58 +39,81 @@ function isWordStart(text, i) {
|
|
|
76
39
|
return prev === prev.toLowerCase() && cur !== cur.toLowerCase() && cur === cur.toUpperCase();
|
|
77
40
|
}
|
|
78
41
|
function fuzzyMatch(query, text) {
|
|
79
|
-
|
|
42
|
+
return matchFolded(foldQuery(query), text);
|
|
43
|
+
}
|
|
44
|
+
let tableM = /* @__PURE__ */ new Float64Array(512);
|
|
45
|
+
let tableD = /* @__PURE__ */ new Float64Array(512);
|
|
46
|
+
let tableC = /* @__PURE__ */ new Uint8Array(512);
|
|
47
|
+
let tableK = /* @__PURE__ */ new Int32Array(512);
|
|
48
|
+
let tableB = /* @__PURE__ */ new Float64Array(128);
|
|
49
|
+
function ensureTables(size, width) {
|
|
50
|
+
if (tableM.length < size) {
|
|
51
|
+
const length = Math.max(size, tableM.length * 2);
|
|
52
|
+
tableM = new Float64Array(length);
|
|
53
|
+
tableD = new Float64Array(length);
|
|
54
|
+
tableC = new Uint8Array(length);
|
|
55
|
+
tableK = new Int32Array(length);
|
|
56
|
+
}
|
|
57
|
+
if (tableB.length < width) tableB = new Float64Array(Math.max(width, tableB.length * 2));
|
|
58
|
+
}
|
|
59
|
+
function matchFolded(q, text) {
|
|
80
60
|
if (q.length === 0) return {
|
|
81
61
|
score: 0,
|
|
82
62
|
indices: []
|
|
83
63
|
};
|
|
84
|
-
const t =
|
|
85
|
-
for (let i = 0; i < text.length; i++) t.push(fold(text[i]));
|
|
64
|
+
const t = foldText(text);
|
|
86
65
|
const m = q.length;
|
|
87
66
|
const n = t.length;
|
|
88
67
|
if (m > n) return null;
|
|
68
|
+
for (let i = 0, from = 0; i < m; i++) {
|
|
69
|
+
from = t.indexOf(q[i], from) + 1;
|
|
70
|
+
if (from === 0) return null;
|
|
71
|
+
}
|
|
89
72
|
const NEG = -Infinity;
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
const consec =
|
|
95
|
-
const Dk =
|
|
73
|
+
const size = m * n;
|
|
74
|
+
ensureTables(size, n);
|
|
75
|
+
const M = tableM;
|
|
76
|
+
const D = tableD;
|
|
77
|
+
const consec = tableC;
|
|
78
|
+
const Dk = tableK;
|
|
79
|
+
M.fill(NEG, 0, size);
|
|
80
|
+
D.fill(NEG, 0, size);
|
|
81
|
+
consec.fill(0, 0, size);
|
|
82
|
+
Dk.fill(-1, 0, size);
|
|
83
|
+
const bonus = tableB;
|
|
84
|
+
bonus.fill(-1, 0, n);
|
|
85
|
+
const bonusAt = (j) => bonus[j] >= 0 ? bonus[j] : bonus[j] = SCORE_CHAR + (isWordStart(text, j) ? BONUS_WORD_START : 0) + (j === 0 ? BONUS_STRING_START : 0);
|
|
96
86
|
for (let i = 0; i < m; i++) {
|
|
97
|
-
const
|
|
98
|
-
const
|
|
99
|
-
const Ci = new Uint8Array(n);
|
|
100
|
-
const Ki = new Int32Array(n).fill(-1);
|
|
87
|
+
const row = i * n;
|
|
88
|
+
const prev = row - n;
|
|
101
89
|
for (let j = i; j < n; j++) {
|
|
90
|
+
const at = row + j;
|
|
102
91
|
if (t[j] === q[i]) {
|
|
103
|
-
if (i === 0)
|
|
92
|
+
if (i === 0) M[at] = bonusAt(j) - PENALTY_LEADING * j;
|
|
104
93
|
else if (j > 0) {
|
|
105
|
-
const consecutive = M[
|
|
106
|
-
const jump = D[
|
|
94
|
+
const consecutive = M[prev + j - 1] + BONUS_CONSECUTIVE;
|
|
95
|
+
const jump = D[prev + j - 1];
|
|
107
96
|
if (consecutive >= jump && consecutive > NEG) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
} else if (jump > NEG)
|
|
97
|
+
M[at] = consecutive + bonusAt(j);
|
|
98
|
+
consec[at] = 1;
|
|
99
|
+
} else if (jump > NEG) M[at] = jump + bonusAt(j);
|
|
111
100
|
}
|
|
112
101
|
}
|
|
113
|
-
const carried = j > 0 ?
|
|
114
|
-
if (
|
|
115
|
-
|
|
116
|
-
|
|
102
|
+
const carried = j > 0 ? D[at - 1] - PENALTY_GAP : NEG;
|
|
103
|
+
if (M[at] > NEG && M[at] >= carried) {
|
|
104
|
+
D[at] = M[at];
|
|
105
|
+
Dk[at] = j;
|
|
117
106
|
} else if (j > 0) {
|
|
118
|
-
|
|
119
|
-
|
|
107
|
+
D[at] = carried;
|
|
108
|
+
Dk[at] = Dk[at - 1];
|
|
120
109
|
}
|
|
121
110
|
}
|
|
122
|
-
M.push(Mi);
|
|
123
|
-
D.push(Di);
|
|
124
|
-
consec.push(Ci);
|
|
125
|
-
Dk.push(Ki);
|
|
126
111
|
}
|
|
127
112
|
let end = -1;
|
|
128
113
|
let best = NEG;
|
|
129
|
-
|
|
130
|
-
|
|
114
|
+
const last = (m - 1) * n;
|
|
115
|
+
for (let j = m - 1; j < n; j++) if (M[last + j] > best) {
|
|
116
|
+
best = M[last + j];
|
|
131
117
|
end = j;
|
|
132
118
|
}
|
|
133
119
|
if (end < 0) return null;
|
|
@@ -136,7 +122,7 @@ function fuzzyMatch(query, text) {
|
|
|
136
122
|
for (let i = m - 1; i >= 0; i--) {
|
|
137
123
|
indices[i] = j;
|
|
138
124
|
if (i === 0) break;
|
|
139
|
-
j = consec[i
|
|
125
|
+
j = consec[i * n + j] ? j - 1 : Dk[(i - 1) * n + j - 1];
|
|
140
126
|
}
|
|
141
127
|
return {
|
|
142
128
|
score: best - (n - m) * .01,
|
|
@@ -173,29 +159,80 @@ function highlightSegments(text, indices) {
|
|
|
173
159
|
const WEIGHT_KEYWORD = .8;
|
|
174
160
|
const WEIGHT_DESCRIPTION = .5;
|
|
175
161
|
const MIN_SECONDARY_QUALITY = 4;
|
|
176
|
-
function strongEnough(match,
|
|
177
|
-
const length = query.replace(/\s+/g, "").length;
|
|
162
|
+
function strongEnough(match, length) {
|
|
178
163
|
return !!match && length > 0 && match.score / length >= MIN_SECONDARY_QUALITY;
|
|
179
164
|
}
|
|
180
165
|
function matchCommand(query, command) {
|
|
181
|
-
const
|
|
166
|
+
const q = foldQuery(query);
|
|
167
|
+
const label = matchFolded(q, command.label);
|
|
182
168
|
let best = label;
|
|
183
169
|
for (const keyword of command.keywords ?? []) {
|
|
184
|
-
const m =
|
|
185
|
-
if (strongEnough(m,
|
|
170
|
+
const m = matchFolded(q, keyword);
|
|
171
|
+
if (strongEnough(m, q.length) && (!best || m.score * WEIGHT_KEYWORD > best.score)) best = {
|
|
186
172
|
score: m.score * WEIGHT_KEYWORD,
|
|
187
173
|
indices: label?.indices ?? []
|
|
188
174
|
};
|
|
189
175
|
}
|
|
190
176
|
if (command.description) {
|
|
191
|
-
const m =
|
|
192
|
-
if (strongEnough(m,
|
|
177
|
+
const m = matchFolded(q, command.description);
|
|
178
|
+
if (strongEnough(m, q.length) && (!best || m.score * WEIGHT_DESCRIPTION > best.score)) best = {
|
|
193
179
|
score: m.score * WEIGHT_DESCRIPTION,
|
|
194
180
|
indices: label?.indices ?? []
|
|
195
181
|
};
|
|
196
182
|
}
|
|
197
183
|
return best;
|
|
198
184
|
}
|
|
185
|
+
const DEFAULT_COMMAND_PALETTE_LABELS = {
|
|
186
|
+
placeholder: "Type a command or search…",
|
|
187
|
+
dialog: "Command palette",
|
|
188
|
+
listbox: "Commands",
|
|
189
|
+
empty: "No results found.",
|
|
190
|
+
loading: "Loading…",
|
|
191
|
+
recent: "Recent",
|
|
192
|
+
defaultGroup: "Commands",
|
|
193
|
+
results: "{count} results",
|
|
194
|
+
closeHint: "Esc",
|
|
195
|
+
back: "Back",
|
|
196
|
+
level: "{name}: {count} results",
|
|
197
|
+
submenu: "opens a sub-palette"
|
|
198
|
+
};
|
|
199
|
+
const DEFAULT_COMMAND_PALETTE_CONFIG = {
|
|
200
|
+
shortcut: "mod+k",
|
|
201
|
+
theme: "auto",
|
|
202
|
+
recent: {
|
|
203
|
+
max: 5,
|
|
204
|
+
storageKey: "rr-cp:recent"
|
|
205
|
+
},
|
|
206
|
+
debounceMs: 200,
|
|
207
|
+
maxResults: 50,
|
|
208
|
+
maxEmptyResults: 100,
|
|
209
|
+
filter: matchCommand,
|
|
210
|
+
labels: DEFAULT_COMMAND_PALETTE_LABELS
|
|
211
|
+
};
|
|
212
|
+
const COMMAND_PALETTE_CONFIG = new InjectionToken("COMMAND_PALETTE_CONFIG", {
|
|
213
|
+
providedIn: "root",
|
|
214
|
+
factory: () => DEFAULT_COMMAND_PALETTE_CONFIG
|
|
215
|
+
});
|
|
216
|
+
function resolveConfig(options = {}) {
|
|
217
|
+
return {
|
|
218
|
+
...DEFAULT_COMMAND_PALETTE_CONFIG,
|
|
219
|
+
...options,
|
|
220
|
+
recent: options.recent === false ? false : {
|
|
221
|
+
...DEFAULT_COMMAND_PALETTE_CONFIG.recent,
|
|
222
|
+
...options.recent
|
|
223
|
+
},
|
|
224
|
+
labels: {
|
|
225
|
+
...DEFAULT_COMMAND_PALETTE_LABELS,
|
|
226
|
+
...options.labels
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function provideCommandPalette(options = {}) {
|
|
231
|
+
return makeEnvironmentProviders([{
|
|
232
|
+
provide: COMMAND_PALETTE_CONFIG,
|
|
233
|
+
useValue: resolveConfig(options)
|
|
234
|
+
}]);
|
|
235
|
+
}
|
|
199
236
|
var RecentStore = class {
|
|
200
237
|
storageKey;
|
|
201
238
|
max;
|
|
@@ -273,9 +310,25 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
273
310
|
providerState = signal(/* @__PURE__ */ new Map(), ...ngDevMode ? [{ debugName: "providerState" }] : /* istanbul ignore next */ []);
|
|
274
311
|
recents = signal(this.recentStore?.load() ?? [], ...ngDevMode ? [{ debugName: "recents" }] : /* istanbul ignore next */ []);
|
|
275
312
|
pending = /* @__PURE__ */ new Map();
|
|
313
|
+
pathIds = signal([], ...ngDevMode ? [{ debugName: "pathIds" }] : /* istanbul ignore next */ []);
|
|
276
314
|
returnFocus = null;
|
|
277
315
|
isOpen = this._isOpen.asReadonly();
|
|
278
316
|
query = this._query.asReadonly();
|
|
317
|
+
path = computed(() => {
|
|
318
|
+
const path = [];
|
|
319
|
+
let level = this.commands();
|
|
320
|
+
for (const id of this.pathIds()) {
|
|
321
|
+
const parent = level.find((c) => c.id === id && isParent(c));
|
|
322
|
+
if (!parent) break;
|
|
323
|
+
path.push(parent);
|
|
324
|
+
level = parent.children;
|
|
325
|
+
}
|
|
326
|
+
return path;
|
|
327
|
+
}, ...ngDevMode ? [{ debugName: "path" }] : /* istanbul ignore next */ []);
|
|
328
|
+
levelCommands = computed(() => {
|
|
329
|
+
const path = this.path();
|
|
330
|
+
return path.length ? path[path.length - 1].children : this.commands();
|
|
331
|
+
}, ...ngDevMode ? [{ debugName: "levelCommands" }] : /* istanbul ignore next */ []);
|
|
279
332
|
commands = computed(() => {
|
|
280
333
|
const byId = /* @__PURE__ */ new Map();
|
|
281
334
|
for (const registration of this.registrations()) for (const command of registration.source()) {
|
|
@@ -292,6 +345,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
292
345
|
this.returnFocus = active && active !== this.document.body && typeof active.focus === "function" ? active : null;
|
|
293
346
|
}
|
|
294
347
|
this._isOpen.set(true);
|
|
348
|
+
this.pathIds.set([]);
|
|
295
349
|
this.setQuery(query);
|
|
296
350
|
}
|
|
297
351
|
close() {
|
|
@@ -299,6 +353,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
299
353
|
this._isOpen.set(false);
|
|
300
354
|
this.cancelAll();
|
|
301
355
|
this._query.set("");
|
|
356
|
+
this.pathIds.set([]);
|
|
302
357
|
this.providerState.set(/* @__PURE__ */ new Map());
|
|
303
358
|
const target = this.returnFocus;
|
|
304
359
|
this.returnFocus = null;
|
|
@@ -312,6 +367,13 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
312
367
|
this._query.set(query);
|
|
313
368
|
if (this._isOpen()) this.scheduleProviders();
|
|
314
369
|
}
|
|
370
|
+
back(levels = 1) {
|
|
371
|
+
const path = this.path();
|
|
372
|
+
if (!path.length || levels < 1) return false;
|
|
373
|
+
this.pathIds.set(path.slice(0, Math.max(0, path.length - levels)).map((c) => c.id));
|
|
374
|
+
this.setQuery("");
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
315
377
|
register(commands, destroyRef) {
|
|
316
378
|
const registration = { source: isSignal(commands) ? commands : () => commands };
|
|
317
379
|
this.registrations.update((list) => [...list, registration]);
|
|
@@ -320,7 +382,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
320
382
|
}
|
|
321
383
|
registerProvider(provider, destroyRef) {
|
|
322
384
|
this.providers.update((list) => [...list.filter((p) => p.id !== provider.id), provider]);
|
|
323
|
-
if (this._isOpen()) this.scheduleProvider(provider, this._query());
|
|
385
|
+
if (this._isOpen() && !this.pathIds().length) this.scheduleProvider(provider, this._query());
|
|
324
386
|
const remove = () => {
|
|
325
387
|
if (!this.providers().includes(provider)) return;
|
|
326
388
|
this.cancel(provider.id);
|
|
@@ -335,6 +397,14 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
335
397
|
}
|
|
336
398
|
async execute(command) {
|
|
337
399
|
if (command.disabled) return;
|
|
400
|
+
if (isParent(command)) {
|
|
401
|
+
if (!this.levelCommands().some((c) => c.id === command.id)) throw new Error("ngx-command-palette: only registered commands can have children");
|
|
402
|
+
this.cancelAll();
|
|
403
|
+
this.providerState.set(/* @__PURE__ */ new Map());
|
|
404
|
+
this.pathIds.update((ids) => [...ids, command.id]);
|
|
405
|
+
this.setQuery("");
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
338
408
|
const query = this._query();
|
|
339
409
|
if (this.recentStore) this.recents.set(this.recentStore.add(command, this.recents()));
|
|
340
410
|
this.close();
|
|
@@ -357,7 +427,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
357
427
|
}
|
|
358
428
|
buildSections(query) {
|
|
359
429
|
const defaultGroup = this.config.labels.defaultGroup;
|
|
360
|
-
const commands = this.
|
|
430
|
+
const commands = this.levelCommands();
|
|
361
431
|
const groups = /* @__PURE__ */ new Map();
|
|
362
432
|
const push = (group, result) => {
|
|
363
433
|
const list = groups.get(group);
|
|
@@ -365,21 +435,26 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
365
435
|
else groups.set(group, [result]);
|
|
366
436
|
};
|
|
367
437
|
const sections = [];
|
|
438
|
+
const topLevel = !this.pathIds().length;
|
|
368
439
|
if (!query) {
|
|
369
|
-
const recent = this.recentResults(commands);
|
|
440
|
+
const recent = topLevel ? this.recentResults(commands) : [];
|
|
370
441
|
if (recent.length) sections.push({
|
|
371
442
|
id: RECENT_SECTION_ID,
|
|
372
443
|
label: this.config.labels.recent,
|
|
373
444
|
items: recent
|
|
374
445
|
});
|
|
446
|
+
let listed = 0;
|
|
375
447
|
for (const command of commands) {
|
|
448
|
+
if (isHidden(command)) continue;
|
|
449
|
+
if (listed++ >= this.config.maxEmptyResults) break;
|
|
376
450
|
const group = command.group ?? defaultGroup;
|
|
377
451
|
push(group, toResult(command, `g:${group}:${command.id}`, 0, []));
|
|
378
452
|
}
|
|
379
453
|
} else {
|
|
380
454
|
const scored = [];
|
|
381
455
|
for (const command of commands) {
|
|
382
|
-
|
|
456
|
+
if (isHidden(command)) continue;
|
|
457
|
+
const match = this.config.filter(query, command);
|
|
383
458
|
if (!match) continue;
|
|
384
459
|
const group = command.group ?? defaultGroup;
|
|
385
460
|
scored.push(toResult(command, `g:${group}:${command.id}`, match.score, match.indices));
|
|
@@ -393,14 +468,14 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
393
468
|
items
|
|
394
469
|
});
|
|
395
470
|
const states = this.providerState();
|
|
396
|
-
for (const provider of this.providers()) {
|
|
471
|
+
for (const provider of topLevel ? this.providers() : []) {
|
|
397
472
|
const state = states.get(provider.id);
|
|
398
473
|
if (!state?.items.length) continue;
|
|
399
|
-
const items = state.items.map((command) => {
|
|
474
|
+
const items = state.items.filter((command) => !isHidden(command)).map((command) => {
|
|
400
475
|
const match = query ? fuzzyMatch(query, command.label) : null;
|
|
401
476
|
return toResult(command, `p:${provider.id}:${command.id}`, match?.score ?? 0, match?.indices ?? []);
|
|
402
477
|
});
|
|
403
|
-
sections.push({
|
|
478
|
+
if (items.length) sections.push({
|
|
404
479
|
id: `p:${provider.id}`,
|
|
405
480
|
label: provider.group,
|
|
406
481
|
items
|
|
@@ -410,7 +485,7 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
410
485
|
}
|
|
411
486
|
recentResults(commands) {
|
|
412
487
|
if (!this.recentStore) return [];
|
|
413
|
-
const byId = new Map(commands.map((c) => [c.id, c]));
|
|
488
|
+
const byId = new Map(descendants(commands).map((c) => [c.id, c]));
|
|
414
489
|
const results = [];
|
|
415
490
|
for (const entry of this.recents()) {
|
|
416
491
|
const command = byId.get(entry.id) ?? (entry.route !== void 0 ? {
|
|
@@ -420,11 +495,12 @@ var CommandPaletteService = class CommandPaletteService {
|
|
|
420
495
|
...entry.group ? { group: entry.group } : {},
|
|
421
496
|
...entry.description ? { description: entry.description } : {}
|
|
422
497
|
} : void 0);
|
|
423
|
-
if (command && !command.disabled) results.push(toResult(command, `r:${entry.id}`, 0, []));
|
|
498
|
+
if (command && !command.disabled && !isHidden(command)) results.push(toResult(command, `r:${entry.id}`, 0, []));
|
|
424
499
|
}
|
|
425
500
|
return results;
|
|
426
501
|
}
|
|
427
502
|
scheduleProviders() {
|
|
503
|
+
if (this.pathIds().length) return;
|
|
428
504
|
const query = this._query();
|
|
429
505
|
for (const provider of this.providers()) this.scheduleProvider(provider, query);
|
|
430
506
|
}
|
|
@@ -542,6 +618,22 @@ function toResult(command, key, score, indices) {
|
|
|
542
618
|
segments: highlightSegments(command.label, indices)
|
|
543
619
|
};
|
|
544
620
|
}
|
|
621
|
+
function isParent(command) {
|
|
622
|
+
return Array.isArray(command.children);
|
|
623
|
+
}
|
|
624
|
+
function descendants(commands) {
|
|
625
|
+
const all = [];
|
|
626
|
+
for (const command of commands) {
|
|
627
|
+
if (isHidden(command)) continue;
|
|
628
|
+
all.push(command);
|
|
629
|
+
if (isParent(command)) all.push(...descendants(command.children));
|
|
630
|
+
}
|
|
631
|
+
return all;
|
|
632
|
+
}
|
|
633
|
+
function isHidden(command) {
|
|
634
|
+
const { hidden } = command;
|
|
635
|
+
return typeof hidden === "function" ? hidden() : !!hidden;
|
|
636
|
+
}
|
|
545
637
|
function isSubscribable(value) {
|
|
546
638
|
return !!value && typeof value.subscribe === "function";
|
|
547
639
|
}
|
|
@@ -773,7 +865,9 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
773
865
|
status = computed(() => {
|
|
774
866
|
if (this.service.loading()) return this.labels.loading;
|
|
775
867
|
const count = this.items().length;
|
|
776
|
-
|
|
868
|
+
if (count === 0) return this.labels.empty;
|
|
869
|
+
const path = this.service.path();
|
|
870
|
+
return (path.length ? this.labels.level : this.labels.results).replace("{name}", path[path.length - 1]?.label ?? "").replace("{count}", String(count));
|
|
777
871
|
}, ...ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []);
|
|
778
872
|
constructor() {
|
|
779
873
|
const media = this.document.defaultView?.matchMedia?.("(prefers-color-scheme: dark)");
|
|
@@ -796,6 +890,14 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
796
890
|
optionId(index) {
|
|
797
891
|
return `${this.uid}-option-${index}`;
|
|
798
892
|
}
|
|
893
|
+
hasChildren(command) {
|
|
894
|
+
return Array.isArray(command.children);
|
|
895
|
+
}
|
|
896
|
+
onBack(levels) {
|
|
897
|
+
this.activeKey.set(null);
|
|
898
|
+
this.service.back(levels);
|
|
899
|
+
this.input()?.nativeElement.focus({ preventScroll: true });
|
|
900
|
+
}
|
|
799
901
|
isTemplate(icon) {
|
|
800
902
|
return icon instanceof TemplateRef;
|
|
801
903
|
}
|
|
@@ -808,6 +910,12 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
808
910
|
this.trapTab(event);
|
|
809
911
|
return;
|
|
810
912
|
}
|
|
913
|
+
if (event.key === "Backspace" && !event.isComposing && this.service.query() === "" && this.service.path().length) {
|
|
914
|
+
event.preventDefault();
|
|
915
|
+
this.activeKey.set(null);
|
|
916
|
+
this.service.back();
|
|
917
|
+
return;
|
|
918
|
+
}
|
|
811
919
|
const action = keyToAction(event);
|
|
812
920
|
if (!action) return;
|
|
813
921
|
event.preventDefault();
|
|
@@ -925,8 +1033,8 @@ var CommandPaletteComponent = class CommandPaletteComponent {
|
|
|
925
1033
|
isSignal: true
|
|
926
1034
|
}],
|
|
927
1035
|
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"],
|
|
1036
|
+
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",
|
|
1037
|
+
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
1038
|
dependencies: [{
|
|
931
1039
|
kind: "directive",
|
|
932
1040
|
type: NgTemplateOutlet,
|
|
@@ -958,8 +1066,8 @@ i0.ɵɵngDeclareClassMetadata({
|
|
|
958
1066
|
"(document:keydown)": "onDocumentKeydown($event)",
|
|
959
1067
|
"(document:focusin)": "onDocumentFocusin($event)"
|
|
960
1068
|
},
|
|
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"]
|
|
1069
|
+
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",
|
|
1070
|
+
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
1071
|
}]
|
|
964
1072
|
}],
|
|
965
1073
|
ctorParameters: () => [],
|