@pstdio/workbench 0.36.1 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/extensions.d.ts +5 -7
- package/dist/extensions.js +380 -393
- package/dist/extensions.js.map +1 -1
- package/dist/{file-renderer-view-DKu2l8bT.js → file-renderer-view-B1tNSzpa.js} +2 -2
- package/dist/{file-renderer-view-DKu2l8bT.js.map → file-renderer-view-B1tNSzpa.js.map} +1 -1
- package/dist/{index-DSsmgN2a.d.ts → index-Cl3NI1pb.d.ts} +11 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/{kanban-presentation-BWhkLbw3.d.ts → kanban-presentation-Mb9rbE48.d.ts} +1 -1
- package/dist/navigation-tree-registry-CKB9qsW1.js +102 -0
- package/dist/navigation-tree-registry-CKB9qsW1.js.map +1 -0
- package/dist/{react-BxrTklvM.js → react-Dnt2zZRw.js} +349 -306
- package/dist/react-Dnt2zZRw.js.map +1 -0
- package/dist/react.d.ts +2 -2
- package/dist/react.js +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/webview-runtime.js +1 -1
- package/package.json +3 -3
- package/dist/navigation-tree-registry-CTidmvVs.js +0 -91
- package/dist/navigation-tree-registry-CTidmvVs.js.map +0 -1
- package/dist/react-BxrTklvM.js.map +0 -1
package/dist/react.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Di as CommandParamDescriptor, Gr as WorkbenchFocusRegionId, H as ThemePreferenceOption$1, In as TreeAction, Ir as RegisteredDataTableRendererContribution, Jn as MenuPath, Jr as RegisteredWidgetContribution, M as WorkbenchModuleContribution, O as WorkbenchCore, Ti as Command, Ur as WorkbenchPanelRenderInput, Wt as KeybindingSequence, Xn as RegisteredMenuItem, Zr as WorkbenchPanelInstance, Zt as WorkbenchTerminalController, _t as PreferenceRegistry, fi as WorkbenchRegion$1, gt as PreferencePropertySchema, ji as WorkbenchCommandExecutionContext, k as WorkbenchCoreContributionContext, ki as CommandParamSchema, oa as WorkbenchStore, q as WorkbenchStatusRegistry, qr as RegisteredPlaceholderContribution, sa as Disposable, si as WorkbenchWidgetPlacement, xt as PreferenceValue, yt as PreferenceScope, zi as ResourceRef } from "./index-
|
|
2
|
-
import { a as ReactResourceContextAction, i as ReactKanbanRendererContribution, n as ReactAttributesSource, r as ReactBoardColumnConfig, t as ReactAttributeDescriptor } from "./kanban-presentation-
|
|
1
|
+
import { Di as CommandParamDescriptor, Gr as WorkbenchFocusRegionId, H as ThemePreferenceOption$1, In as TreeAction, Ir as RegisteredDataTableRendererContribution, Jn as MenuPath, Jr as RegisteredWidgetContribution, M as WorkbenchModuleContribution, O as WorkbenchCore, Ti as Command, Ur as WorkbenchPanelRenderInput, Wt as KeybindingSequence, Xn as RegisteredMenuItem, Zr as WorkbenchPanelInstance, Zt as WorkbenchTerminalController, _t as PreferenceRegistry, fi as WorkbenchRegion$1, gt as PreferencePropertySchema, ji as WorkbenchCommandExecutionContext, k as WorkbenchCoreContributionContext, ki as CommandParamSchema, oa as WorkbenchStore, q as WorkbenchStatusRegistry, qr as RegisteredPlaceholderContribution, sa as Disposable, si as WorkbenchWidgetPlacement, xt as PreferenceValue, yt as PreferenceScope, zi as ResourceRef } from "./index-Cl3NI1pb.js";
|
|
2
|
+
import { a as ReactResourceContextAction, i as ReactKanbanRendererContribution, n as ReactAttributesSource, r as ReactBoardColumnConfig, t as ReactAttributeDescriptor } from "./kanban-presentation-Mb9rbE48.js";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
4
|
import { FileIconThemePreferenceOption, ResourceContextAction, ThemePreference, ThemePreferenceOption } from "@pstdio/ui";
|
|
5
5
|
import { FileUploadValue, ParamEditorProps, ParamValue } from "@pstdio/ui/param-editor";
|
package/dist/react.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, b as O, d as k, et as A, f as j, g as M, h as N, i as P, j as F, k as I, l as L, m as R, n as z, nt as B, p as V, q as H, r as U, rt as W, t as G, tt as K, u as q, v as J, w as Y, x as X, y as Z, z as Q } from "./react-
|
|
1
|
+
import { $ as e, A as t, B as n, C as r, D as i, E as a, F as o, G as s, H as c, I as l, J as u, K as d, L as f, M as p, N as m, O as h, P as g, Q as _, R as v, S as y, T as b, U as x, V as S, W as C, X as w, Y as T, Z as E, _ as D, b as O, d as k, et as A, f as j, g as M, h as N, i as P, j as F, k as I, l as L, m as R, n as z, nt as B, p as V, q as H, r as U, rt as W, t as G, tt as K, u as q, v as J, w as Y, x as X, y as Z, z as Q } from "./react-Dnt2zZRw.js";
|
|
2
2
|
export { H as CommandParamField, r as WORKBENCH_SETTINGS_NAV_WIDGET_ID, i as WORKBENCH_SETTINGS_OPEN_COMMAND_ID, Y as WORKBENCH_SETTINGS_PANEL_WIDGET_ID, b as WORKBENCH_SETTINGS_WIDGET_ID, V as WORKBENCH_TERMINAL_OPEN_COMMAND_ID, R as WORKBENCH_TERMINAL_PANEL_SIZE, N as WORKBENCH_TERMINAL_WIDGET_ID, P as Workbench, X as WorkbenchAttachedSidePanel, K as WorkbenchBreadcrumbView, d as WorkbenchCommandPalette, p as WorkbenchDataTableView, y as WorkbenchFloatingSidePanel, s as WorkbenchFocusRegion, x as WorkbenchHeaderActions, W as WorkbenchIcon, n as WorkbenchKeybindingDispatcher, G as WorkbenchModuleHost, l as WorkbenchNotificationHost, L as WorkbenchOverlayLayer, I as WorkbenchPreferencesForm, g as WorkbenchRegion, m as WorkbenchRegionTabs, J as WorkbenchTerminalPanel, k as WorkbenchThemeProvider, q as WorkbenchThemeScope, h as WorkbenchTreeView, o as WorkbenchWidgetHost, O as WorkflowStatusSettings, w as buildCommandParamInitialValues, u as commandParamName, E as createCommandFilesParamValue, Z as createControllerTerminalBridge, Q as createTreeContextMenuItems, S as createWorkbenchHotkeyRegistrations, f as createWorkbenchResourceActions, a as createWorkbenchSettingsModule, M as createWorkbenchTerminalModule, z as disposeWorkbenchModuleHostRegistrations, _ as isCommandFilesParamValue, e as listCommandParamEntries, C as listWorkbenchMenuItems, A as normalizeCommandParamValues, c as normalizeWorkbenchKeybinding, D as openWorkbenchTerminal, t as paramValueToPreference, F as preferenceSchemaToParams, T as readCommandParamValue, U as syncWorkbenchModuleHostRegistrations, v as useWorkbenchResourceActionResolver, B as useWorkbenchStore, j as useWorkbenchThemePreferences };
|
package/dist/storage.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as WorkbenchPersistenceAdapter, Kr as LayoutPersistenceAdapter, Wn as TreeRendererPersistenceAdapter, fn as WorkbenchSidePanelPersistenceAdapter, pn as WorkbenchPanelMenuStatePersistenceAdapter, vn as WorkbenchPageLocationPersistence } from "./index-
|
|
1
|
+
import { I as WorkbenchPersistenceAdapter, Kr as LayoutPersistenceAdapter, Wn as TreeRendererPersistenceAdapter, fn as WorkbenchSidePanelPersistenceAdapter, pn as WorkbenchPanelMenuStatePersistenceAdapter, vn as WorkbenchPageLocationPersistence } from "./index-Cl3NI1pb.js";
|
|
2
2
|
//#region src/storage/local-storage-persistence-helpers.d.ts
|
|
3
3
|
interface WorkbenchStorageLike {
|
|
4
4
|
readonly length?: number;
|
package/dist/webview-runtime.js
CHANGED
|
@@ -27,7 +27,7 @@ var e = "pstdio-extension-mount", t = (e) => e.replaceAll("&", "&").replaceA
|
|
|
27
27
|
${t}
|
|
28
28
|
</body>
|
|
29
29
|
</html>
|
|
30
|
-
`, i = (e) => r(`<script src="${t(e)}"><\/script>`), a = (e) => r(`<script>${n(e)}<\/script>`), o = () => "// Generated by packages/pstdio-extensions/scripts/build-runtime.ts\nfunction re(){let e=globalThis;if(e.window!==void 0&&e.document!==void 0)return\"browser\";if(e.WorkerGlobalScope!==void 0&&e.self!==void 0&&e.self instanceof e.WorkerGlobalScope||e.window===void 0&&e.self!==void 0&&typeof e.importScripts==\"function\")return\"worker\";let t=e.process;if(t&&typeof t==\"object\"){let r=t.versions??{},s=t.release?.name;if(r.bun||s===\"bun\"||e.Bun!==void 0)return\"bun\";if(r.node&&s===\"node\")return\"node\"}return e.Bun===void 0?\"browser\":\"bun\"}function H(){return re()}function z(){return H()===\"worker\"}function B(){let e=H();return e===\"node\"||e===\"bun\"}function ne(){return window.self!==window.top}function se(e){let t={};return function r(s,i=\"\"){Object.keys(s).forEach((n)=>{let o=i?`${i}.${n}`:n;s[n]===Object(s[n])&&r(s[n],o),typeof s[n]==\"function\"&&(t[o]=s[n],delete s[n])})}(e),t}function oe(e){return!e||e===\"null\"?\"*\":e}function ie(e,t,r){if(!e||typeof e!=\"object\")return e;let s=Array.isArray(t)?t:t.split(\".\").map((n)=>n.match(/^\\d+$/)?Number(n):n),i=e;for(let n=0;n<s.length;n++){let o=s[n];n===s.length-1?i[o]=r:((!i[o]||typeof i[o]!=\"object\")&&(i[o]=typeof s[n+1]==\"number\"?[]:{}),i=i[o])}return e}function ae(e=10){let t=\"\";for(let r=0;r<e;r++)t+=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".charAt(Math.floor(Math.random()*62));return t}var V=H(),P=null;if(V===\"node\"||V===\"bun\")try{let e=globalThis.require;P=e?.(\"node:worker_threads\")?.parentPort??null}catch{}function ce(){if(B())return P;if(z())return self;if(ne())return window.parent;throw Error(\"No valid target found for postMessage\")}function C(e,t,r,s){if(!e)throw Error(\"Rimless Error: No target specified for postMessage\");if(B()&&e===P){e.postMessage(t,{transfer:s});return}if(z()){e.postMessage(t,{transfer:s});return}if(e.postMessage){e.postMessage(t,{targetOrigin:oe(r),transfer:s});return}throw Error(\"Rimless Error: Invalid target for postMessage\")}function G(e){return P!==null&&e===P}function L(e,t,r){G(e)?e.on(t,r):(\"addEventListener\"in e)&&e.addEventListener(t,r)}function O(e,t,r){G(e)?e.off(t,r):(\"removeEventListener\"in e)&&e.removeEventListener(t,r)}function N(e){return e.data||e}var b=function(e){return e.MESSAGE=\"message\",e}({}),h=function(e){return e.HANDSHAKE_REQUEST=\"RIMLESS/HANDSHAKE_REQUEST\",e.HANDSHAKE_REPLY=\"RIMLESS/HANDSHAKE_REPLY\",e.RPC_REQUEST=\"RIMLESS/RPC_REQUEST\",e.RPC_RESOLVE=\"RIMLESS/RPC_RESOLVE\",e.RPC_REJECT=\"RIMLESS/RPC_REJECT\",e}({}),S=Symbol();function de(e={},t,r,s,i){let n=[];for(let[o,d]of Object.entries(e)){async function a(u){let{action:E,callID:m,connectionID:f,callName:v,args:w=[]}=N(u);if(E!==h.RPC_REQUEST||!m||!v||v!==o||f!==t)return;let g={action:h.RPC_RESOLVE,callID:m,callName:v,connectionID:f,error:null,result:null},R;try{g.result=await d(...w,i),g.result?.[S]&&(R=g.result[S]??[],delete g.result[S])}catch(A){g.action=h.RPC_REJECT,g.error=JSON.parse(JSON.stringify(A,Object.getOwnPropertyNames(A)))}C(s,g,u?.origin,R)}L(r,b.MESSAGE,a),n.push(()=>O(r,b.MESSAGE,a))}return()=>n.forEach((o)=>o())}function le(e,t,r,s=[],i,n){return(...o)=>new Promise((d,a)=>{let u=ae();function E(v){let{callID:w,connectionID:g,callName:R,result:A,error:te,action:K}=N(v);if(!(!w||!R)&&R===e&&w===u&&g===t){if(K===h.RPC_RESOLVE)return d(A);if(K===h.RPC_REJECT)return a(te)}}let m={action:h.RPC_REQUEST,args:o,callID:u,callName:e,connectionID:t},f=o.reduce((v,w)=>w[S]?.length?v.concat(w[S]):v,o[S]??[]);L(i,b.MESSAGE,E),s.push(()=>O(i,b.MESSAGE,E)),C(n,m,r?.origin,f)})}function fe(e={},t=[],r,s,i,n){let o={...e},d=[];for(let a of t)ie(o,a,le(a,r,s,d,i,n));return{remote:o,unregisterRemote:()=>d.forEach((a)=>a())}}function pe(e={},t){return new Promise(async(r)=>{let s=se(e),i=ce(),n=self||window;async function o(d){let a=N(d);if(a?.action!==h.HANDSHAKE_REPLY)return;let{remote:u,unregisterRemote:E}=fe(a.schema,a.methodNames,a.connectionID,d,n,i),m=de(s,a.connectionID,n,i,u);return await t?.onConnectionSetup?.(u),C(i,{action:h.HANDSHAKE_REPLY,connectionID:a.connectionID},d?.origin),r({remote:u,close:()=>{O(n,b.MESSAGE,o),E(),m()},id:a.connectionID})}L(n,b.MESSAGE,o),C(i,{action:h.HANDSHAKE_REQUEST,methodNames:Object.keys(s),schema:e})})}var J={connect:pe};var ue=(e)=>typeof e===\"object\"&&e!==null,q=(e)=>{try{let t=JSON.stringify(e);if(typeof t===\"string\"&&t.length>0)return t}catch{}try{return String(e)}catch{return\"Unknown error\"}},j=(e)=>{if(e instanceof Error)return{message:e.message,stack:e.stack};if(typeof e===\"string\")return{message:e};if(ue(e)){let t=typeof e.message===\"string\"?e.message:null,r=typeof e.stack===\"string\"?e.stack:void 0;if(t)return r?{message:t,stack:r}:{message:t};return{message:q(e)}}if(e===null||e===void 0)return{message:\"Unknown error\"};return{message:q(e)}};var M=\"(?:0|[1-9]\\\\d*)\",Y=`(?:${M}|\\\\d*[A-Za-z-][0-9A-Za-z-]*)`,xe=new RegExp(`^${M}\\\\.${M}\\\\.${M}(?:-${Y}(?:\\\\.${Y})*)?(?:\\\\+[0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*)?$`),_=[\"sidenav\",\"main\",\"secondary\",\"side\"];var p=(e,t)=>({extensionId:\"pstdio\",kind:e,id:t}),y={project:p(\"mode\",\"project\"),sessions:p(\"mode\",\"sessions\"),settings:p(\"mode\",\"settings\")},Ae={project:{ref:y.project,regions:_},sessions:{ref:y.sessions,regions:_},settings:{ref:y.settings,regions:_}},U=(e,t,r)=>({id:e,ref:p(\"resource-kind\",e),label:t,menuSlots:r}),D=[{id:\"headerPrimary\",placement:\"header-primary\",access:\"public\"},{id:\"headerOverflow\",placement:\"header-overflow\",access:\"public\"}],W={project:U(\"project\",\"Extension\",D),session:U(\"session\",\"Session\",D),workspace:U(\"workspace\",\"Workspace\",D)},k={project:W.project.ref,session:W.session.ref,workspace:W.workspace.ref},x={start:p(\"page\",\"start\"),sessions:p(\"page\",\"sessions\"),session:p(\"page\",\"session\"),workspaces:p(\"page\",\"workspaces\"),workspace:p(\"page\",\"workspace\")},Ce={start:{ref:x.start,mode:y.project,path:\"\",primary:{cardinality:\"one\",resourceKinds:[]}},sessions:{ref:x.sessions,mode:y.sessions,path:\"sessions\",primary:{cardinality:\"one\",resourceKinds:[]}},session:{ref:x.session,mode:y.sessions,path:\"session\",primary:{cardinality:\"one\",resourceKinds:[\"session\",\"session-draft\"]}},workspaces:{ref:x.workspaces,mode:y.project,path:\"workspaces\",primary:{cardinality:\"one\",resourceKinds:[]}},workspace:{ref:x.workspace,mode:y.project,path:\"workspace\",primary:{cardinality:\"many\",resourceKinds:[\"workspace\"]}}},me={projectSession:p(\"placement\",\"project-session\")},je={projectSession:{ref:me.projectSession,mode:y.project,cardinality:\"many\",resourceKinds:[\"session\",\"session-draft\"]}},Me={projectSettings:p(\"settings-panel\",\"project.settings\"),statusBarLeading:p(\"status-bar-item\",\"status-bar.leading\"),statusBarTrailing:p(\"status-bar-item\",\"status-bar.trailing\")};var Q=(e)=>({...e,kind:\"command\"}),Te=Object.assign(Q,{forExtension:(e)=>(t)=>Q({extensionId:`${e.publisher}.${e.name}`,id:t})}),ge=(e)=>({...e,kind:\"event\"}),T=(e,t)=>({id:e,kind:t.kind,label:t.label,description:t.description,metadata:t.metadata}),l=(e)=>ge({extensionId:\"pstdio\",id:e}),I=(e,t)=>T(`${e.id}.${t}`,{kind:\"menu\"}),$e={sidenav:T(\"project.sidenav\",{kind:\"panel\"}),headerPrimary:I(k.project,\"headerPrimary\"),headerOverflow:I(k.project,\"headerOverflow\"),settingsPanels:T(\"project.settingsPanels\",{kind:\"settings\"})},He={headerPrimary:I(k.session,\"headerPrimary\"),headerOverflow:I(k.session,\"headerOverflow\")},Le={headerPrimary:I(k.workspace,\"headerPrimary\"),headerOverflow:I(k.workspace,\"headerOverflow\"),sidenav:T(\"workspace.sidenav\",{kind:\"panel\"})},Oe={opened:l(\"project.opened\")},Ne={sessionsChanged:l(\"view.sessions.changed\"),workspacesChanged:l(\"view.workspaces.changed\"),repositoriesChanged:l(\"view.repositories.changed\")},_e={started:l(\"session.started\"),resumed:l(\"session.resumed\"),awaitingInput:l(\"session.awaitingInput\"),succeeded:l(\"session.succeeded\"),failed:l(\"session.failed\"),completed:l(\"session.completed\")},Ue={created:l(\"workspace.created\"),provision:l(\"workspace.provision\"),ready:l(\"workspace.ready\"),archived:l(\"workspace.archived\"),deleted:l(\"workspace.deleted\")},De={removed:l(\"worktree.removed\")},We={committed:l(\"git.committed\"),rebased:l(\"git.rebased\"),merged:l(\"git.merged\"),conflicted:l(\"git.conflicted\")};var he=[\"commands.execute\",\"navigation.open\",\"placement.close\",\"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\"],ye=[\"artifacts.read\"],Ee=[\"host.dispatchKeyboardEvent\"],Ke=[...he,...ye,...Ee];var c=(e)=>(t)=>({...t,ref:{kind:e,id:t.id}}),Ve=c(\"view\"),ze=c(\"view-menu\"),Be=c(\"placement\"),Ge=c(\"resource-kind\");var Je=c(\"navigation-item\"),qe=c(\"navigation-tree\"),Ye=c(\"mode\");var Qe=c(\"status-bar-item\"),Fe=c(\"status\"),Ze=c(\"settings-panel\"),Xe=c(\"activity-item\"),et=c(\"settings-section\"),tt=c(\"command-palette-resource\"),rt=c(\"keybinding\"),nt=c(\"schedule\"),st=c(\"artifact-mount\"),ot=c(\"template-type\"),it=c(\"template\"),at=c(\"skill\"),ct=c(\"theme\"),dt=c(\"file-icon-theme\"),lt=c(\"workspace-type\"),ft=c(\"harness\"),pt=c(\"connection\");var F=(e,t,r)=>({call:async(s,...i)=>{try{return await e({method:s,params:i[0]})}catch(n){if(n instanceof Error)throw n;throw Error(j(n).message)}},onEvent:t,extensionId:r}),Z=(e)=>{let t=e,r=new Set;return{get:()=>t,subscribe:(s)=>(r.add(s),()=>r.delete(s)),set:(s)=>{t=s;for(let i of r)i(t)}}};var X=\"pstdio-extension-mount\",ve=()=>{let e=new Map;return{get length(){return e.size},clear:()=>e.clear(),getItem:(t)=>e.get(t)??null,key:(t)=>Array.from(e.keys())[t]??null,removeItem:(t)=>e.delete(t),setItem:(t,r)=>e.set(t,r)}},we=()=>{for(let e of[\"localStorage\",\"sessionStorage\"])try{window[e]}catch{Object.defineProperty(window,e,{configurable:!0,value:ve()})}},ee=(e,t)=>{let r=document.documentElement,s=e===\"dark\"?\"light\":\"dark\";r.classList.remove(s),r.classList.add(e),r.setAttribute(\"data-theme\",e),r.style.colorScheme=e;for(let[i,n]of Object.entries(t))if(i.startsWith(\"--\"))r.style.setProperty(i,n)},Se=(e)=>{for(let t of e){let r=document.createElement(\"link\");r.rel=\"stylesheet\",r.href=t,document.head.appendChild(r)}},be=()=>{let e=document.getElementById(X);if(!e)e=document.createElement(\"div\"),e.id=X,e.style.height=\"100%\",e.style.width=\"100%\",document.body.appendChild(e);return e},ke=(e)=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable,Ie=async()=>{we();let e=Z(void 0),t=new Map,r=(o,d)=>{let a=t.get(o)??new Set;return a.add(d),t.set(o,a),()=>{a.delete(d)}},s,i=!1,n=await J.connect({init:async(o)=>{try{ee(o.theme,o.themeVariables),Se(o.styles),e.set(o.props);let d=be(),a=await import(o.moduleUrl),u=a.default??(a.mount?a:void 0);if(!u?.mount)throw Error(\"Extension module does not export a default view (defineExtensionView).\");let E=F((f)=>n.remote.call(f),r,o.extensionId),m=await u.mount(d,E,e);if(s=typeof m===\"function\"?m:void 0,!i)i=!0,document.addEventListener(\"keydown\",(f)=>{if(!f.ctrlKey&&!f.metaKey&&!f.altKey)return;if(ke(f.target)&&!f.shiftKey)return;n.remote.call({method:\"host.dispatchKeyboardEvent\",params:{key:f.key,code:f.code,ctrlKey:f.ctrlKey,metaKey:f.metaKey,altKey:f.altKey,shiftKey:f.shiftKey,repeat:f.repeat}}).catch(()=>{})},!0)}catch(d){let a=j(d);throw n.remote.runtimeError(a),d instanceof Error?d:Error(a.message)}},themeUpdate:(o)=>{ee(o.theme,o.variables)},propsUpdate:(o)=>{e.set(o.props)},hostEvent:(o)=>{for(let d of t.get(o.scope)??[])d(o.payload)}});n.remote.ready({}),window.addEventListener(\"beforeunload\",()=>{s?.()})};Ie();\n";
|
|
30
|
+
`, i = (e) => r(`<script src="${t(e)}"><\/script>`), a = (e) => r(`<script>${n(e)}<\/script>`), o = () => "// Generated by packages/pstdio-extensions/scripts/build-runtime.ts\nfunction re(){let e=globalThis;if(e.window!==void 0&&e.document!==void 0)return\"browser\";if(e.WorkerGlobalScope!==void 0&&e.self!==void 0&&e.self instanceof e.WorkerGlobalScope||e.window===void 0&&e.self!==void 0&&typeof e.importScripts==\"function\")return\"worker\";let t=e.process;if(t&&typeof t==\"object\"){let r=t.versions??{},s=t.release?.name;if(r.bun||s===\"bun\"||e.Bun!==void 0)return\"bun\";if(r.node&&s===\"node\")return\"node\"}return e.Bun===void 0?\"browser\":\"bun\"}function H(){return re()}function z(){return H()===\"worker\"}function B(){let e=H();return e===\"node\"||e===\"bun\"}function ne(){return window.self!==window.top}function se(e){let t={};return function r(s,i=\"\"){Object.keys(s).forEach((n)=>{let o=i?`${i}.${n}`:n;s[n]===Object(s[n])&&r(s[n],o),typeof s[n]==\"function\"&&(t[o]=s[n],delete s[n])})}(e),t}function oe(e){return!e||e===\"null\"?\"*\":e}function ie(e,t,r){if(!e||typeof e!=\"object\")return e;let s=Array.isArray(t)?t:t.split(\".\").map((n)=>n.match(/^\\d+$/)?Number(n):n),i=e;for(let n=0;n<s.length;n++){let o=s[n];n===s.length-1?i[o]=r:((!i[o]||typeof i[o]!=\"object\")&&(i[o]=typeof s[n+1]==\"number\"?[]:{}),i=i[o])}return e}function ae(e=10){let t=\"\";for(let r=0;r<e;r++)t+=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\".charAt(Math.floor(Math.random()*62));return t}var V=H(),x=null;if(V===\"node\"||V===\"bun\")try{let e=globalThis.require;x=e?.(\"node:worker_threads\")?.parentPort??null}catch{}function ce(){if(B())return x;if(z())return self;if(ne())return window.parent;throw Error(\"No valid target found for postMessage\")}function C(e,t,r,s){if(!e)throw Error(\"Rimless Error: No target specified for postMessage\");if(B()&&e===x){e.postMessage(t,{transfer:s});return}if(z()){e.postMessage(t,{transfer:s});return}if(e.postMessage){e.postMessage(t,{targetOrigin:oe(r),transfer:s});return}throw Error(\"Rimless Error: Invalid target for postMessage\")}function G(e){return x!==null&&e===x}function L(e,t,r){G(e)?e.on(t,r):(\"addEventListener\"in e)&&e.addEventListener(t,r)}function O(e,t,r){G(e)?e.off(t,r):(\"removeEventListener\"in e)&&e.removeEventListener(t,r)}function N(e){return e.data||e}var b=function(e){return e.MESSAGE=\"message\",e}({}),y=function(e){return e.HANDSHAKE_REQUEST=\"RIMLESS/HANDSHAKE_REQUEST\",e.HANDSHAKE_REPLY=\"RIMLESS/HANDSHAKE_REPLY\",e.RPC_REQUEST=\"RIMLESS/RPC_REQUEST\",e.RPC_RESOLVE=\"RIMLESS/RPC_RESOLVE\",e.RPC_REJECT=\"RIMLESS/RPC_REJECT\",e}({}),S=Symbol();function de(e={},t,r,s,i){let n=[];for(let[o,d]of Object.entries(e)){async function a(u){let{action:E,callID:m,connectionID:f,callName:v,args:w=[]}=N(u);if(E!==y.RPC_REQUEST||!m||!v||v!==o||f!==t)return;let g={action:y.RPC_RESOLVE,callID:m,callName:v,connectionID:f,error:null,result:null},R;try{g.result=await d(...w,i),g.result?.[S]&&(R=g.result[S]??[],delete g.result[S])}catch(A){g.action=y.RPC_REJECT,g.error=JSON.parse(JSON.stringify(A,Object.getOwnPropertyNames(A)))}C(s,g,u?.origin,R)}L(r,b.MESSAGE,a),n.push(()=>O(r,b.MESSAGE,a))}return()=>n.forEach((o)=>o())}function le(e,t,r,s=[],i,n){return(...o)=>new Promise((d,a)=>{let u=ae();function E(v){let{callID:w,connectionID:g,callName:R,result:A,error:te,action:W}=N(v);if(!(!w||!R)&&R===e&&w===u&&g===t){if(W===y.RPC_RESOLVE)return d(A);if(W===y.RPC_REJECT)return a(te)}}let m={action:y.RPC_REQUEST,args:o,callID:u,callName:e,connectionID:t},f=o.reduce((v,w)=>w[S]?.length?v.concat(w[S]):v,o[S]??[]);L(i,b.MESSAGE,E),s.push(()=>O(i,b.MESSAGE,E)),C(n,m,r?.origin,f)})}function fe(e={},t=[],r,s,i,n){let o={...e},d=[];for(let a of t)ie(o,a,le(a,r,s,d,i,n));return{remote:o,unregisterRemote:()=>d.forEach((a)=>a())}}function pe(e={},t){return new Promise(async(r)=>{let s=se(e),i=ce(),n=self||window;async function o(d){let a=N(d);if(a?.action!==y.HANDSHAKE_REPLY)return;let{remote:u,unregisterRemote:E}=fe(a.schema,a.methodNames,a.connectionID,d,n,i),m=de(s,a.connectionID,n,i,u);return await t?.onConnectionSetup?.(u),C(i,{action:y.HANDSHAKE_REPLY,connectionID:a.connectionID},d?.origin),r({remote:u,close:()=>{O(n,b.MESSAGE,o),E(),m()},id:a.connectionID})}L(n,b.MESSAGE,o),C(i,{action:y.HANDSHAKE_REQUEST,methodNames:Object.keys(s),schema:e})})}var J={connect:pe};var ue=(e)=>typeof e===\"object\"&&e!==null,q=(e)=>{try{let t=JSON.stringify(e);if(typeof t===\"string\"&&t.length>0)return t}catch{}try{return String(e)}catch{return\"Unknown error\"}},M=(e)=>{if(e instanceof Error)return{message:e.message,stack:e.stack};if(typeof e===\"string\")return{message:e};if(ue(e)){let t=typeof e.message===\"string\"?e.message:null,r=typeof e.stack===\"string\"?e.stack:void 0;if(t)return r?{message:t,stack:r}:{message:t};return{message:q(e)}}if(e===null||e===void 0)return{message:\"Unknown error\"};return{message:q(e)}};var j=\"(?:0|[1-9]\\\\d*)\",Y=`(?:${j}|\\\\d*[A-Za-z-][0-9A-Za-z-]*)`,Pe=new RegExp(`^${j}\\\\.${j}\\\\.${j}(?:-${Y}(?:\\\\.${Y})*)?(?:\\\\+[0-9A-Za-z-]+(?:\\\\.[0-9A-Za-z-]+)*)?$`),U=[\"sidenav\",\"main\",\"secondary\",\"side\"];var p=(e,t)=>({extensionId:\"pstdio\",kind:e,id:t}),h={project:p(\"mode\",\"project\"),sessions:p(\"mode\",\"sessions\"),settings:p(\"mode\",\"settings\")},Ae={project:{ref:h.project,regions:U},sessions:{ref:h.sessions,regions:U},settings:{ref:h.settings,regions:U}},_=(e,t,r)=>({id:e,ref:p(\"resource-kind\",e),label:t,menuSlots:r}),K=[{id:\"headerPrimary\",placement:\"header-primary\",access:\"public\"},{id:\"headerOverflow\",placement:\"header-overflow\",access:\"public\"}],D={project:_(\"project\",\"Extension\",K),session:_(\"session\",\"Session\",K),workspace:_(\"workspace\",\"Workspace\",K)},k={project:D.project.ref,session:D.session.ref,workspace:D.workspace.ref},P={start:p(\"page\",\"start\"),sessions:p(\"page\",\"sessions\"),session:p(\"page\",\"session\"),workspaces:p(\"page\",\"workspaces\"),workspace:p(\"page\",\"workspace\")},Ce={start:{ref:P.start,mode:h.project,path:\"\",primary:{cardinality:\"one\",resourceKinds:[]}},sessions:{ref:P.sessions,mode:h.sessions,path:\"sessions\",primary:{cardinality:\"one\",resourceKinds:[]}},session:{ref:P.session,mode:h.sessions,path:\"session\",primary:{cardinality:\"one\",resourceKinds:[\"session\",\"session-draft\"]}},workspaces:{ref:P.workspaces,mode:h.project,path:\"workspaces\",primary:{cardinality:\"one\",resourceKinds:[]}},workspace:{ref:P.workspace,mode:h.project,path:\"workspace\",primary:{cardinality:\"many\",resourceKinds:[\"workspace\"]}}},me={projectSession:p(\"placement\",\"project-session\")},Me={projectSession:{ref:me.projectSession,mode:h.project,cardinality:\"many\",resourceKinds:[\"session\",\"session-draft\"]}},je={projectSettings:p(\"settings-panel\",\"project.settings\"),statusBarLeading:p(\"status-bar-item\",\"status-bar.leading\"),statusBarTrailing:p(\"status-bar-item\",\"status-bar.trailing\")};var Q=(e)=>({...e,kind:\"command\"}),Te=Object.assign(Q,{forExtension:(e)=>(t)=>Q({extensionId:`${e.publisher}.${e.name}`,id:t})}),ge=(e)=>({...e,kind:\"event\"}),T=(e,t)=>({id:e,kind:t.kind,label:t.label,description:t.description,metadata:t.metadata}),l=(e)=>ge({extensionId:\"pstdio\",id:e}),I=(e,t)=>T(`${e.id}.${t}`,{kind:\"menu\"}),$e={sidenav:T(\"project.sidenav\",{kind:\"panel\"}),headerPrimary:I(k.project,\"headerPrimary\"),headerOverflow:I(k.project,\"headerOverflow\"),settingsPanels:T(\"project.settingsPanels\",{kind:\"settings\"})},He={headerPrimary:I(k.session,\"headerPrimary\"),headerOverflow:I(k.session,\"headerOverflow\")},Le={headerPrimary:I(k.workspace,\"headerPrimary\"),headerOverflow:I(k.workspace,\"headerOverflow\"),sidenav:T(\"workspace.sidenav\",{kind:\"panel\"})},Oe={opened:l(\"project.opened\")},Ne={sessionsChanged:l(\"view.sessions.changed\"),workspacesChanged:l(\"view.workspaces.changed\"),repositoriesChanged:l(\"view.repositories.changed\")},Ue={started:l(\"session.started\"),resumed:l(\"session.resumed\"),awaitingInput:l(\"session.awaitingInput\"),succeeded:l(\"session.succeeded\"),failed:l(\"session.failed\"),completed:l(\"session.completed\")},_e={created:l(\"workspace.created\"),provision:l(\"workspace.provision\"),ready:l(\"workspace.ready\"),archived:l(\"workspace.archived\"),deleted:l(\"workspace.deleted\")},Ke={removed:l(\"worktree.removed\")},De={committed:l(\"git.committed\"),rebased:l(\"git.rebased\"),merged:l(\"git.merged\"),conflicted:l(\"git.conflicted\")};var ye=[\"clipboard.write\",\"commands.execute\",\"navigation.open\",\"placement.close\",\"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=[\"artifacts.read\"],Ee=[\"host.dispatchKeyboardEvent\"],We=[...ye.filter((e)=>e!==\"clipboard.write\"),...he,...Ee];var c=(e)=>(t)=>({...t,ref:{kind:e,id:t.id}}),Ve=c(\"view\"),ze=c(\"view-menu\"),Be=c(\"placement\"),Ge=c(\"resource-kind\");var Je=c(\"navigation-item\"),qe=c(\"navigation-tree\"),Ye=c(\"mode\");var Qe=c(\"status-bar-item\"),Fe=c(\"status\"),Ze=c(\"settings-panel\"),Xe=c(\"activity-item\"),et=c(\"settings-section\"),tt=c(\"command-palette-resource\"),rt=c(\"keybinding\"),nt=c(\"schedule\"),st=c(\"artifact-mount\"),ot=c(\"template-type\"),it=c(\"template\"),at=c(\"skill\"),ct=c(\"theme\"),dt=c(\"file-icon-theme\"),lt=c(\"workspace-type\"),ft=c(\"harness\"),pt=c(\"connection\");var F=(e,t,r)=>({call:async(s,...i)=>{try{return await e({method:s,params:i[0]})}catch(n){if(n instanceof Error)throw n;throw Error(M(n).message)}},onEvent:t,extensionId:r}),Z=(e)=>{let t=e,r=new Set;return{get:()=>t,subscribe:(s)=>(r.add(s),()=>r.delete(s)),set:(s)=>{t=s;for(let i of r)i(t)}}};var X=\"pstdio-extension-mount\",ve=()=>{let e=new Map;return{get length(){return e.size},clear:()=>e.clear(),getItem:(t)=>e.get(t)??null,key:(t)=>Array.from(e.keys())[t]??null,removeItem:(t)=>e.delete(t),setItem:(t,r)=>e.set(t,r)}},we=()=>{for(let e of[\"localStorage\",\"sessionStorage\"])try{window[e]}catch{Object.defineProperty(window,e,{configurable:!0,value:ve()})}},ee=(e,t)=>{let r=document.documentElement,s=e===\"dark\"?\"light\":\"dark\";r.classList.remove(s),r.classList.add(e),r.setAttribute(\"data-theme\",e),r.style.colorScheme=e;for(let[i,n]of Object.entries(t))if(i.startsWith(\"--\"))r.style.setProperty(i,n)},Se=(e)=>{for(let t of e){let r=document.createElement(\"link\");r.rel=\"stylesheet\",r.href=t,document.head.appendChild(r)}},be=()=>{let e=document.getElementById(X);if(!e)e=document.createElement(\"div\"),e.id=X,e.style.height=\"100%\",e.style.width=\"100%\",document.body.appendChild(e);return e},ke=(e)=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable,Ie=async()=>{we();let e=Z(void 0),t=new Map,r=(o,d)=>{let a=t.get(o)??new Set;return a.add(d),t.set(o,a),()=>{a.delete(d)}},s,i=!1,n=await J.connect({init:async(o)=>{try{ee(o.theme,o.themeVariables),Se(o.styles),e.set(o.props);let d=be(),a=await import(o.moduleUrl),u=a.default??(a.mount?a:void 0);if(!u?.mount)throw Error(\"Extension module does not export a default view (defineExtensionView).\");let E=F((f)=>n.remote.call(f),r,o.extensionId),m=await u.mount(d,E,e);if(s=typeof m===\"function\"?m:void 0,!i)i=!0,document.addEventListener(\"keydown\",(f)=>{if(!f.ctrlKey&&!f.metaKey&&!f.altKey)return;if(ke(f.target)&&!f.shiftKey)return;n.remote.call({method:\"host.dispatchKeyboardEvent\",params:{key:f.key,code:f.code,ctrlKey:f.ctrlKey,metaKey:f.metaKey,altKey:f.altKey,shiftKey:f.shiftKey,repeat:f.repeat}}).catch(()=>{})},!0)}catch(d){let a=M(d);throw n.remote.runtimeError(a),d instanceof Error?d:Error(a.message)}},themeUpdate:(o)=>{ee(o.theme,o.variables)},propsUpdate:(o)=>{e.set(o.props)},hostEvent:(o)=>{for(let d of t.get(o.scope)??[])d(o.payload)}});n.remote.ready({}),window.addEventListener(\"beforeunload\",()=>{s?.()})};Ie();\n";
|
|
31
31
|
//#endregion
|
|
32
32
|
export { o as getExtensionRuntimeScript, i as renderExtensionRuntimeHtml, a as renderInlineExtensionRuntimeHtml };
|
|
33
33
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pstdio/workbench",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/pufflyai/prompt-studio"
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"@dnd-kit/core": "^6.3.1",
|
|
46
46
|
"@dnd-kit/sortable": "^10.0.0",
|
|
47
47
|
"@dnd-kit/utilities": "^3.2.2",
|
|
48
|
-
"@pstdio/sdk": "^0.
|
|
49
|
-
"@pstdio/ui": "^0.
|
|
48
|
+
"@pstdio/sdk": "^0.38.0",
|
|
49
|
+
"@pstdio/ui": "^0.38.0",
|
|
50
50
|
"@tanstack/react-hotkeys": "0.10.0",
|
|
51
51
|
"lucide-react": "^0.556.0",
|
|
52
52
|
"rimless": "0.8.2",
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { yt as e } from "./workbench-renderers-RPeMVtTc.js";
|
|
2
|
-
//#region src/core/registries/navigation/navigation-tree-registry.ts
|
|
3
|
-
var t = "navigation.root", n = (e) => `${e.kind}:${e.extensionId}:${e.id}`, r = (e, t) => n(e) === n(t), i = (e) => (t, n) => {
|
|
4
|
-
let r = t.sourceExtensionId === e.extensionId;
|
|
5
|
-
if (r !== (n.sourceExtensionId === e.extensionId)) return r ? -1 : 1;
|
|
6
|
-
if (!r) {
|
|
7
|
-
let e = t.sourceExtensionId.localeCompare(n.sourceExtensionId);
|
|
8
|
-
if (e !== 0) return e;
|
|
9
|
-
}
|
|
10
|
-
return t.declarationIndex - n.declarationIndex || t.id.localeCompare(n.id);
|
|
11
|
-
}, a = (e, t) => e ? `${e}:${t}` : t, o = (e, t) => {
|
|
12
|
-
let n = e.findIndex((e) => e.id === t.id);
|
|
13
|
-
if (n < 0) {
|
|
14
|
-
e.push(t);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
let r = e[n];
|
|
18
|
-
e[n] = {
|
|
19
|
-
...r,
|
|
20
|
-
nodes: [...r.nodes, ...t.nodes]
|
|
21
|
-
};
|
|
22
|
-
}, s = (s = {}) => {
|
|
23
|
-
let c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Set(), d = () => {
|
|
24
|
-
for (let e of u) e();
|
|
25
|
-
}, f = (e, t) => [...c.values()].filter((n) => r(n.owner, e) && (n.slot ?? "content") === t).sort(i(e)), p = (e, t, n) => {
|
|
26
|
-
let r = {
|
|
27
|
-
...e,
|
|
28
|
-
id: a(t.idScope, e.id),
|
|
29
|
-
moveScope: n,
|
|
30
|
-
canHide: e.canHide ?? !0,
|
|
31
|
-
canReorder: e.canReorder ?? !0,
|
|
32
|
-
children: e.children?.map((e) => p(e, t, n))
|
|
33
|
-
};
|
|
34
|
-
return l.set(r, {
|
|
35
|
-
contribution: t,
|
|
36
|
-
node: e
|
|
37
|
-
}), r;
|
|
38
|
-
}, m = (e, r, i) => ({
|
|
39
|
-
...e,
|
|
40
|
-
id: r.sourceExtensionId !== i.extensionId && !e.label ? t : a(r.idScope, e.id),
|
|
41
|
-
moveScope: n(i),
|
|
42
|
-
canHide: e.canHide ?? !0,
|
|
43
|
-
canReorder: e.canReorder ?? !0,
|
|
44
|
-
nodes: e.nodes.map((e) => p(e, r, n(i)))
|
|
45
|
-
});
|
|
46
|
-
return {
|
|
47
|
-
registerContribution(t) {
|
|
48
|
-
if (c.has(t.id)) throw Error(`Navigation tree contribution already registered: ${t.id}`);
|
|
49
|
-
if (!t.viewId && !t.getSections) throw Error(`Navigation tree contribution must declare a viewId or getSections: ${t.id}`);
|
|
50
|
-
c.set(t.id, t);
|
|
51
|
-
let n = t.viewId ? s.subscribeViewRefresh?.(t.viewId, d) : void 0;
|
|
52
|
-
return d(), e(() => {
|
|
53
|
-
c.get(t.id) === t && (n?.dispose(), c.delete(t.id), d());
|
|
54
|
-
});
|
|
55
|
-
},
|
|
56
|
-
resolveOwner(e, t) {
|
|
57
|
-
return [...c.values()].find((n) => n.owner.kind === e && n.owner.id === t)?.owner;
|
|
58
|
-
},
|
|
59
|
-
async getSections(e, t = "content", n = {}) {
|
|
60
|
-
let r = [];
|
|
61
|
-
for (let i of f(e, t)) {
|
|
62
|
-
n.signal?.throwIfAborted();
|
|
63
|
-
let t = i.viewId ? await s.getViewSections?.(i.viewId, n) : await i.getSections?.(n);
|
|
64
|
-
n.signal?.throwIfAborted();
|
|
65
|
-
for (let n of t ?? []) o(r, m(n, i, e));
|
|
66
|
-
}
|
|
67
|
-
return r;
|
|
68
|
-
},
|
|
69
|
-
async getChildren(e, t = {}) {
|
|
70
|
-
t.signal?.throwIfAborted();
|
|
71
|
-
let r = l.get(e);
|
|
72
|
-
if (!r) return e.children ?? [];
|
|
73
|
-
let i = e.moveScope ?? n(r.contribution.owner), a = r.contribution.viewId ? await s.getViewChildren?.(r.contribution.viewId, r.node, t) : await r.contribution.getChildren?.(r.node, t);
|
|
74
|
-
return a ? a.map((e) => p(e, r.contribution, i)) : e.children ?? [];
|
|
75
|
-
},
|
|
76
|
-
getDefaultExpandedSectionIds(e) {
|
|
77
|
-
return [
|
|
78
|
-
"header",
|
|
79
|
-
"content",
|
|
80
|
-
"footer"
|
|
81
|
-
].flatMap((t) => f(e, t).flatMap((e) => (e.defaultExpandedSectionIds ?? (e.viewId ? s.getViewDefaultExpandedSectionIds?.(e.viewId) : void 0) ?? []).map((t) => a(e.idScope, t))));
|
|
82
|
-
},
|
|
83
|
-
onDidChange(t) {
|
|
84
|
-
return u.add(t), e(() => u.delete(t));
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
//#endregion
|
|
89
|
-
export { t as n, s as t };
|
|
90
|
-
|
|
91
|
-
//# sourceMappingURL=navigation-tree-registry-CTidmvVs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-tree-registry-CTidmvVs.js","names":["createDisposable","Disposable","TreeNode","TreeViewSection","ResourceRef","NavigationTreeSlot","NavigationTreeOwner","kind","id","extensionId","NavigationTreeContext","resource","signal","AbortSignal","NavigationTreeContribution","idScope","owner","sourceExtensionId","declarationIndex","slot","viewId","defaultExpandedSectionIds","getSections","context","Promise","getChildren","node","CreateNavigationTreeRegistryInput","subscribeViewRefresh","listener","getViewDefaultExpandedSectionIds","getViewSections","getViewChildren","NavigationTreeRegistry","registerContribution","contribution","resolveOwner","getDefaultExpandedSectionIds","onDidChange","navigationRootSectionId","ownerId","ownersEqual","left","right","contributionOrder","leftOwn","rightOwn","extensionOrder","localeCompare","scopedId","scope","mergeSection","sections","section","index","findIndex","candidate","push","current","nodes","createNavigationTreeRegistry","input","contributions","Map","nodeSources","WeakMap","listeners","Set","emit","matching","values","filter","sort","projectNode","moveScope","projected","canHide","canReorder","children","map","child","set","projectSection","label","has","Error","refreshSubscription","undefined","get","dispose","delete","find","throwIfAborted","sourceSections","source","const","flatMap","add","createDisposable","navigationRootSectionId","ownerId","owner","ownersEqual","left","right","contributionOrder","leftOwn","extensionOrder","scopedId","scope","id","mergeSection","index","sections","candidate","section","current","createNavigationTreeRegistry","contributions","nodeSources","listeners","emit","listener","matching","contribution","slot","projectNode","projected","node","child","moveScope","projectSection","refreshSubscription","input","kind","sourceSections","context","source","children"],"sources":["../src/core/registries/navigation/navigation-tree-registry.ts"],"sourcesContent":["import { createDisposable, type Disposable } from \"../../shared/disposable\";\nimport type { TreeNode, TreeViewSection } from \"../renderers/tree-renderer-registry\";\nimport type { ResourceRef } from \"../resources/resource-registry\";\n\nexport type NavigationTreeSlot = \"header\" | \"content\" | \"footer\";\n\nexport interface NavigationTreeOwner {\n kind: \"mode\" | \"page\";\n id: string;\n extensionId: string;\n}\n\nexport interface NavigationTreeContext {\n resource?: ResourceRef;\n signal?: AbortSignal;\n}\n\nexport interface NavigationTreeContribution {\n id: string;\n /** Prefix projected section and node ids when they come from an independent tree renderer. */\n idScope?: string;\n owner: NavigationTreeOwner;\n sourceExtensionId: string;\n declarationIndex: number;\n slot?: NavigationTreeSlot;\n viewId?: string;\n defaultExpandedSectionIds?: string[];\n getSections?(context: NavigationTreeContext): Promise<TreeViewSection[]> | TreeViewSection[];\n getChildren?(node: TreeNode, context: NavigationTreeContext): Promise<TreeNode[]> | TreeNode[];\n}\n\nexport interface CreateNavigationTreeRegistryInput {\n subscribeViewRefresh?(viewId: string, listener: () => void): Disposable;\n getViewDefaultExpandedSectionIds?(viewId: string): readonly string[] | undefined;\n getViewSections?(viewId: string, context: NavigationTreeContext): Promise<TreeViewSection[]> | TreeViewSection[];\n getViewChildren?(viewId: string, node: TreeNode, context: NavigationTreeContext): Promise<TreeNode[]> | TreeNode[];\n}\n\nexport interface NavigationTreeRegistry {\n registerContribution(contribution: NavigationTreeContribution): Disposable;\n resolveOwner(kind: NavigationTreeOwner[\"kind\"], id: string): NavigationTreeOwner | undefined;\n getSections(\n owner: NavigationTreeOwner,\n slot?: NavigationTreeSlot,\n context?: NavigationTreeContext,\n ): Promise<TreeViewSection[]>;\n getChildren(node: TreeNode, context?: NavigationTreeContext): Promise<TreeNode[]>;\n getDefaultExpandedSectionIds(owner: NavigationTreeOwner): string[];\n onDidChange(listener: () => void): Disposable;\n}\n\n// The owner's top-level section. Extensions add ungrouped entries here and use a labeled section for a named group.\nexport const navigationRootSectionId = \"navigation.root\";\n\nconst ownerId = (owner: NavigationTreeOwner) => `${owner.kind}:${owner.extensionId}:${owner.id}`;\n\nconst ownersEqual = (left: NavigationTreeOwner, right: NavigationTreeOwner) => ownerId(left) === ownerId(right);\n\nconst contributionOrder =\n (owner: NavigationTreeOwner) => (left: NavigationTreeContribution, right: NavigationTreeContribution) => {\n const leftOwn = left.sourceExtensionId === owner.extensionId;\n const rightOwn = right.sourceExtensionId === owner.extensionId;\n if (leftOwn !== rightOwn) return leftOwn ? -1 : 1;\n if (!leftOwn) {\n const extensionOrder = left.sourceExtensionId.localeCompare(right.sourceExtensionId);\n if (extensionOrder !== 0) return extensionOrder;\n }\n return left.declarationIndex - right.declarationIndex || left.id.localeCompare(right.id);\n };\n\nconst scopedId = (scope: string | undefined, id: string) => (scope ? `${scope}:${id}` : id);\n\nconst mergeSection = (sections: TreeViewSection[], section: TreeViewSection) => {\n const index = sections.findIndex((candidate) => candidate.id === section.id);\n if (index < 0) {\n sections.push(section);\n return;\n }\n const current = sections[index]!;\n sections[index] = { ...current, nodes: [...current.nodes, ...section.nodes] };\n};\n\nexport const createNavigationTreeRegistry = (input: CreateNavigationTreeRegistryInput = {}): NavigationTreeRegistry => {\n const contributions = new Map<string, NavigationTreeContribution>();\n const nodeSources = new WeakMap<TreeNode, { contribution: NavigationTreeContribution; node: TreeNode }>();\n const listeners = new Set<() => void>();\n const emit = () => {\n for (const listener of listeners) listener();\n };\n\n const matching = (owner: NavigationTreeOwner, slot: NavigationTreeSlot) =>\n [...contributions.values()]\n .filter((contribution) => ownersEqual(contribution.owner, owner) && (contribution.slot ?? \"content\") === slot)\n .sort(contributionOrder(owner));\n\n const projectNode = (node: TreeNode, contribution: NavigationTreeContribution, moveScope: string): TreeNode => {\n const projected: TreeNode = {\n ...node,\n id: scopedId(contribution.idScope, node.id),\n moveScope,\n canHide: node.canHide ?? true,\n canReorder: node.canReorder ?? true,\n children: node.children?.map((child) => projectNode(child, contribution, moveScope)),\n };\n nodeSources.set(projected, { contribution, node });\n return projected;\n };\n\n const projectSection = (\n section: TreeViewSection,\n contribution: NavigationTreeContribution,\n owner: NavigationTreeOwner,\n ): TreeViewSection => ({\n ...section,\n id:\n contribution.sourceExtensionId !== owner.extensionId && !section.label\n ? navigationRootSectionId\n : scopedId(contribution.idScope, section.id),\n moveScope: ownerId(owner),\n canHide: section.canHide ?? true,\n canReorder: section.canReorder ?? true,\n nodes: section.nodes.map((node) => projectNode(node, contribution, ownerId(owner))),\n });\n\n return {\n registerContribution(contribution) {\n if (contributions.has(contribution.id)) {\n throw new Error(`Navigation tree contribution already registered: ${contribution.id}`);\n }\n if (!contribution.viewId && !contribution.getSections) {\n throw new Error(`Navigation tree contribution must declare a viewId or getSections: ${contribution.id}`);\n }\n contributions.set(contribution.id, contribution);\n const refreshSubscription = contribution.viewId\n ? input.subscribeViewRefresh?.(contribution.viewId, emit)\n : undefined;\n emit();\n return createDisposable(() => {\n if (contributions.get(contribution.id) !== contribution) return;\n refreshSubscription?.dispose();\n contributions.delete(contribution.id);\n emit();\n });\n },\n\n resolveOwner(kind, id) {\n return [...contributions.values()].find(\n (contribution) => contribution.owner.kind === kind && contribution.owner.id === id,\n )?.owner;\n },\n\n async getSections(owner, slot = \"content\", context = {}) {\n const sections: TreeViewSection[] = [];\n for (const contribution of matching(owner, slot)) {\n context.signal?.throwIfAborted();\n const sourceSections = contribution.viewId\n ? await input.getViewSections?.(contribution.viewId, context)\n : await contribution.getSections?.(context);\n context.signal?.throwIfAborted();\n for (const section of sourceSections ?? []) {\n mergeSection(sections, projectSection(section, contribution, owner));\n }\n }\n return sections;\n },\n\n async getChildren(node, context = {}) {\n context.signal?.throwIfAborted();\n const source = nodeSources.get(node);\n if (!source) return node.children ?? [];\n const moveScope = node.moveScope ?? ownerId(source.contribution.owner);\n const children = source.contribution.viewId\n ? await input.getViewChildren?.(source.contribution.viewId, source.node, context)\n : await source.contribution.getChildren?.(source.node, context);\n if (!children) return node.children ?? [];\n return children.map((child) => projectNode(child, source.contribution, moveScope));\n },\n\n getDefaultExpandedSectionIds(owner) {\n return ([\"header\", \"content\", \"footer\"] as const).flatMap((slot) =>\n matching(owner, slot).flatMap((contribution) =>\n (\n contribution.defaultExpandedSectionIds ??\n (contribution.viewId ? input.getViewDefaultExpandedSectionIds?.(contribution.viewId) : undefined) ??\n []\n ).map((id) => scopedId(contribution.idScope, id)),\n ),\n );\n },\n\n onDidChange(listener) {\n listeners.add(listener);\n return createDisposable(() => listeners.delete(listener));\n },\n };\n};\n"],"mappings":";;AAoDA,IAAauC,IAA0B,mBAEjCC,KAAWxB,MAA+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