@scm-js/plugin-api 1.8.0 → 1.9.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 +34 -6
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -800,9 +800,21 @@ export interface IsomCheck {
800
800
  /** Rects whose tiles are not what their ISOM resolves to (doodad tiles are excused). */
801
801
  mismatched: number;
802
802
  }
803
- /** `checkIsom` with the verdict the palette and Check Map draw from it. */
803
+ /**
804
+ * `checkIsom` with what a rebuild would do about it — the verdict the palette, Check Map
805
+ * and the Repair plugin draw from.
806
+ *
807
+ * The two numbers measure opposite directions and are not inverses: `mismatched` is the
808
+ * lattice failing to reproduce the tiles, while a rebuild votes a lattice out of the
809
+ * tiles. A rebuild converges in one pass and leaves `inherent` behind for good, because
810
+ * hand-placed tiles, blends and another editor's ground are not terrain any lattice
811
+ * describes. Reporting `mismatched` alone therefore recommended a repair that could not
812
+ * move the number, on every map with terrain like that.
813
+ */
804
814
  export interface IsomReport extends IsomCheck {
805
- /** More than `STALE_ISOM_SHARE` of the rects disagree with their tiles. */
815
+ /** Of `mismatched`, the rects a rebuild would leave: terrain no lattice describes. */
816
+ inherent: number;
817
+ /** A rebuild would bring more than `STALE_ISOM_SHARE` of the rects back in step. */
806
818
  stale: boolean;
807
819
  }
808
820
  export interface LocationStringChange {
@@ -1663,6 +1675,13 @@ export interface HistoryEdit {
1663
1675
  * removes the section again rather than leaving an all-zero one behind.
1664
1676
  */
1665
1677
  createdIsom?: Uint16Array;
1678
+ /**
1679
+ * Set when the edit rebuilt an existing lattice from the tiles, which is the one edit
1680
+ * to `isom` the ISOM health is re-measured after: a brush stroke keeps the two in step
1681
+ * by construction and is deliberately not measured (`useIsomStatus`), and measuring
1682
+ * costs a second rebuild.
1683
+ */
1684
+ rebuiltIsom?: boolean;
1666
1685
  /** Unit placements, moves and deletions (see editor/units.ts). */
1667
1686
  units?: UnitChange[];
1668
1687
  /**
@@ -3114,10 +3133,19 @@ export interface TerrainApi {
3114
3133
  /** Whether the open map carries an ISOM section the isometric brush can work on. */
3115
3134
  hasIsom(): boolean;
3116
3135
  /**
3117
- * How well the ISOM describes the tiles — `rects` measured, `mismatched` among them,
3118
- * and `stale` when the share is past what the palette warns at — or null when the map
3119
- * has no ISOM (`hasIsom`) or no map is open. Waits for the tileset graphics to load
3120
- * and rejects when they are missing.
3136
+ * How well the ISOM describes the tiles, and what rebuilding it would do about that:
3137
+ * `rects` measured, `mismatched` among them, `inherent` of those a rebuild would leave
3138
+ * behind (terrain no lattice describes — hand-placed tiles, blends, another editor's
3139
+ * ground), and `stale` when a rebuild would bring more than the palette's threshold
3140
+ * back in step. Null when the map has no ISOM (`hasIsom`) or no map is open. Waits for
3141
+ * the tileset graphics to load and rejects when they are missing.
3142
+ *
3143
+ * Offer `tx.rebuildIsom` on `stale`, not on `mismatched`: the two measure opposite
3144
+ * directions, a rebuild converges in one pass, and `inherent` never goes away.
3145
+ *
3146
+ * @example
3147
+ * const r = await api.terrain.checkIsom();
3148
+ * if (r?.stale) await api.document.edit("Rebuild ISOM", (tx) => { tx.rebuildIsom(); });
3121
3149
  */
3122
3150
  checkIsom(): Promise<IsomReport | null>;
3123
3151
  tileInfo(id: number): TileInfo | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",