wings-plugin-sdk 0.9.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/wings.d.ts +21 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wings-plugin-sdk",
3
- "version": "0.9.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",
package/wings.d.ts CHANGED
@@ -128,7 +128,8 @@ interface Wings {
128
128
  onPanes(listener: (panes: WingsPane[]) => void): () => void;
129
129
  /**
130
130
  * Whether the user is in Wings: true while any Wings window (the main one or a view window) is in front, false
131
- * while another app is. Called once with the current state, then on each change. Needs no permission. Pause timers
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
132
133
  * while it is false and check once when it turns true, or use `pollWhileFocused` from `wings-plugin-sdk/poll`.
133
134
  */
134
135
  onFocus(listener: (event: { focused: boolean }) => void): () => void;
@@ -246,11 +247,11 @@ interface Wings {
246
247
  */
247
248
  openView(id: string, options?: { as?: "sidebar" | "modal" | "window" | "tab"; args?: unknown }): Promise<void>;
248
249
  /** Where this page shows. `null` in the plugin's main script. Needs Wings 0.1.22. */
249
- placement(): "sidebar" | "tab" | "modal" | "window" | null;
250
+ placement(): "sidebar" | "tab" | "modal" | "window" | "block" | null;
250
251
  /** What `openView` passed as `args` when it opened this tab, or `null`. Available at once. Needs Wings 0.1.22. */
251
252
  viewArgs<T = unknown>(): T | null;
252
253
  /**
253
- * The project this page is about, or `null` when none is open. A tab page's project is the one the tab belongs to
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
254
255
  * and never changes; any other page gets the project on screen. Needs Wings 0.1.22.
255
256
  */
256
257
  project(): Promise<WingsProject | null>;
@@ -280,6 +281,23 @@ interface Wings {
280
281
  * unloaded. Rejects outside a tab or when the state is too big. Needs Wings 0.1.22.
281
282
  */
282
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;
283
301
  /** Closes a sidebar or view wherever it's open. */
284
302
  closeView(id: string): Promise<void>;
285
303
  /** Opens Wings Settings at the plugin's settings page, `contributes.settings`. Wings 0.1.15 and newer. */