@scm-js/plugin-api 1.65.0 → 1.66.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 +38 -3
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1155,6 +1155,13 @@ export interface SyncFieldsOp {
1155
1155
  extended: boolean;
1156
1156
  encoding: TextEncoding;
1157
1157
  };
1158
+ /**
1159
+ * For each field in `set`, `fieldHash` of the value the change was made from — what the
1160
+ * sender's dialog showed. A receiver whose copy holds something else learns that the op
1161
+ * writes over a version its sender never saw (`Applied.overwritten`). Absent from ops
1162
+ * sent by older editors, which are then never reported as overwriting.
1163
+ */
1164
+ from?: Partial<Record<SyncField, string>>;
1158
1165
  }
1159
1166
  export interface SyncExtrasOp {
1160
1167
  kind: "extras";
@@ -1241,6 +1248,34 @@ export interface HistoryEdit {
1241
1248
  * redo atoms apply it with `applyTables`.
1242
1249
  */
1243
1250
  tables?: TablesEdit;
1251
+ /**
1252
+ * A change to the whole map — Resize / Crop, Change Tileset: the map as it stands on the
1253
+ * other side of the step (`WholeState`). Undo and redo swap it with the scenario's own and
1254
+ * keep what they took out here, so the entry always holds the side it is not on. An entry
1255
+ * with this part has no other: `applyEntry` leaves it alone, and the undo and redo atoms
1256
+ * apply it with `swapWholeState`.
1257
+ */
1258
+ whole?: WholeState;
1259
+ }
1260
+ /**
1261
+ * What a whole-map change replaces: the size, the tileset and every list or grid that is
1262
+ * laid out by the map's size. Held by reference, not copied — Resize and Change Tileset
1263
+ * build new arrays rather than writing into the old ones, and every later in-place edit is
1264
+ * on the undo stack above the entry, so by the time the entry is undone the arrays it took
1265
+ * out are exactly as it left them.
1266
+ */
1267
+ export interface WholeState {
1268
+ width: number;
1269
+ height: number;
1270
+ era: number;
1271
+ tiles: Uint16Array;
1272
+ editorTiles: Uint16Array;
1273
+ isom: Uint16Array | null;
1274
+ mask: Uint8Array | null;
1275
+ units: Scenario["units"];
1276
+ sprites: Scenario["sprites"];
1277
+ doodads: Scenario["doodads"];
1278
+ locations: Scenario["locations"];
1244
1279
  }
1245
1280
  /**
1246
1281
  * Why the map changed: an edit recorded in the history, an undo or redo of one, a dialog
@@ -2995,8 +3030,8 @@ export interface DocumentApi {
2995
3030
  launch?: boolean;
2996
3031
  }): Promise<TestMapOutcome | null>;
2997
3032
  /**
2998
- * Scenario ▸ Resize / Crop Map: a transaction outside the undo model that drops both
2999
- * history stacks (as the dialog does). Content keeps its place relative to `anchor`
3033
+ * Scenario ▸ Resize / Crop Map: one undo step, as the dialog is (on a shared map, where
3034
+ * it replaces everyone's map, both history stacks are dropped instead). Content keeps its place relative to `anchor`
3000
3035
  * (a 3 × 3 grid, row-major, 4 = centre, the default); the new ground is `terrainId`
3001
3036
  * (the tileset's default when omitted); objects outside the new bounds are dropped,
3002
3037
  * locations clamped unless `clampLocations` is false. Null with no map.
@@ -3006,7 +3041,7 @@ export interface DocumentApi {
3006
3041
  * Scenario ▸ Map Properties ▸ Tileset: change ERA and lay the terrain again with the
3007
3042
  * new tileset's terrain (tile numbers do not carry across tilesets; the doodads go with
3008
3043
  * them, everything else stays). Waits for the new graphics so the fill uses real tiles.
3009
- * Like `resize`, a transaction outside the undo model. Null with no map.
3044
+ * Like `resize`, one undo step (on a shared map, the history is dropped instead). Null with no map.
3010
3045
  */
3011
3046
  changeTileset(options: ChangeTilesetOptions): Promise<ChangeTilesetResult | null>;
3012
3047
  readonly extras: ExtrasApi;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.65.0",
3
+ "version": "1.66.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",