@scm-js/plugin-api 1.12.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 +86 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1638,6 +1638,8 @@ export interface DoodadPlacementOptions {
1638
1638
  placeAnywhere: boolean;
1639
1639
  /** Keep the left column on an even tile, as StarEdit always does. */
1640
1640
  snapToGrid: boolean;
1641
+ /** Place as plain terrain: the tiles (both sections) and any overlay sprite, no DD2 record — a placement and a conversion in one. */
1642
+ asTerrain: boolean;
1641
1643
  }
1642
1644
  export interface DoodadVerdict {
1643
1645
  ok: boolean;
@@ -2344,6 +2346,13 @@ export interface EditTransaction {
2344
2346
  /** Stamp a doodad (a `dddata.bin` id) at a tile; returns its record index, or -1 when unknown or off the map. */
2345
2347
  placeDoodad(doodadId: number, tx: number, ty: number, owner?: number): number;
2346
2348
  removeDoodads(indices: number[]): number;
2349
+ /**
2350
+ * Make doodads plain terrain: their records go, their tiles stay (in TILE as well as
2351
+ * MTXM, so the cells are ground to every tool from here on) and an overlay stays as an
2352
+ * ordinary sprite. The way to touch up a ramp or a cliff piece tile by tile.
2353
+ * Returns records converted.
2354
+ */
2355
+ convertDoodads(indices: number[]): number;
2347
2356
  /** A location in the lowest free slot (pixel bounds); returns the slot, or -1 when the table is full. */
2348
2357
  addLocation(bounds: Bounds, name?: string, elevationFlags?: number): number;
2349
2358
  editLocation(index: number, patch: LocationPatch): boolean;
@@ -4112,6 +4121,79 @@ export interface BusyHandle {
4112
4121
  /** Uncover the box. Safe to call twice. */
4113
4122
  done(): void;
4114
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
+ };
4115
4197
  /**
4116
4198
  * Buttons, fields, forms and lists in the editor's own styles, as plain DOM. A plugin
4117
4199
  * dialog built from these looks like a built-in one; `el` is the escape hatch for
@@ -4156,6 +4238,10 @@ export interface WidgetsApi {
4156
4238
  * Calling it again on a covered box only changes the label.
4157
4239
  */
4158
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;
4159
4245
  }
4160
4246
  export type TopMenu = "File" | "Edit" | "View" | "Layer" | "Scenario" | "Triggers" | "Tools" | "Plugins" | "Help";
4161
4247
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.12.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",