@pstdio/workbench 0.8.0 → 0.9.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 +39 -317
- package/dist/extensions.d.ts +1283 -774
- package/dist/extensions.js +1454 -1924
- package/dist/extensions.js.map +1 -1
- package/dist/file-renderer-view-kfJRY3yR.js +515 -0
- package/dist/file-renderer-view-kfJRY3yR.js.map +1 -0
- package/dist/index.d.ts +589 -644
- package/dist/index.js +5011 -2644
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +540 -585
- package/dist/react.js +3583 -3424
- package/dist/react.js.map +1 -1
- package/dist/storage.d.ts +118 -157
- package/dist/storage.js +135 -149
- package/dist/storage.js.map +1 -1
- package/dist/webview-runtime.d.ts +2 -5
- package/dist/webview-runtime.js +3 -3
- package/dist/webview-runtime.js.map +1 -1
- package/dist/workbench-menu-paths-B_QJzcNU.js +12 -0
- package/dist/workbench-menu-paths-B_QJzcNU.js.map +1 -0
- package/dist/workbench-renderers-DmsrBGC7.js +960 -0
- package/dist/workbench-renderers-DmsrBGC7.js.map +1 -0
- package/dist/workspaces-DJwFj8uq.js +1872 -0
- package/dist/workspaces-DJwFj8uq.js.map +1 -0
- package/package.json +6 -41
- package/dist/composition-resolver-types-CWykPyEK.js +0 -241
- package/dist/composition-resolver-types-CWykPyEK.js.map +0 -1
- package/dist/file-renderer-view-B6_iR4EN.js +0 -496
- package/dist/file-renderer-view-B6_iR4EN.js.map +0 -1
- package/dist/file-section-navigation-CfYqVObc.js +0 -30
- package/dist/file-section-navigation-CfYqVObc.js.map +0 -1
- package/dist/layout-types-DMoZz38-.js +0 -100
- package/dist/layout-types-DMoZz38-.js.map +0 -1
- package/dist/surface-map-C1pOTUmF.js +0 -52
- package/dist/surface-map-C1pOTUmF.js.map +0 -1
- package/dist/testing.d.ts +0 -2443
- package/dist/testing.js +0 -58
- package/dist/testing.js.map +0 -1
- package/dist/workbench-built-ins-BCJ6-fIM.js +0 -1173
- package/dist/workbench-built-ins-BCJ6-fIM.js.map +0 -1
- package/dist/workbench-menu-paths-D-e7iscN.js +0 -43
- package/dist/workbench-menu-paths-D-e7iscN.js.map +0 -1
- package/dist/workflow-status-settings-DLiu9FZ0.js +0 -144
- package/dist/workflow-status-settings-DLiu9FZ0.js.map +0 -1
|
@@ -0,0 +1,515 @@
|
|
|
1
|
+
import { jsx as g, jsxs as L } from "react/jsx-runtime";
|
|
2
|
+
import { c as ie } from "react/compiler-runtime";
|
|
3
|
+
import { Image as _e, Box as he, Flex as B, Center as ne, Text as oe, Button as Ee, Spinner as Fe } from "@chakra-ui/react";
|
|
4
|
+
import { resourceKey as ue } from "@pstdio/sdk/extensions";
|
|
5
|
+
import { useState as me, useRef as V, useEffect as re, useLayoutEffect as ke } from "react";
|
|
6
|
+
import { EmptyState as Ke, useFileIconThemePreference as Te, resolveFileIconElement as je, Header as Le } from "@pstdio/ui";
|
|
7
|
+
import { CodeEditor as Ae } from "@pstdio/ui/diff";
|
|
8
|
+
import { MarkdownEditor as He } from "@pstdio/ui/rich-text";
|
|
9
|
+
import { a3 as K } from "./workbench-renderers-DmsrBGC7.js";
|
|
10
|
+
const Oe = "pstdio.fileSectionNavigation", Pe = (r) => {
|
|
11
|
+
if (!r || typeof r != "object") return !1;
|
|
12
|
+
const e = r, t = e.occurrence === void 0 || typeof e.occurrence == "number" && Number.isInteger(e.occurrence) && e.occurrence >= 0;
|
|
13
|
+
return typeof e.id == "string" && typeof e.heading == "string" && t;
|
|
14
|
+
}, $e = (r) => {
|
|
15
|
+
const e = r?.metadata?.[Oe];
|
|
16
|
+
if (!e || typeof e != "object") return;
|
|
17
|
+
const t = e;
|
|
18
|
+
if (!(typeof t.treeId != "string" || typeof t.targetNodeId != "string") && !(!Array.isArray(t.anchors) || !t.anchors.every(Pe)))
|
|
19
|
+
return {
|
|
20
|
+
treeId: t.treeId,
|
|
21
|
+
targetNodeId: t.targetNodeId,
|
|
22
|
+
anchors: t.anchors
|
|
23
|
+
};
|
|
24
|
+
}, Be = (r, e) => e && r.anchors.some((t) => t.id === e) ? e : r.targetNodeId, Ve = (r) => {
|
|
25
|
+
const {
|
|
26
|
+
previous: e,
|
|
27
|
+
current: t,
|
|
28
|
+
currentResourceKey: i,
|
|
29
|
+
selectedNodeId: n
|
|
30
|
+
} = r;
|
|
31
|
+
return !e || !n || !e.anchorIds.includes(n) || t?.targetNodeId === n ? !1 : !t || e.treeId !== t.treeId || e.resourceKey !== i;
|
|
32
|
+
}, qe = /* @__PURE__ */ new Set(["png", "jpg", "jpeg", "gif", "webp", "svg", "avif", "bmp", "ico"]), De = /* @__PURE__ */ new Set(["md", "markdown", "txt"]), Re = {
|
|
33
|
+
ts: "typescript",
|
|
34
|
+
tsx: "typescript",
|
|
35
|
+
js: "javascript",
|
|
36
|
+
jsx: "javascript",
|
|
37
|
+
mjs: "javascript",
|
|
38
|
+
cjs: "javascript",
|
|
39
|
+
json: "json",
|
|
40
|
+
jsonc: "json",
|
|
41
|
+
py: "python",
|
|
42
|
+
rb: "ruby",
|
|
43
|
+
rs: "rust",
|
|
44
|
+
go: "go",
|
|
45
|
+
java: "java",
|
|
46
|
+
kt: "kotlin",
|
|
47
|
+
c: "c",
|
|
48
|
+
h: "c",
|
|
49
|
+
cpp: "cpp",
|
|
50
|
+
cc: "cpp",
|
|
51
|
+
hpp: "cpp",
|
|
52
|
+
cs: "csharp",
|
|
53
|
+
php: "php",
|
|
54
|
+
swift: "swift",
|
|
55
|
+
sh: "shell",
|
|
56
|
+
bash: "shell",
|
|
57
|
+
zsh: "shell",
|
|
58
|
+
sql: "sql",
|
|
59
|
+
css: "css",
|
|
60
|
+
scss: "scss",
|
|
61
|
+
less: "less",
|
|
62
|
+
html: "html",
|
|
63
|
+
xml: "xml",
|
|
64
|
+
yml: "yaml",
|
|
65
|
+
yaml: "yaml",
|
|
66
|
+
toml: "ini",
|
|
67
|
+
ini: "ini",
|
|
68
|
+
dockerfile: "dockerfile",
|
|
69
|
+
graphql: "graphql",
|
|
70
|
+
gql: "graphql",
|
|
71
|
+
md: "markdown",
|
|
72
|
+
markdown: "markdown",
|
|
73
|
+
txt: "plaintext"
|
|
74
|
+
}, be = (r) => {
|
|
75
|
+
if (!r) return "";
|
|
76
|
+
const e = r.lastIndexOf(".");
|
|
77
|
+
return e < 0 || e === r.length - 1 ? "" : r.slice(e + 1).toLowerCase();
|
|
78
|
+
}, Me = (r, e) => e?.startsWith("image/") ? !0 : qe.has(be(r)), Ue = (r, e) => {
|
|
79
|
+
if (Me(r, e)) return "image";
|
|
80
|
+
const t = be(r);
|
|
81
|
+
return !De.has(t) && t in Re ? "code" : "markdown";
|
|
82
|
+
}, ze = (r) => Re[be(r)] ?? "plaintext", We = (r, e) => {
|
|
83
|
+
if (r.emptyState) return {
|
|
84
|
+
kind: "empty",
|
|
85
|
+
isEditable: !1
|
|
86
|
+
};
|
|
87
|
+
const t = Ue(r.fileName, r.mimeType);
|
|
88
|
+
if (t === "image") return {
|
|
89
|
+
kind: "image",
|
|
90
|
+
isEditable: !1
|
|
91
|
+
};
|
|
92
|
+
const i = e && r.editable !== !1;
|
|
93
|
+
return t === "code" || r.textRenderer === "monaco" ? {
|
|
94
|
+
kind: "code",
|
|
95
|
+
isEditable: i,
|
|
96
|
+
language: ze(r.fileName)
|
|
97
|
+
} : {
|
|
98
|
+
kind: "markdown",
|
|
99
|
+
isEditable: i
|
|
100
|
+
};
|
|
101
|
+
}, Ye = (r) => {
|
|
102
|
+
const e = ie(40), {
|
|
103
|
+
content: t,
|
|
104
|
+
editorKey: i,
|
|
105
|
+
errorNotice: n,
|
|
106
|
+
contributionCanSave: o,
|
|
107
|
+
onActiveSectionChange: d,
|
|
108
|
+
onChange: S,
|
|
109
|
+
rendererRef: f,
|
|
110
|
+
sectionNavigation: u,
|
|
111
|
+
title: T
|
|
112
|
+
} = r;
|
|
113
|
+
let w;
|
|
114
|
+
e[0] !== t || e[1] !== o ? (w = We(t, o), e[0] = t, e[1] = o, e[2] = w) : w = e[2];
|
|
115
|
+
const b = w;
|
|
116
|
+
if (b.kind === "empty") {
|
|
117
|
+
const E = t.emptyState?.title ?? "Select a file", p = t.emptyState?.description;
|
|
118
|
+
let c;
|
|
119
|
+
e[3] !== E || e[4] !== p ? (c = /* @__PURE__ */ g(Ke, { flex: "1", minH: "0", title: E, description: p }), e[3] = E, e[4] = p, e[5] = c) : c = e[5];
|
|
120
|
+
let m;
|
|
121
|
+
return e[6] !== n || e[7] !== c ? (m = /* @__PURE__ */ L(B, { direction: "column", h: "full", minH: "0", bg: "bg", children: [
|
|
122
|
+
n,
|
|
123
|
+
c
|
|
124
|
+
] }), e[6] = n, e[7] = c, e[8] = m) : m = e[8], m;
|
|
125
|
+
}
|
|
126
|
+
if (b.kind === "image") {
|
|
127
|
+
if (!t.dataUrl) {
|
|
128
|
+
let _;
|
|
129
|
+
return e[9] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ g(ne, { h: "full", minH: "0", bg: "bg", p: "md", children: /* @__PURE__ */ g(oe, { color: "fg.muted", children: "This image preview is unavailable." }) }), e[9] = _) : _ = e[9], _;
|
|
130
|
+
}
|
|
131
|
+
const E = t.fileName ?? T;
|
|
132
|
+
let p;
|
|
133
|
+
e[10] !== t.dataUrl || e[11] !== E ? (p = /* @__PURE__ */ g(_e, { src: t.dataUrl, alt: E, maxW: "100%", maxH: "100%", objectFit: "contain" }), e[10] = t.dataUrl, e[11] = E, e[12] = p) : p = e[12];
|
|
134
|
+
let c;
|
|
135
|
+
e[13] !== f || e[14] !== p ? (c = /* @__PURE__ */ g(ne, { ref: f, flex: "1", minH: "0", p: "md", overflow: "auto", children: p }), e[13] = f, e[14] = p, e[15] = c) : c = e[15];
|
|
136
|
+
let m;
|
|
137
|
+
return e[16] !== n || e[17] !== c ? (m = /* @__PURE__ */ L(B, { direction: "column", h: "full", minH: "0", bg: "bg", children: [
|
|
138
|
+
n,
|
|
139
|
+
c
|
|
140
|
+
] }), e[16] = n, e[17] = c, e[18] = m) : m = e[18], m;
|
|
141
|
+
}
|
|
142
|
+
if (b.kind === "code") {
|
|
143
|
+
const E = t.content ?? "", p = b.isEditable ? S : void 0;
|
|
144
|
+
let c;
|
|
145
|
+
e[19] !== i || e[20] !== b.isEditable || e[21] !== b.language || e[22] !== E || e[23] !== p ? (c = /* @__PURE__ */ g(he, { flex: "1", minH: "0", children: /* @__PURE__ */ g(Ae, { language: b.language, defaultCode: E, isEditable: b.isEditable, showLineNumbers: !0, onChange: p }, i) }), e[19] = i, e[20] = b.isEditable, e[21] = b.language, e[22] = E, e[23] = p, e[24] = c) : c = e[24];
|
|
146
|
+
let m;
|
|
147
|
+
return e[25] !== n || e[26] !== c ? (m = /* @__PURE__ */ L(B, { direction: "column", h: "full", minH: "0", bg: "bg", children: [
|
|
148
|
+
n,
|
|
149
|
+
c
|
|
150
|
+
] }), e[25] = n, e[26] = c, e[27] = m) : m = e[27], m;
|
|
151
|
+
}
|
|
152
|
+
const F = t.content ?? "", v = b.isEditable ? t.placeholder ?? "Write…" : void 0, N = b.isEditable ? S : void 0;
|
|
153
|
+
let x;
|
|
154
|
+
e[28] !== i || e[29] !== d || e[30] !== b.isEditable || e[31] !== u || e[32] !== F || e[33] !== v || e[34] !== N ? (x = /* @__PURE__ */ g(he, { flex: "1", minH: "0", overflowY: "auto", children: /* @__PURE__ */ g(He, { defaultState: F, isEditable: b.isEditable, sectionNavigation: u, placeholder: v, onActiveSectionChange: d, onChange: N }, i) }), e[28] = i, e[29] = d, e[30] = b.isEditable, e[31] = u, e[32] = F, e[33] = v, e[34] = N, e[35] = x) : x = e[35];
|
|
155
|
+
let y;
|
|
156
|
+
return e[36] !== n || e[37] !== f || e[38] !== x ? (y = /* @__PURE__ */ L(B, { ref: f, direction: "column", h: "full", minH: "0", overflow: "hidden", bg: "bg", children: [
|
|
157
|
+
n,
|
|
158
|
+
x
|
|
159
|
+
] }), e[36] = n, e[37] = f, e[38] = x, e[39] = y) : y = e[39], y;
|
|
160
|
+
}, Ge = (r) => {
|
|
161
|
+
let e, t, i = null, n = null, o, d, S = !1, f = null, u = 0;
|
|
162
|
+
const T = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Set(), b = (l) => l instanceof Error ? l.message : "Failed to save file.", F = () => ({
|
|
163
|
+
dirty: i !== null || n !== null && n.value !== e,
|
|
164
|
+
saving: n !== null,
|
|
165
|
+
...o ? {
|
|
166
|
+
saveError: o
|
|
167
|
+
} : {}
|
|
168
|
+
}), v = () => r.onStateChange?.(F()), N = () => {
|
|
169
|
+
f !== null && (clearTimeout(f), f = null);
|
|
170
|
+
}, x = () => r.createOperationId?.() ?? `file-save-${Date.now()}-${++u}`, y = () => i !== null || n !== null || f !== null || !!o, E = (l) => {
|
|
171
|
+
l.revision && (!d || l.revision.localeCompare(d) > 0) && (d = l.revision), l.revision || (S = !0);
|
|
172
|
+
}, p = (l) => {
|
|
173
|
+
const a = l.origin?.operationId;
|
|
174
|
+
return !a || l.origin?.rendererId !== r.binding.rendererId || l.origin.instanceId !== r.binding.instanceId ? !1 : n?.origin.operationId === a || w.has(a);
|
|
175
|
+
}, c = (l) => {
|
|
176
|
+
if (i !== null || n) return;
|
|
177
|
+
const a = d, R = S;
|
|
178
|
+
if (d = void 0, S = !1, a && (!l || a.localeCompare(l) > 0)) {
|
|
179
|
+
r.load({
|
|
180
|
+
resourceKey: r.binding.resourceKey,
|
|
181
|
+
revision: a
|
|
182
|
+
});
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
R && r.load({
|
|
186
|
+
resourceKey: r.binding.resourceKey
|
|
187
|
+
});
|
|
188
|
+
}, m = () => {
|
|
189
|
+
if (i === null || n || o) return;
|
|
190
|
+
const l = i;
|
|
191
|
+
i = null;
|
|
192
|
+
const a = {
|
|
193
|
+
rendererId: r.binding.rendererId,
|
|
194
|
+
instanceId: r.binding.instanceId,
|
|
195
|
+
operationId: x()
|
|
196
|
+
};
|
|
197
|
+
n = {
|
|
198
|
+
value: l,
|
|
199
|
+
origin: a
|
|
200
|
+
}, v(), Promise.resolve(r.save(l, a)).then((R) => {
|
|
201
|
+
if (n?.origin.operationId === a.operationId) {
|
|
202
|
+
if (n = null, w.add(a.operationId), w.size > 20 && w.delete(w.values().next().value), e = l, t = R?.revision ?? t, i === e && (i = null, N()), v(), i !== null) {
|
|
203
|
+
_();
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
c(R?.revision);
|
|
207
|
+
}
|
|
208
|
+
}).catch((R) => {
|
|
209
|
+
n?.origin.operationId === a.operationId && (n = null, i === null && (i = l), o = b(R), v());
|
|
210
|
+
});
|
|
211
|
+
}, _ = () => {
|
|
212
|
+
N(), f = setTimeout(() => {
|
|
213
|
+
f = null, m();
|
|
214
|
+
}, r.debounceMs);
|
|
215
|
+
};
|
|
216
|
+
return {
|
|
217
|
+
getBaseline() {
|
|
218
|
+
return e;
|
|
219
|
+
},
|
|
220
|
+
getState: F,
|
|
221
|
+
setBaseline(l, a) {
|
|
222
|
+
e = l, t = a, v();
|
|
223
|
+
},
|
|
224
|
+
acceptLoaded(l, a) {
|
|
225
|
+
return y() ? (E(a ? {
|
|
226
|
+
revision: a
|
|
227
|
+
} : {}), !1) : (e = l, t = a, v(), !0);
|
|
228
|
+
},
|
|
229
|
+
handleChange(l) {
|
|
230
|
+
if (!(o && l === i)) {
|
|
231
|
+
if (o = void 0, l === e && !n) {
|
|
232
|
+
i = null, N(), v();
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (n?.value === l) {
|
|
236
|
+
i = null, N(), v();
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
i = l, _(), v();
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
handleRefreshEvent(l = {}) {
|
|
243
|
+
if (!(l.resourceKey && l.resourceKey !== r.binding.resourceKey) && !p(l) && !(l.revision && T.has(l.revision))) {
|
|
244
|
+
if (l.revision && T.add(l.revision), y()) {
|
|
245
|
+
E(l);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
l.revision && t && l.revision.localeCompare(t) <= 0 || r.load(l);
|
|
249
|
+
}
|
|
250
|
+
},
|
|
251
|
+
retry() {
|
|
252
|
+
!o || i === null || n || (o = void 0, v(), m());
|
|
253
|
+
},
|
|
254
|
+
retryLoad() {
|
|
255
|
+
r.load({
|
|
256
|
+
resourceKey: r.binding.resourceKey
|
|
257
|
+
});
|
|
258
|
+
},
|
|
259
|
+
flush() {
|
|
260
|
+
N(), m();
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
}, Xe = (r, e, t, i) => !r || r.loadKey !== t ? 1 : (i ?? r.content) === e.content && r.dataUrl === e.dataUrl ? r.editorRevision : r.editorRevision + 1, Je = 30, $ = /* @__PURE__ */ new Map(), ve = (r) => $.get(r), Ie = (r, e) => {
|
|
264
|
+
if ($.delete(r), $.set(r, e), $.size <= Je) return;
|
|
265
|
+
const t = $.keys().next().value;
|
|
266
|
+
t !== void 0 && $.delete(t);
|
|
267
|
+
}, Se = (r) => {
|
|
268
|
+
const e = ie(7), {
|
|
269
|
+
message: t,
|
|
270
|
+
onRetry: i
|
|
271
|
+
} = r;
|
|
272
|
+
let n;
|
|
273
|
+
e[0] !== t ? (n = /* @__PURE__ */ g(oe, { color: "fg.muted", textStyle: "label/S/regular", children: t }), e[0] = t, e[1] = n) : n = e[1];
|
|
274
|
+
let o;
|
|
275
|
+
e[2] !== i ? (o = /* @__PURE__ */ g(Ee, { size: "2xs", variant: "subtle", onClick: i, children: "Retry" }), e[2] = i, e[3] = o) : o = e[3];
|
|
276
|
+
let d;
|
|
277
|
+
return e[4] !== n || e[5] !== o ? (d = /* @__PURE__ */ L(B, { flex: "none", alignItems: "center", justifyContent: "space-between", gap: "sm", borderBottomWidth: "1px", borderColor: "border.muted", bg: "bg.muted", px: "sm", py: "xs", children: [
|
|
278
|
+
n,
|
|
279
|
+
o
|
|
280
|
+
] }), e[4] = n, e[5] = o, e[6] = d) : d = e[6], d;
|
|
281
|
+
}, ge = (r) => Array.isArray(r) ? r.map(ge) : !r || typeof r != "object" ? r : Object.fromEntries(Object.entries(r).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => [e, ge(t)])), Qe = (r) => {
|
|
282
|
+
const {
|
|
283
|
+
fileRendererId: e,
|
|
284
|
+
resource: t
|
|
285
|
+
} = r, i = t ? ge({
|
|
286
|
+
id: t.id,
|
|
287
|
+
type: t.type,
|
|
288
|
+
metadata: t.metadata
|
|
289
|
+
}) : null;
|
|
290
|
+
return `${e}:${JSON.stringify(i)}`;
|
|
291
|
+
}, Ze = (r, e) => r?.loadKey === e, et = (r) => {
|
|
292
|
+
const e = ie(9), {
|
|
293
|
+
fileName: t,
|
|
294
|
+
filePath: i
|
|
295
|
+
} = r, {
|
|
296
|
+
activeFileIconTheme: n
|
|
297
|
+
} = Te();
|
|
298
|
+
let o;
|
|
299
|
+
e[0] !== n || e[1] !== t ? (o = je(t, {
|
|
300
|
+
theme: n
|
|
301
|
+
}), e[0] = n, e[1] = t, e[2] = o) : o = e[2];
|
|
302
|
+
const d = `File path ${i}`;
|
|
303
|
+
let S;
|
|
304
|
+
e[3] !== i || e[4] !== d ? (S = /* @__PURE__ */ g(oe, { "aria-label": d, textStyle: "label/S/regular", color: "fg.muted", truncate: !0, children: i }), e[3] = i, e[4] = d, e[5] = S) : S = e[5];
|
|
305
|
+
let f;
|
|
306
|
+
return e[6] !== o || e[7] !== S ? (f = /* @__PURE__ */ L(Le, { variant: "narrow", flexShrink: 0, gap: "2xs", bg: "bg", children: [
|
|
307
|
+
o,
|
|
308
|
+
S
|
|
309
|
+
] }), e[6] = o, e[7] = S, e[8] = f) : f = e[8], f;
|
|
310
|
+
}, tt = 600, rt = (r) => r instanceof Error ? r.message : "Failed to load file.", nt = (r) => {
|
|
311
|
+
const {
|
|
312
|
+
workbench: e,
|
|
313
|
+
navigation: t,
|
|
314
|
+
sectionId: i
|
|
315
|
+
} = r;
|
|
316
|
+
if (!t || !K(e).getTreeRenderer(t.treeId)) return;
|
|
317
|
+
if (i && t.anchors.some((o) => o.id === i)) {
|
|
318
|
+
K(e).setSelectedNode(t.treeId, i);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const n = K(e).getTreeState(t.treeId).selectedNodeId;
|
|
322
|
+
n && t.anchors.some((o) => o.id === n) && K(e).setSelectedNode(t.treeId, void 0);
|
|
323
|
+
}, it = (r, e) => {
|
|
324
|
+
if (!e) return;
|
|
325
|
+
const t = K(r).getTreeRenderer(e.treeId) ? K(r).getTreeState(e.treeId).selectedNodeId : void 0;
|
|
326
|
+
return {
|
|
327
|
+
anchors: e.anchors,
|
|
328
|
+
targetId: Be(e, t)
|
|
329
|
+
};
|
|
330
|
+
}, gt = (r) => {
|
|
331
|
+
const e = ie(66), {
|
|
332
|
+
workbench: t,
|
|
333
|
+
contribution: i
|
|
334
|
+
} = r, n = r.placement?.resource;
|
|
335
|
+
let o, d;
|
|
336
|
+
e[0] !== n || e[1] !== t ? (o = $e(n), d = it(t, o), e[0] = n, e[1] = t, e[2] = o, e[3] = d) : (o = e[2], d = e[3]);
|
|
337
|
+
const S = d;
|
|
338
|
+
let f;
|
|
339
|
+
e[4] !== i.id || e[5] !== n ? (f = Qe({
|
|
340
|
+
fileRendererId: i.id,
|
|
341
|
+
resource: n
|
|
342
|
+
}), e[4] = i.id, e[5] = n, e[6] = f) : f = e[6];
|
|
343
|
+
const u = f, [T, w] = me(null), [b, F] = me(null);
|
|
344
|
+
let v;
|
|
345
|
+
e[7] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (v = {
|
|
346
|
+
dirty: !1,
|
|
347
|
+
saving: !1
|
|
348
|
+
}, e[7] = v) : v = e[7];
|
|
349
|
+
const [N, x] = me(v), y = V(null), E = V(null), p = V(null);
|
|
350
|
+
let c, m;
|
|
351
|
+
e[8] !== n || e[9] !== o || e[10] !== t ? (c = () => {
|
|
352
|
+
const s = p.current, h = s && K(t).getTreeRenderer(s.treeId) ? K(t).getTreeState(s.treeId).selectedNodeId : void 0;
|
|
353
|
+
Ve({
|
|
354
|
+
previous: s,
|
|
355
|
+
current: o,
|
|
356
|
+
currentResourceKey: ue(n),
|
|
357
|
+
selectedNodeId: h
|
|
358
|
+
}) && s && K(t).setSelectedNode(s.treeId, void 0), p.current = o ? {
|
|
359
|
+
resourceKey: ue(n),
|
|
360
|
+
treeId: o.treeId,
|
|
361
|
+
anchorIds: o.anchors.map(ot)
|
|
362
|
+
} : null;
|
|
363
|
+
}, m = [n, o, t], e[8] = n, e[9] = o, e[10] = t, e[11] = c, e[12] = m) : (c = e[11], m = e[12]), re(c, m);
|
|
364
|
+
const _ = V(i), l = V(n);
|
|
365
|
+
let a;
|
|
366
|
+
e[13] !== i || e[14] !== n ? (a = () => {
|
|
367
|
+
_.current = i, l.current = n;
|
|
368
|
+
}, e[13] = i, e[14] = n, e[15] = a) : a = e[15], re(a);
|
|
369
|
+
const R = i.id, A = !!i.save;
|
|
370
|
+
let q;
|
|
371
|
+
e[16] !== R || e[17] !== A || e[18] !== u || e[19] !== r.placement?.instanceId || e[20] !== t ? (q = () => {
|
|
372
|
+
let s = !1;
|
|
373
|
+
F(null);
|
|
374
|
+
const h = ve(u);
|
|
375
|
+
w(h ? {
|
|
376
|
+
...h,
|
|
377
|
+
editorRevision: 1,
|
|
378
|
+
loadKey: u
|
|
379
|
+
} : null);
|
|
380
|
+
const k = () => {
|
|
381
|
+
Promise.resolve(_.current.load(l.current)).then((C) => {
|
|
382
|
+
if (s || y.current && !y.current.acceptLoaded(C.content, C.revision))
|
|
383
|
+
return;
|
|
384
|
+
F(null), Ie(u, C);
|
|
385
|
+
const P = y.current?.getBaseline();
|
|
386
|
+
w((fe) => ({
|
|
387
|
+
...C,
|
|
388
|
+
editorRevision: Xe(fe, C, u, P),
|
|
389
|
+
loadKey: u
|
|
390
|
+
}));
|
|
391
|
+
}).catch((C) => {
|
|
392
|
+
s || F({
|
|
393
|
+
loadKey: u,
|
|
394
|
+
message: rt(C)
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
y.current = A ? Ge({
|
|
399
|
+
binding: {
|
|
400
|
+
rendererId: R,
|
|
401
|
+
instanceId: r.placement?.instanceId ?? R,
|
|
402
|
+
resourceKey: ue(l.current)
|
|
403
|
+
},
|
|
404
|
+
debounceMs: tt,
|
|
405
|
+
load: k,
|
|
406
|
+
onStateChange: (C) => {
|
|
407
|
+
s || x(C);
|
|
408
|
+
},
|
|
409
|
+
save: (C, P) => Promise.resolve(_.current.save?.(l.current, C, P)).then((fe) => {
|
|
410
|
+
const pe = ve(u);
|
|
411
|
+
return pe && Ie(u, {
|
|
412
|
+
...pe,
|
|
413
|
+
content: C
|
|
414
|
+
}), fe ?? void 0;
|
|
415
|
+
})
|
|
416
|
+
}) : null, h && y.current?.setBaseline(h.content, h.revision), x({
|
|
417
|
+
dirty: !1,
|
|
418
|
+
saving: !1
|
|
419
|
+
}), k();
|
|
420
|
+
const xe = K(t).onDidRefreshFileRenderer((C) => {
|
|
421
|
+
if (C.fileRendererId !== R)
|
|
422
|
+
return;
|
|
423
|
+
const P = y.current;
|
|
424
|
+
P ? P.handleRefreshEvent(C) : k();
|
|
425
|
+
});
|
|
426
|
+
return () => {
|
|
427
|
+
s = !0, xe.dispose(), y.current?.flush(), y.current = null;
|
|
428
|
+
};
|
|
429
|
+
}, e[16] = R, e[17] = A, e[18] = u, e[19] = r.placement?.instanceId, e[20] = t, e[21] = q) : q = e[21];
|
|
430
|
+
const le = r.placement?.instanceId;
|
|
431
|
+
let D;
|
|
432
|
+
e[22] !== R || e[23] !== A || e[24] !== u || e[25] !== le || e[26] !== t ? (D = [R, A, t, u, le], e[22] = R, e[23] = A, e[24] = u, e[25] = le, e[26] = t, e[27] = D) : D = e[27], re(q, D);
|
|
433
|
+
let M, U;
|
|
434
|
+
e[28] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (U = () => {
|
|
435
|
+
const s = () => y.current?.flush(), h = () => {
|
|
436
|
+
document.visibilityState === "hidden" && s();
|
|
437
|
+
};
|
|
438
|
+
return window.addEventListener("beforeunload", s), document.addEventListener("visibilitychange", h), () => {
|
|
439
|
+
window.removeEventListener("beforeunload", s), document.removeEventListener("visibilitychange", h);
|
|
440
|
+
};
|
|
441
|
+
}, M = [], e[28] = M, e[29] = U) : (M = e[28], U = e[29]), re(U, M);
|
|
442
|
+
let z;
|
|
443
|
+
e[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (z = (s) => {
|
|
444
|
+
y.current?.handleChange(s);
|
|
445
|
+
}, e[30] = z) : z = e[30];
|
|
446
|
+
const Ce = z;
|
|
447
|
+
let W;
|
|
448
|
+
e[31] !== u || e[32] !== T ? (W = Ze(T, u) ? T : null, e[31] = u, e[32] = T, e[33] = W) : W = e[33];
|
|
449
|
+
const I = W, Y = I ? `${I.loadKey}:${I.editorRevision}` : "";
|
|
450
|
+
let G, X;
|
|
451
|
+
e[34] !== Y || e[35] !== o ? (G = () => {
|
|
452
|
+
if (!Y || o)
|
|
453
|
+
return;
|
|
454
|
+
const s = E.current;
|
|
455
|
+
s && requestAnimationFrame(() => {
|
|
456
|
+
let h = s.parentElement;
|
|
457
|
+
for (; h; ) {
|
|
458
|
+
const k = getComputedStyle(h).overflowY;
|
|
459
|
+
["auto", "scroll", "overlay"].includes(k) && h.scrollHeight > h.clientHeight && (h.scrollTop = 0), h = h.parentElement;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}, X = [Y, o], e[34] = Y, e[35] = o, e[36] = G, e[37] = X) : (G = e[36], X = e[37]), ke(G, X);
|
|
463
|
+
const j = b?.loadKey === u ? b.message : void 0;
|
|
464
|
+
let J;
|
|
465
|
+
e[38] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (J = () => y.current?.retryLoad(), e[38] = J) : J = e[38];
|
|
466
|
+
const ye = J;
|
|
467
|
+
let Q;
|
|
468
|
+
e[39] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (Q = () => y.current?.retry(), e[39] = Q) : Q = e[39];
|
|
469
|
+
const Ne = Q;
|
|
470
|
+
if (j && !I) {
|
|
471
|
+
let s;
|
|
472
|
+
e[40] !== j ? (s = /* @__PURE__ */ g(oe, { color: "fg.muted", children: j }), e[40] = j, e[41] = s) : s = e[41];
|
|
473
|
+
let h;
|
|
474
|
+
e[42] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ g(Ee, { size: "xs", variant: "subtle", onClick: ye, children: "Retry" }), e[42] = h) : h = e[42];
|
|
475
|
+
let k;
|
|
476
|
+
return e[43] !== s ? (k = /* @__PURE__ */ L(ne, { h: "full", minH: "0", bg: "bg", p: "md", flexDirection: "column", gap: "sm", children: [
|
|
477
|
+
s,
|
|
478
|
+
h
|
|
479
|
+
] }), e[43] = s, e[44] = k) : k = e[44], k;
|
|
480
|
+
}
|
|
481
|
+
if (!I) {
|
|
482
|
+
let s;
|
|
483
|
+
return e[45] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ g(ne, { h: "full", minH: "0", bg: "bg", children: /* @__PURE__ */ g(Fe, { size: "sm" }) }), e[45] = s) : s = e[45], s;
|
|
484
|
+
}
|
|
485
|
+
const se = `${I.loadKey}:${I.editorRevision}`;
|
|
486
|
+
let Z;
|
|
487
|
+
e[46] !== N || e[47] !== j ? (Z = j ? /* @__PURE__ */ g(Se, { message: j, onRetry: ye }) : N.saveError ? /* @__PURE__ */ g(Se, { message: N.saveError, onRetry: Ne }) : null, e[46] = N, e[47] = j, e[48] = Z) : Z = e[48];
|
|
488
|
+
const ce = Z;
|
|
489
|
+
let ee;
|
|
490
|
+
e[49] !== o || e[50] !== t ? (ee = (s) => {
|
|
491
|
+
nt({
|
|
492
|
+
workbench: t,
|
|
493
|
+
navigation: o,
|
|
494
|
+
sectionId: s
|
|
495
|
+
});
|
|
496
|
+
}, e[49] = o, e[50] = t, e[51] = ee) : ee = e[51];
|
|
497
|
+
const we = ee;
|
|
498
|
+
let H;
|
|
499
|
+
e[52] !== I.fileName || e[53] !== I.filePath ? (H = I.filePath ? /* @__PURE__ */ g(et, { fileName: I.fileName ?? I.filePath, filePath: I.filePath }) : null, e[52] = I.fileName, e[53] = I.filePath, e[54] = H) : H = e[54];
|
|
500
|
+
const ae = !!i.save, de = o ? we : void 0;
|
|
501
|
+
let O;
|
|
502
|
+
e[55] !== i.title || e[56] !== I || e[57] !== se || e[58] !== S || e[59] !== ce || e[60] !== ae || e[61] !== de ? (O = /* @__PURE__ */ g(he, { flex: "1", minH: "0", children: /* @__PURE__ */ g(Ye, { content: I, editorKey: se, errorNotice: ce, contributionCanSave: ae, onActiveSectionChange: de, onChange: Ce, rendererRef: E, sectionNavigation: S, title: i.title }) }), e[55] = i.title, e[56] = I, e[57] = se, e[58] = S, e[59] = ce, e[60] = ae, e[61] = de, e[62] = O) : O = e[62];
|
|
503
|
+
let te;
|
|
504
|
+
return e[63] !== H || e[64] !== O ? (te = /* @__PURE__ */ L(B, { direction: "column", h: "full", minH: "0", bg: "bg", children: [
|
|
505
|
+
H,
|
|
506
|
+
O
|
|
507
|
+
] }), e[63] = H, e[64] = O, e[65] = te) : te = e[65], te;
|
|
508
|
+
};
|
|
509
|
+
function ot(r) {
|
|
510
|
+
return r.id;
|
|
511
|
+
}
|
|
512
|
+
export {
|
|
513
|
+
gt as WorkbenchFileRendererView
|
|
514
|
+
};
|
|
515
|
+
//# sourceMappingURL=file-renderer-view-kfJRY3yR.js.map
|