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