@scm-js/plugin-api 1.36.0 → 1.37.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 +23 -2
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1209,7 +1209,7 @@ export interface StackedLine {
1209
1209
  pieces: number;
1210
1210
  }
1211
1211
  /** Every built-in dialog, by the id `openDialogAtom` takes; `DialogHost` maps each to its component. */
1212
- export type DialogId = "newMap" | "openMap" | "saveAs" | "exportImage" | "mapProperties" | "resizeMap" | "mapRevision" | "playerSettings" | "forceSettings" | "playerColors" | "unitSettings" | "upgradeSettings" | "techSettings" | "stringEditor" | "soundEditor" | "switches" | "locationList" | "unitProperties" | "locationProperties" | "spriteProperties" | "triggerEditor" | "missionBriefing" | "cuwpEditor" | "replaceTerrain" | "autoStarts" | "testMap" | "symmetry" | "gridSettings" | "preferences" | "shortcuts" | "validateMap" | "statistics" | "importTriggers" | "exportTriggers" | "importStrings" | "exportStrings" | "find" | "about" | "confirmClose" | "plugins" | "confirmPlugin" | "pluginDialog" | "gameData" | "update";
1212
+ export type DialogId = "newMap" | "openMap" | "saveAs" | "exportImage" | "mapProperties" | "resizeMap" | "mapRevision" | "playerSettings" | "forceSettings" | "playerColors" | "unitSettings" | "upgradeSettings" | "techSettings" | "stringEditor" | "soundEditor" | "switches" | "locationList" | "unitProperties" | "locationProperties" | "spriteProperties" | "triggerEditor" | "missionBriefing" | "cuwpEditor" | "replaceTerrain" | "autoStarts" | "testMap" | "symmetry" | "gridSettings" | "preferences" | "shortcuts" | "validateMap" | "statistics" | "importTriggers" | "exportTriggers" | "importStrings" | "exportStrings" | "find" | "about" | "confirmClose" | "recovery" | "previousVersions" | "plugins" | "confirmPlugin" | "pluginDialog" | "gameData" | "update";
1213
1213
  export interface MapImageOptions {
1214
1214
  /** Output pixels per map tile. 32 matches the game's art 1:1; 1 is a minimap. */
1215
1215
  pixelsPerTile: number;
@@ -1992,11 +1992,25 @@ export interface Preferences {
1992
1992
  * What the Save dialog starts from: the options the file was opened with
1993
1993
  * (`"asOpened"`, the default), or one of its presets. `compression` is for a map with
1994
1994
  * no origin — new, or opened from a bare .chk — where there is nothing to follow;
1995
- * `"asOpened"` there means StarEdit's PKWARE.
1995
+ * `"asOpened"` there means StarEdit's PKWARE. `backup` keeps the file a save writes
1996
+ * over: `<name>.bak` beside it in the desktop app, the browser's storage otherwise
1997
+ * (`services/previousVersions.ts`).
1996
1998
  */
1997
1999
  save: {
1998
2000
  start: "asOpened" | "everything" | "smallest";
1999
2001
  compression: "asOpened" | ArchiveCompression;
2002
+ backup: boolean;
2003
+ };
2004
+ /**
2005
+ * Recovery copies (`hooks/useRecovery.ts`): while a map has unsaved changes, a copy of
2006
+ * it is kept in the browser's storage every `minutes` and when the editor goes to the
2007
+ * background, and dropped when the map is saved or closed. What a session that ended
2008
+ * without saving left behind is offered back at the next start. Off stops the copies
2009
+ * and drops this session's; copies left by earlier sessions are still offered.
2010
+ */
2011
+ recovery: {
2012
+ enabled: boolean;
2013
+ minutes: number;
2000
2014
  };
2001
2015
  /** How many edits Undo keeps per map (SCMDraft keeps 200). */
2002
2016
  undoLevels: number;
@@ -3579,6 +3593,13 @@ export interface GameDataApi {
3579
3593
  select(id: string): Promise<GameDataSource>;
3580
3594
  /** Remove a data set's copy (never the game's bundled files). True when there was one. */
3581
3595
  remove(id: string): Promise<boolean>;
3596
+ /**
3597
+ * One file of the data set in use, by its path in the extracted copy: the archive path in
3598
+ * lower case with forward slashes (`arr/units.dat`, `tileset/jungle.cv5`,
3599
+ * `unit/zerg/drone.grp`). `tileset/manifest.json` and `unit/manifest.json` list what was
3600
+ * extracted. Null when the copy has no such file, or there is no game data.
3601
+ */
3602
+ read(path: string): Promise<Uint8Array | null>;
3582
3603
  }
3583
3604
  /**
3584
3605
  * The constants a plugin needs to *write* a record rather than read one: the bit masks in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.36.0",
3
+ "version": "1.37.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",