@scm-js/plugin-api 1.13.0 → 1.14.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 +77 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -4121,6 +4121,79 @@ export interface BusyHandle {
4121
4121
  /** Uncover the box. Safe to call twice. */
4122
4122
  done(): void;
4123
4123
  }
4124
+ export interface StepsOptions extends WidgetOptions {
4125
+ /**
4126
+ * While the list is `running`, show only its last this many rows; the rest come back
4127
+ * when it stops. For a list that grows past what a panel can hold while it is watched.
4128
+ * 0, the default, shows every row.
4129
+ */
4130
+ tail?: number;
4131
+ }
4132
+ export interface StepOptions {
4133
+ /** A character in front of the label, in the list's own vocabulary: ✎ for a change, ▸ for a read. */
4134
+ icon?: string;
4135
+ /** The row's tooltip. */
4136
+ title?: string;
4137
+ /** Begin running (a ring) rather than pending (a hollow mark). */
4138
+ running?: boolean;
4139
+ }
4140
+ /** One row of a `steps` list. Each state takes the detail shown dim after the label. */
4141
+ export type StepHandle = {
4142
+ readonly element: HTMLElement;
4143
+ /** Rename the row (a step named before its arguments were known), and its tooltip. */
4144
+ set(label: string, title?: string): void;
4145
+ start(detail?: string): void;
4146
+ done(detail?: string): void;
4147
+ fail(detail?: string): void;
4148
+ skip(detail?: string): void;
4149
+ /** Change the detail and nothing else — a clock ticking beside a running step. */
4150
+ detail(text: string): void;
4151
+ /** Something under the label — a thumbnail, a line of output. */
4152
+ append(node: Node): void;
4153
+ };
4154
+ /**
4155
+ * A list of steps: one row per unit of work, each pending, running, done, failed or
4156
+ * skipped, with a detail after its label and a mark at its end. What a builder shows
4157
+ * while it builds, and what a tool-using assistant shows while it works.
4158
+ */
4159
+ export type StepsElement = HTMLElement & {
4160
+ add(label: string, options?: StepOptions): StepHandle;
4161
+ /**
4162
+ * A line between rows that is not a step — an assistant's words between its tool
4163
+ * calls. `at` puts it before the row at that index; without it, at the end.
4164
+ */
4165
+ note(content: string | Node, at?: number): HTMLElement;
4166
+ /** Rows and notes so far, for `note`'s `at`. */
4167
+ size(): number;
4168
+ /** Steps so far (rows, not notes). */
4169
+ count(): number;
4170
+ /** Whether work is running: while it is, the `tail` window applies. */
4171
+ running(on: boolean): void;
4172
+ };
4173
+ export interface FoldOptions extends WidgetOptions {
4174
+ /** The line to begin with. */
4175
+ text?: string;
4176
+ /** Open to begin with. */
4177
+ open?: boolean;
4178
+ /** Start with a ring for a mark. */
4179
+ busy?: boolean;
4180
+ }
4181
+ /**
4182
+ * A block that folds to one line: a mark, the line, a control at its end, and a body.
4183
+ * For work worth a line when it is done and a list while it runs — one turn of an
4184
+ * assistant, a pass over the map — and for anything long that most readers skip, such
4185
+ * as a model's reasoning.
4186
+ */
4187
+ export type FoldElement = HTMLDetailsElement & {
4188
+ /** Where the content goes. */
4189
+ readonly body: HTMLElement;
4190
+ /** The line: text, or text and nodes. */
4191
+ set(...content: (string | Node)[]): void;
4192
+ /** The mark in front of the line: `"busy"` for a ring, a character (✓, ✗) in a colour, or null for none. */
4193
+ mark(sym: string | null, kind?: "ok" | "warn" | "error"): void;
4194
+ /** A control at the end of the line — an Undo — whose click does not fold the block; null takes it away. */
4195
+ action(node: HTMLElement | null): void;
4196
+ };
4124
4197
  /**
4125
4198
  * Buttons, fields, forms and lists in the editor's own styles, as plain DOM. A plugin
4126
4199
  * dialog built from these looks like a built-in one; `el` is the escape hatch for
@@ -4165,6 +4238,10 @@ export interface WidgetsApi {
4165
4238
  * Calling it again on a covered box only changes the label.
4166
4239
  */
4167
4240
  busy(target: HTMLElement, options?: BusyOptions | string): BusyHandle;
4241
+ /** A list of steps, each pending → running → done / failed / skipped, with a detail. */
4242
+ steps(options?: StepsOptions): StepsElement;
4243
+ /** A block folded to one line — a mark, a line that can change, a control at its end — over a body. */
4244
+ fold(options?: FoldOptions): FoldElement;
4168
4245
  }
4169
4246
  export type TopMenu = "File" | "Edit" | "View" | "Layer" | "Scenario" | "Triggers" | "Tools" | "Plugins" | "Help";
4170
4247
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.13.0",
3
+ "version": "1.14.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",