@silo-code/sdk 0.6.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/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/context-keys.d.ts +19 -0
- package/dist/context-keys.d.ts.map +1 -0
- package/dist/context-keys.js +2 -0
- package/dist/context-keys.js.map +1 -0
- package/dist/dnd-service.d.ts +140 -0
- package/dist/dnd-service.d.ts.map +1 -0
- package/dist/dnd-service.js +17 -0
- package/dist/dnd-service.js.map +1 -0
- package/dist/domain-types.d.ts +237 -0
- package/dist/domain-types.d.ts.map +1 -0
- package/dist/domain-types.js +11 -0
- package/dist/domain-types.js.map +1 -0
- package/dist/editor-service.d.ts +175 -0
- package/dist/editor-service.d.ts.map +1 -0
- package/dist/editor-service.js +2 -0
- package/dist/editor-service.js.map +1 -0
- package/dist/extension-storage.d.ts +26 -0
- package/dist/extension-storage.d.ts.map +1 -0
- package/dist/extension-storage.js +2 -0
- package/dist/extension-storage.js.map +1 -0
- package/dist/file-service.d.ts +84 -0
- package/dist/file-service.d.ts.map +1 -0
- package/dist/file-service.js +2 -0
- package/dist/file-service.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/layout-service.d.ts +46 -0
- package/dist/layout-service.d.ts.map +1 -0
- package/dist/layout-service.js +2 -0
- package/dist/layout-service.js.map +1 -0
- package/dist/permissions.d.ts +41 -0
- package/dist/permissions.d.ts.map +1 -0
- package/dist/permissions.js +40 -0
- package/dist/permissions.js.map +1 -0
- package/dist/process-service.d.ts +132 -0
- package/dist/process-service.d.ts.map +1 -0
- package/dist/process-service.js +2 -0
- package/dist/process-service.js.map +1 -0
- package/dist/terminal-service.d.ts +38 -0
- package/dist/terminal-service.d.ts.map +1 -0
- package/dist/terminal-service.js +2 -0
- package/dist/terminal-service.js.map +1 -0
- package/dist/theme-service.d.ts +87 -0
- package/dist/theme-service.d.ts.map +1 -0
- package/dist/theme-service.js +2 -0
- package/dist/theme-service.js.map +1 -0
- package/dist/types.d.ts +495 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui-service.d.ts +469 -0
- package/dist/ui-service.d.ts.map +1 -0
- package/dist/ui-service.js +2 -0
- package/dist/ui-service.js.map +1 -0
- package/dist/use-focus-group.d.ts +202 -0
- package/dist/use-focus-group.d.ts.map +1 -0
- package/dist/use-focus-group.js +236 -0
- package/dist/use-focus-group.js.map +1 -0
- package/dist/use-service-state.d.ts +36 -0
- package/dist/use-service-state.d.ts.map +1 -0
- package/dist/use-service-state.js +25 -0
- package/dist/use-service-state.js.map +1 -0
- package/dist/workspace-service.d.ts +72 -0
- package/dist/workspace-service.d.ts.map +1 -0
- package/dist/workspace-service.js +2 -0
- package/dist/workspace-service.js.map +1 -0
- package/package.json +54 -0
- package/src/context-keys.ts +18 -0
- package/src/dnd-service.ts +151 -0
- package/src/domain-types.ts +252 -0
- package/src/editor-service.ts +196 -0
- package/src/extension-storage.ts +25 -0
- package/src/file-service.ts +90 -0
- package/src/index.ts +151 -0
- package/src/layout-service.ts +49 -0
- package/src/permissions.ts +55 -0
- package/src/process-service.ts +143 -0
- package/src/terminal-service.ts +41 -0
- package/src/theme-service.ts +102 -0
- package/src/types.ts +513 -0
- package/src/ui-service.ts +487 -0
- package/src/use-focus-group.test.ts +168 -0
- package/src/use-focus-group.ts +382 -0
- package/src/use-service-state.ts +43 -0
- package/src/workspace-service.ts +76 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Silo extension API — types only.
|
|
3
|
+
*
|
|
4
|
+
* Everything an extension author can see at compile time lives here (plus the
|
|
5
|
+
* service interfaces in the sibling `*-service` files, which this module
|
|
6
|
+
* references). The host injects the runtime implementation at activation time
|
|
7
|
+
* via {@link ExtensionContext}; extensions compile *against* these types and
|
|
8
|
+
* never import the host. This is the VS Code (`vscode.d.ts`) / Obsidian
|
|
9
|
+
* (`obsidian-api`) model.
|
|
10
|
+
*
|
|
11
|
+
* Start with {@link Extension} (the unit you export) and
|
|
12
|
+
* {@link ExtensionContext} (the `ctx` the host hands you).
|
|
13
|
+
*
|
|
14
|
+
* @remarks Every symbol exported here is part of the public, permanently
|
|
15
|
+
* supported surface. Keep it minimal and deliberate — each addition is a
|
|
16
|
+
* forever breaking-change liability.
|
|
17
|
+
*
|
|
18
|
+
* @packageDocumentation
|
|
19
|
+
*/
|
|
20
|
+
import type React from "react";
|
|
21
|
+
import type { IDockviewPanelProps } from "dockview";
|
|
22
|
+
import type { ContextKeys } from "./context-keys";
|
|
23
|
+
import type { WorkspaceService } from "./workspace-service";
|
|
24
|
+
import type { EditorService } from "./editor-service";
|
|
25
|
+
import type { LayoutService } from "./layout-service";
|
|
26
|
+
import type { ProcessService } from "./process-service";
|
|
27
|
+
import type { TerminalService } from "./terminal-service";
|
|
28
|
+
import type { FileService } from "./file-service";
|
|
29
|
+
import type { ThemeService, ThemePreset } from "./theme-service";
|
|
30
|
+
import type { DndService } from "./dnd-service";
|
|
31
|
+
import type { UiService } from "./ui-service";
|
|
32
|
+
import type { ExtensionStorage } from "./extension-storage";
|
|
33
|
+
/**
|
|
34
|
+
* The teardown handle returned by every `register*` call on
|
|
35
|
+
* {@link ExtensionContext}. Calling {@link Disposable.dispose | dispose}
|
|
36
|
+
* removes the contribution. Disposables are also collected on
|
|
37
|
+
* {@link ExtensionContext.subscriptions} so the host can tear an extension
|
|
38
|
+
* down wholesale.
|
|
39
|
+
*
|
|
40
|
+
* @category Core Types
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export interface Disposable {
|
|
44
|
+
dispose(): void;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The dockview panel API handed to a {@link DockPanelKind} component — used to
|
|
48
|
+
* drive the panel's own tab (title, close, focus). Re-exported from `dockview`
|
|
49
|
+
* so extensions don't take a direct dependency on it.
|
|
50
|
+
*
|
|
51
|
+
* @category Core Types
|
|
52
|
+
* @public
|
|
53
|
+
*/
|
|
54
|
+
export type DockPanelApi = IDockviewPanelProps["api"];
|
|
55
|
+
/**
|
|
56
|
+
* Props passed to an {@link Editor} component. An editor renders the contents of
|
|
57
|
+
* one editor tab (a presenter for a file type — distinct from
|
|
58
|
+
* {@link ExtensionContext.editors}, which is the document model).
|
|
59
|
+
*
|
|
60
|
+
* @category Registration
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export interface EditorProps {
|
|
64
|
+
/** Stable id of the editor tab this editor instance is rendering. */
|
|
65
|
+
editorId: string;
|
|
66
|
+
/** Absolute path of the file, or `null` for an untitled buffer. */
|
|
67
|
+
filePath: string | null;
|
|
68
|
+
/** Handle to the surrounding dock panel (title, close, focus). */
|
|
69
|
+
dockApi: DockPanelApi;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Optional declarations about what an {@link Editor} can do, used by the host to
|
|
73
|
+
* decide routing (e.g. whether the editor can own an untitled buffer).
|
|
74
|
+
*
|
|
75
|
+
* @category Registration
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export interface EditorCapabilities {
|
|
79
|
+
/**
|
|
80
|
+
* The editor only displays, it can't edit or save (e.g. the image viewer, a
|
|
81
|
+
* future PDF/hex preview). Defaults to false — editors are editable unless
|
|
82
|
+
* they opt out. Mirrors VS Code's read-only custom-editor variant.
|
|
83
|
+
*/
|
|
84
|
+
readonly?: boolean;
|
|
85
|
+
/** The editor can render a never-saved (untitled) buffer. Defaults to false. */
|
|
86
|
+
handlesUntitled?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Contributes a presenter for a file type — everything that opens in the editor
|
|
90
|
+
* area is an `Editor` (a read-write text editor, a read-only image viewer, …).
|
|
91
|
+
* The host picks one per file by calling each registered editor's
|
|
92
|
+
* {@link Editor.match} (highest {@link Editor.priority} wins) and mounting its
|
|
93
|
+
* {@link Editor.component}. Registered via
|
|
94
|
+
* {@link ExtensionContext.registerEditor}; not to be confused with
|
|
95
|
+
* {@link ExtensionContext.editors} (the document/tab model).
|
|
96
|
+
*
|
|
97
|
+
* @category Registration
|
|
98
|
+
* @public
|
|
99
|
+
*/
|
|
100
|
+
export interface Editor {
|
|
101
|
+
/** Unique id, conventionally namespaced (e.g. `"core.text-editor"`). */
|
|
102
|
+
id: string;
|
|
103
|
+
/**
|
|
104
|
+
* Human-facing name of this *view* of a file, e.g. `"Text"` or `"Preview"`.
|
|
105
|
+
* Surfaces in the breadcrumb view-switcher and the explorer "Open With" menu
|
|
106
|
+
* when more than one editor matches a file. Defaults to {@link Editor.id}
|
|
107
|
+
* where a label is needed but none is given.
|
|
108
|
+
*/
|
|
109
|
+
label?: string;
|
|
110
|
+
/** Returns true if this editor should handle the given path (`null` = untitled). */
|
|
111
|
+
match: (path: string | null) => boolean;
|
|
112
|
+
/** The React component rendered for matched tabs. */
|
|
113
|
+
component: React.ComponentType<EditorProps>;
|
|
114
|
+
/**
|
|
115
|
+
* Higher wins when multiple editors match the same file. Defaults to 0. On a
|
|
116
|
+
* tie the first-registered editor wins — so a second editor for a type can
|
|
117
|
+
* deliberately be an *alternate* (not the default) by matching the
|
|
118
|
+
* incumbent's priority rather than exceeding it. Users still pick any matching
|
|
119
|
+
* view per-tab via "Open With" / the view-switcher
|
|
120
|
+
* ({@link OpenFileOptions.viewType}).
|
|
121
|
+
*/
|
|
122
|
+
priority?: number;
|
|
123
|
+
/** Optional routing hints — see {@link EditorCapabilities}. */
|
|
124
|
+
capabilities?: EditorCapabilities;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Describes how to bootstrap a new, never-saved buffer for a file type. Its
|
|
128
|
+
* mere presence on a FileType marks the type as creatable — it shows up in the
|
|
129
|
+
* "New File" surfaces (the tab-group + menu, the empty-workspace watermark).
|
|
130
|
+
*
|
|
131
|
+
* @category Registration
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
export interface NewFileTemplate {
|
|
135
|
+
/** Base name (no extension) for the untitled buffer. Defaults to "Untitled". */
|
|
136
|
+
defaultName?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Declarative metadata about a file extension — the open-ended counterpart to
|
|
140
|
+
* Viewer (which is purely a renderer). A single source of truth that "New File"
|
|
141
|
+
* surfaces (and, later, tab/explorer icons) can enumerate. Registering a
|
|
142
|
+
* FileType does not register a viewer; the two are matched independently by
|
|
143
|
+
* extension at dispatch time.
|
|
144
|
+
*
|
|
145
|
+
* @category Registration
|
|
146
|
+
* @public
|
|
147
|
+
*/
|
|
148
|
+
export interface FileType {
|
|
149
|
+
/** Unique id, conventionally namespaced. */
|
|
150
|
+
id: string;
|
|
151
|
+
/** Human label, e.g. "Foo File". Used to build "New {label}…" entries. */
|
|
152
|
+
label: string;
|
|
153
|
+
/** Extensions this type owns — leading dot, lowercase. e.g. [".foo"]. */
|
|
154
|
+
extensions: string[];
|
|
155
|
+
/** When present, the type can be created from "New File" surfaces. */
|
|
156
|
+
newFile?: NewFileTemplate;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* A named, invokable action. Register with
|
|
160
|
+
* {@link ExtensionContext.registerCommand} and trigger from menu items,
|
|
161
|
+
* keybindings, status items, or {@link ExtensionContext.executeCommand}.
|
|
162
|
+
*
|
|
163
|
+
* @category Registration
|
|
164
|
+
* @public
|
|
165
|
+
*/
|
|
166
|
+
export interface Command {
|
|
167
|
+
/** Unique id, conventionally `area.verb` (e.g. `"view.toggleLeftPanel"`). */
|
|
168
|
+
id: string;
|
|
169
|
+
/** Human-readable label (shown where the command surfaces in UI). */
|
|
170
|
+
label: string;
|
|
171
|
+
/** The action. Runs synchronously; do async work inside if needed. */
|
|
172
|
+
run: () => void;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The top-level application menus a {@link MenuItemContribution} can target.
|
|
176
|
+
*
|
|
177
|
+
* @category Registration
|
|
178
|
+
* @public
|
|
179
|
+
*/
|
|
180
|
+
export type MenuId = "file" | "edit" | "view" | "window";
|
|
181
|
+
/**
|
|
182
|
+
* Places a command into one of the application menus.
|
|
183
|
+
*
|
|
184
|
+
* @category Registration
|
|
185
|
+
* @public
|
|
186
|
+
*/
|
|
187
|
+
export interface MenuItemContribution {
|
|
188
|
+
/** Unique id for this menu entry. */
|
|
189
|
+
id: string;
|
|
190
|
+
/** Which application menu to place the item in. */
|
|
191
|
+
menu: MenuId;
|
|
192
|
+
/** Id of the {@link Command} this item invokes. */
|
|
193
|
+
command: string;
|
|
194
|
+
/** Override label; defaults to the command's label. */
|
|
195
|
+
label?: string;
|
|
196
|
+
/** Accelerator shown next to the item (display only; bind via {@link Keybinding}). */
|
|
197
|
+
accelerator?: string;
|
|
198
|
+
/**
|
|
199
|
+
* Group key used to bucket items in the same submenu. Items in different
|
|
200
|
+
* groups are visually separated by a separator. Group names are sorted
|
|
201
|
+
* lexically — convention is to prefix with a digit ("1_new", "2_save").
|
|
202
|
+
* Defaults to "9_default" so unspecified items land at the bottom.
|
|
203
|
+
*/
|
|
204
|
+
group?: string;
|
|
205
|
+
/** Sort order within a group. Defaults to 0. */
|
|
206
|
+
order?: number;
|
|
207
|
+
/**
|
|
208
|
+
* Optional predicate against current context keys. Items whose `when`
|
|
209
|
+
* returns false stay visible in the app menu but are disabled (macOS
|
|
210
|
+
* native pattern — items can't appear/disappear without rebuilding the
|
|
211
|
+
* whole menu). Items without `when` are always enabled.
|
|
212
|
+
*/
|
|
213
|
+
when?: (ctx: ContextKeys) => boolean;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Binds a keyboard shortcut to a {@link Command}.
|
|
217
|
+
*
|
|
218
|
+
* @category Registration
|
|
219
|
+
* @public
|
|
220
|
+
*/
|
|
221
|
+
export interface Keybinding {
|
|
222
|
+
/** Unique id for this binding. */
|
|
223
|
+
id: string;
|
|
224
|
+
/**
|
|
225
|
+
* Shortcut spec like "cmd+s", "ctrl+shift+s", "cmd+1", "cmd+shift+=".
|
|
226
|
+
* Parsed against KeyboardEvent.code for layout-stable letter/digit keys
|
|
227
|
+
* plus a small alias table for symbol keys (= → Equal, - → Minus, etc.).
|
|
228
|
+
*/
|
|
229
|
+
key: string;
|
|
230
|
+
/** Id of the {@link Command} to invoke. */
|
|
231
|
+
command: string;
|
|
232
|
+
/** Optional predicate against context keys; the binding is inert when false. */
|
|
233
|
+
when?: (ctx: ContextKeys) => boolean;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Props passed to a {@link SidePanel} component.
|
|
237
|
+
*
|
|
238
|
+
* @category Registration
|
|
239
|
+
* @public
|
|
240
|
+
*/
|
|
241
|
+
export interface SidePanelProps {
|
|
242
|
+
/** True when this side panel is currently visible / selected in its column. */
|
|
243
|
+
active: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Namespaced, persisted key/value storage scoped to this panel id.
|
|
246
|
+
* Use for restoring UI state (scroll positions, selections, expanded
|
|
247
|
+
* sections, etc.) across reloads.
|
|
248
|
+
*/
|
|
249
|
+
storage: ExtensionStorage;
|
|
250
|
+
/**
|
|
251
|
+
* True once the persisted app state has finished loading from disk.
|
|
252
|
+
* Panels should defer restoring values from `storage` until this is true
|
|
253
|
+
* (or subscribe to `storage` and re-read when it flips).
|
|
254
|
+
*/
|
|
255
|
+
hydrated: boolean;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* A panel mounted in the left or right side column (e.g. file explorer, git).
|
|
259
|
+
*
|
|
260
|
+
* @category Registration
|
|
261
|
+
* @public
|
|
262
|
+
*/
|
|
263
|
+
export interface SidePanel {
|
|
264
|
+
/** Unique id, conventionally namespaced. */
|
|
265
|
+
id: string;
|
|
266
|
+
/** Which side column to mount in. */
|
|
267
|
+
location: "left" | "right";
|
|
268
|
+
/** Title shown in the column's panel switcher. */
|
|
269
|
+
title: string;
|
|
270
|
+
/** The React component; receives {@link SidePanelProps}. */
|
|
271
|
+
component: React.ComponentType<SidePanelProps>;
|
|
272
|
+
/** Sort order within the side column. Defaults to 0. */
|
|
273
|
+
order?: number;
|
|
274
|
+
/**
|
|
275
|
+
* If true, defer mounting the component until the first time this panel
|
|
276
|
+
* becomes active. Once mounted, stays mounted (panel can use `active`
|
|
277
|
+
* to pause expensive work when hidden).
|
|
278
|
+
*/
|
|
279
|
+
lazyMount?: boolean;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Registers a kind of dock panel (a tab that can live in the center dock area,
|
|
283
|
+
* e.g. the terminal). Workspaces open panels of registered kinds by id.
|
|
284
|
+
*
|
|
285
|
+
* @category Registration
|
|
286
|
+
* @public
|
|
287
|
+
*/
|
|
288
|
+
export interface DockPanelKind {
|
|
289
|
+
/** Unique id for this panel kind. */
|
|
290
|
+
id: string;
|
|
291
|
+
/** The React component; receives the raw dockview panel props. */
|
|
292
|
+
component: React.ComponentType<IDockviewPanelProps>;
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* A widget in the status bar (the strip along the bottom of the window).
|
|
296
|
+
*
|
|
297
|
+
* @category Registration
|
|
298
|
+
* @public
|
|
299
|
+
*/
|
|
300
|
+
export interface StatusItem {
|
|
301
|
+
/** Unique id for this status item. */
|
|
302
|
+
id: string;
|
|
303
|
+
/** Which end of the status bar this item sits at. */
|
|
304
|
+
alignment: "left" | "right";
|
|
305
|
+
/** Sort order within its alignment group. Lower sorts first. Defaults to 0. */
|
|
306
|
+
priority?: number;
|
|
307
|
+
/** The React component (renders its own content; no props). */
|
|
308
|
+
component: React.ComponentType;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* A page in the Settings dialog, listed in the left rail.
|
|
312
|
+
*
|
|
313
|
+
* @category Registration
|
|
314
|
+
* @public
|
|
315
|
+
*/
|
|
316
|
+
export interface SettingsPage {
|
|
317
|
+
/** Unique id for this settings page. */
|
|
318
|
+
id: string;
|
|
319
|
+
/** Label shown in the Settings left rail. */
|
|
320
|
+
title: string;
|
|
321
|
+
/**
|
|
322
|
+
* Optional grouping key for the left rail (groups sorted lexically, separated
|
|
323
|
+
* by a divider). Honored only for `core.*` pages; a page contributed by any
|
|
324
|
+
* non-core extension is always grouped under **Extensions**, so `group` is
|
|
325
|
+
* ignored for those.
|
|
326
|
+
*/
|
|
327
|
+
group?: string;
|
|
328
|
+
/** Sort order within the group. Lower sorts first. Defaults to 0. */
|
|
329
|
+
order?: number;
|
|
330
|
+
/** Renders the right-hand pane when this page is selected. */
|
|
331
|
+
component: React.ComponentType;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* The object handed to {@link Extension.activate}. It is the *only* sanctioned
|
|
335
|
+
* way an extension touches the running app: register contributions, invoke
|
|
336
|
+
* commands, and read/drive state through the typed consumer services. Every
|
|
337
|
+
* `register*` call returns a {@link Disposable} and is also tracked on
|
|
338
|
+
* {@link ExtensionContext.subscriptions}.
|
|
339
|
+
*
|
|
340
|
+
* @category Extension Contract
|
|
341
|
+
* @public
|
|
342
|
+
*/
|
|
343
|
+
export interface ExtensionContext {
|
|
344
|
+
/** The activating extension's id (its {@link Extension.id}). */
|
|
345
|
+
readonly extensionId: string;
|
|
346
|
+
/** Disposables tracked for this extension; the host disposes them on teardown. */
|
|
347
|
+
readonly subscriptions: Disposable[];
|
|
348
|
+
/** Register an {@link Editor} (a presenter for a file type's editor tab). */
|
|
349
|
+
registerEditor(editor: Editor): Disposable;
|
|
350
|
+
/** Register a {@link FileType} (declarative file metadata). */
|
|
351
|
+
registerFileType(type: FileType): Disposable;
|
|
352
|
+
/** Register a {@link Command} (a named, invokable action). */
|
|
353
|
+
registerCommand(cmd: Command): Disposable;
|
|
354
|
+
/** Register a {@link MenuItemContribution} (place a command in a menu). */
|
|
355
|
+
registerMenuItem(item: MenuItemContribution): Disposable;
|
|
356
|
+
/** Register a {@link Keybinding} (bind a shortcut to a command). */
|
|
357
|
+
registerKeybinding(binding: Keybinding): Disposable;
|
|
358
|
+
/** Register a {@link SidePanel} (a left/right column panel). */
|
|
359
|
+
registerSidePanel(panel: SidePanel): Disposable;
|
|
360
|
+
/** Register a {@link DockPanelKind} (a center-dock tab kind). */
|
|
361
|
+
registerDockPanelKind(kind: DockPanelKind): Disposable;
|
|
362
|
+
/** Register a {@link StatusItem} (a status-bar widget). */
|
|
363
|
+
registerStatusItem(item: StatusItem): Disposable;
|
|
364
|
+
/** Register a {@link SettingsPage} (a page in the Settings dialog). */
|
|
365
|
+
registerSettingsPage(page: SettingsPage): Disposable;
|
|
366
|
+
/** Register a {@link ThemePreset} (a selectable theme in the picker). */
|
|
367
|
+
registerThemePreset(preset: ThemePreset): Disposable;
|
|
368
|
+
/**
|
|
369
|
+
* Invoke a registered command by id — including commands contributed by
|
|
370
|
+
* other extensions. The minimal "operate" primitive; pairs with the typed
|
|
371
|
+
* services for read access.
|
|
372
|
+
*/
|
|
373
|
+
executeCommand(id: string): void;
|
|
374
|
+
/**
|
|
375
|
+
* Consumer API for driving workspace state — create, rename, reorder,
|
|
376
|
+
* activate, soft close/reopen, and hard delete. Subscribe to a frozen
|
|
377
|
+
* state for read access without depending on Valtio.
|
|
378
|
+
*/
|
|
379
|
+
readonly workspaces: WorkspaceService;
|
|
380
|
+
/**
|
|
381
|
+
* The editor & document domain — open files into editor tabs, drive the
|
|
382
|
+
* active editor (save / close), and register editor save handlers. Opening
|
|
383
|
+
* editors lives here, not on {@link ExtensionContext.workspaces}.
|
|
384
|
+
*/
|
|
385
|
+
readonly editors: EditorService;
|
|
386
|
+
/**
|
|
387
|
+
* Consumer API for app layout — side-panel collapse state. Read via
|
|
388
|
+
* getState/useServiceState/subscribe; drive via toggleSidePanel /
|
|
389
|
+
* setSidePanelCollapsed.
|
|
390
|
+
*/
|
|
391
|
+
readonly layout: LayoutService;
|
|
392
|
+
/**
|
|
393
|
+
* Persistent process / PTY sessions that **survive app restarts** — the core
|
|
394
|
+
* primitive under the terminal (and future task runners, REPLs). Spawn or
|
|
395
|
+
* re-attach a session and drive it via the returned `ProcessSession`.
|
|
396
|
+
*/
|
|
397
|
+
readonly process: ProcessService;
|
|
398
|
+
/**
|
|
399
|
+
* Consumer API for the terminal domain — open a terminal tab in a workspace
|
|
400
|
+
* (`create`) or reap a workspace's terminals (`closeWorkspace`). The terminal
|
|
401
|
+
* is a core feature (a built-in DockKind like the editor); its tabs render
|
|
402
|
+
* from the workspace's records, and PTY sessions live on
|
|
403
|
+
* {@link ExtensionContext.process}.
|
|
404
|
+
*/
|
|
405
|
+
readonly terminals: TerminalService;
|
|
406
|
+
/**
|
|
407
|
+
* Host-mediated filesystem access — read / write / list / watch, all routed
|
|
408
|
+
* through the host rather than raw Tauri. The single privileged chokepoint
|
|
409
|
+
* for the filesystem; watcher lifecycle is host-owned (see {@link FileService}).
|
|
410
|
+
*/
|
|
411
|
+
readonly files: FileService;
|
|
412
|
+
/**
|
|
413
|
+
* Consumer API for the theme domain — read the merged preset set + active
|
|
414
|
+
* theme, switch themes, and manage custom themes. Read via getState /
|
|
415
|
+
* subscribe; contribute a new preset via
|
|
416
|
+
* {@link ExtensionContext.registerThemePreset}.
|
|
417
|
+
*/
|
|
418
|
+
readonly theme: ThemeService;
|
|
419
|
+
/**
|
|
420
|
+
* Drag-and-drop — be a drag source ({@link DndService.beginDrag}) and a drop
|
|
421
|
+
* target ({@link DndService.registerDropTarget}), with typed payloads
|
|
422
|
+
* ({@link DND_MIME}) that interoperate across extensions. The host owns the
|
|
423
|
+
* drag affordance and the modifier-mode resolution.
|
|
424
|
+
*/
|
|
425
|
+
readonly dnd: DndService;
|
|
426
|
+
/**
|
|
427
|
+
* User-interaction — the only sanctioned way to talk to the user (the host
|
|
428
|
+
* renders the chrome). Native file/folder pickers ({@link UiService.pickFolder},
|
|
429
|
+
* {@link UiService.pickFile}, {@link UiService.savePath}) and transient toast
|
|
430
|
+
* notifications ({@link UiService.notify}). Mirrors VS Code's `window.show*`.
|
|
431
|
+
*/
|
|
432
|
+
readonly ui: UiService;
|
|
433
|
+
/**
|
|
434
|
+
* Resolve a handle to another extension in order to consume the API it
|
|
435
|
+
* published (the value its {@link Extension.activate} returned). This is how
|
|
436
|
+
* features that live *outside* core — git, terminal, themes — expose
|
|
437
|
+
* capabilities to other extensions.
|
|
438
|
+
*
|
|
439
|
+
* Returns `undefined` if no extension with that id is known. Even when known,
|
|
440
|
+
* the handle's {@link ExtensionHandle.api | api} is `undefined` until that
|
|
441
|
+
* extension has activated — so **always handle absence**; the provider may be
|
|
442
|
+
* disabled or activate after you. Call this at use time, not in `activate`.
|
|
443
|
+
*
|
|
444
|
+
* @typeParam API - the provider's published API type (import its types package).
|
|
445
|
+
*/
|
|
446
|
+
getExtension<API = unknown>(id: string): ExtensionHandle<API> | undefined;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* A handle to another extension, obtained via
|
|
450
|
+
* {@link ExtensionContext.getExtension}. Lets one extension consume another's
|
|
451
|
+
* published API while tolerating its absence.
|
|
452
|
+
*
|
|
453
|
+
* @category Extension Contract
|
|
454
|
+
* @public
|
|
455
|
+
*/
|
|
456
|
+
export interface ExtensionHandle<API = unknown> {
|
|
457
|
+
/** The resolved extension's id. */
|
|
458
|
+
readonly id: string;
|
|
459
|
+
/** True once that extension has activated. */
|
|
460
|
+
readonly active: boolean;
|
|
461
|
+
/** Its published API (what its `activate` returned), or `undefined` if it
|
|
462
|
+
* hasn't activated or published nothing. */
|
|
463
|
+
readonly api: API | undefined;
|
|
464
|
+
}
|
|
465
|
+
/**
|
|
466
|
+
* The shape of a Silo extension: a stable id plus an
|
|
467
|
+
* {@link Extension.activate | activate} function the host calls once, passing
|
|
468
|
+
* the {@link ExtensionContext}. This is the unit the host loads — built-ins
|
|
469
|
+
* today, external packages later.
|
|
470
|
+
*
|
|
471
|
+
* @typeParam API - the type of the API this extension publishes, if any (the
|
|
472
|
+
* return type of {@link Extension.activate}). Defaults to `unknown`; omit it for
|
|
473
|
+
* extensions that publish nothing.
|
|
474
|
+
*
|
|
475
|
+
* @category Extension Contract
|
|
476
|
+
* @public
|
|
477
|
+
*/
|
|
478
|
+
export interface Extension<API = unknown> {
|
|
479
|
+
/**
|
|
480
|
+
* Unique extension id, conventionally namespaced: `core.*` for Silo's core
|
|
481
|
+
* feature set, `silo.*` for its optional bundled features, `<vendor>.*` for
|
|
482
|
+
* third parties (e.g. `"core.editor"`, `"silo.git"`, `"acme.foo"`).
|
|
483
|
+
*/
|
|
484
|
+
id: string;
|
|
485
|
+
/**
|
|
486
|
+
* Called once by the host; register contributions against `ctx` here.
|
|
487
|
+
* **Optionally return an API object** to publish it for other extensions to
|
|
488
|
+
* consume via {@link ExtensionContext.getExtension}. Return nothing if the
|
|
489
|
+
* extension publishes no API.
|
|
490
|
+
*/
|
|
491
|
+
activate(ctx: ExtensionContext): API | void;
|
|
492
|
+
/** Optional cleanup hook (reserved for dynamic load/unload). */
|
|
493
|
+
deactivate?(): void;
|
|
494
|
+
}
|
|
495
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gB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