wings-plugin-sdk 0.8.0 → 0.10.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/package.json +5 -5
- package/wings.d.ts +51 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wings-plugin-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "The wings API types, the page frame, React hooks and the build command for Wings plugins.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
"default": "./build.mjs"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"test": "node --test"
|
|
31
|
+
},
|
|
29
32
|
"bin": {
|
|
30
33
|
"wings-plugin": "bin.mjs"
|
|
31
34
|
},
|
|
@@ -69,8 +72,5 @@
|
|
|
69
72
|
"react": "^19.1.0",
|
|
70
73
|
"react-dom": "^19.1.0",
|
|
71
74
|
"typescript": "~6.0.3"
|
|
72
|
-
},
|
|
73
|
-
"scripts": {
|
|
74
|
-
"test": "node --test"
|
|
75
75
|
}
|
|
76
|
-
}
|
|
76
|
+
}
|
package/wings.d.ts
CHANGED
|
@@ -108,13 +108,28 @@ interface WingsProject {
|
|
|
108
108
|
branch: string | null;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
+
/** A line in a plugin's section under a project in the sidebar. Needs Wings 0.1.23. */
|
|
112
|
+
interface WingsProjectSectionRow {
|
|
113
|
+
/** Up to 64 characters, unique in the section. */
|
|
114
|
+
id: string;
|
|
115
|
+
/** Up to 120 characters. */
|
|
116
|
+
label: string;
|
|
117
|
+
/** Muted text under the label, up to 120 characters. */
|
|
118
|
+
detail?: string;
|
|
119
|
+
/** A small pill after the label. `text` is up to 24 characters. */
|
|
120
|
+
badge?: { text: string; tone?: Tone };
|
|
121
|
+
/** Clicking the row opens `view`, one of the plugin's `contributes.views` that lists `tab` in `opens`, as a tab in the row's project, with `args` (JSON, up to 16 KB) as `viewArgs()`. */
|
|
122
|
+
open: { view: string; args?: unknown };
|
|
123
|
+
}
|
|
124
|
+
|
|
111
125
|
interface Wings {
|
|
112
126
|
// Every `on*` call returns a function that removes the listener, for cleaning up in a React effect.
|
|
113
127
|
/** Every terminal pane, on every change. */
|
|
114
128
|
onPanes(listener: (panes: WingsPane[]) => void): () => void;
|
|
115
129
|
/**
|
|
116
130
|
* Whether the user is in Wings: true while any Wings window (the main one or a view window) is in front, false
|
|
117
|
-
* while another app is.
|
|
131
|
+
* while another app is. In a block on a Project page it is also false while the block is out of view or its tab is hidden.
|
|
132
|
+
* Called once with the current state, then on each change. Needs no permission. Pause timers
|
|
118
133
|
* while it is false and check once when it turns true, or use `pollWhileFocused` from `wings-plugin-sdk/poll`.
|
|
119
134
|
*/
|
|
120
135
|
onFocus(listener: (event: { focused: boolean }) => void): () => void;
|
|
@@ -227,16 +242,16 @@ interface Wings {
|
|
|
227
242
|
* gets the same `wings` object wherever it opens.
|
|
228
243
|
*
|
|
229
244
|
* `args` (JSON, up to 16 KB, only with `as: "tab"`) is what the tab's page reads with `viewArgs`. A tab that's
|
|
230
|
-
* already open with other args takes the new ones, drops its saved tab state and reloads; a view with `"multiple": true`
|
|
231
|
-
*
|
|
245
|
+
* already open with other args takes the new ones, drops its saved tab state and reloads; a view with `"multiple": true` opens a new tab,
|
|
246
|
+
* unless a tab of it in that project already has the same `args`: that one is shown. Needs Wings 0.1.22.
|
|
232
247
|
*/
|
|
233
248
|
openView(id: string, options?: { as?: "sidebar" | "modal" | "window" | "tab"; args?: unknown }): Promise<void>;
|
|
234
249
|
/** Where this page shows. `null` in the plugin's main script. Needs Wings 0.1.22. */
|
|
235
|
-
placement(): "sidebar" | "tab" | "modal" | "window" | null;
|
|
250
|
+
placement(): "sidebar" | "tab" | "modal" | "window" | "block" | null;
|
|
236
251
|
/** What `openView` passed as `args` when it opened this tab, or `null`. Available at once. Needs Wings 0.1.22. */
|
|
237
252
|
viewArgs<T = unknown>(): T | null;
|
|
238
253
|
/**
|
|
239
|
-
* The project this page is about, or `null` when none is open. A tab page's project is the one
|
|
254
|
+
* The project this page is about, or `null` when none is open. A tab page's or block's project is the one it belongs to
|
|
240
255
|
* and never changes; any other page gets the project on screen. Needs Wings 0.1.22.
|
|
241
256
|
*/
|
|
242
257
|
project(): Promise<WingsProject | null>;
|
|
@@ -245,6 +260,20 @@ interface Wings {
|
|
|
245
260
|
* tab page), or its branch or name changed. Needs Wings 0.1.22.
|
|
246
261
|
*/
|
|
247
262
|
onProject(listener: (project: WingsProject | null) => void): () => void;
|
|
263
|
+
/** Every project in Wings, in sidebar order. Worktrees are projects too. Needs Wings 0.1.23. */
|
|
264
|
+
projects(): Promise<WingsProject[]>;
|
|
265
|
+
/**
|
|
266
|
+
* Calls the listener with every project, then each time one is added, removed or renamed, or a branch changes.
|
|
267
|
+
* Works in the main script and in pages. Needs Wings 0.1.23.
|
|
268
|
+
*/
|
|
269
|
+
onProjects(listener: (projects: WingsProject[]) => void): () => void;
|
|
270
|
+
/**
|
|
271
|
+
* Shows `rows` under a project in the sidebar, in the section `sectionId` that the manifest declares in
|
|
272
|
+
* `contributes.projectSections`, or removes the section with `null`. Up to 50 rows. Rejects for a project that isn't
|
|
273
|
+
* there, a section the plugin didn't declare, or a row whose `open.view` isn't one of its views that opens as a tab.
|
|
274
|
+
* Sections are kept in memory and go when the plugin is turned off, so fill them again on start. Needs Wings 0.1.23.
|
|
275
|
+
*/
|
|
276
|
+
setProjectSection(projectId: string, sectionId: string, rows: WingsProjectSectionRow[] | null): Promise<void>;
|
|
248
277
|
/** In a tab page: the state it last saved with `setTabState`, or `null`. Outside a tab it is `null`. Opening the tab with new `args` clears it. Needs Wings 0.1.22. */
|
|
249
278
|
tabState<T = unknown>(): Promise<T | null>;
|
|
250
279
|
/**
|
|
@@ -252,6 +281,23 @@ interface Wings {
|
|
|
252
281
|
* unloaded. Rejects outside a tab or when the state is too big. Needs Wings 0.1.22.
|
|
253
282
|
*/
|
|
254
283
|
setTabState(state: unknown): Promise<void>;
|
|
284
|
+
/**
|
|
285
|
+
* In a block on a Project page, `contributes.blocks`: the state it last saved with `setBlockState`, or `null`. Outside a
|
|
286
|
+
* block it is `null`. Needs Wings 0.1.24.
|
|
287
|
+
*/
|
|
288
|
+
blockState<T = unknown>(): Promise<T | null>;
|
|
289
|
+
/**
|
|
290
|
+
* In a block: saves JSON state, up to 16 KB, on the block, like which board or filter it shows. Wings keeps it with the
|
|
291
|
+
* Project page across restarts and while the block is unloaded. Rejects outside a block or when the state is too big.
|
|
292
|
+
* Needs Wings 0.1.24.
|
|
293
|
+
*/
|
|
294
|
+
setBlockState(state: unknown): Promise<void>;
|
|
295
|
+
/**
|
|
296
|
+
* In a block: asks for a height in CSS pixels. Wings rounds it and clamps it to the block's `minHeight` (default 160)
|
|
297
|
+
* up to 1200, and applies it without reloading the page. Call it when the content's height changes: asking for the
|
|
298
|
+
* height already asked for does nothing, and calls in the same tick send only the last. Throws outside a block. Needs Wings 0.1.24.
|
|
299
|
+
*/
|
|
300
|
+
setHeight(px: number): void;
|
|
255
301
|
/** Closes a sidebar or view wherever it's open. */
|
|
256
302
|
closeView(id: string): Promise<void>;
|
|
257
303
|
/** Opens Wings Settings at the plugin's settings page, `contributes.settings`. Wings 0.1.15 and newer. */
|