@silo-code/sdk 0.12.0 → 0.13.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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/workspace-service.d.ts +63 -0
- package/dist/workspace-service.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -0
- package/src/workspace-service.ts +67 -0
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export type { Disposable, DockPanelApi, DockPanelProps, EditorProps, EditorCapabilities, Editor, NewFileTemplate, FileType, Command, MenuId, MenuItemContribution, Keybinding, SidePanelProps, SidePanel, DockPanelKind, StatusItem, SettingsPage, ExtensionContext, Extension, ExtensionManifest, ExtensionHandle, } from "./types";
|
|
13
13
|
export type { Workspace, EditorMode, EditorRecord, SidePanelSlot, } from "./domain-types";
|
|
14
|
-
export type { WorkspaceService, WorkspaceState, CreateWorkspaceInput, WorkspaceStatusRow, WorkspaceDecorationProvider, } from "./workspace-service";
|
|
14
|
+
export type { WorkspaceService, WorkspaceState, CreateWorkspaceInput, WorkspaceStatusRow, WorkspaceDecorationProvider, WorkspaceSectionProps, WorkspaceSectionProvider, } from "./workspace-service";
|
|
15
15
|
export type { EditorService, EditorSaveHandlers, OpenFileOptions, EditorViewInfo, OpenDiffSpec, DiffContent, DiffContentRequest, DiffContentProvider, } from "./editor-service";
|
|
16
16
|
export type { LayoutService, LayoutState, SidePanelColumnState, SideLocation, } from "./layout-service";
|
|
17
17
|
export type { ProcessService, ProcessSession, ProcessSpawnOptions, ProcessExecOptions, ProcessExecResult, } from "./process-service";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAKjB,YAAY,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,2BAA2B,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAKjB,YAAY,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,2BAA2B,EAC3B,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,YAAY,GACb,MAAM,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OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA4FH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA0BhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA8BzC,yEAAyE;AACzE,iFAAiF;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,wEAAwE;AACxE,iFAAiF;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -22,6 +22,37 @@ export interface WorkspaceStatusRow {
|
|
|
22
22
|
*/
|
|
23
23
|
startedAt?: string;
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Props passed to a {@link WorkspaceSectionProvider} component for each
|
|
27
|
+
* workspace row it is mounted in.
|
|
28
|
+
*
|
|
29
|
+
* @category Consumer Services
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
export interface WorkspaceSectionProps {
|
|
33
|
+
/** The id of the workspace whose row this component is rendering inside. */
|
|
34
|
+
workspaceId: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A section provider that mounts a React component inside workspace rows in the
|
|
38
|
+
* Workspaces side panel. Register via {@link WorkspaceService.registerSection}.
|
|
39
|
+
*
|
|
40
|
+
* Sections appear below the path line and any status-row decorations. Multiple
|
|
41
|
+
* providers stack vertically in ascending {@link WorkspaceSectionProvider.order}
|
|
42
|
+
* order. Return `null` from your component for workspaces where the section
|
|
43
|
+
* should not appear — this produces no DOM node and no visual gap.
|
|
44
|
+
*
|
|
45
|
+
* @category Consumer Services
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export interface WorkspaceSectionProvider {
|
|
49
|
+
/** Unique id, conventionally `"<extension-id>.section"`. */
|
|
50
|
+
id: string;
|
|
51
|
+
/** The React component mounted once per workspace row. */
|
|
52
|
+
component: React.ComponentType<WorkspaceSectionProps>;
|
|
53
|
+
/** Sort order among sections. Lower values appear first. Defaults to `0`. */
|
|
54
|
+
order?: number;
|
|
55
|
+
}
|
|
25
56
|
/**
|
|
26
57
|
* A decoration provider that contributes {@link WorkspaceStatusRow}s to
|
|
27
58
|
* workspace rows in the Workspaces side panel. Register via
|
|
@@ -150,5 +181,37 @@ export interface WorkspaceService {
|
|
|
150
181
|
* to observe invalidations.
|
|
151
182
|
*/
|
|
152
183
|
subscribeDecorations(listener: () => void): Disposable;
|
|
184
|
+
/**
|
|
185
|
+
* Register a section provider that mounts a React component inside workspace
|
|
186
|
+
* rows in the Workspaces side panel. Returns a {@link Disposable} that
|
|
187
|
+
* unregisters the provider and unmounts the component from all rows.
|
|
188
|
+
*
|
|
189
|
+
* Return `null` from your component for workspaces where the section should
|
|
190
|
+
* not appear — this produces no DOM node and no visual gap.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```tsx
|
|
194
|
+
* ctx.subscriptions.push(
|
|
195
|
+
* ctx.workspaces.registerSection({
|
|
196
|
+
* id: "my-ext.section",
|
|
197
|
+
* component: ({ workspaceId }) => {
|
|
198
|
+
* const ws = ctx.workspaces.get(workspaceId);
|
|
199
|
+
* if (!ws?.terminals.length) return null;
|
|
200
|
+
* return <MyCard terminals={ws.terminals} />;
|
|
201
|
+
* },
|
|
202
|
+
* }),
|
|
203
|
+
* );
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
registerSection(provider: WorkspaceSectionProvider): Disposable;
|
|
207
|
+
/**
|
|
208
|
+
* Subscribe to section registration changes. The listener is called whenever
|
|
209
|
+
* a {@link WorkspaceSectionProvider} is registered or unregistered. Returns a
|
|
210
|
+
* {@link Disposable} that cancels the subscription.
|
|
211
|
+
*
|
|
212
|
+
* The Workspaces panel subscribes internally to re-render when providers
|
|
213
|
+
* are added or removed.
|
|
214
|
+
*/
|
|
215
|
+
subscribeSection(listener: () => void): Disposable;
|
|
153
216
|
}
|
|
154
217
|
//# sourceMappingURL=workspace-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-service.d.ts","sourceRoot":"","sources":["../src/workspace-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,iFAAiF;IACjF,EAAE,EAAE,MAAM,CAAC;IACX,0DAA0D;IAC1D,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAC1C,6EAA6E;IAC7E,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,2BAA2B;IAC1C,kFAAkF;IAClF,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG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.ts
CHANGED
package/src/workspace-service.ts
CHANGED
|
@@ -26,6 +26,39 @@ export interface WorkspaceStatusRow {
|
|
|
26
26
|
startedAt?: string;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Props passed to a {@link WorkspaceSectionProvider} component for each
|
|
31
|
+
* workspace row it is mounted in.
|
|
32
|
+
*
|
|
33
|
+
* @category Consumer Services
|
|
34
|
+
* @public
|
|
35
|
+
*/
|
|
36
|
+
export interface WorkspaceSectionProps {
|
|
37
|
+
/** The id of the workspace whose row this component is rendering inside. */
|
|
38
|
+
workspaceId: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A section provider that mounts a React component inside workspace rows in the
|
|
43
|
+
* Workspaces side panel. Register via {@link WorkspaceService.registerSection}.
|
|
44
|
+
*
|
|
45
|
+
* Sections appear below the path line and any status-row decorations. Multiple
|
|
46
|
+
* providers stack vertically in ascending {@link WorkspaceSectionProvider.order}
|
|
47
|
+
* order. Return `null` from your component for workspaces where the section
|
|
48
|
+
* should not appear — this produces no DOM node and no visual gap.
|
|
49
|
+
*
|
|
50
|
+
* @category Consumer Services
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export interface WorkspaceSectionProvider {
|
|
54
|
+
/** Unique id, conventionally `"<extension-id>.section"`. */
|
|
55
|
+
id: string;
|
|
56
|
+
/** The React component mounted once per workspace row. */
|
|
57
|
+
component: React.ComponentType<WorkspaceSectionProps>;
|
|
58
|
+
/** Sort order among sections. Lower values appear first. Defaults to `0`. */
|
|
59
|
+
order?: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
29
62
|
/**
|
|
30
63
|
* A decoration provider that contributes {@link WorkspaceStatusRow}s to
|
|
31
64
|
* workspace rows in the Workspaces side panel. Register via
|
|
@@ -161,4 +194,38 @@ export interface WorkspaceService {
|
|
|
161
194
|
* to observe invalidations.
|
|
162
195
|
*/
|
|
163
196
|
subscribeDecorations(listener: () => void): Disposable;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Register a section provider that mounts a React component inside workspace
|
|
200
|
+
* rows in the Workspaces side panel. Returns a {@link Disposable} that
|
|
201
|
+
* unregisters the provider and unmounts the component from all rows.
|
|
202
|
+
*
|
|
203
|
+
* Return `null` from your component for workspaces where the section should
|
|
204
|
+
* not appear — this produces no DOM node and no visual gap.
|
|
205
|
+
*
|
|
206
|
+
* @example
|
|
207
|
+
* ```tsx
|
|
208
|
+
* ctx.subscriptions.push(
|
|
209
|
+
* ctx.workspaces.registerSection({
|
|
210
|
+
* id: "my-ext.section",
|
|
211
|
+
* component: ({ workspaceId }) => {
|
|
212
|
+
* const ws = ctx.workspaces.get(workspaceId);
|
|
213
|
+
* if (!ws?.terminals.length) return null;
|
|
214
|
+
* return <MyCard terminals={ws.terminals} />;
|
|
215
|
+
* },
|
|
216
|
+
* }),
|
|
217
|
+
* );
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
registerSection(provider: WorkspaceSectionProvider): Disposable;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Subscribe to section registration changes. The listener is called whenever
|
|
224
|
+
* a {@link WorkspaceSectionProvider} is registered or unregistered. Returns a
|
|
225
|
+
* {@link Disposable} that cancels the subscription.
|
|
226
|
+
*
|
|
227
|
+
* The Workspaces panel subscribes internally to re-render when providers
|
|
228
|
+
* are added or removed.
|
|
229
|
+
*/
|
|
230
|
+
subscribeSection(listener: () => void): Disposable;
|
|
164
231
|
}
|