@patterkit/runtime 0.14.2 → 0.15.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
@@ -33,6 +33,30 @@ version number always means the same runtime behaviour. This package is versione
33
33
 
34
34
  ## [Unreleased]
35
35
 
36
+ ## [0.15.0] - 2026-10-03
37
+
38
+ ### Added
39
+
40
+ - **Scene and block gameData you can read at runtime.** The bundle always carried a scene's and a
41
+ block's gameData, but nothing handed it to the host. Two static reads now do, by internal id or
42
+ gameId address. They return the node's own overrides, raw, the same rule as a beat's
43
+ `step.gameData`: the project's field defaults are not merged in (resolve them with
44
+ `effectiveGameData`), and a block does not inherit its scene's. A node that sets none, or a ref
45
+ that does not resolve, gives an empty object. `getOutline()` carries the same overrides as
46
+ `gameData` on each scene and block, left out when empty. Held across all four runtimes by the
47
+ conformance corpus. `engine.gameDataForScene(sceneRef)`, `engine.gameDataForBlock(sceneRef, blockRef)`.
48
+
49
+ ## [0.14.3] - 2026-09-27
50
+
51
+ ### Fixed
52
+
53
+ - **The JS zip's module builds work without npm.** The zip carried the npm package's module build,
54
+ which imports five other packages the zip never included, so copying it into a project and
55
+ importing it failed until you installed them from npm. The zip now carries builds of the runtime
56
+ and of `@patterkit/play-helpers` with their dependencies inside them, under
57
+ `@patterkit/runtime/dist/` and `@patterkit/play-helpers/dist/`. They carry their own registry as a
58
+ result; to share one registry between engines, install from npm. The npm package is unchanged.
59
+
36
60
  ## [0.14.2] - 2026-09-27
37
61
 
38
62
  ### Changed
package/README.md CHANGED
@@ -16,9 +16,11 @@ Three equivalent channels - pick whichever fits how you work; **no npm is requir
16
16
  [`play-js-v*` GitHub Release](https://github.com/patterkit/patter/releases) - this
17
17
  runtime as a plain download, symmetric with the Unity / Unreal / Godot plugin zips.
18
18
  It carries `patterplay.min.js` (the `<script>` drop-in: this runtime plus
19
- `@patterkit/play-helpers` under one global), the module builds under `dist/` (ESM + CJS +
20
- types, for vendoring into your own build), this README, the CHANGELOG, and two `demos/`
21
- (the zero-build drop-in page and the interactive tour).
19
+ `@patterkit/play-helpers` under one global), the module builds of both packages under
20
+ `@patterkit/runtime/dist/` and `@patterkit/play-helpers/dist/` (ESM + CJS + types, with their
21
+ dependencies inside them, so they need nothing installed), this README, the CHANGELOG, and two
22
+ `demos/` (the zero-build drop-in page and the interactive tour). The zip's builds carry their own
23
+ registry; to share one registry between engines, install from npm.
22
24
  - **npm**: `npm install @patterkit/runtime` (same version as the zip). `@wildwinter/scoperegistry`
23
25
  is a peer dependency, so a game holds one registry that every engine shares; npm installs it for
24
26
  you, and a package manager that doesn't install peers needs `npm install @wildwinter/scoperegistry`.
package/dist/index.cjs CHANGED
@@ -420,6 +420,24 @@ var Engine = class _Engine {
420
420
  const id = this.resolveBlockRef(sceneId, blockRef);
421
421
  return (id != null ? this.host.tagIndex.get(id) : void 0) ?? [];
422
422
  }
423
+ /**
424
+ * A scene's own author gameData (by internal id or gameId address): the RAW sparse overrides, exactly
425
+ * as a beat's step carries its own, not merged with the project's declared field defaults (resolve
426
+ * those with `effectiveGameData(gameDataFields(bundle, "scene"), ...)`). Not inherited by its blocks.
427
+ * A fresh object each call; empty when the scene sets none or the ref is unknown.
428
+ */
429
+ gameDataForScene(sceneRef) {
430
+ const id = this.resolveSceneRef(sceneRef);
431
+ const scene = id != null ? this.host.bundle.scenes[id] : void 0;
432
+ return { ...scene?.gameData };
433
+ }
434
+ /** A block's own author gameData, by scene + block ref (id or gameId). Raw overrides, like
435
+ * {@link gameDataForScene}; the scene's gameData is not folded in. Empty when none / unknown. */
436
+ gameDataForBlock(sceneRef, blockRef) {
437
+ const id = this.resolveBlockRef(this.resolveSceneRef(sceneRef), blockRef);
438
+ const block = id != null ? this.host.blockById.get(id) : void 0;
439
+ return { ...block?.gameData };
440
+ }
423
441
  /**
424
442
  * Every cast member the PROJECT declares, in authored order - the same list `describeBundle` counts.
425
443
  * A superset of any scene's cast: the validator holds a beat's `character` to a declared member, so
@@ -466,11 +484,13 @@ var Engine = class _Engine {
466
484
  id: scene.id,
467
485
  ...(0, import_model.effectiveGameId)(scene) ? { gameId: (0, import_model.effectiveGameId)(scene) } : {},
468
486
  name: scene.name,
487
+ ...gameDataField(scene.gameData),
469
488
  ...this.tagsField(scene.id),
470
489
  blocks: scene.blocks.map((block) => ({
471
490
  id: block.id,
472
491
  ...(0, import_model.effectiveGameId)(block) ? { gameId: (0, import_model.effectiveGameId)(block) } : {},
473
492
  name: block.name,
493
+ ...gameDataField(block.gameData),
474
494
  ...this.tagsField(block.id),
475
495
  children: block.children.map((n) => this.outlineNode(n))
476
496
  }))
@@ -1673,6 +1693,9 @@ function collectCast(nodes, out) {
1673
1693
  for (const beat of n.beats ?? []) if (beat.kind === "line" && beat.character) out.add(beat.character);
1674
1694
  });
1675
1695
  }
1696
+ function gameDataField(gameData) {
1697
+ return gameData && Object.keys(gameData).length ? { gameData } : {};
1698
+ }
1676
1699
  function serialiseSelectors(map) {
1677
1700
  const out = {};
1678
1701
  for (const [id, st] of map) {