@patterkit/runtime 0.14.3 → 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 +13 -0
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -33,6 +33,19 @@ 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
|
+
|
|
36
49
|
## [0.14.3] - 2026-09-27
|
|
37
50
|
|
|
38
51
|
### Fixed
|
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) {
|