@scm-js/plugin-api 1.26.0 → 1.28.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/index.d.ts +35 -1
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2179,8 +2179,34 @@ export interface BuildStepSpec {
2179
2179
  */
2180
2180
  run(input: BuildStepInput): Promise<Uint8Array>;
2181
2181
  }
2182
+ /**
2183
+ * Work a plugin does on the *document* before the map's bytes are produced for Save, Test
2184
+ * Map or `export` — the place to bring generated content up to date, such as writing a
2185
+ * script's triggers into the trigger list with `document.update`. It runs before any
2186
+ * build step is asked whether it applies, so a step can rely on what it did.
2187
+ */
2188
+ export interface BeforeBuildSpec {
2189
+ /** Unique within the plugin. */
2190
+ id: string;
2191
+ /** What a failure notice names: "TrigScript". */
2192
+ label: string;
2193
+ /** Whether there is anything to do for the open map. Cheap and synchronous; every save asks. Always, when omitted. */
2194
+ applies?(): boolean;
2195
+ /**
2196
+ * May be asynchronous and may write to the document. A throw does not stop the save:
2197
+ * the map is written as it stands and a notice shows the error's message, so word it
2198
+ * for the user. Inside it `document.export()` answers the map as it stands, without
2199
+ * running anything.
2200
+ */
2201
+ run(ctx: {
2202
+ purpose: BuildPurpose;
2203
+ signal: AbortSignal;
2204
+ }): void | Promise<void>;
2205
+ }
2182
2206
  export interface BuildStepsApi {
2183
2207
  add(spec: BuildStepSpec): Disposable;
2208
+ /** Run `spec.run` before the map's bytes are produced, every time the map leaves the editor. */
2209
+ before(spec: BeforeBuildSpec): Disposable;
2184
2210
  /** The steps behind the file the open map came from or was last saved to; null for a plain map. */
2185
2211
  builtBy(): BuiltBy[] | null;
2186
2212
  }
@@ -3903,8 +3929,14 @@ export interface DialogSpec {
3903
3929
  tall?: boolean;
3904
3930
  /** Fill `body` (an empty `<div>` inside the dialog); return a cleanup if you need one. */
3905
3931
  mount(body: HTMLElement, dialog: DialogHandle): void | (() => void);
3906
- /** Footer buttons, left to right; a single Close when omitted. */
3932
+ /**
3933
+ * Footer buttons, left to right; a single Close when omitted. An empty list leaves the
3934
+ * dialog without a footer — for a dialog that is a workspace of its own, with its own
3935
+ * controls, closed by the title strip's × (`setBusy` and a `slot` then have nowhere to show).
3936
+ */
3907
3937
  buttons?: DialogButton[];
3938
+ /** The body runs edge to edge, without the dialog's padding: for content that draws its own frame (an editor with its own bars). */
3939
+ flush?: boolean;
3908
3940
  /**
3909
3941
  * Ctrl+V anywhere in the dialog (while it is the topmost one). Files come from the
3910
3942
  * clipboard's items — a screenshot pastes as one `image/png` file — and `text` is the
@@ -3976,6 +4008,8 @@ export interface PanelSpec {
3976
4008
  dock?: "float" | "right";
3977
4009
  /** A docked panel that takes the dock's spare height (a transcript, a long list); off by default. */
3978
4010
  grow?: boolean;
4011
+ /** Floating only: the body runs edge to edge, without the panel's padding — for content that draws its own frame. */
4012
+ flush?: boolean;
3979
4013
  /** Fill `body` (an empty `<div>` inside the panel); return a cleanup if you need one. */
3980
4014
  mount(body: HTMLElement, panel: PanelHandle): void | (() => void);
3981
4015
  /** The panel closed, whichever way. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.26.0",
3
+ "version": "1.28.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",