nexus-shell 0.2.2 → 0.2.4
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 +4 -3
- package/dist/components/widgets/SettingsPanel.d.ts +6 -1
- package/dist/components/widgets/ThemeSwitcher.d.ts +7 -2
- package/dist/components/widgets/TreeWidget.d.ts +89 -44
- package/dist/core/Boot.d.ts +1 -1
- package/dist/core/services/ThemeService.d.ts +10 -1
- package/dist/index.d.ts +1 -0
- package/dist/lib/themes.d.ts +57 -0
- package/dist/nexus-shell.es.js +833 -823
- package/dist/nexus-shell.umd.js +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/nexus-shell.es.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var H = (
|
|
4
|
-
import { jsxs as c, jsx as r, Fragment as
|
|
5
|
-
import se, { useMemo as
|
|
6
|
-
import { Model as
|
|
1
|
+
var Oe = Object.defineProperty;
|
|
2
|
+
var Ae = (n, e, o) => e in n ? Oe(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o;
|
|
3
|
+
var H = (n, e, o) => Ae(n, typeof e != "symbol" ? e + "" : e, o);
|
|
4
|
+
import { jsxs as c, jsx as r, Fragment as be } from "react/jsx-runtime";
|
|
5
|
+
import se, { useMemo as j, useState as A, useRef as z, useEffect as O } from "react";
|
|
6
|
+
import { Model as R, Actions as G, DockLocation as Le, Layout as Me } from "flexlayout-react";
|
|
7
7
|
import "flexlayout-react/style/light.css";
|
|
8
|
-
import { Settings as
|
|
9
|
-
import { clsx as
|
|
10
|
-
import { twMerge as
|
|
11
|
-
import { create as
|
|
12
|
-
import { TableVirtuoso as
|
|
13
|
-
function S(...
|
|
14
|
-
return
|
|
8
|
+
import { Settings as ze, MessageCircle as xe, X as B, User as ve, Terminal as ye, Send as Pe, ChevronRight as we, GraduationCap as ue, Moon as $e, Sun as Re, Palette as Ke, ChevronUp as Ne, Search as Z, Info as je, HelpCircle as Ue, AlertCircle as Fe, Check as _e, Camera as Be, Edit2 as He, Loader2 as ke, ChevronsUpDown as We, ChevronDown as Ce, Clock as Je } from "lucide-react";
|
|
9
|
+
import { clsx as Ge } from "clsx";
|
|
10
|
+
import { twMerge as Ve } from "tailwind-merge";
|
|
11
|
+
import { create as F } from "zustand";
|
|
12
|
+
import { TableVirtuoso as Ye, Virtuoso as qe } from "react-virtuoso";
|
|
13
|
+
function S(...n) {
|
|
14
|
+
return Ve(Ge(n));
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
{ id: "settings", label: "Settings", icon:
|
|
18
|
-
],
|
|
19
|
-
items:
|
|
20
|
-
bottomItems: e =
|
|
21
|
-
activeId:
|
|
16
|
+
const Qe = [
|
|
17
|
+
{ id: "settings", label: "Settings", icon: ze }
|
|
18
|
+
], Xe = ({
|
|
19
|
+
items: n = [],
|
|
20
|
+
bottomItems: e = Qe,
|
|
21
|
+
activeId: o = null,
|
|
22
22
|
onSelect: t,
|
|
23
23
|
className: a,
|
|
24
24
|
"aria-label": s = "Activity Bar"
|
|
@@ -30,10 +30,10 @@ const tt = [
|
|
|
30
30
|
onClick: () => t == null ? void 0 : t(u),
|
|
31
31
|
"aria-label": i,
|
|
32
32
|
title: i,
|
|
33
|
-
"aria-pressed":
|
|
33
|
+
"aria-pressed": o === u,
|
|
34
34
|
className: S(
|
|
35
35
|
"p-2 cursor-pointer rounded text-muted-foreground hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
36
|
-
|
|
36
|
+
o === u && "text-foreground border-l-2 border-primary rounded-none"
|
|
37
37
|
),
|
|
38
38
|
children: /* @__PURE__ */ r(d, { size: 20 })
|
|
39
39
|
},
|
|
@@ -49,88 +49,88 @@ const tt = [
|
|
|
49
49
|
a
|
|
50
50
|
),
|
|
51
51
|
children: [
|
|
52
|
-
/* @__PURE__ */ r("div", { className: "flex-1 flex flex-col space-y-4", children:
|
|
52
|
+
/* @__PURE__ */ r("div", { className: "flex-1 flex flex-col space-y-4", children: n.map(l) }),
|
|
53
53
|
e.length > 0 && /* @__PURE__ */ r("div", { className: "flex flex-col space-y-4", children: e.map(l) })
|
|
54
54
|
]
|
|
55
55
|
}
|
|
56
56
|
);
|
|
57
|
-
}, q = "nexus-shell-sidebar",
|
|
57
|
+
}, q = "nexus-shell-sidebar", U = F((n) => {
|
|
58
58
|
const e = localStorage.getItem(q);
|
|
59
59
|
return {
|
|
60
60
|
activeSidebar: e !== null ? e : null,
|
|
61
61
|
panels: [],
|
|
62
62
|
setActiveSidebar: (t) => {
|
|
63
|
-
t === null ? localStorage.removeItem(q) : localStorage.setItem(q, t),
|
|
63
|
+
t === null ? localStorage.removeItem(q) : localStorage.setItem(q, t), n({ activeSidebar: t });
|
|
64
64
|
},
|
|
65
|
-
toggleSidebar: (t) =>
|
|
65
|
+
toggleSidebar: (t) => n((a) => {
|
|
66
66
|
const s = a.activeSidebar === t ? null : t;
|
|
67
67
|
return s === null ? localStorage.removeItem(q) : localStorage.setItem(q, s), { activeSidebar: s };
|
|
68
68
|
}),
|
|
69
|
-
setPanels: (t) =>
|
|
69
|
+
setPanels: (t) => n({ panels: t })
|
|
70
70
|
};
|
|
71
|
-
}),
|
|
72
|
-
const e =
|
|
71
|
+
}), Ze = (n) => {
|
|
72
|
+
const e = U((s) => s.panels), o = U((s) => s.activeSidebar), t = U((s) => s.toggleSidebar), a = j(
|
|
73
73
|
() => e.map(({ id: s, label: l, icon: u }) => ({ id: s, label: l, icon: u })),
|
|
74
74
|
[e]
|
|
75
75
|
);
|
|
76
76
|
return /* @__PURE__ */ r(
|
|
77
|
-
|
|
77
|
+
Xe,
|
|
78
78
|
{
|
|
79
|
-
...
|
|
79
|
+
...n,
|
|
80
80
|
items: a,
|
|
81
|
-
activeId:
|
|
81
|
+
activeId: o,
|
|
82
82
|
onSelect: t
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
|
-
},
|
|
86
|
-
/* @__PURE__ */ r(
|
|
85
|
+
}, et = /* @__PURE__ */ c("div", { className: "h-full flex flex-col items-center justify-center text-center px-6 text-muted-foreground", children: [
|
|
86
|
+
/* @__PURE__ */ r(xe, { size: 28, className: "mb-3 opacity-40" }),
|
|
87
87
|
/* @__PURE__ */ r("p", { className: "text-xs", children: "No messages yet." }),
|
|
88
88
|
/* @__PURE__ */ c("p", { className: "text-[11px] mt-1 opacity-70", children: [
|
|
89
89
|
"Type a message, or ",
|
|
90
90
|
/* @__PURE__ */ r("span", { className: "font-mono", children: "/" }),
|
|
91
91
|
" for commands."
|
|
92
92
|
] })
|
|
93
|
-
] }),
|
|
94
|
-
messages:
|
|
93
|
+
] }), tt = ({
|
|
94
|
+
messages: n = [],
|
|
95
95
|
onSend: e,
|
|
96
|
-
slashCommands:
|
|
96
|
+
slashCommands: o = [],
|
|
97
97
|
onSlashCommand: t,
|
|
98
98
|
onClose: a,
|
|
99
99
|
title: s = "Chat",
|
|
100
100
|
placeholder: l = "Send a message…",
|
|
101
|
-
emptyState: u =
|
|
101
|
+
emptyState: u = et,
|
|
102
102
|
className: i
|
|
103
103
|
}) => {
|
|
104
|
-
const [d,
|
|
105
|
-
(
|
|
106
|
-
) : [], h =
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}, [
|
|
110
|
-
|
|
104
|
+
const [d, m] = A(""), [f, p] = A(0), N = z(null), k = z(null), w = d.startsWith("/") ? o.filter(
|
|
105
|
+
(g) => `/${g.command}`.startsWith(d.toLowerCase().split(" ")[0])
|
|
106
|
+
) : [], h = w.length > 0;
|
|
107
|
+
O(() => {
|
|
108
|
+
k.current && (k.current.scrollTop = k.current.scrollHeight);
|
|
109
|
+
}, [n]), O(() => {
|
|
110
|
+
p(0);
|
|
111
111
|
}, [d]);
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
var
|
|
117
|
-
t == null || t(
|
|
118
|
-
},
|
|
112
|
+
const x = () => {
|
|
113
|
+
const g = d.trim();
|
|
114
|
+
g && (e == null || e(g), m(""));
|
|
115
|
+
}, b = (g) => {
|
|
116
|
+
var C;
|
|
117
|
+
t == null || t(g), m(`/${g.command} `), (C = N.current) == null || C.focus();
|
|
118
|
+
}, y = (g) => {
|
|
119
119
|
if (h) {
|
|
120
|
-
if (
|
|
121
|
-
|
|
120
|
+
if (g.key === "ArrowDown") {
|
|
121
|
+
g.preventDefault(), p((C) => (C + 1) % w.length);
|
|
122
122
|
return;
|
|
123
123
|
}
|
|
124
|
-
if (
|
|
125
|
-
|
|
124
|
+
if (g.key === "ArrowUp") {
|
|
125
|
+
g.preventDefault(), p((C) => (C - 1 + w.length) % w.length);
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
128
|
-
if (
|
|
129
|
-
|
|
128
|
+
if (g.key === "Tab" || g.key === "Enter" && !g.shiftKey) {
|
|
129
|
+
g.preventDefault(), b(w[f]);
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
g.key === "Enter" && !g.shiftKey && (g.preventDefault(), x());
|
|
134
134
|
};
|
|
135
135
|
return /* @__PURE__ */ c(
|
|
136
136
|
"aside",
|
|
@@ -144,7 +144,7 @@ const tt = [
|
|
|
144
144
|
children: [
|
|
145
145
|
/* @__PURE__ */ c("div", { className: "h-10 flex items-center justify-between px-4 shrink-0", children: [
|
|
146
146
|
/* @__PURE__ */ c("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
|
|
147
|
-
/* @__PURE__ */ r(
|
|
147
|
+
/* @__PURE__ */ r(xe, { size: 13 }),
|
|
148
148
|
/* @__PURE__ */ r("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
|
|
149
149
|
] }),
|
|
150
150
|
a && /* @__PURE__ */ r(
|
|
@@ -154,41 +154,41 @@ const tt = [
|
|
|
154
154
|
onClick: a,
|
|
155
155
|
"aria-label": "Close Chat",
|
|
156
156
|
className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
157
|
-
children: /* @__PURE__ */ r(
|
|
157
|
+
children: /* @__PURE__ */ r(B, { size: 14 })
|
|
158
158
|
}
|
|
159
159
|
)
|
|
160
160
|
] }),
|
|
161
161
|
/* @__PURE__ */ r(
|
|
162
162
|
"div",
|
|
163
163
|
{
|
|
164
|
-
ref:
|
|
164
|
+
ref: k,
|
|
165
165
|
role: "log",
|
|
166
166
|
"aria-label": `${s} transcript`,
|
|
167
167
|
className: "flex-1 overflow-y-auto border-t border-border/50 bg-background/50 px-3 py-3 space-y-3",
|
|
168
|
-
children:
|
|
169
|
-
const
|
|
168
|
+
children: n.length === 0 ? u : n.map((g) => {
|
|
169
|
+
const C = g.role === "user";
|
|
170
170
|
return /* @__PURE__ */ c(
|
|
171
171
|
"div",
|
|
172
172
|
{
|
|
173
|
-
className: S("flex flex-col",
|
|
173
|
+
className: S("flex flex-col", C ? "items-end" : "items-start"),
|
|
174
174
|
children: [
|
|
175
175
|
/* @__PURE__ */ c("div", { className: "flex items-center space-x-1 mb-1 text-[10px] uppercase tracking-wider text-muted-foreground font-bold", children: [
|
|
176
|
-
|
|
177
|
-
/* @__PURE__ */ r("span", { children:
|
|
176
|
+
C ? /* @__PURE__ */ r(ve, { size: 10 }) : /* @__PURE__ */ r(ye, { size: 10 }),
|
|
177
|
+
/* @__PURE__ */ r("span", { children: g.author ?? (C ? "You" : "Assistant") })
|
|
178
178
|
] }),
|
|
179
179
|
/* @__PURE__ */ r(
|
|
180
180
|
"div",
|
|
181
181
|
{
|
|
182
182
|
className: S(
|
|
183
183
|
"max-w-[85%] rounded-lg px-3 py-2 text-xs whitespace-pre-wrap break-words",
|
|
184
|
-
|
|
184
|
+
C ? "bg-primary text-primary-foreground" : "bg-card border border-border text-foreground"
|
|
185
185
|
),
|
|
186
|
-
children:
|
|
186
|
+
children: g.text
|
|
187
187
|
}
|
|
188
188
|
)
|
|
189
189
|
]
|
|
190
190
|
},
|
|
191
|
-
|
|
191
|
+
g.id
|
|
192
192
|
);
|
|
193
193
|
})
|
|
194
194
|
}
|
|
@@ -200,26 +200,26 @@ const tt = [
|
|
|
200
200
|
role: "listbox",
|
|
201
201
|
"aria-label": "Slash commands",
|
|
202
202
|
className: "absolute bottom-full left-2 right-2 mb-1 bg-popover border border-border rounded-md shadow-lg overflow-hidden z-20",
|
|
203
|
-
children:
|
|
203
|
+
children: w.map((g, C) => /* @__PURE__ */ c(
|
|
204
204
|
"div",
|
|
205
205
|
{
|
|
206
206
|
role: "option",
|
|
207
|
-
"aria-selected":
|
|
208
|
-
onMouseEnter: () =>
|
|
209
|
-
onClick: () =>
|
|
207
|
+
"aria-selected": C === f,
|
|
208
|
+
onMouseEnter: () => p(C),
|
|
209
|
+
onClick: () => b(g),
|
|
210
210
|
className: S(
|
|
211
211
|
"px-3 py-1.5 text-xs cursor-pointer flex items-baseline justify-between gap-3",
|
|
212
|
-
|
|
212
|
+
C === f ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
|
|
213
213
|
),
|
|
214
214
|
children: [
|
|
215
215
|
/* @__PURE__ */ c("span", { className: "font-mono", children: [
|
|
216
216
|
"/",
|
|
217
|
-
|
|
217
|
+
g.command
|
|
218
218
|
] }),
|
|
219
|
-
/* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground truncate", children:
|
|
219
|
+
/* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground truncate", children: g.description })
|
|
220
220
|
]
|
|
221
221
|
},
|
|
222
|
-
|
|
222
|
+
g.command
|
|
223
223
|
))
|
|
224
224
|
}
|
|
225
225
|
),
|
|
@@ -227,13 +227,13 @@ const tt = [
|
|
|
227
227
|
/* @__PURE__ */ r(
|
|
228
228
|
"textarea",
|
|
229
229
|
{
|
|
230
|
-
ref:
|
|
230
|
+
ref: N,
|
|
231
231
|
rows: 1,
|
|
232
232
|
value: d,
|
|
233
233
|
"aria-label": `${s} message`,
|
|
234
234
|
placeholder: l,
|
|
235
|
-
onChange: (
|
|
236
|
-
onKeyDown:
|
|
235
|
+
onChange: (g) => m(g.target.value),
|
|
236
|
+
onKeyDown: y,
|
|
237
237
|
className: "flex-1 resize-none bg-background border border-border rounded-md px-3 py-2 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/50 max-h-32"
|
|
238
238
|
}
|
|
239
239
|
),
|
|
@@ -241,11 +241,11 @@ const tt = [
|
|
|
241
241
|
"button",
|
|
242
242
|
{
|
|
243
243
|
type: "button",
|
|
244
|
-
onClick:
|
|
244
|
+
onClick: x,
|
|
245
245
|
disabled: !d.trim(),
|
|
246
246
|
"aria-label": "Send message",
|
|
247
247
|
className: "p-2 rounded-md bg-primary text-primary-foreground disabled:opacity-40 disabled:cursor-not-allowed hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
248
|
-
children: /* @__PURE__ */ r(
|
|
248
|
+
children: /* @__PURE__ */ r(Pe, { size: 14 })
|
|
249
249
|
}
|
|
250
250
|
)
|
|
251
251
|
] })
|
|
@@ -254,53 +254,53 @@ const tt = [
|
|
|
254
254
|
}
|
|
255
255
|
);
|
|
256
256
|
};
|
|
257
|
-
let
|
|
258
|
-
const
|
|
257
|
+
let rt = 0;
|
|
258
|
+
const nt = () => `msg-${Date.now()}-${rt += 1}`, Q = F((n) => ({
|
|
259
259
|
messages: [],
|
|
260
260
|
slashCommands: [],
|
|
261
|
-
setMessages: (e) =>
|
|
262
|
-
addMessage: (e) =>
|
|
263
|
-
messages: [...
|
|
261
|
+
setMessages: (e) => n({ messages: e }),
|
|
262
|
+
addMessage: (e) => n((o) => ({
|
|
263
|
+
messages: [...o.messages, { ...e, id: e.id ?? nt() }]
|
|
264
264
|
})),
|
|
265
|
-
clearMessages: () =>
|
|
266
|
-
setSlashCommands: (e) =>
|
|
267
|
-
registerSlashCommand: (e) =>
|
|
268
|
-
})),
|
|
269
|
-
isChatOpen: localStorage.getItem(
|
|
265
|
+
clearMessages: () => n({ messages: [] }),
|
|
266
|
+
setSlashCommands: (e) => n({ slashCommands: e }),
|
|
267
|
+
registerSlashCommand: (e) => n((o) => ({ slashCommands: [...o.slashCommands, e] }))
|
|
268
|
+
})), re = "nexus-shell-right-sidebar", ae = F((n) => ({
|
|
269
|
+
isChatOpen: localStorage.getItem(re) === "true",
|
|
270
270
|
setChatOpen: (t) => {
|
|
271
|
-
localStorage.setItem(
|
|
271
|
+
localStorage.setItem(re, String(t)), n({ isChatOpen: t });
|
|
272
272
|
},
|
|
273
|
-
toggleChat: () =>
|
|
273
|
+
toggleChat: () => n((t) => {
|
|
274
274
|
const a = !t.isChatOpen;
|
|
275
|
-
return localStorage.setItem(
|
|
275
|
+
return localStorage.setItem(re, String(a)), { isChatOpen: a };
|
|
276
276
|
})
|
|
277
|
-
})),
|
|
278
|
-
const
|
|
279
|
-
return
|
|
280
|
-
|
|
277
|
+
})), ot = ({ onSend: n, ...e }) => {
|
|
278
|
+
const o = ae((i) => i.isChatOpen), t = ae((i) => i.setChatOpen), a = Q((i) => i.messages), s = Q((i) => i.slashCommands), l = Q((i) => i.addMessage);
|
|
279
|
+
return o ? /* @__PURE__ */ r(
|
|
280
|
+
tt,
|
|
281
281
|
{
|
|
282
282
|
...e,
|
|
283
283
|
messages: a,
|
|
284
284
|
slashCommands: s,
|
|
285
285
|
onSend: (i) => {
|
|
286
286
|
if (l({ role: "user", text: i }), i.startsWith("/")) {
|
|
287
|
-
const [d, ...
|
|
288
|
-
if (
|
|
289
|
-
|
|
287
|
+
const [d, ...m] = i.slice(1).split(/\s+/), f = s.find((p) => p.command === d);
|
|
288
|
+
if (f) {
|
|
289
|
+
f.execute(m);
|
|
290
290
|
return;
|
|
291
291
|
}
|
|
292
292
|
l({ role: "assistant", text: `Unknown command: /${d}` });
|
|
293
293
|
return;
|
|
294
294
|
}
|
|
295
|
-
|
|
295
|
+
n == null || n(i);
|
|
296
296
|
},
|
|
297
297
|
onClose: () => t(!1)
|
|
298
298
|
}
|
|
299
299
|
) : null;
|
|
300
|
-
},
|
|
301
|
-
menus:
|
|
300
|
+
}, st = ({
|
|
301
|
+
menus: n = {},
|
|
302
302
|
onSelect: e,
|
|
303
|
-
title:
|
|
303
|
+
title: o,
|
|
304
304
|
center: t,
|
|
305
305
|
right: a,
|
|
306
306
|
className: s
|
|
@@ -317,15 +317,15 @@ const lt = () => `msg-${Date.now()}-${at += 1}`, Q = U((o) => ({
|
|
|
317
317
|
role: "menuitem",
|
|
318
318
|
tabIndex: 0,
|
|
319
319
|
onClick: () => !d.submenu && (e == null ? void 0 : e(d)),
|
|
320
|
-
onKeyDown: (
|
|
321
|
-
!d.submenu && (
|
|
320
|
+
onKeyDown: (m) => {
|
|
321
|
+
!d.submenu && (m.key === "Enter" || m.key === " ") && (m.preventDefault(), e == null || e(d));
|
|
322
322
|
},
|
|
323
323
|
className: "px-3 py-1.5 hover:bg-accent hover:text-accent-foreground cursor-pointer text-xs flex justify-between items-center focus:outline-none focus:bg-accent",
|
|
324
324
|
children: [
|
|
325
325
|
/* @__PURE__ */ r("span", { children: d.label }),
|
|
326
326
|
/* @__PURE__ */ c("div", { className: "flex items-center space-x-2", children: [
|
|
327
327
|
l(d),
|
|
328
|
-
d.submenu && /* @__PURE__ */ r(
|
|
328
|
+
d.submenu && /* @__PURE__ */ r(we, { size: 10 })
|
|
329
329
|
] })
|
|
330
330
|
]
|
|
331
331
|
}
|
|
@@ -335,22 +335,22 @@ const lt = () => `msg-${Date.now()}-${at += 1}`, Q = U((o) => ({
|
|
|
335
335
|
{
|
|
336
336
|
role: "menu",
|
|
337
337
|
className: "absolute left-full top-0 hidden group-hover/sub:block z-[60] min-w-[180px] bg-popover text-popover-foreground border shadow-md rounded-md py-1 ml-[-2px]",
|
|
338
|
-
children: d.submenu.map((
|
|
338
|
+
children: d.submenu.map((m) => /* @__PURE__ */ c(
|
|
339
339
|
"div",
|
|
340
340
|
{
|
|
341
341
|
role: "menuitem",
|
|
342
342
|
tabIndex: 0,
|
|
343
|
-
onClick: () => e == null ? void 0 : e(
|
|
344
|
-
onKeyDown: (
|
|
345
|
-
(
|
|
343
|
+
onClick: () => e == null ? void 0 : e(m),
|
|
344
|
+
onKeyDown: (f) => {
|
|
345
|
+
(f.key === "Enter" || f.key === " ") && (f.preventDefault(), e == null || e(m));
|
|
346
346
|
},
|
|
347
347
|
className: "px-3 py-1.5 hover:bg-accent hover:text-accent-foreground cursor-pointer text-xs flex justify-between items-center focus:outline-none focus:bg-accent",
|
|
348
348
|
children: [
|
|
349
|
-
/* @__PURE__ */ r("span", { children:
|
|
350
|
-
l(
|
|
349
|
+
/* @__PURE__ */ r("span", { children: m.label }),
|
|
350
|
+
l(m)
|
|
351
351
|
]
|
|
352
352
|
},
|
|
353
|
-
|
|
353
|
+
m.id
|
|
354
354
|
))
|
|
355
355
|
}
|
|
356
356
|
)
|
|
@@ -364,19 +364,19 @@ const lt = () => `msg-${Date.now()}-${at += 1}`, Q = U((o) => ({
|
|
|
364
364
|
"aria-label": "Application Header",
|
|
365
365
|
className: S(
|
|
366
366
|
"bg-muted border-b flex items-center justify-between px-4 select-none shrink-0 transition-all z-50 relative",
|
|
367
|
-
|
|
367
|
+
o !== void 0 ? "h-12 bg-card/65 backdrop-blur-sm" : "h-8",
|
|
368
368
|
s
|
|
369
369
|
),
|
|
370
370
|
children: [
|
|
371
371
|
/* @__PURE__ */ c("div", { className: "flex items-center flex-1 min-w-0", children: [
|
|
372
|
-
|
|
372
|
+
o !== void 0 ? /* @__PURE__ */ r("div", { className: "mr-12 flex items-center shrink-0", children: o }) : /* @__PURE__ */ r("div", { className: "font-semibold mr-6 text-sm shrink-0", children: "Nexus Shell" }),
|
|
373
373
|
/* @__PURE__ */ r(
|
|
374
374
|
"nav",
|
|
375
375
|
{
|
|
376
376
|
role: "navigation",
|
|
377
377
|
"aria-label": "Main Menu",
|
|
378
378
|
className: "flex space-x-1 text-sm shrink-0",
|
|
379
|
-
children: Object.entries(
|
|
379
|
+
children: Object.entries(n).map(([i, d]) => /* @__PURE__ */ c("div", { className: "relative group", children: [
|
|
380
380
|
/* @__PURE__ */ r(
|
|
381
381
|
"div",
|
|
382
382
|
{
|
|
@@ -398,13 +398,13 @@ const lt = () => `msg-${Date.now()}-${at += 1}`, Q = U((o) => ({
|
|
|
398
398
|
}
|
|
399
399
|
);
|
|
400
400
|
};
|
|
401
|
-
class
|
|
401
|
+
class at {
|
|
402
402
|
constructor() {
|
|
403
403
|
H(this, "menus", /* @__PURE__ */ new Map());
|
|
404
404
|
}
|
|
405
|
-
registerMenu(e,
|
|
405
|
+
registerMenu(e, o) {
|
|
406
406
|
var t;
|
|
407
|
-
this.menus.has(e) || this.menus.set(e, []), (t = this.menus.get(e)) == null || t.push(
|
|
407
|
+
this.menus.has(e) || this.menus.set(e, []), (t = this.menus.get(e)) == null || t.push(o);
|
|
408
408
|
}
|
|
409
409
|
setMenus(e) {
|
|
410
410
|
this.menus = new Map(Object.entries(e));
|
|
@@ -414,13 +414,13 @@ class ct {
|
|
|
414
414
|
}
|
|
415
415
|
getAllMenus() {
|
|
416
416
|
const e = {};
|
|
417
|
-
return this.menus.forEach((
|
|
418
|
-
e[t] =
|
|
417
|
+
return this.menus.forEach((o, t) => {
|
|
418
|
+
e[t] = o;
|
|
419
419
|
}), e;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
422
|
-
const le = new
|
|
423
|
-
class
|
|
422
|
+
const le = new at();
|
|
423
|
+
class lt {
|
|
424
424
|
constructor() {
|
|
425
425
|
H(this, "commands", /* @__PURE__ */ new Map());
|
|
426
426
|
}
|
|
@@ -431,9 +431,9 @@ class ut {
|
|
|
431
431
|
}
|
|
432
432
|
this.commands.set(e.id, e);
|
|
433
433
|
}
|
|
434
|
-
executeCommand(e, ...
|
|
434
|
+
executeCommand(e, ...o) {
|
|
435
435
|
const t = this.commands.get(e);
|
|
436
|
-
t ? t.execute(...
|
|
436
|
+
t ? t.execute(...o) : console.warn(`Command ${e} not found.`);
|
|
437
437
|
}
|
|
438
438
|
getCommand(e) {
|
|
439
439
|
return this.commands.get(e);
|
|
@@ -442,43 +442,43 @@ class ut {
|
|
|
442
442
|
return Array.from(this.commands.values());
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
const
|
|
446
|
-
var
|
|
445
|
+
const J = new lt(), Se = (n) => n.map((e) => {
|
|
446
|
+
var o;
|
|
447
447
|
return {
|
|
448
448
|
...e,
|
|
449
|
-
keybinding: e.keybinding ?? (e.commandId ? (
|
|
450
|
-
submenu: e.submenu ?
|
|
449
|
+
keybinding: e.keybinding ?? (e.commandId ? (o = J.getCommand(e.commandId)) == null ? void 0 : o.keybinding : void 0),
|
|
450
|
+
submenu: e.submenu ? Se(e.submenu) : void 0
|
|
451
451
|
};
|
|
452
|
-
}),
|
|
453
|
-
for (const
|
|
454
|
-
if (
|
|
455
|
-
const t =
|
|
452
|
+
}), Te = (n, e) => {
|
|
453
|
+
for (const o of n) {
|
|
454
|
+
if (o.id === e) return o;
|
|
455
|
+
const t = o.submenu && Te(o.submenu, e);
|
|
456
456
|
if (t) return t;
|
|
457
457
|
}
|
|
458
|
-
},
|
|
459
|
-
const e = le.getAllMenus(),
|
|
460
|
-
Object.entries(e).map(([a, s]) => [a,
|
|
458
|
+
}, it = (n) => {
|
|
459
|
+
const e = le.getAllMenus(), o = Object.fromEntries(
|
|
460
|
+
Object.entries(e).map(([a, s]) => [a, Se(s)])
|
|
461
461
|
);
|
|
462
|
-
return /* @__PURE__ */ r(
|
|
462
|
+
return /* @__PURE__ */ r(st, { ...n, menus: o, onSelect: (a) => {
|
|
463
463
|
for (const s of Object.values(e)) {
|
|
464
|
-
const l =
|
|
464
|
+
const l = Te(s, a.id);
|
|
465
465
|
if (l != null && l.commandId) {
|
|
466
|
-
|
|
466
|
+
J.executeCommand(l.commandId);
|
|
467
467
|
return;
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
} });
|
|
471
|
-
},
|
|
472
|
-
title:
|
|
471
|
+
}, ne = ({
|
|
472
|
+
title: n,
|
|
473
473
|
children: e,
|
|
474
|
-
onClose:
|
|
474
|
+
onClose: o,
|
|
475
475
|
width: t = "300px",
|
|
476
476
|
className: a
|
|
477
477
|
}) => /* @__PURE__ */ c(
|
|
478
478
|
"aside",
|
|
479
479
|
{
|
|
480
480
|
role: "tabpanel",
|
|
481
|
-
"aria-label": `${
|
|
481
|
+
"aria-label": `${n} Panel`,
|
|
482
482
|
style: { width: t },
|
|
483
483
|
className: S(
|
|
484
484
|
"h-full bg-muted border-r flex flex-col select-none shrink-0",
|
|
@@ -486,29 +486,59 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
486
486
|
),
|
|
487
487
|
children: [
|
|
488
488
|
/* @__PURE__ */ c("div", { className: "h-10 flex items-center justify-between px-4 text-[11px] font-bold text-muted-foreground uppercase tracking-widest", children: [
|
|
489
|
-
/* @__PURE__ */ r("span", { className: "truncate", children:
|
|
490
|
-
|
|
489
|
+
/* @__PURE__ */ r("span", { className: "truncate", children: n }),
|
|
490
|
+
o && /* @__PURE__ */ r(
|
|
491
491
|
"button",
|
|
492
492
|
{
|
|
493
493
|
type: "button",
|
|
494
|
-
onClick:
|
|
494
|
+
onClick: o,
|
|
495
495
|
"aria-label": "Close Panel",
|
|
496
496
|
className: "p-1 hover:bg-accent hover:text-foreground rounded transition-colors focus:outline-none focus:ring-2 focus:ring-ring shrink-0",
|
|
497
|
-
children: /* @__PURE__ */ r(
|
|
497
|
+
children: /* @__PURE__ */ r(B, { size: 14 })
|
|
498
498
|
}
|
|
499
499
|
)
|
|
500
500
|
] }),
|
|
501
501
|
/* @__PURE__ */ r("div", { className: "flex-1 overflow-auto border-t border-border/50 bg-background/50", children: e })
|
|
502
502
|
]
|
|
503
503
|
}
|
|
504
|
-
),
|
|
505
|
-
{
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
504
|
+
), X = [
|
|
505
|
+
{
|
|
506
|
+
id: "light",
|
|
507
|
+
label: "Light",
|
|
508
|
+
shortLabel: "Light",
|
|
509
|
+
description: "Neutral light theme. The default."
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
id: "dark",
|
|
513
|
+
label: "Dark",
|
|
514
|
+
shortLabel: "Dark",
|
|
515
|
+
description: "Low-glare dark theme on a soft grey base."
|
|
516
|
+
},
|
|
517
|
+
{
|
|
518
|
+
id: "gt",
|
|
519
|
+
label: "Georgia Tech",
|
|
520
|
+
shortLabel: "GT",
|
|
521
|
+
description: "Buzz Gold (#EAAA00) on Tech Tower White."
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
id: "tamu",
|
|
525
|
+
label: "Texas A&M",
|
|
526
|
+
shortLabel: "TAMU",
|
|
527
|
+
description: "Aggie Maroon (#500000) on white."
|
|
528
|
+
}
|
|
529
|
+
], dt = X.map((n) => `theme-${n.id}`), ct = (n) => `theme-${n}`, ut = {
|
|
530
|
+
light: Re,
|
|
531
|
+
dark: $e,
|
|
532
|
+
gt: ue,
|
|
533
|
+
tamu: ue
|
|
534
|
+
}, mt = X.map((n) => ({
|
|
535
|
+
id: n.id,
|
|
536
|
+
label: n.label,
|
|
537
|
+
icon: ut[n.id] ?? Ke
|
|
538
|
+
})), ft = ({
|
|
539
|
+
theme: n,
|
|
510
540
|
onThemeChange: e,
|
|
511
|
-
themes:
|
|
541
|
+
themes: o = mt,
|
|
512
542
|
className: t
|
|
513
543
|
}) => /* @__PURE__ */ r("div", { className: S("p-4 space-y-6", t), children: /* @__PURE__ */ c("section", { children: [
|
|
514
544
|
/* @__PURE__ */ r("h3", { className: "text-[11px] font-bold text-muted-foreground uppercase mb-3", children: "Theme" }),
|
|
@@ -518,16 +548,16 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
518
548
|
role: "radiogroup",
|
|
519
549
|
"aria-label": "Theme",
|
|
520
550
|
className: "grid grid-cols-1 gap-2",
|
|
521
|
-
children:
|
|
551
|
+
children: o.map(({ id: a, label: s, icon: l }) => /* @__PURE__ */ c(
|
|
522
552
|
"button",
|
|
523
553
|
{
|
|
524
554
|
type: "button",
|
|
525
555
|
role: "radio",
|
|
526
|
-
"aria-checked":
|
|
556
|
+
"aria-checked": n === a,
|
|
527
557
|
onClick: () => e(a),
|
|
528
558
|
className: S(
|
|
529
559
|
"flex items-center space-x-3 px-3 py-2 rounded-md border text-sm transition-all focus:outline-none focus:ring-2 focus:ring-ring",
|
|
530
|
-
|
|
560
|
+
n === a ? "bg-primary text-primary-foreground border-primary" : "bg-background hover:bg-accent border-border"
|
|
531
561
|
),
|
|
532
562
|
children: [
|
|
533
563
|
/* @__PURE__ */ r(l, { size: 16 }),
|
|
@@ -538,43 +568,46 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
538
568
|
))
|
|
539
569
|
}
|
|
540
570
|
)
|
|
541
|
-
] }) }),
|
|
542
|
-
const e = window.document.documentElement
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
571
|
+
] }) }), me = "nexus-shell-theme", fe = (n) => {
|
|
572
|
+
const e = window.document.documentElement, o = [
|
|
573
|
+
...dt,
|
|
574
|
+
...Array.from(e.classList).filter((t) => t.startsWith("theme-"))
|
|
575
|
+
];
|
|
576
|
+
e.classList.remove(...o), e.classList.add(ct(n));
|
|
577
|
+
}, Y = F((n) => {
|
|
578
|
+
const o = localStorage.getItem(me) || "light";
|
|
579
|
+
return fe(o), {
|
|
580
|
+
theme: o,
|
|
548
581
|
setTheme: (t) => {
|
|
549
|
-
localStorage.setItem(
|
|
582
|
+
localStorage.setItem(me, t), fe(t), n({ theme: t });
|
|
550
583
|
}
|
|
551
584
|
};
|
|
552
|
-
}),
|
|
553
|
-
const e =
|
|
585
|
+
}), pt = (n) => {
|
|
586
|
+
const e = U((d) => d.activeSidebar), o = U((d) => d.panels), t = U((d) => d.setActiveSidebar), a = Y((d) => d.theme), s = Y((d) => d.setTheme);
|
|
554
587
|
if (!e) return null;
|
|
555
588
|
const l = () => t(null);
|
|
556
589
|
if (e === "settings")
|
|
557
|
-
return /* @__PURE__ */ r(
|
|
558
|
-
|
|
590
|
+
return /* @__PURE__ */ r(ne, { ...n, title: "Settings", onClose: l, children: /* @__PURE__ */ r(
|
|
591
|
+
ft,
|
|
559
592
|
{
|
|
560
593
|
theme: a,
|
|
561
594
|
onThemeChange: (d) => s(d)
|
|
562
595
|
}
|
|
563
596
|
) });
|
|
564
|
-
const u =
|
|
597
|
+
const u = o.find((d) => d.id === e);
|
|
565
598
|
if (!u)
|
|
566
|
-
return /* @__PURE__ */ r(
|
|
599
|
+
return /* @__PURE__ */ r(ne, { ...n, title: e, onClose: l, children: /* @__PURE__ */ r("div", { className: "p-4 text-sm italic text-muted-foreground", children: "Panel content not found." }) });
|
|
567
600
|
const i = typeof u.component == "function" ? u.component : null;
|
|
568
|
-
return /* @__PURE__ */ r(
|
|
569
|
-
},
|
|
570
|
-
widgets:
|
|
601
|
+
return /* @__PURE__ */ r(ne, { ...n, title: u.label, onClose: l, children: i ? /* @__PURE__ */ r(i, {}) : u.component });
|
|
602
|
+
}, oe = (n, e) => (e.priority ?? 0) - (n.priority ?? 0), gt = ({
|
|
603
|
+
widgets: n = [],
|
|
571
604
|
className: e,
|
|
572
|
-
"aria-label":
|
|
605
|
+
"aria-label": o = "Status Bar"
|
|
573
606
|
}) => {
|
|
574
607
|
const t = {
|
|
575
|
-
left:
|
|
576
|
-
center:
|
|
577
|
-
right:
|
|
608
|
+
left: n.filter((s) => s.alignment === "left").sort(oe),
|
|
609
|
+
center: n.filter((s) => s.alignment === "center").sort(oe),
|
|
610
|
+
right: n.filter((s) => s.alignment === "right").sort(oe)
|
|
578
611
|
}, a = (s) => {
|
|
579
612
|
const l = s.icon, u = !!s.onClick;
|
|
580
613
|
return /* @__PURE__ */ c(
|
|
@@ -604,7 +637,7 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
604
637
|
"footer",
|
|
605
638
|
{
|
|
606
639
|
role: "status",
|
|
607
|
-
"aria-label":
|
|
640
|
+
"aria-label": o,
|
|
608
641
|
className: S(
|
|
609
642
|
"h-6 bg-primary text-primary-foreground text-[11px] flex items-center justify-between px-1 select-none shrink-0 border-t border-white/5",
|
|
610
643
|
e
|
|
@@ -616,46 +649,46 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
616
649
|
]
|
|
617
650
|
}
|
|
618
651
|
);
|
|
619
|
-
}, ie =
|
|
652
|
+
}, ie = F((n) => ({
|
|
620
653
|
widgets: [],
|
|
621
|
-
setWidgets: (e) =>
|
|
622
|
-
addWidget: (e) =>
|
|
623
|
-
widgets: [...
|
|
654
|
+
setWidgets: (e) => n({ widgets: e }),
|
|
655
|
+
addWidget: (e) => n((o) => ({
|
|
656
|
+
widgets: [...o.widgets, e].sort(
|
|
624
657
|
(t, a) => (a.priority || 0) - (t.priority || 0)
|
|
625
658
|
)
|
|
626
659
|
})),
|
|
627
|
-
removeWidget: (e) =>
|
|
628
|
-
widgets:
|
|
660
|
+
removeWidget: (e) => n((o) => ({
|
|
661
|
+
widgets: o.widgets.filter((t) => t.id !== e)
|
|
629
662
|
})),
|
|
630
|
-
updateWidget: (e,
|
|
631
|
-
widgets: t.widgets.map((a) => a.id === e ? { ...a, ...
|
|
663
|
+
updateWidget: (e, o) => n((t) => ({
|
|
664
|
+
widgets: t.widgets.map((a) => a.id === e ? { ...a, ...o } : a)
|
|
632
665
|
}))
|
|
633
|
-
})),
|
|
634
|
-
const e = ie((t) => t.widgets),
|
|
666
|
+
})), ht = (n) => {
|
|
667
|
+
const e = ie((t) => t.widgets), o = j(
|
|
635
668
|
() => e.map(({ commandId: t, ...a }) => ({
|
|
636
669
|
...a,
|
|
637
|
-
onClick: a.onClick ?? (t ? () =>
|
|
670
|
+
onClick: a.onClick ?? (t ? () => J.executeCommand(t) : void 0)
|
|
638
671
|
})),
|
|
639
672
|
[e]
|
|
640
673
|
);
|
|
641
|
-
return /* @__PURE__ */ r(
|
|
642
|
-
},
|
|
643
|
-
history:
|
|
674
|
+
return /* @__PURE__ */ r(gt, { ...n, widgets: o });
|
|
675
|
+
}, bt = ({
|
|
676
|
+
history: n = [],
|
|
644
677
|
onCommand: e,
|
|
645
|
-
onClose:
|
|
678
|
+
onClose: o,
|
|
646
679
|
height: t = "250px",
|
|
647
680
|
prompt: a = "$",
|
|
648
681
|
title: s = "Terminal",
|
|
649
682
|
className: l
|
|
650
683
|
}) => {
|
|
651
|
-
const [u, i] = A(""), d =
|
|
652
|
-
|
|
684
|
+
const [u, i] = A(""), d = z(null), m = z(null);
|
|
685
|
+
O(() => {
|
|
653
686
|
d.current && (d.current.scrollTop = d.current.scrollHeight);
|
|
654
|
-
}, [
|
|
655
|
-
const
|
|
656
|
-
if (
|
|
657
|
-
const
|
|
658
|
-
|
|
687
|
+
}, [n]);
|
|
688
|
+
const f = (p) => {
|
|
689
|
+
if (p.key !== "Enter") return;
|
|
690
|
+
const N = u.trim();
|
|
691
|
+
N && (e == null || e(N), i(""));
|
|
659
692
|
};
|
|
660
693
|
return /* @__PURE__ */ c(
|
|
661
694
|
"div",
|
|
@@ -668,28 +701,28 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
668
701
|
children: [
|
|
669
702
|
/* @__PURE__ */ c("div", { className: "h-8 flex items-center justify-between px-3 border-b border-border/50 shrink-0", children: [
|
|
670
703
|
/* @__PURE__ */ c("div", { className: "flex items-center space-x-2 text-muted-foreground", children: [
|
|
671
|
-
/* @__PURE__ */ r(
|
|
704
|
+
/* @__PURE__ */ r(ye, { size: 13 }),
|
|
672
705
|
/* @__PURE__ */ r("span", { className: "text-[11px] font-bold uppercase tracking-widest", children: s })
|
|
673
706
|
] }),
|
|
674
|
-
|
|
707
|
+
o && /* @__PURE__ */ c("div", { className: "flex items-center space-x-1", children: [
|
|
675
708
|
/* @__PURE__ */ r(
|
|
676
709
|
"button",
|
|
677
710
|
{
|
|
678
711
|
type: "button",
|
|
679
|
-
onClick:
|
|
712
|
+
onClick: o,
|
|
680
713
|
"aria-label": "Collapse Terminal",
|
|
681
714
|
className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
682
|
-
children: /* @__PURE__ */ r(
|
|
715
|
+
children: /* @__PURE__ */ r(Ne, { size: 14 })
|
|
683
716
|
}
|
|
684
717
|
),
|
|
685
718
|
/* @__PURE__ */ r(
|
|
686
719
|
"button",
|
|
687
720
|
{
|
|
688
721
|
type: "button",
|
|
689
|
-
onClick:
|
|
722
|
+
onClick: o,
|
|
690
723
|
"aria-label": "Close Terminal",
|
|
691
724
|
className: "p-1 rounded hover:bg-accent hover:text-foreground text-muted-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
692
|
-
children: /* @__PURE__ */ r(
|
|
725
|
+
children: /* @__PURE__ */ r(B, { size: 14 })
|
|
693
726
|
}
|
|
694
727
|
)
|
|
695
728
|
] })
|
|
@@ -702,10 +735,10 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
702
735
|
"aria-label": `${s} output`,
|
|
703
736
|
className: "flex-1 overflow-y-auto px-3 py-2 space-y-0.5",
|
|
704
737
|
onClick: () => {
|
|
705
|
-
var
|
|
706
|
-
return (
|
|
738
|
+
var p;
|
|
739
|
+
return (p = m.current) == null ? void 0 : p.focus();
|
|
707
740
|
},
|
|
708
|
-
children:
|
|
741
|
+
children: n.map((p, N) => /* @__PURE__ */ r("div", { className: "whitespace-pre-wrap break-all text-foreground/90", children: p }, N))
|
|
709
742
|
}
|
|
710
743
|
),
|
|
711
744
|
/* @__PURE__ */ c("div", { className: "flex items-center px-3 py-2 border-t border-border/50 shrink-0", children: [
|
|
@@ -713,12 +746,12 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
713
746
|
/* @__PURE__ */ r(
|
|
714
747
|
"input",
|
|
715
748
|
{
|
|
716
|
-
ref:
|
|
749
|
+
ref: m,
|
|
717
750
|
type: "text",
|
|
718
751
|
"aria-label": `${s} input`,
|
|
719
752
|
value: u,
|
|
720
|
-
onChange: (
|
|
721
|
-
onKeyDown:
|
|
753
|
+
onChange: (p) => i(p.target.value),
|
|
754
|
+
onKeyDown: f,
|
|
722
755
|
spellCheck: !1,
|
|
723
756
|
autoComplete: "off",
|
|
724
757
|
className: "flex-1 bg-transparent outline-none text-foreground placeholder:text-muted-foreground"
|
|
@@ -728,24 +761,24 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
728
761
|
]
|
|
729
762
|
}
|
|
730
763
|
);
|
|
731
|
-
}, V =
|
|
764
|
+
}, V = F((n) => ({
|
|
732
765
|
isOpen: !1,
|
|
733
766
|
history: ["Welcome to Nexus Shell Terminal v0.1.0", 'Type "help" for a list of commands.'],
|
|
734
|
-
setOpen: (e) =>
|
|
735
|
-
toggle: () =>
|
|
736
|
-
addHistory: (e) =>
|
|
737
|
-
clearHistory: () =>
|
|
738
|
-
})),
|
|
767
|
+
setOpen: (e) => n({ isOpen: e }),
|
|
768
|
+
toggle: () => n((e) => ({ isOpen: !e.isOpen })),
|
|
769
|
+
addHistory: (e) => n((o) => ({ history: [...o.history, e] })),
|
|
770
|
+
clearHistory: () => n({ history: [] })
|
|
771
|
+
})), xt = [
|
|
739
772
|
"Available commands:",
|
|
740
773
|
" help — show this message",
|
|
741
774
|
" clear — clear the terminal"
|
|
742
|
-
],
|
|
743
|
-
onCommand:
|
|
775
|
+
], vt = ({
|
|
776
|
+
onCommand: n,
|
|
744
777
|
...e
|
|
745
778
|
}) => {
|
|
746
|
-
const
|
|
747
|
-
return
|
|
748
|
-
|
|
779
|
+
const o = V((i) => i.isOpen), t = V((i) => i.history), a = V((i) => i.setOpen), s = V((i) => i.addHistory), l = V((i) => i.clearHistory);
|
|
780
|
+
return o ? /* @__PURE__ */ r(
|
|
781
|
+
bt,
|
|
749
782
|
{
|
|
750
783
|
...e,
|
|
751
784
|
history: t,
|
|
@@ -757,16 +790,16 @@ const B = new ut(), Ce = (o) => o.map((e) => {
|
|
|
757
790
|
return;
|
|
758
791
|
}
|
|
759
792
|
if (d === "help") {
|
|
760
|
-
|
|
793
|
+
xt.forEach(s);
|
|
761
794
|
return;
|
|
762
795
|
}
|
|
763
|
-
(
|
|
796
|
+
(n == null ? void 0 : n(i)) !== !0 && s(`command not found: ${i.split(" ")[0]}`);
|
|
764
797
|
},
|
|
765
798
|
onClose: () => a(!1)
|
|
766
799
|
}
|
|
767
800
|
) : null;
|
|
768
801
|
};
|
|
769
|
-
class
|
|
802
|
+
class yt {
|
|
770
803
|
constructor() {
|
|
771
804
|
H(this, "components", /* @__PURE__ */ new Map());
|
|
772
805
|
}
|
|
@@ -774,8 +807,8 @@ class wt {
|
|
|
774
807
|
* Register a component with a unique ID.
|
|
775
808
|
* This ID is what you use in your FlexLayout models.
|
|
776
809
|
*/
|
|
777
|
-
register(e,
|
|
778
|
-
this.components.has(e) && console.warn(`Component with ID "${e}" is already registered.`), this.components.set(e,
|
|
810
|
+
register(e, o) {
|
|
811
|
+
this.components.has(e) && console.warn(`Component with ID "${e}" is already registered.`), this.components.set(e, o);
|
|
779
812
|
}
|
|
780
813
|
/**
|
|
781
814
|
* Retrieve a registered component by its ID.
|
|
@@ -790,7 +823,7 @@ class wt {
|
|
|
790
823
|
return Array.from(this.components.keys());
|
|
791
824
|
}
|
|
792
825
|
}
|
|
793
|
-
const
|
|
826
|
+
const wt = new yt(), _ = {
|
|
794
827
|
global: { tabEnableClose: !0, tabSetEnableMaximize: !1, tabSetEnableDivide: !0 },
|
|
795
828
|
borders: [
|
|
796
829
|
{
|
|
@@ -816,49 +849,49 @@ const Nt = new wt(), _ = {
|
|
|
816
849
|
}
|
|
817
850
|
]
|
|
818
851
|
}
|
|
819
|
-
},
|
|
820
|
-
let
|
|
852
|
+
}, pe = "nexus-shell-layout", Nt = F((n, e) => {
|
|
853
|
+
let o;
|
|
821
854
|
if (typeof window < "u")
|
|
822
855
|
try {
|
|
823
|
-
const t = localStorage.getItem(
|
|
856
|
+
const t = localStorage.getItem(pe);
|
|
824
857
|
if (t) {
|
|
825
858
|
const a = JSON.parse(t);
|
|
826
|
-
|
|
859
|
+
o = R.fromJson(a);
|
|
827
860
|
const s = /* @__PURE__ */ new Set(["dialogue-library", "argument-inspector"]), l = [];
|
|
828
|
-
|
|
861
|
+
o.visitNodes((u) => {
|
|
829
862
|
if (u.getType() === "tab") {
|
|
830
863
|
const i = u;
|
|
831
864
|
s.has(i.getComponent()) && l.push(i.getId());
|
|
832
865
|
}
|
|
833
866
|
}), l.forEach((u) => {
|
|
834
|
-
|
|
867
|
+
o.doAction(G.deleteTab(u));
|
|
835
868
|
});
|
|
836
869
|
} else
|
|
837
|
-
|
|
870
|
+
o = R.fromJson(_);
|
|
838
871
|
} catch (t) {
|
|
839
|
-
console.warn("Failed to load layout from storage, using default", t),
|
|
872
|
+
console.warn("Failed to load layout from storage, using default", t), o = R.fromJson(_);
|
|
840
873
|
}
|
|
841
874
|
else
|
|
842
|
-
|
|
875
|
+
o = R.fromJson(_);
|
|
843
876
|
return {
|
|
844
|
-
model:
|
|
877
|
+
model: o,
|
|
845
878
|
dirtyTabs: /* @__PURE__ */ new Set(),
|
|
846
|
-
storageKey:
|
|
879
|
+
storageKey: pe,
|
|
847
880
|
disableLocalStorage: !1,
|
|
848
881
|
initLayout: (t, a) => {
|
|
849
882
|
let s;
|
|
850
883
|
if (t && Object.keys(t).length > 0)
|
|
851
884
|
try {
|
|
852
|
-
s =
|
|
885
|
+
s = R.fromJson(t);
|
|
853
886
|
} catch (l) {
|
|
854
|
-
console.warn("Failed to parse init layout json, using default", l), s =
|
|
887
|
+
console.warn("Failed to parse init layout json, using default", l), s = R.fromJson(_);
|
|
855
888
|
}
|
|
856
889
|
else
|
|
857
|
-
s =
|
|
858
|
-
|
|
890
|
+
s = R.fromJson(_);
|
|
891
|
+
n({ model: s, disableLocalStorage: a || !1 });
|
|
859
892
|
},
|
|
860
893
|
setModel: (t) => {
|
|
861
|
-
|
|
894
|
+
n({ model: t });
|
|
862
895
|
const a = e().storageKey;
|
|
863
896
|
if (typeof window < "u" && !e().disableLocalStorage)
|
|
864
897
|
try {
|
|
@@ -872,16 +905,16 @@ const Nt = new wt(), _ = {
|
|
|
872
905
|
if (typeof window < "u")
|
|
873
906
|
try {
|
|
874
907
|
const l = localStorage.getItem(t);
|
|
875
|
-
l ? s =
|
|
908
|
+
l ? s = R.fromJson(JSON.parse(l)) : s = R.fromJson(a || _);
|
|
876
909
|
} catch (l) {
|
|
877
|
-
console.warn("Failed to load layout from storage for key", t, l), s =
|
|
910
|
+
console.warn("Failed to load layout from storage for key", t, l), s = R.fromJson(a || _);
|
|
878
911
|
}
|
|
879
912
|
else
|
|
880
|
-
s =
|
|
881
|
-
|
|
913
|
+
s = R.fromJson(a || _);
|
|
914
|
+
n({ storageKey: t, model: s });
|
|
882
915
|
},
|
|
883
916
|
setTabDirty: (t, a) => {
|
|
884
|
-
|
|
917
|
+
n((s) => {
|
|
885
918
|
const l = new Set(s.dirtyTabs);
|
|
886
919
|
return a ? l.add(t) : l.delete(t), { dirtyTabs: l };
|
|
887
920
|
});
|
|
@@ -892,84 +925,84 @@ const Nt = new wt(), _ = {
|
|
|
892
925
|
let i = u == null ? void 0 : u.getId();
|
|
893
926
|
if (!i)
|
|
894
927
|
try {
|
|
895
|
-
const
|
|
896
|
-
i =
|
|
897
|
-
} catch (
|
|
898
|
-
console.warn("Failed to get first tabset fallback",
|
|
928
|
+
const f = l.getFirstTabSet();
|
|
929
|
+
i = f == null ? void 0 : f.getId();
|
|
930
|
+
} catch (f) {
|
|
931
|
+
console.warn("Failed to get first tabset fallback", f);
|
|
899
932
|
}
|
|
900
|
-
const
|
|
933
|
+
const m = { ...{}, ...s };
|
|
901
934
|
if (["nexus-dashboard", "nexus-docs"].includes(t)) {
|
|
902
|
-
let
|
|
903
|
-
if (l.visitNodes((
|
|
904
|
-
if (
|
|
905
|
-
const
|
|
906
|
-
|
|
935
|
+
let f = null;
|
|
936
|
+
if (l.visitNodes((p) => {
|
|
937
|
+
if (p.getType() === "tab") {
|
|
938
|
+
const N = p;
|
|
939
|
+
N.getComponent() === t && (f = N.getId());
|
|
907
940
|
}
|
|
908
|
-
}),
|
|
909
|
-
l.doAction(G.selectTab(
|
|
941
|
+
}), f) {
|
|
942
|
+
l.doAction(G.selectTab(f));
|
|
910
943
|
return;
|
|
911
944
|
}
|
|
912
945
|
}
|
|
913
|
-
if (
|
|
914
|
-
let
|
|
915
|
-
if (l.visitNodes((
|
|
916
|
-
var
|
|
917
|
-
if (
|
|
918
|
-
const
|
|
919
|
-
((
|
|
946
|
+
if (m.mapId) {
|
|
947
|
+
let f = null;
|
|
948
|
+
if (l.visitNodes((p) => {
|
|
949
|
+
var N;
|
|
950
|
+
if (p.getType() === "tab") {
|
|
951
|
+
const k = p;
|
|
952
|
+
((N = k.getConfig()) == null ? void 0 : N.mapId) === m.mapId && (f = k.getId());
|
|
920
953
|
}
|
|
921
|
-
}),
|
|
922
|
-
l.doAction(G.selectTab(
|
|
954
|
+
}), f) {
|
|
955
|
+
l.doAction(G.selectTab(f));
|
|
923
956
|
return;
|
|
924
957
|
}
|
|
925
958
|
}
|
|
926
|
-
if (
|
|
927
|
-
let
|
|
928
|
-
if (l.visitNodes((
|
|
929
|
-
var
|
|
930
|
-
if (
|
|
931
|
-
const
|
|
932
|
-
((
|
|
959
|
+
if (m.projectId) {
|
|
960
|
+
let f = null;
|
|
961
|
+
if (l.visitNodes((p) => {
|
|
962
|
+
var N;
|
|
963
|
+
if (p.getType() === "tab") {
|
|
964
|
+
const k = p;
|
|
965
|
+
((N = k.getConfig()) == null ? void 0 : N.projectId) === m.projectId && (f = k.getId());
|
|
933
966
|
}
|
|
934
|
-
}),
|
|
935
|
-
l.doAction(G.selectTab(
|
|
967
|
+
}), f) {
|
|
968
|
+
l.doAction(G.selectTab(f));
|
|
936
969
|
return;
|
|
937
970
|
}
|
|
938
971
|
}
|
|
939
972
|
i && l.doAction(
|
|
940
973
|
G.addNode(
|
|
941
|
-
{ type: "tab", component: t, name: a || t, config:
|
|
974
|
+
{ type: "tab", component: t, name: a || t, config: m },
|
|
942
975
|
i,
|
|
943
|
-
|
|
976
|
+
Le.CENTER,
|
|
944
977
|
-1
|
|
945
978
|
)
|
|
946
979
|
);
|
|
947
980
|
}
|
|
948
981
|
};
|
|
949
|
-
}),
|
|
982
|
+
}), Ee = F((n, e) => ({
|
|
950
983
|
isOpen: !1,
|
|
951
984
|
type: "alert",
|
|
952
985
|
title: "",
|
|
953
986
|
message: "",
|
|
954
987
|
defaultValue: "",
|
|
955
988
|
resolve: null,
|
|
956
|
-
openAlert: (
|
|
957
|
-
|
|
989
|
+
openAlert: (o, t = "Alert") => new Promise((a) => {
|
|
990
|
+
n({ isOpen: !0, type: "alert", title: t, message: o, defaultValue: "", resolve: a });
|
|
958
991
|
}),
|
|
959
|
-
openConfirm: (
|
|
960
|
-
|
|
992
|
+
openConfirm: (o, t = "Confirm") => new Promise((a) => {
|
|
993
|
+
n({ isOpen: !0, type: "confirm", title: t, message: o, defaultValue: "", resolve: a });
|
|
961
994
|
}),
|
|
962
|
-
openPrompt: (
|
|
963
|
-
|
|
995
|
+
openPrompt: (o, t = "", a = "Prompt") => new Promise((s) => {
|
|
996
|
+
n({ isOpen: !0, type: "prompt", title: a, message: o, defaultValue: t, resolve: s });
|
|
964
997
|
}),
|
|
965
|
-
close: (
|
|
998
|
+
close: (o = null) => {
|
|
966
999
|
const { resolve: t } = e();
|
|
967
|
-
t && t(
|
|
1000
|
+
t && t(o), n({ isOpen: !1, resolve: null });
|
|
968
1001
|
}
|
|
969
1002
|
})), Gt = ({
|
|
970
|
-
panels:
|
|
1003
|
+
panels: n,
|
|
971
1004
|
slashCommands: e,
|
|
972
|
-
menuConfig:
|
|
1005
|
+
menuConfig: o,
|
|
973
1006
|
statusBarConfig: t,
|
|
974
1007
|
title: a,
|
|
975
1008
|
rightMenuBarContent: s,
|
|
@@ -977,41 +1010,41 @@ const Nt = new wt(), _ = {
|
|
|
977
1010
|
layoutModel: u,
|
|
978
1011
|
initialLayoutJson: i,
|
|
979
1012
|
disableLocalStorage: d = !1,
|
|
980
|
-
onLayoutChange:
|
|
1013
|
+
onLayoutChange: m
|
|
981
1014
|
}) => {
|
|
982
|
-
const { model:
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
}, [
|
|
986
|
-
e &&
|
|
987
|
-
}, [e,
|
|
988
|
-
|
|
989
|
-
}, [
|
|
990
|
-
t &&
|
|
991
|
-
}, [t,
|
|
992
|
-
u || !i && !d ||
|
|
1015
|
+
const { model: f, setModel: p, initLayout: N, isTabDirty: k, setTabDirty: w } = Nt(), h = Y((D) => D.theme), x = U((D) => D.setPanels), b = Q((D) => D.setSlashCommands), y = ie((D) => D.setWidgets);
|
|
1016
|
+
O(() => {
|
|
1017
|
+
n && x(n);
|
|
1018
|
+
}, [n, x]), O(() => {
|
|
1019
|
+
e && b(e);
|
|
1020
|
+
}, [e, b]), O(() => {
|
|
1021
|
+
o && le.setMenus(o);
|
|
1022
|
+
}, [o]), O(() => {
|
|
1023
|
+
t && y(t);
|
|
1024
|
+
}, [t, y]), O(() => {
|
|
1025
|
+
u || !i && !d || N(i, d);
|
|
993
1026
|
}, []);
|
|
994
|
-
const
|
|
1027
|
+
const g = (D) => {
|
|
995
1028
|
try {
|
|
996
|
-
const
|
|
997
|
-
return
|
|
1029
|
+
const L = D.getComponent(), T = D.getConfig() || {}, P = L ? wt.get(L) : void 0;
|
|
1030
|
+
return P ? /* @__PURE__ */ r(P, { node: D, ...T }) : /* @__PURE__ */ c("div", { className: "p-4 text-sm", children: [
|
|
998
1031
|
"Unknown Component: ",
|
|
999
|
-
|
|
1032
|
+
L
|
|
1000
1033
|
] });
|
|
1001
|
-
} catch (
|
|
1002
|
-
return console.error("Error in component factory:",
|
|
1034
|
+
} catch (L) {
|
|
1035
|
+
return console.error("Error in component factory:", L), /* @__PURE__ */ c("div", { className: "p-8 text-destructive bg-destructive/10 border border-destructive/20 h-full flex items-center justify-center", children: [
|
|
1003
1036
|
"Error rendering component: ",
|
|
1004
|
-
|
|
1037
|
+
L instanceof Error ? L.message : "Unknown error"
|
|
1005
1038
|
] });
|
|
1006
1039
|
}
|
|
1007
|
-
},
|
|
1008
|
-
if (
|
|
1009
|
-
const
|
|
1010
|
-
if (!
|
|
1011
|
-
|
|
1012
|
-
`Tab "${
|
|
1013
|
-
).then((
|
|
1014
|
-
|
|
1040
|
+
}, C = (D) => {
|
|
1041
|
+
if (D.type !== G.DELETE_TAB) return D;
|
|
1042
|
+
const L = f.getNodeById(D.data.node);
|
|
1043
|
+
if (!L || !k(L.getId())) return D;
|
|
1044
|
+
Ee.getState().openConfirm(
|
|
1045
|
+
`Tab "${L.getName()}" has unsaved changes. Are you sure you want to close it?`
|
|
1046
|
+
).then((T) => {
|
|
1047
|
+
T && (w(L.getId(), !1), f.doAction(D));
|
|
1015
1048
|
});
|
|
1016
1049
|
};
|
|
1017
1050
|
return /* @__PURE__ */ c(
|
|
@@ -1020,7 +1053,7 @@ const Nt = new wt(), _ = {
|
|
|
1020
1053
|
className: `flex flex-col h-screen w-screen bg-background text-foreground overflow-hidden theme-${h}`,
|
|
1021
1054
|
children: [
|
|
1022
1055
|
/* @__PURE__ */ r(
|
|
1023
|
-
|
|
1056
|
+
it,
|
|
1024
1057
|
{
|
|
1025
1058
|
title: a,
|
|
1026
1059
|
center: l,
|
|
@@ -1028,36 +1061,38 @@ const Nt = new wt(), _ = {
|
|
|
1028
1061
|
}
|
|
1029
1062
|
),
|
|
1030
1063
|
/* @__PURE__ */ c("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
1031
|
-
/* @__PURE__ */ r(
|
|
1032
|
-
/* @__PURE__ */ r(
|
|
1064
|
+
/* @__PURE__ */ r(Ze, {}),
|
|
1065
|
+
/* @__PURE__ */ r(pt, {}),
|
|
1033
1066
|
/* @__PURE__ */ c("div", { className: "flex-1 flex flex-col min-w-0 bg-card", children: [
|
|
1034
1067
|
/* @__PURE__ */ r("div", { className: "flex-1 relative h-full w-full", children: /* @__PURE__ */ r(
|
|
1035
|
-
|
|
1068
|
+
Me,
|
|
1036
1069
|
{
|
|
1037
|
-
model: u ||
|
|
1038
|
-
factory:
|
|
1039
|
-
onModelChange: (
|
|
1040
|
-
u ||
|
|
1070
|
+
model: u || f,
|
|
1071
|
+
factory: g,
|
|
1072
|
+
onModelChange: (D) => {
|
|
1073
|
+
u || p(D), m == null || m(D.toJson());
|
|
1041
1074
|
},
|
|
1042
|
-
onAction:
|
|
1075
|
+
onAction: C
|
|
1043
1076
|
}
|
|
1044
1077
|
) }),
|
|
1045
|
-
/* @__PURE__ */ r(
|
|
1078
|
+
/* @__PURE__ */ r(vt, {})
|
|
1046
1079
|
] }),
|
|
1047
|
-
/* @__PURE__ */ r(
|
|
1080
|
+
/* @__PURE__ */ r(ot, {})
|
|
1048
1081
|
] }),
|
|
1049
|
-
/* @__PURE__ */ r(
|
|
1082
|
+
/* @__PURE__ */ r(ht, {})
|
|
1050
1083
|
]
|
|
1051
1084
|
}
|
|
1052
1085
|
);
|
|
1053
|
-
},
|
|
1086
|
+
}, De = X.map((n) => ({
|
|
1087
|
+
id: `theme.${n.id}`,
|
|
1088
|
+
label: `Preferences: ${n.label} Theme`,
|
|
1089
|
+
execute: () => Y.getState().setTheme(n.id)
|
|
1090
|
+
})), Vt = [
|
|
1054
1091
|
"view.toggleTerminal",
|
|
1055
1092
|
"view.toggleChat",
|
|
1056
1093
|
"view.toggleSidebar",
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
"theme.gt"
|
|
1060
|
-
], oe = (o) => () => Y.getState().setTheme(o), Ct = [
|
|
1094
|
+
...De.map((n) => n.id)
|
|
1095
|
+
], kt = [
|
|
1061
1096
|
{
|
|
1062
1097
|
id: "view.toggleTerminal",
|
|
1063
1098
|
label: "View: Toggle Terminal",
|
|
@@ -1075,14 +1110,12 @@ const Nt = new wt(), _ = {
|
|
|
1075
1110
|
keybinding: "Control+b",
|
|
1076
1111
|
execute: () => {
|
|
1077
1112
|
var t;
|
|
1078
|
-
const { activeSidebar:
|
|
1079
|
-
n
|
|
1113
|
+
const { activeSidebar: n, panels: e, setActiveSidebar: o } = U.getState();
|
|
1114
|
+
o(n ? null : ((t = e[0]) == null ? void 0 : t.id) ?? null);
|
|
1080
1115
|
}
|
|
1081
1116
|
},
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
{ id: "theme.gt", label: "Preferences: Georgia Tech Theme", execute: oe("gt") }
|
|
1085
|
-
], St = {
|
|
1117
|
+
...De
|
|
1118
|
+
], Ct = {
|
|
1086
1119
|
View: [
|
|
1087
1120
|
{ id: "view.terminal", label: "Toggle Terminal", commandId: "view.toggleTerminal" },
|
|
1088
1121
|
{ id: "view.chat", label: "Toggle Chat", commandId: "view.toggleChat" },
|
|
@@ -1090,31 +1123,31 @@ const Nt = new wt(), _ = {
|
|
|
1090
1123
|
{
|
|
1091
1124
|
id: "view.theme",
|
|
1092
1125
|
label: "Theme",
|
|
1093
|
-
submenu:
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1126
|
+
submenu: X.map((n) => ({
|
|
1127
|
+
id: `view.theme.${n.id}`,
|
|
1128
|
+
label: n.label,
|
|
1129
|
+
commandId: `theme.${n.id}`
|
|
1130
|
+
}))
|
|
1098
1131
|
}
|
|
1099
1132
|
]
|
|
1100
|
-
}, Yt = (
|
|
1133
|
+
}, Yt = (n = {}) => {
|
|
1101
1134
|
const {
|
|
1102
1135
|
panels: e,
|
|
1103
|
-
menus:
|
|
1136
|
+
menus: o,
|
|
1104
1137
|
commands: t,
|
|
1105
1138
|
statusBar: a,
|
|
1106
1139
|
slashCommands: s,
|
|
1107
1140
|
defaultCommands: l = !0,
|
|
1108
1141
|
defaultMenus: u = !0
|
|
1109
|
-
} =
|
|
1110
|
-
l &&
|
|
1142
|
+
} = n;
|
|
1143
|
+
l && kt.forEach((d) => J.registerCommand(d)), t == null || t.forEach((d) => J.registerCommand(d));
|
|
1111
1144
|
const i = {
|
|
1112
|
-
...l && u ?
|
|
1113
|
-
...
|
|
1145
|
+
...l && u ? Ct : {},
|
|
1146
|
+
...o ?? {}
|
|
1114
1147
|
};
|
|
1115
|
-
Object.keys(i).length > 0 && le.setMenus(i), e &&
|
|
1148
|
+
Object.keys(i).length > 0 && le.setMenus(i), e && U.getState().setPanels(e), a && ie.getState().setWidgets(a), s && Q.getState().setSlashCommands(s);
|
|
1116
1149
|
};
|
|
1117
|
-
class
|
|
1150
|
+
class St {
|
|
1118
1151
|
constructor() {
|
|
1119
1152
|
H(this, "plugins", /* @__PURE__ */ new Map());
|
|
1120
1153
|
H(this, "loaders", /* @__PURE__ */ new Map());
|
|
@@ -1127,25 +1160,25 @@ class Tt {
|
|
|
1127
1160
|
}
|
|
1128
1161
|
this.plugins.set(e.id, e), this.statuses.set(e.id, "registered"), console.log(`Plugin ${e.name} (${e.id}) registered.`);
|
|
1129
1162
|
}
|
|
1130
|
-
registerLazyPlugin(e,
|
|
1163
|
+
registerLazyPlugin(e, o) {
|
|
1131
1164
|
if (this.loaders.has(e) || this.plugins.has(e)) {
|
|
1132
1165
|
console.warn(`Plugin ${e} is already registered or has a loader.`);
|
|
1133
1166
|
return;
|
|
1134
1167
|
}
|
|
1135
|
-
this.loaders.set(e,
|
|
1168
|
+
this.loaders.set(e, o), this.statuses.set(e, "inactive"), console.log(`Lazy plugin loader for ${e} registered.`);
|
|
1136
1169
|
}
|
|
1137
1170
|
async activatePlugin(e) {
|
|
1138
|
-
let
|
|
1139
|
-
if (!
|
|
1171
|
+
let o = this.plugins.get(e);
|
|
1172
|
+
if (!o && this.loaders.has(e))
|
|
1140
1173
|
try {
|
|
1141
|
-
|
|
1174
|
+
o = await this.loaders.get(e)(), this.plugins.set(e, o), this.statuses.set(e, "registered"), console.log(`Lazy plugin ${e} loaded.`);
|
|
1142
1175
|
} catch (t) {
|
|
1143
1176
|
console.error(`Failed to load lazy plugin ${e}`, t), this.statuses.set(e, "failed");
|
|
1144
1177
|
return;
|
|
1145
1178
|
}
|
|
1146
|
-
if (
|
|
1179
|
+
if (o)
|
|
1147
1180
|
try {
|
|
1148
|
-
this.statuses.set(e, "activating"),
|
|
1181
|
+
this.statuses.set(e, "activating"), o.activate(), this.statuses.set(e, "active"), console.log(`Plugin ${o.name} activated.`);
|
|
1149
1182
|
} catch (t) {
|
|
1150
1183
|
console.error(`Failed to activate plugin ${e}`, t), this.statuses.set(e, "failed");
|
|
1151
1184
|
}
|
|
@@ -1153,10 +1186,10 @@ class Tt {
|
|
|
1153
1186
|
console.warn(`Plugin ${e} not found for activation.`), this.statuses.set(e, "failed");
|
|
1154
1187
|
}
|
|
1155
1188
|
async deactivatePlugin(e) {
|
|
1156
|
-
const
|
|
1157
|
-
if (
|
|
1189
|
+
const o = this.plugins.get(e);
|
|
1190
|
+
if (o)
|
|
1158
1191
|
try {
|
|
1159
|
-
|
|
1192
|
+
o.deactivate(), this.statuses.set(e, "deactivated"), console.log(`Plugin ${o.name} deactivated.`);
|
|
1160
1193
|
} catch (t) {
|
|
1161
1194
|
console.error(`Failed to deactivate plugin ${e}`, t), this.statuses.set(e, "failed");
|
|
1162
1195
|
}
|
|
@@ -1166,8 +1199,8 @@ class Tt {
|
|
|
1166
1199
|
}
|
|
1167
1200
|
getPluginStatuses() {
|
|
1168
1201
|
const e = {};
|
|
1169
|
-
return this.statuses.forEach((
|
|
1170
|
-
e[t] =
|
|
1202
|
+
return this.statuses.forEach((o, t) => {
|
|
1203
|
+
e[t] = o;
|
|
1171
1204
|
}), e;
|
|
1172
1205
|
}
|
|
1173
1206
|
getPlugin(e) {
|
|
@@ -1177,26 +1210,26 @@ class Tt {
|
|
|
1177
1210
|
return Array.from(this.plugins.values());
|
|
1178
1211
|
}
|
|
1179
1212
|
}
|
|
1180
|
-
const qt = new
|
|
1213
|
+
const qt = new St(), ge = "nexus-shell-user-profile", he = {
|
|
1181
1214
|
name: "David Tech",
|
|
1182
1215
|
role: "Shell Architect",
|
|
1183
1216
|
email: "david@techmuch.io",
|
|
1184
1217
|
avatarUrl: "",
|
|
1185
1218
|
customAvatar: ""
|
|
1186
|
-
}, W =
|
|
1187
|
-
let e = { ...
|
|
1219
|
+
}, W = F((n) => {
|
|
1220
|
+
let e = { ...he };
|
|
1188
1221
|
if (typeof window < "u")
|
|
1189
1222
|
try {
|
|
1190
|
-
const t = localStorage.getItem(
|
|
1191
|
-
t && (e = { ...
|
|
1223
|
+
const t = localStorage.getItem(ge);
|
|
1224
|
+
t && (e = { ...he, ...JSON.parse(t) });
|
|
1192
1225
|
} catch (t) {
|
|
1193
1226
|
console.error("Failed to parse saved user profile:", t);
|
|
1194
1227
|
}
|
|
1195
|
-
const
|
|
1228
|
+
const o = (t) => {
|
|
1196
1229
|
if (typeof window < "u")
|
|
1197
1230
|
try {
|
|
1198
1231
|
localStorage.setItem(
|
|
1199
|
-
|
|
1232
|
+
ge,
|
|
1200
1233
|
JSON.stringify({
|
|
1201
1234
|
name: t.name,
|
|
1202
1235
|
role: t.role,
|
|
@@ -1211,64 +1244,64 @@ const qt = new Tt(), pe = "nexus-shell-user-profile", ge = {
|
|
|
1211
1244
|
};
|
|
1212
1245
|
return {
|
|
1213
1246
|
...e,
|
|
1214
|
-
updateProfile: (t) =>
|
|
1247
|
+
updateProfile: (t) => n((a) => {
|
|
1215
1248
|
const s = { ...a, ...t };
|
|
1216
|
-
return
|
|
1249
|
+
return o(s), t;
|
|
1217
1250
|
}),
|
|
1218
|
-
setCustomAvatar: (t) =>
|
|
1251
|
+
setCustomAvatar: (t) => n((a) => {
|
|
1219
1252
|
const s = { ...a, customAvatar: t };
|
|
1220
|
-
return
|
|
1253
|
+
return o(s), { customAvatar: t };
|
|
1221
1254
|
}),
|
|
1222
|
-
clearCustomAvatar: () =>
|
|
1255
|
+
clearCustomAvatar: () => n((t) => {
|
|
1223
1256
|
const a = { ...t, customAvatar: "" };
|
|
1224
|
-
return
|
|
1257
|
+
return o(a), { customAvatar: "" };
|
|
1225
1258
|
})
|
|
1226
1259
|
};
|
|
1227
1260
|
}), Qt = () => {
|
|
1228
|
-
|
|
1229
|
-
const
|
|
1230
|
-
const
|
|
1231
|
-
for (const t of
|
|
1232
|
-
if (t.keybinding &&
|
|
1261
|
+
O(() => {
|
|
1262
|
+
const n = (e) => {
|
|
1263
|
+
const o = J.getCommands();
|
|
1264
|
+
for (const t of o)
|
|
1265
|
+
if (t.keybinding && Tt(e, t.keybinding)) {
|
|
1233
1266
|
e.preventDefault(), t.execute();
|
|
1234
1267
|
break;
|
|
1235
1268
|
}
|
|
1236
1269
|
};
|
|
1237
|
-
return window.addEventListener("keydown",
|
|
1270
|
+
return window.addEventListener("keydown", n), () => window.removeEventListener("keydown", n);
|
|
1238
1271
|
}, []);
|
|
1239
1272
|
};
|
|
1240
|
-
function
|
|
1241
|
-
var
|
|
1242
|
-
const
|
|
1243
|
-
return
|
|
1273
|
+
function Tt(n, e) {
|
|
1274
|
+
var p;
|
|
1275
|
+
const o = e.split("+"), t = (p = o.pop()) == null ? void 0 : p.toLowerCase(), a = o.includes("Control") || o.includes("Ctrl"), s = o.includes("Shift"), l = o.includes("Alt"), u = o.includes("Meta") || o.includes("Cmd"), i = n.ctrlKey, d = n.shiftKey, m = n.altKey, f = n.metaKey;
|
|
1276
|
+
return n.key.toLowerCase() === t && i === a && d === s && m === l && f === u;
|
|
1244
1277
|
}
|
|
1245
|
-
const Et = (
|
|
1246
|
-
const
|
|
1247
|
-
return
|
|
1248
|
-
},
|
|
1249
|
-
open:
|
|
1278
|
+
const Et = (n, e) => {
|
|
1279
|
+
const o = e.toLowerCase();
|
|
1280
|
+
return n.label.toLowerCase().includes(o) || n.id.toLowerCase().includes(o);
|
|
1281
|
+
}, Dt = ({
|
|
1282
|
+
open: n,
|
|
1250
1283
|
commands: e,
|
|
1251
|
-
onSelect:
|
|
1284
|
+
onSelect: o,
|
|
1252
1285
|
onClose: t,
|
|
1253
1286
|
inline: a = !1,
|
|
1254
1287
|
placeholder: s = "Type a command to run…",
|
|
1255
1288
|
filter: l = Et,
|
|
1256
1289
|
className: u
|
|
1257
1290
|
}) => {
|
|
1258
|
-
const [i, d] = A(""), [
|
|
1259
|
-
() => e.filter((
|
|
1291
|
+
const [i, d] = A(""), [m, f] = A(0), p = z(null), N = j(
|
|
1292
|
+
() => e.filter((w) => l(w, i)),
|
|
1260
1293
|
[e, i, l]
|
|
1261
1294
|
);
|
|
1262
|
-
if (
|
|
1263
|
-
var
|
|
1264
|
-
|
|
1265
|
-
}, [
|
|
1266
|
-
|
|
1267
|
-
}, [i]), !
|
|
1268
|
-
const
|
|
1269
|
-
|
|
1270
|
-
(h) =>
|
|
1271
|
-
)) :
|
|
1295
|
+
if (O(() => {
|
|
1296
|
+
var w;
|
|
1297
|
+
n && (d(""), f(0), (w = p.current) == null || w.focus());
|
|
1298
|
+
}, [n]), O(() => {
|
|
1299
|
+
f(0);
|
|
1300
|
+
}, [i]), !n) return null;
|
|
1301
|
+
const k = (w) => {
|
|
1302
|
+
w.key === "ArrowDown" ? (w.preventDefault(), f((h) => N.length ? (h + 1) % N.length : 0)) : w.key === "ArrowUp" ? (w.preventDefault(), f(
|
|
1303
|
+
(h) => N.length ? (h - 1 + N.length) % N.length : 0
|
|
1304
|
+
)) : w.key === "Enter" ? (w.preventDefault(), N[m] && o(N[m])) : w.key === "Escape" && (w.preventDefault(), t == null || t());
|
|
1272
1305
|
};
|
|
1273
1306
|
return /* @__PURE__ */ r(
|
|
1274
1307
|
"div",
|
|
@@ -1284,18 +1317,18 @@ const Et = (o, e) => {
|
|
|
1284
1317
|
role: "dialog",
|
|
1285
1318
|
"aria-modal": !a,
|
|
1286
1319
|
"aria-label": "Command Palette",
|
|
1287
|
-
onClick: (
|
|
1320
|
+
onClick: (w) => w.stopPropagation(),
|
|
1288
1321
|
className: S(
|
|
1289
1322
|
"w-full max-w-xl bg-popover text-popover-foreground border shadow-2xl rounded-xl overflow-hidden animate-in fade-in zoom-in duration-200",
|
|
1290
1323
|
u
|
|
1291
1324
|
),
|
|
1292
1325
|
children: [
|
|
1293
1326
|
/* @__PURE__ */ c("div", { className: "flex items-center px-4 border-b", children: [
|
|
1294
|
-
/* @__PURE__ */ r(
|
|
1327
|
+
/* @__PURE__ */ r(Z, { size: 18, className: "text-muted-foreground mr-3" }),
|
|
1295
1328
|
/* @__PURE__ */ r(
|
|
1296
1329
|
"input",
|
|
1297
1330
|
{
|
|
1298
|
-
ref:
|
|
1331
|
+
ref: p,
|
|
1299
1332
|
type: "text",
|
|
1300
1333
|
role: "combobox",
|
|
1301
1334
|
"aria-expanded": !0,
|
|
@@ -1303,8 +1336,8 @@ const Et = (o, e) => {
|
|
|
1303
1336
|
"aria-label": "Command",
|
|
1304
1337
|
placeholder: s,
|
|
1305
1338
|
value: i,
|
|
1306
|
-
onChange: (
|
|
1307
|
-
onKeyDown:
|
|
1339
|
+
onChange: (w) => d(w.target.value),
|
|
1340
|
+
onKeyDown: k,
|
|
1308
1341
|
className: "flex-1 h-14 bg-transparent outline-none text-base text-foreground placeholder:text-muted-foreground"
|
|
1309
1342
|
}
|
|
1310
1343
|
)
|
|
@@ -1315,23 +1348,23 @@ const Et = (o, e) => {
|
|
|
1315
1348
|
id: "command-palette-list",
|
|
1316
1349
|
role: "listbox",
|
|
1317
1350
|
className: "max-h-[300px] overflow-y-auto py-2",
|
|
1318
|
-
children:
|
|
1351
|
+
children: N.length === 0 ? /* @__PURE__ */ r("div", { className: "px-4 py-8 text-center text-sm text-muted-foreground", children: i ? `No commands found matching "${i}"` : "No commands available." }) : N.map((w, h) => /* @__PURE__ */ c(
|
|
1319
1352
|
"div",
|
|
1320
1353
|
{
|
|
1321
1354
|
role: "option",
|
|
1322
|
-
"aria-selected": h ===
|
|
1323
|
-
onClick: () =>
|
|
1324
|
-
onMouseEnter: () =>
|
|
1355
|
+
"aria-selected": h === m,
|
|
1356
|
+
onClick: () => o(w),
|
|
1357
|
+
onMouseEnter: () => f(h),
|
|
1325
1358
|
className: S(
|
|
1326
1359
|
"px-4 py-2 cursor-pointer flex justify-between items-center text-sm",
|
|
1327
|
-
h ===
|
|
1360
|
+
h === m ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
|
|
1328
1361
|
),
|
|
1329
1362
|
children: [
|
|
1330
|
-
/* @__PURE__ */ r("span", { children:
|
|
1331
|
-
|
|
1363
|
+
/* @__PURE__ */ r("span", { children: w.label }),
|
|
1364
|
+
w.keybinding && /* @__PURE__ */ r("span", { className: "text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded border border-border/50", children: w.keybinding })
|
|
1332
1365
|
]
|
|
1333
1366
|
},
|
|
1334
|
-
|
|
1367
|
+
w.id
|
|
1335
1368
|
))
|
|
1336
1369
|
}
|
|
1337
1370
|
),
|
|
@@ -1357,40 +1390,40 @@ const Et = (o, e) => {
|
|
|
1357
1390
|
}
|
|
1358
1391
|
);
|
|
1359
1392
|
}, Xt = ({
|
|
1360
|
-
shortcutKey:
|
|
1393
|
+
shortcutKey: n = "p",
|
|
1361
1394
|
...e
|
|
1362
1395
|
}) => {
|
|
1363
|
-
const [
|
|
1364
|
-
return
|
|
1365
|
-
if (
|
|
1396
|
+
const [o, t] = A(!1);
|
|
1397
|
+
return O(() => {
|
|
1398
|
+
if (n === null) return;
|
|
1366
1399
|
const a = (s) => {
|
|
1367
|
-
(s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() ===
|
|
1400
|
+
(s.metaKey || s.ctrlKey) && s.shiftKey && s.key.toLowerCase() === n && (s.preventDefault(), t((l) => !l));
|
|
1368
1401
|
};
|
|
1369
1402
|
return window.addEventListener("keydown", a), () => window.removeEventListener("keydown", a);
|
|
1370
|
-
}, [
|
|
1371
|
-
|
|
1403
|
+
}, [n]), /* @__PURE__ */ r(
|
|
1404
|
+
Dt,
|
|
1372
1405
|
{
|
|
1373
1406
|
...e,
|
|
1374
|
-
open:
|
|
1375
|
-
commands:
|
|
1407
|
+
open: o,
|
|
1408
|
+
commands: J.getCommands(),
|
|
1376
1409
|
onSelect: (a) => {
|
|
1377
1410
|
a.execute(), t(!1);
|
|
1378
1411
|
},
|
|
1379
1412
|
onClose: () => t(!1)
|
|
1380
1413
|
}
|
|
1381
1414
|
);
|
|
1415
|
+
}, It = {
|
|
1416
|
+
alert: Fe,
|
|
1417
|
+
confirm: Ue,
|
|
1418
|
+
prompt: je
|
|
1382
1419
|
}, Ot = {
|
|
1383
|
-
alert: Re,
|
|
1384
|
-
confirm: je,
|
|
1385
|
-
prompt: $e
|
|
1386
|
-
}, zt = {
|
|
1387
1420
|
alert: "text-destructive",
|
|
1388
1421
|
confirm: "text-amber-500",
|
|
1389
1422
|
prompt: "text-blue-500"
|
|
1390
1423
|
}, At = ({
|
|
1391
|
-
open:
|
|
1424
|
+
open: n,
|
|
1392
1425
|
type: e = "alert",
|
|
1393
|
-
title:
|
|
1426
|
+
title: o,
|
|
1394
1427
|
message: t,
|
|
1395
1428
|
defaultValue: a = "",
|
|
1396
1429
|
onConfirm: s,
|
|
@@ -1398,26 +1431,26 @@ const Et = (o, e) => {
|
|
|
1398
1431
|
confirmLabel: u,
|
|
1399
1432
|
cancelLabel: i = "Cancel",
|
|
1400
1433
|
placeholder: d = "Enter value…",
|
|
1401
|
-
className:
|
|
1434
|
+
className: m
|
|
1402
1435
|
}) => {
|
|
1403
|
-
const [
|
|
1404
|
-
if (
|
|
1405
|
-
if (!
|
|
1406
|
-
const
|
|
1407
|
-
var
|
|
1408
|
-
(
|
|
1436
|
+
const [f, p] = A(a), N = z(null);
|
|
1437
|
+
if (O(() => {
|
|
1438
|
+
if (!n || (p(a), e !== "prompt")) return;
|
|
1439
|
+
const x = window.setTimeout(() => {
|
|
1440
|
+
var b, y;
|
|
1441
|
+
(b = N.current) == null || b.focus(), (y = N.current) == null || y.select();
|
|
1409
1442
|
}, 50);
|
|
1410
|
-
return () => window.clearTimeout(
|
|
1411
|
-
}, [
|
|
1412
|
-
if (!
|
|
1413
|
-
const
|
|
1414
|
-
|
|
1443
|
+
return () => window.clearTimeout(x);
|
|
1444
|
+
}, [n, e, a]), O(() => {
|
|
1445
|
+
if (!n) return;
|
|
1446
|
+
const x = (b) => {
|
|
1447
|
+
b.key === "Escape" && (b.preventDefault(), l == null || l());
|
|
1415
1448
|
};
|
|
1416
|
-
return document.addEventListener("keydown",
|
|
1417
|
-
}, [
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
}, h =
|
|
1449
|
+
return document.addEventListener("keydown", x), () => document.removeEventListener("keydown", x);
|
|
1450
|
+
}, [n, l]), !n) return null;
|
|
1451
|
+
const k = () => s == null ? void 0 : s(e === "prompt" ? f : void 0), w = (x) => {
|
|
1452
|
+
x.key === "Enter" && (x.preventDefault(), k());
|
|
1453
|
+
}, h = It[e];
|
|
1421
1454
|
return /* @__PURE__ */ r(
|
|
1422
1455
|
"div",
|
|
1423
1456
|
{
|
|
@@ -1428,12 +1461,12 @@ const Et = (o, e) => {
|
|
|
1428
1461
|
{
|
|
1429
1462
|
role: "dialog",
|
|
1430
1463
|
"aria-modal": "true",
|
|
1431
|
-
"aria-label":
|
|
1432
|
-
onClick: (
|
|
1433
|
-
onKeyDown:
|
|
1464
|
+
"aria-label": o,
|
|
1465
|
+
onClick: (x) => x.stopPropagation(),
|
|
1466
|
+
onKeyDown: w,
|
|
1434
1467
|
className: S(
|
|
1435
1468
|
"relative flex flex-col w-full max-w-md p-6 bg-card border border-border shadow-2xl rounded-2xl animate-in fade-in zoom-in-95 ring-1 ring-white/10",
|
|
1436
|
-
|
|
1469
|
+
m
|
|
1437
1470
|
),
|
|
1438
1471
|
children: [
|
|
1439
1472
|
/* @__PURE__ */ r(
|
|
@@ -1443,25 +1476,25 @@ const Et = (o, e) => {
|
|
|
1443
1476
|
onClick: l,
|
|
1444
1477
|
"aria-label": "Close",
|
|
1445
1478
|
className: "absolute top-4 right-4 p-1 rounded-full text-muted-foreground hover:bg-muted hover:text-foreground transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
1446
|
-
children: /* @__PURE__ */ r(
|
|
1479
|
+
children: /* @__PURE__ */ r(B, { size: 18 })
|
|
1447
1480
|
}
|
|
1448
1481
|
),
|
|
1449
1482
|
/* @__PURE__ */ c("div", { className: "flex items-start space-x-4 mb-4", children: [
|
|
1450
|
-
/* @__PURE__ */ r("div", { className: S("p-2 bg-muted rounded-full shrink-0",
|
|
1483
|
+
/* @__PURE__ */ r("div", { className: S("p-2 bg-muted rounded-full shrink-0", Ot[e]), children: /* @__PURE__ */ r(h, { size: 24 }) }),
|
|
1451
1484
|
/* @__PURE__ */ c("div", { className: "flex-1 mt-1", children: [
|
|
1452
|
-
/* @__PURE__ */ r("h2", { className: "text-lg font-semibold tracking-tight pr-6", children:
|
|
1485
|
+
/* @__PURE__ */ r("h2", { className: "text-lg font-semibold tracking-tight pr-6", children: o }),
|
|
1453
1486
|
t && /* @__PURE__ */ r("p", { className: "text-sm text-muted-foreground mt-1 whitespace-pre-wrap", children: t })
|
|
1454
1487
|
] })
|
|
1455
1488
|
] }),
|
|
1456
1489
|
e === "prompt" && /* @__PURE__ */ r("div", { className: "mt-2 mb-4", children: /* @__PURE__ */ r(
|
|
1457
1490
|
"input",
|
|
1458
1491
|
{
|
|
1459
|
-
ref:
|
|
1492
|
+
ref: N,
|
|
1460
1493
|
type: "text",
|
|
1461
|
-
"aria-label":
|
|
1462
|
-
value:
|
|
1494
|
+
"aria-label": o,
|
|
1495
|
+
value: f,
|
|
1463
1496
|
placeholder: d,
|
|
1464
|
-
onChange: (
|
|
1497
|
+
onChange: (x) => p(x.target.value),
|
|
1465
1498
|
className: "w-full bg-background border border-border rounded-lg px-4 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/50 transition-all placeholder:text-muted-foreground/50"
|
|
1466
1499
|
}
|
|
1467
1500
|
) }),
|
|
@@ -1479,7 +1512,7 @@ const Et = (o, e) => {
|
|
|
1479
1512
|
"button",
|
|
1480
1513
|
{
|
|
1481
1514
|
type: "button",
|
|
1482
|
-
onClick:
|
|
1515
|
+
onClick: k,
|
|
1483
1516
|
autoFocus: e !== "prompt",
|
|
1484
1517
|
className: "px-4 py-2 text-sm font-medium rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors focus:outline-none focus:ring-2 focus:ring-ring",
|
|
1485
1518
|
children: u ?? (e === "alert" ? "OK" : "Confirm")
|
|
@@ -1491,33 +1524,32 @@ const Et = (o, e) => {
|
|
|
1491
1524
|
)
|
|
1492
1525
|
}
|
|
1493
1526
|
);
|
|
1494
|
-
}, Zt = (
|
|
1495
|
-
const { isOpen: e, type:
|
|
1527
|
+
}, Zt = (n) => {
|
|
1528
|
+
const { isOpen: e, type: o, title: t, message: a, defaultValue: s, close: l } = Ee();
|
|
1496
1529
|
return /* @__PURE__ */ r(
|
|
1497
1530
|
At,
|
|
1498
1531
|
{
|
|
1499
|
-
...
|
|
1532
|
+
...n,
|
|
1500
1533
|
open: e,
|
|
1501
|
-
type:
|
|
1534
|
+
type: o,
|
|
1502
1535
|
title: t,
|
|
1503
1536
|
message: a,
|
|
1504
1537
|
defaultValue: s,
|
|
1505
1538
|
onConfirm: (d) => {
|
|
1506
|
-
|
|
1539
|
+
o === "prompt" ? l(d ?? "") : o === "confirm" ? l(!0) : l();
|
|
1507
1540
|
},
|
|
1508
1541
|
onCancel: () => {
|
|
1509
|
-
|
|
1542
|
+
o === "prompt" ? l(null) : o === "confirm" ? l(!1) : l();
|
|
1510
1543
|
}
|
|
1511
1544
|
}
|
|
1512
1545
|
);
|
|
1513
|
-
}, Lt =
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
value: o,
|
|
1546
|
+
}, Lt = X.map((n) => ({
|
|
1547
|
+
id: n.id,
|
|
1548
|
+
label: n.shortLabel
|
|
1549
|
+
})), Mt = ({
|
|
1550
|
+
value: n,
|
|
1519
1551
|
onChange: e,
|
|
1520
|
-
options:
|
|
1552
|
+
options: o = Lt,
|
|
1521
1553
|
className: t,
|
|
1522
1554
|
"aria-label": a = "Theme"
|
|
1523
1555
|
}) => /* @__PURE__ */ r(
|
|
@@ -1529,63 +1561,63 @@ const Et = (o, e) => {
|
|
|
1529
1561
|
"flex items-center border border-border rounded-lg p-0.5 bg-secondary/80 select-none",
|
|
1530
1562
|
t
|
|
1531
1563
|
),
|
|
1532
|
-
children:
|
|
1564
|
+
children: o.map((s) => /* @__PURE__ */ r(
|
|
1533
1565
|
"button",
|
|
1534
1566
|
{
|
|
1535
1567
|
role: "radio",
|
|
1536
|
-
"aria-checked":
|
|
1568
|
+
"aria-checked": n === s.id,
|
|
1537
1569
|
onClick: () => e(s.id),
|
|
1538
1570
|
className: S(
|
|
1539
1571
|
"px-2.5 py-1 text-[9px] font-extrabold uppercase rounded-md transition-all font-mono cursor-pointer outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
1540
|
-
|
|
1572
|
+
n === s.id ? "bg-primary text-primary-foreground shadow" : "text-muted-foreground hover:bg-accent hover:text-foreground"
|
|
1541
1573
|
),
|
|
1542
1574
|
children: s.label
|
|
1543
1575
|
},
|
|
1544
1576
|
s.id
|
|
1545
1577
|
))
|
|
1546
1578
|
}
|
|
1547
|
-
), er = (
|
|
1548
|
-
const e = Y((t) => t.theme),
|
|
1549
|
-
return /* @__PURE__ */ r(Mt, { ...
|
|
1550
|
-
},
|
|
1551
|
-
profile:
|
|
1579
|
+
), er = (n) => {
|
|
1580
|
+
const e = Y((t) => t.theme), o = Y((t) => t.setTheme);
|
|
1581
|
+
return /* @__PURE__ */ r(Mt, { ...n, value: e, onChange: o });
|
|
1582
|
+
}, zt = ({
|
|
1583
|
+
profile: n,
|
|
1552
1584
|
actions: e = [],
|
|
1553
|
-
onProfileChange:
|
|
1585
|
+
onProfileChange: o,
|
|
1554
1586
|
onAvatarChange: t,
|
|
1555
1587
|
onClick: a,
|
|
1556
1588
|
showName: s = !0,
|
|
1557
1589
|
className: l
|
|
1558
1590
|
}) => {
|
|
1559
|
-
const { name: u, role: i, email: d, avatarUrl:
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
}, [
|
|
1563
|
-
if (!
|
|
1564
|
-
const
|
|
1565
|
-
|
|
1591
|
+
const { name: u, role: i, email: d, avatarUrl: m } = n, [f, p] = A(!1), [N, k] = A(!1), [w, h] = A(u), [x, b] = A(i ?? ""), y = z(null), g = z(null);
|
|
1592
|
+
O(() => {
|
|
1593
|
+
f && (h(u), b(i ?? ""), k(!1));
|
|
1594
|
+
}, [f, u, i]), O(() => {
|
|
1595
|
+
if (!f) return;
|
|
1596
|
+
const T = (P) => {
|
|
1597
|
+
y.current && !y.current.contains(P.target) && p(!1);
|
|
1566
1598
|
};
|
|
1567
|
-
return document.addEventListener("mousedown",
|
|
1568
|
-
}, [
|
|
1569
|
-
const
|
|
1570
|
-
|
|
1571
|
-
},
|
|
1599
|
+
return document.addEventListener("mousedown", T), () => document.removeEventListener("mousedown", T);
|
|
1600
|
+
}, [f]);
|
|
1601
|
+
const C = (T) => {
|
|
1602
|
+
T.preventDefault(), o == null || o({ name: w, role: x }), k(!1);
|
|
1603
|
+
}, D = (T) => {
|
|
1572
1604
|
var v;
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1575
|
-
},
|
|
1576
|
-
return /* @__PURE__ */ c("div", { ref:
|
|
1605
|
+
const P = (v = T.target.files) == null ? void 0 : v[0];
|
|
1606
|
+
P && (t == null || t(P)), T.target.value = "";
|
|
1607
|
+
}, L = (T) => m ? /* @__PURE__ */ r("img", { src: m, alt: u, className: "w-full h-full object-cover" }) : /* @__PURE__ */ r(ve, { size: T, className: "text-muted-foreground" });
|
|
1608
|
+
return /* @__PURE__ */ c("div", { ref: y, className: "relative inline-block text-left", children: [
|
|
1577
1609
|
/* @__PURE__ */ c(
|
|
1578
1610
|
"button",
|
|
1579
1611
|
{
|
|
1580
1612
|
type: "button",
|
|
1581
|
-
onClick: () => a ? a() :
|
|
1613
|
+
onClick: () => a ? a() : p((T) => !T),
|
|
1582
1614
|
"aria-haspopup": a ? void 0 : "menu",
|
|
1583
|
-
"aria-expanded": a ? void 0 :
|
|
1615
|
+
"aria-expanded": a ? void 0 : f,
|
|
1584
1616
|
"aria-label": "User Profile Menu",
|
|
1585
1617
|
className: S(
|
|
1586
1618
|
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none transition-all duration-200 select-none",
|
|
1587
1619
|
s ? "flex items-center space-x-2 px-2 py-1 rounded-md hover:bg-accent/50 hover:text-accent-foreground text-left cursor-pointer border border-transparent hover:border-border/30" : "w-7 h-7 rounded-full bg-secondary/80 border border-border flex items-center justify-center text-muted-foreground hover:text-foreground hover:bg-secondary cursor-pointer",
|
|
1588
|
-
|
|
1620
|
+
f && (s ? "bg-accent/60 border-border/40" : "border-primary/50 text-foreground ring-1 ring-primary/20"),
|
|
1589
1621
|
l
|
|
1590
1622
|
),
|
|
1591
1623
|
children: [
|
|
@@ -1596,7 +1628,7 @@ const Et = (o, e) => {
|
|
|
1596
1628
|
"rounded-full overflow-hidden border border-border/50 bg-muted flex items-center justify-center shrink-0 shadow-sm",
|
|
1597
1629
|
s ? "w-6 h-6" : "w-full h-full"
|
|
1598
1630
|
),
|
|
1599
|
-
children:
|
|
1631
|
+
children: L(s ? 13 : 12)
|
|
1600
1632
|
}
|
|
1601
1633
|
),
|
|
1602
1634
|
s && /* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 leading-tight pr-1", children: [
|
|
@@ -1610,14 +1642,14 @@ const Et = (o, e) => {
|
|
|
1610
1642
|
"input",
|
|
1611
1643
|
{
|
|
1612
1644
|
type: "file",
|
|
1613
|
-
ref:
|
|
1614
|
-
onChange:
|
|
1645
|
+
ref: g,
|
|
1646
|
+
onChange: D,
|
|
1615
1647
|
accept: "image/*",
|
|
1616
1648
|
"aria-label": "Upload avatar",
|
|
1617
1649
|
className: "hidden"
|
|
1618
1650
|
}
|
|
1619
1651
|
),
|
|
1620
|
-
|
|
1652
|
+
f && /* @__PURE__ */ r(
|
|
1621
1653
|
"div",
|
|
1622
1654
|
{
|
|
1623
1655
|
role: "menu",
|
|
@@ -1625,7 +1657,7 @@ const Et = (o, e) => {
|
|
|
1625
1657
|
"absolute z-50 w-64 rounded-lg border border-border/50 bg-card text-card-foreground shadow-lg backdrop-blur-md p-2 flex flex-col gap-1 mt-1.5 animate-in fade-in slide-in-from-top-2 duration-150 origin-top-right",
|
|
1626
1658
|
s ? "left-0" : "right-0"
|
|
1627
1659
|
),
|
|
1628
|
-
children:
|
|
1660
|
+
children: N ? /* @__PURE__ */ c("form", { onSubmit: C, className: "p-2 flex flex-col gap-2", children: [
|
|
1629
1661
|
/* @__PURE__ */ r("span", { className: "text-[10px] font-bold uppercase tracking-wider text-muted-foreground", children: "Edit Profile" }),
|
|
1630
1662
|
/* @__PURE__ */ c("div", { className: "flex flex-col gap-1", children: [
|
|
1631
1663
|
/* @__PURE__ */ r("label", { htmlFor: "profile-name", className: "text-[9px] font-semibold text-muted-foreground", children: "Name" }),
|
|
@@ -1634,8 +1666,8 @@ const Et = (o, e) => {
|
|
|
1634
1666
|
{
|
|
1635
1667
|
id: "profile-name",
|
|
1636
1668
|
type: "text",
|
|
1637
|
-
value:
|
|
1638
|
-
onChange: (
|
|
1669
|
+
value: w,
|
|
1670
|
+
onChange: (T) => h(T.target.value),
|
|
1639
1671
|
required: !0,
|
|
1640
1672
|
className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
|
|
1641
1673
|
}
|
|
@@ -1648,8 +1680,8 @@ const Et = (o, e) => {
|
|
|
1648
1680
|
{
|
|
1649
1681
|
id: "profile-role",
|
|
1650
1682
|
type: "text",
|
|
1651
|
-
value:
|
|
1652
|
-
onChange: (
|
|
1683
|
+
value: x,
|
|
1684
|
+
onChange: (T) => b(T.target.value),
|
|
1653
1685
|
className: "w-full px-2 py-1 text-xs border rounded bg-background focus:ring-1 focus:ring-primary focus:outline-none"
|
|
1654
1686
|
}
|
|
1655
1687
|
)
|
|
@@ -1659,10 +1691,10 @@ const Et = (o, e) => {
|
|
|
1659
1691
|
"button",
|
|
1660
1692
|
{
|
|
1661
1693
|
type: "button",
|
|
1662
|
-
onClick: () =>
|
|
1694
|
+
onClick: () => k(!1),
|
|
1663
1695
|
className: "px-2 py-1 text-[10px] rounded hover:bg-accent text-muted-foreground flex items-center gap-1 border border-border/30",
|
|
1664
1696
|
children: [
|
|
1665
|
-
/* @__PURE__ */ r(
|
|
1697
|
+
/* @__PURE__ */ r(B, { size: 10 }),
|
|
1666
1698
|
" Cancel"
|
|
1667
1699
|
]
|
|
1668
1700
|
}
|
|
@@ -1673,20 +1705,20 @@ const Et = (o, e) => {
|
|
|
1673
1705
|
type: "submit",
|
|
1674
1706
|
className: "px-2 py-1 text-[10px] rounded bg-primary text-primary-foreground hover:bg-primary/95 flex items-center gap-1 font-semibold",
|
|
1675
1707
|
children: [
|
|
1676
|
-
/* @__PURE__ */ r(
|
|
1708
|
+
/* @__PURE__ */ r(_e, { size: 10 }),
|
|
1677
1709
|
" Save"
|
|
1678
1710
|
]
|
|
1679
1711
|
}
|
|
1680
1712
|
)
|
|
1681
1713
|
] })
|
|
1682
|
-
] }) : /* @__PURE__ */ c(
|
|
1714
|
+
] }) : /* @__PURE__ */ c(be, { children: [
|
|
1683
1715
|
/* @__PURE__ */ c("div", { className: "p-2 flex items-center gap-3 border-b border-border/40 pb-2.5 mb-1", children: [
|
|
1684
1716
|
/* @__PURE__ */ c(
|
|
1685
1717
|
"div",
|
|
1686
1718
|
{
|
|
1687
1719
|
onClick: () => {
|
|
1688
|
-
var
|
|
1689
|
-
return t && ((
|
|
1720
|
+
var T;
|
|
1721
|
+
return t && ((T = g.current) == null ? void 0 : T.click());
|
|
1690
1722
|
},
|
|
1691
1723
|
title: t ? "Upload avatar image" : void 0,
|
|
1692
1724
|
className: S(
|
|
@@ -1694,23 +1726,23 @@ const Et = (o, e) => {
|
|
|
1694
1726
|
t && "cursor-pointer"
|
|
1695
1727
|
),
|
|
1696
1728
|
children: [
|
|
1697
|
-
|
|
1698
|
-
t && /* @__PURE__ */ r("div", { className: "absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity", children: /* @__PURE__ */ r(
|
|
1729
|
+
L(24),
|
|
1730
|
+
t && /* @__PURE__ */ r("div", { className: "absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 flex items-center justify-center transition-opacity", children: /* @__PURE__ */ r(Be, { size: 14, className: "text-white" }) })
|
|
1699
1731
|
]
|
|
1700
1732
|
}
|
|
1701
1733
|
),
|
|
1702
1734
|
/* @__PURE__ */ c("div", { className: "flex flex-col min-w-0 leading-normal flex-1", children: [
|
|
1703
1735
|
/* @__PURE__ */ c("div", { className: "flex items-center gap-1", children: [
|
|
1704
1736
|
/* @__PURE__ */ r("span", { className: "text-xs font-bold truncate text-foreground", children: u }),
|
|
1705
|
-
|
|
1737
|
+
o && /* @__PURE__ */ r(
|
|
1706
1738
|
"button",
|
|
1707
1739
|
{
|
|
1708
1740
|
type: "button",
|
|
1709
|
-
onClick: () =>
|
|
1741
|
+
onClick: () => k(!0),
|
|
1710
1742
|
title: "Edit Profile",
|
|
1711
1743
|
"aria-label": "Edit Profile",
|
|
1712
1744
|
className: "p-1 text-muted-foreground hover:text-foreground hover:bg-accent/40 rounded transition-colors",
|
|
1713
|
-
children: /* @__PURE__ */ r(
|
|
1745
|
+
children: /* @__PURE__ */ r(He, { size: 10 })
|
|
1714
1746
|
}
|
|
1715
1747
|
)
|
|
1716
1748
|
] }),
|
|
@@ -1718,58 +1750,58 @@ const Et = (o, e) => {
|
|
|
1718
1750
|
d && /* @__PURE__ */ r("span", { className: "text-[9px] text-muted-foreground/60 truncate font-mono mt-0.5", children: d })
|
|
1719
1751
|
] })
|
|
1720
1752
|
] }),
|
|
1721
|
-
e.map((
|
|
1722
|
-
const
|
|
1753
|
+
e.map((T) => {
|
|
1754
|
+
const P = T.icon;
|
|
1723
1755
|
return /* @__PURE__ */ c(
|
|
1724
1756
|
"button",
|
|
1725
1757
|
{
|
|
1726
1758
|
type: "button",
|
|
1727
1759
|
role: "menuitem",
|
|
1728
1760
|
onClick: () => {
|
|
1729
|
-
|
|
1761
|
+
T.onSelect(), p(!1);
|
|
1730
1762
|
},
|
|
1731
1763
|
className: S(
|
|
1732
1764
|
"w-full px-2 py-1.5 text-left rounded-md text-[11px] font-medium flex items-center gap-2 cursor-pointer transition-colors",
|
|
1733
|
-
|
|
1734
|
-
|
|
1765
|
+
T.destructive ? "text-destructive hover:bg-destructive/10" : "hover:bg-accent/60 hover:text-accent-foreground",
|
|
1766
|
+
T.divider && "border-t border-border/20 pt-2 mt-1"
|
|
1735
1767
|
),
|
|
1736
1768
|
children: [
|
|
1737
|
-
|
|
1738
|
-
|
|
1769
|
+
P && /* @__PURE__ */ r(P, { size: 12, className: "opacity-70" }),
|
|
1770
|
+
T.label
|
|
1739
1771
|
]
|
|
1740
1772
|
},
|
|
1741
|
-
|
|
1773
|
+
T.id
|
|
1742
1774
|
);
|
|
1743
1775
|
})
|
|
1744
1776
|
] })
|
|
1745
1777
|
}
|
|
1746
1778
|
)
|
|
1747
1779
|
] });
|
|
1748
|
-
}, tr = (
|
|
1749
|
-
const e = W((d) => d.name),
|
|
1780
|
+
}, tr = (n) => {
|
|
1781
|
+
const e = W((d) => d.name), o = W((d) => d.role), t = W((d) => d.email), a = W((d) => d.avatarUrl), s = W((d) => d.customAvatar), l = W((d) => d.updateProfile), u = W((d) => d.setCustomAvatar);
|
|
1750
1782
|
return /* @__PURE__ */ r(
|
|
1751
|
-
|
|
1783
|
+
zt,
|
|
1752
1784
|
{
|
|
1753
|
-
...
|
|
1754
|
-
profile: { name: e, role:
|
|
1785
|
+
...n,
|
|
1786
|
+
profile: { name: e, role: o, email: t, avatarUrl: s || a },
|
|
1755
1787
|
onProfileChange: l,
|
|
1756
1788
|
onAvatarChange: (d) => {
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1759
|
-
typeof
|
|
1760
|
-
},
|
|
1789
|
+
const m = new FileReader();
|
|
1790
|
+
m.onloadend = () => {
|
|
1791
|
+
typeof m.result == "string" && u(m.result);
|
|
1792
|
+
}, m.readAsDataURL(d);
|
|
1761
1793
|
}
|
|
1762
1794
|
}
|
|
1763
1795
|
);
|
|
1764
|
-
}, rr = ({ title:
|
|
1765
|
-
|
|
1796
|
+
}, rr = ({ title: n, subtitle: e, icon: o, className: t }) => /* @__PURE__ */ c("div", { className: S("flex items-center space-x-3 select-none", t), children: [
|
|
1797
|
+
o && /* @__PURE__ */ r("div", { className: "w-8 h-8 rounded-lg bg-primary/10 border border-primary/30 flex items-center justify-center text-primary shadow-inner shrink-0", children: o }),
|
|
1766
1798
|
/* @__PURE__ */ c("div", { className: "min-w-0", children: [
|
|
1767
|
-
/* @__PURE__ */ r("h1", { className: "text-xs font-black uppercase tracking-wider text-foreground font-mono truncate", children:
|
|
1799
|
+
/* @__PURE__ */ r("h1", { className: "text-xs font-black uppercase tracking-wider text-foreground font-mono truncate", children: n }),
|
|
1768
1800
|
e && /* @__PURE__ */ r("p", { className: "text-[9px] text-muted-foreground font-semibold truncate", children: e })
|
|
1769
1801
|
] })
|
|
1770
|
-
] }),
|
|
1771
|
-
const s =
|
|
1772
|
-
return
|
|
1802
|
+
] }), Pt = ({ x: n, y: e, items: o, onClose: t, className: a }) => {
|
|
1803
|
+
const s = z(null);
|
|
1804
|
+
return O(() => {
|
|
1773
1805
|
const l = (i) => {
|
|
1774
1806
|
s.current && !s.current.contains(i.target) && t();
|
|
1775
1807
|
}, u = (i) => {
|
|
@@ -1783,12 +1815,12 @@ const Et = (o, e) => {
|
|
|
1783
1815
|
{
|
|
1784
1816
|
ref: s,
|
|
1785
1817
|
role: "menu",
|
|
1786
|
-
style: { top: e, left:
|
|
1818
|
+
style: { top: e, left: n },
|
|
1787
1819
|
className: S(
|
|
1788
1820
|
"fixed z-[1000] min-w-[160px] bg-popover text-popover-foreground border shadow-md rounded-md py-1 animate-in fade-in zoom-in-95 duration-100",
|
|
1789
1821
|
a
|
|
1790
1822
|
),
|
|
1791
|
-
children:
|
|
1823
|
+
children: o.map((l, u) => /* @__PURE__ */ c(se.Fragment, { children: [
|
|
1792
1824
|
l.divider && /* @__PURE__ */ r("div", { className: "h-[1px] bg-border my-1" }),
|
|
1793
1825
|
/* @__PURE__ */ c(
|
|
1794
1826
|
"div",
|
|
@@ -1816,9 +1848,9 @@ const Et = (o, e) => {
|
|
|
1816
1848
|
}
|
|
1817
1849
|
);
|
|
1818
1850
|
}, nr = ({
|
|
1819
|
-
columns:
|
|
1851
|
+
columns: n,
|
|
1820
1852
|
data: e,
|
|
1821
|
-
onRowClick:
|
|
1853
|
+
onRowClick: o,
|
|
1822
1854
|
selectedRowId: t,
|
|
1823
1855
|
rowKey: a = "id",
|
|
1824
1856
|
virtualized: s = !0,
|
|
@@ -1827,85 +1859,85 @@ const Et = (o, e) => {
|
|
|
1827
1859
|
placeholder: i = "No data available",
|
|
1828
1860
|
className: d
|
|
1829
1861
|
}) => {
|
|
1830
|
-
const [
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
}, [
|
|
1834
|
-
const
|
|
1835
|
-
if (!
|
|
1836
|
-
const v =
|
|
1837
|
-
return e.filter((
|
|
1838
|
-
}, [e,
|
|
1839
|
-
if (!
|
|
1840
|
-
const { key: v, direction:
|
|
1841
|
-
return [...
|
|
1842
|
-
const
|
|
1843
|
-
if (
|
|
1844
|
-
if (
|
|
1862
|
+
const [m, f] = A(""), [p, N] = A(null), [k, w] = A(-1), h = z(null);
|
|
1863
|
+
O(() => {
|
|
1864
|
+
w(-1);
|
|
1865
|
+
}, [m, p]);
|
|
1866
|
+
const x = j(() => {
|
|
1867
|
+
if (!m) return e;
|
|
1868
|
+
const v = m.toLowerCase();
|
|
1869
|
+
return e.filter((E) => Object.values(E).some((I) => I == null ? !1 : String(I).toLowerCase().includes(v)));
|
|
1870
|
+
}, [e, m]), b = j(() => {
|
|
1871
|
+
if (!p) return x;
|
|
1872
|
+
const { key: v, direction: E } = p;
|
|
1873
|
+
return [...x].sort((I, K) => {
|
|
1874
|
+
const $ = I[v], M = K[v];
|
|
1875
|
+
if ($ === M) return 0;
|
|
1876
|
+
if ($ == null) return 1;
|
|
1845
1877
|
if (M == null) return -1;
|
|
1846
|
-
const
|
|
1847
|
-
if (!isNaN(
|
|
1848
|
-
return
|
|
1849
|
-
const de = String(
|
|
1850
|
-
return
|
|
1878
|
+
const ee = Number($), te = Number(M);
|
|
1879
|
+
if (!isNaN(ee) && !isNaN(te))
|
|
1880
|
+
return E === "asc" ? ee - te : te - ee;
|
|
1881
|
+
const de = String($).toLowerCase(), ce = String(M).toLowerCase();
|
|
1882
|
+
return E === "asc" ? de.localeCompare(ce) : ce.localeCompare(de);
|
|
1851
1883
|
});
|
|
1852
|
-
}, [
|
|
1853
|
-
|
|
1854
|
-
},
|
|
1855
|
-
if (!(
|
|
1884
|
+
}, [x, p]), y = (v, E) => {
|
|
1885
|
+
E !== !1 && N((I) => !I || I.key !== v ? { key: v, direction: "asc" } : I.direction === "asc" ? { key: v, direction: "desc" } : null);
|
|
1886
|
+
}, g = (v) => {
|
|
1887
|
+
if (!(b.length === 0 || u)) {
|
|
1856
1888
|
if (v.key === "ArrowDown")
|
|
1857
|
-
v.preventDefault(),
|
|
1858
|
-
const
|
|
1859
|
-
return
|
|
1889
|
+
v.preventDefault(), w((E) => {
|
|
1890
|
+
const I = E + 1;
|
|
1891
|
+
return I >= b.length ? 0 : I;
|
|
1860
1892
|
});
|
|
1861
1893
|
else if (v.key === "ArrowUp")
|
|
1862
|
-
v.preventDefault(),
|
|
1863
|
-
const
|
|
1864
|
-
return
|
|
1894
|
+
v.preventDefault(), w((E) => {
|
|
1895
|
+
const I = E - 1;
|
|
1896
|
+
return I < 0 ? b.length - 1 : I;
|
|
1865
1897
|
});
|
|
1866
|
-
else if ((v.key === "Enter" || v.key === " ") && (v.preventDefault(),
|
|
1867
|
-
const
|
|
1868
|
-
|
|
1898
|
+
else if ((v.key === "Enter" || v.key === " ") && (v.preventDefault(), k >= 0 && k < b.length)) {
|
|
1899
|
+
const E = b[k];
|
|
1900
|
+
o && o(E);
|
|
1869
1901
|
}
|
|
1870
1902
|
}
|
|
1871
|
-
},
|
|
1903
|
+
}, C = (v) => v.sortable === !1 ? null : (p == null ? void 0 : p.key) !== v.key ? /* @__PURE__ */ r(We, { size: 14, className: "text-muted-foreground/60 ml-1.5 opacity-0 group-hover:opacity-100 transition-opacity" }) : p.direction === "asc" ? /* @__PURE__ */ r(Ne, { size: 14, className: "text-primary ml-1.5" }) : /* @__PURE__ */ r(Ce, { size: 14, className: "text-primary ml-1.5" }), D = () => /* @__PURE__ */ r("tr", { role: "row", className: "border-b border-border bg-muted/30 select-none", children: n.map((v) => /* @__PURE__ */ r(
|
|
1872
1904
|
"th",
|
|
1873
1905
|
{
|
|
1874
1906
|
role: "columnheader",
|
|
1875
|
-
"aria-sort": (
|
|
1907
|
+
"aria-sort": (p == null ? void 0 : p.key) === v.key ? p.direction === "asc" ? "ascending" : "descending" : "none",
|
|
1876
1908
|
className: S(
|
|
1877
1909
|
"p-3 text-xs font-semibold text-muted-foreground uppercase tracking-wider text-left transition-colors",
|
|
1878
1910
|
v.sortable !== !1 && "cursor-pointer hover:bg-accent/30 hover:text-foreground group"
|
|
1879
1911
|
),
|
|
1880
1912
|
style: { width: v.width },
|
|
1881
|
-
onClick: () =>
|
|
1913
|
+
onClick: () => y(v.key, v.sortable),
|
|
1882
1914
|
children: /* @__PURE__ */ c("div", { className: "flex items-center", children: [
|
|
1883
1915
|
/* @__PURE__ */ r("span", { children: v.header }),
|
|
1884
|
-
|
|
1916
|
+
C(v)
|
|
1885
1917
|
] })
|
|
1886
1918
|
},
|
|
1887
1919
|
v.key
|
|
1888
|
-
)) }),
|
|
1889
|
-
const
|
|
1920
|
+
)) }), L = (v, E) => {
|
|
1921
|
+
const I = t !== void 0 && v[a] === t;
|
|
1890
1922
|
return /* @__PURE__ */ r(
|
|
1891
1923
|
"tr",
|
|
1892
1924
|
{
|
|
1893
1925
|
role: "row",
|
|
1894
|
-
"aria-selected":
|
|
1895
|
-
onClick: () =>
|
|
1926
|
+
"aria-selected": I,
|
|
1927
|
+
onClick: () => o && o(v),
|
|
1896
1928
|
className: S(
|
|
1897
1929
|
"border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
|
|
1898
|
-
|
|
1899
|
-
|
|
1930
|
+
I && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
|
|
1931
|
+
k === E && "bg-accent/60 ring-1 ring-inset ring-ring"
|
|
1900
1932
|
),
|
|
1901
|
-
children:
|
|
1902
|
-
const M = v[
|
|
1903
|
-
return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children:
|
|
1933
|
+
children: n.map(($) => {
|
|
1934
|
+
const M = v[$.key];
|
|
1935
|
+
return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: $.render ? $.render(M, v) : M != null ? String(M) : "" }, $.key);
|
|
1904
1936
|
})
|
|
1905
1937
|
},
|
|
1906
|
-
String(v[a] ||
|
|
1938
|
+
String(v[a] || E)
|
|
1907
1939
|
);
|
|
1908
|
-
},
|
|
1940
|
+
}, T = j(() => ({
|
|
1909
1941
|
Table: (v) => /* @__PURE__ */ r(
|
|
1910
1942
|
"table",
|
|
1911
1943
|
{
|
|
@@ -1914,53 +1946,53 @@ const Et = (o, e) => {
|
|
|
1914
1946
|
className: "w-full border-collapse text-left bg-background text-foreground"
|
|
1915
1947
|
}
|
|
1916
1948
|
),
|
|
1917
|
-
TableHead: se.forwardRef((v,
|
|
1918
|
-
TableBody: se.forwardRef((v,
|
|
1919
|
-
TableRow: ({ item: v, context:
|
|
1920
|
-
if (!
|
|
1921
|
-
const
|
|
1949
|
+
TableHead: se.forwardRef((v, E) => /* @__PURE__ */ r("thead", { ref: E, ...v, className: "sticky top-0 bg-background z-10 shadow-[0_1px_0_0_rgba(0,0,0,0.1)] dark:shadow-[0_1px_0_0_rgba(255,255,255,0.05)]" })),
|
|
1950
|
+
TableBody: se.forwardRef((v, E) => /* @__PURE__ */ r("tbody", { ref: E, ...v })),
|
|
1951
|
+
TableRow: ({ item: v, context: E, ...I }) => {
|
|
1952
|
+
if (!E || !v) return /* @__PURE__ */ r("tr", { ...I });
|
|
1953
|
+
const K = E.selectedRowId !== void 0 && v[E.rowKey] === E.selectedRowId, $ = E.focusedIndex === I["data-index"];
|
|
1922
1954
|
return /* @__PURE__ */ r(
|
|
1923
1955
|
"tr",
|
|
1924
1956
|
{
|
|
1925
|
-
...
|
|
1957
|
+
...I,
|
|
1926
1958
|
onClick: () => {
|
|
1927
1959
|
var M;
|
|
1928
|
-
return (M =
|
|
1960
|
+
return (M = E.onRowClick) == null ? void 0 : M.call(E, v);
|
|
1929
1961
|
},
|
|
1930
1962
|
className: S(
|
|
1931
1963
|
"border-b border-border/40 hover:bg-accent/40 transition-colors cursor-pointer text-sm outline-none",
|
|
1932
|
-
|
|
1933
|
-
|
|
1964
|
+
K && "bg-primary/10 text-primary hover:bg-primary/15 font-medium border-l-2 border-l-primary",
|
|
1965
|
+
$ && "bg-accent/60 ring-1 ring-inset ring-ring"
|
|
1934
1966
|
)
|
|
1935
1967
|
}
|
|
1936
1968
|
);
|
|
1937
1969
|
}
|
|
1938
|
-
}), []),
|
|
1939
|
-
/* @__PURE__ */ r(
|
|
1970
|
+
}), []), P = () => u ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center h-64 space-y-3", children: [
|
|
1971
|
+
/* @__PURE__ */ r(ke, { className: "animate-spin text-primary", size: 24 }),
|
|
1940
1972
|
/* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: "Loading dataset..." })
|
|
1941
|
-
] }) :
|
|
1973
|
+
] }) : b.length === 0 ? /* @__PURE__ */ c("div", { className: "flex flex-col items-center justify-center h-48 text-center px-4", children: [
|
|
1942
1974
|
/* @__PURE__ */ r("span", { className: "text-sm font-medium text-foreground", children: i }),
|
|
1943
1975
|
/* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground mt-1", children: "No items matched your search query." })
|
|
1944
1976
|
] }) : s ? /* @__PURE__ */ r("div", { className: "flex-1 min-h-[300px] h-full relative", children: /* @__PURE__ */ r(
|
|
1945
|
-
|
|
1977
|
+
Ye,
|
|
1946
1978
|
{
|
|
1947
|
-
data:
|
|
1979
|
+
data: b,
|
|
1948
1980
|
context: {
|
|
1949
1981
|
selectedRowId: t,
|
|
1950
|
-
focusedIndex:
|
|
1982
|
+
focusedIndex: k,
|
|
1951
1983
|
rowKey: a,
|
|
1952
|
-
onRowClick:
|
|
1984
|
+
onRowClick: o
|
|
1953
1985
|
},
|
|
1954
|
-
components:
|
|
1955
|
-
fixedHeaderContent:
|
|
1956
|
-
itemContent: (v,
|
|
1957
|
-
const
|
|
1958
|
-
return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children:
|
|
1986
|
+
components: T,
|
|
1987
|
+
fixedHeaderContent: D,
|
|
1988
|
+
itemContent: (v, E) => /* @__PURE__ */ r(be, { children: n.map((I) => {
|
|
1989
|
+
const K = E[I.key];
|
|
1990
|
+
return /* @__PURE__ */ r("td", { role: "gridcell", className: "p-3 align-middle truncate max-w-xs", children: I.render ? I.render(K, E) : K != null ? String(K) : "" }, I.key);
|
|
1959
1991
|
}) })
|
|
1960
1992
|
}
|
|
1961
1993
|
) }) : /* @__PURE__ */ r("div", { className: "flex-1 overflow-auto", children: /* @__PURE__ */ c("table", { role: "grid", className: "w-full border-collapse text-left bg-background text-foreground", children: [
|
|
1962
|
-
/* @__PURE__ */ r("thead", { children:
|
|
1963
|
-
/* @__PURE__ */ r("tbody", { children:
|
|
1994
|
+
/* @__PURE__ */ r("thead", { children: D() }),
|
|
1995
|
+
/* @__PURE__ */ r("tbody", { children: b.map((v, E) => L(v, E)) })
|
|
1964
1996
|
] }) });
|
|
1965
1997
|
return /* @__PURE__ */ c(
|
|
1966
1998
|
"div",
|
|
@@ -1969,7 +2001,7 @@ const Et = (o, e) => {
|
|
|
1969
2001
|
role: "region",
|
|
1970
2002
|
"aria-label": "Data Grid",
|
|
1971
2003
|
tabIndex: 0,
|
|
1972
|
-
onKeyDown:
|
|
2004
|
+
onKeyDown: g,
|
|
1973
2005
|
className: S(
|
|
1974
2006
|
"flex flex-col h-full bg-background border border-border rounded-lg shadow-sm overflow-hidden focus:outline-none focus:ring-1 focus:ring-ring focus:border-transparent",
|
|
1975
2007
|
d
|
|
@@ -1977,79 +2009,79 @@ const Et = (o, e) => {
|
|
|
1977
2009
|
children: [
|
|
1978
2010
|
l && /* @__PURE__ */ c("div", { className: "flex items-center justify-between p-3 border-b border-border bg-muted/20", children: [
|
|
1979
2011
|
/* @__PURE__ */ c("div", { className: "relative flex-1 max-w-sm", children: [
|
|
1980
|
-
/* @__PURE__ */ r(
|
|
2012
|
+
/* @__PURE__ */ r(Z, { size: 14, className: "absolute left-2.5 top-2.5 text-muted-foreground" }),
|
|
1981
2013
|
/* @__PURE__ */ r(
|
|
1982
2014
|
"input",
|
|
1983
2015
|
{
|
|
1984
2016
|
type: "text",
|
|
1985
2017
|
placeholder: "Filter table rows...",
|
|
1986
2018
|
className: "w-full bg-secondary/40 border border-border rounded-md pl-8 pr-7 py-1.5 text-xs text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-primary focus:border-transparent transition-all",
|
|
1987
|
-
value:
|
|
1988
|
-
onChange: (v) =>
|
|
2019
|
+
value: m,
|
|
2020
|
+
onChange: (v) => f(v.target.value)
|
|
1989
2021
|
}
|
|
1990
2022
|
),
|
|
1991
|
-
|
|
2023
|
+
m && /* @__PURE__ */ r(
|
|
1992
2024
|
"button",
|
|
1993
2025
|
{
|
|
1994
|
-
onClick: () =>
|
|
2026
|
+
onClick: () => f(""),
|
|
1995
2027
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
1996
2028
|
"aria-label": "Clear filter",
|
|
1997
|
-
children: /* @__PURE__ */ r(
|
|
2029
|
+
children: /* @__PURE__ */ r(B, { size: 12 })
|
|
1998
2030
|
}
|
|
1999
2031
|
)
|
|
2000
2032
|
] }),
|
|
2001
2033
|
/* @__PURE__ */ c("div", { className: "text-[11px] text-muted-foreground font-medium ml-4", children: [
|
|
2002
|
-
|
|
2034
|
+
b.length,
|
|
2003
2035
|
" of ",
|
|
2004
2036
|
e.length,
|
|
2005
2037
|
" records"
|
|
2006
2038
|
] })
|
|
2007
2039
|
] }),
|
|
2008
|
-
|
|
2040
|
+
P()
|
|
2009
2041
|
]
|
|
2010
2042
|
}
|
|
2011
2043
|
);
|
|
2012
2044
|
}, or = ({
|
|
2013
|
-
results:
|
|
2045
|
+
results: n,
|
|
2014
2046
|
onQueryChange: e,
|
|
2015
|
-
onSelect:
|
|
2047
|
+
onSelect: o,
|
|
2016
2048
|
categories: t,
|
|
2017
2049
|
placeholder: a = "Search…",
|
|
2018
2050
|
debounceMs: s = 200,
|
|
2019
2051
|
className: l
|
|
2020
2052
|
}) => {
|
|
2021
|
-
const [u, i] = A(""), [d,
|
|
2022
|
-
() =>
|
|
2023
|
-
[
|
|
2053
|
+
const [u, i] = A(""), [d, m] = A(!1), [f, p] = A(0), N = z(null), k = z(null), w = j(() => t || [...new Set(n.map((y) => y.category))], [t, n]), h = j(
|
|
2054
|
+
() => w.flatMap((y) => n.filter((g) => g.category === y)),
|
|
2055
|
+
[w, n]
|
|
2024
2056
|
);
|
|
2025
|
-
|
|
2026
|
-
const
|
|
2027
|
-
|
|
2057
|
+
O(() => {
|
|
2058
|
+
const y = (g) => {
|
|
2059
|
+
N.current && !N.current.contains(g.target) && m(!1);
|
|
2028
2060
|
};
|
|
2029
|
-
return document.addEventListener("mousedown",
|
|
2030
|
-
}, []),
|
|
2061
|
+
return document.addEventListener("mousedown", y), () => document.removeEventListener("mousedown", y);
|
|
2062
|
+
}, []), O(() => {
|
|
2031
2063
|
if (!e) return;
|
|
2032
|
-
const
|
|
2033
|
-
return () => window.clearTimeout(
|
|
2034
|
-
}, [u, s, e]),
|
|
2035
|
-
|
|
2036
|
-
}, [
|
|
2037
|
-
const
|
|
2038
|
-
|
|
2039
|
-
},
|
|
2040
|
-
var
|
|
2064
|
+
const y = window.setTimeout(() => e(u), s);
|
|
2065
|
+
return () => window.clearTimeout(y);
|
|
2066
|
+
}, [u, s, e]), O(() => {
|
|
2067
|
+
p(0);
|
|
2068
|
+
}, [n]);
|
|
2069
|
+
const x = (y) => {
|
|
2070
|
+
o(y), m(!1), i("");
|
|
2071
|
+
}, b = (y) => {
|
|
2072
|
+
var g;
|
|
2041
2073
|
if (!d) {
|
|
2042
|
-
(
|
|
2074
|
+
(y.key === "ArrowDown" || y.key === "Enter") && m(!0);
|
|
2043
2075
|
return;
|
|
2044
2076
|
}
|
|
2045
|
-
|
|
2046
|
-
(
|
|
2047
|
-
)) :
|
|
2077
|
+
y.key === "ArrowDown" ? (y.preventDefault(), p((C) => h.length ? (C + 1) % h.length : 0)) : y.key === "ArrowUp" ? (y.preventDefault(), p(
|
|
2078
|
+
(C) => h.length ? (C - 1 + h.length) % h.length : 0
|
|
2079
|
+
)) : y.key === "Enter" ? (y.preventDefault(), h[f] && x(h[f])) : y.key === "Escape" && (y.preventDefault(), m(!1), (g = k.current) == null || g.blur());
|
|
2048
2080
|
};
|
|
2049
|
-
return /* @__PURE__ */ c("div", { ref:
|
|
2081
|
+
return /* @__PURE__ */ c("div", { ref: N, className: S("relative w-full", l), children: [
|
|
2050
2082
|
/* @__PURE__ */ c("div", { className: "relative flex items-center", children: [
|
|
2051
2083
|
/* @__PURE__ */ r(
|
|
2052
|
-
|
|
2084
|
+
Z,
|
|
2053
2085
|
{
|
|
2054
2086
|
size: 13,
|
|
2055
2087
|
className: "absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"
|
|
@@ -2058,18 +2090,18 @@ const Et = (o, e) => {
|
|
|
2058
2090
|
/* @__PURE__ */ r(
|
|
2059
2091
|
"input",
|
|
2060
2092
|
{
|
|
2061
|
-
ref:
|
|
2093
|
+
ref: k,
|
|
2062
2094
|
type: "text",
|
|
2063
2095
|
role: "combobox",
|
|
2064
2096
|
"aria-expanded": d,
|
|
2065
2097
|
"aria-label": a,
|
|
2066
2098
|
value: u,
|
|
2067
2099
|
placeholder: a,
|
|
2068
|
-
onChange: (
|
|
2069
|
-
i(
|
|
2100
|
+
onChange: (y) => {
|
|
2101
|
+
i(y.target.value), m(!0);
|
|
2070
2102
|
},
|
|
2071
|
-
onFocus: () =>
|
|
2072
|
-
onKeyDown:
|
|
2103
|
+
onFocus: () => m(!0),
|
|
2104
|
+
onKeyDown: b,
|
|
2073
2105
|
className: "w-full h-7 pl-8 pr-7 bg-secondary/35 border border-border/40 rounded-md text-xs text-foreground placeholder:text-muted-foreground/75 focus:outline-none focus:ring-1 focus:ring-primary/40 focus:bg-background/95 focus:border-primary/50 transition-all font-sans"
|
|
2074
2106
|
}
|
|
2075
2107
|
),
|
|
@@ -2078,12 +2110,12 @@ const Et = (o, e) => {
|
|
|
2078
2110
|
{
|
|
2079
2111
|
type: "button",
|
|
2080
2112
|
onClick: () => {
|
|
2081
|
-
var
|
|
2082
|
-
i(""), (
|
|
2113
|
+
var y;
|
|
2114
|
+
i(""), (y = k.current) == null || y.focus();
|
|
2083
2115
|
},
|
|
2084
2116
|
"aria-label": "Clear search",
|
|
2085
2117
|
className: "absolute right-2 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",
|
|
2086
|
-
children: /* @__PURE__ */ r(
|
|
2118
|
+
children: /* @__PURE__ */ r(B, { size: 11 })
|
|
2087
2119
|
}
|
|
2088
2120
|
)
|
|
2089
2121
|
] }),
|
|
@@ -2097,44 +2129,44 @@ const Et = (o, e) => {
|
|
|
2097
2129
|
'No results found matching "',
|
|
2098
2130
|
u,
|
|
2099
2131
|
'"'
|
|
2100
|
-
] }) :
|
|
2101
|
-
const
|
|
2102
|
-
return
|
|
2103
|
-
/* @__PURE__ */ r("div", { className: "px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-muted-foreground/80 bg-muted/40 border-y border-border/20 first:border-t-0", children:
|
|
2104
|
-
|
|
2105
|
-
const
|
|
2132
|
+
] }) : w.map((y) => {
|
|
2133
|
+
const g = n.filter((C) => C.category === y);
|
|
2134
|
+
return g.length === 0 ? null : /* @__PURE__ */ c("div", { className: "flex flex-col", children: [
|
|
2135
|
+
/* @__PURE__ */ r("div", { className: "px-3 py-1 text-[9px] font-bold uppercase tracking-wider text-muted-foreground/80 bg-muted/40 border-y border-border/20 first:border-t-0", children: y }),
|
|
2136
|
+
g.map((C) => {
|
|
2137
|
+
const D = C.icon, L = h.indexOf(C), T = L === f;
|
|
2106
2138
|
return /* @__PURE__ */ c(
|
|
2107
2139
|
"div",
|
|
2108
2140
|
{
|
|
2109
2141
|
role: "option",
|
|
2110
|
-
"aria-selected":
|
|
2111
|
-
onClick: () =>
|
|
2112
|
-
onMouseEnter: () =>
|
|
2142
|
+
"aria-selected": T,
|
|
2143
|
+
onClick: () => x(C),
|
|
2144
|
+
onMouseEnter: () => p(L),
|
|
2113
2145
|
className: S(
|
|
2114
2146
|
"px-3 py-2 cursor-pointer flex items-start space-x-2.5 transition-colors border-l-2",
|
|
2115
|
-
|
|
2147
|
+
T ? "bg-accent text-accent-foreground border-primary" : "border-transparent hover:bg-accent/40"
|
|
2116
2148
|
),
|
|
2117
2149
|
children: [
|
|
2118
|
-
|
|
2150
|
+
D && /* @__PURE__ */ r(
|
|
2119
2151
|
"div",
|
|
2120
2152
|
{
|
|
2121
2153
|
className: S(
|
|
2122
2154
|
"mt-0.5 p-1 rounded bg-muted/50",
|
|
2123
|
-
|
|
2155
|
+
T && "bg-background text-primary"
|
|
2124
2156
|
),
|
|
2125
|
-
children: /* @__PURE__ */ r(
|
|
2157
|
+
children: /* @__PURE__ */ r(D, { size: 12 })
|
|
2126
2158
|
}
|
|
2127
2159
|
),
|
|
2128
2160
|
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
2129
|
-
/* @__PURE__ */ r("div", { className: "text-xs font-medium truncate", children:
|
|
2130
|
-
|
|
2161
|
+
/* @__PURE__ */ r("div", { className: "text-xs font-medium truncate", children: C.title }),
|
|
2162
|
+
C.description && /* @__PURE__ */ r("div", { className: "text-[10px] text-muted-foreground truncate mt-0.5", children: C.description })
|
|
2131
2163
|
] })
|
|
2132
2164
|
]
|
|
2133
2165
|
},
|
|
2134
|
-
`${
|
|
2166
|
+
`${C.category}-${C.id}`
|
|
2135
2167
|
);
|
|
2136
2168
|
})
|
|
2137
|
-
] },
|
|
2169
|
+
] }, y);
|
|
2138
2170
|
}) }),
|
|
2139
2171
|
h.length > 0 && /* @__PURE__ */ c("div", { className: "px-3 py-1.5 border-t border-border bg-muted/20 flex items-center justify-between text-[9px] text-muted-foreground select-none shrink-0 font-mono", children: [
|
|
2140
2172
|
/* @__PURE__ */ c("div", { className: "flex space-x-2", children: [
|
|
@@ -2156,42 +2188,42 @@ const Et = (o, e) => {
|
|
|
2156
2188
|
)
|
|
2157
2189
|
] });
|
|
2158
2190
|
}, sr = ({
|
|
2159
|
-
placeholder:
|
|
2191
|
+
placeholder: n = "Search...",
|
|
2160
2192
|
onSearch: e,
|
|
2161
|
-
results:
|
|
2193
|
+
results: o,
|
|
2162
2194
|
onSelect: t,
|
|
2163
2195
|
suggestions: a = [],
|
|
2164
2196
|
loading: s = !1,
|
|
2165
2197
|
className: l
|
|
2166
2198
|
}) => {
|
|
2167
|
-
const [u, i] = A(""), [d,
|
|
2168
|
-
|
|
2199
|
+
const [u, i] = A(""), [d, m] = A(!1), [f, p] = A(-1), N = z(null);
|
|
2200
|
+
O(() => {
|
|
2169
2201
|
const h = setTimeout(() => {
|
|
2170
2202
|
e(u);
|
|
2171
2203
|
}, 300);
|
|
2172
2204
|
return () => clearTimeout(h);
|
|
2173
2205
|
}, [u, e]);
|
|
2174
|
-
const
|
|
2206
|
+
const k = a.filter(
|
|
2175
2207
|
(h) => h.toLowerCase().includes(u.toLowerCase()) && h.toLowerCase() !== u.toLowerCase()
|
|
2176
|
-
),
|
|
2177
|
-
d &&
|
|
2208
|
+
), w = (h) => {
|
|
2209
|
+
d && k.length > 0 && (h.key === "ArrowDown" ? (h.preventDefault(), p((x) => (x + 1) % k.length)) : h.key === "ArrowUp" ? (h.preventDefault(), p((x) => (x - 1 + k.length) % k.length)) : h.key === "Enter" && f >= 0 && (h.preventDefault(), i(k[f]), m(!1)));
|
|
2178
2210
|
};
|
|
2179
|
-
return /* @__PURE__ */ c("div", { ref:
|
|
2211
|
+
return /* @__PURE__ */ c("div", { ref: N, className: S("flex flex-col h-full bg-background", l), children: [
|
|
2180
2212
|
/* @__PURE__ */ c("div", { className: "p-3 border-b border-border/50", children: [
|
|
2181
2213
|
/* @__PURE__ */ c("div", { className: "relative", children: [
|
|
2182
|
-
/* @__PURE__ */ r("div", { className: "absolute left-2.5 top-2.5 text-muted-foreground", children: s ? /* @__PURE__ */ r(
|
|
2214
|
+
/* @__PURE__ */ r("div", { className: "absolute left-2.5 top-2.5 text-muted-foreground", children: s ? /* @__PURE__ */ r(ke, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ r(Z, { size: 14 }) }),
|
|
2183
2215
|
/* @__PURE__ */ r(
|
|
2184
2216
|
"input",
|
|
2185
2217
|
{
|
|
2186
2218
|
type: "text",
|
|
2187
2219
|
className: "w-full bg-secondary/50 border border-border rounded-md pl-9 pr-8 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary focus:border-transparent transition-all",
|
|
2188
|
-
placeholder:
|
|
2220
|
+
placeholder: n,
|
|
2189
2221
|
value: u,
|
|
2190
2222
|
onChange: (h) => {
|
|
2191
|
-
i(h.target.value),
|
|
2223
|
+
i(h.target.value), m(!0), p(-1);
|
|
2192
2224
|
},
|
|
2193
|
-
onKeyDown:
|
|
2194
|
-
onFocus: () =>
|
|
2225
|
+
onKeyDown: w,
|
|
2226
|
+
onFocus: () => m(!0)
|
|
2195
2227
|
}
|
|
2196
2228
|
),
|
|
2197
2229
|
u && /* @__PURE__ */ r(
|
|
@@ -2201,37 +2233,37 @@ const Et = (o, e) => {
|
|
|
2201
2233
|
i(""), e("");
|
|
2202
2234
|
},
|
|
2203
2235
|
className: "absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",
|
|
2204
|
-
children: /* @__PURE__ */ r(
|
|
2236
|
+
children: /* @__PURE__ */ r(B, { size: 14 })
|
|
2205
2237
|
}
|
|
2206
2238
|
)
|
|
2207
2239
|
] }),
|
|
2208
|
-
d &&
|
|
2240
|
+
d && k.length > 0 && /* @__PURE__ */ r("div", { className: "absolute left-3 right-3 mt-1 bg-popover border shadow-lg rounded-md z-50 py-1 overflow-hidden", children: k.map((h, x) => /* @__PURE__ */ c(
|
|
2209
2241
|
"div",
|
|
2210
2242
|
{
|
|
2211
2243
|
className: S(
|
|
2212
2244
|
"px-3 py-1.5 text-xs cursor-pointer flex items-center space-x-2",
|
|
2213
|
-
|
|
2245
|
+
x === f ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
|
|
2214
2246
|
),
|
|
2215
2247
|
onClick: () => {
|
|
2216
|
-
i(h),
|
|
2248
|
+
i(h), m(!1);
|
|
2217
2249
|
},
|
|
2218
2250
|
children: [
|
|
2219
|
-
/* @__PURE__ */ r(
|
|
2251
|
+
/* @__PURE__ */ r(Je, { size: 12, className: "text-muted-foreground" }),
|
|
2220
2252
|
/* @__PURE__ */ r("span", { children: h })
|
|
2221
2253
|
]
|
|
2222
2254
|
},
|
|
2223
2255
|
h
|
|
2224
2256
|
)) })
|
|
2225
2257
|
] }),
|
|
2226
|
-
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children:
|
|
2227
|
-
const
|
|
2258
|
+
/* @__PURE__ */ r("div", { className: "flex-1 overflow-y-auto", children: o.length === 0 ? /* @__PURE__ */ r("div", { className: "p-8 text-center text-xs text-muted-foreground italic", children: u ? `No results found for "${u}"` : "Type to start searching..." }) : /* @__PURE__ */ r("div", { className: "py-2", children: o.map((h) => {
|
|
2259
|
+
const x = h.icon;
|
|
2228
2260
|
return /* @__PURE__ */ r(
|
|
2229
2261
|
"div",
|
|
2230
2262
|
{
|
|
2231
2263
|
onClick: () => t(h),
|
|
2232
2264
|
className: "px-4 py-2 hover:bg-accent/50 cursor-pointer group transition-colors border-l-2 border-transparent hover:border-primary",
|
|
2233
2265
|
children: /* @__PURE__ */ c("div", { className: "flex items-start space-x-3", children: [
|
|
2234
|
-
|
|
2266
|
+
x && /* @__PURE__ */ r("div", { className: "mt-0.5 p-1 rounded bg-muted group-hover:bg-background transition-colors", children: /* @__PURE__ */ r(x, { size: 14, className: "text-muted-foreground group-hover:text-primary" }) }),
|
|
2235
2267
|
/* @__PURE__ */ c("div", { className: "flex-1 min-w-0", children: [
|
|
2236
2268
|
/* @__PURE__ */ c("div", { className: "flex items-center justify-between", children: [
|
|
2237
2269
|
/* @__PURE__ */ r("span", { className: "text-xs font-medium truncate", children: h.title }),
|
|
@@ -2245,103 +2277,77 @@ const Et = (o, e) => {
|
|
|
2245
2277
|
);
|
|
2246
2278
|
}) }) })
|
|
2247
2279
|
] });
|
|
2248
|
-
},
|
|
2249
|
-
|
|
2280
|
+
}, Ie = (n, e = 0) => n.reduce((o, t) => (o.push({ ...t, level: e }), t.isOpen && t.children && o.push(...Ie(t.children, e + 1)), o), []), $t = (n) => {
|
|
2281
|
+
if (!n) return ["background"];
|
|
2282
|
+
const e = [n.isBranch ? "branch" : "leaf"];
|
|
2283
|
+
return n.kind && e.push(n.kind), e;
|
|
2284
|
+
}, ar = ({
|
|
2285
|
+
data: n,
|
|
2250
2286
|
onToggle: e,
|
|
2251
|
-
onActivate:
|
|
2287
|
+
onActivate: o,
|
|
2252
2288
|
onMoveNode: t,
|
|
2253
|
-
actions: a,
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
indent: d = 12,
|
|
2259
|
-
virtualized: f = !0,
|
|
2260
|
-
className: p
|
|
2289
|
+
actions: a = [],
|
|
2290
|
+
indent: s = 12,
|
|
2291
|
+
virtualized: l = !0,
|
|
2292
|
+
"aria-label": u = "Tree",
|
|
2293
|
+
className: i
|
|
2261
2294
|
}) => {
|
|
2262
|
-
const [
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
}, [
|
|
2266
|
-
const
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
},
|
|
2279
|
-
{
|
|
2280
|
-
id: "rename",
|
|
2281
|
-
label: "Rename",
|
|
2282
|
-
icon: /* @__PURE__ */ r(Ge, { size: 14 }),
|
|
2283
|
-
divider: !0,
|
|
2284
|
-
showFor: ["file", "folder"],
|
|
2285
|
-
onSelect: ({ nodeId: g }) => g && (u == null ? void 0 : u(g))
|
|
2286
|
-
},
|
|
2287
|
-
{
|
|
2288
|
-
id: "delete",
|
|
2289
|
-
label: "Delete",
|
|
2290
|
-
icon: /* @__PURE__ */ r(Ve, { size: 14, className: "text-destructive" }),
|
|
2291
|
-
showFor: ["file", "folder"],
|
|
2292
|
-
onSelect: ({ nodeId: g }) => g && (i == null ? void 0 : i(g))
|
|
2293
|
-
}
|
|
2294
|
-
]).filter(
|
|
2295
|
-
(g) => !g.showFor || m && g.showFor.includes(m.scope)
|
|
2296
|
-
).map((g) => ({
|
|
2297
|
-
label: g.label,
|
|
2298
|
-
icon: g.icon,
|
|
2299
|
-
divider: g.divider,
|
|
2300
|
-
onClick: () => m && g.onSelect(m.context)
|
|
2301
|
-
})), N = (g, b, E) => {
|
|
2302
|
-
g.preventDefault(), g.stopPropagation(), k({
|
|
2303
|
-
x: g.clientX,
|
|
2304
|
-
y: g.clientY,
|
|
2305
|
-
scope: E,
|
|
2295
|
+
const [d, m] = A(null), [f, p] = A(null), N = j(() => Ie(n), [n]);
|
|
2296
|
+
O(() => {
|
|
2297
|
+
p(null);
|
|
2298
|
+
}, [n]);
|
|
2299
|
+
const k = a.filter(
|
|
2300
|
+
(x) => !x.showFor || d && x.showFor.some((b) => d.scopes.includes(b))
|
|
2301
|
+
).map((x) => ({
|
|
2302
|
+
label: x.label,
|
|
2303
|
+
icon: x.icon,
|
|
2304
|
+
divider: x.divider,
|
|
2305
|
+
onClick: () => d && x.onSelect(d.context)
|
|
2306
|
+
})), w = (x, b) => {
|
|
2307
|
+
a.length !== 0 && (x.preventDefault(), x.stopPropagation(), m({
|
|
2308
|
+
x: x.clientX,
|
|
2309
|
+
y: x.clientY,
|
|
2310
|
+
scopes: $t(b),
|
|
2306
2311
|
context: { nodeId: (b == null ? void 0 : b.id) ?? null, node: b }
|
|
2307
|
-
});
|
|
2308
|
-
},
|
|
2309
|
-
const b =
|
|
2312
|
+
}));
|
|
2313
|
+
}, h = (x) => {
|
|
2314
|
+
const b = N[x], y = !!b.isBranch;
|
|
2310
2315
|
return /* @__PURE__ */ c(
|
|
2311
2316
|
"div",
|
|
2312
2317
|
{
|
|
2313
2318
|
role: "treeitem",
|
|
2314
|
-
"aria-expanded":
|
|
2319
|
+
"aria-expanded": y ? !!b.isOpen : void 0,
|
|
2315
2320
|
"aria-level": b.level + 1,
|
|
2316
2321
|
tabIndex: 0,
|
|
2317
2322
|
draggable: !0,
|
|
2318
|
-
onDragStart: (
|
|
2319
|
-
|
|
2323
|
+
onDragStart: (g) => {
|
|
2324
|
+
g.dataTransfer.setData("text/plain", b.id), g.dataTransfer.effectAllowed = "move";
|
|
2320
2325
|
},
|
|
2321
|
-
onDragOver: (
|
|
2322
|
-
|
|
2326
|
+
onDragOver: (g) => {
|
|
2327
|
+
y && (g.preventDefault(), p(b.id));
|
|
2323
2328
|
},
|
|
2324
|
-
onDragLeave: () =>
|
|
2325
|
-
onDrop: (
|
|
2326
|
-
|
|
2327
|
-
const
|
|
2328
|
-
|
|
2329
|
+
onDragLeave: () => p(null),
|
|
2330
|
+
onDrop: (g) => {
|
|
2331
|
+
g.preventDefault(), p(null);
|
|
2332
|
+
const C = g.dataTransfer.getData("text/plain");
|
|
2333
|
+
C && C !== b.id && y && (t == null || t(C, b.id));
|
|
2329
2334
|
},
|
|
2330
|
-
onClick: () =>
|
|
2331
|
-
onDoubleClick: () =>
|
|
2332
|
-
onKeyDown: (
|
|
2333
|
-
|
|
2335
|
+
onClick: () => y && (e == null ? void 0 : e(b)),
|
|
2336
|
+
onDoubleClick: () => o == null ? void 0 : o(b),
|
|
2337
|
+
onKeyDown: (g) => {
|
|
2338
|
+
g.key === "Enter" && (g.preventDefault(), y ? e == null || e(b) : o == null || o(b));
|
|
2334
2339
|
},
|
|
2335
|
-
onContextMenu: (
|
|
2336
|
-
style: { paddingLeft: `${b.level *
|
|
2340
|
+
onContextMenu: (g) => w(g, b),
|
|
2341
|
+
style: { paddingLeft: `${b.level * s + 8}px` },
|
|
2337
2342
|
className: S(
|
|
2338
2343
|
"flex items-center py-1 px-2 cursor-pointer hover:bg-accent hover:text-accent-foreground select-none text-xs",
|
|
2339
2344
|
"transition-colors duration-150 relative focus:outline-none focus:ring-1 focus:ring-ring",
|
|
2340
|
-
|
|
2345
|
+
f === b.id && "bg-primary/20 ring-1 ring-primary/50 rounded-sm",
|
|
2346
|
+
b.className
|
|
2341
2347
|
),
|
|
2342
2348
|
children: [
|
|
2343
|
-
/* @__PURE__ */ r("div", { className: "w-4 h-4 mr-1 flex items-center justify-center", children:
|
|
2344
|
-
/* @__PURE__ */ r("div", { className: "mr-2
|
|
2349
|
+
/* @__PURE__ */ r("div", { className: "w-4 h-4 mr-1 flex items-center justify-center shrink-0", children: y && (b.isOpen ? /* @__PURE__ */ r(Ce, { size: 14 }) : /* @__PURE__ */ r(we, { size: 14 })) }),
|
|
2350
|
+
b.icon && /* @__PURE__ */ r("div", { className: "mr-2 flex items-center shrink-0", children: b.icon }),
|
|
2345
2351
|
/* @__PURE__ */ r("span", { className: "truncate", children: b.label })
|
|
2346
2352
|
]
|
|
2347
2353
|
},
|
|
@@ -2352,24 +2358,25 @@ const Et = (o, e) => {
|
|
|
2352
2358
|
"div",
|
|
2353
2359
|
{
|
|
2354
2360
|
role: "tree",
|
|
2355
|
-
|
|
2356
|
-
|
|
2361
|
+
"aria-label": u,
|
|
2362
|
+
className: S("h-full w-full bg-muted/30", i),
|
|
2363
|
+
onContextMenu: (x) => w(x, null),
|
|
2357
2364
|
children: [
|
|
2358
|
-
|
|
2359
|
-
|
|
2365
|
+
l ? /* @__PURE__ */ r(
|
|
2366
|
+
qe,
|
|
2360
2367
|
{
|
|
2361
2368
|
style: { height: "100%" },
|
|
2362
|
-
totalCount:
|
|
2363
|
-
itemContent:
|
|
2369
|
+
totalCount: N.length,
|
|
2370
|
+
itemContent: h
|
|
2364
2371
|
}
|
|
2365
|
-
) : /* @__PURE__ */ r("div", { className: "h-full overflow-auto", children:
|
|
2366
|
-
|
|
2367
|
-
|
|
2372
|
+
) : /* @__PURE__ */ r("div", { className: "h-full overflow-auto", children: N.map((x, b) => h(b)) }),
|
|
2373
|
+
d && k.length > 0 && /* @__PURE__ */ r(
|
|
2374
|
+
Pt,
|
|
2368
2375
|
{
|
|
2369
|
-
x:
|
|
2370
|
-
y:
|
|
2371
|
-
items:
|
|
2372
|
-
onClose: () =>
|
|
2376
|
+
x: d.x,
|
|
2377
|
+
y: d.y,
|
|
2378
|
+
items: k,
|
|
2379
|
+
onClose: () => m(null)
|
|
2373
2380
|
}
|
|
2374
2381
|
)
|
|
2375
2382
|
]
|
|
@@ -2377,52 +2384,55 @@ const Et = (o, e) => {
|
|
|
2377
2384
|
);
|
|
2378
2385
|
};
|
|
2379
2386
|
export {
|
|
2380
|
-
|
|
2387
|
+
Xe as ActivityBar,
|
|
2381
2388
|
rr as AppTitle,
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2389
|
+
X as BUNDLED_THEMES,
|
|
2390
|
+
dt as BUNDLED_THEME_CLASSES,
|
|
2391
|
+
tt as ChatPane,
|
|
2392
|
+
Dt as CommandPalette,
|
|
2393
|
+
lt as CommandRegistry,
|
|
2394
|
+
Ze as ConnectedActivityBar,
|
|
2395
|
+
ot as ConnectedChatPane,
|
|
2387
2396
|
Xt as ConnectedCommandPalette,
|
|
2388
|
-
|
|
2397
|
+
it as ConnectedMenuBar,
|
|
2389
2398
|
Zt as ConnectedModal,
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2399
|
+
pt as ConnectedSidebarPane,
|
|
2400
|
+
ht as ConnectedStatusBar,
|
|
2401
|
+
vt as ConnectedTerminalPane,
|
|
2393
2402
|
er as ConnectedThemeSwitcher,
|
|
2394
2403
|
tr as ConnectedUserProfile,
|
|
2395
|
-
|
|
2404
|
+
Pt as ContextMenu,
|
|
2396
2405
|
Vt as DEFAULT_COMMAND_IDS,
|
|
2397
|
-
|
|
2406
|
+
mt as DEFAULT_SETTINGS_THEMES,
|
|
2398
2407
|
Lt as DEFAULT_THEME_OPTIONS,
|
|
2399
2408
|
nr as DataGrid,
|
|
2400
|
-
|
|
2401
|
-
|
|
2409
|
+
st as MenuBar,
|
|
2410
|
+
at as MenuRegistry,
|
|
2402
2411
|
At as Modal,
|
|
2403
2412
|
Gt as NexusWorkspaceShell,
|
|
2404
2413
|
or as QuickSearch,
|
|
2405
2414
|
sr as SearchWidget,
|
|
2406
|
-
|
|
2415
|
+
ft as SettingsPanel,
|
|
2407
2416
|
Gt as ShellLayout,
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2417
|
+
ne as SidebarPane,
|
|
2418
|
+
gt as StatusBar,
|
|
2419
|
+
bt as TerminalPane,
|
|
2411
2420
|
Mt as ThemeSwitcher,
|
|
2412
2421
|
ar as TreeWidget,
|
|
2413
|
-
|
|
2422
|
+
zt as UserProfile,
|
|
2414
2423
|
S as cn,
|
|
2415
|
-
|
|
2416
|
-
|
|
2424
|
+
J as commandRegistry,
|
|
2425
|
+
wt as componentRegistry,
|
|
2417
2426
|
Yt as initializeShell,
|
|
2418
2427
|
le as menuRegistry,
|
|
2419
2428
|
qt as pluginRegistry,
|
|
2429
|
+
ct as themeClass,
|
|
2420
2430
|
Q as useChatStore,
|
|
2421
2431
|
Qt as useKeyboardShortcuts,
|
|
2422
|
-
|
|
2423
|
-
|
|
2432
|
+
Nt as useLayoutStore,
|
|
2433
|
+
Ee as useModalStore,
|
|
2424
2434
|
ae as useRightSidebarStore,
|
|
2425
|
-
|
|
2435
|
+
U as useSidebarStore,
|
|
2426
2436
|
ie as useStatusBarStore,
|
|
2427
2437
|
V as useTerminalStore,
|
|
2428
2438
|
Y as useThemeStore,
|