@patterkit/runtime 0.5.0 → 0.6.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 +19 -1
- package/dist/index.cjs +29 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +29 -3
- package/dist/index.js.map +1 -1
- package/dist/patterplay.min.js +2 -2
- package/dist/patterplay.min.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [f97f6eb]
|
|
8
|
+
- @patterkit/model@0.4.0
|
|
9
|
+
- @patterkit/dialect@0.1.6
|
|
10
|
+
|
|
3
11
|
## 0.4.1
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -25,6 +33,16 @@ version number always means the same runtime behaviour. This package is versione
|
|
|
25
33
|
|
|
26
34
|
## [Unreleased]
|
|
27
35
|
|
|
36
|
+
## [0.6.0] - 2026-08-25
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **The `quality` property type: a story stage as an ordered ladder of named stages.** The value is a
|
|
41
|
+
stage name; ordering operators compare by ladder POSITION, `advance(@q)` steps to the next stage
|
|
42
|
+
saturating at the last, and a save carries the stage by name - so a stage inserted mid-production
|
|
43
|
+
shifts nothing. Declared with `stages` on the property; seeds at the first stage. Corpus-locked
|
|
44
|
+
across all four runtimes (gating, stepping, and the insertion story through a live hot swap).
|
|
45
|
+
|
|
28
46
|
## [0.5.0] - 2026-08-21
|
|
29
47
|
|
|
30
48
|
### Added
|
|
@@ -33,7 +51,7 @@ version number always means the same runtime behaviour. This package is versione
|
|
|
33
51
|
project declares, the speakers of a scene, and the speakers of one block. Scene and block refs take
|
|
34
52
|
an internal id or a gameId address. The result is the character token a line beat carries, deduped
|
|
35
53
|
and ordered by first appearance, and it is derived from the AUTHORED structure, so a speaker behind a
|
|
36
|
-
condition, inside a group, or voicing a choice prompt is included: it answers who
|
|
54
|
+
condition, inside a group, or voicing a choice prompt is included: it answers who _can_ speak, not
|
|
37
55
|
who a given playthrough heard. Held across all four runtimes by the conformance corpus.
|
|
38
56
|
`engine.getCast()`, `engine.castForScene(sceneRef)`, `engine.castForBlock(sceneRef, blockRef)`.
|
|
39
57
|
|
package/dist/index.cjs
CHANGED
|
@@ -525,6 +525,7 @@ var Engine = class _Engine {
|
|
|
525
525
|
ref: `@${d.name}`,
|
|
526
526
|
type: d.type,
|
|
527
527
|
values: d.values,
|
|
528
|
+
stages: d.stages,
|
|
528
529
|
value: this.getProperty(`@${d.name}`),
|
|
529
530
|
default: declDefault(d)
|
|
530
531
|
}));
|
|
@@ -657,9 +658,28 @@ var Flow = class {
|
|
|
657
658
|
nextRandom: this.rng,
|
|
658
659
|
visits: (id2) => this.visitCounts.get(id2) ?? 0,
|
|
659
660
|
patterVisits: (id2) => this.host.sharedVisits.get(id2) ?? 0
|
|
660
|
-
}
|
|
661
|
+
},
|
|
662
|
+
// The quality channel (expr 0.4.0): hands the evaluator a property's stage ladder, which is what
|
|
663
|
+
// makes ordering compare by position and advance() step. Wired by hand because this context takes
|
|
664
|
+
// only the registry's SCOPES (the patter/scene resolvers here are the flow's own merged views),
|
|
665
|
+
// and because @scene declarations belong to whichever scene the flow is in RIGHT NOW.
|
|
666
|
+
qualities: (scope, name) => this.stagesFor(scope, name)
|
|
661
667
|
};
|
|
662
668
|
}
|
|
669
|
+
/** The stage ladder of `@scope.name` when it is a declared quality, else undefined. Names compare
|
|
670
|
+
* lowercase, as the compiler emits references (the selfBackedResolver lesson). */
|
|
671
|
+
stagesFor(scope, name) {
|
|
672
|
+
const key = name.toLowerCase();
|
|
673
|
+
const fromDecls = (decls) => decls?.find((d) => d.name.toLowerCase() === key && d.type === "quality")?.stages;
|
|
674
|
+
if (scope === "patter") {
|
|
675
|
+
return fromDecls(this.host.patterSharedDecls) ?? fromDecls(this.host.patterLocalDecls);
|
|
676
|
+
}
|
|
677
|
+
if (scope === "scene") {
|
|
678
|
+
const scene = this.currentSceneId != null ? this.host.bundle.scenes[this.currentSceneId] : void 0;
|
|
679
|
+
return fromDecls(scene?.sceneProps);
|
|
680
|
+
}
|
|
681
|
+
return fromDecls(this.host.bundle.scopeRegistry?.scopes.find((s) => s.token === scope)?.declarations);
|
|
682
|
+
}
|
|
663
683
|
// -- Host API -------------------------------------------------------------
|
|
664
684
|
/** Begin this flow at a scene (and optionally a specific block within it). */
|
|
665
685
|
start(sceneId, blockId) {
|
|
@@ -1421,7 +1441,7 @@ function deserialiseSelectors(rec) {
|
|
|
1421
1441
|
return map;
|
|
1422
1442
|
}
|
|
1423
1443
|
function toDecl(decl) {
|
|
1424
|
-
return { name: decl.name, type: decl.type, values: decl.values, default: decl.default };
|
|
1444
|
+
return { name: decl.name, type: decl.type, values: decl.values, stages: decl.stages, default: decl.default };
|
|
1425
1445
|
}
|
|
1426
1446
|
function declDefault(d) {
|
|
1427
1447
|
if (d.default !== void 0) return d.default;
|
|
@@ -1434,12 +1454,14 @@ function declDefault(d) {
|
|
|
1434
1454
|
return [];
|
|
1435
1455
|
case "enum":
|
|
1436
1456
|
return d.values?.[0] ?? "";
|
|
1457
|
+
case "quality":
|
|
1458
|
+
return d.stages?.[0] ?? "";
|
|
1437
1459
|
default:
|
|
1438
1460
|
return false;
|
|
1439
1461
|
}
|
|
1440
1462
|
}
|
|
1441
1463
|
function toForeignDecl(decl) {
|
|
1442
|
-
return { name: decl.name, type: decl.type, values: decl.values, default: decl.default, writable: decl.writable };
|
|
1464
|
+
return { name: decl.name, type: decl.type, values: decl.values, stages: decl.stages, default: decl.default, writable: decl.writable };
|
|
1443
1465
|
}
|
|
1444
1466
|
function hostScopeDefault(decl) {
|
|
1445
1467
|
if (decl.default !== void 0) return decl.default;
|
|
@@ -1454,6 +1476,8 @@ function hostScopeDefault(decl) {
|
|
|
1454
1476
|
return [];
|
|
1455
1477
|
case "enum":
|
|
1456
1478
|
return decl.values?.[0] ?? "";
|
|
1479
|
+
case "quality":
|
|
1480
|
+
return decl.stages?.[0] ?? "";
|
|
1457
1481
|
}
|
|
1458
1482
|
}
|
|
1459
1483
|
function selfBackedResolver(decls) {
|
|
@@ -1480,6 +1504,8 @@ function sceneDefault(decl) {
|
|
|
1480
1504
|
return [];
|
|
1481
1505
|
case "enum":
|
|
1482
1506
|
return decl.values?.[0] ?? "";
|
|
1507
|
+
case "quality":
|
|
1508
|
+
return decl.stages?.[0] ?? "";
|
|
1483
1509
|
}
|
|
1484
1510
|
}
|
|
1485
1511
|
function truthy(v) {
|