@principal-ade/panel-layouts 0.2.1 → 0.2.3
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/dist/index.d.ts +243 -0
- package/dist/index.esm.js +889 -558
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import './index.css';var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { EditableConfigurablePanelLayout as
|
|
5
|
-
import
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { useTheme as
|
|
1
|
+
import './index.css';var X = Object.defineProperty;
|
|
2
|
+
var G = (a, e, t) => e in a ? X(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var _ = (a, e, t) => G(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { EditableConfigurablePanelLayout as Be, ResponsiveConfigurablePanelLayout as Je, mapThemeToPanelVars as He, mapThemeToTabVars as Xe } from "@principal-ade/panels";
|
|
5
|
+
import Y, { useState as A, useRef as W, useEffect as P, useCallback as g, forwardRef as Q, useMemo as q } from "react";
|
|
6
|
+
import { jsx as R, jsxs as I, Fragment as U } from "react/jsx-runtime";
|
|
7
|
+
import { useTheme as O } from "@principal-ade/industry-theme";
|
|
8
8
|
class Z {
|
|
9
9
|
constructor() {
|
|
10
|
-
|
|
10
|
+
_(this, "storageKey", "panel-layouts");
|
|
11
11
|
}
|
|
12
12
|
async load(e) {
|
|
13
13
|
try {
|
|
@@ -23,127 +23,127 @@ class Z {
|
|
|
23
23
|
`${this.storageKey}:${e}`,
|
|
24
24
|
JSON.stringify(t)
|
|
25
25
|
);
|
|
26
|
-
} catch (
|
|
27
|
-
console.error(`Failed to save panel layout for ${e}:`,
|
|
26
|
+
} catch (o) {
|
|
27
|
+
console.error(`Failed to save panel layout for ${e}:`, o);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function Ce(a) {
|
|
32
32
|
const {
|
|
33
33
|
viewKey: e,
|
|
34
34
|
defaultSizes: t,
|
|
35
|
-
panelType:
|
|
35
|
+
panelType: o,
|
|
36
36
|
adapter: s = new Z()
|
|
37
|
-
} =
|
|
37
|
+
} = a, [r, n] = A(t), [i, m] = A(a.collapsed), y = W(a.collapsed), h = W({}), d = W(null), u = W(null);
|
|
38
38
|
P(() => {
|
|
39
39
|
(async () => {
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const x = await s.load(e);
|
|
41
|
+
x != null && x.sizes && (n(x.sizes), f(x.sizes));
|
|
42
42
|
})();
|
|
43
43
|
}, [e]);
|
|
44
|
-
const
|
|
45
|
-
(
|
|
46
|
-
"left" in
|
|
44
|
+
const f = g(
|
|
45
|
+
(w) => {
|
|
46
|
+
"left" in w && w.left > 0 && (h.current.left = w.left), "middle" in w && w.middle > 0 && (h.current.middle = w.middle), "right" in w && w.right > 0 && (h.current.right = w.right);
|
|
47
47
|
},
|
|
48
48
|
[]
|
|
49
|
-
), c =
|
|
50
|
-
(
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
53
|
-
return
|
|
54
|
-
if (
|
|
49
|
+
), c = g(
|
|
50
|
+
(w) => {
|
|
51
|
+
const x = h.current[w];
|
|
52
|
+
if (x && x > 0)
|
|
53
|
+
return x;
|
|
54
|
+
if (w === "left" && "left" in t && t.left > 0)
|
|
55
55
|
return t.left;
|
|
56
|
-
if (
|
|
56
|
+
if (w === "right" && "right" in t && t.right > 0)
|
|
57
57
|
return t.right;
|
|
58
58
|
},
|
|
59
59
|
[t]
|
|
60
|
-
),
|
|
60
|
+
), l = W(t);
|
|
61
61
|
P(() => {
|
|
62
|
-
("left" in t && t.left !==
|
|
63
|
-
}, [t,
|
|
64
|
-
const
|
|
65
|
-
(
|
|
66
|
-
}, [
|
|
67
|
-
const
|
|
68
|
-
async (
|
|
62
|
+
("left" in t && t.left !== l.current.left || "middle" in t && "middle" in l.current && t.middle !== l.current.middle || "right" in t && t.right !== l.current.right) && (n(t), f(t), l.current = t);
|
|
63
|
+
}, [t, f]), P(() => {
|
|
64
|
+
const w = a.collapsed.left !== y.current.left, x = "right" in a.collapsed && "right" in y.current && a.collapsed.right !== y.current.right;
|
|
65
|
+
(w || x) && (m(a.collapsed), y.current = { ...a.collapsed });
|
|
66
|
+
}, [a.collapsed.left, a.collapsed.right]);
|
|
67
|
+
const b = g(
|
|
68
|
+
async (w) => {
|
|
69
69
|
try {
|
|
70
|
-
await s.save(e, { sizes:
|
|
71
|
-
} catch (
|
|
70
|
+
await s.save(e, { sizes: w });
|
|
71
|
+
} catch (x) {
|
|
72
72
|
console.error(
|
|
73
73
|
`Failed to save panel preferences for ${e}:`,
|
|
74
|
-
|
|
74
|
+
x
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
77
|
},
|
|
78
78
|
[e, s]
|
|
79
|
-
), S =
|
|
80
|
-
(
|
|
81
|
-
const
|
|
82
|
-
let
|
|
83
|
-
if ("left" in
|
|
84
|
-
const k = !!(
|
|
79
|
+
), S = g(
|
|
80
|
+
(w) => {
|
|
81
|
+
const x = { ...w };
|
|
82
|
+
let v = !0;
|
|
83
|
+
if ("left" in w) {
|
|
84
|
+
const k = !!(i != null && i.left), p = w.left;
|
|
85
85
|
if (k) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
} else
|
|
86
|
+
const C = c("left");
|
|
87
|
+
C !== void 0 && C > 0 ? x.left = C : v = !1;
|
|
88
|
+
} else p === 0 && (v = !1);
|
|
89
89
|
}
|
|
90
|
-
if (
|
|
91
|
-
const k = !!(
|
|
90
|
+
if (o === "three-panel" && "right" in w) {
|
|
91
|
+
const k = !!(i != null && i.right), p = w.right;
|
|
92
92
|
if (k) {
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
} else
|
|
93
|
+
const C = c("right");
|
|
94
|
+
C !== void 0 && C > 0 ? x.right = C : v = !1;
|
|
95
|
+
} else p === 0 && (v = !1);
|
|
96
96
|
}
|
|
97
|
-
if (
|
|
98
|
-
|
|
97
|
+
if (n(x), f(x), d.current && (clearTimeout(d.current), d.current = null), !v) {
|
|
98
|
+
u.current = null;
|
|
99
99
|
return;
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
const k =
|
|
103
|
-
k && (
|
|
101
|
+
u.current = x, d.current = setTimeout(() => {
|
|
102
|
+
const k = u.current;
|
|
103
|
+
k && (b(k), u.current = null), d.current = null;
|
|
104
104
|
}, 500);
|
|
105
105
|
},
|
|
106
106
|
[
|
|
107
|
-
|
|
107
|
+
i,
|
|
108
108
|
c,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
o,
|
|
110
|
+
b,
|
|
111
|
+
f
|
|
112
112
|
]
|
|
113
113
|
);
|
|
114
114
|
P(() => () => {
|
|
115
|
-
if (
|
|
116
|
-
const
|
|
117
|
-
|
|
115
|
+
if (d.current) {
|
|
116
|
+
const w = u.current;
|
|
117
|
+
w && (b(w), u.current = null), clearTimeout(d.current), d.current = null;
|
|
118
118
|
}
|
|
119
|
-
}, [
|
|
120
|
-
const
|
|
121
|
-
}, []), E =
|
|
122
|
-
}, []),
|
|
123
|
-
}, []), $ =
|
|
119
|
+
}, [b]);
|
|
120
|
+
const z = g(async () => {
|
|
121
|
+
}, []), E = g(async () => {
|
|
122
|
+
}, []), D = g(async () => {
|
|
123
|
+
}, []), $ = g(async () => {
|
|
124
124
|
}, []);
|
|
125
|
-
return
|
|
125
|
+
return o === "three-panel" ? {
|
|
126
126
|
type: "three-panel",
|
|
127
|
-
sizes:
|
|
128
|
-
collapsed:
|
|
127
|
+
sizes: r,
|
|
128
|
+
collapsed: i,
|
|
129
129
|
handlePanelResize: S,
|
|
130
|
-
handleLeftCollapseComplete:
|
|
130
|
+
handleLeftCollapseComplete: z,
|
|
131
131
|
handleLeftExpandComplete: E,
|
|
132
|
-
handleRightCollapseComplete:
|
|
132
|
+
handleRightCollapseComplete: D,
|
|
133
133
|
handleRightExpandComplete: $
|
|
134
134
|
} : {
|
|
135
135
|
type: "two-panel",
|
|
136
|
-
sizes:
|
|
137
|
-
collapsed:
|
|
136
|
+
sizes: r,
|
|
137
|
+
collapsed: i,
|
|
138
138
|
handlePanelResize: S,
|
|
139
|
-
handleLeftCollapseComplete:
|
|
139
|
+
handleLeftCollapseComplete: z,
|
|
140
140
|
handleLeftExpandComplete: E
|
|
141
141
|
};
|
|
142
142
|
}
|
|
143
|
-
class
|
|
143
|
+
class ee {
|
|
144
144
|
constructor() {
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
_(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
|
|
146
|
+
_(this, "REPO_STATE_PREFIX", "panel-layouts:repo-state:");
|
|
147
147
|
}
|
|
148
148
|
/**
|
|
149
149
|
* Load all user-created workspace presets
|
|
@@ -171,8 +171,8 @@ class U {
|
|
|
171
171
|
*/
|
|
172
172
|
async loadRepositoryState(e) {
|
|
173
173
|
try {
|
|
174
|
-
const t = `${this.REPO_STATE_PREFIX}${e}`,
|
|
175
|
-
return
|
|
174
|
+
const t = `${this.REPO_STATE_PREFIX}${e}`, o = localStorage.getItem(t);
|
|
175
|
+
return o ? JSON.parse(o) : null;
|
|
176
176
|
} catch (t) {
|
|
177
177
|
return console.error(
|
|
178
178
|
`Failed to load repository state for ${e}:`,
|
|
@@ -185,13 +185,13 @@ class U {
|
|
|
185
185
|
*/
|
|
186
186
|
async saveRepositoryState(e, t) {
|
|
187
187
|
try {
|
|
188
|
-
const
|
|
189
|
-
localStorage.setItem(
|
|
190
|
-
} catch (
|
|
188
|
+
const o = `${this.REPO_STATE_PREFIX}${e}`;
|
|
189
|
+
localStorage.setItem(o, JSON.stringify(t));
|
|
190
|
+
} catch (o) {
|
|
191
191
|
throw console.error(
|
|
192
192
|
`Failed to save repository state for ${e}:`,
|
|
193
|
-
|
|
194
|
-
),
|
|
193
|
+
o
|
|
194
|
+
), o;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
/**
|
|
@@ -201,16 +201,16 @@ class U {
|
|
|
201
201
|
try {
|
|
202
202
|
const e = {};
|
|
203
203
|
for (let t = 0; t < localStorage.length; t++) {
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
const s =
|
|
207
|
-
if (
|
|
204
|
+
const o = localStorage.key(t);
|
|
205
|
+
if (o && o.startsWith(this.REPO_STATE_PREFIX)) {
|
|
206
|
+
const s = o.substring(this.REPO_STATE_PREFIX.length), r = localStorage.getItem(o);
|
|
207
|
+
if (r)
|
|
208
208
|
try {
|
|
209
|
-
e[s] = JSON.parse(
|
|
210
|
-
} catch (
|
|
209
|
+
e[s] = JSON.parse(r);
|
|
210
|
+
} catch (n) {
|
|
211
211
|
console.error(
|
|
212
212
|
`Failed to parse repository state for ${s}:`,
|
|
213
|
-
|
|
213
|
+
n
|
|
214
214
|
);
|
|
215
215
|
}
|
|
216
216
|
}
|
|
@@ -221,7 +221,7 @@ class U {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
class
|
|
224
|
+
class T {
|
|
225
225
|
/**
|
|
226
226
|
* Configure a custom storage adapter (for Electron IPC or remote storage)
|
|
227
227
|
*/
|
|
@@ -248,8 +248,8 @@ class R {
|
|
|
248
248
|
* Create a new workspace layout
|
|
249
249
|
*/
|
|
250
250
|
static async createWorkspaceLayout(e) {
|
|
251
|
-
const t = await this.adapter.loadWorkspacePresets(),
|
|
252
|
-
id:
|
|
251
|
+
const t = await this.adapter.loadWorkspacePresets(), o = this.generateWorkspaceId(e.name), s = {
|
|
252
|
+
id: o,
|
|
253
253
|
name: e.name,
|
|
254
254
|
description: e.description,
|
|
255
255
|
layout: e.layout,
|
|
@@ -258,22 +258,22 @@ class R {
|
|
|
258
258
|
createdAt: Date.now(),
|
|
259
259
|
updatedAt: Date.now(),
|
|
260
260
|
isBuiltIn: !1
|
|
261
|
-
},
|
|
261
|
+
}, r = {
|
|
262
262
|
...t,
|
|
263
|
-
[
|
|
263
|
+
[o]: s
|
|
264
264
|
};
|
|
265
|
-
return await this.adapter.saveWorkspacePresets(
|
|
265
|
+
return await this.adapter.saveWorkspacePresets(r), s;
|
|
266
266
|
}
|
|
267
267
|
/**
|
|
268
268
|
* Update an existing workspace layout
|
|
269
269
|
*/
|
|
270
270
|
static async updateWorkspaceLayout(e, t) {
|
|
271
|
-
const
|
|
271
|
+
const o = await this.adapter.loadWorkspacePresets(), s = o[e];
|
|
272
272
|
if (!s)
|
|
273
273
|
return console.error(`Workspace layout ${e} not found`), null;
|
|
274
274
|
if (s.isBuiltIn)
|
|
275
275
|
return console.error(`Cannot update built-in workspace layout ${e}`), null;
|
|
276
|
-
const
|
|
276
|
+
const r = {
|
|
277
277
|
...s,
|
|
278
278
|
...t,
|
|
279
279
|
id: e,
|
|
@@ -281,20 +281,20 @@ class R {
|
|
|
281
281
|
createdAt: s.createdAt,
|
|
282
282
|
// Preserve creation time
|
|
283
283
|
updatedAt: Date.now()
|
|
284
|
-
},
|
|
285
|
-
...
|
|
286
|
-
[e]:
|
|
284
|
+
}, n = {
|
|
285
|
+
...o,
|
|
286
|
+
[e]: r
|
|
287
287
|
};
|
|
288
|
-
return await this.adapter.saveWorkspacePresets(
|
|
288
|
+
return await this.adapter.saveWorkspacePresets(n), r;
|
|
289
289
|
}
|
|
290
290
|
/**
|
|
291
291
|
* Delete a workspace layout
|
|
292
292
|
*/
|
|
293
293
|
static async deleteWorkspaceLayout(e) {
|
|
294
|
-
const t = await this.adapter.loadWorkspacePresets(),
|
|
295
|
-
if (!
|
|
294
|
+
const t = await this.adapter.loadWorkspacePresets(), o = t[e];
|
|
295
|
+
if (!o)
|
|
296
296
|
return console.error(`Workspace layout ${e} not found`), !1;
|
|
297
|
-
if (
|
|
297
|
+
if (o.isBuiltIn)
|
|
298
298
|
return console.error(`Cannot delete built-in workspace layout ${e}`), !1;
|
|
299
299
|
const s = { ...t };
|
|
300
300
|
return delete s[e], await this.adapter.saveWorkspacePresets(s), !0;
|
|
@@ -315,9 +315,9 @@ class R {
|
|
|
315
315
|
* Update only sizes in repository state
|
|
316
316
|
*/
|
|
317
317
|
static async updateRepositorySizes(e, t) {
|
|
318
|
-
const
|
|
319
|
-
|
|
320
|
-
...
|
|
318
|
+
const o = await this.getRepositoryState(e);
|
|
319
|
+
o && await this.setRepositoryState(e, {
|
|
320
|
+
...o,
|
|
321
321
|
sizes: t
|
|
322
322
|
});
|
|
323
323
|
}
|
|
@@ -325,9 +325,9 @@ class R {
|
|
|
325
325
|
* Update only collapsed state in repository state
|
|
326
326
|
*/
|
|
327
327
|
static async updateRepositoryCollapsed(e, t) {
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
...
|
|
328
|
+
const o = await this.getRepositoryState(e);
|
|
329
|
+
o && await this.setRepositoryState(e, {
|
|
330
|
+
...o,
|
|
331
331
|
collapsed: t
|
|
332
332
|
});
|
|
333
333
|
}
|
|
@@ -335,15 +335,15 @@ class R {
|
|
|
335
335
|
* Check if repository state differs from workspace defaults
|
|
336
336
|
*/
|
|
337
337
|
static hasStateDeviation(e, t) {
|
|
338
|
-
const
|
|
339
|
-
return { hasSizeDeviation:
|
|
338
|
+
const o = t.defaultSizes ? JSON.stringify(e.sizes) !== JSON.stringify(t.defaultSizes) : !1, s = t.defaultCollapsed ? JSON.stringify(e.collapsed) !== JSON.stringify(t.defaultCollapsed) : !1;
|
|
339
|
+
return { hasSizeDeviation: o, hasCollapsedDeviation: s };
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
342
342
|
* Update workspace defaults from repository state
|
|
343
343
|
*/
|
|
344
344
|
static async updateWorkspaceFromRepositoryState(e, t) {
|
|
345
|
-
const
|
|
346
|
-
if (!
|
|
345
|
+
const o = await this.getWorkspaceLayout(e), s = await this.getRepositoryState(t);
|
|
346
|
+
if (!o || !s || o.isBuiltIn) {
|
|
347
347
|
console.error(
|
|
348
348
|
"Cannot update built-in workspace or workspace/state not found"
|
|
349
349
|
);
|
|
@@ -358,16 +358,16 @@ class R {
|
|
|
358
358
|
* Reset repository state to workspace defaults
|
|
359
359
|
*/
|
|
360
360
|
static async resetRepositoryToWorkspaceDefaults(e, t) {
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
361
|
+
const o = await this.getWorkspaceLayout(t);
|
|
362
|
+
if (!o) {
|
|
363
363
|
console.error(`Workspace ${t} not found`);
|
|
364
364
|
return;
|
|
365
365
|
}
|
|
366
366
|
const s = await this.getRepositoryState(e);
|
|
367
367
|
s && await this.setRepositoryState(e, {
|
|
368
368
|
...s,
|
|
369
|
-
sizes:
|
|
370
|
-
collapsed:
|
|
369
|
+
sizes: o.defaultSizes || { left: 20, middle: 45, right: 35 },
|
|
370
|
+
collapsed: o.defaultCollapsed || { left: !1, right: !1 }
|
|
371
371
|
});
|
|
372
372
|
}
|
|
373
373
|
/**
|
|
@@ -381,9 +381,9 @@ class R {
|
|
|
381
381
|
*/
|
|
382
382
|
static async findMatchingWorkspace(e) {
|
|
383
383
|
const t = await this.getWorkspaceLayouts();
|
|
384
|
-
for (const [
|
|
384
|
+
for (const [o, s] of Object.entries(t))
|
|
385
385
|
if (this.isLayoutMatchingWorkspace(e, s))
|
|
386
|
-
return
|
|
386
|
+
return o;
|
|
387
387
|
return null;
|
|
388
388
|
}
|
|
389
389
|
/**
|
|
@@ -610,303 +610,303 @@ class R {
|
|
|
610
610
|
Object.keys(e).length;
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
|
-
|
|
614
|
-
function
|
|
615
|
-
const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId:
|
|
613
|
+
_(T, "adapter", new ee());
|
|
614
|
+
function Se(a = {}) {
|
|
615
|
+
const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId: o } = a, [s, r] = A(
|
|
616
616
|
{}
|
|
617
|
-
), [
|
|
617
|
+
), [n, i] = A(null), [m, y] = A(null), [h, d] = A(!0), [u, f] = A(null), c = g(async () => {
|
|
618
618
|
try {
|
|
619
|
-
|
|
620
|
-
const
|
|
621
|
-
if (
|
|
622
|
-
let k = await
|
|
619
|
+
d(!0), f(null);
|
|
620
|
+
const v = await T.getWorkspaceLayouts();
|
|
621
|
+
if (r(v), e) {
|
|
622
|
+
let k = await T.getRepositoryState(e);
|
|
623
623
|
if (!k && t) {
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
workspaceId:
|
|
627
|
-
sizes:
|
|
624
|
+
const p = o || "project-management", C = await T.getWorkspaceLayout(p);
|
|
625
|
+
C && (k = {
|
|
626
|
+
workspaceId: p,
|
|
627
|
+
sizes: C.defaultSizes || {
|
|
628
628
|
left: 20,
|
|
629
629
|
middle: 45,
|
|
630
630
|
right: 35
|
|
631
631
|
},
|
|
632
|
-
collapsed:
|
|
632
|
+
collapsed: C.defaultCollapsed || {
|
|
633
633
|
left: !1,
|
|
634
634
|
right: !1
|
|
635
635
|
}
|
|
636
|
-
}, await
|
|
636
|
+
}, await T.setRepositoryState(
|
|
637
637
|
e,
|
|
638
638
|
k
|
|
639
639
|
));
|
|
640
640
|
}
|
|
641
|
-
if (
|
|
642
|
-
const
|
|
641
|
+
if (i(k), k != null && k.workspaceId) {
|
|
642
|
+
const p = await T.getWorkspaceLayout(
|
|
643
643
|
k.workspaceId
|
|
644
644
|
);
|
|
645
|
-
|
|
645
|
+
y(p);
|
|
646
646
|
} else
|
|
647
|
-
|
|
647
|
+
y(null);
|
|
648
648
|
}
|
|
649
|
-
} catch (
|
|
650
|
-
|
|
649
|
+
} catch (v) {
|
|
650
|
+
f(v), console.error("Failed to load workspace data:", v);
|
|
651
651
|
} finally {
|
|
652
|
-
|
|
652
|
+
d(!1);
|
|
653
653
|
}
|
|
654
|
-
}, [e, t,
|
|
654
|
+
}, [e, t, o]);
|
|
655
655
|
P(() => {
|
|
656
656
|
c();
|
|
657
657
|
}, [c]);
|
|
658
|
-
const
|
|
659
|
-
async (
|
|
658
|
+
const l = g(
|
|
659
|
+
async (v) => await T.getWorkspaceLayout(v),
|
|
660
660
|
[]
|
|
661
|
-
),
|
|
662
|
-
async (
|
|
663
|
-
const k = await
|
|
661
|
+
), b = g(
|
|
662
|
+
async (v) => {
|
|
663
|
+
const k = await T.createWorkspaceLayout(v);
|
|
664
664
|
return await c(), k;
|
|
665
665
|
},
|
|
666
666
|
[c]
|
|
667
|
-
), S =
|
|
668
|
-
async (
|
|
669
|
-
const
|
|
670
|
-
return await c(),
|
|
667
|
+
), S = g(
|
|
668
|
+
async (v, k) => {
|
|
669
|
+
const p = await T.updateWorkspaceLayout(v, k);
|
|
670
|
+
return await c(), p;
|
|
671
671
|
},
|
|
672
672
|
[c]
|
|
673
|
-
),
|
|
674
|
-
async (
|
|
675
|
-
const k = await
|
|
673
|
+
), z = g(
|
|
674
|
+
async (v) => {
|
|
675
|
+
const k = await T.deleteWorkspaceLayout(v);
|
|
676
676
|
return k && await c(), k;
|
|
677
677
|
},
|
|
678
678
|
[c]
|
|
679
|
-
), E =
|
|
680
|
-
async (
|
|
679
|
+
), E = g(
|
|
680
|
+
async (v) => {
|
|
681
681
|
if (!e) {
|
|
682
682
|
console.error("Cannot apply workspace without repositoryKey");
|
|
683
683
|
return;
|
|
684
684
|
}
|
|
685
|
-
const k = await
|
|
685
|
+
const k = await T.getWorkspaceLayout(v);
|
|
686
686
|
if (!k) {
|
|
687
|
-
console.error(`Workspace ${
|
|
687
|
+
console.error(`Workspace ${v} not found`);
|
|
688
688
|
return;
|
|
689
689
|
}
|
|
690
|
-
const
|
|
691
|
-
workspaceId:
|
|
690
|
+
const p = {
|
|
691
|
+
workspaceId: v,
|
|
692
692
|
sizes: k.defaultSizes || { left: 20, middle: 45, right: 35 },
|
|
693
693
|
collapsed: k.defaultCollapsed || {
|
|
694
694
|
left: !1,
|
|
695
695
|
right: !1
|
|
696
696
|
}
|
|
697
697
|
};
|
|
698
|
-
await
|
|
698
|
+
await T.setRepositoryState(e, p), await c();
|
|
699
699
|
},
|
|
700
700
|
[e, c]
|
|
701
|
-
),
|
|
702
|
-
async (
|
|
701
|
+
), D = g(
|
|
702
|
+
async (v) => {
|
|
703
703
|
if (!e) {
|
|
704
704
|
console.error("Cannot update sizes without repositoryKey");
|
|
705
705
|
return;
|
|
706
706
|
}
|
|
707
|
-
await
|
|
707
|
+
await T.updateRepositorySizes(e, v), await c();
|
|
708
708
|
},
|
|
709
709
|
[e, c]
|
|
710
|
-
), $ =
|
|
711
|
-
async (
|
|
710
|
+
), $ = g(
|
|
711
|
+
async (v) => {
|
|
712
712
|
if (!e) {
|
|
713
713
|
console.error("Cannot update collapsed without repositoryKey");
|
|
714
714
|
return;
|
|
715
715
|
}
|
|
716
|
-
await
|
|
716
|
+
await T.updateRepositoryCollapsed(
|
|
717
717
|
e,
|
|
718
|
-
|
|
718
|
+
v
|
|
719
719
|
), await c();
|
|
720
720
|
},
|
|
721
721
|
[e, c]
|
|
722
|
-
),
|
|
723
|
-
if (!e || !(
|
|
722
|
+
), w = g(async () => {
|
|
723
|
+
if (!e || !(n != null && n.workspaceId)) {
|
|
724
724
|
console.error("Cannot reset without repositoryKey and active workspace");
|
|
725
725
|
return;
|
|
726
726
|
}
|
|
727
|
-
await
|
|
727
|
+
await T.resetRepositoryToWorkspaceDefaults(
|
|
728
728
|
e,
|
|
729
|
-
|
|
729
|
+
n.workspaceId
|
|
730
730
|
), await c();
|
|
731
|
-
}, [e,
|
|
731
|
+
}, [e, n == null ? void 0 : n.workspaceId, c]), x = g(async () => {
|
|
732
732
|
await c();
|
|
733
733
|
}, [c]);
|
|
734
734
|
return {
|
|
735
735
|
workspaces: s,
|
|
736
|
-
repositoryState:
|
|
737
|
-
activeWorkspace:
|
|
738
|
-
loading:
|
|
739
|
-
error:
|
|
740
|
-
getWorkspace:
|
|
741
|
-
createWorkspace:
|
|
736
|
+
repositoryState: n,
|
|
737
|
+
activeWorkspace: m,
|
|
738
|
+
loading: h,
|
|
739
|
+
error: u,
|
|
740
|
+
getWorkspace: l,
|
|
741
|
+
createWorkspace: b,
|
|
742
742
|
updateWorkspace: S,
|
|
743
|
-
deleteWorkspace:
|
|
743
|
+
deleteWorkspace: z,
|
|
744
744
|
applyWorkspace: E,
|
|
745
|
-
updateSizes:
|
|
745
|
+
updateSizes: D,
|
|
746
746
|
updateCollapsed: $,
|
|
747
|
-
resetToDefaults:
|
|
748
|
-
refresh:
|
|
747
|
+
resetToDefaults: w,
|
|
748
|
+
refresh: x
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
-
function
|
|
751
|
+
function Pe(a = {}) {
|
|
752
752
|
const {
|
|
753
753
|
initialFocus: e = null,
|
|
754
754
|
collapsed: t = {},
|
|
755
|
-
panelType:
|
|
755
|
+
panelType: o = "three-panel",
|
|
756
756
|
onFocusChange: s,
|
|
757
|
-
events:
|
|
758
|
-
getPanelId:
|
|
759
|
-
} =
|
|
757
|
+
events: r,
|
|
758
|
+
getPanelId: n
|
|
759
|
+
} = a, [i, m] = A(
|
|
760
760
|
e
|
|
761
|
-
),
|
|
762
|
-
(
|
|
763
|
-
const
|
|
764
|
-
if (
|
|
765
|
-
if (
|
|
766
|
-
const
|
|
767
|
-
|
|
761
|
+
), y = g(
|
|
762
|
+
(l) => {
|
|
763
|
+
const b = i;
|
|
764
|
+
if (m(l), s == null || s(l), r && n) {
|
|
765
|
+
if (b) {
|
|
766
|
+
const z = n(b);
|
|
767
|
+
z && r.emit({
|
|
768
768
|
type: "panel:blur",
|
|
769
769
|
source: "panel-layouts",
|
|
770
770
|
timestamp: Date.now(),
|
|
771
771
|
payload: {
|
|
772
|
-
panelId:
|
|
773
|
-
panelSlot:
|
|
774
|
-
nextPanelId:
|
|
772
|
+
panelId: z,
|
|
773
|
+
panelSlot: b,
|
|
774
|
+
nextPanelId: n(l)
|
|
775
775
|
}
|
|
776
776
|
});
|
|
777
777
|
}
|
|
778
|
-
const S =
|
|
779
|
-
S &&
|
|
778
|
+
const S = n(l);
|
|
779
|
+
S && r.emit({
|
|
780
780
|
type: "panel:focus",
|
|
781
781
|
source: "panel-layouts",
|
|
782
782
|
timestamp: Date.now(),
|
|
783
783
|
payload: {
|
|
784
784
|
panelId: S,
|
|
785
|
-
panelSlot:
|
|
785
|
+
panelSlot: l,
|
|
786
786
|
source: "keyboard-shortcut"
|
|
787
787
|
}
|
|
788
788
|
});
|
|
789
789
|
}
|
|
790
790
|
},
|
|
791
|
-
[
|
|
792
|
-
),
|
|
793
|
-
const
|
|
794
|
-
if (
|
|
795
|
-
const
|
|
796
|
-
|
|
791
|
+
[i, s, r, n]
|
|
792
|
+
), h = g(() => {
|
|
793
|
+
const l = i;
|
|
794
|
+
if (m(null), s == null || s(null), r && n && l) {
|
|
795
|
+
const b = n(l);
|
|
796
|
+
b && r.emit({
|
|
797
797
|
type: "panel:blur",
|
|
798
798
|
source: "panel-layouts",
|
|
799
799
|
timestamp: Date.now(),
|
|
800
800
|
payload: {
|
|
801
|
-
panelId:
|
|
802
|
-
panelSlot:
|
|
801
|
+
panelId: b,
|
|
802
|
+
panelSlot: l
|
|
803
803
|
}
|
|
804
804
|
});
|
|
805
805
|
}
|
|
806
|
-
}, [
|
|
807
|
-
const
|
|
808
|
-
return t.left ||
|
|
809
|
-
}, [t,
|
|
810
|
-
const
|
|
811
|
-
if (
|
|
812
|
-
if (
|
|
813
|
-
|
|
806
|
+
}, [i, s, r, n]), d = g(() => {
|
|
807
|
+
const l = [];
|
|
808
|
+
return t.left || l.push("left"), l.push("middle"), o === "three-panel" && !t.right && l.push("right"), l;
|
|
809
|
+
}, [t, o]), u = g(() => {
|
|
810
|
+
const l = d();
|
|
811
|
+
if (l.length === 0) return;
|
|
812
|
+
if (i === null) {
|
|
813
|
+
y(l[0]);
|
|
814
814
|
return;
|
|
815
815
|
}
|
|
816
|
-
const
|
|
817
|
-
if (
|
|
818
|
-
|
|
816
|
+
const b = l.indexOf(i);
|
|
817
|
+
if (b === -1) {
|
|
818
|
+
y(l[0]);
|
|
819
819
|
return;
|
|
820
820
|
}
|
|
821
|
-
const S = (
|
|
822
|
-
|
|
823
|
-
}, [
|
|
824
|
-
const
|
|
825
|
-
if (
|
|
826
|
-
if (
|
|
827
|
-
|
|
821
|
+
const S = (b + 1) % l.length;
|
|
822
|
+
y(l[S]);
|
|
823
|
+
}, [i, d, y]), f = g(() => {
|
|
824
|
+
const l = d();
|
|
825
|
+
if (l.length === 0) return;
|
|
826
|
+
if (i === null) {
|
|
827
|
+
y(l[l.length - 1]);
|
|
828
828
|
return;
|
|
829
829
|
}
|
|
830
|
-
const
|
|
831
|
-
if (
|
|
832
|
-
|
|
830
|
+
const b = l.indexOf(i);
|
|
831
|
+
if (b === -1) {
|
|
832
|
+
y(l[l.length - 1]);
|
|
833
833
|
return;
|
|
834
834
|
}
|
|
835
|
-
const S =
|
|
836
|
-
|
|
837
|
-
}, [
|
|
838
|
-
(
|
|
839
|
-
[
|
|
835
|
+
const S = b === 0 ? l.length - 1 : b - 1;
|
|
836
|
+
y(l[S]);
|
|
837
|
+
}, [i, d, y]), c = g(
|
|
838
|
+
(l) => i === l,
|
|
839
|
+
[i]
|
|
840
840
|
);
|
|
841
841
|
return {
|
|
842
|
-
focusedPanel:
|
|
843
|
-
setFocus:
|
|
844
|
-
clearFocus:
|
|
845
|
-
focusNext:
|
|
846
|
-
focusPrevious:
|
|
842
|
+
focusedPanel: i,
|
|
843
|
+
setFocus: y,
|
|
844
|
+
clearFocus: h,
|
|
845
|
+
focusNext: u,
|
|
846
|
+
focusPrevious: f,
|
|
847
847
|
isFocused: c
|
|
848
848
|
};
|
|
849
849
|
}
|
|
850
|
-
function
|
|
850
|
+
function Te(a) {
|
|
851
851
|
const {
|
|
852
852
|
enabled: e = !0,
|
|
853
853
|
focusedPanel: t,
|
|
854
|
-
collapsed:
|
|
854
|
+
collapsed: o,
|
|
855
855
|
panelType: s,
|
|
856
|
-
setFocus:
|
|
857
|
-
onExpand:
|
|
858
|
-
onCollapse:
|
|
859
|
-
} =
|
|
856
|
+
setFocus: r,
|
|
857
|
+
onExpand: n,
|
|
858
|
+
onCollapse: i
|
|
859
|
+
} = a, m = W(t), y = W(o), h = W(s);
|
|
860
860
|
P(() => {
|
|
861
|
-
|
|
861
|
+
m.current = t;
|
|
862
862
|
}, [t]), P(() => {
|
|
863
|
-
|
|
864
|
-
}, [
|
|
865
|
-
|
|
863
|
+
y.current = o;
|
|
864
|
+
}, [o]), P(() => {
|
|
865
|
+
h.current = s;
|
|
866
866
|
}, [s]);
|
|
867
|
-
const
|
|
868
|
-
(
|
|
869
|
-
if (!
|
|
867
|
+
const d = g(
|
|
868
|
+
(u) => {
|
|
869
|
+
if (!u.altKey || u.ctrlKey || u.metaKey || u.shiftKey)
|
|
870
870
|
return;
|
|
871
|
-
const
|
|
872
|
-
|
|
871
|
+
const f = u.code, c = m.current, l = y.current, b = h.current;
|
|
872
|
+
f === "Digit1" || f === "Numpad1" ? (u.preventDefault(), l.left ? n("left") : c !== "left" ? r("left") : (i("left"), r("middle"))) : f === "Digit2" || f === "Numpad2" ? (u.preventDefault(), r("middle")) : (f === "Digit3" || f === "Numpad3") && b === "three-panel" && (u.preventDefault(), l.right ? n("right") : c !== "right" ? r("right") : (i("right"), r("middle")));
|
|
873
873
|
},
|
|
874
|
-
[
|
|
874
|
+
[r, n, i]
|
|
875
875
|
);
|
|
876
876
|
P(() => {
|
|
877
877
|
if (e)
|
|
878
|
-
return window.addEventListener("keydown",
|
|
879
|
-
window.removeEventListener("keydown",
|
|
878
|
+
return window.addEventListener("keydown", d), () => {
|
|
879
|
+
window.removeEventListener("keydown", d);
|
|
880
880
|
};
|
|
881
|
-
}, [e,
|
|
881
|
+
}, [e, d]);
|
|
882
882
|
}
|
|
883
|
-
function
|
|
883
|
+
function Re(a, e, t, o) {
|
|
884
884
|
P(() => {
|
|
885
885
|
const s = e.on(
|
|
886
886
|
"panel:focus",
|
|
887
|
-
(
|
|
888
|
-
|
|
887
|
+
(n) => {
|
|
888
|
+
n.payload.panelId === a && t();
|
|
889
889
|
}
|
|
890
890
|
);
|
|
891
|
-
let
|
|
892
|
-
return
|
|
891
|
+
let r;
|
|
892
|
+
return o && (r = e.on(
|
|
893
893
|
"panel:blur",
|
|
894
|
-
(
|
|
895
|
-
|
|
894
|
+
(n) => {
|
|
895
|
+
n.payload.panelId === a && o();
|
|
896
896
|
}
|
|
897
897
|
)), () => {
|
|
898
|
-
s(),
|
|
898
|
+
s(), r == null || r();
|
|
899
899
|
};
|
|
900
|
-
}, [
|
|
900
|
+
}, [a, e, t, o]);
|
|
901
901
|
}
|
|
902
|
-
const
|
|
903
|
-
isFocused:
|
|
902
|
+
const Ie = ({
|
|
903
|
+
isFocused: a,
|
|
904
904
|
className: e = "",
|
|
905
905
|
style: t = {}
|
|
906
906
|
}) => {
|
|
907
|
-
if (!
|
|
907
|
+
if (!a)
|
|
908
908
|
return null;
|
|
909
|
-
const
|
|
909
|
+
const o = {
|
|
910
910
|
position: "absolute",
|
|
911
911
|
top: 0,
|
|
912
912
|
left: 0,
|
|
@@ -920,63 +920,63 @@ const fe = ({
|
|
|
920
920
|
transition: "opacity 0.15s ease-in-out",
|
|
921
921
|
...t
|
|
922
922
|
};
|
|
923
|
-
return /* @__PURE__ */
|
|
923
|
+
return /* @__PURE__ */ R(
|
|
924
924
|
"div",
|
|
925
925
|
{
|
|
926
926
|
className: `panel-focus-indicator ${e}`,
|
|
927
|
-
style:
|
|
927
|
+
style: o,
|
|
928
928
|
role: "presentation",
|
|
929
929
|
"aria-hidden": "true"
|
|
930
930
|
}
|
|
931
931
|
);
|
|
932
|
-
},
|
|
933
|
-
value:
|
|
932
|
+
}, te = ({
|
|
933
|
+
value: a,
|
|
934
934
|
onChange: e,
|
|
935
935
|
placeholder: t = "> Type a command...",
|
|
936
|
-
onClose:
|
|
936
|
+
onClose: o,
|
|
937
937
|
onEnter: s
|
|
938
938
|
}) => {
|
|
939
|
-
const { theme:
|
|
939
|
+
const { theme: r } = O(), n = W(null);
|
|
940
940
|
P(() => {
|
|
941
|
-
|
|
941
|
+
n.current && n.current.focus();
|
|
942
942
|
}, []);
|
|
943
|
-
const
|
|
944
|
-
switch (
|
|
943
|
+
const i = (m) => {
|
|
944
|
+
switch (m.key) {
|
|
945
945
|
case "Enter":
|
|
946
|
-
|
|
946
|
+
m.preventDefault(), s == null || s();
|
|
947
947
|
break;
|
|
948
948
|
case "Escape":
|
|
949
|
-
|
|
949
|
+
m.preventDefault(), o();
|
|
950
950
|
break;
|
|
951
951
|
}
|
|
952
952
|
};
|
|
953
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ R(
|
|
954
954
|
"div",
|
|
955
955
|
{
|
|
956
956
|
style: {
|
|
957
957
|
padding: "0",
|
|
958
|
-
borderBottom: `1px solid ${
|
|
959
|
-
backgroundColor:
|
|
958
|
+
borderBottom: `1px solid ${r.colors.border}`,
|
|
959
|
+
backgroundColor: r.colors.background
|
|
960
960
|
},
|
|
961
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ R(
|
|
962
962
|
"input",
|
|
963
963
|
{
|
|
964
|
-
ref:
|
|
964
|
+
ref: n,
|
|
965
965
|
type: "text",
|
|
966
|
-
value:
|
|
967
|
-
onChange: (
|
|
968
|
-
onKeyDown:
|
|
966
|
+
value: a,
|
|
967
|
+
onChange: (m) => e(m.target.value),
|
|
968
|
+
onKeyDown: i,
|
|
969
969
|
placeholder: t,
|
|
970
970
|
style: {
|
|
971
971
|
width: "100%",
|
|
972
972
|
padding: "16px 20px",
|
|
973
973
|
fontSize: "16px",
|
|
974
|
-
fontFamily:
|
|
974
|
+
fontFamily: r.fonts.monospace,
|
|
975
975
|
backgroundColor: "transparent",
|
|
976
976
|
border: "none",
|
|
977
977
|
outline: "none",
|
|
978
|
-
color:
|
|
979
|
-
caretColor:
|
|
978
|
+
color: r.colors.text,
|
|
979
|
+
caretColor: r.colors.primary
|
|
980
980
|
},
|
|
981
981
|
autoComplete: "off",
|
|
982
982
|
autoCorrect: "off",
|
|
@@ -986,33 +986,33 @@ const fe = ({
|
|
|
986
986
|
)
|
|
987
987
|
}
|
|
988
988
|
);
|
|
989
|
-
},
|
|
990
|
-
({ command:
|
|
991
|
-
const { theme:
|
|
992
|
-
return /* @__PURE__ */
|
|
989
|
+
}, j = Q(
|
|
990
|
+
({ command: a, isSelected: e, onClick: t, onMouseEnter: o }, s) => {
|
|
991
|
+
const { theme: r } = O(), { label: n, description: i, icon: m, shortcut: y } = a, [h, d] = Y.useState(!1);
|
|
992
|
+
return /* @__PURE__ */ I(
|
|
993
993
|
"div",
|
|
994
994
|
{
|
|
995
995
|
ref: s,
|
|
996
996
|
onClick: t,
|
|
997
997
|
onMouseEnter: () => {
|
|
998
|
-
|
|
998
|
+
d(!0), o();
|
|
999
999
|
},
|
|
1000
|
-
onMouseLeave: () =>
|
|
1000
|
+
onMouseLeave: () => d(!1),
|
|
1001
1001
|
style: {
|
|
1002
1002
|
padding: "10px 16px",
|
|
1003
1003
|
cursor: "pointer",
|
|
1004
|
-
backgroundColor: e ||
|
|
1005
|
-
borderLeft: e ||
|
|
1004
|
+
backgroundColor: e || h ? r.colors.backgroundSecondary : "transparent",
|
|
1005
|
+
borderLeft: e || h ? `3px solid ${r.colors.primary}` : "3px solid transparent",
|
|
1006
1006
|
transition: "all 0.1s ease",
|
|
1007
1007
|
display: "flex",
|
|
1008
1008
|
alignItems: "center",
|
|
1009
1009
|
gap: "12px"
|
|
1010
1010
|
},
|
|
1011
|
-
onMouseDown: (
|
|
1012
|
-
|
|
1011
|
+
onMouseDown: (u) => {
|
|
1012
|
+
u.preventDefault();
|
|
1013
1013
|
},
|
|
1014
1014
|
children: [
|
|
1015
|
-
|
|
1015
|
+
m && /* @__PURE__ */ R(
|
|
1016
1016
|
"div",
|
|
1017
1017
|
{
|
|
1018
1018
|
style: {
|
|
@@ -1023,52 +1023,52 @@ const fe = ({
|
|
|
1023
1023
|
alignItems: "center",
|
|
1024
1024
|
justifyContent: "center",
|
|
1025
1025
|
fontSize: "16px",
|
|
1026
|
-
color: e ||
|
|
1026
|
+
color: e || h ? r.colors.primary : r.colors.textSecondary
|
|
1027
1027
|
},
|
|
1028
|
-
children:
|
|
1028
|
+
children: m
|
|
1029
1029
|
}
|
|
1030
1030
|
),
|
|
1031
|
-
/* @__PURE__ */
|
|
1032
|
-
/* @__PURE__ */
|
|
1031
|
+
/* @__PURE__ */ I("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1032
|
+
/* @__PURE__ */ R(
|
|
1033
1033
|
"div",
|
|
1034
1034
|
{
|
|
1035
1035
|
style: {
|
|
1036
1036
|
fontSize: "14px",
|
|
1037
1037
|
fontWeight: 500,
|
|
1038
|
-
color: e ||
|
|
1039
|
-
marginBottom:
|
|
1038
|
+
color: e || h ? r.colors.text : r.colors.textSecondary,
|
|
1039
|
+
marginBottom: i ? "2px" : 0
|
|
1040
1040
|
},
|
|
1041
|
-
children:
|
|
1041
|
+
children: n
|
|
1042
1042
|
}
|
|
1043
1043
|
),
|
|
1044
|
-
|
|
1044
|
+
i && /* @__PURE__ */ R(
|
|
1045
1045
|
"div",
|
|
1046
1046
|
{
|
|
1047
1047
|
style: {
|
|
1048
1048
|
fontSize: "12px",
|
|
1049
|
-
color:
|
|
1049
|
+
color: r.colors.textMuted,
|
|
1050
1050
|
overflow: "hidden",
|
|
1051
1051
|
textOverflow: "ellipsis",
|
|
1052
1052
|
whiteSpace: "nowrap"
|
|
1053
1053
|
},
|
|
1054
|
-
children:
|
|
1054
|
+
children: i
|
|
1055
1055
|
}
|
|
1056
1056
|
)
|
|
1057
1057
|
] }),
|
|
1058
|
-
|
|
1058
|
+
y && /* @__PURE__ */ R(
|
|
1059
1059
|
"div",
|
|
1060
1060
|
{
|
|
1061
1061
|
style: {
|
|
1062
1062
|
flexShrink: 0,
|
|
1063
1063
|
fontSize: "11px",
|
|
1064
|
-
color:
|
|
1064
|
+
color: r.colors.textMuted,
|
|
1065
1065
|
padding: "2px 8px",
|
|
1066
|
-
backgroundColor:
|
|
1067
|
-
border: `1px solid ${
|
|
1066
|
+
backgroundColor: r.colors.background,
|
|
1067
|
+
border: `1px solid ${r.colors.border}`,
|
|
1068
1068
|
borderRadius: "4px",
|
|
1069
|
-
fontFamily:
|
|
1069
|
+
fontFamily: r.fonts.monospace
|
|
1070
1070
|
},
|
|
1071
|
-
children:
|
|
1071
|
+
children: y
|
|
1072
1072
|
}
|
|
1073
1073
|
)
|
|
1074
1074
|
]
|
|
@@ -1076,37 +1076,37 @@ const fe = ({
|
|
|
1076
1076
|
);
|
|
1077
1077
|
}
|
|
1078
1078
|
);
|
|
1079
|
-
|
|
1080
|
-
const
|
|
1081
|
-
commands:
|
|
1079
|
+
j.displayName = "CommandItem";
|
|
1080
|
+
const ae = ({
|
|
1081
|
+
commands: a,
|
|
1082
1082
|
selectedIndex: e,
|
|
1083
1083
|
onSelect: t,
|
|
1084
|
-
onHover:
|
|
1084
|
+
onHover: o,
|
|
1085
1085
|
maxResults: s = 10
|
|
1086
1086
|
}) => {
|
|
1087
|
-
const { theme:
|
|
1087
|
+
const { theme: r } = O(), n = W(null), i = W(null), m = a.slice(0, s);
|
|
1088
1088
|
P(() => {
|
|
1089
|
-
if (
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1089
|
+
if (i.current && n.current) {
|
|
1090
|
+
const d = i.current, u = n.current, f = d.offsetTop, c = f + d.offsetHeight, l = u.scrollTop, b = u.clientHeight;
|
|
1091
|
+
f < l ? u.scrollTop = f - 8 : c > l + b && (u.scrollTop = c - b + 8);
|
|
1092
1092
|
}
|
|
1093
1093
|
}, [e]);
|
|
1094
|
-
const
|
|
1095
|
-
const c =
|
|
1096
|
-
return
|
|
1097
|
-
}, {}),
|
|
1098
|
-
return /* @__PURE__ */
|
|
1094
|
+
const y = m.reduce((d, u, f) => {
|
|
1095
|
+
const c = u.category || "Other";
|
|
1096
|
+
return d[c] || (d[c] = []), d[c].push({ command: u, index: f }), d;
|
|
1097
|
+
}, {}), h = Object.keys(y).sort((d, u) => d === "Other" ? 1 : u === "Other" ? -1 : d.localeCompare(u));
|
|
1098
|
+
return /* @__PURE__ */ I(
|
|
1099
1099
|
"div",
|
|
1100
1100
|
{
|
|
1101
|
-
ref:
|
|
1101
|
+
ref: n,
|
|
1102
1102
|
style: {
|
|
1103
1103
|
overflowY: "auto",
|
|
1104
1104
|
maxHeight: "400px",
|
|
1105
1105
|
padding: "8px 0"
|
|
1106
1106
|
},
|
|
1107
1107
|
children: [
|
|
1108
|
-
|
|
1109
|
-
|
|
1108
|
+
h.map((d) => /* @__PURE__ */ I("div", { children: [
|
|
1109
|
+
h.length > 1 && /* @__PURE__ */ R(
|
|
1110
1110
|
"div",
|
|
1111
1111
|
{
|
|
1112
1112
|
style: {
|
|
@@ -1114,39 +1114,39 @@ const te = ({
|
|
|
1114
1114
|
fontSize: "11px",
|
|
1115
1115
|
fontWeight: 600,
|
|
1116
1116
|
textTransform: "uppercase",
|
|
1117
|
-
color:
|
|
1117
|
+
color: r.colors.textMuted,
|
|
1118
1118
|
letterSpacing: "0.5px"
|
|
1119
1119
|
},
|
|
1120
|
-
children:
|
|
1120
|
+
children: d
|
|
1121
1121
|
}
|
|
1122
1122
|
),
|
|
1123
|
-
|
|
1124
|
-
|
|
1123
|
+
y[d].map(({ command: u, index: f }) => /* @__PURE__ */ R(
|
|
1124
|
+
j,
|
|
1125
1125
|
{
|
|
1126
|
-
command:
|
|
1127
|
-
isSelected:
|
|
1128
|
-
onClick: () => t(
|
|
1129
|
-
onMouseEnter: () =>
|
|
1130
|
-
ref:
|
|
1126
|
+
command: u,
|
|
1127
|
+
isSelected: f === e,
|
|
1128
|
+
onClick: () => t(u),
|
|
1129
|
+
onMouseEnter: () => o(f),
|
|
1130
|
+
ref: f === e ? i : void 0
|
|
1131
1131
|
},
|
|
1132
|
-
|
|
1132
|
+
u.id
|
|
1133
1133
|
))
|
|
1134
|
-
] },
|
|
1135
|
-
|
|
1134
|
+
] }, d)),
|
|
1135
|
+
a.length > s && /* @__PURE__ */ I(
|
|
1136
1136
|
"div",
|
|
1137
1137
|
{
|
|
1138
1138
|
style: {
|
|
1139
1139
|
padding: "8px 16px",
|
|
1140
1140
|
fontSize: "12px",
|
|
1141
|
-
color:
|
|
1141
|
+
color: r.colors.textMuted,
|
|
1142
1142
|
textAlign: "center",
|
|
1143
|
-
borderTop: `1px solid ${
|
|
1143
|
+
borderTop: `1px solid ${r.colors.border}`
|
|
1144
1144
|
},
|
|
1145
1145
|
children: [
|
|
1146
1146
|
"Showing ",
|
|
1147
1147
|
s,
|
|
1148
1148
|
" of ",
|
|
1149
|
-
|
|
1149
|
+
a.length,
|
|
1150
1150
|
" results"
|
|
1151
1151
|
]
|
|
1152
1152
|
}
|
|
@@ -1154,35 +1154,35 @@ const te = ({
|
|
|
1154
1154
|
]
|
|
1155
1155
|
}
|
|
1156
1156
|
);
|
|
1157
|
-
},
|
|
1158
|
-
commandPalette:
|
|
1157
|
+
}, Ae = ({
|
|
1158
|
+
commandPalette: a,
|
|
1159
1159
|
config: e
|
|
1160
1160
|
}) => {
|
|
1161
|
-
const { theme: t } =
|
|
1161
|
+
const { theme: t } = O(), o = W(null), {
|
|
1162
1162
|
isOpen: s,
|
|
1163
|
-
close:
|
|
1164
|
-
query:
|
|
1165
|
-
setQuery:
|
|
1166
|
-
filteredCommands:
|
|
1167
|
-
selectedIndex:
|
|
1168
|
-
setSelectedIndex:
|
|
1169
|
-
executeSelected:
|
|
1170
|
-
} =
|
|
1163
|
+
close: r,
|
|
1164
|
+
query: n,
|
|
1165
|
+
setQuery: i,
|
|
1166
|
+
filteredCommands: m,
|
|
1167
|
+
selectedIndex: y,
|
|
1168
|
+
setSelectedIndex: h,
|
|
1169
|
+
executeSelected: d
|
|
1170
|
+
} = a;
|
|
1171
1171
|
if (P(() => {
|
|
1172
1172
|
if (!s) return;
|
|
1173
|
-
const c = (
|
|
1174
|
-
|
|
1175
|
-
},
|
|
1173
|
+
const c = (b) => {
|
|
1174
|
+
o.current && !o.current.contains(b.target) && r();
|
|
1175
|
+
}, l = setTimeout(() => {
|
|
1176
1176
|
document.addEventListener("mousedown", c);
|
|
1177
1177
|
}, 100);
|
|
1178
1178
|
return () => {
|
|
1179
|
-
clearTimeout(
|
|
1179
|
+
clearTimeout(l), document.removeEventListener("mousedown", c);
|
|
1180
1180
|
};
|
|
1181
|
-
}, [s,
|
|
1181
|
+
}, [s, r]), !s)
|
|
1182
1182
|
return null;
|
|
1183
|
-
const
|
|
1184
|
-
return /* @__PURE__ */
|
|
1185
|
-
/* @__PURE__ */
|
|
1183
|
+
const u = (e == null ? void 0 : e.maxHeight) || "50vh", f = (e == null ? void 0 : e.placeholder) || "> Type a command...";
|
|
1184
|
+
return /* @__PURE__ */ I(U, { children: [
|
|
1185
|
+
/* @__PURE__ */ R(
|
|
1186
1186
|
"div",
|
|
1187
1187
|
{
|
|
1188
1188
|
style: {
|
|
@@ -1192,20 +1192,20 @@ const te = ({
|
|
|
1192
1192
|
backdropFilter: "blur(2px)",
|
|
1193
1193
|
zIndex: 999
|
|
1194
1194
|
},
|
|
1195
|
-
onClick:
|
|
1195
|
+
onClick: r
|
|
1196
1196
|
}
|
|
1197
1197
|
),
|
|
1198
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ I(
|
|
1199
1199
|
"div",
|
|
1200
1200
|
{
|
|
1201
|
-
ref:
|
|
1201
|
+
ref: o,
|
|
1202
1202
|
className: e == null ? void 0 : e.className,
|
|
1203
1203
|
style: {
|
|
1204
1204
|
position: "fixed",
|
|
1205
1205
|
bottom: 0,
|
|
1206
1206
|
left: 0,
|
|
1207
1207
|
right: 0,
|
|
1208
|
-
maxHeight:
|
|
1208
|
+
maxHeight: u,
|
|
1209
1209
|
backgroundColor: t.colors.surface,
|
|
1210
1210
|
borderTop: `1px solid ${t.colors.border}`,
|
|
1211
1211
|
boxShadow: t.shadows[2],
|
|
@@ -1215,18 +1215,18 @@ const te = ({
|
|
|
1215
1215
|
...e == null ? void 0 : e.style
|
|
1216
1216
|
},
|
|
1217
1217
|
children: [
|
|
1218
|
-
/* @__PURE__ */
|
|
1219
|
-
/* @__PURE__ */
|
|
1220
|
-
|
|
1218
|
+
/* @__PURE__ */ I("div", { children: [
|
|
1219
|
+
/* @__PURE__ */ R(
|
|
1220
|
+
te,
|
|
1221
1221
|
{
|
|
1222
|
-
value:
|
|
1223
|
-
onChange:
|
|
1224
|
-
placeholder:
|
|
1225
|
-
onClose:
|
|
1226
|
-
onEnter:
|
|
1222
|
+
value: n,
|
|
1223
|
+
onChange: i,
|
|
1224
|
+
placeholder: f,
|
|
1225
|
+
onClose: r,
|
|
1226
|
+
onEnter: d
|
|
1227
1227
|
}
|
|
1228
1228
|
),
|
|
1229
|
-
/* @__PURE__ */
|
|
1229
|
+
/* @__PURE__ */ I(
|
|
1230
1230
|
"div",
|
|
1231
1231
|
{
|
|
1232
1232
|
style: {
|
|
@@ -1239,31 +1239,31 @@ const te = ({
|
|
|
1239
1239
|
backgroundColor: t.colors.background
|
|
1240
1240
|
},
|
|
1241
1241
|
children: [
|
|
1242
|
-
/* @__PURE__ */
|
|
1243
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ I("span", { children: [
|
|
1243
|
+
/* @__PURE__ */ R("kbd", { style: { padding: "2px 6px", backgroundColor: t.colors.backgroundSecondary, borderRadius: "3px", border: `1px solid ${t.colors.border}` }, children: "Enter" }),
|
|
1244
1244
|
" Execute"
|
|
1245
1245
|
] }),
|
|
1246
|
-
/* @__PURE__ */
|
|
1247
|
-
/* @__PURE__ */
|
|
1246
|
+
/* @__PURE__ */ I("span", { children: [
|
|
1247
|
+
/* @__PURE__ */ R("kbd", { style: { padding: "2px 6px", backgroundColor: t.colors.backgroundSecondary, borderRadius: "3px", border: `1px solid ${t.colors.border}` }, children: "Esc" }),
|
|
1248
1248
|
" Close"
|
|
1249
1249
|
] })
|
|
1250
1250
|
]
|
|
1251
1251
|
}
|
|
1252
1252
|
)
|
|
1253
1253
|
] }),
|
|
1254
|
-
|
|
1255
|
-
|
|
1254
|
+
m.length > 0 && /* @__PURE__ */ R(
|
|
1255
|
+
ae,
|
|
1256
1256
|
{
|
|
1257
|
-
commands:
|
|
1258
|
-
selectedIndex:
|
|
1257
|
+
commands: m,
|
|
1258
|
+
selectedIndex: y,
|
|
1259
1259
|
onSelect: (c) => {
|
|
1260
|
-
|
|
1260
|
+
a.executeCommand(c.id);
|
|
1261
1261
|
},
|
|
1262
|
-
onHover:
|
|
1262
|
+
onHover: h,
|
|
1263
1263
|
maxResults: e == null ? void 0 : e.maxResults
|
|
1264
1264
|
}
|
|
1265
1265
|
),
|
|
1266
|
-
|
|
1266
|
+
n && m.length === 0 && /* @__PURE__ */ I(
|
|
1267
1267
|
"div",
|
|
1268
1268
|
{
|
|
1269
1269
|
style: {
|
|
@@ -1274,7 +1274,7 @@ const te = ({
|
|
|
1274
1274
|
},
|
|
1275
1275
|
children: [
|
|
1276
1276
|
'No commands found for "',
|
|
1277
|
-
|
|
1277
|
+
n,
|
|
1278
1278
|
'"'
|
|
1279
1279
|
]
|
|
1280
1280
|
}
|
|
@@ -1284,10 +1284,10 @@ const te = ({
|
|
|
1284
1284
|
)
|
|
1285
1285
|
] });
|
|
1286
1286
|
};
|
|
1287
|
-
class
|
|
1287
|
+
class M {
|
|
1288
1288
|
constructor() {
|
|
1289
|
-
|
|
1290
|
-
|
|
1289
|
+
_(this, "commands", /* @__PURE__ */ new Map());
|
|
1290
|
+
_(this, "listeners", /* @__PURE__ */ new Set());
|
|
1291
1291
|
}
|
|
1292
1292
|
/**
|
|
1293
1293
|
* Register one or more commands
|
|
@@ -1328,7 +1328,7 @@ class B {
|
|
|
1328
1328
|
*/
|
|
1329
1329
|
getCommands(e) {
|
|
1330
1330
|
const t = Array.from(this.commands.values());
|
|
1331
|
-
return e ? t.filter((
|
|
1331
|
+
return e ? t.filter((o) => o.isAvailable ? o.isAvailable(e) : !0) : t;
|
|
1332
1332
|
}
|
|
1333
1333
|
/**
|
|
1334
1334
|
* Get a command by ID
|
|
@@ -1344,34 +1344,34 @@ class B {
|
|
|
1344
1344
|
* @param context - Command context
|
|
1345
1345
|
*/
|
|
1346
1346
|
async executeCommand(e, t) {
|
|
1347
|
-
var s,
|
|
1348
|
-
const
|
|
1349
|
-
if (!
|
|
1347
|
+
var s, r;
|
|
1348
|
+
const o = this.commands.get(e);
|
|
1349
|
+
if (!o) {
|
|
1350
1350
|
console.warn(`Command not found: ${e}`);
|
|
1351
1351
|
return;
|
|
1352
1352
|
}
|
|
1353
|
-
if (
|
|
1353
|
+
if (o.isAvailable && !o.isAvailable(t)) {
|
|
1354
1354
|
console.warn(`Command not available: ${e}`);
|
|
1355
1355
|
return;
|
|
1356
1356
|
}
|
|
1357
1357
|
try {
|
|
1358
|
-
await
|
|
1358
|
+
await o.execute(t), (s = t.events) == null || s.emit({
|
|
1359
1359
|
type: "command:executed",
|
|
1360
1360
|
source: "command-palette",
|
|
1361
1361
|
timestamp: Date.now(),
|
|
1362
1362
|
payload: {
|
|
1363
|
-
commandId:
|
|
1364
|
-
commandLabel:
|
|
1363
|
+
commandId: o.id,
|
|
1364
|
+
commandLabel: o.label
|
|
1365
1365
|
}
|
|
1366
1366
|
});
|
|
1367
|
-
} catch (
|
|
1368
|
-
console.error(`Error executing command ${e}:`,
|
|
1367
|
+
} catch (n) {
|
|
1368
|
+
console.error(`Error executing command ${e}:`, n), (r = t.events) == null || r.emit({
|
|
1369
1369
|
type: "command:error",
|
|
1370
1370
|
source: "command-palette",
|
|
1371
1371
|
timestamp: Date.now(),
|
|
1372
1372
|
payload: {
|
|
1373
|
-
commandId:
|
|
1374
|
-
error:
|
|
1373
|
+
commandId: o.id,
|
|
1374
|
+
error: n instanceof Error ? n.message : String(n)
|
|
1375
1375
|
}
|
|
1376
1376
|
});
|
|
1377
1377
|
}
|
|
@@ -1383,17 +1383,17 @@ class B {
|
|
|
1383
1383
|
* @returns Filtered and sorted commands
|
|
1384
1384
|
*/
|
|
1385
1385
|
searchCommands(e, t) {
|
|
1386
|
-
const
|
|
1386
|
+
const o = this.getCommands(t);
|
|
1387
1387
|
if (!e.trim())
|
|
1388
|
-
return this.sortCommands(
|
|
1388
|
+
return this.sortCommands(o);
|
|
1389
1389
|
const s = e.toLowerCase();
|
|
1390
|
-
return
|
|
1391
|
-
var
|
|
1392
|
-
let
|
|
1393
|
-
return
|
|
1394
|
-
(
|
|
1395
|
-
) && (
|
|
1396
|
-
}).filter((
|
|
1390
|
+
return o.map((n) => {
|
|
1391
|
+
var m, y;
|
|
1392
|
+
let i = 0;
|
|
1393
|
+
return n.label.toLowerCase() === s ? i += 1e3 : n.label.toLowerCase().startsWith(s) ? i += 500 : n.label.toLowerCase().includes(s) && (i += 250), (m = n.description) != null && m.toLowerCase().includes(s) && (i += 100), n.keywords && n.keywords.some(
|
|
1394
|
+
(d) => d.toLowerCase().includes(s)
|
|
1395
|
+
) && (i += 150), (y = n.category) != null && y.toLowerCase().includes(s) && (i += 50), i > 0 && n.priority && (i += n.priority), { command: n, score: i };
|
|
1396
|
+
}).filter((n) => n.score > 0).sort((n, i) => i.score - n.score).map((n) => n.command);
|
|
1397
1397
|
}
|
|
1398
1398
|
/**
|
|
1399
1399
|
* Sort commands by priority and label
|
|
@@ -1401,12 +1401,12 @@ class B {
|
|
|
1401
1401
|
* @returns Sorted commands
|
|
1402
1402
|
*/
|
|
1403
1403
|
sortCommands(e) {
|
|
1404
|
-
return e.sort((t,
|
|
1405
|
-
const s = (
|
|
1404
|
+
return e.sort((t, o) => {
|
|
1405
|
+
const s = (o.priority || 0) - (t.priority || 0);
|
|
1406
1406
|
if (s !== 0)
|
|
1407
1407
|
return s;
|
|
1408
|
-
const
|
|
1409
|
-
return
|
|
1408
|
+
const r = t.category || "", n = o.category || "", i = r.localeCompare(n);
|
|
1409
|
+
return i !== 0 ? i : t.label.localeCompare(o.label);
|
|
1410
1410
|
});
|
|
1411
1411
|
}
|
|
1412
1412
|
/**
|
|
@@ -1438,136 +1438,136 @@ class B {
|
|
|
1438
1438
|
this.listeners.forEach((e) => e());
|
|
1439
1439
|
}
|
|
1440
1440
|
}
|
|
1441
|
-
let
|
|
1442
|
-
function
|
|
1443
|
-
return
|
|
1441
|
+
let F = null;
|
|
1442
|
+
function We() {
|
|
1443
|
+
return F || (F = new M()), F;
|
|
1444
1444
|
}
|
|
1445
|
-
function
|
|
1446
|
-
|
|
1445
|
+
function ze() {
|
|
1446
|
+
F = null;
|
|
1447
1447
|
}
|
|
1448
|
-
function
|
|
1449
|
-
context:
|
|
1448
|
+
function Le({
|
|
1449
|
+
context: a,
|
|
1450
1450
|
commands: e = [],
|
|
1451
1451
|
keyboard: t = { key: " ", altKey: !0 },
|
|
1452
|
-
config:
|
|
1452
|
+
config: o = {},
|
|
1453
1453
|
registry: s
|
|
1454
1454
|
}) {
|
|
1455
|
-
const [
|
|
1456
|
-
() => s || new
|
|
1455
|
+
const [r, n] = A(!1), [i, m] = A(""), [y, h] = A(0), [d, u] = A([]), f = q(
|
|
1456
|
+
() => s || new M(),
|
|
1457
1457
|
[s]
|
|
1458
|
-
), c =
|
|
1458
|
+
), c = q(
|
|
1459
1459
|
() => ({
|
|
1460
|
-
...
|
|
1461
|
-
closeCommandPalette: () =>
|
|
1460
|
+
...a,
|
|
1461
|
+
closeCommandPalette: () => n(!1)
|
|
1462
1462
|
}),
|
|
1463
|
-
[
|
|
1463
|
+
[a]
|
|
1464
1464
|
);
|
|
1465
1465
|
P(() => {
|
|
1466
|
-
let
|
|
1467
|
-
const
|
|
1468
|
-
if (
|
|
1469
|
-
const L =
|
|
1470
|
-
|
|
1466
|
+
let p = !0;
|
|
1467
|
+
const C = f.subscribe(() => {
|
|
1468
|
+
if (p) {
|
|
1469
|
+
const L = f.getCommands(c);
|
|
1470
|
+
u(L);
|
|
1471
1471
|
}
|
|
1472
1472
|
});
|
|
1473
1473
|
if (e.length > 0)
|
|
1474
|
-
|
|
1474
|
+
f.registerCommands(e);
|
|
1475
1475
|
else {
|
|
1476
|
-
const L =
|
|
1477
|
-
|
|
1476
|
+
const L = f.getCommands(c);
|
|
1477
|
+
u(L);
|
|
1478
1478
|
}
|
|
1479
1479
|
return () => {
|
|
1480
|
-
|
|
1480
|
+
p = !1, C();
|
|
1481
1481
|
};
|
|
1482
|
-
}, [
|
|
1483
|
-
const
|
|
1482
|
+
}, [f]);
|
|
1483
|
+
const l = q(() => (o.fuzzySearch === !1, f.searchCommands(i, c)), [i, f, c, o.fuzzySearch]);
|
|
1484
1484
|
P(() => {
|
|
1485
|
-
|
|
1486
|
-
}, [
|
|
1487
|
-
const
|
|
1488
|
-
var
|
|
1489
|
-
|
|
1485
|
+
h(0);
|
|
1486
|
+
}, [l]);
|
|
1487
|
+
const b = g(() => {
|
|
1488
|
+
var p;
|
|
1489
|
+
n(!0), m(""), h(0), (p = a.events) == null || p.emit({
|
|
1490
1490
|
type: "command-palette:opened",
|
|
1491
1491
|
source: "command-palette",
|
|
1492
1492
|
timestamp: Date.now(),
|
|
1493
1493
|
payload: {}
|
|
1494
1494
|
});
|
|
1495
|
-
}, [
|
|
1496
|
-
var
|
|
1497
|
-
|
|
1495
|
+
}, [a.events]), S = g(() => {
|
|
1496
|
+
var p;
|
|
1497
|
+
n(!1), m(""), h(0), (p = a.events) == null || p.emit({
|
|
1498
1498
|
type: "command-palette:closed",
|
|
1499
1499
|
source: "command-palette",
|
|
1500
1500
|
timestamp: Date.now(),
|
|
1501
1501
|
payload: {}
|
|
1502
1502
|
});
|
|
1503
|
-
}, [
|
|
1504
|
-
|
|
1505
|
-
}, [
|
|
1506
|
-
async (
|
|
1507
|
-
await
|
|
1503
|
+
}, [a.events]), z = g(() => {
|
|
1504
|
+
r ? S() : b();
|
|
1505
|
+
}, [r, b, S]), E = g(
|
|
1506
|
+
async (p) => {
|
|
1507
|
+
await f.executeCommand(p, c), S();
|
|
1508
1508
|
},
|
|
1509
|
-
[
|
|
1510
|
-
),
|
|
1511
|
-
|
|
1512
|
-
const
|
|
1513
|
-
return
|
|
1509
|
+
[f, c, S]
|
|
1510
|
+
), D = g(() => {
|
|
1511
|
+
h((p) => {
|
|
1512
|
+
const C = o.maxResults || l.length, L = Math.min(l.length, C) - 1;
|
|
1513
|
+
return p < L ? p + 1 : 0;
|
|
1514
1514
|
});
|
|
1515
|
-
}, [
|
|
1516
|
-
|
|
1517
|
-
const
|
|
1518
|
-
return
|
|
1515
|
+
}, [l.length, o.maxResults]), $ = g(() => {
|
|
1516
|
+
h((p) => {
|
|
1517
|
+
const C = o.maxResults || l.length, L = Math.min(l.length, C) - 1;
|
|
1518
|
+
return p > 0 ? p - 1 : L;
|
|
1519
1519
|
});
|
|
1520
|
-
}, [
|
|
1521
|
-
const
|
|
1522
|
-
|
|
1523
|
-
}, [
|
|
1524
|
-
(
|
|
1525
|
-
|
|
1520
|
+
}, [l.length, o.maxResults]), w = g(async () => {
|
|
1521
|
+
const p = l[0];
|
|
1522
|
+
p && await E(p.id);
|
|
1523
|
+
}, [l, E]), x = g(
|
|
1524
|
+
(p) => {
|
|
1525
|
+
f.registerCommands(p);
|
|
1526
1526
|
},
|
|
1527
|
-
[
|
|
1528
|
-
),
|
|
1529
|
-
(
|
|
1530
|
-
|
|
1527
|
+
[f]
|
|
1528
|
+
), v = g(
|
|
1529
|
+
(p) => {
|
|
1530
|
+
f.unregisterCommands(p);
|
|
1531
1531
|
},
|
|
1532
|
-
[
|
|
1533
|
-
), k =
|
|
1534
|
-
(
|
|
1532
|
+
[f]
|
|
1533
|
+
), k = g(
|
|
1534
|
+
(p) => {
|
|
1535
1535
|
const {
|
|
1536
|
-
key:
|
|
1536
|
+
key: C = " ",
|
|
1537
1537
|
altKey: L = !0,
|
|
1538
|
-
ctrlKey:
|
|
1539
|
-
metaKey:
|
|
1540
|
-
shiftKey:
|
|
1541
|
-
} = t, H =
|
|
1542
|
-
if ((
|
|
1543
|
-
const
|
|
1544
|
-
if (
|
|
1538
|
+
ctrlKey: V = !1,
|
|
1539
|
+
metaKey: B = !1,
|
|
1540
|
+
shiftKey: J = !1
|
|
1541
|
+
} = t, H = p.altKey === L && p.ctrlKey === V && p.metaKey === B && p.shiftKey === J;
|
|
1542
|
+
if ((C === " " ? p.code === "Space" : p.key === C) && H) {
|
|
1543
|
+
const N = p.target;
|
|
1544
|
+
if (N.tagName === "INPUT" || N.tagName === "TEXTAREA" || N.isContentEditable)
|
|
1545
1545
|
return;
|
|
1546
|
-
|
|
1546
|
+
p.preventDefault(), z();
|
|
1547
1547
|
}
|
|
1548
1548
|
},
|
|
1549
|
-
[t,
|
|
1549
|
+
[t, z]
|
|
1550
1550
|
);
|
|
1551
1551
|
return P(() => (window.addEventListener("keydown", k), () => window.removeEventListener("keydown", k)), [k]), {
|
|
1552
|
-
isOpen:
|
|
1553
|
-
open:
|
|
1552
|
+
isOpen: r,
|
|
1553
|
+
open: b,
|
|
1554
1554
|
close: S,
|
|
1555
|
-
toggle:
|
|
1556
|
-
query:
|
|
1557
|
-
setQuery:
|
|
1558
|
-
filteredCommands:
|
|
1555
|
+
toggle: z,
|
|
1556
|
+
query: i,
|
|
1557
|
+
setQuery: m,
|
|
1558
|
+
filteredCommands: l,
|
|
1559
1559
|
executeCommand: E,
|
|
1560
|
-
selectedIndex:
|
|
1561
|
-
setSelectedIndex:
|
|
1562
|
-
selectNext:
|
|
1560
|
+
selectedIndex: y,
|
|
1561
|
+
setSelectedIndex: h,
|
|
1562
|
+
selectNext: D,
|
|
1563
1563
|
selectPrevious: $,
|
|
1564
|
-
executeSelected:
|
|
1565
|
-
commands:
|
|
1566
|
-
registerCommands:
|
|
1567
|
-
unregisterCommands:
|
|
1564
|
+
executeSelected: w,
|
|
1565
|
+
commands: d,
|
|
1566
|
+
registerCommands: x,
|
|
1567
|
+
unregisterCommands: v
|
|
1568
1568
|
};
|
|
1569
1569
|
}
|
|
1570
|
-
const
|
|
1570
|
+
const oe = [
|
|
1571
1571
|
{
|
|
1572
1572
|
id: "panel.focus.left",
|
|
1573
1573
|
label: "Focus Left Panel",
|
|
@@ -1577,10 +1577,10 @@ const ae = [
|
|
|
1577
1577
|
shortcut: "Alt+1",
|
|
1578
1578
|
priority: 100,
|
|
1579
1579
|
keywords: ["left", "sidebar", "focus", "switch"],
|
|
1580
|
-
execute: (
|
|
1581
|
-
|
|
1580
|
+
execute: (a) => {
|
|
1581
|
+
a.setFocus("left");
|
|
1582
1582
|
},
|
|
1583
|
-
isAvailable: (
|
|
1583
|
+
isAvailable: (a) => a.focusedPanel !== "left"
|
|
1584
1584
|
},
|
|
1585
1585
|
{
|
|
1586
1586
|
id: "panel.focus.middle",
|
|
@@ -1591,10 +1591,10 @@ const ae = [
|
|
|
1591
1591
|
shortcut: "Alt+2",
|
|
1592
1592
|
priority: 100,
|
|
1593
1593
|
keywords: ["middle", "center", "main", "focus", "switch"],
|
|
1594
|
-
execute: (
|
|
1595
|
-
|
|
1594
|
+
execute: (a) => {
|
|
1595
|
+
a.setFocus("middle");
|
|
1596
1596
|
},
|
|
1597
|
-
isAvailable: (
|
|
1597
|
+
isAvailable: (a) => a.focusedPanel !== "middle"
|
|
1598
1598
|
},
|
|
1599
1599
|
{
|
|
1600
1600
|
id: "panel.focus.right",
|
|
@@ -1605,10 +1605,10 @@ const ae = [
|
|
|
1605
1605
|
shortcut: "Alt+3",
|
|
1606
1606
|
priority: 100,
|
|
1607
1607
|
keywords: ["right", "sidebar", "focus", "switch"],
|
|
1608
|
-
execute: (
|
|
1609
|
-
|
|
1608
|
+
execute: (a) => {
|
|
1609
|
+
a.setFocus("right");
|
|
1610
1610
|
},
|
|
1611
|
-
isAvailable: (
|
|
1611
|
+
isAvailable: (a) => a.focusedPanel !== "right"
|
|
1612
1612
|
},
|
|
1613
1613
|
{
|
|
1614
1614
|
id: "panel.toggle.left",
|
|
@@ -1618,9 +1618,9 @@ const ae = [
|
|
|
1618
1618
|
category: "Panel Control",
|
|
1619
1619
|
keywords: ["toggle", "left", "collapse", "expand", "hide", "show"],
|
|
1620
1620
|
priority: 80,
|
|
1621
|
-
execute: (
|
|
1621
|
+
execute: (a) => {
|
|
1622
1622
|
var e;
|
|
1623
|
-
(e =
|
|
1623
|
+
(e = a.events) == null || e.emit({
|
|
1624
1624
|
type: "panel:toggle",
|
|
1625
1625
|
source: "command-palette",
|
|
1626
1626
|
timestamp: Date.now(),
|
|
@@ -1636,9 +1636,9 @@ const ae = [
|
|
|
1636
1636
|
category: "Panel Control",
|
|
1637
1637
|
keywords: ["toggle", "right", "collapse", "expand", "hide", "show"],
|
|
1638
1638
|
priority: 80,
|
|
1639
|
-
execute: (
|
|
1639
|
+
execute: (a) => {
|
|
1640
1640
|
var e;
|
|
1641
|
-
(e =
|
|
1641
|
+
(e = a.events) == null || e.emit({
|
|
1642
1642
|
type: "panel:toggle",
|
|
1643
1643
|
source: "command-palette",
|
|
1644
1644
|
timestamp: Date.now(),
|
|
@@ -1654,9 +1654,9 @@ const ae = [
|
|
|
1654
1654
|
category: "Panel Control",
|
|
1655
1655
|
keywords: ["collapse", "hide", "all", "maximize", "focus mode"],
|
|
1656
1656
|
priority: 70,
|
|
1657
|
-
execute: (
|
|
1657
|
+
execute: (a) => {
|
|
1658
1658
|
var e;
|
|
1659
|
-
(e =
|
|
1659
|
+
(e = a.events) == null || e.emit({
|
|
1660
1660
|
type: "panel:collapse-all",
|
|
1661
1661
|
source: "command-palette",
|
|
1662
1662
|
timestamp: Date.now(),
|
|
@@ -1672,9 +1672,9 @@ const ae = [
|
|
|
1672
1672
|
category: "Panel Control",
|
|
1673
1673
|
keywords: ["expand", "show", "all", "restore", "default"],
|
|
1674
1674
|
priority: 70,
|
|
1675
|
-
execute: (
|
|
1675
|
+
execute: (a) => {
|
|
1676
1676
|
var e;
|
|
1677
|
-
(e =
|
|
1677
|
+
(e = a.events) == null || e.emit({
|
|
1678
1678
|
type: "panel:expand-all",
|
|
1679
1679
|
source: "command-palette",
|
|
1680
1680
|
timestamp: Date.now(),
|
|
@@ -1690,17 +1690,17 @@ const ae = [
|
|
|
1690
1690
|
category: "Panel Control",
|
|
1691
1691
|
keywords: ["refresh", "reload", "update", "sync"],
|
|
1692
1692
|
priority: 60,
|
|
1693
|
-
execute: (
|
|
1693
|
+
execute: (a) => {
|
|
1694
1694
|
var t;
|
|
1695
|
-
const e =
|
|
1696
|
-
e && ((t =
|
|
1695
|
+
const e = a.focusedPanel;
|
|
1696
|
+
e && ((t = a.events) == null || t.emit({
|
|
1697
1697
|
type: "panel:refresh",
|
|
1698
1698
|
source: "command-palette",
|
|
1699
1699
|
timestamp: Date.now(),
|
|
1700
1700
|
payload: { panelId: e }
|
|
1701
1701
|
}));
|
|
1702
1702
|
},
|
|
1703
|
-
isAvailable: (
|
|
1703
|
+
isAvailable: (a) => a.focusedPanel !== null
|
|
1704
1704
|
},
|
|
1705
1705
|
{
|
|
1706
1706
|
id: "panel.reset.layout",
|
|
@@ -1710,9 +1710,9 @@ const ae = [
|
|
|
1710
1710
|
category: "Panel Control",
|
|
1711
1711
|
keywords: ["reset", "layout", "default", "restore"],
|
|
1712
1712
|
priority: 50,
|
|
1713
|
-
execute: (
|
|
1713
|
+
execute: (a) => {
|
|
1714
1714
|
var e;
|
|
1715
|
-
(e =
|
|
1715
|
+
(e = a.events) == null || e.emit({
|
|
1716
1716
|
type: "panel:reset-layout",
|
|
1717
1717
|
source: "command-palette",
|
|
1718
1718
|
timestamp: Date.now(),
|
|
@@ -1721,32 +1721,363 @@ const ae = [
|
|
|
1721
1721
|
}
|
|
1722
1722
|
}
|
|
1723
1723
|
];
|
|
1724
|
-
function
|
|
1725
|
-
return
|
|
1724
|
+
function Ee() {
|
|
1725
|
+
return oe;
|
|
1726
|
+
}
|
|
1727
|
+
const se = {
|
|
1728
|
+
name: "toggle_panel",
|
|
1729
|
+
description: "Collapse or expand a side panel to give more space to the main content area.",
|
|
1730
|
+
inputs: {
|
|
1731
|
+
type: "object",
|
|
1732
|
+
properties: {
|
|
1733
|
+
panel: {
|
|
1734
|
+
type: "string",
|
|
1735
|
+
enum: ["left", "right"],
|
|
1736
|
+
description: 'Which panel to toggle: "left" or "right"'
|
|
1737
|
+
}
|
|
1738
|
+
},
|
|
1739
|
+
required: ["panel"]
|
|
1740
|
+
},
|
|
1741
|
+
outputs: {
|
|
1742
|
+
type: "object",
|
|
1743
|
+
properties: {
|
|
1744
|
+
success: { type: "boolean" },
|
|
1745
|
+
panel: { type: "string" },
|
|
1746
|
+
action: { type: "string" }
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
tags: ["panel", "layout", "toggle", "collapse", "expand", "sidebar"],
|
|
1750
|
+
tool_call_template: {
|
|
1751
|
+
call_template_type: "panel_event",
|
|
1752
|
+
event_type: "panel:toggle"
|
|
1753
|
+
}
|
|
1754
|
+
}, re = {
|
|
1755
|
+
name: "collapse_all_panels",
|
|
1756
|
+
description: "Collapse both left and right panels to maximize the main content area. Useful for focus mode.",
|
|
1757
|
+
inputs: {
|
|
1758
|
+
type: "object",
|
|
1759
|
+
properties: {},
|
|
1760
|
+
required: []
|
|
1761
|
+
},
|
|
1762
|
+
outputs: {
|
|
1763
|
+
type: "object",
|
|
1764
|
+
properties: {
|
|
1765
|
+
success: { type: "boolean" },
|
|
1766
|
+
action: { type: "string" }
|
|
1767
|
+
}
|
|
1768
|
+
},
|
|
1769
|
+
tags: ["panel", "layout", "collapse", "focus", "maximize"],
|
|
1770
|
+
tool_call_template: {
|
|
1771
|
+
call_template_type: "panel_event",
|
|
1772
|
+
event_type: "panel:collapse-all"
|
|
1773
|
+
}
|
|
1774
|
+
}, ne = {
|
|
1775
|
+
name: "expand_all_panels",
|
|
1776
|
+
description: "Expand both left and right panels to show all content. Restores the default layout.",
|
|
1777
|
+
inputs: {
|
|
1778
|
+
type: "object",
|
|
1779
|
+
properties: {},
|
|
1780
|
+
required: []
|
|
1781
|
+
},
|
|
1782
|
+
outputs: {
|
|
1783
|
+
type: "object",
|
|
1784
|
+
properties: {
|
|
1785
|
+
success: { type: "boolean" },
|
|
1786
|
+
action: { type: "string" }
|
|
1787
|
+
}
|
|
1788
|
+
},
|
|
1789
|
+
tags: ["panel", "layout", "expand", "restore", "show"],
|
|
1790
|
+
tool_call_template: {
|
|
1791
|
+
call_template_type: "panel_event",
|
|
1792
|
+
event_type: "panel:expand-all"
|
|
1793
|
+
}
|
|
1794
|
+
}, ie = {
|
|
1795
|
+
name: "switch_panel",
|
|
1796
|
+
description: "Change which content is displayed in a panel slot (left, middle, or right).",
|
|
1797
|
+
inputs: {
|
|
1798
|
+
type: "object",
|
|
1799
|
+
properties: {
|
|
1800
|
+
slot: {
|
|
1801
|
+
type: "string",
|
|
1802
|
+
enum: ["left", "middle", "right"],
|
|
1803
|
+
description: 'Which slot to change: "left", "middle", or "right"'
|
|
1804
|
+
},
|
|
1805
|
+
panel: {
|
|
1806
|
+
type: "string",
|
|
1807
|
+
description: "The panel ID to display in the slot"
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
required: ["slot", "panel"]
|
|
1811
|
+
},
|
|
1812
|
+
outputs: {
|
|
1813
|
+
type: "object",
|
|
1814
|
+
properties: {
|
|
1815
|
+
success: { type: "boolean" },
|
|
1816
|
+
slot: { type: "string" },
|
|
1817
|
+
panel: { type: "string" }
|
|
1818
|
+
}
|
|
1819
|
+
},
|
|
1820
|
+
tags: ["panel", "layout", "switch", "navigation", "view"],
|
|
1821
|
+
tool_call_template: {
|
|
1822
|
+
call_template_type: "panel_event",
|
|
1823
|
+
event_type: "panel:switch"
|
|
1824
|
+
}
|
|
1825
|
+
}, le = {
|
|
1826
|
+
name: "focus_panel",
|
|
1827
|
+
description: "Set focus to a specific panel slot for keyboard navigation.",
|
|
1828
|
+
inputs: {
|
|
1829
|
+
type: "object",
|
|
1830
|
+
properties: {
|
|
1831
|
+
slot: {
|
|
1832
|
+
type: "string",
|
|
1833
|
+
enum: ["left", "middle", "right"],
|
|
1834
|
+
description: 'Which slot to focus: "left", "middle", or "right"'
|
|
1835
|
+
}
|
|
1836
|
+
},
|
|
1837
|
+
required: ["slot"]
|
|
1838
|
+
},
|
|
1839
|
+
outputs: {
|
|
1840
|
+
type: "object",
|
|
1841
|
+
properties: {
|
|
1842
|
+
success: { type: "boolean" },
|
|
1843
|
+
slot: { type: "string" }
|
|
1844
|
+
}
|
|
1845
|
+
},
|
|
1846
|
+
tags: ["panel", "focus", "navigation", "keyboard"],
|
|
1847
|
+
tool_call_template: {
|
|
1848
|
+
call_template_type: "panel_event",
|
|
1849
|
+
event_type: "panel:focus"
|
|
1850
|
+
}
|
|
1851
|
+
}, ce = {
|
|
1852
|
+
name: "reset_layout",
|
|
1853
|
+
description: "Reset panel sizes to the default layout configuration.",
|
|
1854
|
+
inputs: {
|
|
1855
|
+
type: "object",
|
|
1856
|
+
properties: {},
|
|
1857
|
+
required: []
|
|
1858
|
+
},
|
|
1859
|
+
outputs: {
|
|
1860
|
+
type: "object",
|
|
1861
|
+
properties: {
|
|
1862
|
+
success: { type: "boolean" },
|
|
1863
|
+
action: { type: "string" }
|
|
1864
|
+
}
|
|
1865
|
+
},
|
|
1866
|
+
tags: ["panel", "layout", "reset", "default", "restore"],
|
|
1867
|
+
tool_call_template: {
|
|
1868
|
+
call_template_type: "panel_event",
|
|
1869
|
+
event_type: "panel:reset-layout"
|
|
1870
|
+
}
|
|
1871
|
+
}, de = [
|
|
1872
|
+
se,
|
|
1873
|
+
re,
|
|
1874
|
+
ne,
|
|
1875
|
+
ie,
|
|
1876
|
+
le,
|
|
1877
|
+
ce
|
|
1878
|
+
], _e = {
|
|
1879
|
+
id: "panel-layouts",
|
|
1880
|
+
name: "Panel Layouts",
|
|
1881
|
+
description: "Generic panel layout operations",
|
|
1882
|
+
tools: de
|
|
1883
|
+
};
|
|
1884
|
+
function pe(a, e, t = {}) {
|
|
1885
|
+
const {
|
|
1886
|
+
categoryPrefix: o = "Panel Tools",
|
|
1887
|
+
basePriority: s = 50,
|
|
1888
|
+
includePanelInCategory: r = !0
|
|
1889
|
+
} = t, n = r ? `${o} > ${a.panelId}` : o, i = fe(a.inputs);
|
|
1890
|
+
return {
|
|
1891
|
+
id: `tool.${a.qualifiedName}`,
|
|
1892
|
+
label: ue(a.name),
|
|
1893
|
+
description: a.description,
|
|
1894
|
+
category: n,
|
|
1895
|
+
keywords: [...a.tags, a.panelId, "tool"],
|
|
1896
|
+
priority: s,
|
|
1897
|
+
execute: async (m) => {
|
|
1898
|
+
var h;
|
|
1899
|
+
if (i) {
|
|
1900
|
+
console.warn(
|
|
1901
|
+
`Tool "${a.qualifiedName}" requires parameters. Invoke programmatically with: registry.invokeTool('${a.qualifiedName}', { ... })`
|
|
1902
|
+
), (h = m.events) == null || h.emit({
|
|
1903
|
+
type: "tool:requires-parameters",
|
|
1904
|
+
source: "command-palette",
|
|
1905
|
+
timestamp: Date.now(),
|
|
1906
|
+
payload: {
|
|
1907
|
+
toolName: a.qualifiedName,
|
|
1908
|
+
inputs: a.inputs
|
|
1909
|
+
}
|
|
1910
|
+
});
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
const y = await e.invokeTool(
|
|
1914
|
+
a.qualifiedName,
|
|
1915
|
+
{},
|
|
1916
|
+
"command-palette"
|
|
1917
|
+
);
|
|
1918
|
+
y.success || console.error(`Tool invocation failed: ${y.error}`), m.closeCommandPalette();
|
|
1919
|
+
}
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
function K(a, e = {}) {
|
|
1923
|
+
return a.getAllTools().map((o) => pe(o, a, e));
|
|
1924
|
+
}
|
|
1925
|
+
function De(a, e = {}) {
|
|
1926
|
+
return () => K(a, e);
|
|
1927
|
+
}
|
|
1928
|
+
function ue(a) {
|
|
1929
|
+
return a.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
|
|
1930
|
+
}
|
|
1931
|
+
function fe(a) {
|
|
1932
|
+
return !(a.type !== "object" || !a.required || a.required.length === 0);
|
|
1933
|
+
}
|
|
1934
|
+
function $e(a, e = {}) {
|
|
1935
|
+
return K(a, e);
|
|
1936
|
+
}
|
|
1937
|
+
function Fe(a) {
|
|
1938
|
+
const { inputs: e } = a;
|
|
1939
|
+
if (e.type !== "object" || !e.properties)
|
|
1940
|
+
return [];
|
|
1941
|
+
const t = new Set(e.required || []), o = [];
|
|
1942
|
+
for (const [s, r] of Object.entries(e.properties))
|
|
1943
|
+
o.push({
|
|
1944
|
+
name: s,
|
|
1945
|
+
type: r.type || "unknown",
|
|
1946
|
+
description: r.description || "",
|
|
1947
|
+
required: t.has(s),
|
|
1948
|
+
default: r.default,
|
|
1949
|
+
enum: r.enum
|
|
1950
|
+
});
|
|
1951
|
+
return o;
|
|
1952
|
+
}
|
|
1953
|
+
function me(a) {
|
|
1954
|
+
const e = {};
|
|
1955
|
+
if (a.inputs.properties)
|
|
1956
|
+
for (const [t, o] of Object.entries(a.inputs.properties)) {
|
|
1957
|
+
const s = o;
|
|
1958
|
+
e[t] = {
|
|
1959
|
+
type: s.type || "string",
|
|
1960
|
+
description: s.description,
|
|
1961
|
+
...s.enum && { enum: s.enum }
|
|
1962
|
+
};
|
|
1963
|
+
}
|
|
1964
|
+
return {
|
|
1965
|
+
name: a.name,
|
|
1966
|
+
description: a.description,
|
|
1967
|
+
parameters: {
|
|
1968
|
+
type: "object",
|
|
1969
|
+
properties: e,
|
|
1970
|
+
required: a.inputs.required || []
|
|
1971
|
+
}
|
|
1972
|
+
};
|
|
1973
|
+
}
|
|
1974
|
+
function Oe(a) {
|
|
1975
|
+
return {
|
|
1976
|
+
functionDeclarations: a.map(me)
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
function ye(a) {
|
|
1980
|
+
return {
|
|
1981
|
+
type: "function",
|
|
1982
|
+
function: {
|
|
1983
|
+
name: a.name,
|
|
1984
|
+
description: a.description,
|
|
1985
|
+
parameters: a.inputs
|
|
1986
|
+
}
|
|
1987
|
+
};
|
|
1988
|
+
}
|
|
1989
|
+
function Ne(a) {
|
|
1990
|
+
return a.map(ye);
|
|
1991
|
+
}
|
|
1992
|
+
function he(a) {
|
|
1993
|
+
return {
|
|
1994
|
+
name: a.name,
|
|
1995
|
+
description: a.description,
|
|
1996
|
+
input_schema: a.inputs
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
function qe(a) {
|
|
2000
|
+
return a.map(he);
|
|
2001
|
+
}
|
|
2002
|
+
function ge(a) {
|
|
2003
|
+
return {
|
|
2004
|
+
name: a.name,
|
|
2005
|
+
description: a.description,
|
|
2006
|
+
parameters: a.inputs
|
|
2007
|
+
};
|
|
2008
|
+
}
|
|
2009
|
+
function je(a) {
|
|
2010
|
+
return a.map(ge);
|
|
2011
|
+
}
|
|
2012
|
+
function Me(a, e = {}) {
|
|
2013
|
+
const {
|
|
2014
|
+
header: t = "You have access to the following tools:",
|
|
2015
|
+
includeParameters: o = !0
|
|
2016
|
+
} = e, s = a.map((r) => {
|
|
2017
|
+
let n = `- ${r.name}: ${r.description}`;
|
|
2018
|
+
if (o && r.inputs.properties) {
|
|
2019
|
+
const i = Object.entries(r.inputs.properties).map(([m, y]) => {
|
|
2020
|
+
var u;
|
|
2021
|
+
const h = y, d = (u = r.inputs.required) != null && u.includes(m) ? " (required)" : "";
|
|
2022
|
+
return ` - ${m}: ${h.description || h.type}${d}`;
|
|
2023
|
+
}).join(`
|
|
2024
|
+
`);
|
|
2025
|
+
i && (n += `
|
|
2026
|
+
${i}`);
|
|
2027
|
+
}
|
|
2028
|
+
return n;
|
|
2029
|
+
});
|
|
2030
|
+
return `${t}
|
|
2031
|
+
|
|
2032
|
+
${s.join(`
|
|
2033
|
+
|
|
2034
|
+
`)}`;
|
|
1726
2035
|
}
|
|
1727
2036
|
export {
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
2037
|
+
te as CommandInput,
|
|
2038
|
+
j as CommandItem,
|
|
2039
|
+
ae as CommandList,
|
|
2040
|
+
Ae as CommandPalette,
|
|
2041
|
+
M as CommandRegistryService,
|
|
2042
|
+
Be as EditableConfigurablePanelLayout,
|
|
2043
|
+
Ie as FocusIndicator,
|
|
1735
2044
|
Z as LocalStoragePersistenceAdapter,
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
2045
|
+
ee as LocalStorageWorkspaceAdapter,
|
|
2046
|
+
Je as ResponsiveConfigurablePanelLayout,
|
|
2047
|
+
T as WorkspaceLayoutService,
|
|
2048
|
+
re as collapseAllPanelsTool,
|
|
2049
|
+
De as createToolCommandsProvider,
|
|
2050
|
+
ne as expandAllPanelsTool,
|
|
2051
|
+
le as focusPanelTool,
|
|
2052
|
+
Me as generateToolsSystemPrompt,
|
|
2053
|
+
We as getGlobalCommandRegistry,
|
|
2054
|
+
Ee as getPanelCommands,
|
|
2055
|
+
Fe as getToolParameterInfo,
|
|
2056
|
+
de as layoutTools,
|
|
2057
|
+
_e as layoutToolsMetadata,
|
|
2058
|
+
He as mapThemeToPanelVars,
|
|
2059
|
+
Xe as mapThemeToTabVars,
|
|
2060
|
+
oe as panelCommands,
|
|
2061
|
+
ze as resetGlobalCommandRegistry,
|
|
2062
|
+
ce as resetLayoutTool,
|
|
2063
|
+
ie as switchPanelTool,
|
|
2064
|
+
se as togglePanelTool,
|
|
2065
|
+
ge as toolToAIFunction,
|
|
2066
|
+
he as toolToAnthropicFormat,
|
|
2067
|
+
pe as toolToCommand,
|
|
2068
|
+
me as toolToGeminiFunction,
|
|
2069
|
+
ye as toolToOpenAIFunction,
|
|
2070
|
+
je as toolsToAIFunctions,
|
|
2071
|
+
qe as toolsToAnthropicFormat,
|
|
2072
|
+
K as toolsToCommands,
|
|
2073
|
+
Oe as toolsToGeminiFormat,
|
|
2074
|
+
Ne as toolsToOpenAIFormat,
|
|
2075
|
+
Le as useCommandPalette,
|
|
2076
|
+
Pe as usePanelFocus,
|
|
2077
|
+
Re as usePanelFocusListener,
|
|
2078
|
+
Te as usePanelKeyboardShortcuts,
|
|
2079
|
+
Ce as usePanelPersistence,
|
|
2080
|
+
$e as useToolCommands,
|
|
2081
|
+
Se as useWorkspace
|
|
1751
2082
|
};
|
|
1752
2083
|
//# sourceMappingURL=index.esm.js.map
|