@pstdio/workbench 0.2.1 → 0.4.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 +749 -256
  5. package/dist/extensions.js +900 -694
  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 +756 -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 +745 -231
  14. package/dist/react.js +3494 -2493
  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 +695 -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 T } from "react";
3
+ import { host as Ve } from "rimless";
4
+ import { W as S } 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
+ }, V = (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(V(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(V(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 = V(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 = V(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,45 +157,45 @@ 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), B = I(d), ne = I(c), [se, D] = He(null);
164
+ return p.current = r, h.current = o, v.current = n, te.current = s, re.current = t.webview.capabilities, oe.current = a, B.current = d, ne.current = c, A(() => {
165
165
  const w = i.current;
166
166
  if (!w) return;
167
167
  const C = `${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 === C) return;
170
+ f.current = C, u.current = !1, l.current = null;
171
+ const x = t.webview.styles, H = 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
+ D(g.message), B.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 E = g.remote;
189
+ l.current = E, te.current?.bind((De) => E.hostEvent?.(De)), await E.init({
190
+ moduleUrl: H,
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, D(null), oe.current?.();
196
+ }).catch((g) => {
197
+ const E = Je(g);
198
+ D(E.message), B.current?.(E);
199
199
  }), () => {
200
200
  };
201
201
  }, [t.webview.runtimeUrl, t.webview.moduleUrl, t.webview.styles]), A(() => {
@@ -203,58 +203,58 @@ ${t.webview.moduleUrl}`;
203
203
  if (!(!w || !s))
204
204
  return s.bind((C) => w.hostEvent?.(C)), () => 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
217
  const C = () => {
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(C), H = {
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, H), x.observe(document.body, H), () => {
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
+ D(w), B.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
+ }, W = "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: W,
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
+ }), j = (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
+ }), K = (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 ? W : void 0);
603
+ if (!t) throw new Error(`Panel Menu has no renderer: ${e.id}`);
604
+ return t;
605
+ }, M = (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
+ })), $ = (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 $({
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: K(t.eligibleLocations),
665
+ panelMenus: M(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,125 @@ 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
+ }, R = (e, t = "") => m(e, t), me = (e) => ({
681
+ ...e,
682
+ label: R(e.label, e.id),
683
+ description: e.description ? R(e.description) : void 0,
684
+ icon: e.icon ? T(S, {
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 = j({
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(() => {
708
+ return e.workbench.renderers.registerDataTableRenderer({
709
+ id: t.id,
710
+ title: R(t.title, t.id),
711
+ resourceKind: t.resourceKind,
712
+ columns: t.columns?.map(me),
713
+ initialPageSize: t.initialPageSize,
714
+ pageSizeOptions: t.pageSizeOptions,
715
+ selectionMode: t.selectionMode,
716
+ selectionActions: t.selectionActions?.map((n) => ({
717
+ id: n.id,
718
+ label: R(n.label, n.id),
719
+ icon: n.icon ? T(S, {
720
+ name: n.icon,
721
+ size: 16
808
722
  }) : void 0,
809
- onReorder: i.reorderCommandId ? (f, h) => b(i, i.reorderCommandId, {
810
- rowId: f,
811
- beforeRowId: h
723
+ destructive: n.destructive,
724
+ run: (s) => o(n.commandId, {
725
+ rowIds: s.map((a) => a.id)
812
726
  }).then(() => {
727
+ })
728
+ })),
729
+ emptyTitle: t.emptyTitle ? R(t.emptyTitle) : void 0,
730
+ emptyDescription: t.emptyDescription ? R(t.emptyDescription) : void 0,
731
+ executeQuery: async ({
732
+ resource: n,
733
+ modeId: s
734
+ }) => {
735
+ const a = await o(t.queryCommandId, {
736
+ rendererId: t.id,
737
+ projectId: e.projectId,
738
+ modeId: s,
739
+ resource: n ? {
740
+ type: n.kind,
741
+ id: n.id ?? n.uri,
742
+ label: n.label,
743
+ metadata: n.metadata
744
+ } : void 0
745
+ }, n);
746
+ return Ct(a) ? {
747
+ rows: a.rows.map(Et),
748
+ columns: a.columns?.map(me)
749
+ } : {
750
+ rows: []
751
+ };
752
+ },
753
+ rowActions: t.rowActions?.map((n) => ({
754
+ id: n.id,
755
+ label: R(n.label, n.id),
756
+ icon: n.icon ? T(S, {
757
+ name: n.icon,
758
+ size: 16
813
759
  }) : 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
- }));
760
+ destructive: n.destructive,
761
+ run: (s) => o(n.commandId, {
762
+ rowId: s.id
763
+ }, s.resource).then(() => {
764
+ })
765
+ }))
766
+ });
767
+ }, At = (e, t) => {
768
+ if (t.dataTableRendererId)
769
+ return $({
770
+ workbench: e.workbench,
771
+ contribution: {
772
+ id: t.id,
773
+ title: m(t.title, t.id),
774
+ region: t.region,
775
+ closable: t.closable,
776
+ rendererId: t.dataTableRendererId,
777
+ singleton: !0,
778
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
779
+ eligibleLocations: K(t.eligibleLocations),
780
+ panelMenus: M(t.panelMenus)
781
+ }
782
+ });
783
+ }, Pt = (e, t, r) => {
784
+ const o = t.map((n) => xt(e, n));
785
+ for (const n of r) {
786
+ const s = At(e, n);
787
+ s && o.push(s);
856
788
  }
857
789
  return {
858
790
  dispose() {
859
- for (let i = o.length - 1; i >= 0; i -= 1) o[i]?.dispose();
791
+ for (let n = o.length - 1; n >= 0; n -= 1) o[n]?.dispose();
860
792
  }
861
793
  };
862
- }, Vt = {
794
+ }, Tt = {
863
795
  first: 0,
864
796
  default: 1,
865
797
  last: 2
866
- }, Ur = {
798
+ }, no = {
867
799
  commands: [],
868
800
  commandPaletteContributions: [],
869
801
  diagnostics: [],
@@ -872,14 +804,15 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
872
804
  modes: [],
873
805
  navigation: [],
874
806
  routes: [],
875
- dataRenderers: [],
807
+ kanbanRenderers: [],
808
+ dataTableRenderers: [],
876
809
  treeRenderers: [],
877
810
  fileRenderers: [],
878
811
  settingsPanels: [],
879
812
  settingsDefinitions: [],
880
813
  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) => {
814
+ panels: []
815
+ }, 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
816
  const {
884
817
  commandId: t,
885
818
  contribution: r,
@@ -890,14 +823,15 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
890
823
  } = e;
891
824
  return {
892
825
  commandId: t,
826
+ sourceCommandId: r.commandId,
893
827
  label: n(r.label, r.extensionId),
894
828
  icon: r.icon,
895
829
  group: s.group ?? r.group,
896
830
  overflowLabel: s.overflowLabel,
897
- order: Ce(r, o),
831
+ order: Ee(r, o),
898
832
  when: a
899
833
  };
900
- }, Ft = (e) => {
834
+ }, Kt = (e) => {
901
835
  const {
902
836
  commandId: t,
903
837
  contribution: r,
@@ -909,63 +843,63 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
909
843
  label: n(r.label, r.extensionId),
910
844
  icon: r.icon,
911
845
  group: r.group,
912
- order: Ce(r, o)
846
+ order: Ee(r, o)
913
847
  };
914
- }, _t = (e) => {
848
+ }, Mt = (e) => {
915
849
  const {
916
- createCommandId: t = Ot,
850
+ createCommandId: t = St,
917
851
  createWhenExpression: r,
918
852
  menuSlotsById: o,
919
853
  menuTargetsById: n,
920
854
  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);
855
+ resolveString: a = xe
856
+ } = e, d = [];
857
+ return s.menuContributions.forEach((c, b) => {
858
+ const i = c.target ? n?.get(c.target) : o.get(c.slotId);
925
859
  if (!i) return;
926
- const l = t(d), m = s.commands.find((p) => p.id === d.commandId);
927
- c.push({
860
+ const l = t(c), u = s.commands.find((f) => f.id === c.commandId);
861
+ d.push({
928
862
  command: {
929
863
  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
864
+ label: a(c.label, c.extensionId),
865
+ category: c.group,
866
+ description: u ? a(u.description, u.extensionId) : void 0,
867
+ icon: c.icon,
868
+ params: u?.params
935
869
  },
936
- contribution: d,
937
- menuItem: Ut({
870
+ contribution: c,
871
+ menuItem: jt({
938
872
  commandId: l,
939
- contribution: d,
873
+ contribution: c,
940
874
  index: b,
941
875
  resolveString: a,
942
876
  slot: i,
943
- when: r?.(d)
877
+ when: r?.(c)
944
878
  }),
945
879
  menuPath: i.menuPath,
946
- targetCommandId: d.commandId
880
+ targetCommandId: c.commandId
947
881
  });
948
- }), c;
949
- }, Lt = (e) => {
882
+ }), d;
883
+ }, $t = (e) => {
950
884
  const {
951
- createCommandId: t = Nt,
885
+ createCommandId: t = Wt,
952
886
  metadata: r,
953
- resolveString: o = Ee
887
+ resolveString: o = xe
954
888
  } = e, n = [];
955
889
  return (r.commandPaletteContributions ?? []).forEach((s, a) => {
956
- const c = t(s), d = r.commands.find((b) => b.id === s.commandId);
890
+ const d = t(s), c = r.commands.find((b) => b.id === s.commandId);
957
891
  n.push({
958
892
  command: {
959
- id: c,
893
+ id: d,
960
894
  label: o(s.label, s.extensionId),
961
895
  category: s.group,
962
- description: d ? o(d.description, d.extensionId) : void 0,
896
+ description: c ? o(c.description, c.extensionId) : void 0,
963
897
  icon: s.icon,
964
- params: d?.params
898
+ params: c?.params
965
899
  },
966
900
  contribution: s,
967
- menuItem: Ft({
968
- commandId: c,
901
+ menuItem: Kt({
902
+ commandId: d,
969
903
  contribution: s,
970
904
  index: a,
971
905
  resolveString: o
@@ -973,7 +907,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
973
907
  targetCommandId: s.commandId
974
908
  });
975
909
  }), n;
976
- }, Fr = (e) => {
910
+ }, so = (e) => {
977
911
  const {
978
912
  createResource: t,
979
913
  metadata: r
@@ -983,7 +917,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
983
917
  route: o
984
918
  })
985
919
  })) : [];
986
- }, zt = (e) => {
920
+ }, Bt = (e) => {
987
921
  if (e)
988
922
  return {
989
923
  type: e.kind,
@@ -991,7 +925,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
991
925
  label: e.label,
992
926
  metadata: e.metadata
993
927
  };
994
- }, qt = (e) => ({
928
+ }, Dt = (e) => ({
995
929
  id: e.rendererId,
996
930
  kind: "renderer",
997
931
  context: {
@@ -1001,8 +935,8 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1001
935
  resourceId: e.resource.id
1002
936
  } : {}
1003
937
  }
1004
- }), ce = async (e, t, r, o, n = {}) => {
1005
- const s = zt(o), a = await e.executeCommand(r, {
938
+ }), ue = async (e, t, r, o, n = {}) => {
939
+ const s = Bt(o), a = await e.executeCommand(r, {
1006
940
  projectId: e.projectId,
1007
941
  params: {
1008
942
  projectId: e.projectId,
@@ -1010,40 +944,46 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1010
944
  ...n
1011
945
  },
1012
946
  resource: s,
1013
- slot: qt({
947
+ slot: Dt({
1014
948
  projectId: e.projectId,
1015
949
  rendererId: t,
1016
950
  resource: s
1017
951
  }),
1018
952
  source: "dashboard"
1019
953
  });
1020
- return D(a);
1021
- }, Qt = (e, t) => e.workbench.renderers.registerFileRenderer({
954
+ return L(a);
955
+ }, Ht = (e, t) => e.workbench.renderers.registerFileRenderer({
1022
956
  id: t.id,
1023
- title: u(t.title, t.id),
957
+ title: m(t.title, t.id),
1024
958
  resourceKind: t.resourceKind,
1025
- load: async (r) => await ce(e, t.id, t.loadCommandId, r) ?? {},
959
+ load: async (r) => await ue(e, t.id, t.loadCommandId, r) ?? {},
1026
960
  save: t.saveCommandId ? async (r, o) => {
1027
- await ce(e, t.id, t.saveCommandId, r, {
961
+ await ue(e, t.id, t.saveCommandId, r, {
1028
962
  content: o
1029
963
  });
1030
964
  } : void 0
1031
- }), Gt = (e, t) => {
965
+ }), Vt = (e, t) => {
1032
966
  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
967
+ return $({
968
+ workbench: e.workbench,
969
+ contribution: {
970
+ id: t.id,
971
+ title: m(t.title, t.id),
972
+ region: t.region,
973
+ closable: t.closable,
974
+ rendererId: t.fileRendererId,
975
+ singleton: !0,
976
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
977
+ eligibleLocations: K(t.eligibleLocations),
978
+ panelMenus: M(t.panelMenus)
979
+ }
1040
980
  });
1041
- }, Xt = (e) => {
981
+ }, Ft = (e) => {
1042
982
  const t = [];
1043
983
  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);
984
+ t.push(Ht(e, r));
985
+ for (const r of e.metadata.panels) {
986
+ const o = Vt(e, r);
1047
987
  o && t.push(o);
1048
988
  }
1049
989
  return {
@@ -1051,42 +991,298 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1051
991
  for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1052
992
  }
1053
993
  };
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) => {
994
+ }, Lt = (e) => typeof e == "object" && e !== null && !Array.isArray(e), be = (e, t, r, o) => (t ?? []).map((n) => {
995
+ const s = {
996
+ ...n,
997
+ label: r(n.label, n.id),
998
+ type: n.type.kind === "enum" || n.type.kind === "enum-multi" ? {
999
+ ...n.type,
1000
+ options: Array.isArray(n.type.options) ? n.type.options.map((a) => ({
1001
+ ...a,
1002
+ label: r(a.label, a.value)
1003
+ })) : n.type.options
1004
+ } : n.type
1005
+ };
1006
+ return o(e, s);
1007
+ }), Ot = (e, t, r, o) => {
1008
+ let n = be(e, t, r, o);
1009
+ const s = /* @__PURE__ */ new Set();
1010
+ return {
1011
+ source: {
1012
+ getSnapshot: () => n,
1013
+ subscribe: (a) => (s.add(a), () => s.delete(a))
1014
+ },
1015
+ set(a) {
1016
+ n = be(e, a, r, o);
1017
+ for (const d of s) d();
1018
+ }
1019
+ };
1020
+ }, 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) => {
1021
+ const {
1022
+ resource: r
1023
+ } = t;
1024
+ if (Nt(r)) return r;
1025
+ if (Ut(r)) return O(r);
1026
+ }, qt = (e, t) => {
1027
+ const r = Ae(e, t);
1028
+ if (r) return r;
1029
+ if (e.resourceKind)
1030
+ return {
1031
+ kind: e.resourceKind,
1032
+ uri: _t(e.resourceKind, t.id),
1033
+ id: t.id,
1034
+ label: t.title
1035
+ };
1036
+ }, fe = (e, t) => {
1037
+ const r = e, o = t(r);
1038
+ return o === void 0 ? r : {
1039
+ ...r,
1040
+ resource: o
1041
+ };
1042
+ }, 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) => {
1043
+ if (!Gt.has(t.type)) return;
1044
+ const o = "options" in t && Array.isArray(t.options) ? t.options : [], n = t;
1045
+ return {
1046
+ id: e,
1047
+ label: r(t.label, e),
1048
+ description: t.description === void 0 ? void 0 : r(t.description),
1049
+ placeholder: n.placeholder === void 0 ? void 0 : r(n.placeholder),
1050
+ type: t.type,
1051
+ required: t.required === !0,
1052
+ defaultValue: t.defaultValue,
1053
+ options: t.type === "select" || t.type === "multi-select" ? o.map((s) => ({
1054
+ value: s.value,
1055
+ label: r(s.label, s.value),
1056
+ icon: s.icon
1057
+ })) : void 0,
1058
+ multiple: t.type === "files" ? n.multiple !== !1 : void 0,
1059
+ accept: t.type === "files" && typeof n.accept == "string" ? n.accept : void 0
1060
+ };
1061
+ }, Xt = (e, t) => Object.entries(e.createRow?.params ?? {}).flatMap(([r, o]) => {
1062
+ const n = Yt(r, o, t);
1063
+ return n ? [n] : [];
1064
+ }), Jt = (e, t) => j({
1065
+ id: t.id,
1066
+ kind: "kanbanRenderer",
1067
+ projectId: e.projectId,
1068
+ context: {
1069
+ kanbanRendererId: t.id
1070
+ }
1071
+ }), F = (e, t, r, o, n) => k(e, r, {
1072
+ params: o,
1073
+ resource: n ?? e.workbench.getPrimaryResource(),
1074
+ slot: Jt(e, t),
1075
+ metadata: {
1076
+ kanbanRendererId: t.id
1077
+ }
1078
+ }), Te = (e, t) => `workbench.extension.kanbanRenderer.${e.id}.rowAction.${t.id}`, Zt = (e, t, r) => (t.rowActions ?? []).map((o) => {
1079
+ const n = e.workbench.commands.getCommand(o.commandId)?.command;
1080
+ return e.workbench.commands.registerCommand({
1081
+ id: Te(t, o),
1082
+ label: r(o.label, o.id),
1083
+ icon: o.icon,
1084
+ params: n?.params
1085
+ }, {
1086
+ execute: (s, a) => F(e, t, o.commandId, Pe(zt(s)), a?.resource)
1087
+ });
1088
+ }), er = (e, t, r, o, n, s) => {
1089
+ const a = Te(t, r), d = e.workbench.commands.getCommand(a), c = {
1090
+ rowId: o.id
1091
+ }, b = n ? {
1092
+ resource: n
1093
+ } : void 0, i = s(r.label, r.id);
1094
+ return d && Qt(d.command.params) ? (e.workbench.commandPalette.requestParams({
1095
+ record: d,
1096
+ label: i,
1097
+ args: c,
1098
+ context: b
1099
+ }), Promise.resolve()) : d ? e.workbench.commands.executeCommand(d.command.id, c, b).then(() => {
1100
+ }) : F(e, t, r.commandId, c, n).then(() => {
1101
+ });
1102
+ }, tr = (e) => (r) => T(S, {
1103
+ name: e ?? "MoreHorizontal",
1104
+ ...r
1105
+ }), rr = (e, t) => ({
1106
+ color: e?.color,
1107
+ canDragIn: e?.canDragIn,
1108
+ canDragOut: e?.canDragOut,
1109
+ canCreate: e?.canCreate,
1110
+ actions: e?.actions?.map((r) => ({
1111
+ id: r.id,
1112
+ label: t(r.label, r.id),
1113
+ icon: tr(r.icon)
1114
+ }))
1115
+ }), or = (e) => e ? T(S, {
1116
+ name: e,
1117
+ size: 16
1118
+ }) : void 0, nr = (e, t) => {
1119
+ if (e.createRow)
1120
+ return {
1121
+ title: t(e.createRow.title, "Create row"),
1122
+ submitLabel: t(e.createRow.submitLabel, "Create"),
1123
+ fields: Xt(e, t),
1124
+ labels: {
1125
+ cancel: t(e.createRow.labels?.cancel, "Cancel"),
1126
+ properties: t(e.createRow.labels?.properties, "Properties"),
1127
+ submitError: t(e.createRow.labels?.submitError, "Could not create resource."),
1128
+ removeFile: t(e.createRow.labels?.removeFile, "Remove file")
1129
+ }
1130
+ };
1131
+ }, sr = (e, t, r) => {
1132
+ if (t.onRowClick)
1133
+ return (o) => t.onRowClick?.({
1134
+ record: e,
1135
+ row: o,
1136
+ resource: r(e, o)
1137
+ });
1138
+ }, ir = (e, t, r) => {
1139
+ const o = e.createRow;
1140
+ if (o)
1141
+ return async (n) => {
1142
+ const s = Pe(n.values, o.columnParam ? {
1143
+ [o.columnParam]: n.columnId
1144
+ } : void 0, o.attributesParam ? {
1145
+ [o.attributesParam]: n.attributeValues
1146
+ } : void 0), a = await r(e, o.commandId, s);
1147
+ await t.onAfterCreate?.({
1148
+ record: e,
1149
+ created: a,
1150
+ submission: n
1151
+ });
1152
+ };
1153
+ }, ar = (e, t, r, o, n) => {
1154
+ const s = t.rowActions;
1155
+ if (s?.length)
1156
+ return (a) => s.map((d) => {
1157
+ const c = n(t, a), b = () => er(e, t, d, a, c, o);
1158
+ return {
1159
+ key: d.id,
1160
+ label: o(d.label, d.id),
1161
+ commandId: d.commandId,
1162
+ icon: or(d.icon),
1163
+ onClick: () => r.executeRowAction ? r.executeRowAction({
1164
+ record: t,
1165
+ action: d,
1166
+ row: a,
1167
+ resource: c,
1168
+ runDefault: b
1169
+ }) : b()
1170
+ };
1171
+ });
1172
+ }, dr = (e, t, r = {}) => {
1173
+ 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 ?? (() => {
1174
+ }), b = (i, l, u) => F(e, i, l, u).then((f) => (c(i), f));
1175
+ for (const i of t) {
1176
+ const l = Ot(i, i.attributes, n, s);
1177
+ let u;
1178
+ const f = (p) => a(i, p);
1179
+ o.push(...Zt(e, i, n)), o.push(e.workbench.renderers.registerKanbanRenderer({
1180
+ id: i.id,
1181
+ title: n(i.title, i.id),
1182
+ resourceKind: i.resourceKind,
1183
+ attributes: l.source,
1184
+ defaultSettings: i.defaultSettings,
1185
+ defaultFilters: i.defaultFilters,
1186
+ defaultViews: i.defaultViews?.map((p) => ({
1187
+ ...p,
1188
+ title: n(p.title, p.id)
1189
+ })),
1190
+ defaultActiveViewId: i.defaultActiveViewId,
1191
+ emptyTitle: n(i.emptyTitle, ""),
1192
+ emptyDescription: n(i.emptyDescription, ""),
1193
+ hideToolbar: i.hideToolbar,
1194
+ createRow: nr(i, n),
1195
+ getBoardColumnConfig: (p) => rr(u?.[p], n),
1196
+ onRowClick: sr(i, r, a),
1197
+ executeQuery: async (p) => {
1198
+ const h = await F(e, i, i.queryCommandId, {
1199
+ settings: p.settings,
1200
+ filters: p.filters
1201
+ });
1202
+ 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))) : [];
1203
+ },
1204
+ onAttributeChange: i.updateAttributeCommandId ? (p, h, v) => b(i, i.updateAttributeCommandId, {
1205
+ rowId: p,
1206
+ attributeId: h,
1207
+ value: v
1208
+ }).then(() => {
1209
+ }) : void 0,
1210
+ onReorder: i.reorderCommandId ? (p, h) => b(i, i.reorderCommandId, {
1211
+ rowId: p,
1212
+ beforeRowId: h
1213
+ }).then(() => {
1214
+ }) : void 0,
1215
+ onCreateRow: ir(i, r, b),
1216
+ onColumnAction: i.columnActionCommandId ? async (p, h) => {
1217
+ await b(i, i.columnActionCommandId, {
1218
+ columnId: p,
1219
+ actionId: h
1220
+ });
1221
+ } : void 0,
1222
+ getRowContextMenuActions: ar(e, i, r, n, d)
1223
+ })), o.push(e.workbench.layout.registerPanel({
1224
+ closable: !1,
1225
+ id: i.id,
1226
+ title: n(i.title, i.id),
1227
+ region: "main",
1228
+ rendererId: i.id,
1229
+ singleton: !0,
1230
+ resourceKinds: i.resourceKind ? [i.resourceKind] : void 0
1231
+ }));
1232
+ }
1233
+ return {
1234
+ dispose() {
1235
+ for (let i = o.length - 1; i >= 0; i -= 1) o[i]?.dispose();
1236
+ }
1237
+ };
1238
+ }, cr = (e, t) => {
1239
+ if (e)
1240
+ return Object.fromEntries(Object.entries(e).map(([r, o]) => [r, {
1241
+ ...o,
1242
+ label: o.label === void 0 ? void 0 : t(o.label, r),
1243
+ description: o.description === void 0 ? void 0 : t(o.description)
1244
+ }]));
1245
+ }, 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
1246
  const {
1056
1247
  ctx: t,
1057
1248
  getHostTreeHeaderNodes: r,
1058
1249
  record: o,
1059
1250
  treeViews: n
1060
- } = e, s = xe(n, t);
1061
- return s?.hostTreeHeader !== "default" ? [] : await r?.({
1251
+ } = e, s = Se(n, t);
1252
+ return !s || !("hostTreeHeader" in s) || s.hostTreeHeader !== "default" ? [] : await r?.({
1062
1253
  ctx: t,
1063
1254
  record: o,
1064
- view: s
1255
+ panel: s
1065
1256
  }) ?? [];
1066
- }, Zt = async (e) => {
1257
+ }, ur = async (e) => {
1067
1258
  const {
1068
1259
  ctx: t,
1069
1260
  getHostTreeFooterNodes: r,
1070
1261
  record: o,
1071
1262
  treeViews: n
1072
- } = e, s = xe(n, t);
1073
- return s?.hostTreeFooter !== "default" ? [] : await r?.({
1263
+ } = e, s = Se(n, t);
1264
+ return !s || !("hostTreeFooter" in s) || s.hostTreeFooter !== "default" ? [] : await r?.({
1074
1265
  ctx: t,
1075
1266
  record: o,
1076
- view: s
1267
+ panel: s
1077
1268
  }) ?? [];
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) => {
1269
+ }, br = (e, t) => {
1270
+ if (t.treeRendererId)
1271
+ return $({
1272
+ workbench: e.workbench,
1273
+ contribution: {
1274
+ id: t.id,
1275
+ title: m(t.title, t.id),
1276
+ region: t.region,
1277
+ closable: t.closable,
1278
+ rendererId: t.treeRendererId,
1279
+ singleton: !0,
1280
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
1281
+ eligibleLocations: K(t.eligibleLocations),
1282
+ panelMenus: M(t.panelMenus)
1283
+ }
1284
+ });
1285
+ }, G = (e) => {
1090
1286
  if (e)
1091
1287
  return {
1092
1288
  type: e.kind,
@@ -1094,13 +1290,13 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1094
1290
  label: e.label,
1095
1291
  metadata: e.metadata
1096
1292
  };
1097
- }, de = (e) => ({
1293
+ }, pe = (e) => ({
1098
1294
  kind: e.type,
1099
1295
  uri: `pstdio://extension-resource/${encodeURIComponent(e.type)}/${encodeURIComponent(e.id)}`,
1100
1296
  id: e.id,
1101
1297
  label: e.label,
1102
1298
  metadata: e.metadata
1103
- }), Ae = (e) => ({
1299
+ }), We = (e) => ({
1104
1300
  id: e.treeId,
1105
1301
  kind: "renderer",
1106
1302
  context: {
@@ -1114,8 +1310,8 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1114
1310
  resourceId: e.resource.id
1115
1311
  } : {}
1116
1312
  }
1117
- }), N = (e, t, r, o) => {
1118
- const n = F(r.resource);
1313
+ }), z = (e, t, r, o) => {
1314
+ const n = G(r.resource);
1119
1315
  return {
1120
1316
  projectId: e.projectId,
1121
1317
  modeId: e.workbench.modes.getActiveModeId(),
@@ -1129,12 +1325,12 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1129
1325
  node: o
1130
1326
  } : {}
1131
1327
  };
1132
- }, U = async (e, t, r) => {
1328
+ }, Q = async (e, t, r) => {
1133
1329
  const o = r.resource, n = await e.executeCommand(t, {
1134
1330
  projectId: e.projectId,
1135
1331
  params: r,
1136
1332
  resource: o,
1137
- slot: Ae({
1333
+ slot: We({
1138
1334
  modeId: r.modeId,
1139
1335
  projectId: e.projectId,
1140
1336
  resource: o,
@@ -1142,15 +1338,15 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1142
1338
  }),
1143
1339
  source: "dashboard"
1144
1340
  });
1145
- return D(n);
1146
- }, We = async (e, t, r, o, n) => {
1341
+ return L(n);
1342
+ }, je = async (e, t, r, o, n) => {
1147
1343
  const s = e.workbench.modes.getActiveModeId(), a = await e.executeCommand(r, {
1148
1344
  projectId: e.projectId,
1149
1345
  ...o ? {
1150
1346
  params: o
1151
1347
  } : {},
1152
1348
  resource: n,
1153
- slot: Ae({
1349
+ slot: We({
1154
1350
  modeId: s,
1155
1351
  projectId: e.projectId,
1156
1352
  resource: n,
@@ -1161,28 +1357,28 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1161
1357
  treeId: t.id
1162
1358
  }
1163
1359
  });
1164
- return D(a);
1165
- }, tr = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, rr = (e, t) => {
1360
+ return L(a);
1361
+ }, fr = (e, t) => e && typeof e == "object" && !Array.isArray(e) ? e : t, pr = (e, t) => {
1166
1362
  const r = /* @__PURE__ */ new WeakMap(), o = `workbench.extensionTreeRenderer.${t.id}.command`, n = (i) => {
1167
1363
  if (i.emptyState)
1168
1364
  return {
1169
- title: u(i.emptyState.title),
1170
- description: u(i.emptyState.description),
1365
+ title: m(i.emptyState.title),
1366
+ description: m(i.emptyState.description),
1171
1367
  icon: i.emptyState.icon
1172
1368
  };
1173
- }, s = (i, l, m) => {
1369
+ }, s = (i, l, u) => {
1174
1370
  if (i) {
1175
1371
  if (i.kind === "resource" && i.resource)
1176
1372
  return {
1177
1373
  kind: "resource",
1178
- resource: de(i.resource),
1374
+ resource: pe(i.resource),
1179
1375
  input: {
1180
1376
  replaceActive: !0
1181
1377
  }
1182
1378
  };
1183
- if (i.kind === "view" && i.widgetId) return {
1184
- kind: "view",
1185
- widgetId: i.widgetId
1379
+ if (i.kind === "panel" && i.panelId) return {
1380
+ kind: "panel",
1381
+ panelId: i.panelId
1186
1382
  };
1187
1383
  if (!(i.kind !== "command" || !i.commandId))
1188
1384
  return {
@@ -1192,115 +1388,115 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1192
1388
  commandId: i.commandId,
1193
1389
  nodeId: l.id,
1194
1390
  params: i.args,
1195
- resource: l.resource ?? F(m.resource),
1391
+ resource: l.resource ?? G(u.resource),
1196
1392
  treeId: t.id
1197
1393
  }
1198
1394
  };
1199
1395
  }
1200
- }, a = (i, l, m) => {
1201
- const p = i.commandId;
1396
+ }, a = (i, l, u) => {
1397
+ const f = i.commandId;
1202
1398
  return {
1203
1399
  id: i.id,
1204
- label: u(i.label),
1400
+ label: m(i.label),
1205
1401
  icon: i.icon,
1206
1402
  args: i.args,
1207
- params: i.params,
1403
+ params: cr(i.params, m),
1208
1404
  submitLabel: i.submitLabel,
1209
1405
  when: i.when,
1210
1406
  disabled: i.disabled,
1211
1407
  // Actions mutate tree data (create/delete/...), so refresh afterwards. Plain
1212
1408
  // 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);
1409
+ run: f ? async (p) => {
1410
+ await je(e, t, f, fr(p, i.args), l?.resource ?? G(u.resource)), e.workbench.renderers.refresh(t.id);
1215
1411
  } : void 0
1216
1412
  };
1217
- }, c = (i, l) => {
1218
- const m = {
1413
+ }, d = (i, l) => {
1414
+ const u = {
1219
1415
  id: i.id,
1220
- label: u(i.label),
1416
+ label: m(i.label),
1221
1417
  icon: i.icon,
1222
1418
  iconColor: i.iconColor,
1223
1419
  iconTooltip: i.iconTooltip,
1224
- resource: i.resource ? de(i.resource) : void 0,
1420
+ resource: i.resource ? pe(i.resource) : void 0,
1225
1421
  target: s(i.target, i, l),
1226
1422
  rowVariant: i.rowVariant,
1227
- actions: i.actions?.map((p) => a(p, i, l)),
1228
- contextMenuActions: i.contextMenuActions?.map((p) => a(p, i, l)),
1423
+ actions: i.actions?.map((f) => a(f, i, l)),
1424
+ contextMenuActions: i.contextMenuActions?.map((f) => a(f, i, l)),
1229
1425
  collapsible: i.collapsible,
1230
1426
  disabled: i.disabled,
1231
- children: i.children?.map((p) => c(p, l)),
1427
+ children: i.children?.map((f) => d(f, l)),
1232
1428
  description: i.description,
1233
1429
  contextValue: i.contextValue,
1234
1430
  hiddenByDefault: i.hiddenByDefault,
1235
1431
  canHide: i.canHide
1236
1432
  };
1237
- return r.set(m, i), m;
1433
+ return r.set(u, i), u;
1238
1434
  };
1239
1435
  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
1436
+ mapNodes: (i, l) => i.map((u) => d(u, l)),
1437
+ mapSections: (i, l) => i.map((u) => ({
1438
+ id: u.id,
1439
+ label: m(u.label),
1440
+ actions: u.actions?.map((f) => a(f, void 0, l)),
1441
+ collapsible: u.collapsible,
1442
+ emptyState: n(u),
1443
+ nodes: u.nodes.map((f) => d(f, l)),
1444
+ hiddenByDefault: u.hiddenByDefault,
1445
+ canHide: u.canHide
1250
1446
  })),
1251
1447
  originalNodes: r,
1252
1448
  runnerCommandId: o
1253
1449
  };
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) => {
1450
+ }, 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
1451
  for (const t of e)
1256
1452
  for (const r of t.nodes)
1257
1453
  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({
1454
+ }, gr = (e, t) => {
1455
+ const r = pr(e, t), o = lr(e.metadata, t), n = e.workbench.commands.registerCommand({
1260
1456
  id: r.runnerCommandId,
1261
- label: `${u(t.title, t.id)} tree command`
1457
+ label: `${m(t.title, t.id)} tree command`
1262
1458
  }, {
1263
1459
  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);
1460
+ const d = a;
1461
+ d.nodeId && e.workbench.renderers.setSelectedNode(t.id, d.nodeId);
1462
+ const c = await je(e, t, d.commandId, d.params, d.resource);
1267
1463
  for (const b of e.workbench.renderers.listFileRenderers())
1268
1464
  e.workbench.renderers.refreshFileRenderer(b.id);
1269
- return d;
1465
+ return c;
1270
1466
  }
1271
1467
  }), s = e.workbench.renderers.registerTreeRenderer({
1272
1468
  id: t.id,
1273
- title: u(t.title, t.id),
1469
+ title: m(t.title, t.id),
1274
1470
  icon: t.icon,
1275
1471
  defaultExpandedNodeIds: t.defaultExpandedNodeIds,
1276
1472
  defaultExpandedSectionIds: t.defaultExpandedSectionIds,
1277
- getHeader: (a) => Jt({
1473
+ getHeader: (a) => mr({
1278
1474
  ctx: a,
1279
1475
  getHostTreeHeaderNodes: e.getHostTreeHeaderNodes,
1280
1476
  record: t,
1281
1477
  treeViews: o
1282
1478
  }),
1283
1479
  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);
1480
+ const d = await Q(e, t.bodyCommandId, z(e, t, a));
1481
+ if (!hr(d)) return [];
1482
+ const c = wr(d);
1483
+ return c && e.workbench.renderers.setSelectedNode(t.id, c), r.mapSections(d, a);
1288
1484
  },
1289
1485
  getFooter: async (a) => {
1290
- const c = await Zt({
1486
+ const d = await ur({
1291
1487
  ctx: a,
1292
1488
  getHostTreeFooterNodes: e.getHostTreeFooterNodes,
1293
1489
  record: t,
1294
1490
  treeViews: o
1295
1491
  });
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];
1492
+ if (!t.footerCommandId) return d;
1493
+ const c = await Q(e, t.footerCommandId, z(e, t, a));
1494
+ return [...he(c) ? r.mapNodes(c, a) : [], ...d];
1299
1495
  },
1300
- getChildren: async (a, c) => {
1496
+ getChildren: async (a, d) => {
1301
1497
  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) : [];
1498
+ const c = r.originalNodes.get(a) ?? a, b = await Q(e, t.childrenCommandId, z(e, t, d, c));
1499
+ return he(b) ? r.mapNodes(b, d) : [];
1304
1500
  }
1305
1501
  });
1306
1502
  return {
@@ -1308,12 +1504,12 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1308
1504
  s.dispose(), n.dispose();
1309
1505
  }
1310
1506
  };
1311
- }, ir = (e) => {
1507
+ }, Ir = (e) => {
1312
1508
  const t = [];
1313
1509
  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);
1510
+ t.push(gr(e, r));
1511
+ for (const r of e.metadata.panels) {
1512
+ const o = br(e, r);
1317
1513
  o && t.push(o);
1318
1514
  }
1319
1515
  return {
@@ -1321,8 +1517,8 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1321
1517
  for (let r = t.length - 1; r >= 0; r -= 1) t[r]?.dispose();
1322
1518
  }
1323
1519
  };
1324
- }, ar = (e) => (t) => ({
1325
- ...we({
1520
+ }, yr = (e) => (t) => ({
1521
+ ...ve({
1326
1522
  workbench: t.workbench,
1327
1523
  hostEvents: t.hostEvents
1328
1524
  }),
@@ -1332,10 +1528,10 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1332
1528
  "resource.open": (o) => {
1333
1529
  const n = o;
1334
1530
  if (!n.resource) throw new Error("resource.open requires a resource.");
1335
- return t.workbench.resources.openResource(q(n.resource), n.input);
1531
+ return t.workbench.resources.openResource(O(n.resource), n.input);
1336
1532
  },
1337
1533
  "commands.execute": async (o) => {
1338
- const n = o, s = n.resource ?? z(t.placement.resource);
1534
+ const n = o, s = n.resource ?? J(t.placement.resource);
1339
1535
  return e.executeCommand(n.commandId, {
1340
1536
  projectId: e.projectId,
1341
1537
  ...n.params ? {
@@ -1344,12 +1540,12 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1344
1540
  ...s ? {
1345
1541
  resource: s
1346
1542
  } : {},
1347
- slot: $({
1543
+ slot: j({
1348
1544
  id: t.webviewId,
1349
1545
  kind: e.slotKind,
1350
1546
  projectId: e.projectId,
1351
1547
  context: {
1352
- contributionId: t.webviewId
1548
+ panelId: t.webviewId
1353
1549
  }
1354
1550
  }),
1355
1551
  source: "dashboard"
@@ -1360,23 +1556,17 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1360
1556
  "files.list": e.files.list,
1361
1557
  "files.delete": e.files.delete
1362
1558
  } : {}
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) => ({
1559
+ }), Z = (e, t) => ({
1370
1560
  kind: t,
1371
1561
  uri: `workbench://extension-route/${encodeURIComponent(e.id)}`,
1372
1562
  id: e.id,
1373
- label: u(e.label, e.id),
1563
+ label: m(e.label, e.id),
1374
1564
  metadata: {
1375
1565
  extensionId: e.extensionId,
1376
1566
  extensionRouteId: e.id,
1377
1567
  path: e.path
1378
1568
  }
1379
- }), me = (e, t) => e.routes.find((r) => t.id === r.id || t.metadata?.extensionRouteId === r.id), cr = (e) => {
1569
+ }), we = (e, t) => e.routes.find((r) => t.id === r.id || t.metadata?.extensionRouteId === r.id), vr = (e) => {
1380
1570
  if (e.metadata.routes.length === 0) return [];
1381
1571
  const t = [];
1382
1572
  e.workbench.resources.getKind(e.routeResourceKind) || t.push(e.workbench.resources.registerKind({
@@ -1385,43 +1575,51 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1385
1575
  icon: "Component"
1386
1576
  }));
1387
1577
  for (const r of e.metadata.routes)
1388
- t.push(e.workbench.layout.registerWidget({
1578
+ t.push(e.workbench.layout.registerPanel({
1579
+ closable: !1,
1389
1580
  id: r.id,
1390
- title: u(r.label, r.id),
1391
- area: "main",
1392
- rendererId: B,
1581
+ title: m(r.label, r.id),
1582
+ region: "main",
1583
+ rendererId: W,
1393
1584
  singleton: !0,
1394
- config: Q(r.webview)
1585
+ config: N(r.webview)
1395
1586
  }));
1396
1587
  return t.push(e.workbench.resources.registerProvider({
1397
1588
  id: "workbench.extension.routes",
1398
1589
  kind: e.routeResourceKind,
1399
1590
  list: () => e.metadata.routes.map((r) => ({
1400
- resource: G(r, e.routeResourceKind)
1591
+ resource: Z(r, e.routeResourceKind)
1401
1592
  }))
1402
- }), e.workbench.resources.registerOpener({
1593
+ }), e.workbench.resources.registerPresenter({
1403
1594
  id: "workbench.extension.routes",
1404
- canOpen: (r) => r.kind === e.routeResourceKind && !!me(e.metadata, r),
1595
+ canOpen: (r) => r.kind === e.routeResourceKind && !!we(e.metadata, r),
1405
1596
  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
- });
1597
+ const n = we(e.metadata, r);
1598
+ return e.workbench.layout.openPanel(n.id, {
1599
+ strategy: o.replaceActive ? {
1600
+ kind: "replace-active"
1601
+ } : {
1602
+ kind: "activate-or-open"
1603
+ },
1604
+ title: m(n.label, n.id)
1605
+ });
1412
1606
  }
1413
1607
  })), 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
1608
+ }, kr = {
1609
+ "workbench.left.tree": "sidenav",
1610
+ "workbench.main.left.tree": "main-left-menu",
1611
+ "workbench.main.right.tree": "main-right-menu"
1612
+ }, Rr = (e) => e ? kr[e] ?? "sidenav" : "sidenav", Cr = (e) => e && typeof e == "object" && !Array.isArray(e) ? e : void 0, Er = (e, t) => {
1613
+ if (t.action.kind === "kanbanRenderer") return {
1614
+ kind: "panel",
1615
+ panelId: t.action.kanbanRendererId
1418
1616
  };
1419
1617
  const r = t.action;
1420
1618
  if (r.kind === "route") {
1421
1619
  const o = e.metadata.routes.find((n) => n.id === r.route);
1422
1620
  return o ? {
1423
1621
  kind: "resource",
1424
- resource: G(o, e.routeResourceKind)
1622
+ resource: Z(o, e.routeResourceKind)
1425
1623
  } : void 0;
1426
1624
  }
1427
1625
  return r.kind === "command" ? {
@@ -1435,7 +1633,7 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1435
1633
  href: r.href
1436
1634
  }
1437
1635
  };
1438
- }, mr = (e) => {
1636
+ }, xr = (e) => {
1439
1637
  const t = e.metadata.treeItems ?? [];
1440
1638
  if (t.length === 0) return [];
1441
1639
  const r = [], o = /* @__PURE__ */ new Map();
@@ -1445,21 +1643,22 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1445
1643
  r.push(e.workbench.renderers.registerTreeRenderer({
1446
1644
  id: a,
1447
1645
  title: "Extensions",
1448
- getChildren: (c) => c.children ?? [],
1646
+ getChildren: (d) => d.children ?? [],
1449
1647
  getBody: () => [{
1450
1648
  id: "extensions",
1451
1649
  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)
1650
+ nodes: s.map((d) => ({
1651
+ id: d.id,
1652
+ label: m(d.label, d.id),
1653
+ icon: d.icon,
1654
+ target: Er(e, d)
1457
1655
  }))
1458
1656
  }]
1459
- }), e.workbench.layout.registerWidget({
1657
+ }), e.workbench.layout.registerPanel({
1658
+ closable: !1,
1460
1659
  id: a,
1461
1660
  title: "Extensions",
1462
- area: It(n),
1661
+ region: Rr(n),
1463
1662
  rendererId: a,
1464
1663
  singleton: !0
1465
1664
  }));
@@ -1468,108 +1667,114 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1468
1667
  const s = n.action;
1469
1668
  s.kind === "href" && r.push(e.workbench.commands.registerCommand({
1470
1669
  id: `workbench.extension.href.${n.id}`,
1471
- label: u(n.label, n.id)
1670
+ label: m(n.label, n.id)
1472
1671
  }, {
1473
- execute: (a) => e.openHref?.(dr(a)?.href ?? s.href)
1672
+ execute: (a) => e.openHref?.(Cr(a)?.href ?? s.href)
1474
1673
  }));
1475
1674
  }
1476
1675
  return r;
1477
- }, _ = "extension-route", ur = "extensions", fr = (e) => {
1676
+ }, Y = "extension-route", Ar = "extensions", Pr = (e) => {
1478
1677
  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) => ({
1678
+ }, 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
1679
  ...e(r),
1481
1680
  ...t(r)
1482
- }) : e, Se = (e, t) => {
1483
- const r = e.createWebviewHostCapabilities ?? ar({
1681
+ }) : e, Ke = (e, t) => {
1682
+ const r = e.createWebviewHostCapabilities ?? yr({
1484
1683
  executeCommand: e.executeCommand,
1485
1684
  files: e.webviewFiles,
1486
1685
  projectId: e.projectId,
1487
1686
  slotKind: t
1488
1687
  });
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"),
1688
+ return Wr(r, e.createWebviewHostCapabilityOverrides);
1689
+ }, jr = (e, t) => {
1690
+ e.workbench.renderers.getRenderer(W) || t.push(e.workbench.renderers.registerRenderer(bt({
1691
+ createHostCapabilities: Ke(e, "panel"),
1493
1692
  createProps: e.createWebviewProps,
1494
1693
  createTheme: e.createWebviewTheme
1495
1694
  })));
1496
- }, gr = (e, t) => t.commands.map((r) => e.workbench.commands.registerCommand({
1695
+ }, Kr = (e, t) => t.commands.map((r) => e.workbench.commands.registerCommand({
1497
1696
  id: r.id,
1498
- label: u(r.title, r.id),
1499
- description: u(r.description),
1697
+ label: m(r.title, r.id),
1698
+ description: m(r.description),
1500
1699
  params: r.params
1501
1700
  }, {
1502
- execute: (o, n) => R(e, r.id, {
1503
- params: X(o),
1701
+ execute: (o, n) => k(e, r.id, {
1702
+ params: ee(o),
1504
1703
  resource: n?.resource
1505
1704
  })
1506
- })), Pe = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), Ir = (e, t) => e.menuSlotsById ? _t({
1705
+ })), Me = (e, t) => t?.resource ?? e.workbench.getPrimaryResource(), Mr = (e, t) => e.menuSlotsById ? Mt({
1507
1706
  metadata: e.metadata,
1508
1707
  menuSlotsById: e.menuSlotsById,
1509
1708
  menuTargetsById: e.menuTargetsById,
1510
1709
  createWhenExpression: e.createMenuWhenExpression
1511
1710
  }).flatMap((o) => [e.workbench.commands.registerCommand(o.command, {
1512
- execute: (n, s) => R(t, o.targetCommandId, {
1711
+ execute: (n, s) => k(t, o.targetCommandId, {
1513
1712
  params: {
1514
1713
  ...o.contribution.params ?? {},
1515
- ...X(n) ?? {}
1714
+ ...ee(n) ?? {}
1516
1715
  },
1517
- resource: Pe(e, s),
1518
- slot: $({
1716
+ resource: Me(e, s),
1717
+ slot: j({
1519
1718
  id: o.contribution.slotId,
1520
1719
  kind: "menu",
1521
1720
  projectId: e.projectId,
1522
1721
  context: {
1523
- contributionId: o.contribution.id
1722
+ panelId: o.contribution.id
1524
1723
  }
1525
1724
  })
1526
1725
  })
1527
- }), e.workbench.layout.registerMenuItem(o.menuPath, o.menuItem)]) : [], yr = (e, t) => Lt({
1726
+ }), e.workbench.layout.registerMenuItem(o.menuPath, o.menuItem)]) : [], $r = (e, t) => $t({
1528
1727
  metadata: e.metadata
1529
1728
  }).flatMap((o) => [e.workbench.commands.registerCommand(o.command, {
1530
- execute: (n, s) => R(t, o.targetCommandId, {
1729
+ execute: (n, s) => k(t, o.targetCommandId, {
1531
1730
  params: {
1532
1731
  ...o.contribution.params ?? {},
1533
- ...X(n) ?? {}
1732
+ ...ee(n) ?? {}
1534
1733
  },
1535
- resource: Pe(e, s),
1536
- slot: $({
1734
+ resource: Me(e, s),
1735
+ slot: j({
1537
1736
  id: "workbench.commandPalette",
1538
1737
  kind: "menu",
1539
1738
  projectId: e.projectId,
1540
1739
  context: {
1541
- contributionId: o.contribution.id
1740
+ panelId: o.contribution.id
1542
1741
  }
1543
1742
  })
1544
1743
  }),
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
- } : {}
1744
+ isVisible: () => Le(o.contribution.when, e.workbench.getPrimaryResource()?.kind)
1745
+ }), e.workbench.layout.registerMenuItem(Oe, o.menuItem)]), Br = (e) => e.metadata.panels.flatMap((t) => t.webview ? [$({
1746
+ workbench: e.workbench,
1747
+ contribution: {
1748
+ id: t.id,
1749
+ title: m(t.title, t.id),
1750
+ region: t.region,
1751
+ closable: t.closable,
1752
+ rendererId: W,
1753
+ singleton: !0,
1754
+ resourceKinds: t.resourceKind ? [t.resourceKind] : void 0,
1755
+ eligibleLocations: K(t.eligibleLocations),
1756
+ panelMenus: M(t.panelMenus),
1757
+ config: {
1758
+ ...N(t.webview),
1759
+ ...t.region === "overlay" ? {
1760
+ size: "lg",
1761
+ scrollBehavior: "inside",
1762
+ contentHeight: "min(560px, calc(100dvh - 48px))"
1763
+ } : {}
1764
+ }
1560
1765
  }
1561
- })] : []), vr = (e) => {
1562
- const t = [], r = e.settingsSectionId ?? ur;
1766
+ })] : []), Dr = (e) => {
1767
+ const t = [], r = e.settingsSectionId ?? Ar;
1563
1768
  e.workbench.settings.getSection(r) || t.push(e.workbench.settings.registerSection({
1564
1769
  id: r,
1565
1770
  title: e.settingsSectionTitle ?? "Extensions"
1566
1771
  }));
1567
1772
  const o = Object.fromEntries((e.metadata.settingsDefinitions ?? []).map((n) => [n.key, {
1568
1773
  type: n.type,
1569
- scope: hr(n.scope),
1570
- default: br(n.default),
1774
+ scope: Sr(n.scope),
1775
+ default: Tr(n.default),
1571
1776
  enum: n.enum,
1572
- description: u(n.description)
1777
+ description: m(n.description)
1573
1778
  }]));
1574
1779
  Object.keys(o).length > 0 && t.push(e.workbench.preferences.registerSchema({
1575
1780
  properties: o
@@ -1577,21 +1782,21 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1577
1782
  for (const n of e.metadata.settingsPanels)
1578
1783
  t.push(e.workbench.settings.registerPanel({
1579
1784
  id: n.id,
1580
- title: u(n.title, n.id),
1785
+ title: m(n.title, n.id),
1581
1786
  kind: "custom",
1582
1787
  section: r,
1583
1788
  scope: n.scope,
1584
- render: (s) => ye({
1789
+ render: (s) => Ce({
1585
1790
  context: {
1586
1791
  workbench: s.workbench,
1587
1792
  webviewId: n.id,
1588
1793
  placement: {
1589
- ...s.placement,
1590
- contributionId: n.id
1794
+ ...s.instance,
1795
+ panelId: n.id
1591
1796
  },
1592
- hostEvents: Ie(s.workbench, s.placement)
1797
+ hostEvents: Re(s.workbench, s.instance)
1593
1798
  },
1594
- createHostCapabilities: Se(e, "settings"),
1799
+ createHostCapabilities: Ke(e, "settings"),
1595
1800
  createProps: e.createWebviewProps ?? (({
1596
1801
  placement: a
1597
1802
  }) => ({
@@ -1600,129 +1805,130 @@ const lt = (e) => typeof e == "object" && e !== null && "$l10n" in e && typeof e
1600
1805
  })),
1601
1806
  createTheme: e.createWebviewTheme,
1602
1807
  ownerId: n.extensionId,
1603
- title: u(n.title, n.id),
1604
- webview: Q(n.webview)
1808
+ title: m(n.title, n.id),
1809
+ webview: N(n.webview)
1605
1810
  })
1606
1811
  }));
1607
1812
  return t;
1608
- }, Rr = (e) => {
1813
+ }, Hr = (e) => {
1609
1814
  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);
1815
+ for (const o of e.metadata.panels) o.resourceKind && t.add(o.resourceKind);
1816
+ for (const o of e.metadata.kanbanRenderers ?? []) o.resourceKind && t.add(o.resourceKind);
1612
1817
  const r = [];
1613
- for (const o of t)
1818
+ for (const o of t) {
1614
1819
  e.workbench.resources.getKind(o) || r.push(e.workbench.resources.registerKind({
1615
1820
  kind: o,
1616
1821
  label: o,
1617
1822
  icon: "FileText",
1618
1823
  surface: "primary"
1619
- })), r.push(e.workbench.resources.registerOpener({
1824
+ }));
1825
+ const n = e.metadata.panels.filter((s) => s.resourceKind === o && s.region !== "overlay");
1826
+ n.length > 0 && r.push(e.workbench.resources.registerPresenter({
1620
1827
  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
- }))
1828
+ canOpen: (s) => s.kind === o,
1829
+ open: (s) => {
1830
+ const a = n.map((d) => e.workbench.layout.openPanel(d.id, {
1831
+ resource: s,
1832
+ title: s.label ?? s.id ?? s.uri
1833
+ }));
1834
+ return a.find((d, c) => n[c]?.region === "main") ?? a[0];
1835
+ }
1626
1836
  }));
1627
- return r;
1628
- }, Cr = (e, t) => {
1629
- if (t === !0) {
1630
- e.layout.resetAreas();
1631
- return;
1632
1837
  }
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),
1838
+ return r;
1839
+ }, Vr = (e, t) => {
1840
+ t.panel && e.layout.openPanel(t.panel, {
1841
+ region: t.region,
1638
1842
  pinned: t.pinned,
1639
- title: u(t.title)
1843
+ title: m(t.title)
1640
1844
  });
1641
- }, xr = (e, t, r) => {
1845
+ }, Fr = (e, t, r) => {
1642
1846
  if (!r.resource) return;
1643
1847
  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);
1848
+ o && t.resources.openResource(Z(o, e.routeResourceKind ?? Y));
1849
+ }, Lr = (e, t, r) => {
1647
1850
  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({
1851
+ Vr(t, o), Fr(e, t, o);
1852
+ }, Or = (e) => e.metadata.modes.map((t) => e.workbench.modes.registerMode({
1650
1853
  id: t.modeId,
1651
- label: u(t.label, t.modeId),
1652
- activate: (r) => {
1653
- Ar(e, r, t);
1854
+ label: m(t.label, t.modeId),
1855
+ panels: t.layout?.panels,
1856
+ activate: () => {
1857
+ },
1858
+ seed: (r) => {
1859
+ Lr(e, r, t);
1654
1860
  }
1655
- })), _r = (e) => {
1861
+ })), io = (e) => {
1656
1862
  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({
1863
+ 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
1864
  metadata: e.metadata,
1659
- routeResourceKind: e.routeResourceKind ?? _,
1865
+ routeResourceKind: e.routeResourceKind ?? Y,
1660
1866
  workbench: e.workbench
1661
- })), t.push(...mr({
1867
+ })), t.push(...xr({
1662
1868
  metadata: e.metadata,
1663
1869
  openHref: e.openHref,
1664
- routeResourceKind: e.routeResourceKind ?? _,
1870
+ routeResourceKind: e.routeResourceKind ?? Y,
1665
1871
  workbench: e.workbench
1666
- })), t.push(...Rr(e)), t.push(...Wr(e)), {
1872
+ })), t.push(...Hr(e)), t.push(...Or(e)), {
1667
1873
  dispose() {
1668
- fr(t);
1874
+ Pr(t);
1669
1875
  }
1670
1876
  };
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) => {
1877
+ }, 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
1878
  if (t)
1679
1879
  try {
1680
- e.layout.activateWidget(t);
1880
+ e.layout.activatePanel(t);
1681
1881
  } catch {
1682
1882
  }
1683
- }, jr = (e, t) => !Sr(e).has(t), Kr = (e, t) => !Pr(e).has(t), Br = (e, t) => {
1883
+ }, 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
1884
  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, {
1885
+ for (const o of t.panels) {
1886
+ if (!o.webview || o.region === "overlay") continue;
1887
+ const n = ge(e, o.id);
1888
+ n && e.layout.openPanel(o.id, {
1689
1889
  resource: n.resource,
1690
- title: u(o.title, n.title)
1890
+ title: m(o.title, n.title)
1691
1891
  });
1692
1892
  }
1693
1893
  for (const o of t.routes) {
1694
1894
  if (!o.webview) continue;
1695
- const n = ue(e, o.id);
1696
- n && e.layout.openWidget(o.id, {
1895
+ const n = ge(e, o.id);
1896
+ n && e.layout.openPanel(o.id, {
1697
1897
  resource: n.resource,
1698
- title: u(o.label, n.title)
1898
+ title: m(o.label, n.title)
1699
1899
  });
1700
1900
  }
1701
- Tr(e, r);
1702
- }, Lr = (e, t, r) => {
1703
- if (Br(e, t), jr(t, r))
1901
+ qr(e, r);
1902
+ }, ao = (e, t, r) => {
1903
+ if (Yr(e, t), zr(t, r))
1704
1904
  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);
1905
+ if (Qr(t, r))
1906
+ for (const o of t.kanbanRenderers ?? []) e.renderers.refreshKanbanRenderer(o.id);
1907
+ if (Gr(t, r))
1908
+ for (const o of t.dataTableRenderers ?? [])
1909
+ e.renderers.refreshDataTableRenderer(o.id);
1707
1910
  };
1708
1911
  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
1912
+ W as BRIDGE_WEBVIEW_RENDERER_ID,
1913
+ $t as buildWorkbenchExtensionCommandPaletteRegistrations,
1914
+ Mt as buildWorkbenchExtensionMenuRegistrations,
1915
+ so as buildWorkbenchExtensionRouteEntries,
1916
+ bt as createBridgeWebviewRenderer,
1917
+ it as createTerminalSessionCapability,
1918
+ ve as createWorkbenchWebviewHostCapabilities,
1919
+ no as emptyWorkbenchExtensionMetadata,
1920
+ Yr as refreshOpenWorkbenchExtensionWebviews,
1921
+ ao as refreshWorkbenchExtensionContributions,
1922
+ It as registerWorkbenchExtensionCommandPaletteResources,
1923
+ io as registerWorkbenchExtensionContributions,
1924
+ oo as registerWorkbenchExtensionControlsRenderers,
1925
+ Pt as registerWorkbenchExtensionDataTableRenderers,
1926
+ Ft as registerWorkbenchExtensionFileRenderers,
1927
+ dr as registerWorkbenchExtensionKanbanRenderers,
1928
+ $ as registerWorkbenchExtensionPanel,
1929
+ Ir as registerWorkbenchExtensionTreeRenderers,
1930
+ Ce as renderBridgeWebviewFrame,
1931
+ Gr as shouldRefreshWorkbenchExtensionDataTableRenderers,
1932
+ zr as shouldRefreshWorkbenchExtensionTrees
1727
1933
  };
1728
1934
  //# sourceMappingURL=extensions.js.map