@pstdio/workbench 0.2.0 → 0.3.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.
Files changed (39) hide show
  1. package/README.md +100 -88
  2. package/dist/context-key-service-W4QEfVdN.js +1031 -0
  3. package/dist/context-key-service-W4QEfVdN.js.map +1 -0
  4. package/dist/extensions.d.ts +737 -255
  5. package/dist/extensions.js +891 -699
  6. package/dist/extensions.js.map +1 -1
  7. package/dist/file-renderer-view-DrrhYnb_.js.map +1 -1
  8. package/dist/index.d.ts +746 -448
  9. package/dist/index.js +2974 -60
  10. package/dist/index.js.map +1 -1
  11. package/dist/layout-types-DMoZz38-.js +100 -0
  12. package/dist/layout-types-DMoZz38-.js.map +1 -0
  13. package/dist/react.d.ts +735 -231
  14. package/dist/react.js +3562 -2584
  15. package/dist/react.js.map +1 -1
  16. package/dist/storage.d.ts +109 -14
  17. package/dist/storage.js +142 -47
  18. package/dist/storage.js.map +1 -1
  19. package/dist/surface-map-C1pOTUmF.js +52 -0
  20. package/dist/surface-map-C1pOTUmF.js.map +1 -0
  21. package/dist/testing.d.ts +685 -198
  22. package/dist/testing.js +46 -34
  23. package/dist/testing.js.map +1 -1
  24. package/dist/webview-runtime.js +5 -1
  25. package/dist/webview-runtime.js.map +1 -1
  26. package/dist/workbench-menu-paths-B_QJzcNU.js +12 -0
  27. package/dist/workbench-menu-paths-B_QJzcNU.js.map +1 -0
  28. package/package.json +6 -7
  29. package/dist/context-key-service-C--cHa0B.js +0 -447
  30. package/dist/context-key-service-C--cHa0B.js.map +0 -1
  31. package/dist/core.d.ts +0 -1885
  32. package/dist/core.js +0 -64
  33. package/dist/core.js.map +0 -1
  34. package/dist/surface-reconcile-DkRf01ro.js +0 -260
  35. package/dist/surface-reconcile-DkRf01ro.js.map +0 -1
  36. package/dist/workbench-core-DFpwi8Lo.js +0 -2264
  37. package/dist/workbench-core-DFpwi8Lo.js.map +0 -1
  38. package/dist/workbench-menu-paths-CQVH6z4_.js +0 -11
  39. package/dist/workbench-menu-paths-CQVH6z4_.js.map +0 -1
@@ -1,47 +1,47 @@
1
- import { jsxs as oe, jsx as W } from "react/jsx-runtime";
2
- import { useRef as y, useState as Be, useEffect as A, createElement as fe } from "react";
3
- import { host as De } from "rimless";
4
- import { W as be } from "./icon-B9XolQG8.js";
5
- import { isLocalizedString as $e, matchesResourceWhen as He } from "@pstdio/sdk/extensions";
6
- import { b as Me } from "./workbench-menu-paths-CQVH6z4_.js";
7
- const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "notification.action", "notification.resolve", "notification.dismiss", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "terminal.session", "files.upload", "files.list", "files.delete"], he = ["host.dispatchKeyboardEvent"], Oe = [...Ve, ...he], Ne = new Set(Oe), pe = (e) => Ne.has(e), Ue = (e) => {
8
- const [t, r] = e.split("@"), o = r === void 0 ? L : Number(r);
1
+ import { jsxs as de, jsx as P } from "react/jsx-runtime";
2
+ import { useRef as I, useState as He, useEffect as A, createElement as V } from "react";
3
+ import { host as Ve } from "rimless";
4
+ import { W as F } from "./icon-B9XolQG8.js";
5
+ import { isLocalizedString as Fe, matchesResourceWhen as Le } from "@pstdio/sdk/extensions";
6
+ import { w as Oe } from "./workbench-menu-paths-B_QJzcNU.js";
7
+ const X = 1, Ne = ["commands.execute", "resource.open", "notification.show", "notification.action", "notification.resolve", "notification.dismiss", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "terminal.session", "files.upload", "files.list", "files.delete"], Ie = ["host.dispatchKeyboardEvent"], Ue = [...Ne, ...Ie], _e = new Set(Ue), ye = (e) => _e.has(e), qe = (e) => {
8
+ const [t, r] = e.split("@"), o = r === void 0 ? X : Number(r);
9
9
  return {
10
10
  capability: e,
11
11
  name: t ?? "",
12
12
  version: o
13
13
  };
14
- }, j = (e) => ({
14
+ }, D = (e) => ({
15
15
  capability: e,
16
16
  code: "unsupported_webview_capability",
17
17
  message: `Unsupported webview capability: ${e}`,
18
18
  severity: "error"
19
- }), Fe = (e, t, r) => ({
19
+ }), ze = (e, t, r) => ({
20
20
  capability: e,
21
21
  code: "unsupported_webview_capability_version",
22
- message: `Unsupported webview capability version: ${t}@${r.toString()} (supported: ${L.toString()})`,
22
+ message: `Unsupported webview capability version: ${t}@${r.toString()} (supported: ${X.toString()})`,
23
23
  severity: "error"
24
- }), _e = (e) => ({
24
+ }), Qe = (e) => ({
25
25
  capability: e,
26
26
  code: "undeclared_webview_capability",
27
27
  message: `Webview did not declare host capability: ${e}`,
28
28
  severity: "error"
29
- }), Le = (e, t = {}) => {
29
+ }), Ge = (e, t = {}) => {
30
30
  const r = [], o = /* @__PURE__ */ new Set();
31
- for (const n of he)
31
+ for (const n of Ie)
32
32
  t[n] && o.add(n);
33
33
  for (const n of e ?? []) {
34
- const s = Ue(n);
35
- if (!pe(s.name)) {
36
- r.push(j(n));
34
+ const s = qe(n);
35
+ if (!ye(s.name)) {
36
+ r.push(D(n));
37
37
  continue;
38
38
  }
39
- if (s.version !== L) {
40
- r.push(Fe(n, s.name, s.version));
39
+ if (s.version !== X) {
40
+ r.push(ze(n, s.name, s.version));
41
41
  continue;
42
42
  }
43
43
  if (!t[s.name]) {
44
- r.push(j(n));
44
+ r.push(D(n));
45
45
  continue;
46
46
  }
47
47
  o.add(s.name);
@@ -50,33 +50,33 @@ const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "no
50
50
  allowed: o,
51
51
  diagnostics: r
52
52
  };
53
- }, ze = (e) => {
53
+ }, Ye = (e) => {
54
54
  const {
55
55
  allowed: t,
56
56
  diagnostics: r
57
- } = Le(e.declaredCapabilities, e.capabilities), o = (n) => {
57
+ } = Ge(e.declaredCapabilities, e.capabilities), o = (n) => {
58
58
  e.onDiagnostic?.(n);
59
59
  };
60
60
  return {
61
61
  diagnostics: r,
62
62
  async call(n) {
63
- if (!pe(n.method)) {
64
- const a = j(n.method);
63
+ if (!ye(n.method)) {
64
+ const a = D(n.method);
65
65
  throw o(a), new Error(a.message);
66
66
  }
67
67
  if (!t.has(n.method)) {
68
- const a = _e(n.method);
68
+ const a = Qe(n.method);
69
69
  throw o(a), new Error(a.message);
70
70
  }
71
71
  const s = e.capabilities[n.method];
72
72
  if (!s) {
73
- const a = j(n.method);
73
+ const a = D(n.method);
74
74
  throw o(a), new Error(a.message);
75
75
  }
76
76
  return await s(n.params);
77
77
  }
78
78
  };
79
- }, qe = (e) => typeof e == "object" && e !== null, ne = (e) => {
79
+ }, Xe = (e) => typeof e == "object" && e !== null, ce = (e) => {
80
80
  try {
81
81
  const t = JSON.stringify(e);
82
82
  if (typeof t == "string" && t.length > 0) return t;
@@ -87,7 +87,7 @@ const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "no
87
87
  } catch {
88
88
  return "Unknown error";
89
89
  }
90
- }, Qe = (e) => {
90
+ }, Je = (e) => {
91
91
  if (e instanceof Error) return {
92
92
  message: e.message,
93
93
  stack: e.stack
@@ -95,7 +95,7 @@ const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "no
95
95
  if (typeof e == "string") return {
96
96
  message: e
97
97
  };
98
- if (qe(e)) {
98
+ if (Xe(e)) {
99
99
  const t = typeof e.message == "string" ? e.message : null, r = typeof e.stack == "string" ? e.stack : void 0;
100
100
  return t ? r ? {
101
101
  message: t,
@@ -103,15 +103,15 @@ const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "no
103
103
  } : {
104
104
  message: t
105
105
  } : {
106
- message: ne(e)
106
+ message: ce(e)
107
107
  };
108
108
  }
109
109
  return e == null ? {
110
110
  message: "Unknown error"
111
111
  } : {
112
- message: ne(e)
112
+ message: ce(e)
113
113
  };
114
- }, M = () => {
114
+ }, U = () => {
115
115
  if (typeof document > "u") return {};
116
116
  const e = getComputedStyle(document.documentElement), t = {};
117
117
  for (let r = 0; r < e.length; r += 1) {
@@ -119,26 +119,26 @@ const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "no
119
119
  o.startsWith("--chakra-") && (t[o] = e.getPropertyValue(o).trim());
120
120
  }
121
121
  return t;
122
- }, V = (e) => {
122
+ }, _ = (e) => {
123
123
  if (typeof document > "u") return e;
124
124
  const t = document.documentElement.getAttribute("data-theme");
125
125
  if (t === "dark" || t === "light") return t;
126
126
  const r = document.documentElement.getAttribute("data-color-mode");
127
127
  return r === "dark" || r === "light" ? r : e;
128
- }, Ge = {
128
+ }, Ze = {
129
129
  border: 0,
130
130
  display: "block",
131
131
  flex: "1 1 0%",
132
132
  height: "100%",
133
133
  minHeight: 0,
134
134
  width: "100%"
135
- }, Xe = {
135
+ }, et = {
136
136
  display: "flex",
137
137
  height: "100%",
138
138
  minHeight: 0,
139
139
  position: "relative",
140
140
  width: "100%"
141
- }, Ye = {
141
+ }, tt = {
142
142
  alignItems: "center",
143
143
  background: "rgba(255, 255, 255, 0.92)",
144
144
  color: "#7a1f12",
@@ -149,7 +149,7 @@ const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "no
149
149
  position: "absolute",
150
150
  textAlign: "center",
151
151
  zIndex: 1
152
- }, Je = "allow-scripts allow-forms allow-popups", Ze = (e) => {
152
+ }, rt = "allow-scripts allow-forms allow-popups", ot = (e) => {
153
153
  const {
154
154
  view: t,
155
155
  props: r,
@@ -157,104 +157,104 @@ const L = 1, Ve = ["commands.execute", "resource.open", "notification.show", "no
157
157
  capabilities: n,
158
158
  hostEvents: s,
159
159
  onReady: a,
160
- onError: c,
161
- onDiagnostics: d,
160
+ onError: d,
161
+ onDiagnostics: c,
162
162
  title: b
163
- } = e, i = y(null), l = y(null), m = y(!1), p = y(null), f = y(r), h = y(o), g = y(n), v = y(s), Y = y(t.webview.capabilities), J = y(a), S = y(c), Z = y(d), [ee, P] = Be(null);
164
- return f.current = r, h.current = o, g.current = n, v.current = s, Y.current = t.webview.capabilities, J.current = a, S.current = c, Z.current = d, A(() => {
163
+ } = e, i = I(null), l = I(null), u = I(!1), f = I(null), p = I(r), h = I(o), v = I(n), te = I(s), re = I(t.webview.capabilities), oe = I(a), M = I(d), ne = I(c), [se, $] = He(null);
164
+ return p.current = r, h.current = o, v.current = n, te.current = s, re.current = t.webview.capabilities, oe.current = a, M.current = d, ne.current = c, A(() => {
165
165
  const w = i.current;
166
166
  if (!w) return;
167
- const C = `${t.webview.runtimeUrl}
167
+ const R = `${t.webview.runtimeUrl}
168
168
  ${t.webview.moduleUrl}`;
169
- if (p.current === C) return;
170
- p.current = C, m.current = !1, l.current = null;
171
- const x = t.webview.styles, T = t.webview.moduleUrl, te = (I) => {
172
- I.length > 0 && Z.current?.(I);
173
- }, re = () => ze({
174
- capabilities: g.current ?? {},
175
- declaredCapabilities: Y.current,
176
- onDiagnostic: (I) => te([I])
169
+ if (f.current === R) return;
170
+ f.current = R, u.current = !1, l.current = null;
171
+ const x = t.webview.styles, B = t.webview.moduleUrl, ie = (g) => {
172
+ g.length > 0 && ne.current?.(g);
173
+ }, ae = () => Ye({
174
+ capabilities: v.current ?? {},
175
+ declaredCapabilities: re.current,
176
+ onDiagnostic: (g) => ie([g])
177
177
  });
178
- te(re().diagnostics);
179
- const Te = {
178
+ ie(ae().diagnostics);
179
+ const $e = {
180
180
  ready: () => {
181
181
  },
182
- runtimeError: (I) => {
183
- P(I.message), S.current?.(I);
182
+ runtimeError: (g) => {
183
+ $(g.message), M.current?.(g);
184
184
  },
185
- call: async (I) => await re().call(I)
186
- }, je = De.connect(w, Te);
187
- return w.contentWindow?.location.replace(t.webview.runtimeUrl), je.then(async (I) => {
188
- const E = I.remote;
189
- l.current = E, v.current?.bind((Ke) => E.hostEvent?.(Ke)), await E.init({
190
- moduleUrl: T,
185
+ call: async (g) => await ae().call(g)
186
+ }, Be = Ve.connect(w, $e);
187
+ return w.contentWindow?.location.replace(t.webview.runtimeUrl), Be.then(async (g) => {
188
+ const C = g.remote;
189
+ l.current = C, te.current?.bind((De) => C.hostEvent?.(De)), await C.init({
190
+ moduleUrl: B,
191
191
  styles: x,
192
- props: f.current,
193
- theme: V(h.current),
194
- themeVariables: M()
195
- }), m.current = !0, P(null), J.current?.();
196
- }).catch((I) => {
197
- const E = Qe(I);
198
- P(E.message), S.current?.(E);
192
+ props: p.current,
193
+ theme: _(h.current),
194
+ themeVariables: U()
195
+ }), u.current = !0, $(null), oe.current?.();
196
+ }).catch((g) => {
197
+ const C = Je(g);
198
+ $(C.message), M.current?.(C);
199
199
  }), () => {
200
200
  };
201
201
  }, [t.webview.runtimeUrl, t.webview.moduleUrl, t.webview.styles]), A(() => {
202
202
  const w = l.current;
203
203
  if (!(!w || !s))
204
- return s.bind((C) => w.hostEvent?.(C)), () => s.unbind();
204
+ return s.bind((R) => w.hostEvent?.(R)), () => s.unbind();
205
205
  }, [s]), A(() => {
206
- m.current && l.current?.propsUpdate({
206
+ u.current && l.current?.propsUpdate({
207
207
  props: r
208
208
  });
209
209
  }, [r]), A(() => {
210
- m.current && l.current?.themeUpdate({
211
- theme: V(o),
212
- variables: M()
210
+ u.current && l.current?.themeUpdate({
211
+ theme: _(o),
212
+ variables: U()
213
213
  });
214
214
  }, [o]), A(() => {
215
215
  if (typeof window > "u" || typeof MutationObserver > "u") return;
216
216
  let w = null;
217
- const C = () => {
217
+ const R = () => {
218
218
  w !== null && cancelAnimationFrame(w), w = requestAnimationFrame(() => {
219
- w = null, m.current && l.current?.themeUpdate({
220
- theme: V(h.current),
221
- variables: M()
219
+ w = null, u.current && l.current?.themeUpdate({
220
+ theme: _(h.current),
221
+ variables: U()
222
222
  });
223
223
  });
224
- }, x = new MutationObserver(C), T = {
224
+ }, x = new MutationObserver(R), B = {
225
225
  attributeFilter: ["class", "data-color-mode", "data-theme", "style"],
226
226
  attributes: !0
227
227
  };
228
- return x.observe(document.documentElement, T), x.observe(document.body, T), () => {
228
+ return x.observe(document.documentElement, B), x.observe(document.body, B), () => {
229
229
  x.disconnect(), w !== null && cancelAnimationFrame(w);
230
230
  };
231
- }, []), /* @__PURE__ */ oe("div", { style: Xe, children: [
232
- ee ? /* @__PURE__ */ W("div", { role: "alert", style: Ye, children: /* @__PURE__ */ oe("div", { children: [
233
- /* @__PURE__ */ W("strong", { children: "Extension view failed to load." }),
234
- /* @__PURE__ */ W("div", { children: ee })
231
+ }, []), /* @__PURE__ */ de("div", { style: et, children: [
232
+ se ? /* @__PURE__ */ P("div", { role: "alert", style: tt, children: /* @__PURE__ */ de("div", { children: [
233
+ /* @__PURE__ */ P("strong", { children: "Extension view failed to load." }),
234
+ /* @__PURE__ */ P("div", { children: se })
235
235
  ] }) }) : null,
236
- /* @__PURE__ */ W(
236
+ /* @__PURE__ */ P(
237
237
  "iframe",
238
238
  {
239
239
  ref: i,
240
240
  title: b ?? t.label,
241
241
  allow: "fullscreen",
242
242
  allowFullScreen: !0,
243
- sandbox: Je,
243
+ sandbox: rt,
244
244
  style: {
245
- ...Ge,
245
+ ...Ze,
246
246
  colorScheme: o
247
247
  },
248
248
  onError: () => {
249
249
  const w = `Failed to load extension runtime at ${t.webview.runtimeUrl}`;
250
- P(w), S.current?.({
250
+ $(w), M.current?.({
251
251
  message: w
252
252
  });
253
253
  }
254
254
  }
255
255
  )
256
256
  ] });
257
- }, et = () => {
257
+ }, nt = () => {
258
258
  let e = null;
259
259
  const t = [], r = /* @__PURE__ */ new Set();
260
260
  return {
@@ -272,13 +272,13 @@ ${t.webview.moduleUrl}`;
272
272
  for (const o of r) o();
273
273
  }
274
274
  };
275
- }, tt = "terminal.session", rt = (e) => {
275
+ }, st = "terminal.session", it = (e) => {
276
276
  const {
277
277
  terminal: t,
278
278
  hostEvents: r
279
279
  } = e, o = (n) => {
280
280
  r.emit({
281
- scope: tt,
281
+ scope: st,
282
282
  payload: n
283
283
  });
284
284
  };
@@ -325,13 +325,13 @@ ${t.webview.moduleUrl}`;
325
325
  const {
326
326
  sessionId: a
327
327
  } = s;
328
- let c = () => {
329
- }, d = () => {
328
+ let d = () => {
329
+ }, c = () => {
330
330
  }, b = !1;
331
331
  const i = () => {
332
- b || (b = !0, c(), d());
332
+ b || (b = !0, d(), c());
333
333
  };
334
- return c = t.subscribe(a, {
334
+ return d = t.subscribe(a, {
335
335
  onData: (l) => o({
336
336
  sessionId: a,
337
337
  kind: "data",
@@ -345,14 +345,14 @@ ${t.webview.moduleUrl}`;
345
345
  signal: l.signal
346
346
  }), i();
347
347
  }
348
- }), d = r.onDisconnect(i), {
348
+ }), c = r.onDisconnect(i), {
349
349
  operation: "subscribe",
350
350
  accepted: !0
351
351
  };
352
352
  }
353
353
  }
354
354
  };
355
- }, ot = (e) => {
355
+ }, at = (e) => {
356
356
  if (typeof document > "u") return;
357
357
  const t = new KeyboardEvent("keydown", {
358
358
  ...e,
@@ -360,7 +360,7 @@ ${t.webview.moduleUrl}`;
360
360
  cancelable: !0
361
361
  });
362
362
  document.dispatchEvent(t);
363
- }, we = (e) => ({
363
+ }, ve = (e) => ({
364
364
  "commands.execute": (t) => {
365
365
  const r = t;
366
366
  return e.workbench.commands.executeCommand(r.commandId, r.params);
@@ -391,116 +391,116 @@ ${t.webview.moduleUrl}`;
391
391
  value: r.value
392
392
  };
393
393
  },
394
- "host.dispatchKeyboardEvent": (t) => (e.dispatchKeyboardEvent ?? ot)(t),
394
+ "host.dispatchKeyboardEvent": (t) => (e.dispatchKeyboardEvent ?? at)(t),
395
395
  ...e.hostEvents ? {
396
- "terminal.session": rt({
396
+ "terminal.session": it({
397
397
  terminal: e.workbench.terminal,
398
398
  hostEvents: e.hostEvents
399
399
  })
400
400
  } : {}
401
- }), nt = (e, t) => {
401
+ }), dt = (e, t) => {
402
402
  for (const r of t)
403
403
  console.warn(`[workbench.webview:${e}] ${r.code}/${r.capability}: ${r.message}`);
404
- }, st = (e, t) => {
404
+ }, ct = (e, t) => {
405
405
  console.error(`[workbench.webview:${e}] runtime error: ${t}`);
406
- }, B = "webview:bridge", it = (e) => {
406
+ }, T = "webview:bridge", lt = (e) => {
407
407
  if (typeof e != "object" || e === null || Array.isArray(e)) return !1;
408
408
  const t = e;
409
409
  return typeof t.runtimeUrl == "string" && typeof t.moduleUrl == "string";
410
- }, at = ({
410
+ }, mt = ({
411
411
  placement: e
412
412
  }) => ({
413
413
  placement: e,
414
414
  resource: e.resource
415
- }), ge = () => "light", se = /* @__PURE__ */ new WeakMap(), Ie = (e, t) => {
416
- let r = se.get(e);
417
- r || (r = /* @__PURE__ */ new Map(), se.set(e, r));
418
- const o = t.widgetId;
415
+ }), ke = () => "light", le = /* @__PURE__ */ new WeakMap(), Re = (e, t) => {
416
+ let r = le.get(e);
417
+ r || (r = /* @__PURE__ */ new Map(), le.set(e, r));
418
+ const o = t.instanceId;
419
419
  let n = r.get(o);
420
- return n || (n = et(), r.set(o, n)), n;
421
- }, ye = (e) => {
420
+ return n || (n = nt(), r.set(o, n)), n;
421
+ }, Ce = (e) => {
422
422
  const {
423
423
  context: t,
424
424
  createHostCapabilities: r,
425
425
  createProps: o,
426
- createTheme: n = ge,
426
+ createTheme: n = ke,
427
427
  ownerId: s,
428
428
  title: a,
429
- webview: c
429
+ webview: d
430
430
  } = e;
431
- return /* @__PURE__ */ W(Ze, { view: {
431
+ return /* @__PURE__ */ P(ot, { view: {
432
432
  extensionId: s ?? "workbench",
433
433
  id: t.webviewId,
434
- label: c.title ?? a,
434
+ label: d.title ?? a,
435
435
  webview: {
436
- capabilities: c.capabilities,
437
- moduleUrl: c.moduleUrl,
438
- runtimeUrl: c.runtimeUrl,
439
- styles: c.styles ?? []
436
+ capabilities: d.capabilities,
437
+ moduleUrl: d.moduleUrl,
438
+ runtimeUrl: d.runtimeUrl,
439
+ styles: d.styles ?? []
440
440
  }
441
- }, props: o(t), theme: n(t), capabilities: r(t), hostEvents: t.hostEvents, onDiagnostics: (d) => nt(t.webviewId, d), onError: (d) => st(t.webviewId, d.message) });
442
- }, ct = (e, t, r, o) => {
441
+ }, props: o(t), theme: n(t), capabilities: r(t), hostEvents: t.hostEvents, onDiagnostics: (c) => dt(t.webviewId, c), onError: (c) => ct(t.webviewId, c.message) });
442
+ }, ut = (e, t, r, o) => {
443
443
  const {
444
444
  workbench: n,
445
- widget: s,
446
- placement: a
447
- } = e, c = it(s.config) ? s.config : null;
448
- return c ? ye({
445
+ panel: s,
446
+ instance: a
447
+ } = e, d = lt(s.config) ? s.config : null;
448
+ return d ? Ce({
449
449
  context: {
450
450
  workbench: n,
451
- webviewId: a.contributionId,
451
+ webviewId: a.panelId,
452
452
  placement: a,
453
- hostEvents: Ie(n, a)
453
+ hostEvents: Re(n, a)
454
454
  },
455
455
  createHostCapabilities: t,
456
456
  createProps: r,
457
457
  createTheme: o,
458
- ownerId: s.ownerId,
458
+ ownerId: "ownerId" in s ? s.ownerId : void 0,
459
459
  title: s.title,
460
- webview: c
460
+ webview: d
461
461
  }) : null;
462
- }, dt = (e = {}) => {
463
- const t = e.createHostCapabilities ?? we, r = e.createProps ?? at, o = e.createTheme ?? ge;
462
+ }, bt = (e = {}) => {
463
+ const t = e.createHostCapabilities ?? ve, r = e.createProps ?? mt, o = e.createTheme ?? ke;
464
464
  return {
465
- id: B,
466
- render: (n) => ct(n, t, r, o)
465
+ id: T,
466
+ render: (n) => ut(n, t, r, o)
467
467
  };
468
- }, k = (e, t) => ({
468
+ }, y = (e, t) => ({
469
469
  id: e,
470
470
  kind: t.kind,
471
471
  label: t.label,
472
472
  description: t.description,
473
473
  metadata: t.metadata
474
474
  });
475
- k("project.sidebar", {
476
- kind: "view"
477
- }), k("project.headerPrimary", {
475
+ y("project.sidenav", {
476
+ kind: "panel"
477
+ }), y("project.headerPrimary", {
478
478
  kind: "menu"
479
- }), k("project.headerOverflow", {
479
+ }), y("project.headerOverflow", {
480
480
  kind: "menu"
481
- }), k("project.settingsPanels", {
481
+ }), y("project.settingsPanels", {
482
482
  kind: "settings"
483
483
  });
484
- k("session.headerPrimary", {
484
+ y("session.headerPrimary", {
485
485
  kind: "menu"
486
- }), k("session.headerOverflow", {
486
+ }), y("session.headerOverflow", {
487
487
  kind: "menu"
488
- }), k("session.transcriptActions", {
488
+ }), y("session.transcriptActions", {
489
489
  kind: "menu"
490
490
  });
491
- k("workspace.headerPrimary", {
491
+ y("workspace.headerPrimary", {
492
492
  kind: "menu"
493
- }), k("workspace.headerOverflow", {
493
+ }), y("workspace.headerOverflow", {
494
494
  kind: "menu"
495
- }), k("workspace.sidebar", {
496
- kind: "view"
495
+ }), y("workspace.sidenav", {
496
+ kind: "panel"
497
497
  });
498
- const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e.$l10n == "string", u = (e, t = "") => e === void 0 ? t : lt(e) ? e.default ?? e.$l10n : e, D = (e) => {
498
+ const ft = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e.$l10n == "string", m = (e, t = "") => e === void 0 ? t : ft(e) ? e.default ?? e.$l10n : e, L = (e) => {
499
499
  const t = e;
500
500
  if (!t?.outcome) return e;
501
501
  if (t.outcome.status === "success") return t.outcome.value;
502
502
  throw new Error(t.outcome.reason ?? t.outcome.error?.message ?? "Extension command failed.");
503
- }, z = (e) => {
503
+ }, J = (e) => {
504
504
  if (e)
505
505
  return {
506
506
  type: e.kind,
@@ -508,21 +508,21 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
508
508
  label: e.label,
509
509
  metadata: e.metadata
510
510
  };
511
- }, q = (e) => ({
511
+ }, O = (e) => ({
512
512
  kind: e.type,
513
513
  uri: `pstdio://extension-resource/${encodeURIComponent(e.type)}/${encodeURIComponent(e.id)}`,
514
514
  id: e.id,
515
515
  label: e.label,
516
516
  metadata: e.metadata
517
- }), $ = (e) => ({
517
+ }), S = (e) => ({
518
518
  id: e.id,
519
519
  kind: e.kind,
520
520
  context: {
521
521
  projectId: e.projectId,
522
522
  ...e.context ?? {}
523
523
  }
524
- }), R = async (e, t, r = {}) => {
525
- const o = z(r.resource), n = await e.executeCommand(t, {
524
+ }), k = async (e, t, r = {}) => {
525
+ const o = J(r.resource), n = await e.executeCommand(t, {
526
526
  projectId: e.projectId,
527
527
  ...r.params ? {
528
528
  params: r.params
@@ -538,31 +538,31 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
538
538
  metadata: r.metadata
539
539
  } : {}
540
540
  });
541
- return D(n);
542
- }, mt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ut = (e) => typeof e == "string" ? e : e?.id, ft = async (e, t) => {
541
+ return L(n);
542
+ }, pt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ht = (e) => typeof e == "string" ? e : e?.id, wt = async (e, t) => {
543
543
  if (t.kind === "resource" && t.resource) {
544
- await e.workbench.resources.openResource(q(t.resource), {
544
+ await e.workbench.resources.openResource(O(t.resource), {
545
545
  replaceActive: !0
546
546
  }).catch(() => {
547
547
  });
548
548
  return;
549
549
  }
550
- const r = ut(t.command);
551
- r && (await R(e, r, {
550
+ const r = ht(t.command);
551
+ r && (await k(e, r, {
552
552
  params: t.params
553
553
  }), e.workbench.commandPaletteResources.refresh());
554
- }, bt = (e, t, r, o) => ({
554
+ }, gt = (e, t, r, o) => ({
555
555
  id: `${t.id}:${o.id}`,
556
556
  label: o.label,
557
557
  description: o.description,
558
558
  icon: o.icon,
559
559
  keywords: o.keywords,
560
560
  group: r,
561
- activate: () => ft(e, o.target)
562
- }), ht = (e, t) => {
561
+ activate: () => wt(e, o.target)
562
+ }), It = (e, t) => {
563
563
  const r = [];
564
564
  for (const o of t) {
565
- const n = u(o.title, o.id);
565
+ const n = m(o.title, o.id);
566
566
  r.push(e.workbench.commandPaletteResources.registerProvider({
567
567
  id: o.id,
568
568
  title: n,
@@ -571,17 +571,17 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
571
571
  query: s,
572
572
  limit: a
573
573
  }) => {
574
- const c = e.workbench.getActiveResource(), d = await R(e, o.queryCommandId, {
574
+ const d = e.workbench.getActiveResource(), c = await k(e, o.queryCommandId, {
575
575
  params: {
576
576
  projectId: e.projectId,
577
577
  modeId: e.workbench.modes.getActiveModeId(),
578
- activeResource: z(c),
578
+ activeResource: J(d),
579
579
  providerId: o.id,
580
580
  query: s,
581
581
  limit: a
582
582
  }
583
583
  });
584
- return mt(d) ? (d.items ?? []).map((b) => bt(e, o, n, b)) : [];
584
+ return pt(c) ? (c.items ?? []).map((b) => gt(e, o, n, b)) : [];
585
585
  }
586
586
  }));
587
587
  }
@@ -590,46 +590,49 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
590
590
  for (let o = r.length - 1; o >= 0; o -= 1) r[o]?.dispose();
591
591
  }
592
592
  };
593
- }, pt = {
594
- "workbench.main": "main",
595
- "workbench.main.left": "main-left",
596
- "workbench.main.right": "main-right",
597
- "workbench.secondary": "secondary"
598
- }, wt = {
599
- "workbench.left.tree": "left",
600
- "workbench.main.left.tree": "main-left",
601
- "workbench.main.right.tree": "main-right"
602
- }, gt = {
603
- "workbench.left": "left",
604
- "workbench.main.left": "main-left",
605
- "workbench.main": "main",
606
- "workbench.main.right": "main-right",
607
- "workbench.secondary": "secondary"
608
- }, H = (e) => e ? pt[e] ?? "main" : "main", It = (e) => e ? wt[e] ?? "left" : "left", ke = (e) => e ? gt[e] ?? "main" : "main", O = (e, t = "") => u(e, t), yt = (e) => !!e && typeof e == "object" && !Array.isArray(e), kt = (e, t, r) => {
609
- const o = (n, s, a) => n ? R(e, n, {
593
+ }, N = (e) => ({
594
+ title: m(e.title),
595
+ runtimeUrl: e.runtimeUrl,
596
+ moduleUrl: e.moduleUrl,
597
+ styles: e.styles,
598
+ capabilities: e.capabilities
599
+ }), W = (e) => e ? {
600
+ resourceKinds: e.resourceKinds ? [...e.resourceKinds] : void 0
601
+ } : void 0, yt = (e) => {
602
+ const t = e.treeRendererId ?? e.fileRendererId ?? e.controlsRendererId ?? e.dataTableRendererId ?? (e.webview ? T : void 0);
603
+ if (!t) throw new Error(`Panel Menu has no renderer: ${e.id}`);
604
+ return t;
605
+ }, j = (e) => e?.map((t) => ({
606
+ id: t.id,
607
+ title: m(t.title, t.id),
608
+ side: t.side,
609
+ rendererId: yt(t),
610
+ config: t.webview ? N(t.webview) : void 0
611
+ })), K = (e) => e.workbench.layout.registerPanel(e.contribution), q = (e, t = "") => m(e, t), vt = (e) => !!e && typeof e == "object" && !Array.isArray(e), kt = (e, t, r) => {
612
+ const o = (n, s, a) => n ? k(e, n, {
610
613
  params: s,
611
614
  resource: a
612
615
  }) : Promise.resolve(void 0);
613
616
  return e.workbench.renderers.registerControlsRenderer({
614
617
  id: t.id,
615
- title: O(t.title, t.id),
616
- emptyTitle: O(t.emptyTitle, ""),
617
- emptyDescription: O(t.emptyDescription, ""),
618
+ title: q(t.title, t.id),
619
+ emptyTitle: q(t.emptyTitle, ""),
620
+ emptyDescription: q(t.emptyDescription, ""),
618
621
  defaultValues: t.defaultValues,
619
622
  executeQuery: async (n) => {
620
623
  const s = await o(t.queryCommandId, {}, n ?? r.resolveResource?.(t));
621
- return yt(s) ? s : {};
624
+ return vt(s) ? s : {};
622
625
  },
623
626
  updateValue: t.updateValueCommandId ? ({
624
627
  controlId: n,
625
628
  value: s,
626
629
  values: a,
627
- resource: c
630
+ resource: d
628
631
  }) => o(t.updateValueCommandId, {
629
632
  controlId: n,
630
633
  value: s,
631
634
  values: a
632
- }, c).then(() => {
635
+ }, d).then(() => {
633
636
  }) : void 0,
634
637
  apply: t.applyCommandId ? ({
635
638
  values: n,
@@ -646,21 +649,27 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
646
649
  }, s).then(() => {
647
650
  }) : void 0
648
651
  });
649
- }, vt = (e, t) => {
652
+ }, Rt = (e, t) => {
650
653
  if (t.controlsRendererId)
651
- return e.workbench.layout.registerWidget({
652
- id: t.id,
653
- title: u(t.title, t.id),
654
- area: t.surface === "modal" ? "overlay" : H(t.target),
655
- rendererId: t.controlsRendererId,
656
- singleton: !0,
657
- resourceKinds: t.resourceKind ? [t.resourceKind] : void 0
654
+ return K({
655
+ workbench: e.workbench,
656
+ contribution: {
657
+ id: t.id,
658
+ title: m(t.title, t.id),
659
+ region: t.region,
660
+ closable: t.closable,
661
+ rendererId: t.controlsRendererId,
662
+ singleton: !0,
663
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
664
+ eligibleLocations: W(t.eligibleLocations),
665
+ panelMenus: j(t.panelMenus)
666
+ }
658
667
  });
659
- }, Nr = (e, t, r, o = {}) => {
668
+ }, oo = (e, t, r, o = {}) => {
660
669
  const n = [];
661
670
  for (const s of t) n.push(kt(e, s, o));
662
671
  for (const s of r) {
663
- const a = vt(e, s);
672
+ const a = Rt(e, s);
664
673
  a && n.push(a);
665
674
  }
666
675
  return {
@@ -668,202 +677,111 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
668
677
  for (let s = n.length - 1; s >= 0; s -= 1) n[s]?.dispose();
669
678
  }
670
679
  };
671
- }, Rt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), ie = (e, t, r, o) => (t ?? []).map((n) => {
672
- const s = {
673
- ...n,
674
- label: r(n.label, n.id),
675
- type: n.type.kind === "enum" || n.type.kind === "enum-multi" ? {
676
- ...n.type,
677
- options: Array.isArray(n.type.options) ? n.type.options.map((a) => ({
678
- ...a,
679
- label: r(a.label, a.value)
680
- })) : n.type.options
681
- } : n.type
682
- };
683
- return o(e, s);
684
- }), Ct = (e, t, r, o) => {
685
- let n = ie(e, t, r, o);
686
- const s = /* @__PURE__ */ new Set();
687
- return {
688
- source: {
689
- getSnapshot: () => n,
690
- subscribe: (a) => (s.add(a), () => s.delete(a))
691
- },
692
- set(a) {
693
- n = ie(e, a, r, o);
694
- for (const c of s) c();
680
+ }, E = (e, t = "") => m(e, t), me = (e) => ({
681
+ ...e,
682
+ label: E(e.label, e.id),
683
+ description: e.description ? E(e.description) : void 0,
684
+ icon: e.icon ? V(F, {
685
+ name: e.icon,
686
+ size: 14
687
+ }) : void 0
688
+ }), Ct = (e) => !!(e && typeof e == "object" && Array.isArray(e.rows)), Et = (e) => ({
689
+ id: e.id,
690
+ values: e.values,
691
+ resource: e.resource ? O(e.resource) : void 0
692
+ }), xt = (e, t) => {
693
+ const r = S({
694
+ id: t.id,
695
+ kind: "dataTableRenderer",
696
+ projectId: e.projectId,
697
+ context: {
698
+ dataTableRendererId: t.id
699
+ }
700
+ }), o = (n, s, a) => k(e, n, {
701
+ params: s,
702
+ resource: a,
703
+ slot: r,
704
+ metadata: {
705
+ dataTableRendererId: t.id
695
706
  }
696
- };
697
- }, Et = (e) => !!(e && typeof e == "object" && typeof e.kind == "string"), xt = (e) => !!(e && typeof e == "object" && typeof e.type == "string" && typeof e.id == "string"), At = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, ve = (e, t) => {
698
- const {
699
- resource: r
700
- } = t;
701
- if (Et(r)) return r;
702
- if (xt(r)) return q(r);
703
- }, Wt = (e, t) => {
704
- const r = ve(e, t);
705
- if (r) return r;
706
- if (e.resourceKind)
707
- return {
708
- kind: e.resourceKind,
709
- uri: At(e.resourceKind, t.id),
710
- id: t.id,
711
- label: t.title
712
- };
713
- }, ae = (e, t) => {
714
- const r = e, o = t(r);
715
- return o === void 0 ? r : {
716
- ...r,
717
- resource: o
718
- };
719
- }, St = (...e) => Object.assign({}, ...e.filter((t) => !!t)), Pt = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Tt = (e) => Object.keys(e ?? {}).length > 0, jt = (e) => (r) => fe(be, {
720
- name: e ?? "MoreHorizontal",
721
- ...r
722
- }), Kt = (e, t) => ({
723
- color: e?.color,
724
- canDragIn: e?.canDragIn,
725
- canDragOut: e?.canDragOut,
726
- canCreate: e?.canCreate,
727
- actions: e?.actions?.map((r) => ({
728
- id: r.id,
729
- label: t(r.label, r.id),
730
- icon: jt(r.icon)
731
- }))
732
- }), Bt = (e) => e ? fe(be, {
733
- name: e,
734
- size: 16
735
- }) : void 0, Dt = (e, t) => $({
736
- id: t.id,
737
- kind: "dataRenderer",
738
- projectId: e.projectId,
739
- context: {
740
- dataRendererId: t.id
741
- }
742
- }), K = (e, t, r, o, n) => R(e, r, {
743
- params: o,
744
- resource: n ?? e.workbench.getPrimaryResource(),
745
- slot: Dt(e, t),
746
- metadata: {
747
- dataRendererId: t.id
748
- }
749
- }), Re = (e, t) => `workbench.extension.dataRenderer.${e.id}.rowAction.${t.id}`, $t = (e, t, r) => (t.rowActions ?? []).map((o) => {
750
- const n = e.workbench.commands.getCommand(o.commandId)?.command;
751
- return e.workbench.commands.registerCommand({
752
- id: Re(t, o),
753
- label: r(o.label, o.id),
754
- icon: o.icon,
755
- params: n?.params
756
- }, {
757
- execute: (s, a) => K(e, t, o.commandId, St(Pt(s)), a?.resource)
758
- });
759
- }), Ht = (e, t, r, o, n, s) => {
760
- const a = Re(t, r), c = e.workbench.commands.getCommand(a), d = {
761
- rowId: o.id
762
- }, b = n ? {
763
- resource: n
764
- } : void 0, i = s(r.label, r.id);
765
- return c && Tt(c.command.params) ? (e.workbench.commandPalette.requestParams({
766
- record: c,
767
- label: i,
768
- args: d,
769
- context: b
770
- }), Promise.resolve()) : c ? e.workbench.commands.executeCommand(c.command.id, d, b).then(() => {
771
- }) : K(e, t, r.commandId, d, n).then(() => {
772
707
  });
773
- }, Mt = (e, t, r = {}) => {
774
- const o = [], n = r.resolveLabel ?? ((i, l) => u(i, l)), s = r.decorateAttribute ?? ((i, l) => l), a = r.resolveRowResource ?? ve, c = r.resolveRowActionResource ?? Wt, d = r.onAfterMutation ?? (() => {
775
- }), b = (i, l, m) => K(e, i, l, m).then((p) => (d(i), p));
776
- for (const i of t) {
777
- const l = Ct(i, i.attributes, n, s);
778
- let m;
779
- const p = (f) => a(i, f);
780
- o.push(...$t(e, i, n)), o.push(e.workbench.renderers.registerDataRenderer({
781
- id: i.id,
782
- title: n(i.title, i.id),
783
- resourceKind: i.resourceKind,
784
- attributes: l.source,
785
- defaultSettings: i.defaultSettings,
786
- defaultFilters: i.defaultFilters,
787
- emptyTitle: n(i.emptyTitle, ""),
788
- emptyDescription: n(i.emptyDescription, ""),
789
- hideToolbar: i.hideToolbar,
790
- getBoardColumnConfig: (f) => Kt(m?.[f], n),
791
- onRowClick: r.onRowClick ? (f) => r.onRowClick({
792
- record: i,
793
- row: f,
794
- resource: a(i, f)
795
- }) : void 0,
796
- executeQuery: async (f) => {
797
- const h = await K(e, i, i.queryCommandId, {
798
- settings: f.settings,
799
- filters: f.filters
800
- });
801
- return Array.isArray(h) ? h.map((g) => ae(g, p)) : Rt(h) ? (l.set(h.attributes), m = h.boardColumnConfigs, (h.rows ?? []).map((g) => ae(g, p))) : [];
802
- },
803
- onAttributeChange: i.updateAttributeCommandId ? (f, h, g) => b(i, i.updateAttributeCommandId, {
804
- rowId: f,
805
- attributeId: h,
806
- value: g
807
- }).then(() => {
808
- }) : void 0,
809
- onReorder: i.reorderCommandId ? (f, h) => b(i, i.reorderCommandId, {
810
- rowId: f,
811
- beforeRowId: h
812
- }).then(() => {
708
+ return e.workbench.renderers.registerDataTableRenderer({
709
+ id: t.id,
710
+ title: E(t.title, t.id),
711
+ resourceKind: t.resourceKind,
712
+ columns: t.columns?.map(me),
713
+ initialPageSize: t.initialPageSize,
714
+ pageSizeOptions: t.pageSizeOptions,
715
+ emptyTitle: t.emptyTitle ? E(t.emptyTitle) : void 0,
716
+ emptyDescription: t.emptyDescription ? E(t.emptyDescription) : void 0,
717
+ executeQuery: async ({
718
+ resource: n,
719
+ modeId: s
720
+ }) => {
721
+ const a = await o(t.queryCommandId, {
722
+ rendererId: t.id,
723
+ projectId: e.projectId,
724
+ modeId: s,
725
+ resource: n ? {
726
+ type: n.kind,
727
+ id: n.id ?? n.uri,
728
+ label: n.label,
729
+ metadata: n.metadata
730
+ } : void 0
731
+ }, n);
732
+ return Ct(a) ? {
733
+ rows: a.rows.map(Et),
734
+ columns: a.columns?.map(me)
735
+ } : {
736
+ rows: []
737
+ };
738
+ },
739
+ rowActions: t.rowActions?.map((n) => ({
740
+ id: n.id,
741
+ label: E(n.label, n.id),
742
+ icon: n.icon ? V(F, {
743
+ name: n.icon,
744
+ size: 16
813
745
  }) : void 0,
814
- onCreateRow: i.createRow ? (f) => {
815
- const h = i.createRow?.columnParam ? {
816
- [i.createRow.columnParam]: f
817
- } : {}, g = () => b(i, i.createRow.commandId, h).then((v) => (r.onAfterCreate?.({
818
- record: i,
819
- created: v
820
- }), v));
821
- r.onCreateRow ? r.onCreateRow({
822
- record: i,
823
- columnId: f,
824
- executeDefault: g
825
- }) : g();
826
- } : void 0,
827
- onColumnAction: i.columnActionCommandId ? async (f, h) => {
828
- await b(i, i.columnActionCommandId, {
829
- columnId: f,
830
- actionId: h
831
- });
832
- } : void 0,
833
- getRowContextMenuActions: i.rowActions?.length ? (f) => i.rowActions.map((h) => {
834
- const g = c(i, f), v = () => Ht(e, i, h, f, g, n);
835
- return {
836
- key: h.id,
837
- label: n(h.label, h.id),
838
- icon: Bt(h.icon),
839
- onClick: () => r.executeRowAction ? r.executeRowAction({
840
- record: i,
841
- action: h,
842
- row: f,
843
- resource: g,
844
- runDefault: v
845
- }) : v()
846
- };
847
- }) : void 0
848
- })), o.push(e.workbench.layout.registerWidget({
849
- id: i.id,
850
- title: n(i.title, i.id),
851
- area: "main",
852
- rendererId: i.id,
853
- singleton: !0,
854
- resourceKinds: i.resourceKind ? [i.resourceKind] : void 0
855
- }));
746
+ destructive: n.destructive,
747
+ run: (s) => o(n.commandId, {
748
+ rowId: s.id
749
+ }, s.resource).then(() => {
750
+ })
751
+ }))
752
+ });
753
+ }, At = (e, t) => {
754
+ if (t.dataTableRendererId)
755
+ return K({
756
+ workbench: e.workbench,
757
+ contribution: {
758
+ id: t.id,
759
+ title: m(t.title, t.id),
760
+ region: t.region,
761
+ closable: t.closable,
762
+ rendererId: t.dataTableRendererId,
763
+ singleton: !0,
764
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
765
+ eligibleLocations: W(t.eligibleLocations),
766
+ panelMenus: j(t.panelMenus)
767
+ }
768
+ });
769
+ }, Pt = (e, t, r) => {
770
+ const o = t.map((n) => xt(e, n));
771
+ for (const n of r) {
772
+ const s = At(e, n);
773
+ s && o.push(s);
856
774
  }
857
775
  return {
858
776
  dispose() {
859
- for (let i = o.length - 1; i >= 0; i -= 1) o[i]?.dispose();
777
+ for (let n = o.length - 1; n >= 0; n -= 1) o[n]?.dispose();
860
778
  }
861
779
  };
862
- }, Vt = {
780
+ }, Tt = {
863
781
  first: 0,
864
782
  default: 1,
865
783
  last: 2
866
- }, Ur = {
784
+ }, no = {
867
785
  commands: [],
868
786
  commandPaletteContributions: [],
869
787
  diagnostics: [],
@@ -872,14 +790,15 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
872
790
  modes: [],
873
791
  navigation: [],
874
792
  routes: [],
875
- dataRenderers: [],
793
+ kanbanRenderers: [],
794
+ dataTableRenderers: [],
876
795
  treeRenderers: [],
877
796
  fileRenderers: [],
878
797
  settingsPanels: [],
879
798
  settingsDefinitions: [],
880
799
  treeItems: [],
881
- views: []
882
- }, Ot = (e) => `workbench.extension.menu.${e.id}`, Nt = (e) => `workbench.extension.palette.${e.id}`, Ce = (e, t) => Vt[e.placement ?? "default"] * 1e3 + t, Ee = (e) => e === void 0 ? "" : $e(e) ? e.default ?? e.$l10n : e, Ut = (e) => {
800
+ panels: []
801
+ }, St = (e) => `workbench.extension.menu.${e.id}`, Wt = (e) => `workbench.extension.palette.${e.id}`, Ee = (e, t) => Tt[e.placement ?? "default"] * 1e3 + t, xe = (e) => e === void 0 ? "" : Fe(e) ? e.default ?? e.$l10n : e, jt = (e) => {
883
802
  const {
884
803
  commandId: t,
885
804
  contribution: r,
@@ -890,14 +809,15 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
890
809
  } = e;
891
810
  return {
892
811
  commandId: t,
812
+ sourceCommandId: r.commandId,
893
813
  label: n(r.label, r.extensionId),
894
814
  icon: r.icon,
895
815
  group: s.group ?? r.group,
896
816
  overflowLabel: s.overflowLabel,
897
- order: Ce(r, o),
817
+ order: Ee(r, o),
898
818
  when: a
899
819
  };
900
- }, Ft = (e) => {
820
+ }, Kt = (e) => {
901
821
  const {
902
822
  commandId: t,
903
823
  contribution: r,
@@ -909,63 +829,63 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
909
829
  label: n(r.label, r.extensionId),
910
830
  icon: r.icon,
911
831
  group: r.group,
912
- order: Ce(r, o)
832
+ order: Ee(r, o)
913
833
  };
914
- }, _t = (e) => {
834
+ }, Mt = (e) => {
915
835
  const {
916
- createCommandId: t = Ot,
836
+ createCommandId: t = St,
917
837
  createWhenExpression: r,
918
838
  menuSlotsById: o,
919
839
  menuTargetsById: n,
920
840
  metadata: s,
921
- resolveString: a = Ee
922
- } = e, c = [];
923
- return s.menuContributions.forEach((d, b) => {
924
- const i = d.target ? n?.get(d.target) : o.get(d.slotId);
841
+ resolveString: a = xe
842
+ } = e, d = [];
843
+ return s.menuContributions.forEach((c, b) => {
844
+ const i = c.target ? n?.get(c.target) : o.get(c.slotId);
925
845
  if (!i) return;
926
- const l = t(d), m = s.commands.find((p) => p.id === d.commandId);
927
- c.push({
846
+ const l = t(c), u = s.commands.find((f) => f.id === c.commandId);
847
+ d.push({
928
848
  command: {
929
849
  id: l,
930
- label: a(d.label, d.extensionId),
931
- category: d.group,
932
- description: m ? a(m.description, m.extensionId) : void 0,
933
- icon: d.icon,
934
- params: m?.params
850
+ label: a(c.label, c.extensionId),
851
+ category: c.group,
852
+ description: u ? a(u.description, u.extensionId) : void 0,
853
+ icon: c.icon,
854
+ params: u?.params
935
855
  },
936
- contribution: d,
937
- menuItem: Ut({
856
+ contribution: c,
857
+ menuItem: jt({
938
858
  commandId: l,
939
- contribution: d,
859
+ contribution: c,
940
860
  index: b,
941
861
  resolveString: a,
942
862
  slot: i,
943
- when: r?.(d)
863
+ when: r?.(c)
944
864
  }),
945
865
  menuPath: i.menuPath,
946
- targetCommandId: d.commandId
866
+ targetCommandId: c.commandId
947
867
  });
948
- }), c;
949
- }, Lt = (e) => {
868
+ }), d;
869
+ }, $t = (e) => {
950
870
  const {
951
- createCommandId: t = Nt,
871
+ createCommandId: t = Wt,
952
872
  metadata: r,
953
- resolveString: o = Ee
873
+ resolveString: o = xe
954
874
  } = e, n = [];
955
875
  return (r.commandPaletteContributions ?? []).forEach((s, a) => {
956
- const c = t(s), d = r.commands.find((b) => b.id === s.commandId);
876
+ const d = t(s), c = r.commands.find((b) => b.id === s.commandId);
957
877
  n.push({
958
878
  command: {
959
- id: c,
879
+ id: d,
960
880
  label: o(s.label, s.extensionId),
961
881
  category: s.group,
962
- description: d ? o(d.description, d.extensionId) : void 0,
882
+ description: c ? o(c.description, c.extensionId) : void 0,
963
883
  icon: s.icon,
964
- params: d?.params
884
+ params: c?.params
965
885
  },
966
886
  contribution: s,
967
- menuItem: Ft({
968
- commandId: c,
887
+ menuItem: Kt({
888
+ commandId: d,
969
889
  contribution: s,
970
890
  index: a,
971
891
  resolveString: o
@@ -973,7 +893,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
973
893
  targetCommandId: s.commandId
974
894
  });
975
895
  }), n;
976
- }, Fr = (e) => {
896
+ }, so = (e) => {
977
897
  const {
978
898
  createResource: t,
979
899
  metadata: r
@@ -983,7 +903,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
983
903
  route: o
984
904
  })
985
905
  })) : [];
986
- }, zt = (e) => {
906
+ }, Bt = (e) => {
987
907
  if (e)
988
908
  return {
989
909
  type: e.kind,
@@ -991,7 +911,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
991
911
  label: e.label,
992
912
  metadata: e.metadata
993
913
  };
994
- }, qt = (e) => ({
914
+ }, Dt = (e) => ({
995
915
  id: e.rendererId,
996
916
  kind: "renderer",
997
917
  context: {
@@ -1001,8 +921,8 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1001
921
  resourceId: e.resource.id
1002
922
  } : {}
1003
923
  }
1004
- }), ce = async (e, t, r, o, n = {}) => {
1005
- const s = zt(o), a = await e.executeCommand(r, {
924
+ }), ue = async (e, t, r, o, n = {}) => {
925
+ const s = Bt(o), a = await e.executeCommand(r, {
1006
926
  projectId: e.projectId,
1007
927
  params: {
1008
928
  projectId: e.projectId,
@@ -1010,40 +930,46 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1010
930
  ...n
1011
931
  },
1012
932
  resource: s,
1013
- slot: qt({
933
+ slot: Dt({
1014
934
  projectId: e.projectId,
1015
935
  rendererId: t,
1016
936
  resource: s
1017
937
  }),
1018
938
  source: "dashboard"
1019
939
  });
1020
- return D(a);
1021
- }, Qt = (e, t) => e.workbench.renderers.registerFileRenderer({
940
+ return L(a);
941
+ }, Ht = (e, t) => e.workbench.renderers.registerFileRenderer({
1022
942
  id: t.id,
1023
- title: u(t.title, t.id),
943
+ title: m(t.title, t.id),
1024
944
  resourceKind: t.resourceKind,
1025
- load: async (r) => await ce(e, t.id, t.loadCommandId, r) ?? {},
945
+ load: async (r) => await ue(e, t.id, t.loadCommandId, r) ?? {},
1026
946
  save: t.saveCommandId ? async (r, o) => {
1027
- await ce(e, t.id, t.saveCommandId, r, {
947
+ await ue(e, t.id, t.saveCommandId, r, {
1028
948
  content: o
1029
949
  });
1030
950
  } : void 0
1031
- }), Gt = (e, t) => {
951
+ }), Vt = (e, t) => {
1032
952
  if (t.fileRendererId)
1033
- return e.workbench.layout.registerWidget({
1034
- id: t.id,
1035
- title: u(t.title, t.id),
1036
- area: t.surface === "modal" ? "overlay" : H(t.target),
1037
- rendererId: t.fileRendererId,
1038
- singleton: !0,
1039
- resourceKinds: t.resourceKind ? [t.resourceKind] : void 0
953
+ return K({
954
+ workbench: e.workbench,
955
+ contribution: {
956
+ id: t.id,
957
+ title: m(t.title, t.id),
958
+ region: t.region,
959
+ closable: t.closable,
960
+ rendererId: t.fileRendererId,
961
+ singleton: !0,
962
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
963
+ eligibleLocations: W(t.eligibleLocations),
964
+ panelMenus: j(t.panelMenus)
965
+ }
1040
966
  });
1041
- }, Xt = (e) => {
967
+ }, Ft = (e) => {
1042
968
  const t = [];
1043
969
  for (const r of e.metadata.fileRenderers ?? [])
1044
- t.push(Qt(e, r));
1045
- for (const r of e.metadata.views) {
1046
- const o = Gt(e, r);
970
+ t.push(Ht(e, r));
971
+ for (const r of e.metadata.panels) {
972
+ const o = Vt(e, r);
1047
973
  o && t.push(o);
1048
974
  }
1049
975
  return {
@@ -1051,42 +977,298 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1051
977
  for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1052
978
  }
1053
979
  };
1054
- }, Yt = (e, t) => e.views.filter((r) => r.treeRendererId === t.id), xe = (e, t) => t.viewId ? e.find((r) => r.id === t.viewId) : e.length === 1 ? e[0] : void 0, Jt = async (e) => {
980
+ }, Lt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), be = (e, t, r, o) => (t ?? []).map((n) => {
981
+ const s = {
982
+ ...n,
983
+ label: r(n.label, n.id),
984
+ type: n.type.kind === "enum" || n.type.kind === "enum-multi" ? {
985
+ ...n.type,
986
+ options: Array.isArray(n.type.options) ? n.type.options.map((a) => ({
987
+ ...a,
988
+ label: r(a.label, a.value)
989
+ })) : n.type.options
990
+ } : n.type
991
+ };
992
+ return o(e, s);
993
+ }), Ot = (e, t, r, o) => {
994
+ let n = be(e, t, r, o);
995
+ const s = /* @__PURE__ */ new Set();
996
+ return {
997
+ source: {
998
+ getSnapshot: () => n,
999
+ subscribe: (a) => (s.add(a), () => s.delete(a))
1000
+ },
1001
+ set(a) {
1002
+ n = be(e, a, r, o);
1003
+ for (const d of s) d();
1004
+ }
1005
+ };
1006
+ }, Nt = (e) => !!(e && typeof e == "object" && typeof e.kind == "string"), Ut = (e) => !!(e && typeof e == "object" && typeof e.type == "string" && typeof e.id == "string"), _t = (e, t) => `pstdio://extension-resource/${encodeURIComponent(e)}/${encodeURIComponent(t)}`, Ae = (e, t) => {
1007
+ const {
1008
+ resource: r
1009
+ } = t;
1010
+ if (Nt(r)) return r;
1011
+ if (Ut(r)) return O(r);
1012
+ }, qt = (e, t) => {
1013
+ const r = Ae(e, t);
1014
+ if (r) return r;
1015
+ if (e.resourceKind)
1016
+ return {
1017
+ kind: e.resourceKind,
1018
+ uri: _t(e.resourceKind, t.id),
1019
+ id: t.id,
1020
+ label: t.title
1021
+ };
1022
+ }, fe = (e, t) => {
1023
+ const r = e, o = t(r);
1024
+ return o === void 0 ? r : {
1025
+ ...r,
1026
+ resource: o
1027
+ };
1028
+ }, Pe = (...e) => Object.assign({}, ...e.filter((t) => !!t)), zt = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Qt = (e) => Object.keys(e ?? {}).length > 0, Gt = /* @__PURE__ */ new Set(["text", "longtext", "markdown", "number", "boolean", "select", "multi-select", "files"]), Yt = (e, t, r) => {
1029
+ if (!Gt.has(t.type)) return;
1030
+ const o = "options" in t && Array.isArray(t.options) ? t.options : [], n = t;
1031
+ return {
1032
+ id: e,
1033
+ label: r(t.label, e),
1034
+ description: t.description === void 0 ? void 0 : r(t.description),
1035
+ placeholder: n.placeholder === void 0 ? void 0 : r(n.placeholder),
1036
+ type: t.type,
1037
+ required: t.required === !0,
1038
+ defaultValue: t.defaultValue,
1039
+ options: t.type === "select" || t.type === "multi-select" ? o.map((s) => ({
1040
+ value: s.value,
1041
+ label: r(s.label, s.value),
1042
+ icon: s.icon
1043
+ })) : void 0,
1044
+ multiple: t.type === "files" ? n.multiple !== !1 : void 0,
1045
+ accept: t.type === "files" && typeof n.accept == "string" ? n.accept : void 0
1046
+ };
1047
+ }, Xt = (e, t) => Object.entries(e.createRow?.params ?? {}).flatMap(([r, o]) => {
1048
+ const n = Yt(r, o, t);
1049
+ return n ? [n] : [];
1050
+ }), Jt = (e, t) => S({
1051
+ id: t.id,
1052
+ kind: "kanbanRenderer",
1053
+ projectId: e.projectId,
1054
+ context: {
1055
+ kanbanRendererId: t.id
1056
+ }
1057
+ }), H = (e, t, r, o, n) => k(e, r, {
1058
+ params: o,
1059
+ resource: n ?? e.workbench.getPrimaryResource(),
1060
+ slot: Jt(e, t),
1061
+ metadata: {
1062
+ kanbanRendererId: t.id
1063
+ }
1064
+ }), Te = (e, t) => `workbench.extension.kanbanRenderer.${e.id}.rowAction.${t.id}`, Zt = (e, t, r) => (t.rowActions ?? []).map((o) => {
1065
+ const n = e.workbench.commands.getCommand(o.commandId)?.command;
1066
+ return e.workbench.commands.registerCommand({
1067
+ id: Te(t, o),
1068
+ label: r(o.label, o.id),
1069
+ icon: o.icon,
1070
+ params: n?.params
1071
+ }, {
1072
+ execute: (s, a) => H(e, t, o.commandId, Pe(zt(s)), a?.resource)
1073
+ });
1074
+ }), er = (e, t, r, o, n, s) => {
1075
+ const a = Te(t, r), d = e.workbench.commands.getCommand(a), c = {
1076
+ rowId: o.id
1077
+ }, b = n ? {
1078
+ resource: n
1079
+ } : void 0, i = s(r.label, r.id);
1080
+ return d && Qt(d.command.params) ? (e.workbench.commandPalette.requestParams({
1081
+ record: d,
1082
+ label: i,
1083
+ args: c,
1084
+ context: b
1085
+ }), Promise.resolve()) : d ? e.workbench.commands.executeCommand(d.command.id, c, b).then(() => {
1086
+ }) : H(e, t, r.commandId, c, n).then(() => {
1087
+ });
1088
+ }, tr = (e) => (r) => V(F, {
1089
+ name: e ?? "MoreHorizontal",
1090
+ ...r
1091
+ }), rr = (e, t) => ({
1092
+ color: e?.color,
1093
+ canDragIn: e?.canDragIn,
1094
+ canDragOut: e?.canDragOut,
1095
+ canCreate: e?.canCreate,
1096
+ actions: e?.actions?.map((r) => ({
1097
+ id: r.id,
1098
+ label: t(r.label, r.id),
1099
+ icon: tr(r.icon)
1100
+ }))
1101
+ }), or = (e) => e ? V(F, {
1102
+ name: e,
1103
+ size: 16
1104
+ }) : void 0, nr = (e, t) => {
1105
+ if (e.createRow)
1106
+ return {
1107
+ title: t(e.createRow.title, "Create row"),
1108
+ submitLabel: t(e.createRow.submitLabel, "Create"),
1109
+ fields: Xt(e, t),
1110
+ labels: {
1111
+ cancel: t(e.createRow.labels?.cancel, "Cancel"),
1112
+ properties: t(e.createRow.labels?.properties, "Properties"),
1113
+ submitError: t(e.createRow.labels?.submitError, "Could not create resource."),
1114
+ removeFile: t(e.createRow.labels?.removeFile, "Remove file")
1115
+ }
1116
+ };
1117
+ }, sr = (e, t, r) => {
1118
+ if (t.onRowClick)
1119
+ return (o) => t.onRowClick?.({
1120
+ record: e,
1121
+ row: o,
1122
+ resource: r(e, o)
1123
+ });
1124
+ }, ir = (e, t, r) => {
1125
+ const o = e.createRow;
1126
+ if (o)
1127
+ return async (n) => {
1128
+ const s = Pe(n.values, o.columnParam ? {
1129
+ [o.columnParam]: n.columnId
1130
+ } : void 0, o.attributesParam ? {
1131
+ [o.attributesParam]: n.attributeValues
1132
+ } : void 0), a = await r(e, o.commandId, s);
1133
+ await t.onAfterCreate?.({
1134
+ record: e,
1135
+ created: a,
1136
+ submission: n
1137
+ });
1138
+ };
1139
+ }, ar = (e, t, r, o, n) => {
1140
+ const s = t.rowActions;
1141
+ if (s?.length)
1142
+ return (a) => s.map((d) => {
1143
+ const c = n(t, a), b = () => er(e, t, d, a, c, o);
1144
+ return {
1145
+ key: d.id,
1146
+ label: o(d.label, d.id),
1147
+ commandId: d.commandId,
1148
+ icon: or(d.icon),
1149
+ onClick: () => r.executeRowAction ? r.executeRowAction({
1150
+ record: t,
1151
+ action: d,
1152
+ row: a,
1153
+ resource: c,
1154
+ runDefault: b
1155
+ }) : b()
1156
+ };
1157
+ });
1158
+ }, dr = (e, t, r = {}) => {
1159
+ const o = [], n = r.resolveLabel ?? ((i, l) => m(i, l)), s = r.decorateAttribute ?? ((i, l) => l), a = r.resolveRowResource ?? Ae, d = r.resolveRowActionResource ?? qt, c = r.onAfterMutation ?? (() => {
1160
+ }), b = (i, l, u) => H(e, i, l, u).then((f) => (c(i), f));
1161
+ for (const i of t) {
1162
+ const l = Ot(i, i.attributes, n, s);
1163
+ let u;
1164
+ const f = (p) => a(i, p);
1165
+ o.push(...Zt(e, i, n)), o.push(e.workbench.renderers.registerKanbanRenderer({
1166
+ id: i.id,
1167
+ title: n(i.title, i.id),
1168
+ resourceKind: i.resourceKind,
1169
+ attributes: l.source,
1170
+ defaultSettings: i.defaultSettings,
1171
+ defaultFilters: i.defaultFilters,
1172
+ defaultViews: i.defaultViews?.map((p) => ({
1173
+ ...p,
1174
+ title: n(p.title, p.id)
1175
+ })),
1176
+ defaultActiveViewId: i.defaultActiveViewId,
1177
+ emptyTitle: n(i.emptyTitle, ""),
1178
+ emptyDescription: n(i.emptyDescription, ""),
1179
+ hideToolbar: i.hideToolbar,
1180
+ createRow: nr(i, n),
1181
+ getBoardColumnConfig: (p) => rr(u?.[p], n),
1182
+ onRowClick: sr(i, r, a),
1183
+ executeQuery: async (p) => {
1184
+ const h = await H(e, i, i.queryCommandId, {
1185
+ settings: p.settings,
1186
+ filters: p.filters
1187
+ });
1188
+ return Array.isArray(h) ? h.map((v) => fe(v, f)) : Lt(h) ? (l.set(h.attributes), u = h.boardColumnConfigs, (h.rows ?? []).map((v) => fe(v, f))) : [];
1189
+ },
1190
+ onAttributeChange: i.updateAttributeCommandId ? (p, h, v) => b(i, i.updateAttributeCommandId, {
1191
+ rowId: p,
1192
+ attributeId: h,
1193
+ value: v
1194
+ }).then(() => {
1195
+ }) : void 0,
1196
+ onReorder: i.reorderCommandId ? (p, h) => b(i, i.reorderCommandId, {
1197
+ rowId: p,
1198
+ beforeRowId: h
1199
+ }).then(() => {
1200
+ }) : void 0,
1201
+ onCreateRow: ir(i, r, b),
1202
+ onColumnAction: i.columnActionCommandId ? async (p, h) => {
1203
+ await b(i, i.columnActionCommandId, {
1204
+ columnId: p,
1205
+ actionId: h
1206
+ });
1207
+ } : void 0,
1208
+ getRowContextMenuActions: ar(e, i, r, n, d)
1209
+ })), o.push(e.workbench.layout.registerPanel({
1210
+ closable: !1,
1211
+ id: i.id,
1212
+ title: n(i.title, i.id),
1213
+ region: "main",
1214
+ rendererId: i.id,
1215
+ singleton: !0,
1216
+ resourceKinds: i.resourceKind ? [i.resourceKind] : void 0
1217
+ }));
1218
+ }
1219
+ return {
1220
+ dispose() {
1221
+ for (let i = o.length - 1; i >= 0; i -= 1) o[i]?.dispose();
1222
+ }
1223
+ };
1224
+ }, cr = (e, t) => {
1225
+ if (e)
1226
+ return Object.fromEntries(Object.entries(e).map(([r, o]) => [r, {
1227
+ ...o,
1228
+ label: o.label === void 0 ? void 0 : t(o.label, r),
1229
+ description: o.description === void 0 ? void 0 : t(o.description)
1230
+ }]));
1231
+ }, lr = (e, t) => e.panels.flatMap((r) => [r, ...r.panelMenus ?? []]).filter((r) => r.treeRendererId === t.id), Se = (e, t) => t.viewId ? e.find((r) => r.id === t.viewId) : e.length === 1 ? e[0] : void 0, mr = async (e) => {
1055
1232
  const {
1056
1233
  ctx: t,
1057
1234
  getHostTreeHeaderNodes: r,
1058
1235
  record: o,
1059
1236
  treeViews: n
1060
- } = e, s = xe(n, t);
1061
- return s?.hostTreeHeader !== "default" ? [] : await r?.({
1237
+ } = e, s = Se(n, t);
1238
+ return !s || !("hostTreeHeader" in s) || s.hostTreeHeader !== "default" ? [] : await r?.({
1062
1239
  ctx: t,
1063
1240
  record: o,
1064
- view: s
1241
+ panel: s
1065
1242
  }) ?? [];
1066
- }, Zt = async (e) => {
1243
+ }, ur = async (e) => {
1067
1244
  const {
1068
1245
  ctx: t,
1069
1246
  getHostTreeFooterNodes: r,
1070
1247
  record: o,
1071
1248
  treeViews: n
1072
- } = e, s = xe(n, t);
1073
- return s?.hostTreeFooter !== "default" ? [] : await r?.({
1249
+ } = e, s = Se(n, t);
1250
+ return !s || !("hostTreeFooter" in s) || s.hostTreeFooter !== "default" ? [] : await r?.({
1074
1251
  ctx: t,
1075
1252
  record: o,
1076
- view: s
1253
+ panel: s
1077
1254
  }) ?? [];
1078
- }, er = (e, t) => {
1079
- if (!t.treeRendererId) return;
1080
- const r = H(t.target);
1081
- return e.workbench.layout.registerWidget({
1082
- id: t.id,
1083
- title: u(t.title, t.id),
1084
- area: t.surface === "modal" ? "overlay" : r,
1085
- rendererId: t.treeRendererId,
1086
- singleton: !0,
1087
- resourceKinds: t.resourceKind ? [t.resourceKind] : void 0
1088
- });
1089
- }, F = (e) => {
1255
+ }, br = (e, t) => {
1256
+ if (t.treeRendererId)
1257
+ return K({
1258
+ workbench: e.workbench,
1259
+ contribution: {
1260
+ id: t.id,
1261
+ title: m(t.title, t.id),
1262
+ region: t.region,
1263
+ closable: t.closable,
1264
+ rendererId: t.treeRendererId,
1265
+ singleton: !0,
1266
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
1267
+ eligibleLocations: W(t.eligibleLocations),
1268
+ panelMenus: j(t.panelMenus)
1269
+ }
1270
+ });
1271
+ }, G = (e) => {
1090
1272
  if (e)
1091
1273
  return {
1092
1274
  type: e.kind,
@@ -1094,13 +1276,13 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1094
1276
  label: e.label,
1095
1277
  metadata: e.metadata
1096
1278
  };
1097
- }, de = (e) => ({
1279
+ }, pe = (e) => ({
1098
1280
  kind: e.type,
1099
1281
  uri: `pstdio://extension-resource/${encodeURIComponent(e.type)}/${encodeURIComponent(e.id)}`,
1100
1282
  id: e.id,
1101
1283
  label: e.label,
1102
1284
  metadata: e.metadata
1103
- }), Ae = (e) => ({
1285
+ }), We = (e) => ({
1104
1286
  id: e.treeId,
1105
1287
  kind: "renderer",
1106
1288
  context: {
@@ -1114,8 +1296,8 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1114
1296
  resourceId: e.resource.id
1115
1297
  } : {}
1116
1298
  }
1117
- }), N = (e, t, r, o) => {
1118
- const n = F(r.resource);
1299
+ }), z = (e, t, r, o) => {
1300
+ const n = G(r.resource);
1119
1301
  return {
1120
1302
  projectId: e.projectId,
1121
1303
  modeId: e.workbench.modes.getActiveModeId(),
@@ -1129,12 +1311,12 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1129
1311
  node: o
1130
1312
  } : {}
1131
1313
  };
1132
- }, U = async (e, t, r) => {
1314
+ }, Q = async (e, t, r) => {
1133
1315
  const o = r.resource, n = await e.executeCommand(t, {
1134
1316
  projectId: e.projectId,
1135
1317
  params: r,
1136
1318
  resource: o,
1137
- slot: Ae({
1319
+ slot: We({
1138
1320
  modeId: r.modeId,
1139
1321
  projectId: e.projectId,
1140
1322
  resource: o,
@@ -1142,15 +1324,15 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1142
1324
  }),
1143
1325
  source: "dashboard"
1144
1326
  });
1145
- return D(n);
1146
- }, We = async (e, t, r, o, n) => {
1327
+ return L(n);
1328
+ }, je = async (e, t, r, o, n) => {
1147
1329
  const s = e.workbench.modes.getActiveModeId(), a = await e.executeCommand(r, {
1148
1330
  projectId: e.projectId,
1149
1331
  ...o ? {
1150
1332
  params: o
1151
1333
  } : {},
1152
1334
  resource: n,
1153
- slot: Ae({
1335
+ slot: We({
1154
1336
  modeId: s,
1155
1337
  projectId: e.projectId,
1156
1338
  resource: n,
@@ -1161,28 +1343,28 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1161
1343
  treeId: t.id
1162
1344
  }
1163
1345
  });
1164
- return D(a);
1165
- }, tr = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, rr = (e, t) => {
1346
+ return L(a);
1347
+ }, fr = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, pr = (e, t) => {
1166
1348
  const r = /* @__PURE__ */ new WeakMap(), o = `workbench.extensionTreeRenderer.${t.id}.command`, n = (i) => {
1167
1349
  if (i.emptyState)
1168
1350
  return {
1169
- title: u(i.emptyState.title),
1170
- description: u(i.emptyState.description),
1351
+ title: m(i.emptyState.title),
1352
+ description: m(i.emptyState.description),
1171
1353
  icon: i.emptyState.icon
1172
1354
  };
1173
- }, s = (i, l, m) => {
1355
+ }, s = (i, l, u) => {
1174
1356
  if (i) {
1175
1357
  if (i.kind === "resource" && i.resource)
1176
1358
  return {
1177
1359
  kind: "resource",
1178
- resource: de(i.resource),
1360
+ resource: pe(i.resource),
1179
1361
  input: {
1180
1362
  replaceActive: !0
1181
1363
  }
1182
1364
  };
1183
- if (i.kind === "view" && i.widgetId) return {
1184
- kind: "view",
1185
- widgetId: i.widgetId
1365
+ if (i.kind === "panel" && i.panelId) return {
1366
+ kind: "panel",
1367
+ panelId: i.panelId
1186
1368
  };
1187
1369
  if (!(i.kind !== "command" || !i.commandId))
1188
1370
  return {
@@ -1192,115 +1374,115 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1192
1374
  commandId: i.commandId,
1193
1375
  nodeId: l.id,
1194
1376
  params: i.args,
1195
- resource: l.resource ?? F(m.resource),
1377
+ resource: l.resource ?? G(u.resource),
1196
1378
  treeId: t.id
1197
1379
  }
1198
1380
  };
1199
1381
  }
1200
- }, a = (i, l, m) => {
1201
- const p = i.commandId;
1382
+ }, a = (i, l, u) => {
1383
+ const f = i.commandId;
1202
1384
  return {
1203
1385
  id: i.id,
1204
- label: u(i.label),
1386
+ label: m(i.label),
1205
1387
  icon: i.icon,
1206
1388
  args: i.args,
1207
- params: i.params,
1389
+ params: cr(i.params, m),
1208
1390
  submitLabel: i.submitLabel,
1209
1391
  when: i.when,
1210
1392
  disabled: i.disabled,
1211
1393
  // Actions mutate tree data (create/delete/...), so refresh afterwards. Plain
1212
1394
  // node-target navigation runs through the runner command and must not refetch.
1213
- run: p ? async (f) => {
1214
- await We(e, t, p, tr(f, i.args), l?.resource ?? F(m.resource)), e.workbench.renderers.refresh(t.id);
1395
+ run: f ? async (p) => {
1396
+ await je(e, t, f, fr(p, i.args), l?.resource ?? G(u.resource)), e.workbench.renderers.refresh(t.id);
1215
1397
  } : void 0
1216
1398
  };
1217
- }, c = (i, l) => {
1218
- const m = {
1399
+ }, d = (i, l) => {
1400
+ const u = {
1219
1401
  id: i.id,
1220
- label: u(i.label),
1402
+ label: m(i.label),
1221
1403
  icon: i.icon,
1222
1404
  iconColor: i.iconColor,
1223
1405
  iconTooltip: i.iconTooltip,
1224
- resource: i.resource ? de(i.resource) : void 0,
1406
+ resource: i.resource ? pe(i.resource) : void 0,
1225
1407
  target: s(i.target, i, l),
1226
1408
  rowVariant: i.rowVariant,
1227
- actions: i.actions?.map((p) => a(p, i, l)),
1228
- contextMenuActions: i.contextMenuActions?.map((p) => a(p, i, l)),
1409
+ actions: i.actions?.map((f) => a(f, i, l)),
1410
+ contextMenuActions: i.contextMenuActions?.map((f) => a(f, i, l)),
1229
1411
  collapsible: i.collapsible,
1230
1412
  disabled: i.disabled,
1231
- children: i.children?.map((p) => c(p, l)),
1413
+ children: i.children?.map((f) => d(f, l)),
1232
1414
  description: i.description,
1233
1415
  contextValue: i.contextValue,
1234
1416
  hiddenByDefault: i.hiddenByDefault,
1235
1417
  canHide: i.canHide
1236
1418
  };
1237
- return r.set(m, i), m;
1419
+ return r.set(u, i), u;
1238
1420
  };
1239
1421
  return {
1240
- mapNodes: (i, l) => i.map((m) => c(m, l)),
1241
- mapSections: (i, l) => i.map((m) => ({
1242
- id: m.id,
1243
- label: u(m.label),
1244
- actions: m.actions?.map((p) => a(p, void 0, l)),
1245
- collapsible: m.collapsible,
1246
- emptyState: n(m),
1247
- nodes: m.nodes.map((p) => c(p, l)),
1248
- hiddenByDefault: m.hiddenByDefault,
1249
- canHide: m.canHide
1422
+ mapNodes: (i, l) => i.map((u) => d(u, l)),
1423
+ mapSections: (i, l) => i.map((u) => ({
1424
+ id: u.id,
1425
+ label: m(u.label),
1426
+ actions: u.actions?.map((f) => a(f, void 0, l)),
1427
+ collapsible: u.collapsible,
1428
+ emptyState: n(u),
1429
+ nodes: u.nodes.map((f) => d(f, l)),
1430
+ hiddenByDefault: u.hiddenByDefault,
1431
+ canHide: u.canHide
1250
1432
  })),
1251
1433
  originalNodes: r,
1252
1434
  runnerCommandId: o
1253
1435
  };
1254
- }, or = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "nodes" in t), le = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "id" in t), nr = (e) => {
1436
+ }, hr = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "nodes" in t), he = (e) => Array.isArray(e) && e.every((t) => t && typeof t == "object" && "id" in t), wr = (e) => {
1255
1437
  for (const t of e)
1256
1438
  for (const r of t.nodes)
1257
1439
  if (r.selected) return r.id;
1258
- }, sr = (e, t) => {
1259
- const r = rr(e, t), o = Yt(e.metadata, t), n = e.workbench.commands.registerCommand({
1440
+ }, gr = (e, t) => {
1441
+ const r = pr(e, t), o = lr(e.metadata, t), n = e.workbench.commands.registerCommand({
1260
1442
  id: r.runnerCommandId,
1261
- label: `${u(t.title, t.id)} tree command`
1443
+ label: `${m(t.title, t.id)} tree command`
1262
1444
  }, {
1263
1445
  execute: async (a) => {
1264
- const c = a;
1265
- c.nodeId && e.workbench.renderers.setSelectedNode(t.id, c.nodeId);
1266
- const d = await We(e, t, c.commandId, c.params, c.resource);
1446
+ const d = a;
1447
+ d.nodeId && e.workbench.renderers.setSelectedNode(t.id, d.nodeId);
1448
+ const c = await je(e, t, d.commandId, d.params, d.resource);
1267
1449
  for (const b of e.workbench.renderers.listFileRenderers())
1268
1450
  e.workbench.renderers.refreshFileRenderer(b.id);
1269
- return d;
1451
+ return c;
1270
1452
  }
1271
1453
  }), s = e.workbench.renderers.registerTreeRenderer({
1272
1454
  id: t.id,
1273
- title: u(t.title, t.id),
1455
+ title: m(t.title, t.id),
1274
1456
  icon: t.icon,
1275
1457
  defaultExpandedNodeIds: t.defaultExpandedNodeIds,
1276
1458
  defaultExpandedSectionIds: t.defaultExpandedSectionIds,
1277
- getHeader: (a) => Jt({
1459
+ getHeader: (a) => mr({
1278
1460
  ctx: a,
1279
1461
  getHostTreeHeaderNodes: e.getHostTreeHeaderNodes,
1280
1462
  record: t,
1281
1463
  treeViews: o
1282
1464
  }),
1283
1465
  getBody: async (a) => {
1284
- const c = await U(e, t.bodyCommandId, N(e, t, a));
1285
- if (!or(c)) return [];
1286
- const d = nr(c);
1287
- return d && e.workbench.renderers.setSelectedNode(t.id, d), r.mapSections(c, a);
1466
+ const d = await Q(e, t.bodyCommandId, z(e, t, a));
1467
+ if (!hr(d)) return [];
1468
+ const c = wr(d);
1469
+ return c && e.workbench.renderers.setSelectedNode(t.id, c), r.mapSections(d, a);
1288
1470
  },
1289
1471
  getFooter: async (a) => {
1290
- const c = await Zt({
1472
+ const d = await ur({
1291
1473
  ctx: a,
1292
1474
  getHostTreeFooterNodes: e.getHostTreeFooterNodes,
1293
1475
  record: t,
1294
1476
  treeViews: o
1295
1477
  });
1296
- if (!t.footerCommandId) return c;
1297
- const d = await U(e, t.footerCommandId, N(e, t, a));
1298
- return [...le(d) ? r.mapNodes(d, a) : [], ...c];
1478
+ if (!t.footerCommandId) return d;
1479
+ const c = await Q(e, t.footerCommandId, z(e, t, a));
1480
+ return [...he(c) ? r.mapNodes(c, a) : [], ...d];
1299
1481
  },
1300
- getChildren: async (a, c) => {
1482
+ getChildren: async (a, d) => {
1301
1483
  if (!t.childrenCommandId) return a.children ?? [];
1302
- const d = r.originalNodes.get(a) ?? a, b = await U(e, t.childrenCommandId, N(e, t, c, d));
1303
- return le(b) ? r.mapNodes(b, c) : [];
1484
+ const c = r.originalNodes.get(a) ?? a, b = await Q(e, t.childrenCommandId, z(e, t, d, c));
1485
+ return he(b) ? r.mapNodes(b, d) : [];
1304
1486
  }
1305
1487
  });
1306
1488
  return {
@@ -1308,12 +1490,12 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1308
1490
  s.dispose(), n.dispose();
1309
1491
  }
1310
1492
  };
1311
- }, ir = (e) => {
1493
+ }, Ir = (e) => {
1312
1494
  const t = [];
1313
1495
  for (const r of e.metadata.treeRenderers ?? [])
1314
- t.push(sr(e, r));
1315
- for (const r of e.metadata.views) {
1316
- const o = er(e, r);
1496
+ t.push(gr(e, r));
1497
+ for (const r of e.metadata.panels) {
1498
+ const o = br(e, r);
1317
1499
  o && t.push(o);
1318
1500
  }
1319
1501
  return {
@@ -1321,8 +1503,8 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1321
1503
  for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1322
1504
  }
1323
1505
  };
1324
- }, ar = (e) => (t) => ({
1325
- ...we({
1506
+ }, yr = (e) => (t) => ({
1507
+ ...ve({
1326
1508
  workbench: t.workbench,
1327
1509
  hostEvents: t.hostEvents
1328
1510
  }),
@@ -1332,10 +1514,10 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1332
1514
  "resource.open": (o) => {
1333
1515
  const n = o;
1334
1516
  if (!n.resource) throw new Error("resource.open requires a resource.");
1335
- return t.workbench.resources.openResource(q(n.resource), n.input);
1517
+ return t.workbench.resources.openResource(O(n.resource), n.input);
1336
1518
  },
1337
1519
  "commands.execute": async (o) => {
1338
- const n = o, s = n.resource ?? z(t.placement.resource);
1520
+ const n = o, s = n.resource ?? J(t.placement.resource);
1339
1521
  return e.executeCommand(n.commandId, {
1340
1522
  projectId: e.projectId,
1341
1523
  ...n.params ? {
@@ -1344,12 +1526,12 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1344
1526
  ...s ? {
1345
1527
  resource: s
1346
1528
  } : {},
1347
- slot: $({
1529
+ slot: S({
1348
1530
  id: t.webviewId,
1349
1531
  kind: e.slotKind,
1350
1532
  projectId: e.projectId,
1351
1533
  context: {
1352
- contributionId: t.webviewId
1534
+ panelId: t.webviewId
1353
1535
  }
1354
1536
  }),
1355
1537
  source: "dashboard"
@@ -1360,23 +1542,17 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1360
1542
  "files.list": e.files.list,
1361
1543
  "files.delete": e.files.delete
1362
1544
  } : {}
1363
- }), Q = (e) => ({
1364
- title: u(e.title),
1365
- runtimeUrl: e.runtimeUrl,
1366
- moduleUrl: e.moduleUrl,
1367
- styles: e.styles,
1368
- capabilities: e.capabilities
1369
- }), G = (e, t) => ({
1545
+ }), Z = (e, t) => ({
1370
1546
  kind: t,
1371
1547
  uri: `workbench://extension-route/${encodeURIComponent(e.id)}`,
1372
1548
  id: e.id,
1373
- label: u(e.label, e.id),
1549
+ label: m(e.label, e.id),
1374
1550
  metadata: {
1375
1551
  extensionId: e.extensionId,
1376
1552
  extensionRouteId: e.id,
1377
1553
  path: e.path
1378
1554
  }
1379
- }), me = (e, t) => e.routes.find((r) => t.id === r.id || t.metadata?.extensionRouteId === r.id), cr = (e) => {
1555
+ }), we = (e, t) => e.routes.find((r) => t.id === r.id || t.metadata?.extensionRouteId === r.id), vr = (e) => {
1380
1556
  if (e.metadata.routes.length === 0) return [];
1381
1557
  const t = [];
1382
1558
  e.workbench.resources.getKind(e.routeResourceKind) || t.push(e.workbench.resources.registerKind({
@@ -1385,43 +1561,51 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1385
1561
  icon: "Component"
1386
1562
  }));
1387
1563
  for (const r of e.metadata.routes)
1388
- t.push(e.workbench.layout.registerWidget({
1564
+ t.push(e.workbench.layout.registerPanel({
1565
+ closable: !1,
1389
1566
  id: r.id,
1390
- title: u(r.label, r.id),
1391
- area: "main",
1392
- rendererId: B,
1567
+ title: m(r.label, r.id),
1568
+ region: "main",
1569
+ rendererId: T,
1393
1570
  singleton: !0,
1394
- config: Q(r.webview)
1571
+ config: N(r.webview)
1395
1572
  }));
1396
1573
  return t.push(e.workbench.resources.registerProvider({
1397
1574
  id: "workbench.extension.routes",
1398
1575
  kind: e.routeResourceKind,
1399
1576
  list: () => e.metadata.routes.map((r) => ({
1400
- resource: G(r, e.routeResourceKind)
1577
+ resource: Z(r, e.routeResourceKind)
1401
1578
  }))
1402
- }), e.workbench.resources.registerOpener({
1579
+ }), e.workbench.resources.registerPresenter({
1403
1580
  id: "workbench.extension.routes",
1404
- canOpen: (r) => r.kind === e.routeResourceKind && !!me(e.metadata, r),
1581
+ canOpen: (r) => r.kind === e.routeResourceKind && !!we(e.metadata, r),
1405
1582
  open: (r, o) => {
1406
- const n = me(e.metadata, r);
1407
- if (n)
1408
- return e.workbench.layout.openWidget(n.id, {
1409
- replaceActive: o.replaceActive,
1410
- title: u(n.label, n.id)
1411
- });
1583
+ const n = we(e.metadata, r);
1584
+ return e.workbench.layout.openPanel(n.id, {
1585
+ strategy: o.replaceActive ? {
1586
+ kind: "replace-active"
1587
+ } : {
1588
+ kind: "activate-or-open"
1589
+ },
1590
+ title: m(n.label, n.id)
1591
+ });
1412
1592
  }
1413
1593
  })), t;
1414
- }, dr = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, lr = (e, t) => {
1415
- if (t.action.kind === "dataRenderer") return {
1416
- kind: "view",
1417
- widgetId: t.action.dataRendererId
1594
+ }, kr = {
1595
+ "workbench.left.tree": "sidenav",
1596
+ "workbench.main.left.tree": "main-left-menu",
1597
+ "workbench.main.right.tree": "main-right-menu"
1598
+ }, Rr = (e) => e ? kr[e] ?? "sidenav" : "sidenav", Cr = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Er = (e, t) => {
1599
+ if (t.action.kind === "kanbanRenderer") return {
1600
+ kind: "panel",
1601
+ panelId: t.action.kanbanRendererId
1418
1602
  };
1419
1603
  const r = t.action;
1420
1604
  if (r.kind === "route") {
1421
1605
  const o = e.metadata.routes.find((n) => n.id === r.route);
1422
1606
  return o ? {
1423
1607
  kind: "resource",
1424
- resource: G(o, e.routeResourceKind)
1608
+ resource: Z(o, e.routeResourceKind)
1425
1609
  } : void 0;
1426
1610
  }
1427
1611
  return r.kind === "command" ? {
@@ -1435,7 +1619,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1435
1619
  href: r.href
1436
1620
  }
1437
1621
  };
1438
- }, mr = (e) => {
1622
+ }, xr = (e) => {
1439
1623
  const t = e.metadata.treeItems ?? [];
1440
1624
  if (t.length === 0) return [];
1441
1625
  const r = [], o = /* @__PURE__ */ new Map();
@@ -1445,21 +1629,22 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1445
1629
  r.push(e.workbench.renderers.registerTreeRenderer({
1446
1630
  id: a,
1447
1631
  title: "Extensions",
1448
- getChildren: (c) => c.children ?? [],
1632
+ getChildren: (d) => d.children ?? [],
1449
1633
  getBody: () => [{
1450
1634
  id: "extensions",
1451
1635
  label: "Extensions",
1452
- nodes: s.map((c) => ({
1453
- id: c.id,
1454
- label: u(c.label, c.id),
1455
- icon: c.icon,
1456
- target: lr(e, c)
1636
+ nodes: s.map((d) => ({
1637
+ id: d.id,
1638
+ label: m(d.label, d.id),
1639
+ icon: d.icon,
1640
+ target: Er(e, d)
1457
1641
  }))
1458
1642
  }]
1459
- }), e.workbench.layout.registerWidget({
1643
+ }), e.workbench.layout.registerPanel({
1644
+ closable: !1,
1460
1645
  id: a,
1461
1646
  title: "Extensions",
1462
- area: It(n),
1647
+ region: Rr(n),
1463
1648
  rendererId: a,
1464
1649
  singleton: !0
1465
1650
  }));
@@ -1468,108 +1653,114 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1468
1653
  const s = n.action;
1469
1654
  s.kind === "href" && r.push(e.workbench.commands.registerCommand({
1470
1655
  id: `workbench.extension.href.${n.id}`,
1471
- label: u(n.label, n.id)
1656
+ label: m(n.label, n.id)
1472
1657
  }, {
1473
- execute: (a) => e.openHref?.(dr(a)?.href ?? s.href)
1658
+ execute: (a) => e.openHref?.(Cr(a)?.href ?? s.href)
1474
1659
  }));
1475
1660
  }
1476
1661
  return r;
1477
- }, _ = "extension-route", ur = "extensions", fr = (e) => {
1662
+ }, Y = "extension-route", Ar = "extensions", Pr = (e) => {
1478
1663
  for (let t = e.length - 1; t >= 0; t -= 1) e[t]?.dispose();
1479
- }, X = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, br = (e) => e === void 0 ? void 0 : e, hr = (e) => e === "global" ? "user" : "project", pr = (e, t) => t ? (r) => ({
1664
+ }, ee = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Tr = (e) => e === void 0 ? void 0 : e, Sr = (e) => e === "global" ? "user" : "project", Wr = (e, t) => t ? (r) => ({
1480
1665
  ...e(r),
1481
1666
  ...t(r)
1482
- }) : e, Se = (e, t) => {
1483
- const r = e.createWebviewHostCapabilities ?? ar({
1667
+ }) : e, Ke = (e, t) => {
1668
+ const r = e.createWebviewHostCapabilities ?? yr({
1484
1669
  executeCommand: e.executeCommand,
1485
1670
  files: e.webviewFiles,
1486
1671
  projectId: e.projectId,
1487
1672
  slotKind: t
1488
1673
  });
1489
- return pr(r, e.createWebviewHostCapabilityOverrides);
1490
- }, wr = (e, t) => {
1491
- e.workbench.renderers.getRenderer(B) || t.push(e.workbench.renderers.registerRenderer(dt({
1492
- createHostCapabilities: Se(e, "view"),
1674
+ return Wr(r, e.createWebviewHostCapabilityOverrides);
1675
+ }, jr = (e, t) => {
1676
+ e.workbench.renderers.getRenderer(T) || t.push(e.workbench.renderers.registerRenderer(bt({
1677
+ createHostCapabilities: Ke(e, "panel"),
1493
1678
  createProps: e.createWebviewProps,
1494
1679
  createTheme: e.createWebviewTheme
1495
1680
  })));
1496
- }, gr = (e, t) => t.commands.map((r) => e.workbench.commands.registerCommand({
1681
+ }, Kr = (e, t) => t.commands.map((r) => e.workbench.commands.registerCommand({
1497
1682
  id: r.id,
1498
- label: u(r.title, r.id),
1499
- description: u(r.description),
1683
+ label: m(r.title, r.id),
1684
+ description: m(r.description),
1500
1685
  params: r.params
1501
1686
  }, {
1502
- execute: (o, n) => R(e, r.id, {
1503
- params: X(o),
1687
+ execute: (o, n) => k(e, r.id, {
1688
+ params: ee(o),
1504
1689
  resource: n?.resource
1505
1690
  })
1506
- })), Pe = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), Ir = (e, t) => e.menuSlotsById ? _t({
1691
+ })), Me = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), Mr = (e, t) => e.menuSlotsById ? Mt({
1507
1692
  metadata: e.metadata,
1508
1693
  menuSlotsById: e.menuSlotsById,
1509
1694
  menuTargetsById: e.menuTargetsById,
1510
1695
  createWhenExpression: e.createMenuWhenExpression
1511
1696
  }).flatMap((o) => [e.workbench.commands.registerCommand(o.command, {
1512
- execute: (n, s) => R(t, o.targetCommandId, {
1697
+ execute: (n, s) => k(t, o.targetCommandId, {
1513
1698
  params: {
1514
1699
  ...o.contribution.params ?? {},
1515
- ...X(n) ?? {}
1700
+ ...ee(n) ?? {}
1516
1701
  },
1517
- resource: Pe(e, s),
1518
- slot: $({
1702
+ resource: Me(e, s),
1703
+ slot: S({
1519
1704
  id: o.contribution.slotId,
1520
1705
  kind: "menu",
1521
1706
  projectId: e.projectId,
1522
1707
  context: {
1523
- contributionId: o.contribution.id
1708
+ panelId: o.contribution.id
1524
1709
  }
1525
1710
  })
1526
1711
  })
1527
- }), e.workbench.layout.registerMenuItem(o.menuPath, o.menuItem)]) : [], yr = (e, t) => Lt({
1712
+ }), e.workbench.layout.registerMenuItem(o.menuPath, o.menuItem)]) : [], $r = (e, t) => $t({
1528
1713
  metadata: e.metadata
1529
1714
  }).flatMap((o) => [e.workbench.commands.registerCommand(o.command, {
1530
- execute: (n, s) => R(t, o.targetCommandId, {
1715
+ execute: (n, s) => k(t, o.targetCommandId, {
1531
1716
  params: {
1532
1717
  ...o.contribution.params ?? {},
1533
- ...X(n) ?? {}
1718
+ ...ee(n) ?? {}
1534
1719
  },
1535
- resource: Pe(e, s),
1536
- slot: $({
1720
+ resource: Me(e, s),
1721
+ slot: S({
1537
1722
  id: "workbench.commandPalette",
1538
1723
  kind: "menu",
1539
1724
  projectId: e.projectId,
1540
1725
  context: {
1541
- contributionId: o.contribution.id
1726
+ panelId: o.contribution.id
1542
1727
  }
1543
1728
  })
1544
1729
  }),
1545
- isVisible: () => He(o.contribution.when, e.workbench.getPrimaryResource()?.kind)
1546
- }), e.workbench.layout.registerMenuItem(Me, o.menuItem)]), kr = (e) => e.metadata.views.flatMap((t) => t.webview ? [e.workbench.layout.registerWidget({
1547
- id: t.id,
1548
- title: u(t.title, t.id),
1549
- area: t.surface === "modal" ? "overlay" : H(t.target),
1550
- rendererId: B,
1551
- singleton: !0,
1552
- resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
1553
- config: {
1554
- ...Q(t.webview),
1555
- ...t.surface === "modal" ? {
1556
- size: "lg",
1557
- scrollBehavior: "inside",
1558
- contentHeight: "min(560px, calc(100dvh - 48px))"
1559
- } : {}
1730
+ isVisible: () => Le(o.contribution.when, e.workbench.getPrimaryResource()?.kind)
1731
+ }), e.workbench.layout.registerMenuItem(Oe, o.menuItem)]), Br = (e) => e.metadata.panels.flatMap((t) => t.webview ? [K({
1732
+ workbench: e.workbench,
1733
+ contribution: {
1734
+ id: t.id,
1735
+ title: m(t.title, t.id),
1736
+ region: t.region,
1737
+ closable: t.closable,
1738
+ rendererId: T,
1739
+ singleton: !0,
1740
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
1741
+ eligibleLocations: W(t.eligibleLocations),
1742
+ panelMenus: j(t.panelMenus),
1743
+ config: {
1744
+ ...N(t.webview),
1745
+ ...t.region === "overlay" ? {
1746
+ size: "lg",
1747
+ scrollBehavior: "inside",
1748
+ contentHeight: "min(560px, calc(100dvh - 48px))"
1749
+ } : {}
1750
+ }
1560
1751
  }
1561
- })] : []), vr = (e) => {
1562
- const t = [], r = e.settingsSectionId ?? ur;
1752
+ })] : []), Dr = (e) => {
1753
+ const t = [], r = e.settingsSectionId ?? Ar;
1563
1754
  e.workbench.settings.getSection(r) || t.push(e.workbench.settings.registerSection({
1564
1755
  id: r,
1565
1756
  title: e.settingsSectionTitle ?? "Extensions"
1566
1757
  }));
1567
1758
  const o = Object.fromEntries((e.metadata.settingsDefinitions ?? []).map((n) => [n.key, {
1568
1759
  type: n.type,
1569
- scope: hr(n.scope),
1570
- default: br(n.default),
1760
+ scope: Sr(n.scope),
1761
+ default: Tr(n.default),
1571
1762
  enum: n.enum,
1572
- description: u(n.description)
1763
+ description: m(n.description)
1573
1764
  }]));
1574
1765
  Object.keys(o).length > 0 && t.push(e.workbench.preferences.registerSchema({
1575
1766
  properties: o
@@ -1577,21 +1768,21 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1577
1768
  for (const n of e.metadata.settingsPanels)
1578
1769
  t.push(e.workbench.settings.registerPanel({
1579
1770
  id: n.id,
1580
- title: u(n.title, n.id),
1771
+ title: m(n.title, n.id),
1581
1772
  kind: "custom",
1582
1773
  section: r,
1583
1774
  scope: n.scope,
1584
- render: (s) => ye({
1775
+ render: (s) => Ce({
1585
1776
  context: {
1586
1777
  workbench: s.workbench,
1587
1778
  webviewId: n.id,
1588
1779
  placement: {
1589
- ...s.placement,
1590
- contributionId: n.id
1780
+ ...s.instance,
1781
+ panelId: n.id
1591
1782
  },
1592
- hostEvents: Ie(s.workbench, s.placement)
1783
+ hostEvents: Re(s.workbench, s.instance)
1593
1784
  },
1594
- createHostCapabilities: Se(e, "settings"),
1785
+ createHostCapabilities: Ke(e, "settings"),
1595
1786
  createProps: e.createWebviewProps ?? (({
1596
1787
  placement: a
1597
1788
  }) => ({
@@ -1600,129 +1791,130 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1600
1791
  })),
1601
1792
  createTheme: e.createWebviewTheme,
1602
1793
  ownerId: n.extensionId,
1603
- title: u(n.title, n.id),
1604
- webview: Q(n.webview)
1794
+ title: m(n.title, n.id),
1795
+ webview: N(n.webview)
1605
1796
  })
1606
1797
  }));
1607
1798
  return t;
1608
- }, Rr = (e) => {
1799
+ }, Hr = (e) => {
1609
1800
  const t = /* @__PURE__ */ new Set();
1610
- for (const o of e.metadata.views) o.resourceKind && t.add(o.resourceKind);
1611
- for (const o of e.metadata.dataRenderers ?? []) o.resourceKind && t.add(o.resourceKind);
1801
+ for (const o of e.metadata.panels) o.resourceKind && t.add(o.resourceKind);
1802
+ for (const o of e.metadata.kanbanRenderers ?? []) o.resourceKind && t.add(o.resourceKind);
1612
1803
  const r = [];
1613
- for (const o of t)
1804
+ for (const o of t) {
1614
1805
  e.workbench.resources.getKind(o) || r.push(e.workbench.resources.registerKind({
1615
1806
  kind: o,
1616
1807
  label: o,
1617
1808
  icon: "FileText",
1618
1809
  surface: "primary"
1619
- })), r.push(e.workbench.resources.registerOpener({
1810
+ }));
1811
+ const n = e.metadata.panels.filter((s) => s.resourceKind === o && s.region !== "overlay");
1812
+ n.length > 0 && r.push(e.workbench.resources.registerPresenter({
1620
1813
  id: `workbench.extension.resource.${o}`,
1621
- canOpen: (n) => n.kind === o,
1622
- open: (n) => e.metadata.views.filter((a) => a.resourceKind === o && a.surface !== "modal").map((a) => e.workbench.layout.openWidget(a.id, {
1623
- resource: n,
1624
- title: n.label ?? n.id ?? n.uri
1625
- }))
1814
+ canOpen: (s) => s.kind === o,
1815
+ open: (s) => {
1816
+ const a = n.map((d) => e.workbench.layout.openPanel(d.id, {
1817
+ resource: s,
1818
+ title: s.label ?? s.id ?? s.uri
1819
+ }));
1820
+ return a.find((d, c) => n[c]?.region === "main") ?? a[0];
1821
+ }
1626
1822
  }));
1627
- return r;
1628
- }, Cr = (e, t) => {
1629
- if (t === !0) {
1630
- e.layout.resetAreas();
1631
- return;
1632
1823
  }
1633
- if (Array.isArray(t))
1634
- for (const r of t) e.layout.clearArea(ke(r));
1635
- }, Er = (e, t) => {
1636
- t.view && e.layout.openWidget(t.view, {
1637
- area: ke(t.target),
1824
+ return r;
1825
+ }, Vr = (e, t) => {
1826
+ t.panel && e.layout.openPanel(t.panel, {
1827
+ region: t.region,
1638
1828
  pinned: t.pinned,
1639
- title: u(t.title)
1829
+ title: m(t.title)
1640
1830
  });
1641
- }, xr = (e, t, r) => {
1831
+ }, Fr = (e, t, r) => {
1642
1832
  if (!r.resource) return;
1643
1833
  const o = e.metadata.routes.find((n) => n.id === r.resource || n.path === r.resource);
1644
- o && t.resources.openResource(G(o, e.routeResourceKind ?? _));
1645
- }, Ar = (e, t, r) => {
1646
- Cr(t, r.layout?.reset);
1834
+ o && t.resources.openResource(Z(o, e.routeResourceKind ?? Y));
1835
+ }, Lr = (e, t, r) => {
1647
1836
  for (const o of r.layout?.open ?? [])
1648
- Er(t, o), xr(e, t, o);
1649
- }, Wr = (e) => e.metadata.modes.map((t) => e.workbench.modes.registerMode({
1837
+ Vr(t, o), Fr(e, t, o);
1838
+ }, Or = (e) => e.metadata.modes.map((t) => e.workbench.modes.registerMode({
1650
1839
  id: t.modeId,
1651
- label: u(t.label, t.modeId),
1652
- activate: (r) => {
1653
- Ar(e, r, t);
1840
+ label: m(t.label, t.modeId),
1841
+ panels: t.layout?.panels,
1842
+ activate: () => {
1843
+ },
1844
+ seed: (r) => {
1845
+ Lr(e, r, t);
1654
1846
  }
1655
- })), _r = (e) => {
1847
+ })), io = (e) => {
1656
1848
  const t = [], r = e;
1657
- return wr(e, t), t.push(...gr(r, e.metadata)), t.push(...Ir(e, r)), t.push(...yr(e, r)), t.push(ir(e)), t.push(Xt(e)), t.push(...kr(e)), t.push(Mt(r, e.metadata.dataRenderers ?? [])), t.push(ht(r, e.metadata.commandPaletteResources ?? [])), t.push(...vr(e)), t.push(...cr({
1849
+ return jr(e, t), t.push(...Kr(r, e.metadata)), t.push(...Mr(e, r)), t.push(...$r(e, r)), t.push(Ir(e)), t.push(Ft(e)), t.push(...Br(e)), t.push(dr(r, e.metadata.kanbanRenderers ?? [])), t.push(Pt(r, e.metadata.dataTableRenderers ?? [], e.metadata.panels)), t.push(It(r, e.metadata.commandPaletteResources ?? [])), t.push(...Dr(e)), t.push(...vr({
1658
1850
  metadata: e.metadata,
1659
- routeResourceKind: e.routeResourceKind ?? _,
1851
+ routeResourceKind: e.routeResourceKind ?? Y,
1660
1852
  workbench: e.workbench
1661
- })), t.push(...mr({
1853
+ })), t.push(...xr({
1662
1854
  metadata: e.metadata,
1663
1855
  openHref: e.openHref,
1664
- routeResourceKind: e.routeResourceKind ?? _,
1856
+ routeResourceKind: e.routeResourceKind ?? Y,
1665
1857
  workbench: e.workbench
1666
- })), t.push(...Rr(e)), t.push(...Wr(e)), {
1858
+ })), t.push(...Hr(e)), t.push(...Or(e)), {
1667
1859
  dispose() {
1668
- fr(t);
1860
+ Pr(t);
1669
1861
  }
1670
1862
  };
1671
- }, Sr = (e) => new Set((e.treeRenderers ?? []).flatMap((t) => [t.bodyCommandId, t.childrenCommandId, t.footerCommandId].filter((r) => r))), Pr = (e) => new Set((e.dataRenderers ?? []).map((t) => t.queryCommandId)), ue = (e, t) => {
1672
- const r = e.layout.getLayout();
1673
- for (const o of Object.values(r.areas)) {
1674
- const n = o.widgets.find((s) => s.contributionId === t);
1675
- if (n) return n;
1676
- }
1677
- }, Tr = (e, t) => {
1863
+ }, Nr = (e) => new Set((e.treeRenderers ?? []).flatMap((t) => [t.bodyCommandId, t.childrenCommandId, t.footerCommandId].filter((r) => r))), Ur = (e) => new Set((e.kanbanRenderers ?? []).map((t) => t.queryCommandId)), _r = (e) => new Set((e.dataTableRenderers ?? []).map((t) => t.queryCommandId)), ge = (e, t) => e.layout.listPanelInstances().find((r) => r.panelId === t), qr = (e, t) => {
1678
1864
  if (t)
1679
1865
  try {
1680
- e.layout.activateWidget(t);
1866
+ e.layout.activatePanel(t);
1681
1867
  } catch {
1682
1868
  }
1683
- }, jr = (e, t) => !Sr(e).has(t), Kr = (e, t) => !Pr(e).has(t), Br = (e, t) => {
1869
+ }, zr = (e, t) => !Nr(e).has(t), Qr = (e, t) => !Ur(e).has(t), Gr = (e, t) => !_r(e).has(t), Yr = (e, t) => {
1684
1870
  const r = e.layout.getLayout().activeWidgetId;
1685
- for (const o of t.views) {
1686
- if (!o.webview || o.surface === "modal") continue;
1687
- const n = ue(e, o.id);
1688
- n && e.layout.openWidget(o.id, {
1871
+ for (const o of t.panels) {
1872
+ if (!o.webview || o.region === "overlay") continue;
1873
+ const n = ge(e, o.id);
1874
+ n && e.layout.openPanel(o.id, {
1689
1875
  resource: n.resource,
1690
- title: u(o.title, n.title)
1876
+ title: m(o.title, n.title)
1691
1877
  });
1692
1878
  }
1693
1879
  for (const o of t.routes) {
1694
1880
  if (!o.webview) continue;
1695
- const n = ue(e, o.id);
1696
- n && e.layout.openWidget(o.id, {
1881
+ const n = ge(e, o.id);
1882
+ n && e.layout.openPanel(o.id, {
1697
1883
  resource: n.resource,
1698
- title: u(o.label, n.title)
1884
+ title: m(o.label, n.title)
1699
1885
  });
1700
1886
  }
1701
- Tr(e, r);
1702
- }, Lr = (e, t, r) => {
1703
- if (Br(e, t), jr(t, r))
1887
+ qr(e, r);
1888
+ }, ao = (e, t, r) => {
1889
+ if (Yr(e, t), zr(t, r))
1704
1890
  for (const o of t.treeRenderers ?? []) e.renderers.refresh(o.id);
1705
- if (Kr(t, r))
1706
- for (const o of t.dataRenderers ?? []) e.renderers.refreshDataRenderer(o.id);
1891
+ if (Qr(t, r))
1892
+ for (const o of t.kanbanRenderers ?? []) e.renderers.refreshKanbanRenderer(o.id);
1893
+ if (Gr(t, r))
1894
+ for (const o of t.dataTableRenderers ?? [])
1895
+ e.renderers.refreshDataTableRenderer(o.id);
1707
1896
  };
1708
1897
  export {
1709
- B as BRIDGE_WEBVIEW_RENDERER_ID,
1710
- Lt as buildWorkbenchExtensionCommandPaletteRegistrations,
1711
- _t as buildWorkbenchExtensionMenuRegistrations,
1712
- Fr as buildWorkbenchExtensionRouteEntries,
1713
- dt as createBridgeWebviewRenderer,
1714
- rt as createTerminalSessionCapability,
1715
- we as createWorkbenchWebviewHostCapabilities,
1716
- Ur as emptyWorkbenchExtensionMetadata,
1717
- Br as refreshOpenWorkbenchExtensionWebviews,
1718
- Lr as refreshWorkbenchExtensionContributions,
1719
- ht as registerWorkbenchExtensionCommandPaletteResources,
1720
- _r as registerWorkbenchExtensionContributions,
1721
- Nr as registerWorkbenchExtensionControlsRenderers,
1722
- Mt as registerWorkbenchExtensionDataRenderers,
1723
- Xt as registerWorkbenchExtensionFileRenderers,
1724
- ir as registerWorkbenchExtensionTreeRenderers,
1725
- ye as renderBridgeWebviewFrame,
1726
- jr as shouldRefreshWorkbenchExtensionTrees
1898
+ T as BRIDGE_WEBVIEW_RENDERER_ID,
1899
+ $t as buildWorkbenchExtensionCommandPaletteRegistrations,
1900
+ Mt as buildWorkbenchExtensionMenuRegistrations,
1901
+ so as buildWorkbenchExtensionRouteEntries,
1902
+ bt as createBridgeWebviewRenderer,
1903
+ it as createTerminalSessionCapability,
1904
+ ve as createWorkbenchWebviewHostCapabilities,
1905
+ no as emptyWorkbenchExtensionMetadata,
1906
+ Yr as refreshOpenWorkbenchExtensionWebviews,
1907
+ ao as refreshWorkbenchExtensionContributions,
1908
+ It as registerWorkbenchExtensionCommandPaletteResources,
1909
+ io as registerWorkbenchExtensionContributions,
1910
+ oo as registerWorkbenchExtensionControlsRenderers,
1911
+ Pt as registerWorkbenchExtensionDataTableRenderers,
1912
+ Ft as registerWorkbenchExtensionFileRenderers,
1913
+ dr as registerWorkbenchExtensionKanbanRenderers,
1914
+ K as registerWorkbenchExtensionPanel,
1915
+ Ir as registerWorkbenchExtensionTreeRenderers,
1916
+ Ce as renderBridgeWebviewFrame,
1917
+ Gr as shouldRefreshWorkbenchExtensionDataTableRenderers,
1918
+ zr as shouldRefreshWorkbenchExtensionTrees
1727
1919
  };
1728
1920
  //# sourceMappingURL=extensions.js.map