@principal-ade/panel-layouts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +466 -0
- package/dist/index.d.ts +580 -0
- package/dist/index.esm.js +767 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,767 @@
|
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var D = (n, e, t) => e in n ? $(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
|
+
var T = (n, e, t) => D(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { AnimatedResizableLayout as q, AnimatedVerticalLayout as K, ConfigurablePanelLayout as M, PanelConfigurator as X, SnapCarousel as Y, TabGroup as G, ThreePanelLayout as Q, mapThemeToPanelVars as Z, mapThemeToTabVars as H, useLocalStorage as U, useMediaQuery as ee } from "@a24z/panels";
|
|
5
|
+
import { useState as b, useRef as C, useEffect as R, useCallback as d } from "react";
|
|
6
|
+
class V {
|
|
7
|
+
constructor() {
|
|
8
|
+
T(this, "storageKey", "panel-layouts");
|
|
9
|
+
}
|
|
10
|
+
async load(e) {
|
|
11
|
+
try {
|
|
12
|
+
const t = localStorage.getItem(`${this.storageKey}:${e}`);
|
|
13
|
+
return t ? JSON.parse(t) : null;
|
|
14
|
+
} catch (t) {
|
|
15
|
+
return console.error(`Failed to load panel layout for ${e}:`, t), null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async save(e, t) {
|
|
19
|
+
try {
|
|
20
|
+
localStorage.setItem(
|
|
21
|
+
`${this.storageKey}:${e}`,
|
|
22
|
+
JSON.stringify(t)
|
|
23
|
+
);
|
|
24
|
+
} catch (a) {
|
|
25
|
+
console.error(`Failed to save panel layout for ${e}:`, a);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function x(n) {
|
|
30
|
+
const {
|
|
31
|
+
viewKey: e,
|
|
32
|
+
defaultSizes: t,
|
|
33
|
+
panelType: a,
|
|
34
|
+
adapter: s = new V()
|
|
35
|
+
} = n, [f, u] = b(t), [y, I] = b(n.collapsed), S = C(n.collapsed), v = C({}), h = C(null), k = C(null);
|
|
36
|
+
R(() => {
|
|
37
|
+
(async () => {
|
|
38
|
+
const c = await s.load(e);
|
|
39
|
+
c != null && c.sizes && (u(c.sizes), m(c.sizes));
|
|
40
|
+
})();
|
|
41
|
+
}, [e]);
|
|
42
|
+
const m = d(
|
|
43
|
+
(r) => {
|
|
44
|
+
"left" in r && r.left > 0 && (v.current.left = r.left), "middle" in r && r.middle > 0 && (v.current.middle = r.middle), "right" in r && r.right > 0 && (v.current.right = r.right);
|
|
45
|
+
},
|
|
46
|
+
[]
|
|
47
|
+
), l = d(
|
|
48
|
+
(r) => {
|
|
49
|
+
const c = v.current[r];
|
|
50
|
+
if (c && c > 0)
|
|
51
|
+
return c;
|
|
52
|
+
if (r === "left" && "left" in t && t.left > 0)
|
|
53
|
+
return t.left;
|
|
54
|
+
if (r === "right" && "right" in t && t.right > 0)
|
|
55
|
+
return t.right;
|
|
56
|
+
},
|
|
57
|
+
[t]
|
|
58
|
+
), W = C(t);
|
|
59
|
+
R(() => {
|
|
60
|
+
("left" in t && t.left !== W.current.left || "middle" in t && "middle" in W.current && t.middle !== W.current.middle || "right" in t && t.right !== W.current.right) && (u(t), m(t), W.current = t);
|
|
61
|
+
}, [t, m]), R(() => {
|
|
62
|
+
const r = n.collapsed.left !== S.current.left, c = "right" in n.collapsed && "right" in S.current && n.collapsed.right !== S.current.right;
|
|
63
|
+
(r || c) && (I(n.collapsed), S.current = { ...n.collapsed });
|
|
64
|
+
}, [n.collapsed.left, n.collapsed.right]);
|
|
65
|
+
const P = d(
|
|
66
|
+
async (r) => {
|
|
67
|
+
try {
|
|
68
|
+
await s.save(e, { sizes: r });
|
|
69
|
+
} catch (c) {
|
|
70
|
+
console.error(
|
|
71
|
+
`Failed to save panel preferences for ${e}:`,
|
|
72
|
+
c
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
[e, s]
|
|
77
|
+
), A = d(
|
|
78
|
+
(r) => {
|
|
79
|
+
const c = { ...r };
|
|
80
|
+
let o = !0;
|
|
81
|
+
if ("left" in r) {
|
|
82
|
+
const i = !!(y != null && y.left), g = r.left;
|
|
83
|
+
if (i) {
|
|
84
|
+
const w = l("left");
|
|
85
|
+
w !== void 0 && w > 0 ? c.left = w : o = !1;
|
|
86
|
+
} else g === 0 && (o = !1);
|
|
87
|
+
}
|
|
88
|
+
if (a === "three-panel" && "right" in r) {
|
|
89
|
+
const i = !!(y != null && y.right), g = r.right;
|
|
90
|
+
if (i) {
|
|
91
|
+
const w = l("right");
|
|
92
|
+
w !== void 0 && w > 0 ? c.right = w : o = !1;
|
|
93
|
+
} else g === 0 && (o = !1);
|
|
94
|
+
}
|
|
95
|
+
if (u(c), m(c), h.current && (clearTimeout(h.current), h.current = null), !o) {
|
|
96
|
+
k.current = null;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
k.current = c, h.current = setTimeout(() => {
|
|
100
|
+
const i = k.current;
|
|
101
|
+
i && (P(i), k.current = null), h.current = null;
|
|
102
|
+
}, 500);
|
|
103
|
+
},
|
|
104
|
+
[
|
|
105
|
+
y,
|
|
106
|
+
l,
|
|
107
|
+
a,
|
|
108
|
+
P,
|
|
109
|
+
m
|
|
110
|
+
]
|
|
111
|
+
);
|
|
112
|
+
R(() => () => {
|
|
113
|
+
if (h.current) {
|
|
114
|
+
const r = k.current;
|
|
115
|
+
r && (P(r), k.current = null), clearTimeout(h.current), h.current = null;
|
|
116
|
+
}
|
|
117
|
+
}, [P]);
|
|
118
|
+
const z = d(async () => {
|
|
119
|
+
}, []), L = d(async () => {
|
|
120
|
+
}, []), E = d(async () => {
|
|
121
|
+
}, []), O = d(async () => {
|
|
122
|
+
}, []);
|
|
123
|
+
return a === "three-panel" ? {
|
|
124
|
+
type: "three-panel",
|
|
125
|
+
sizes: f,
|
|
126
|
+
collapsed: y,
|
|
127
|
+
handlePanelResize: A,
|
|
128
|
+
handleLeftCollapseComplete: z,
|
|
129
|
+
handleLeftExpandComplete: L,
|
|
130
|
+
handleRightCollapseComplete: E,
|
|
131
|
+
handleRightExpandComplete: O
|
|
132
|
+
} : {
|
|
133
|
+
type: "two-panel",
|
|
134
|
+
sizes: f,
|
|
135
|
+
collapsed: y,
|
|
136
|
+
handlePanelResize: A,
|
|
137
|
+
handleLeftCollapseComplete: z,
|
|
138
|
+
handleLeftExpandComplete: L
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
class F {
|
|
142
|
+
constructor() {
|
|
143
|
+
T(this, "PRESETS_KEY", "panel-layouts:workspace-presets");
|
|
144
|
+
T(this, "REPO_STATE_PREFIX", "panel-layouts:repo-state:");
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Load all user-created workspace presets
|
|
148
|
+
*/
|
|
149
|
+
async loadWorkspacePresets() {
|
|
150
|
+
try {
|
|
151
|
+
const e = localStorage.getItem(this.PRESETS_KEY);
|
|
152
|
+
return e ? JSON.parse(e) : {};
|
|
153
|
+
} catch (e) {
|
|
154
|
+
return console.error("Failed to load workspace presets:", e), {};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Save workspace presets
|
|
159
|
+
*/
|
|
160
|
+
async saveWorkspacePresets(e) {
|
|
161
|
+
try {
|
|
162
|
+
localStorage.setItem(this.PRESETS_KEY, JSON.stringify(e));
|
|
163
|
+
} catch (t) {
|
|
164
|
+
throw console.error("Failed to save workspace presets:", t), t;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Load repository-specific workspace state
|
|
169
|
+
*/
|
|
170
|
+
async loadRepositoryState(e) {
|
|
171
|
+
try {
|
|
172
|
+
const t = `${this.REPO_STATE_PREFIX}${e}`, a = localStorage.getItem(t);
|
|
173
|
+
return a ? JSON.parse(a) : null;
|
|
174
|
+
} catch (t) {
|
|
175
|
+
return console.error(
|
|
176
|
+
`Failed to load repository state for ${e}:`,
|
|
177
|
+
t
|
|
178
|
+
), null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Save repository-specific workspace state
|
|
183
|
+
*/
|
|
184
|
+
async saveRepositoryState(e, t) {
|
|
185
|
+
try {
|
|
186
|
+
const a = `${this.REPO_STATE_PREFIX}${e}`;
|
|
187
|
+
localStorage.setItem(a, JSON.stringify(t));
|
|
188
|
+
} catch (a) {
|
|
189
|
+
throw console.error(
|
|
190
|
+
`Failed to save repository state for ${e}:`,
|
|
191
|
+
a
|
|
192
|
+
), a;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Load all repository states
|
|
197
|
+
*/
|
|
198
|
+
async loadAllRepositoryStates() {
|
|
199
|
+
try {
|
|
200
|
+
const e = {};
|
|
201
|
+
for (let t = 0; t < localStorage.length; t++) {
|
|
202
|
+
const a = localStorage.key(t);
|
|
203
|
+
if (a && a.startsWith(this.REPO_STATE_PREFIX)) {
|
|
204
|
+
const s = a.substring(this.REPO_STATE_PREFIX.length), f = localStorage.getItem(a);
|
|
205
|
+
if (f)
|
|
206
|
+
try {
|
|
207
|
+
e[s] = JSON.parse(f);
|
|
208
|
+
} catch (u) {
|
|
209
|
+
console.error(
|
|
210
|
+
`Failed to parse repository state for ${s}:`,
|
|
211
|
+
u
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return e;
|
|
217
|
+
} catch (e) {
|
|
218
|
+
return console.error("Failed to load all repository states:", e), {};
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
class p {
|
|
223
|
+
/**
|
|
224
|
+
* Configure a custom storage adapter (for Electron IPC or remote storage)
|
|
225
|
+
*/
|
|
226
|
+
static setAdapter(e) {
|
|
227
|
+
this.adapter = e;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Get all workspace layouts (including built-in)
|
|
231
|
+
*/
|
|
232
|
+
static async getWorkspaceLayouts() {
|
|
233
|
+
const e = this.getBuiltInWorkspaceLayouts();
|
|
234
|
+
return {
|
|
235
|
+
...await this.adapter.loadWorkspacePresets(),
|
|
236
|
+
...e
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Get a specific workspace layout by ID
|
|
241
|
+
*/
|
|
242
|
+
static async getWorkspaceLayout(e) {
|
|
243
|
+
return (await this.getWorkspaceLayouts())[e] || null;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Create a new workspace layout
|
|
247
|
+
*/
|
|
248
|
+
static async createWorkspaceLayout(e) {
|
|
249
|
+
const t = await this.adapter.loadWorkspacePresets(), a = this.generateWorkspaceId(e.name), s = {
|
|
250
|
+
id: a,
|
|
251
|
+
name: e.name,
|
|
252
|
+
description: e.description,
|
|
253
|
+
layout: e.layout,
|
|
254
|
+
defaultSizes: e.defaultSizes,
|
|
255
|
+
defaultCollapsed: e.defaultCollapsed,
|
|
256
|
+
createdAt: Date.now(),
|
|
257
|
+
updatedAt: Date.now(),
|
|
258
|
+
isBuiltIn: !1
|
|
259
|
+
}, f = {
|
|
260
|
+
...t,
|
|
261
|
+
[a]: s
|
|
262
|
+
};
|
|
263
|
+
return await this.adapter.saveWorkspacePresets(f), s;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Update an existing workspace layout
|
|
267
|
+
*/
|
|
268
|
+
static async updateWorkspaceLayout(e, t) {
|
|
269
|
+
const a = await this.adapter.loadWorkspacePresets(), s = a[e];
|
|
270
|
+
if (!s)
|
|
271
|
+
return console.error(`Workspace layout ${e} not found`), null;
|
|
272
|
+
if (s.isBuiltIn)
|
|
273
|
+
return console.error(`Cannot update built-in workspace layout ${e}`), null;
|
|
274
|
+
const f = {
|
|
275
|
+
...s,
|
|
276
|
+
...t,
|
|
277
|
+
id: e,
|
|
278
|
+
// Preserve ID
|
|
279
|
+
createdAt: s.createdAt,
|
|
280
|
+
// Preserve creation time
|
|
281
|
+
updatedAt: Date.now()
|
|
282
|
+
}, u = {
|
|
283
|
+
...a,
|
|
284
|
+
[e]: f
|
|
285
|
+
};
|
|
286
|
+
return await this.adapter.saveWorkspacePresets(u), f;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Delete a workspace layout
|
|
290
|
+
*/
|
|
291
|
+
static async deleteWorkspaceLayout(e) {
|
|
292
|
+
const t = await this.adapter.loadWorkspacePresets(), a = t[e];
|
|
293
|
+
if (!a)
|
|
294
|
+
return console.error(`Workspace layout ${e} not found`), !1;
|
|
295
|
+
if (a.isBuiltIn)
|
|
296
|
+
return console.error(`Cannot delete built-in workspace layout ${e}`), !1;
|
|
297
|
+
const s = { ...t };
|
|
298
|
+
return delete s[e], await this.adapter.saveWorkspacePresets(s), !0;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Get repository state (which workspace + current sizes/collapsed)
|
|
302
|
+
*/
|
|
303
|
+
static async getRepositoryState(e) {
|
|
304
|
+
return await this.adapter.loadRepositoryState(e);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Set repository state (which workspace + current sizes/collapsed/layout)
|
|
308
|
+
*/
|
|
309
|
+
static async setRepositoryState(e, t) {
|
|
310
|
+
await this.adapter.saveRepositoryState(e, t);
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Update only sizes in repository state
|
|
314
|
+
*/
|
|
315
|
+
static async updateRepositorySizes(e, t) {
|
|
316
|
+
const a = await this.getRepositoryState(e);
|
|
317
|
+
a && await this.setRepositoryState(e, {
|
|
318
|
+
...a,
|
|
319
|
+
sizes: t
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Update only collapsed state in repository state
|
|
324
|
+
*/
|
|
325
|
+
static async updateRepositoryCollapsed(e, t) {
|
|
326
|
+
const a = await this.getRepositoryState(e);
|
|
327
|
+
a && await this.setRepositoryState(e, {
|
|
328
|
+
...a,
|
|
329
|
+
collapsed: t
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Check if repository state differs from workspace defaults
|
|
334
|
+
*/
|
|
335
|
+
static hasStateDeviation(e, t) {
|
|
336
|
+
const a = t.defaultSizes ? JSON.stringify(e.sizes) !== JSON.stringify(t.defaultSizes) : !1, s = t.defaultCollapsed ? JSON.stringify(e.collapsed) !== JSON.stringify(t.defaultCollapsed) : !1;
|
|
337
|
+
return { hasSizeDeviation: a, hasCollapsedDeviation: s };
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Update workspace defaults from repository state
|
|
341
|
+
*/
|
|
342
|
+
static async updateWorkspaceFromRepositoryState(e, t) {
|
|
343
|
+
const a = await this.getWorkspaceLayout(e), s = await this.getRepositoryState(t);
|
|
344
|
+
if (!a || !s || a.isBuiltIn) {
|
|
345
|
+
console.error(
|
|
346
|
+
"Cannot update built-in workspace or workspace/state not found"
|
|
347
|
+
);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
await this.updateWorkspaceLayout(e, {
|
|
351
|
+
defaultSizes: s.sizes,
|
|
352
|
+
defaultCollapsed: s.collapsed
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Reset repository state to workspace defaults
|
|
357
|
+
*/
|
|
358
|
+
static async resetRepositoryToWorkspaceDefaults(e, t) {
|
|
359
|
+
const a = await this.getWorkspaceLayout(t);
|
|
360
|
+
if (!a) {
|
|
361
|
+
console.error(`Workspace ${t} not found`);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const s = await this.getRepositoryState(e);
|
|
365
|
+
s && await this.setRepositoryState(e, {
|
|
366
|
+
...s,
|
|
367
|
+
sizes: a.defaultSizes || { left: 20, middle: 45, right: 35 },
|
|
368
|
+
collapsed: a.defaultCollapsed || { left: !1, right: !1 }
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Check if a layout matches a workspace layout
|
|
373
|
+
*/
|
|
374
|
+
static isLayoutMatchingWorkspace(e, t) {
|
|
375
|
+
return this.areLayoutsEqual(e, t.layout);
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Find workspace ID that matches the given layout
|
|
379
|
+
*/
|
|
380
|
+
static async findMatchingWorkspace(e) {
|
|
381
|
+
const t = await this.getWorkspaceLayouts();
|
|
382
|
+
for (const [a, s] of Object.entries(t))
|
|
383
|
+
if (this.isLayoutMatchingWorkspace(e, s))
|
|
384
|
+
return a;
|
|
385
|
+
return null;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Deep comparison of two panel layouts
|
|
389
|
+
*/
|
|
390
|
+
static areLayoutsEqual(e, t) {
|
|
391
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Generate a unique ID from a workspace name
|
|
395
|
+
*/
|
|
396
|
+
static generateWorkspaceId(e) {
|
|
397
|
+
return `${e.toLowerCase().replace(/[^a-z0-9]+/g, "-")}-${Date.now()}`;
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Get built-in workspace layouts
|
|
401
|
+
*/
|
|
402
|
+
static getBuiltInWorkspaceLayouts() {
|
|
403
|
+
const e = Date.now();
|
|
404
|
+
return {
|
|
405
|
+
"project-management": {
|
|
406
|
+
id: "project-management",
|
|
407
|
+
name: "Project Management",
|
|
408
|
+
description: "Tasks, dependencies, issues, file tree, docs, drawings, multi terminal, city visualization, code viewer, markdown slides, and excalidraw",
|
|
409
|
+
layout: {
|
|
410
|
+
left: {
|
|
411
|
+
type: "tabs",
|
|
412
|
+
panels: [
|
|
413
|
+
"tasks",
|
|
414
|
+
"dependencies",
|
|
415
|
+
"gitIssues",
|
|
416
|
+
"fileTree",
|
|
417
|
+
"docs",
|
|
418
|
+
"drawings"
|
|
419
|
+
],
|
|
420
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
421
|
+
},
|
|
422
|
+
middle: "multiTerminal",
|
|
423
|
+
right: {
|
|
424
|
+
type: "tabs",
|
|
425
|
+
panels: [
|
|
426
|
+
"cityVisualization",
|
|
427
|
+
"codeViewer",
|
|
428
|
+
"markdownViewer",
|
|
429
|
+
"excalidrawDiagram"
|
|
430
|
+
],
|
|
431
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
defaultSizes: { left: 20, middle: 45, right: 35 },
|
|
435
|
+
defaultCollapsed: { left: !1, right: !1 },
|
|
436
|
+
createdAt: e,
|
|
437
|
+
updatedAt: e,
|
|
438
|
+
isBuiltIn: !0
|
|
439
|
+
},
|
|
440
|
+
"code-review": {
|
|
441
|
+
id: "code-review",
|
|
442
|
+
name: "Code Review",
|
|
443
|
+
description: "Git changes, pull requests, and file tree on left, git diff and code viewer in middle, city map on right",
|
|
444
|
+
layout: {
|
|
445
|
+
left: {
|
|
446
|
+
type: "tabs",
|
|
447
|
+
panels: ["gitChanges", "gitPullRequests", "fileTree"],
|
|
448
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
449
|
+
},
|
|
450
|
+
middle: {
|
|
451
|
+
type: "tabs",
|
|
452
|
+
panels: ["gitDiff", "codeViewer"],
|
|
453
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
454
|
+
},
|
|
455
|
+
right: "cityVisualization"
|
|
456
|
+
},
|
|
457
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
458
|
+
defaultCollapsed: { left: !1, right: !1 },
|
|
459
|
+
createdAt: e,
|
|
460
|
+
updatedAt: e,
|
|
461
|
+
isBuiltIn: !0
|
|
462
|
+
},
|
|
463
|
+
documentation: {
|
|
464
|
+
id: "documentation",
|
|
465
|
+
name: "Documentation",
|
|
466
|
+
description: "Docs, markdown viewer, and code viewer",
|
|
467
|
+
layout: {
|
|
468
|
+
left: "docs",
|
|
469
|
+
middle: "markdownViewer",
|
|
470
|
+
right: "codeViewer"
|
|
471
|
+
},
|
|
472
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
473
|
+
defaultCollapsed: { left: !1, right: !0 },
|
|
474
|
+
createdAt: e,
|
|
475
|
+
updatedAt: e,
|
|
476
|
+
isBuiltIn: !0
|
|
477
|
+
},
|
|
478
|
+
"agent-work": {
|
|
479
|
+
id: "agent-work",
|
|
480
|
+
name: "Agent Work",
|
|
481
|
+
description: "Tasks, agent sessions, file tree, agent context, git changes, docs, multi terminal, city map, agent events, code viewer, and markdown slides",
|
|
482
|
+
layout: {
|
|
483
|
+
left: {
|
|
484
|
+
type: "tabs",
|
|
485
|
+
panels: [
|
|
486
|
+
"tasks",
|
|
487
|
+
"agentSessions",
|
|
488
|
+
"fileTree",
|
|
489
|
+
"agentContext",
|
|
490
|
+
"gitChanges",
|
|
491
|
+
"docs"
|
|
492
|
+
],
|
|
493
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
494
|
+
},
|
|
495
|
+
middle: "multiTerminal",
|
|
496
|
+
right: {
|
|
497
|
+
type: "tabs",
|
|
498
|
+
panels: [
|
|
499
|
+
"cityVisualization",
|
|
500
|
+
"agentEvents",
|
|
501
|
+
"codeViewer",
|
|
502
|
+
"markdownViewer"
|
|
503
|
+
],
|
|
504
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
defaultSizes: { left: 20, middle: 45, right: 35 },
|
|
508
|
+
defaultCollapsed: { left: !1, right: !1 },
|
|
509
|
+
createdAt: e,
|
|
510
|
+
updatedAt: e,
|
|
511
|
+
isBuiltIn: !0
|
|
512
|
+
},
|
|
513
|
+
"quality-check": {
|
|
514
|
+
id: "quality-check",
|
|
515
|
+
name: "Quality Check",
|
|
516
|
+
description: "Package information, tools, and dependencies on left; city visualization map in middle; multi terminal and code viewer on right (collapsed)",
|
|
517
|
+
layout: {
|
|
518
|
+
left: {
|
|
519
|
+
type: "tabs",
|
|
520
|
+
panels: ["packageInfo", "tools", "dependencies"],
|
|
521
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
522
|
+
},
|
|
523
|
+
middle: "cityVisualization",
|
|
524
|
+
right: {
|
|
525
|
+
type: "tabs",
|
|
526
|
+
panels: ["multiTerminal", "codeViewer"],
|
|
527
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
528
|
+
}
|
|
529
|
+
},
|
|
530
|
+
defaultSizes: { left: 20, middle: 45, right: 35 },
|
|
531
|
+
defaultCollapsed: { left: !1, right: !0 },
|
|
532
|
+
createdAt: e,
|
|
533
|
+
updatedAt: e,
|
|
534
|
+
isBuiltIn: !0
|
|
535
|
+
},
|
|
536
|
+
drawing: {
|
|
537
|
+
id: "drawing",
|
|
538
|
+
name: "Drawing",
|
|
539
|
+
description: "Drawings and docs, excalidraw diagram, multi terminal and markdown viewer",
|
|
540
|
+
layout: {
|
|
541
|
+
left: {
|
|
542
|
+
type: "tabs",
|
|
543
|
+
panels: ["drawings", "docs"],
|
|
544
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
545
|
+
},
|
|
546
|
+
middle: "excalidrawDiagram",
|
|
547
|
+
right: {
|
|
548
|
+
type: "tabs",
|
|
549
|
+
panels: ["multiTerminal", "markdownViewer"],
|
|
550
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
554
|
+
defaultCollapsed: { left: !1, right: !0 },
|
|
555
|
+
createdAt: e,
|
|
556
|
+
updatedAt: e,
|
|
557
|
+
isBuiltIn: !0
|
|
558
|
+
},
|
|
559
|
+
"old-school": {
|
|
560
|
+
id: "old-school",
|
|
561
|
+
name: "Old School",
|
|
562
|
+
description: "File tree, search, git changes, and docs on left; code viewer and markdown viewer in middle; multi terminal and city map on right (collapsed)",
|
|
563
|
+
layout: {
|
|
564
|
+
left: {
|
|
565
|
+
type: "tabs",
|
|
566
|
+
panels: ["fileTree", "search", "gitChanges", "docs"],
|
|
567
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
568
|
+
},
|
|
569
|
+
middle: {
|
|
570
|
+
type: "tabs",
|
|
571
|
+
panels: ["codeViewer", "markdownViewer"],
|
|
572
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
573
|
+
},
|
|
574
|
+
right: {
|
|
575
|
+
type: "tabs",
|
|
576
|
+
panels: ["multiTerminal", "cityVisualization"],
|
|
577
|
+
config: { defaultActiveTab: 0, tabPosition: "top" }
|
|
578
|
+
}
|
|
579
|
+
},
|
|
580
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
581
|
+
defaultCollapsed: { left: !1, right: !0 },
|
|
582
|
+
createdAt: e,
|
|
583
|
+
updatedAt: e,
|
|
584
|
+
isBuiltIn: !0
|
|
585
|
+
},
|
|
586
|
+
"principal-office": {
|
|
587
|
+
id: "principal-office",
|
|
588
|
+
name: "Principal Office",
|
|
589
|
+
description: "Alexandria docs on left, MDX editor in middle, multi terminal on right",
|
|
590
|
+
layout: {
|
|
591
|
+
left: "docs",
|
|
592
|
+
middle: "mdxEditor",
|
|
593
|
+
right: "multiTerminal"
|
|
594
|
+
},
|
|
595
|
+
defaultSizes: { left: 20, middle: 50, right: 30 },
|
|
596
|
+
defaultCollapsed: { left: !1, right: !1 },
|
|
597
|
+
createdAt: e,
|
|
598
|
+
updatedAt: e,
|
|
599
|
+
isBuiltIn: !0
|
|
600
|
+
}
|
|
601
|
+
};
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Initialize workspace layouts with built-in defaults if none exist
|
|
605
|
+
*/
|
|
606
|
+
static async initializeWorkspaceLayouts() {
|
|
607
|
+
const e = await this.adapter.loadWorkspacePresets();
|
|
608
|
+
Object.keys(e).length;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
T(p, "adapter", new F());
|
|
612
|
+
function J(n = {}) {
|
|
613
|
+
const { repositoryKey: e, autoInitialize: t = !1, defaultWorkspaceId: a } = n, [s, f] = b(
|
|
614
|
+
{}
|
|
615
|
+
), [u, y] = b(null), [I, S] = b(null), [v, h] = b(!0), [k, m] = b(null), l = d(async () => {
|
|
616
|
+
try {
|
|
617
|
+
h(!0), m(null);
|
|
618
|
+
const o = await p.getWorkspaceLayouts();
|
|
619
|
+
if (f(o), e) {
|
|
620
|
+
let i = await p.getRepositoryState(e);
|
|
621
|
+
if (!i && t) {
|
|
622
|
+
const g = a || "project-management", w = await p.getWorkspaceLayout(g);
|
|
623
|
+
w && (i = {
|
|
624
|
+
workspaceId: g,
|
|
625
|
+
sizes: w.defaultSizes || {
|
|
626
|
+
left: 20,
|
|
627
|
+
middle: 45,
|
|
628
|
+
right: 35
|
|
629
|
+
},
|
|
630
|
+
collapsed: w.defaultCollapsed || {
|
|
631
|
+
left: !1,
|
|
632
|
+
right: !1
|
|
633
|
+
}
|
|
634
|
+
}, await p.setRepositoryState(
|
|
635
|
+
e,
|
|
636
|
+
i
|
|
637
|
+
));
|
|
638
|
+
}
|
|
639
|
+
if (y(i), i != null && i.workspaceId) {
|
|
640
|
+
const g = await p.getWorkspaceLayout(
|
|
641
|
+
i.workspaceId
|
|
642
|
+
);
|
|
643
|
+
S(g);
|
|
644
|
+
} else
|
|
645
|
+
S(null);
|
|
646
|
+
}
|
|
647
|
+
} catch (o) {
|
|
648
|
+
m(o), console.error("Failed to load workspace data:", o);
|
|
649
|
+
} finally {
|
|
650
|
+
h(!1);
|
|
651
|
+
}
|
|
652
|
+
}, [e, t, a]);
|
|
653
|
+
R(() => {
|
|
654
|
+
l();
|
|
655
|
+
}, [l]);
|
|
656
|
+
const W = d(
|
|
657
|
+
async (o) => await p.getWorkspaceLayout(o),
|
|
658
|
+
[]
|
|
659
|
+
), P = d(
|
|
660
|
+
async (o) => {
|
|
661
|
+
const i = await p.createWorkspaceLayout(o);
|
|
662
|
+
return await l(), i;
|
|
663
|
+
},
|
|
664
|
+
[l]
|
|
665
|
+
), A = d(
|
|
666
|
+
async (o, i) => {
|
|
667
|
+
const g = await p.updateWorkspaceLayout(o, i);
|
|
668
|
+
return await l(), g;
|
|
669
|
+
},
|
|
670
|
+
[l]
|
|
671
|
+
), z = d(
|
|
672
|
+
async (o) => {
|
|
673
|
+
const i = await p.deleteWorkspaceLayout(o);
|
|
674
|
+
return i && await l(), i;
|
|
675
|
+
},
|
|
676
|
+
[l]
|
|
677
|
+
), L = d(
|
|
678
|
+
async (o) => {
|
|
679
|
+
if (!e) {
|
|
680
|
+
console.error("Cannot apply workspace without repositoryKey");
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
const i = await p.getWorkspaceLayout(o);
|
|
684
|
+
if (!i) {
|
|
685
|
+
console.error(`Workspace ${o} not found`);
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
const g = {
|
|
689
|
+
workspaceId: o,
|
|
690
|
+
sizes: i.defaultSizes || { left: 20, middle: 45, right: 35 },
|
|
691
|
+
collapsed: i.defaultCollapsed || {
|
|
692
|
+
left: !1,
|
|
693
|
+
right: !1
|
|
694
|
+
}
|
|
695
|
+
};
|
|
696
|
+
await p.setRepositoryState(e, g), await l();
|
|
697
|
+
},
|
|
698
|
+
[e, l]
|
|
699
|
+
), E = d(
|
|
700
|
+
async (o) => {
|
|
701
|
+
if (!e) {
|
|
702
|
+
console.error("Cannot update sizes without repositoryKey");
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
await p.updateRepositorySizes(e, o), await l();
|
|
706
|
+
},
|
|
707
|
+
[e, l]
|
|
708
|
+
), O = d(
|
|
709
|
+
async (o) => {
|
|
710
|
+
if (!e) {
|
|
711
|
+
console.error("Cannot update collapsed without repositoryKey");
|
|
712
|
+
return;
|
|
713
|
+
}
|
|
714
|
+
await p.updateRepositoryCollapsed(
|
|
715
|
+
e,
|
|
716
|
+
o
|
|
717
|
+
), await l();
|
|
718
|
+
},
|
|
719
|
+
[e, l]
|
|
720
|
+
), r = d(async () => {
|
|
721
|
+
if (!e || !(u != null && u.workspaceId)) {
|
|
722
|
+
console.error("Cannot reset without repositoryKey and active workspace");
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
await p.resetRepositoryToWorkspaceDefaults(
|
|
726
|
+
e,
|
|
727
|
+
u.workspaceId
|
|
728
|
+
), await l();
|
|
729
|
+
}, [e, u == null ? void 0 : u.workspaceId, l]), c = d(async () => {
|
|
730
|
+
await l();
|
|
731
|
+
}, [l]);
|
|
732
|
+
return {
|
|
733
|
+
workspaces: s,
|
|
734
|
+
repositoryState: u,
|
|
735
|
+
activeWorkspace: I,
|
|
736
|
+
loading: v,
|
|
737
|
+
error: k,
|
|
738
|
+
getWorkspace: W,
|
|
739
|
+
createWorkspace: P,
|
|
740
|
+
updateWorkspace: A,
|
|
741
|
+
deleteWorkspace: z,
|
|
742
|
+
applyWorkspace: L,
|
|
743
|
+
updateSizes: E,
|
|
744
|
+
updateCollapsed: O,
|
|
745
|
+
resetToDefaults: r,
|
|
746
|
+
refresh: c
|
|
747
|
+
};
|
|
748
|
+
}
|
|
749
|
+
export {
|
|
750
|
+
q as AnimatedResizableLayout,
|
|
751
|
+
K as AnimatedVerticalLayout,
|
|
752
|
+
M as ConfigurablePanelLayout,
|
|
753
|
+
V as LocalStoragePersistenceAdapter,
|
|
754
|
+
F as LocalStorageWorkspaceAdapter,
|
|
755
|
+
X as PanelConfigurator,
|
|
756
|
+
Y as SnapCarousel,
|
|
757
|
+
G as TabGroup,
|
|
758
|
+
Q as ThreePanelLayout,
|
|
759
|
+
p as WorkspaceLayoutService,
|
|
760
|
+
Z as mapThemeToPanelVars,
|
|
761
|
+
H as mapThemeToTabVars,
|
|
762
|
+
U as useLocalStorage,
|
|
763
|
+
ee as useMediaQuery,
|
|
764
|
+
x as usePanelPersistence,
|
|
765
|
+
J as useWorkspace
|
|
766
|
+
};
|
|
767
|
+
//# sourceMappingURL=index.esm.js.map
|