@pstdio/workbench 0.45.0-nightly.20261021030241 → 0.45.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/dist/extensions.d.ts +21 -62
- package/dist/extensions.js +1250 -978
- package/dist/extensions.js.map +1 -1
- package/dist/{index-CEjUGkgB.d.ts → index-DL-0XKr0.d.ts} +247 -191
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1530 -1271
- package/dist/index.js.map +1 -1
- package/dist/{kanban-presentation-CQNhh7IY.d.ts → kanban-presentation-CdHu43iH.d.ts} +1 -3
- package/dist/{layout-tab-presentation-Bz6EgFEa.js → layout-tab-presentation-CCUroIOY.js} +2 -3
- package/dist/{layout-tab-presentation-Bz6EgFEa.js.map → layout-tab-presentation-CCUroIOY.js.map} +1 -1
- package/dist/{navigation-tree-registry-BsMNSEyZ.js → navigation-tree-registry-DM4Lhfir.js} +3 -4
- package/dist/{navigation-tree-registry-BsMNSEyZ.js.map → navigation-tree-registry-DM4Lhfir.js.map} +1 -1
- package/dist/{react-hsii-4ZV.js → react-7X-EBlBD.js} +4163 -3123
- package/dist/react-7X-EBlBD.js.map +1 -0
- package/dist/react.d.ts +7 -94
- package/dist/react.js +1 -2
- package/dist/storage.d.ts +1 -7
- package/dist/storage.js +106 -80
- package/dist/storage.js.map +1 -1
- package/dist/webview-runtime.d.ts +0 -4
- package/dist/webview-runtime.js +2 -3
- package/dist/webview-runtime.js.map +1 -1
- package/dist/{workbench-renderers-Ku0_knjs.js → workbench-renderers-DOc_oE0K.js} +308 -292
- package/dist/workbench-renderers-DOc_oE0K.js.map +1 -0
- package/package.json +3 -3
- package/dist/file-renderer-view-CJBCZZIE.js +0 -668
- package/dist/file-renderer-view-CJBCZZIE.js.map +0 -1
- package/dist/react-hsii-4ZV.js.map +0 -1
- package/dist/workbench-renderers-Ku0_knjs.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pstdio/workbench",
|
|
3
|
-
"version": "0.45.0
|
|
3
|
+
"version": "0.45.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/pufflyai/prompt-studio"
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@dnd-kit/core": "^6.3.1",
|
|
46
|
-
"@pstdio/sdk": "^0.45.0
|
|
47
|
-
"@pstdio/ui": "^0.45.0
|
|
46
|
+
"@pstdio/sdk": "^0.45.0",
|
|
47
|
+
"@pstdio/ui": "^0.45.0",
|
|
48
48
|
"@tanstack/react-hotkeys": "0.10.0",
|
|
49
49
|
"lucide-react": "^0.557.0",
|
|
50
50
|
"rimless": "0.8.3",
|
|
@@ -1,668 +0,0 @@
|
|
|
1
|
-
import { H as e, a as t, c as n, o as r, s as i, yt as a } from "./react-hsii-4ZV.js";
|
|
2
|
-
import { h as o, t as s } from "./workbench-renderers-Ku0_knjs.js";
|
|
3
|
-
import { resourceKey as c } from "@pstdio/sdk/extensions";
|
|
4
|
-
import { c as l } from "react/compiler-runtime";
|
|
5
|
-
import { Box as u, Button as d, Center as f, Flex as p, Image as m, Spinner as h, Text as g } from "@chakra-ui/react";
|
|
6
|
-
import { AlertMessage as _, EmptyState as v, Header as y, resolveFileIconElement as b, useFileIconThemePreference as x } from "@pstdio/ui";
|
|
7
|
-
import { useEffect as S, useLayoutEffect as C, useRef as w, useState as T } from "react";
|
|
8
|
-
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
9
|
-
import { CodeEditor as ee } from "@pstdio/ui/diff";
|
|
10
|
-
import { MarkdownEditor as O } from "@pstdio/ui/rich-text";
|
|
11
|
-
//#region src/core/registries/renderers/file-section-navigation.ts
|
|
12
|
-
var k = "pstdio.fileSectionNavigation", A = (e) => {
|
|
13
|
-
if (!e || typeof e != "object") return !1;
|
|
14
|
-
let t = e, n = t.occurrence === void 0 || typeof t.occurrence == "number" && Number.isInteger(t.occurrence) && t.occurrence >= 0;
|
|
15
|
-
return typeof t.id == "string" && typeof t.heading == "string" && n;
|
|
16
|
-
}, j = (e) => {
|
|
17
|
-
let t = e?.metadata?.[k];
|
|
18
|
-
if (!t || typeof t != "object") return;
|
|
19
|
-
let n = t;
|
|
20
|
-
if (typeof n.treeId == "string" && typeof n.targetNodeId == "string" && Array.isArray(n.anchors) && n.anchors.every(A)) return {
|
|
21
|
-
treeId: n.treeId,
|
|
22
|
-
targetNodeId: n.targetNodeId,
|
|
23
|
-
anchors: n.anchors
|
|
24
|
-
};
|
|
25
|
-
}, M = (e, t) => t && e.anchors.some((e) => e.id === t) ? t : e.targetNodeId, te = (e) => {
|
|
26
|
-
let { previous: t, current: n, currentResourceKey: r, selectedNodeId: i } = e;
|
|
27
|
-
return !t || !i || !t.anchorIds.includes(i) || n?.targetNodeId === i ? !1 : !n || t.treeId !== n.treeId || t.resourceKey !== r;
|
|
28
|
-
}, ne = /* @__PURE__ */ new Set([
|
|
29
|
-
"png",
|
|
30
|
-
"jpg",
|
|
31
|
-
"jpeg",
|
|
32
|
-
"gif",
|
|
33
|
-
"webp",
|
|
34
|
-
"svg",
|
|
35
|
-
"avif",
|
|
36
|
-
"bmp",
|
|
37
|
-
"ico"
|
|
38
|
-
]), N = /* @__PURE__ */ new Set([
|
|
39
|
-
"md",
|
|
40
|
-
"markdown",
|
|
41
|
-
"txt"
|
|
42
|
-
]), P = {
|
|
43
|
-
ts: "typescript",
|
|
44
|
-
tsx: "typescript",
|
|
45
|
-
js: "javascript",
|
|
46
|
-
jsx: "javascript",
|
|
47
|
-
mjs: "javascript",
|
|
48
|
-
cjs: "javascript",
|
|
49
|
-
json: "json",
|
|
50
|
-
jsonc: "json",
|
|
51
|
-
py: "python",
|
|
52
|
-
rb: "ruby",
|
|
53
|
-
rs: "rust",
|
|
54
|
-
go: "go",
|
|
55
|
-
java: "java",
|
|
56
|
-
kt: "kotlin",
|
|
57
|
-
c: "c",
|
|
58
|
-
h: "c",
|
|
59
|
-
cpp: "cpp",
|
|
60
|
-
cc: "cpp",
|
|
61
|
-
hpp: "cpp",
|
|
62
|
-
cs: "csharp",
|
|
63
|
-
php: "php",
|
|
64
|
-
swift: "swift",
|
|
65
|
-
sh: "shell",
|
|
66
|
-
bash: "shell",
|
|
67
|
-
zsh: "shell",
|
|
68
|
-
sql: "sql",
|
|
69
|
-
css: "css",
|
|
70
|
-
scss: "scss",
|
|
71
|
-
less: "less",
|
|
72
|
-
html: "html",
|
|
73
|
-
xml: "xml",
|
|
74
|
-
yml: "yaml",
|
|
75
|
-
yaml: "yaml",
|
|
76
|
-
toml: "ini",
|
|
77
|
-
ini: "ini",
|
|
78
|
-
dockerfile: "dockerfile",
|
|
79
|
-
graphql: "graphql",
|
|
80
|
-
gql: "graphql",
|
|
81
|
-
md: "markdown",
|
|
82
|
-
markdown: "markdown",
|
|
83
|
-
txt: "plaintext"
|
|
84
|
-
}, F = (e) => {
|
|
85
|
-
if (!e) return "";
|
|
86
|
-
let t = e.lastIndexOf(".");
|
|
87
|
-
return t < 0 || t === e.length - 1 ? "" : e.slice(t + 1).toLowerCase();
|
|
88
|
-
}, I = (e, t) => t?.startsWith("image/") ? !0 : ne.has(F(e)), L = (e, t) => {
|
|
89
|
-
if (I(e, t)) return "image";
|
|
90
|
-
let n = F(e);
|
|
91
|
-
return !N.has(n) && n in P ? "code" : "markdown";
|
|
92
|
-
}, R = (e) => P[F(e)] ?? "plaintext", re = (e, t) => {
|
|
93
|
-
if (e.emptyState) return {
|
|
94
|
-
kind: "empty",
|
|
95
|
-
isEditable: !1
|
|
96
|
-
};
|
|
97
|
-
let n = L(e.fileName, e.mimeType);
|
|
98
|
-
if (n === "image") return {
|
|
99
|
-
kind: "image",
|
|
100
|
-
isEditable: !1
|
|
101
|
-
};
|
|
102
|
-
let r = t && e.editable !== !1;
|
|
103
|
-
return n === "code" || e.textRenderer === "monaco" ? {
|
|
104
|
-
kind: "code",
|
|
105
|
-
isEditable: r,
|
|
106
|
-
language: R(e.fileName)
|
|
107
|
-
} : {
|
|
108
|
-
kind: "markdown",
|
|
109
|
-
isEditable: r
|
|
110
|
-
};
|
|
111
|
-
}, ie = (e) => {
|
|
112
|
-
let t = l(49), { content: n, position: r, editorKey: i, errorNotice: a, contributionCanSave: o, onActiveSectionChange: s, onChange: c, rendererRef: d, sectionNavigation: h, title: y } = e, b;
|
|
113
|
-
t[0] !== n || t[1] !== o ? (b = re(n, o), t[0] = n, t[1] = o, t[2] = b) : b = t[2];
|
|
114
|
-
let x = b, S;
|
|
115
|
-
t[3] !== r || t[4] !== x.kind ? (S = r && x.kind !== "code" && x.kind !== "empty" ? /* @__PURE__ */ E(_, {
|
|
116
|
-
status: "info",
|
|
117
|
-
title: "Source location unavailable",
|
|
118
|
-
children: "This preview does not support source line selection."
|
|
119
|
-
}) : null, t[3] = r, t[4] = x.kind, t[5] = S) : S = t[5];
|
|
120
|
-
let C = S;
|
|
121
|
-
if (x.kind === "empty") {
|
|
122
|
-
let e = n.emptyState?.title ?? "Select a file", r = n.emptyState?.description, i;
|
|
123
|
-
t[6] !== e || t[7] !== r ? (i = /* @__PURE__ */ E(v, {
|
|
124
|
-
flex: "1",
|
|
125
|
-
minH: "0",
|
|
126
|
-
title: e,
|
|
127
|
-
description: r
|
|
128
|
-
}), t[6] = e, t[7] = r, t[8] = i) : i = t[8];
|
|
129
|
-
let o;
|
|
130
|
-
return t[9] !== a || t[10] !== C || t[11] !== i ? (o = /* @__PURE__ */ D(p, {
|
|
131
|
-
direction: "column",
|
|
132
|
-
h: "full",
|
|
133
|
-
minH: "0",
|
|
134
|
-
bg: "bg",
|
|
135
|
-
children: [
|
|
136
|
-
a,
|
|
137
|
-
C,
|
|
138
|
-
i
|
|
139
|
-
]
|
|
140
|
-
}), t[9] = a, t[10] = C, t[11] = i, t[12] = o) : o = t[12], o;
|
|
141
|
-
}
|
|
142
|
-
if (x.kind === "image") {
|
|
143
|
-
if (!n.dataUrl) {
|
|
144
|
-
let e;
|
|
145
|
-
return t[13] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ E(f, {
|
|
146
|
-
h: "full",
|
|
147
|
-
minH: "0",
|
|
148
|
-
bg: "bg",
|
|
149
|
-
p: "md",
|
|
150
|
-
children: /* @__PURE__ */ E(g, {
|
|
151
|
-
color: "fg.muted",
|
|
152
|
-
children: "This image preview is unavailable."
|
|
153
|
-
})
|
|
154
|
-
}), t[13] = e) : e = t[13], e;
|
|
155
|
-
}
|
|
156
|
-
let e = n.fileName ?? y, r;
|
|
157
|
-
t[14] !== n.dataUrl || t[15] !== e ? (r = /* @__PURE__ */ E(m, {
|
|
158
|
-
src: n.dataUrl,
|
|
159
|
-
alt: e,
|
|
160
|
-
maxW: "100%",
|
|
161
|
-
maxH: "100%",
|
|
162
|
-
objectFit: "contain"
|
|
163
|
-
}), t[14] = n.dataUrl, t[15] = e, t[16] = r) : r = t[16];
|
|
164
|
-
let i;
|
|
165
|
-
t[17] !== d || t[18] !== r ? (i = /* @__PURE__ */ E(f, {
|
|
166
|
-
ref: d,
|
|
167
|
-
flex: "1",
|
|
168
|
-
minH: "0",
|
|
169
|
-
p: "md",
|
|
170
|
-
overflow: "auto",
|
|
171
|
-
children: r
|
|
172
|
-
}), t[17] = d, t[18] = r, t[19] = i) : i = t[19];
|
|
173
|
-
let o;
|
|
174
|
-
return t[20] !== a || t[21] !== C || t[22] !== i ? (o = /* @__PURE__ */ D(p, {
|
|
175
|
-
direction: "column",
|
|
176
|
-
h: "full",
|
|
177
|
-
minH: "0",
|
|
178
|
-
bg: "bg",
|
|
179
|
-
children: [
|
|
180
|
-
a,
|
|
181
|
-
C,
|
|
182
|
-
i
|
|
183
|
-
]
|
|
184
|
-
}), t[20] = a, t[21] = C, t[22] = i, t[23] = o) : o = t[23], o;
|
|
185
|
-
}
|
|
186
|
-
if (x.kind === "code") {
|
|
187
|
-
let e = n.content ?? "", o = x.isEditable ? c : void 0, s;
|
|
188
|
-
t[24] !== n.fileName || t[25] !== i || t[26] !== r || t[27] !== x.isEditable || t[28] !== x.language || t[29] !== e || t[30] !== o ? (s = /* @__PURE__ */ E(u, {
|
|
189
|
-
flex: "1",
|
|
190
|
-
minH: "0",
|
|
191
|
-
children: /* @__PURE__ */ E(ee, {
|
|
192
|
-
language: x.language,
|
|
193
|
-
position: r,
|
|
194
|
-
fileName: n.fileName,
|
|
195
|
-
defaultCode: e,
|
|
196
|
-
isEditable: x.isEditable,
|
|
197
|
-
showLineNumbers: !0,
|
|
198
|
-
onChange: o
|
|
199
|
-
}, i)
|
|
200
|
-
}), t[24] = n.fileName, t[25] = i, t[26] = r, t[27] = x.isEditable, t[28] = x.language, t[29] = e, t[30] = o, t[31] = s) : s = t[31];
|
|
201
|
-
let l;
|
|
202
|
-
return t[32] !== a || t[33] !== C || t[34] !== s ? (l = /* @__PURE__ */ D(p, {
|
|
203
|
-
direction: "column",
|
|
204
|
-
h: "full",
|
|
205
|
-
minH: "0",
|
|
206
|
-
bg: "bg",
|
|
207
|
-
children: [
|
|
208
|
-
a,
|
|
209
|
-
C,
|
|
210
|
-
s
|
|
211
|
-
]
|
|
212
|
-
}), t[32] = a, t[33] = C, t[34] = s, t[35] = l) : l = t[35], l;
|
|
213
|
-
}
|
|
214
|
-
let w = n.content ?? "", T = x.isEditable ? n.placeholder ?? "Write…" : void 0, k = x.isEditable ? c : void 0, A;
|
|
215
|
-
t[36] !== i || t[37] !== s || t[38] !== x.isEditable || t[39] !== h || t[40] !== w || t[41] !== T || t[42] !== k ? (A = /* @__PURE__ */ E(u, {
|
|
216
|
-
flex: "1",
|
|
217
|
-
minH: "0",
|
|
218
|
-
overflowY: "auto",
|
|
219
|
-
children: /* @__PURE__ */ E(O, {
|
|
220
|
-
defaultState: w,
|
|
221
|
-
isEditable: x.isEditable,
|
|
222
|
-
sectionNavigation: h,
|
|
223
|
-
placeholder: T,
|
|
224
|
-
onActiveSectionChange: s,
|
|
225
|
-
onChange: k
|
|
226
|
-
}, i)
|
|
227
|
-
}), t[36] = i, t[37] = s, t[38] = x.isEditable, t[39] = h, t[40] = w, t[41] = T, t[42] = k, t[43] = A) : A = t[43];
|
|
228
|
-
let j;
|
|
229
|
-
return t[44] !== a || t[45] !== C || t[46] !== d || t[47] !== A ? (j = /* @__PURE__ */ D(p, {
|
|
230
|
-
ref: d,
|
|
231
|
-
direction: "column",
|
|
232
|
-
h: "full",
|
|
233
|
-
minH: "0",
|
|
234
|
-
overflow: "hidden",
|
|
235
|
-
bg: "bg",
|
|
236
|
-
children: [
|
|
237
|
-
a,
|
|
238
|
-
C,
|
|
239
|
-
A
|
|
240
|
-
]
|
|
241
|
-
}), t[44] = a, t[45] = C, t[46] = d, t[47] = A, t[48] = j) : j = t[48], j;
|
|
242
|
-
}, ae = (e) => {
|
|
243
|
-
let t, n = !1, r, i = null, a = null, o, s, c = !1, l = null, u = 0, d = /* @__PURE__ */ new Set(), f = /* @__PURE__ */ new Set(), p = (e) => e instanceof Error ? e.message : "Failed to save file.", m = () => ({
|
|
244
|
-
dirty: i !== null || a !== null && a.value !== t,
|
|
245
|
-
saving: a !== null,
|
|
246
|
-
...o ? { saveError: o } : {},
|
|
247
|
-
...n ? { removed: !0 } : {}
|
|
248
|
-
}), h = () => e.onStateChange?.(m()), g = () => {
|
|
249
|
-
l !== null && (clearTimeout(l), l = null);
|
|
250
|
-
}, _ = () => e.createOperationId?.() ?? `file-save-${Date.now()}-${++u}`, v = () => i !== null || a !== null || l !== null || !!o, y = (e) => {
|
|
251
|
-
e.revision && (!s || e.revision.localeCompare(s) > 0) && (s = e.revision), e.revision || (c = !0);
|
|
252
|
-
}, b = (t) => {
|
|
253
|
-
let n = t.origin?.operationId;
|
|
254
|
-
return !n || t.origin?.rendererId !== e.binding.rendererId || t.origin.instanceId !== e.binding.instanceId ? !1 : a?.origin.operationId === n || f.has(n);
|
|
255
|
-
}, x = (t) => {
|
|
256
|
-
if (i !== null || a) return;
|
|
257
|
-
let n = s, r = c;
|
|
258
|
-
if (s = void 0, c = !1, n && (!t || n.localeCompare(t) > 0)) {
|
|
259
|
-
e.load({
|
|
260
|
-
resourceKey: e.binding.resourceKey,
|
|
261
|
-
revision: n
|
|
262
|
-
});
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
|
-
r && e.load({ resourceKey: e.binding.resourceKey });
|
|
266
|
-
}, S = () => {
|
|
267
|
-
if (n || i === null || a || o) return;
|
|
268
|
-
let s = i;
|
|
269
|
-
i = null;
|
|
270
|
-
let c = {
|
|
271
|
-
rendererId: e.binding.rendererId,
|
|
272
|
-
instanceId: e.binding.instanceId,
|
|
273
|
-
operationId: _()
|
|
274
|
-
};
|
|
275
|
-
a = {
|
|
276
|
-
value: s,
|
|
277
|
-
origin: c
|
|
278
|
-
}, h(), Promise.resolve(e.save(s, c)).then((e) => {
|
|
279
|
-
if (a?.origin.operationId === c.operationId) {
|
|
280
|
-
if (a = null, f.add(c.operationId), f.size > 20 && f.delete(f.values().next().value), t = s, r = e?.revision ?? r, i === t && (i = null, g()), h(), i !== null) {
|
|
281
|
-
C();
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
x(e?.revision);
|
|
285
|
-
}
|
|
286
|
-
}).catch((e) => {
|
|
287
|
-
n || a?.origin.operationId === c.operationId && (a = null, i === null && (i = s), o = p(e), h());
|
|
288
|
-
});
|
|
289
|
-
}, C = () => {
|
|
290
|
-
g(), l = setTimeout(() => {
|
|
291
|
-
l = null, S();
|
|
292
|
-
}, e.debounceMs);
|
|
293
|
-
};
|
|
294
|
-
return {
|
|
295
|
-
getDraft() {
|
|
296
|
-
return i ?? a?.value ?? t;
|
|
297
|
-
},
|
|
298
|
-
markRemoved() {
|
|
299
|
-
let e = v();
|
|
300
|
-
return n = !0, i = i ?? a?.value ?? null, a = null, g(), h(), e;
|
|
301
|
-
},
|
|
302
|
-
getBaseline() {
|
|
303
|
-
return t;
|
|
304
|
-
},
|
|
305
|
-
getState: m,
|
|
306
|
-
setBaseline(e, n) {
|
|
307
|
-
t = e, r = n, h();
|
|
308
|
-
},
|
|
309
|
-
acceptLoaded(e, i) {
|
|
310
|
-
if (n) return null;
|
|
311
|
-
if (v()) return y(i ? { revision: i } : {}), null;
|
|
312
|
-
let a = t;
|
|
313
|
-
return t = e, r = i, h(), { shown: a };
|
|
314
|
-
},
|
|
315
|
-
handleChange(e) {
|
|
316
|
-
if (n) {
|
|
317
|
-
i = e, h();
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
if (!(o && e === i)) {
|
|
321
|
-
if (o = void 0, e === t && !a) {
|
|
322
|
-
i = null, g(), h();
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
if (a?.value === e) {
|
|
326
|
-
i = null, g(), h();
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
i = e, C(), h();
|
|
330
|
-
}
|
|
331
|
-
},
|
|
332
|
-
handleRefreshEvent(t = {}) {
|
|
333
|
-
if (!n && !(t.resourceKey && t.resourceKey !== e.binding.resourceKey) && !b(t) && !(t.revision && d.has(t.revision))) {
|
|
334
|
-
if (t.revision && d.add(t.revision), v()) {
|
|
335
|
-
y(t);
|
|
336
|
-
return;
|
|
337
|
-
}
|
|
338
|
-
t.revision && r && t.revision.localeCompare(r) <= 0 || e.load(t);
|
|
339
|
-
}
|
|
340
|
-
},
|
|
341
|
-
retry() {
|
|
342
|
-
o && i !== null && !a && (o = void 0, h(), S());
|
|
343
|
-
},
|
|
344
|
-
retryLoad() {
|
|
345
|
-
n || e.load({ resourceKey: e.binding.resourceKey });
|
|
346
|
-
},
|
|
347
|
-
flush() {
|
|
348
|
-
g(), S();
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
}, oe = (e) => {
|
|
352
|
-
let t = l(7), { message: n, onRetry: r } = e, i;
|
|
353
|
-
t[0] === n ? i = t[1] : (i = /* @__PURE__ */ E(g, {
|
|
354
|
-
color: "fg.muted",
|
|
355
|
-
textStyle: "label/S/regular",
|
|
356
|
-
children: n
|
|
357
|
-
}), t[0] = n, t[1] = i);
|
|
358
|
-
let a;
|
|
359
|
-
t[2] === r ? a = t[3] : (a = r ? /* @__PURE__ */ E(d, {
|
|
360
|
-
size: "2xs",
|
|
361
|
-
variant: "subtle",
|
|
362
|
-
onClick: r,
|
|
363
|
-
children: "Retry"
|
|
364
|
-
}) : null, t[2] = r, t[3] = a);
|
|
365
|
-
let o;
|
|
366
|
-
return t[4] !== i || t[5] !== a ? (o = /* @__PURE__ */ D(p, {
|
|
367
|
-
flex: "none",
|
|
368
|
-
alignItems: "center",
|
|
369
|
-
justifyContent: "space-between",
|
|
370
|
-
gap: "sm",
|
|
371
|
-
borderBottomWidth: "1px",
|
|
372
|
-
borderColor: "border.muted",
|
|
373
|
-
bg: "bg.muted",
|
|
374
|
-
px: "sm",
|
|
375
|
-
py: "xs",
|
|
376
|
-
children: [i, a]
|
|
377
|
-
}), t[4] = i, t[5] = a, t[6] = o) : o = t[6], o;
|
|
378
|
-
}, z = (e) => Array.isArray(e) ? e.map(z) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => [e, z(t)])), se = (e) => {
|
|
379
|
-
let { fileRendererId: t, resource: n } = e, r = n ? z({
|
|
380
|
-
id: n.id,
|
|
381
|
-
type: n.type,
|
|
382
|
-
metadata: n.metadata
|
|
383
|
-
}) : null, i = `${JSON.stringify(c(n))}:${t}:${JSON.stringify(r)}`;
|
|
384
|
-
return e.pageParams ? `${i}:${JSON.stringify(z(e.pageParams))}` : i;
|
|
385
|
-
}, ce = (e, t) => e?.loadKey === t, B = (e) => {
|
|
386
|
-
let t = l(9), { fileName: n, filePath: r } = e, { activeFileIconTheme: i } = x(), a;
|
|
387
|
-
t[0] !== i || t[1] !== n ? (a = b(n, { theme: i }), t[0] = i, t[1] = n, t[2] = a) : a = t[2];
|
|
388
|
-
let o = `File path ${r}`, s;
|
|
389
|
-
t[3] !== r || t[4] !== o ? (s = /* @__PURE__ */ E(g, {
|
|
390
|
-
"aria-label": o,
|
|
391
|
-
textStyle: "label/S/regular",
|
|
392
|
-
color: "fg.muted",
|
|
393
|
-
truncate: !0,
|
|
394
|
-
children: r
|
|
395
|
-
}), t[3] = r, t[4] = o, t[5] = s) : s = t[5];
|
|
396
|
-
let c;
|
|
397
|
-
return t[6] !== a || t[7] !== s ? (c = /* @__PURE__ */ D(y, {
|
|
398
|
-
variant: "narrow",
|
|
399
|
-
flexShrink: 0,
|
|
400
|
-
gap: "2xs",
|
|
401
|
-
bg: "bg",
|
|
402
|
-
children: [a, s]
|
|
403
|
-
}), t[6] = a, t[7] = s, t[8] = c) : c = t[8], c;
|
|
404
|
-
}, le = 600, ue = (e) => e instanceof Error ? e.message : "Failed to load file.", de = (e) => {
|
|
405
|
-
let { workbench: t, navigation: n, sectionId: r } = e;
|
|
406
|
-
if (!n || !s(t).getTreeRenderer(n.treeId)) return;
|
|
407
|
-
if (r && n.anchors.some((e) => e.id === r)) {
|
|
408
|
-
s(t).setSelectedNode(n.treeId, r);
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
let i = s(t).getTreeState(n.treeId).selectedNodeId;
|
|
412
|
-
i && n.anchors.some((e) => e.id === i) && s(t).setSelectedNode(n.treeId, void 0);
|
|
413
|
-
}, fe = (e, t) => {
|
|
414
|
-
if (!t) return;
|
|
415
|
-
let n = s(e).getTreeRenderer(t.treeId) ? s(e).getTreeState(t.treeId).selectedNodeId : void 0;
|
|
416
|
-
return {
|
|
417
|
-
anchors: t.anchors,
|
|
418
|
-
targetId: M(t, n)
|
|
419
|
-
};
|
|
420
|
-
}, pe = (e, t) => {
|
|
421
|
-
let n = l(2), r;
|
|
422
|
-
return n[0] === t ? r = n[1] : (r = (e) => {
|
|
423
|
-
let n = e.location;
|
|
424
|
-
if (!n?.position || c(n.resource) !== c(t)) return;
|
|
425
|
-
let r = Object.values(e.pages).find((e) => e.ref.id === n.page.id && e.ref.extensionId === n.page.extensionId)?.document?.metadataKey;
|
|
426
|
-
if (r && n.resource?.metadata?.[r] === t?.metadata?.[r]) return n.position;
|
|
427
|
-
}, n[0] = t, n[1] = r), a(e.pages.store, r);
|
|
428
|
-
}, me = (e) => {
|
|
429
|
-
let t = l(3), { file: n } = e, r;
|
|
430
|
-
return t[0] !== n.fileName || t[1] !== n.filePath ? (r = n.filePath ? /* @__PURE__ */ E(B, {
|
|
431
|
-
fileName: n.fileName ?? n.filePath,
|
|
432
|
-
filePath: n.filePath
|
|
433
|
-
}) : null, t[0] = n.fileName, t[1] = n.filePath, t[2] = r) : r = t[2], r;
|
|
434
|
-
}, he = (e, t, n) => e ? o(e) : JSON.stringify([
|
|
435
|
-
"file",
|
|
436
|
-
t,
|
|
437
|
-
n
|
|
438
|
-
]), V = (a) => {
|
|
439
|
-
let o = l(72), { workbench: m, contribution: _ } = a, v = a.placement?.resource, y = pe(m, v), b, x;
|
|
440
|
-
o[0] !== v || o[1] !== m ? (b = j(v), x = fe(m, b), o[0] = v, o[1] = m, o[2] = b, o[3] = x) : (b = o[2], x = o[3]);
|
|
441
|
-
let ee = x, O = e(m, a.placement), k = se({
|
|
442
|
-
fileRendererId: _.id,
|
|
443
|
-
resource: v,
|
|
444
|
-
pageParams: O
|
|
445
|
-
}), [A, M] = T(null), [ne, N] = T(null), P;
|
|
446
|
-
o[4] === Symbol.for("react.memo_cache_sentinel") ? (P = {
|
|
447
|
-
dirty: !1,
|
|
448
|
-
saving: !1
|
|
449
|
-
}, o[4] = P) : P = o[4];
|
|
450
|
-
let [F, I] = T(P), L = w(null), R = w(void 0), re = w(null), z = w(null), B, V;
|
|
451
|
-
o[5] !== v || o[6] !== b || o[7] !== m ? (B = () => {
|
|
452
|
-
let e = z.current, t = e && s(m).getTreeRenderer(e.treeId) ? s(m).getTreeState(e.treeId).selectedNodeId : void 0;
|
|
453
|
-
te({
|
|
454
|
-
previous: e,
|
|
455
|
-
current: b,
|
|
456
|
-
currentResourceKey: c(v),
|
|
457
|
-
selectedNodeId: t
|
|
458
|
-
}) && e && s(m).setSelectedNode(e.treeId, void 0), z.current = b ? {
|
|
459
|
-
resourceKey: c(v),
|
|
460
|
-
treeId: b.treeId,
|
|
461
|
-
anchorIds: b.anchors.map(ge)
|
|
462
|
-
} : null;
|
|
463
|
-
}, V = [
|
|
464
|
-
v,
|
|
465
|
-
b,
|
|
466
|
-
m
|
|
467
|
-
], o[5] = v, o[6] = b, o[7] = m, o[8] = B, o[9] = V) : (B = o[8], V = o[9]), S(B, V);
|
|
468
|
-
let _e = w(_), H = w(v), ve = w(O), ye = w(a.placement), be;
|
|
469
|
-
o[10] !== _ || o[11] !== O || o[12] !== a.placement || o[13] !== v ? (be = () => {
|
|
470
|
-
_e.current = _, H.current = v, ve.current = O, ye.current = a.placement;
|
|
471
|
-
}, o[10] = _, o[11] = O, o[12] = a.placement, o[13] = v, o[14] = be) : be = o[14], S(be);
|
|
472
|
-
let U = _.id, W = !!_.save, G = he(a.placement, U, k), K = a.placement?.instanceId ?? U, xe;
|
|
473
|
-
o[15] !== U || o[16] !== W || o[17] !== K || o[18] !== k || o[19] !== G || o[20] !== I || o[21] !== N || o[22] !== M || o[23] !== m ? (xe = () => {
|
|
474
|
-
let e = !1, a = !1, o = H.current, l = _e.current, u = m.views.reads.bind(G), d = null;
|
|
475
|
-
N(null);
|
|
476
|
-
let f = r(k), p = f;
|
|
477
|
-
M(f ? {
|
|
478
|
-
...f,
|
|
479
|
-
editorRevision: 1,
|
|
480
|
-
loadKey: k
|
|
481
|
-
} : null);
|
|
482
|
-
let h = (n) => {
|
|
483
|
-
let r = n === void 0 ? "refresh" : n;
|
|
484
|
-
u.request({
|
|
485
|
-
queryKey: k,
|
|
486
|
-
load: (e) => _e.current.load(H.current, e, ve.current),
|
|
487
|
-
onValue: (n) => {
|
|
488
|
-
if (e || a) return;
|
|
489
|
-
let r = t(n, k, d);
|
|
490
|
-
r && (p = n, N(null), M(r));
|
|
491
|
-
},
|
|
492
|
-
onError: (t) => {
|
|
493
|
-
e || a || N({
|
|
494
|
-
loadKey: k,
|
|
495
|
-
message: ue(t)
|
|
496
|
-
});
|
|
497
|
-
}
|
|
498
|
-
}, r);
|
|
499
|
-
};
|
|
500
|
-
R.current = () => h("retry"), d = W ? ae({
|
|
501
|
-
binding: {
|
|
502
|
-
rendererId: U,
|
|
503
|
-
instanceId: K,
|
|
504
|
-
resourceKey: c(H.current)
|
|
505
|
-
},
|
|
506
|
-
debounceMs: le,
|
|
507
|
-
load: () => h(),
|
|
508
|
-
onStateChange: (t) => {
|
|
509
|
-
e || I(t);
|
|
510
|
-
},
|
|
511
|
-
save: async (e, t) => {
|
|
512
|
-
let r = await i(l, o, e, t, p);
|
|
513
|
-
return p = r.content, p && !a && n(k, p), r.result;
|
|
514
|
-
}
|
|
515
|
-
}) : null, L.current = d, f && L.current?.setBaseline(f.content, f.revision), I({
|
|
516
|
-
dirty: !1,
|
|
517
|
-
saving: !1
|
|
518
|
-
}), h();
|
|
519
|
-
let g = m.resources.onWillRemove((e) => {
|
|
520
|
-
if (c(e) !== c(H.current)) return [];
|
|
521
|
-
a = !0;
|
|
522
|
-
let t = L.current?.markRemoved(), n = ye.current?.placementIdentity;
|
|
523
|
-
return t && n ? [n] : [];
|
|
524
|
-
}), _ = s(m).onDidRefreshFileRenderer((e) => {
|
|
525
|
-
if (a || e.fileRendererId !== U) return;
|
|
526
|
-
let t = L.current;
|
|
527
|
-
t ? t.handleRefreshEvent(e) : h();
|
|
528
|
-
});
|
|
529
|
-
return () => {
|
|
530
|
-
e = !0, u.dispose(), R.current = void 0, _.dispose(), g.dispose(), d?.flush(), L.current === d && (L.current = null);
|
|
531
|
-
};
|
|
532
|
-
}, o[15] = U, o[16] = W, o[17] = K, o[18] = k, o[19] = G, o[20] = I, o[21] = N, o[22] = M, o[23] = m, o[24] = xe) : xe = o[24];
|
|
533
|
-
let Se;
|
|
534
|
-
o[25] !== U || o[26] !== W || o[27] !== K || o[28] !== k || o[29] !== G || o[30] !== m ? (Se = [
|
|
535
|
-
U,
|
|
536
|
-
W,
|
|
537
|
-
m,
|
|
538
|
-
k,
|
|
539
|
-
G,
|
|
540
|
-
K
|
|
541
|
-
], o[25] = U, o[26] = W, o[27] = K, o[28] = k, o[29] = G, o[30] = m, o[31] = Se) : Se = o[31], S(xe, Se);
|
|
542
|
-
let Ce, we;
|
|
543
|
-
o[32] === Symbol.for("react.memo_cache_sentinel") ? (Ce = () => {
|
|
544
|
-
let e = () => L.current?.flush(), t = () => {
|
|
545
|
-
document.visibilityState === "hidden" && e();
|
|
546
|
-
};
|
|
547
|
-
return window.addEventListener("beforeunload", e), document.addEventListener("visibilitychange", t), () => {
|
|
548
|
-
window.removeEventListener("beforeunload", e), document.removeEventListener("visibilitychange", t);
|
|
549
|
-
};
|
|
550
|
-
}, we = [], o[32] = Ce, o[33] = we) : (Ce = o[32], we = o[33]), S(Ce, we);
|
|
551
|
-
let Te;
|
|
552
|
-
o[34] === Symbol.for("react.memo_cache_sentinel") ? (Te = (e) => {
|
|
553
|
-
L.current?.handleChange(e);
|
|
554
|
-
}, o[34] = Te) : Te = o[34];
|
|
555
|
-
let Ee = Te, De;
|
|
556
|
-
o[35] !== k || o[36] !== A ? (De = ce(A, k) ? A : null, o[35] = k, o[36] = A, o[37] = De) : De = o[37];
|
|
557
|
-
let q = De, Oe = q ? `${q.loadKey}:${q.editorRevision}` : "", J, ke;
|
|
558
|
-
o[38] !== Oe || o[39] !== b ? (J = () => {
|
|
559
|
-
if (!Oe || b) return;
|
|
560
|
-
let e = re.current;
|
|
561
|
-
e && requestAnimationFrame(() => {
|
|
562
|
-
let t = e.parentElement;
|
|
563
|
-
for (; t;) {
|
|
564
|
-
let e = getComputedStyle(t).overflowY;
|
|
565
|
-
[
|
|
566
|
-
"auto",
|
|
567
|
-
"scroll",
|
|
568
|
-
"overlay"
|
|
569
|
-
].includes(e) && t.scrollHeight > t.clientHeight && (t.scrollTop = 0), t = t.parentElement;
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
}, ke = [Oe, b], o[38] = Oe, o[39] = b, o[40] = J, o[41] = ke) : (J = o[40], ke = o[41]), C(J, ke);
|
|
573
|
-
let Y = ne?.loadKey === k ? ne.message : void 0;
|
|
574
|
-
if (Y && !q) {
|
|
575
|
-
let e;
|
|
576
|
-
o[42] === Y ? e = o[43] : (e = /* @__PURE__ */ E(g, {
|
|
577
|
-
color: "fg.muted",
|
|
578
|
-
children: Y
|
|
579
|
-
}), o[42] = Y, o[43] = e);
|
|
580
|
-
let t;
|
|
581
|
-
o[44] === Symbol.for("react.memo_cache_sentinel") ? (t = /* @__PURE__ */ E(d, {
|
|
582
|
-
size: "xs",
|
|
583
|
-
variant: "subtle",
|
|
584
|
-
onClick: () => R.current?.(),
|
|
585
|
-
children: "Retry"
|
|
586
|
-
}), o[44] = t) : t = o[44];
|
|
587
|
-
let n;
|
|
588
|
-
return o[45] === e ? n = o[46] : (n = /* @__PURE__ */ D(f, {
|
|
589
|
-
h: "full",
|
|
590
|
-
minH: "0",
|
|
591
|
-
bg: "bg",
|
|
592
|
-
p: "md",
|
|
593
|
-
flexDirection: "column",
|
|
594
|
-
gap: "sm",
|
|
595
|
-
children: [e, t]
|
|
596
|
-
}), o[45] = e, o[46] = n), n;
|
|
597
|
-
}
|
|
598
|
-
if (!q) {
|
|
599
|
-
let e;
|
|
600
|
-
return o[47] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ E(f, {
|
|
601
|
-
h: "full",
|
|
602
|
-
minH: "0",
|
|
603
|
-
bg: "bg",
|
|
604
|
-
children: /* @__PURE__ */ E(h, { size: "sm" })
|
|
605
|
-
}), o[47] = e) : e = o[47], e;
|
|
606
|
-
}
|
|
607
|
-
let Ae = `${q.loadKey}:${q.editorRevision}`, X = null;
|
|
608
|
-
if (F.removed) {
|
|
609
|
-
let e;
|
|
610
|
-
o[48] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ E(oe, { message: "This resource was removed. Your draft is kept here. Copy it before closing this tab." }), o[48] = e) : e = o[48], X = e;
|
|
611
|
-
} else if (Y) {
|
|
612
|
-
let e;
|
|
613
|
-
o[49] === Symbol.for("react.memo_cache_sentinel") ? (e = () => R.current?.(), o[49] = e) : e = o[49];
|
|
614
|
-
let t;
|
|
615
|
-
o[50] === Y ? t = o[51] : (t = /* @__PURE__ */ E(oe, {
|
|
616
|
-
message: Y,
|
|
617
|
-
onRetry: e
|
|
618
|
-
}), o[50] = Y, o[51] = t), X = t;
|
|
619
|
-
} else if (F.saveError) {
|
|
620
|
-
let e;
|
|
621
|
-
o[52] === Symbol.for("react.memo_cache_sentinel") ? (e = () => L.current?.retry(), o[52] = e) : e = o[52];
|
|
622
|
-
let t;
|
|
623
|
-
o[53] === F.saveError ? t = o[54] : (t = /* @__PURE__ */ E(oe, {
|
|
624
|
-
message: F.saveError,
|
|
625
|
-
onRetry: e
|
|
626
|
-
}), o[53] = F.saveError, o[54] = t), X = t;
|
|
627
|
-
}
|
|
628
|
-
let Z;
|
|
629
|
-
o[55] === q ? Z = o[56] : (Z = /* @__PURE__ */ E(me, { file: q }), o[55] = q, o[56] = Z);
|
|
630
|
-
let je = X, Me = !!_.save, Q;
|
|
631
|
-
o[57] !== b || o[58] !== m ? (Q = b ? (e) => de({
|
|
632
|
-
workbench: m,
|
|
633
|
-
navigation: b,
|
|
634
|
-
sectionId: e
|
|
635
|
-
}) : void 0, o[57] = b, o[58] = m, o[59] = Q) : Q = o[59];
|
|
636
|
-
let $;
|
|
637
|
-
o[60] !== _.title || o[61] !== q || o[62] !== Ae || o[63] !== ee || o[64] !== X || o[65] !== y || o[66] !== Me || o[67] !== Q ? ($ = /* @__PURE__ */ E(u, {
|
|
638
|
-
flex: "1",
|
|
639
|
-
minH: "0",
|
|
640
|
-
children: /* @__PURE__ */ E(ie, {
|
|
641
|
-
content: q,
|
|
642
|
-
position: y,
|
|
643
|
-
editorKey: Ae,
|
|
644
|
-
errorNotice: je,
|
|
645
|
-
contributionCanSave: Me,
|
|
646
|
-
onActiveSectionChange: Q,
|
|
647
|
-
onChange: Ee,
|
|
648
|
-
rendererRef: re,
|
|
649
|
-
sectionNavigation: ee,
|
|
650
|
-
title: _.title
|
|
651
|
-
})
|
|
652
|
-
}), o[60] = _.title, o[61] = q, o[62] = Ae, o[63] = ee, o[64] = X, o[65] = y, o[66] = Me, o[67] = Q, o[68] = $) : $ = o[68];
|
|
653
|
-
let Ne;
|
|
654
|
-
return o[69] !== Z || o[70] !== $ ? (Ne = /* @__PURE__ */ D(p, {
|
|
655
|
-
direction: "column",
|
|
656
|
-
h: "full",
|
|
657
|
-
minH: "0",
|
|
658
|
-
bg: "bg",
|
|
659
|
-
children: [Z, $]
|
|
660
|
-
}), o[69] = Z, o[70] = $, o[71] = Ne) : Ne = o[71], Ne;
|
|
661
|
-
};
|
|
662
|
-
function ge(e) {
|
|
663
|
-
return e.id;
|
|
664
|
-
}
|
|
665
|
-
//#endregion
|
|
666
|
-
export { V as WorkbenchFileRendererView };
|
|
667
|
-
|
|
668
|
-
//# sourceMappingURL=file-renderer-view-CJBCZZIE.js.map
|