impact-nova 1.5.12 → 1.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as f, Fragment as le } from "react/jsx-runtime";
|
|
2
2
|
import * as r from "react";
|
|
3
3
|
import * as R from "@radix-ui/react-dialog";
|
|
4
4
|
import { Search as U } from "lucide-react";
|
|
5
5
|
import { cn as c } from "../../../lib/utils.js";
|
|
6
|
-
import { useCommandPalette as
|
|
6
|
+
import { useCommandPalette as de } from "./command-palette-context.js";
|
|
7
7
|
import { Kbd as S } from "./kbd.js";
|
|
8
|
-
import { fuzzyFilter as
|
|
9
|
-
const
|
|
8
|
+
import { fuzzyFilter as me, keybindingToSymbols as fe } from "./utils.js";
|
|
9
|
+
const D = r.createContext({
|
|
10
10
|
query: "",
|
|
11
11
|
setQuery: () => {
|
|
12
12
|
},
|
|
@@ -17,14 +17,14 @@ const z = r.createContext({
|
|
|
17
17
|
onExecute: () => {
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
function
|
|
20
|
+
function ue({
|
|
21
21
|
className: o,
|
|
22
22
|
children: a,
|
|
23
23
|
commands: n,
|
|
24
24
|
placeholder: i = "Type a command or search...",
|
|
25
25
|
emptyTitle: l = "No results found",
|
|
26
26
|
emptyDescription: y = "Try a different search term",
|
|
27
|
-
recentGroupLabel:
|
|
27
|
+
recentGroupLabel: d = "Recently Used",
|
|
28
28
|
defaultGroupLabel: C = "Commands",
|
|
29
29
|
navigateLabel: O = "Navigate",
|
|
30
30
|
runLabel: A = "Run",
|
|
@@ -32,90 +32,92 @@ function fe({
|
|
|
32
32
|
onCommandExecute: j,
|
|
33
33
|
onOpenChange: G
|
|
34
34
|
}) {
|
|
35
|
-
const { open: M, setOpen: L, getPaletteCommands: ee, getEffectiveKeybinding: te, registry: k } =
|
|
36
|
-
const
|
|
35
|
+
const { open: M, setOpen: L, getPaletteCommands: ee, getEffectiveKeybinding: te, registry: k } = de(), [w, q] = r.useState(""), [v, N] = r.useState(0), $ = r.useRef(null), K = r.useRef(null), T = r.useMemo(() => n ?? ee(), [n, M]), B = r.useMemo(() => {
|
|
36
|
+
const e = me(
|
|
37
37
|
T,
|
|
38
38
|
w,
|
|
39
39
|
(s) => `${s.category ? s.category + ": " : ""}${s.label}${s.description ? " " + s.description : ""}`
|
|
40
40
|
);
|
|
41
41
|
if (!w.trim()) {
|
|
42
|
-
const s = k.getRecentCommandIds(), E = new Set(s),
|
|
43
|
-
for (const
|
|
44
|
-
E.has(
|
|
45
|
-
return
|
|
42
|
+
const s = k.getRecentCommandIds(), E = new Set(s), p = [], b = [];
|
|
43
|
+
for (const x of e)
|
|
44
|
+
E.has(x.item.id) ? p.push(x) : b.push(x);
|
|
45
|
+
return p.sort((x, z) => s.indexOf(x.item.id) - s.indexOf(z.item.id)), [...p, ...b];
|
|
46
46
|
}
|
|
47
|
-
return
|
|
48
|
-
}, [T, w, k]),
|
|
49
|
-
const
|
|
47
|
+
return e;
|
|
48
|
+
}, [T, w, k]), u = r.useMemo(() => B.map((e) => e.item), [B]), ae = r.useMemo(() => {
|
|
49
|
+
const e = /* @__PURE__ */ new Map(), s = new Set(k.getRecentCommandIds());
|
|
50
50
|
if (w.trim())
|
|
51
|
-
for (const
|
|
52
|
-
const
|
|
53
|
-
|
|
51
|
+
for (const m of u) {
|
|
52
|
+
const h = m.category || C;
|
|
53
|
+
e.has(h) || e.set(h, []), e.get(h).push(m);
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
for (const g of
|
|
56
|
+
const m = u.filter((g) => s.has(g.id));
|
|
57
|
+
m.length > 0 && e.set(d, m);
|
|
58
|
+
const h = u.filter((g) => !s.has(g.id));
|
|
59
|
+
for (const g of h) {
|
|
60
60
|
const P = g.category || C;
|
|
61
|
-
|
|
61
|
+
e.has(P) || e.set(P, []), e.get(P).push(g);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
const E = { modal: 4, page: 3, module: 2, global: 1 },
|
|
65
|
-
for (const [
|
|
64
|
+
const E = { modal: 4, page: 3, module: 2, global: 1 }, p = { user: 2, "ag-grid": 1, browser: 0, system: 0 }, b = /* @__PURE__ */ new Map();
|
|
65
|
+
for (const [m, h] of e.entries()) {
|
|
66
66
|
let g = -1;
|
|
67
|
-
for (const P of
|
|
68
|
-
const
|
|
69
|
-
g = Math.max(g,
|
|
67
|
+
for (const P of h) {
|
|
68
|
+
const ie = E[P.scope] ?? 1, ce = p[P.source ?? "user"] ?? 0;
|
|
69
|
+
g = Math.max(g, ie * 10 + ce);
|
|
70
70
|
}
|
|
71
|
-
b.set(
|
|
71
|
+
b.set(m, g);
|
|
72
72
|
}
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
const x = /* @__PURE__ */ new Map(), z = e.get(d);
|
|
74
|
+
z && x.set(d, z);
|
|
75
|
+
const oe = Array.from(e.entries()).filter(([m]) => m !== d).sort(([m], [h]) => (b.get(h) ?? 0) - (b.get(m) ?? 0));
|
|
76
|
+
for (const [m, h] of oe)
|
|
77
|
+
x.set(m, h);
|
|
78
|
+
return x;
|
|
79
|
+
}, [u, w, k, d, C]);
|
|
78
80
|
r.useEffect(() => {
|
|
79
81
|
M && (q(""), N(0), requestAnimationFrame(() => {
|
|
80
82
|
$.current?.focus();
|
|
81
83
|
}));
|
|
82
84
|
}, [M]);
|
|
83
|
-
const Q = (
|
|
84
|
-
L(
|
|
85
|
-
}, I = r.useCallback((
|
|
86
|
-
|
|
87
|
-
}, [k, j]), ne = r.useCallback((
|
|
88
|
-
switch (
|
|
85
|
+
const Q = (e) => {
|
|
86
|
+
L(e), G?.(e);
|
|
87
|
+
}, I = r.useCallback((e) => {
|
|
88
|
+
e.handler(), k.addRecentCommand(e.id), j?.(e), Q(!1);
|
|
89
|
+
}, [k, j]), ne = r.useCallback((e) => {
|
|
90
|
+
switch (e.key) {
|
|
89
91
|
case "ArrowDown": {
|
|
90
|
-
|
|
92
|
+
e.preventDefault(), N((s) => Math.min(s + 1, u.length - 1));
|
|
91
93
|
break;
|
|
92
94
|
}
|
|
93
95
|
case "ArrowUp": {
|
|
94
|
-
|
|
96
|
+
e.preventDefault(), N((s) => Math.max(s - 1, 0));
|
|
95
97
|
break;
|
|
96
98
|
}
|
|
97
99
|
case "Enter": {
|
|
98
|
-
|
|
99
|
-
const s =
|
|
100
|
+
e.preventDefault();
|
|
101
|
+
const s = u[v];
|
|
100
102
|
s && I(s);
|
|
101
103
|
break;
|
|
102
104
|
}
|
|
103
105
|
case "Home": {
|
|
104
|
-
|
|
106
|
+
e.preventDefault(), N(0);
|
|
105
107
|
break;
|
|
106
108
|
}
|
|
107
109
|
case "End": {
|
|
108
|
-
|
|
110
|
+
e.preventDefault(), N(Math.max(u.length - 1, 0));
|
|
109
111
|
break;
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
|
-
}, [
|
|
114
|
+
}, [u, v, I]);
|
|
113
115
|
r.useEffect(() => {
|
|
114
116
|
N(0);
|
|
115
117
|
}, [w]), r.useEffect(() => {
|
|
116
|
-
const
|
|
117
|
-
if (!
|
|
118
|
-
const s =
|
|
118
|
+
const e = K.current;
|
|
119
|
+
if (!e) return;
|
|
120
|
+
const s = e.querySelector('[data-selected="true"]');
|
|
119
121
|
s && s.scrollIntoView({ block: "nearest" });
|
|
120
122
|
}, [v]);
|
|
121
123
|
const se = r.useMemo(
|
|
@@ -124,12 +126,12 @@ function fe({
|
|
|
124
126
|
setQuery: q,
|
|
125
127
|
selectedIndex: v,
|
|
126
128
|
setSelectedIndex: N,
|
|
127
|
-
flatItems:
|
|
129
|
+
flatItems: u,
|
|
128
130
|
onExecute: I,
|
|
129
131
|
placeholder: i,
|
|
130
132
|
emptyTitle: l,
|
|
131
133
|
emptyDescription: y,
|
|
132
|
-
recentGroupLabel:
|
|
134
|
+
recentGroupLabel: d,
|
|
133
135
|
defaultGroupLabel: C,
|
|
134
136
|
navigateLabel: O,
|
|
135
137
|
runLabel: A,
|
|
@@ -138,26 +140,26 @@ function fe({
|
|
|
138
140
|
[
|
|
139
141
|
w,
|
|
140
142
|
v,
|
|
141
|
-
|
|
143
|
+
u,
|
|
142
144
|
I,
|
|
143
145
|
i,
|
|
144
146
|
l,
|
|
145
147
|
y,
|
|
146
|
-
|
|
148
|
+
d,
|
|
147
149
|
C,
|
|
148
150
|
O,
|
|
149
151
|
A,
|
|
150
152
|
F
|
|
151
153
|
]
|
|
152
154
|
), re = r.Children.count(a) > 0;
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
+
return /* @__PURE__ */ t(R.Root, { open: M, onOpenChange: Q, children: /* @__PURE__ */ f(R.Portal, { children: [
|
|
156
|
+
/* @__PURE__ */ t(
|
|
155
157
|
R.Overlay,
|
|
156
158
|
{
|
|
157
159
|
className: "fixed inset-0 z-50 bg-black/40 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
|
158
160
|
}
|
|
159
161
|
),
|
|
160
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ f(
|
|
161
163
|
R.Content,
|
|
162
164
|
{
|
|
163
165
|
"aria-describedby": void 0,
|
|
@@ -177,44 +179,44 @@ function fe({
|
|
|
177
179
|
),
|
|
178
180
|
style: { transformOrigin: "top center" },
|
|
179
181
|
children: [
|
|
180
|
-
/* @__PURE__ */
|
|
181
|
-
/* @__PURE__ */
|
|
182
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ t(R.Title, { className: "sr-only", children: "Command Palette" }),
|
|
183
|
+
/* @__PURE__ */ t(D.Provider, { value: se, children: re ? a : /* @__PURE__ */ f(le, { children: [
|
|
184
|
+
/* @__PURE__ */ t(
|
|
183
185
|
W,
|
|
184
186
|
{
|
|
185
187
|
ref: $,
|
|
186
188
|
placeholder: i
|
|
187
189
|
}
|
|
188
190
|
),
|
|
189
|
-
/* @__PURE__ */
|
|
190
|
-
E > 0 && /* @__PURE__ */
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
const b =
|
|
193
|
-
return /* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ t(H, { ref: K, children: u.length === 0 ? /* @__PURE__ */ t(X, {}) : Array.from(ae.entries()).map(([e, s], E) => /* @__PURE__ */ f(r.Fragment, { children: [
|
|
192
|
+
E > 0 && /* @__PURE__ */ t(Y, {}),
|
|
193
|
+
/* @__PURE__ */ t(V, { heading: e, children: s.map((p) => {
|
|
194
|
+
const b = u.indexOf(p), x = te(p.id);
|
|
195
|
+
return /* @__PURE__ */ t(
|
|
194
196
|
_,
|
|
195
197
|
{
|
|
196
|
-
command:
|
|
198
|
+
command: p,
|
|
197
199
|
isSelected: b === v,
|
|
198
|
-
onSelect: () => I(
|
|
200
|
+
onSelect: () => I(p),
|
|
199
201
|
onMouseEnter: () => N(b),
|
|
200
|
-
keybinding:
|
|
202
|
+
keybinding: x
|
|
201
203
|
},
|
|
202
|
-
|
|
204
|
+
p.id
|
|
203
205
|
);
|
|
204
206
|
}) })
|
|
205
|
-
] },
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
+
] }, e)) }),
|
|
208
|
+
/* @__PURE__ */ t(Z, {})
|
|
207
209
|
] }) })
|
|
208
210
|
]
|
|
209
211
|
}
|
|
210
212
|
)
|
|
211
213
|
] }) });
|
|
212
214
|
}
|
|
213
|
-
|
|
215
|
+
ue.displayName = "CommandPalette";
|
|
214
216
|
const W = r.forwardRef(
|
|
215
217
|
({ className: o, placeholder: a, onValueChange: n, ...i }, l) => {
|
|
216
|
-
const { query: y, setQuery:
|
|
217
|
-
return /* @__PURE__ */
|
|
218
|
+
const { query: y, setQuery: d } = r.useContext(D);
|
|
219
|
+
return /* @__PURE__ */ f(
|
|
218
220
|
"div",
|
|
219
221
|
{
|
|
220
222
|
className: c(
|
|
@@ -223,14 +225,14 @@ const W = r.forwardRef(
|
|
|
223
225
|
),
|
|
224
226
|
"data-command-palette-input": !0,
|
|
225
227
|
children: [
|
|
226
|
-
/* @__PURE__ */
|
|
227
|
-
/* @__PURE__ */
|
|
228
|
+
/* @__PURE__ */ t(U, { className: "h-4 w-4 shrink-0 text-[#9ca3af]" }),
|
|
229
|
+
/* @__PURE__ */ t(
|
|
228
230
|
"input",
|
|
229
231
|
{
|
|
230
232
|
ref: l,
|
|
231
233
|
value: y,
|
|
232
234
|
onChange: (C) => {
|
|
233
|
-
|
|
235
|
+
d(C.target.value), n?.(C.target.value);
|
|
234
236
|
},
|
|
235
237
|
placeholder: a,
|
|
236
238
|
autoComplete: "off",
|
|
@@ -243,7 +245,7 @@ const W = r.forwardRef(
|
|
|
243
245
|
...i
|
|
244
246
|
}
|
|
245
247
|
),
|
|
246
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ t(
|
|
247
249
|
S,
|
|
248
250
|
{
|
|
249
251
|
keybinding: { key: "Escape" },
|
|
@@ -258,7 +260,7 @@ const W = r.forwardRef(
|
|
|
258
260
|
}
|
|
259
261
|
);
|
|
260
262
|
W.displayName = "CommandPaletteInput";
|
|
261
|
-
const H = r.forwardRef(({ className: o, children: a, ...n }, i) => /* @__PURE__ */
|
|
263
|
+
const H = r.forwardRef(({ className: o, children: a, ...n }, i) => /* @__PURE__ */ t(
|
|
262
264
|
"div",
|
|
263
265
|
{
|
|
264
266
|
ref: i,
|
|
@@ -274,7 +276,7 @@ const H = r.forwardRef(({ className: o, children: a, ...n }, i) => /* @__PURE__
|
|
|
274
276
|
));
|
|
275
277
|
H.displayName = "CommandPaletteList";
|
|
276
278
|
const V = r.forwardRef(
|
|
277
|
-
({ className: o, heading: a, children: n, ...i }, l) => /* @__PURE__ */
|
|
279
|
+
({ className: o, heading: a, children: n, ...i }, l) => /* @__PURE__ */ f(
|
|
278
280
|
"div",
|
|
279
281
|
{
|
|
280
282
|
ref: l,
|
|
@@ -284,22 +286,22 @@ const V = r.forwardRef(
|
|
|
284
286
|
className: c("py-1", o),
|
|
285
287
|
...i,
|
|
286
288
|
children: [
|
|
287
|
-
a && /* @__PURE__ */
|
|
289
|
+
a && /* @__PURE__ */ t("div", { className: "px-4 py-1.5 text-[10px] font-semibold uppercase tracking-wider text-[#9ca3af]", children: a }),
|
|
288
290
|
n
|
|
289
291
|
]
|
|
290
292
|
}
|
|
291
293
|
)
|
|
292
294
|
);
|
|
293
295
|
V.displayName = "CommandPaletteGroup";
|
|
294
|
-
const
|
|
296
|
+
const pe = {
|
|
295
297
|
browser: "Browser",
|
|
296
298
|
"ag-grid": "AG Grid",
|
|
297
299
|
system: "System"
|
|
298
300
|
};
|
|
299
|
-
function
|
|
301
|
+
function xe({ source: o, isSelected: a }) {
|
|
300
302
|
if (!o || o === "user") return null;
|
|
301
|
-
const n =
|
|
302
|
-
return n ? /* @__PURE__ */
|
|
303
|
+
const n = pe[o];
|
|
304
|
+
return n ? /* @__PURE__ */ t(
|
|
303
305
|
"span",
|
|
304
306
|
{
|
|
305
307
|
className: c(
|
|
@@ -311,10 +313,10 @@ function pe({ source: o, isSelected: a }) {
|
|
|
311
313
|
) : null;
|
|
312
314
|
}
|
|
313
315
|
const _ = r.forwardRef(
|
|
314
|
-
({ className: o, command: a, isSelected: n, onSelect: i, keybinding: l, ...y },
|
|
316
|
+
({ className: o, command: a, isSelected: n, onSelect: i, keybinding: l, ...y }, d) => /* @__PURE__ */ f(
|
|
315
317
|
"div",
|
|
316
318
|
{
|
|
317
|
-
ref:
|
|
319
|
+
ref: d,
|
|
318
320
|
role: "option",
|
|
319
321
|
"aria-selected": n,
|
|
320
322
|
"data-selected": n,
|
|
@@ -329,33 +331,33 @@ const _ = r.forwardRef(
|
|
|
329
331
|
),
|
|
330
332
|
...y,
|
|
331
333
|
children: [
|
|
332
|
-
a.icon && /* @__PURE__ */
|
|
334
|
+
a.icon && /* @__PURE__ */ t("span", { className: c(
|
|
333
335
|
"flex h-4 w-4 shrink-0 items-center justify-center",
|
|
334
336
|
n ? "text-white" : "text-[#6b7280]"
|
|
335
337
|
), children: a.icon }),
|
|
336
|
-
/* @__PURE__ */
|
|
337
|
-
/* @__PURE__ */
|
|
338
|
-
a.description && /* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ f("div", { className: "flex flex-1 flex-col min-w-0", children: [
|
|
339
|
+
/* @__PURE__ */ t("span", { className: "truncate font-medium", children: a.label }),
|
|
340
|
+
a.description && /* @__PURE__ */ t("span", { className: c(
|
|
339
341
|
"truncate text-xs",
|
|
340
342
|
n ? "text-white/70" : "text-[#9ca3af]"
|
|
341
343
|
), children: a.description })
|
|
342
344
|
] }),
|
|
343
|
-
/* @__PURE__ */
|
|
344
|
-
l && /* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ t(xe, { source: a.source, isSelected: n }),
|
|
346
|
+
l && /* @__PURE__ */ t(J, { keybinding: l, isSelected: n })
|
|
345
347
|
]
|
|
346
348
|
}
|
|
347
349
|
)
|
|
348
350
|
);
|
|
349
351
|
_.displayName = "CommandPaletteItem";
|
|
350
352
|
function J({ keybinding: o, isSelected: a, className: n, ...i }) {
|
|
351
|
-
const l =
|
|
352
|
-
return /* @__PURE__ */
|
|
353
|
+
const l = fe(o);
|
|
354
|
+
return /* @__PURE__ */ t(
|
|
353
355
|
"span",
|
|
354
356
|
{
|
|
355
357
|
className: c("ml-auto flex items-center gap-0.5 shrink-0", n),
|
|
356
358
|
"data-command-palette-shortcut": !0,
|
|
357
359
|
...i,
|
|
358
|
-
children: l.map((y,
|
|
360
|
+
children: l.map((y, d) => /* @__PURE__ */ t(
|
|
359
361
|
"kbd",
|
|
360
362
|
{
|
|
361
363
|
className: c(
|
|
@@ -364,15 +366,15 @@ function J({ keybinding: o, isSelected: a, className: n, ...i }) {
|
|
|
364
366
|
),
|
|
365
367
|
children: y
|
|
366
368
|
},
|
|
367
|
-
`${y}-${
|
|
369
|
+
`${y}-${d}`
|
|
368
370
|
))
|
|
369
371
|
}
|
|
370
372
|
);
|
|
371
373
|
}
|
|
372
374
|
J.displayName = "CommandPaletteShortcut";
|
|
373
375
|
function X({ className: o, ...a }) {
|
|
374
|
-
const { emptyTitle: n, emptyDescription: i } = r.useContext(
|
|
375
|
-
return /* @__PURE__ */
|
|
376
|
+
const { emptyTitle: n, emptyDescription: i } = r.useContext(D);
|
|
377
|
+
return /* @__PURE__ */ f(
|
|
376
378
|
"div",
|
|
377
379
|
{
|
|
378
380
|
"data-command-palette-empty": !0,
|
|
@@ -382,16 +384,16 @@ function X({ className: o, ...a }) {
|
|
|
382
384
|
),
|
|
383
385
|
...a,
|
|
384
386
|
children: [
|
|
385
|
-
/* @__PURE__ */
|
|
386
|
-
/* @__PURE__ */
|
|
387
|
-
/* @__PURE__ */
|
|
387
|
+
/* @__PURE__ */ t(U, { className: "h-8 w-8 mb-3 text-[#d1d5db]" }),
|
|
388
|
+
/* @__PURE__ */ t("p", { className: "font-medium", children: n }),
|
|
389
|
+
/* @__PURE__ */ t("p", { className: "text-xs mt-1", children: i })
|
|
388
390
|
]
|
|
389
391
|
}
|
|
390
392
|
);
|
|
391
393
|
}
|
|
392
394
|
X.displayName = "CommandPaletteEmpty";
|
|
393
395
|
function Y({ className: o, ...a }) {
|
|
394
|
-
return /* @__PURE__ */
|
|
396
|
+
return /* @__PURE__ */ t(
|
|
395
397
|
"div",
|
|
396
398
|
{
|
|
397
399
|
"data-command-palette-separator": !0,
|
|
@@ -402,8 +404,8 @@ function Y({ className: o, ...a }) {
|
|
|
402
404
|
}
|
|
403
405
|
Y.displayName = "CommandPaletteSeparator";
|
|
404
406
|
function Z({ className: o, ...a }) {
|
|
405
|
-
const { navigateLabel: n, runLabel: i, closeLabel: l } = r.useContext(
|
|
406
|
-
return /* @__PURE__ */
|
|
407
|
+
const { navigateLabel: n, runLabel: i, closeLabel: l } = r.useContext(D);
|
|
408
|
+
return /* @__PURE__ */ f(
|
|
407
409
|
"div",
|
|
408
410
|
{
|
|
409
411
|
"data-command-palette-footer": !0,
|
|
@@ -413,18 +415,18 @@ function Z({ className: o, ...a }) {
|
|
|
413
415
|
),
|
|
414
416
|
...a,
|
|
415
417
|
children: [
|
|
416
|
-
/* @__PURE__ */
|
|
417
|
-
/* @__PURE__ */
|
|
418
|
-
/* @__PURE__ */
|
|
419
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ f("span", { className: "inline-flex items-center gap-1", children: [
|
|
419
|
+
/* @__PURE__ */ t(S, { keys: ["↑"], size: "sm", variant: "muted" }),
|
|
420
|
+
/* @__PURE__ */ t(S, { keys: ["↓"], size: "sm", variant: "muted" }),
|
|
421
|
+
/* @__PURE__ */ t("span", { children: n })
|
|
420
422
|
] }),
|
|
421
|
-
/* @__PURE__ */
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */
|
|
423
|
+
/* @__PURE__ */ f("span", { className: "inline-flex items-center gap-1", children: [
|
|
424
|
+
/* @__PURE__ */ t(S, { keys: ["↵"], size: "sm", variant: "muted" }),
|
|
425
|
+
/* @__PURE__ */ t("span", { children: i })
|
|
424
426
|
] }),
|
|
425
|
-
/* @__PURE__ */
|
|
426
|
-
/* @__PURE__ */
|
|
427
|
-
/* @__PURE__ */
|
|
427
|
+
/* @__PURE__ */ f("span", { className: "inline-flex items-center gap-1", children: [
|
|
428
|
+
/* @__PURE__ */ t(S, { keys: ["Escape"], size: "sm", variant: "muted" }),
|
|
429
|
+
/* @__PURE__ */ t("span", { children: l })
|
|
428
430
|
] })
|
|
429
431
|
]
|
|
430
432
|
}
|
|
@@ -432,7 +434,7 @@ function Z({ className: o, ...a }) {
|
|
|
432
434
|
}
|
|
433
435
|
Z.displayName = "CommandPaletteFooter";
|
|
434
436
|
export {
|
|
435
|
-
|
|
437
|
+
ue as CommandPalette,
|
|
436
438
|
X as CommandPaletteEmpty,
|
|
437
439
|
Z as CommandPaletteFooter,
|
|
438
440
|
V as CommandPaletteGroup,
|
|
@@ -50,6 +50,7 @@ export declare class ShortcutRegistry {
|
|
|
50
50
|
popScope(scope: ShortcutScope): void;
|
|
51
51
|
getActiveScopes(): ShortcutScope[];
|
|
52
52
|
getHighestActiveScope(): ShortcutScope;
|
|
53
|
+
private getHighestActiveScopePriority;
|
|
53
54
|
getCommand(id: string): CommandDefinition | undefined;
|
|
54
55
|
getAllCommands(): CommandDefinition[];
|
|
55
56
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { deserialiseOverrides as h, serialiseOverrides as
|
|
1
|
+
import { deserialiseOverrides as h, serialiseOverrides as f, isReservedShortcut as u, keybindingsEqual as m, scopePriority as a, matchesKeybinding as g } from "./utils.js";
|
|
2
2
|
const v = 10;
|
|
3
3
|
class c {
|
|
4
4
|
static STORAGE_KEY = "impact-nova-shortcuts";
|
|
@@ -15,7 +15,7 @@ class c {
|
|
|
15
15
|
saveOverrides(e) {
|
|
16
16
|
if (!(typeof localStorage > "u"))
|
|
17
17
|
try {
|
|
18
|
-
localStorage.setItem(c.STORAGE_KEY,
|
|
18
|
+
localStorage.setItem(c.STORAGE_KEY, f(e));
|
|
19
19
|
} catch {
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -86,10 +86,10 @@ class C {
|
|
|
86
86
|
const s = this.commands.get(e);
|
|
87
87
|
if (!s) return { success: !1 };
|
|
88
88
|
if (!s.customisable) return { success: !1 };
|
|
89
|
-
if (
|
|
89
|
+
if (u(t))
|
|
90
90
|
return { success: !1, reserved: !0 };
|
|
91
|
-
const
|
|
92
|
-
return
|
|
91
|
+
const i = this.findConflict(e, t, s.scope);
|
|
92
|
+
return i ? { success: !1, conflict: i } : (s.keybinding = t, this.overrides.set(e, t), this.saveOverrides(), this.emit({ type: "update-keybinding", commandId: e }), { success: !0 });
|
|
93
93
|
}
|
|
94
94
|
resetKeybinding(e) {
|
|
95
95
|
const t = this.commands.get(e);
|
|
@@ -97,12 +97,12 @@ class C {
|
|
|
97
97
|
}
|
|
98
98
|
// ─── Conflict Detection ────────────────────────────────────────────────
|
|
99
99
|
findConflict(e, t, s) {
|
|
100
|
-
for (const [
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
100
|
+
for (const [i, r] of this.commands) {
|
|
101
|
+
if (i === e || r.scope !== s) continue;
|
|
102
|
+
const o = this.getEffectiveKeybinding(i);
|
|
103
|
+
if (o && m(o, t))
|
|
104
104
|
return {
|
|
105
|
-
conflictingCommandId:
|
|
105
|
+
conflictingCommandId: i,
|
|
106
106
|
conflictingLabel: r.label,
|
|
107
107
|
scope: r.scope
|
|
108
108
|
};
|
|
@@ -122,7 +122,13 @@ class C {
|
|
|
122
122
|
getHighestActiveScope() {
|
|
123
123
|
let e = "global";
|
|
124
124
|
for (const t of this.activeScopes)
|
|
125
|
-
|
|
125
|
+
a(t) > a(e) && (e = t);
|
|
126
|
+
return e;
|
|
127
|
+
}
|
|
128
|
+
getHighestActiveScopePriority() {
|
|
129
|
+
let e = 0;
|
|
130
|
+
for (const t of this.activeScopes)
|
|
131
|
+
e = Math.max(e, a(t));
|
|
126
132
|
return e;
|
|
127
133
|
}
|
|
128
134
|
// ─── Command Queries ───────────────────────────────────────────────────
|
|
@@ -140,7 +146,11 @@ class C {
|
|
|
140
146
|
*/
|
|
141
147
|
getPaletteCommands() {
|
|
142
148
|
const t = this.getRegisteredInstances().length > 1;
|
|
143
|
-
return this.getAllCommands().filter((s) =>
|
|
149
|
+
return this.getAllCommands().filter((s) => {
|
|
150
|
+
if (s.hidden || s.when && !s.when()) return !1;
|
|
151
|
+
const i = this.getHighestActiveScopePriority();
|
|
152
|
+
return !(a(s.scope) > i || s.instance && t && this.activeInstance && s.instance !== this.activeInstance);
|
|
153
|
+
});
|
|
144
154
|
}
|
|
145
155
|
/**
|
|
146
156
|
* Get commands for the settings panel (all registered, including hidden).
|
|
@@ -156,14 +166,14 @@ class C {
|
|
|
156
166
|
* @returns true if a command was executed, false otherwise
|
|
157
167
|
*/
|
|
158
168
|
handleKeyEvent(e) {
|
|
159
|
-
const t = this.activeScopes.has("modal"),
|
|
160
|
-
let r = null,
|
|
161
|
-
for (const
|
|
162
|
-
if (
|
|
163
|
-
const d = this.getEffectiveKeybinding(
|
|
164
|
-
if (d && !(t &&
|
|
165
|
-
const l =
|
|
166
|
-
l >
|
|
169
|
+
const t = this.activeScopes.has("modal"), i = this.getRegisteredInstances().length > 1;
|
|
170
|
+
let r = null, o = -1;
|
|
171
|
+
for (const n of this.commands.values()) {
|
|
172
|
+
if (n.passive) continue;
|
|
173
|
+
const d = this.getEffectiveKeybinding(n.id);
|
|
174
|
+
if (d && !(t && n.scope !== "modal") && !(n.instance && i && n.instance !== this.activeInstance) && !(n.when && !n.when()) && g(e, d)) {
|
|
175
|
+
const l = a(n.scope);
|
|
176
|
+
l > o && (r = n, o = l);
|
|
167
177
|
}
|
|
168
178
|
}
|
|
169
179
|
return r ? (e.preventDefault(), e.stopPropagation(), r.handler(), this.addRecentCommand(r.id), !0) : !1;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impact-nova",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.13",
|
|
4
4
|
"description": "Enterprise-grade React design system built with React 19, Vite, Tailwind CSS, and Radix UI. Built-in internationalization (i18n) and comprehensive UI component library for scalable, accessible, and performant applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|