@patterkit/runtime 0.10.0 → 0.12.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 +26 -0
- package/README.md +16 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -72
- package/dist/index.d.ts +4 -72
- package/dist/index.js.map +1 -1
- package/package.json +3 -6
- package/dist/patterplay.min.js +0 -3
- package/dist/patterplay.min.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -33,6 +33,32 @@ version number always means the same runtime behaviour. This package is versione
|
|
|
33
33
|
|
|
34
34
|
## [Unreleased]
|
|
35
35
|
|
|
36
|
+
## [0.12.0] - 2026-09-04
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- **`patterplay.min.js` moved to `@patterkit/play-helpers`, and carries the helpers.** The browser
|
|
41
|
+
drop-in used to be this package's own build, runtime alone, so a plain page with no bundler could
|
|
42
|
+
play but not write the family's save text. It is now built by the play-helpers package (the one
|
|
43
|
+
that depends on both) with the runtime AND the helpers under the one `Patterplay` global. The
|
|
44
|
+
play-js release still ships it loose and in the zip; on a CDN it now lives at
|
|
45
|
+
`@patterkit/play-helpers/dist/patterplay.min.js`, and this npm package no longer contains it.
|
|
46
|
+
(Asked for by the Storylets side, whose drop-in took the same shape the same day.)
|
|
47
|
+
|
|
48
|
+
## [0.11.0] - 2026-09-03
|
|
49
|
+
|
|
50
|
+
### Changed
|
|
51
|
+
|
|
52
|
+
- **The `patter/save@0` shape is the family's contract, and its types live in `@patterkit/model`.**
|
|
53
|
+
`SaveEnvelope`, `SaveGame`, `FlowSnapshot`, `FlowCursor` and the rest are exported from the model
|
|
54
|
+
with `SAVE_SCHEMA`, and re-exported here so existing imports keep working. Nothing this runtime
|
|
55
|
+
writes has changed: its output was always this shape. The three native ports now write and read
|
|
56
|
+
it too, so a save crosses engines, and the conformance corpus carries a save this runtime wrote
|
|
57
|
+
that every runtime must load, write back with the same key paths, and continue.
|
|
58
|
+
- **A host-scope declaration's `writable: false` is pinned as the story's promise**, refused whether
|
|
59
|
+
the scope is bound by the game or self-backed. This runtime always did so; the test now says it
|
|
60
|
+
in one place, and the three native ports match it from this version.
|
|
61
|
+
|
|
36
62
|
## [0.10.0] - 2026-09-02
|
|
37
63
|
|
|
38
64
|
### Added
|
package/README.md
CHANGED
|
@@ -15,11 +15,13 @@ Three equivalent channels - pick whichever fits how you work; **no npm is requir
|
|
|
15
15
|
- **Release zip**: `patterplay-js-<version>.zip` on every
|
|
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
|
-
It carries `patterplay.min.js` (the `<script>` drop-in
|
|
19
|
-
`
|
|
20
|
-
|
|
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).
|
|
21
22
|
- **npm**: `npm install @patterkit/runtime` (same version as the zip).
|
|
22
|
-
- **CDN**: `patterplay.min.js` via unpkg/jsDelivr
|
|
23
|
+
- **CDN**: `patterplay.min.js` via unpkg/jsDelivr from `@patterkit/play-helpers` (the package
|
|
24
|
+
that builds it), or loose on the same Release.
|
|
23
25
|
|
|
24
26
|
## Use it (npm / bundler)
|
|
25
27
|
|
|
@@ -58,19 +60,22 @@ its own system, then applies `{@ref}` replacement with **`flow.interpolate(yourS
|
|
|
58
60
|
## Drop-in (`<script>`)
|
|
59
61
|
|
|
60
62
|
`patterplay.min.js` is a single self-contained, minified IIFE - every dependency
|
|
61
|
-
inlined - for plain HTML pages with no bundler
|
|
63
|
+
inlined - for plain HTML pages with no bundler. It carries this runtime AND
|
|
64
|
+
[`@patterkit/play-helpers`](../play-helpers) on the one `Patterplay` global, so a plain
|
|
65
|
+
page can also write and read the family's save text:
|
|
62
66
|
|
|
63
67
|
```html
|
|
64
|
-
<script src="https://unpkg.com/@patterkit/
|
|
68
|
+
<script src="https://unpkg.com/@patterkit/play-helpers/dist/patterplay.min.js"></script>
|
|
65
69
|
<script>
|
|
66
|
-
const { Engine } = window.Patterplay;
|
|
67
|
-
const
|
|
68
|
-
|
|
70
|
+
const { Engine, serializeState, deserializeState } = window.Patterplay; // also: Flow, gameDataFields, createStateLogger, ...
|
|
71
|
+
const engine = new Engine(BUNDLE);
|
|
72
|
+
const flow = engine.openFlow("main", { scene: "square" });
|
|
73
|
+
// ...advance() / choose() exactly as above; localStorage.setItem("slot1", serializeState(engine)) to save.
|
|
69
74
|
</script>
|
|
70
75
|
```
|
|
71
76
|
|
|
72
|
-
|
|
73
|
-
`dist/patterplay.min.js`).
|
|
77
|
+
It is built by the play-helpers package, the one that depends on both: `npm run build -w
|
|
78
|
+
@patterkit/play-helpers` (emits `packages/play-helpers/dist/patterplay.min.js`).
|
|
74
79
|
|
|
75
80
|
## Demos
|
|
76
81
|
|