@pkhex-everywhere/react 0.2.3 → 0.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @pkhex-everywhere/react
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - c6812ee: `game.formats()` lists the save formats PKHeX doesn't know, such as ROM hacks, by id and name. `game.load()` takes an optional `formatId` that loads the save with that format and skips detection. An unknown id fails with `not-found`. Client methods and hook commands now carry the engine's doc comments, and `useLoadedGame().load()` takes `formatId` too.
8
+ - Updated dependencies [c6812ee]
9
+ - Updated dependencies [79bb0ce]
10
+ - Updated dependencies [cb21c83]
11
+ - Updated dependencies [dde2b58]
12
+ - Updated dependencies [f11f9a8]
13
+ - Updated dependencies [670a8ed]
14
+ - @pkhex-everywhere/engine@0.3.0
15
+
3
16
  ## 0.2.3
4
17
 
5
18
  ### Patch Changes
@@ -22,7 +22,14 @@ export declare function useLoadedGame(): {
22
22
  /** Requires a loaded save; throws `no-save` otherwise. Wrap in `<RequireGame>`. */
23
23
  export: () => Promise<import("@pkhex-everywhere/engine").ExportedSave>;
24
24
  file: () => Promise<import("@pkhex-everywhere/engine").LoadedSave | null>;
25
- load: (data: Binary, fileName?: string | null) => Promise<void>;
25
+ /**
26
+ * Loads a save file, replacing the one loaded before.
27
+ *
28
+ * @param data The save file's bytes.
29
+ * @param fileName The file name to export the save with. Defaults to the name of a `File`, or `save.sav`.
30
+ * @param formatId The id of a save format from `game.formats()` to load the save with, skipping detection. Pass `pkhex` to load it with PKHeX's own detection. An unknown id fails with `not-found`, and a save the format can't read fails with `invalid-save`. Without it, a save that might be in one of the formats fails with `format-choice-required`, whose `candidates` list them.
31
+ */
32
+ load: (data: Binary, fileName?: string | null, formatId?: string | null) => Promise<void>;
26
33
  loadBlank: (version: number) => Promise<void>;
27
34
  game: import("@pkhex-everywhere/engine").SaveSummary | null;
28
35
  };
package/dist/index.js CHANGED
@@ -165,7 +165,14 @@ function useLoadedGame() {
165
165
  /** Requires a loaded save; throws `no-save` otherwise. Wrap in `<RequireGame>`. */
166
166
  export: () => engine.game.export(),
167
167
  file: () => engine.game.file(),
168
- load: (data, fileName) => engine.game.load(data, fileName),
168
+ /**
169
+ * Loads a save file, replacing the one loaded before.
170
+ *
171
+ * @param data The save file's bytes.
172
+ * @param fileName The file name to export the save with. Defaults to the name of a `File`, or `save.sav`.
173
+ * @param formatId The id of a save format from `game.formats()` to load the save with, skipping detection. Pass `pkhex` to load it with PKHeX's own detection. An unknown id fails with `not-found`, and a save the format can't read fails with `invalid-save`. Without it, a save that might be in one of the formats fails with `format-choice-required`, whose `candidates` list them.
174
+ */
175
+ load: (data, fileName, formatId) => engine.game.load(data, fileName, formatId),
169
176
  loadBlank: (version) => engine.game.loadBlank(version)
170
177
  }), [engine])
171
178
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkhex-everywhere/react",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "React hooks for @pkhex-everywhere/engine.",
5
5
  "license": "GPL-3.0-or-later",
6
6
  "homepage": "https://docs.pkhex-everywhere.fyi/docs/",
@@ -30,7 +30,7 @@
30
30
  "test": "vitest run"
31
31
  },
32
32
  "peerDependencies": {
33
- "@pkhex-everywhere/engine": "^0.2.3",
33
+ "@pkhex-everywhere/engine": "^0.3.0",
34
34
  "react": "^19.0.0"
35
35
  },
36
36
  "devDependencies": {