wings-plugin-sdk 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/wings.d.ts +30 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wings-plugin-sdk",
3
- "version": "0.8.0",
3
+ "version": "0.9.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,6 +108,20 @@ 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. */
@@ -227,8 +241,8 @@ interface Wings {
227
241
  * gets the same `wings` object wherever it opens.
228
242
  *
229
243
  * `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` always opens a
231
- * new tab. Needs Wings 0.1.22.
244
+ * 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,
245
+ * unless a tab of it in that project already has the same `args`: that one is shown. Needs Wings 0.1.22.
232
246
  */
233
247
  openView(id: string, options?: { as?: "sidebar" | "modal" | "window" | "tab"; args?: unknown }): Promise<void>;
234
248
  /** Where this page shows. `null` in the plugin's main script. Needs Wings 0.1.22. */
@@ -245,6 +259,20 @@ interface Wings {
245
259
  * tab page), or its branch or name changed. Needs Wings 0.1.22.
246
260
  */
247
261
  onProject(listener: (project: WingsProject | null) => void): () => void;
262
+ /** Every project in Wings, in sidebar order. Worktrees are projects too. Needs Wings 0.1.23. */
263
+ projects(): Promise<WingsProject[]>;
264
+ /**
265
+ * Calls the listener with every project, then each time one is added, removed or renamed, or a branch changes.
266
+ * Works in the main script and in pages. Needs Wings 0.1.23.
267
+ */
268
+ onProjects(listener: (projects: WingsProject[]) => void): () => void;
269
+ /**
270
+ * Shows `rows` under a project in the sidebar, in the section `sectionId` that the manifest declares in
271
+ * `contributes.projectSections`, or removes the section with `null`. Up to 50 rows. Rejects for a project that isn't
272
+ * 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.
273
+ * Sections are kept in memory and go when the plugin is turned off, so fill them again on start. Needs Wings 0.1.23.
274
+ */
275
+ setProjectSection(projectId: string, sectionId: string, rows: WingsProjectSectionRow[] | null): Promise<void>;
248
276
  /** 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
277
  tabState<T = unknown>(): Promise<T | null>;
250
278
  /**