@datamoc/mw_games 0.24.1 → 0.26.1

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.
Files changed (79) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/README.md +15 -0
  3. package/api-surface.json +14468 -0
  4. package/dist/actors/StatBlock.d.ts +2 -4
  5. package/dist/actors/StatBlock.d.ts.map +1 -1
  6. package/dist/actors/StatBlock.js +2 -4
  7. package/dist/actors/StatBlock.js.map +1 -1
  8. package/dist/ai/Heuristics.d.ts +1 -1
  9. package/dist/ai/Heuristics.js +1 -1
  10. package/dist/assets/index.d.ts +1 -0
  11. package/dist/assets/index.d.ts.map +1 -1
  12. package/dist/assets/index.js.map +1 -1
  13. package/dist/core/Blob.d.ts.map +1 -1
  14. package/dist/core/Blob.js +2 -8
  15. package/dist/core/Blob.js.map +1 -1
  16. package/dist/core/Grid.d.ts +115 -0
  17. package/dist/core/Grid.d.ts.map +1 -1
  18. package/dist/core/Grid.js +125 -0
  19. package/dist/core/Grid.js.map +1 -1
  20. package/dist/core/Handles.d.ts +42 -0
  21. package/dist/core/Handles.d.ts.map +1 -0
  22. package/dist/core/Handles.js +38 -0
  23. package/dist/core/Handles.js.map +1 -0
  24. package/dist/core/HttpTransport.d.ts +14 -0
  25. package/dist/core/HttpTransport.d.ts.map +1 -1
  26. package/dist/core/HttpTransport.js +14 -0
  27. package/dist/core/HttpTransport.js.map +1 -1
  28. package/dist/core/Random.d.ts +54 -13
  29. package/dist/core/Random.d.ts.map +1 -1
  30. package/dist/core/Random.js +48 -25
  31. package/dist/core/Random.js.map +1 -1
  32. package/dist/core/index.d.ts +8 -4
  33. package/dist/core/index.d.ts.map +1 -1
  34. package/dist/core/index.js +3 -1
  35. package/dist/core/index.js.map +1 -1
  36. package/dist/headless/index.d.ts +87 -0
  37. package/dist/headless/index.d.ts.map +1 -0
  38. package/dist/headless/index.js +87 -0
  39. package/dist/headless/index.js.map +1 -0
  40. package/dist/mw_games.global.js +113 -112
  41. package/dist/mwl/catalog.d.ts +13 -2
  42. package/dist/mwl/catalog.d.ts.map +1 -1
  43. package/dist/mwl/catalog.js +14 -5
  44. package/dist/mwl/catalog.js.map +1 -1
  45. package/dist/mwl/index.d.ts +3 -1
  46. package/dist/mwl/index.d.ts.map +1 -1
  47. package/dist/mwl/index.js +1 -0
  48. package/dist/mwl/index.js.map +1 -1
  49. package/dist/mwl/tables.d.ts +93 -0
  50. package/dist/mwl/tables.d.ts.map +1 -0
  51. package/dist/mwl/tables.js +87 -0
  52. package/dist/mwl/tables.js.map +1 -0
  53. package/dist/roguelike/Level.d.ts +1 -1
  54. package/dist/roguelike/Level.d.ts.map +1 -1
  55. package/dist/roguelike/Level.js +3 -21
  56. package/dist/roguelike/Level.js.map +1 -1
  57. package/dist/roguelike/Targeting.d.ts.map +1 -1
  58. package/dist/roguelike/Targeting.js +2 -1
  59. package/dist/roguelike/Targeting.js.map +1 -1
  60. package/dist/rpg/index.d.ts +1 -1
  61. package/dist/rpg/index.d.ts.map +1 -1
  62. package/dist/simulation/Runtime.d.ts +18 -2
  63. package/dist/simulation/Runtime.d.ts.map +1 -1
  64. package/dist/simulation/Runtime.js +7 -3
  65. package/dist/simulation/Runtime.js.map +1 -1
  66. package/dist/two-d/pixi-interop.d.ts +24 -1
  67. package/dist/two-d/pixi-interop.d.ts.map +1 -1
  68. package/dist/two-d/pixi-interop.js +23 -1
  69. package/dist/two-d/pixi-interop.js.map +1 -1
  70. package/dist/two-d/render/index.d.ts +2 -2
  71. package/dist/two-d/render/index.d.ts.map +1 -1
  72. package/dist/version.d.ts +1 -1
  73. package/dist/version.js +1 -1
  74. package/package.json +16 -3
  75. package/sbom.cdx.json +6 -6
  76. package/tools/audit-adoptions.d.mts +65 -0
  77. package/tools/audit-adoptions.mjs +252 -0
  78. package/tools/browser-driver.d.mts +78 -0
  79. package/tools/browser-driver.mjs +642 -0
package/CHANGELOG.md CHANGED
@@ -7,6 +7,146 @@ the public API may still change between minor versions.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.26.1] - 2026-10-07
11
+
12
+ The 0.26.0 follow-up: its Chrome end-to-end test failed on every CI run, so the
13
+ `tools/browser-driver` Chrome engine never actually worked on a CI machine (a cold
14
+ Windows runner never reached the debugging endpoint in the old budget; an Ubuntu
15
+ runner crashed in Chrome's sandbox). Chrome now launches against its own profile,
16
+ the endpoint is watched on both output streams with a cold-start budget and a
17
+ diagnostic that names what the browser printed, `close` releases the profile and
18
+ the stdio pipes only after the child exits, and the CI workflows pass
19
+ `--no-sandbox` on Linux through the driver's own `MWG_DRIVER_CHROME_ARGS` channel.
20
+ 0.26.0 was tagged before this was known and its npm publish never ran.
21
+
22
+ ### Fixed
23
+
24
+ - `tools/browser-driver`'s Chrome engine launches against its own profile
25
+ (`options.profileDir`, or a temp dir the driver creates and removes on `close`)
26
+ instead of the machine's default one, watches both stdout and stderr for the
27
+ debugging endpoint (which stream a build prints it on is not something to bet
28
+ on), waits up to 30 s instead of 15 (a cold CI machine's first Chrome start can
29
+ outrun the old budget), and names what the browser printed when the endpoint
30
+ never arrives. This is the fix for the Chrome end-to-end test failing on every
31
+ CI run since the driver landed: the default profile on a fresh runner never
32
+ reached the endpoint in time. `close` now also destroys the child's stdio
33
+ pipes (surviving browser helper processes could hold a suite open past the
34
+ browser's own death) and releases the profile only after the child exits.
35
+ The failing configuration is now diagnosed, not just reported: the timeout
36
+ names what the browser printed. CI's Linux jobs pass `--no-sandbox` through
37
+ the driver's `MWG_DRIVER_CHROME_ARGS` channel, since an Ubuntu 23.10+ runner
38
+ that disables unprivileged user namespaces is a property of that machine,
39
+ not of the tool.
40
+
41
+ ## [0.26.0] - 2026-10-07
42
+
43
+ The machine-readable surface and the audit tooling around it: `api-surface.json` ships as the
44
+ `./api-manifest` subpath (one `{ name, kind, subpath, declaringModule }` row per export), the
45
+ blessed `mwg/headless` entry imports every renderer-free module in one line, `tools/audit-adoptions`
46
+ checks a consumer's imports and local definitions against that manifest, and the dependency-free
47
+ `tools/browser-driver` harness drives real Chrome and Firefox. `core` gained injectable `RandomSource`
48
+ streams for every derived helper and the shared square-grid rulers (`chebyshev`, `manhattan`,
49
+ `euclidean`, `distance` by `DistanceMetric`), the coverage gate now enforces `two-d/ui` instead of
50
+ excluding the whole tree, and the bundle-size baseline is refreshed for the growth those brought.
51
+
52
+ ### Added
53
+
54
+ - Exported the types a public signature already names: `mwl` move/evolution/matchup
55
+ definitions, `core` achievement criteria and hex shape types, particle curve and spawn
56
+ area types, screen effect steps, `rpg` route targets, asset loader options, and the
57
+ `core.HttpTransport` base class its four clients already extend.
58
+
59
+ - `core.NEIGHBOURS4`/`NEIGHBOURS8`/`CIRCLE8` share one frozen square-grid offset table
60
+ instead of each module keeping its own: axial, row-major eight, and the clockwise ring
61
+ (`roguelike`'s `neighbourOffsets` returns these now); `core.euclidean` is the
62
+ straight-line ruler beside `roguelike`'s `chebyshevDistance`.
63
+
64
+ - `core.chebyshev` is the king-move ruler beside `euclidean` (a diagonal costs one
65
+ step) and `core.manhattan` the orthogonal-step count; `core.distance` measures with
66
+ the ruler a `DistanceMetric` names, so a data-authored rule picks its geometry by
67
+ name. `roguelike`'s `chebyshevDistance` delegates to `chebyshev` instead of spelling
68
+ the arithmetic out again.
69
+
70
+ - `api-surface.json` is the machine-readable API surface: one
71
+ `{ name, kind, subpath, declaringModule }` entry per export per subpath,
72
+ generated by the same `tools/api-report.mjs` pass that maintains
73
+ `API_REPORT.md`, shipped in the package behind the `./api-manifest` subpath,
74
+ and pinned by `tests/api-manifest.test.ts` (shape and coverage) plus the
75
+ existing `--check` (agreement with the declarations). `node
76
+ tools/api-report.mjs --diff OLD NEW` diffs two releases' surfaces, and the
77
+ report parser no longer drops `export type { ... }` re-export lists.
78
+
79
+ - `core.RandomSource` lets every derived helper (`chance`, `element`,
80
+ `weighted`, `weightedKey`, `shuffle`, `int`, `range`, `normalRange`) draw
81
+ from an injected stream: pass a rule-local `Generator` (or any
82
+ `float`/`int` pair) as the trailing `source` and the ambient stream is left
83
+ untouched, with identical draws and the same `null` reporting.
84
+
85
+ - `node tools/api-report.mjs --diff OLD NEW` lists added, removed and
86
+ kind-changed exports between two `api-surface.json` manifests, so a version
87
+ bump yields a one-command surface diff.
88
+
89
+ - `mwg/headless` is the blessed renderer-free entry: `core`, `simulation`,
90
+ `mwl`, `i18n`, `actors`, `world`, `battle`, `roguelike`, `board`, `audio`,
91
+ `rpg`, `ai`, `testing` and the two renderer-free asset halves, in one import
92
+ with no DOM or WebGL globals. `tests/headless-smoke.test.ts` imports it in
93
+ plain Node, walks the reachable graph for a renderer leak, and replays a
94
+ seeded scenario through it.
95
+
96
+ - `tools/audit-adoptions` (also `mwg-audit-adoptions`) is the shipped consumer
97
+ adoption auditor: manifest plus reasons file plus config (type-only
98
+ directories, subpath deny-lists, per-pattern import budgets), reporting
99
+ unadopted exports, stale reasons, shadowing collisions and config violations
100
+ with `file:line` and a non-zero exit.
101
+
102
+ - `two-d/pixi-interop` now states the interop-only rationale on each
103
+ re-exported primitive's own declaration: every histogram symbol
104
+ (`Rectangle`, `Texture`, `Container`, `Sprite`, `Graphics`, `FillGradient`,
105
+ `TilingSprite`) already has a facade family, so the note names the
106
+ Pixi-typed seam that keeps the raw export, and `tests/pixi-interop-coverage`
107
+ pins both halves.
108
+
109
+ - `tools/browser-driver` is the dependency-free browser harness: a self-served
110
+ static directory on an OS-chosen free port, Chrome over CDP and Firefox over
111
+ WebDriver BiDi behind one surface (`goto`/`waitReady`/`tap` at canvas
112
+ fractions/`evaluate`/`script`/`screenshot`/`consoleErrors`/`close`), reusing
113
+ the `browser-smoke` readiness contract. Verified live on both engines.
114
+
115
+ ### Changed
116
+
117
+ - The coverage gate now enforces `two-d/ui` instead of excluding the whole tree:
118
+ the widget tests the suite already ran carry it (97.3/92.6/94.3 against the
119
+ 88/89/82 floors), so the exclusion was stale, and a wildcard also left every
120
+ new UI file silently ungated. `EventDialogue` stays excluded as intended, under
121
+ its real path (`two-d/ui`, where the old flag pointed at a nonexistent
122
+ `two-d/stage` copy), and `SelectionModel` gained a direct contract test that
123
+ covers it fully, where before only its embedding widgets exercised it.
124
+
125
+ ## [0.25.0] - 2026-10-05
126
+
127
+ Framework support for the Pixel Dungeon port's simulation and content proposals: numeric
128
+ handle leases for clone-safe commands, journal-free dispatch, one shared random stream for
129
+ scene and simulation draws, MWL node-namespace references, and type-safe table rows with a
130
+ type-emission helper for game build scripts.
131
+
132
+ ### Added
133
+
134
+ - `core.Random.active()` returns the ambient generator the free functions draw from, so a
135
+ `SimulationRuntime` constructed with it shares one stream with scene code; `snapshot`/
136
+ `restore` of that generator replay identical continuations.
137
+ - `SimulationRuntime.restore()` accepts `random` to adopt an externally-owned generator
138
+ (such as the global one), keeping scene and command draws in lockstep across restore.
139
+ - `core.createHandles()`/`Handles` - numeric leases for values a plain-data command cannot
140
+ carry, with a scoped `with(value, body)` lease that drops even when the body throws.
141
+ - `SimulationRuntime` accepts `journal: null` for a journal-free dispatch facade: no append
142
+ cost, an empty journal in `snapshot()`, and plainly documented replay/undo semantics.
143
+ - `mwl.MwlTableReference` accepts a node-id namespace target (`references: { node: 'monster' }`),
144
+ checking table cells against authored node ids with the same table/row/value report.
145
+ - `mwl.typedRows()`/`MwlTypedRow`/`MwlColumnValueType` read table rows through their declared
146
+ columns (every field optional, an absent cell omits the key), and `mwl.emitTableTypes()`
147
+ emits one named row interface plus one typed accessor per table for a game's build script,
148
+ so a changed column type or a removed column fails type-checking at every use.
149
+
10
150
  ## [0.24.1] - 2026-10-02
11
151
 
12
152
  Dependency refresh: Babylon.js 9.29, `@capacitor/cli` held at 8.5.2 so it matches the other Capacitor
package/README.md CHANGED
@@ -336,6 +336,21 @@ edited in a proper editor, without any of those options requiring changes to the
336
336
  It also keeps the content out of the bundle: `tools/compile-resources` treats a map file
337
337
  exactly like a sprite sheet, so adding a hundred maps does not touch the build at all.
338
338
 
339
+ ### Objects for behavior, data for content
340
+
341
+ Content is data (above), but a game's *behavior* belongs in classes. A monster kept as
342
+ loose scene fields works for one tutorial room and collapses for a dungeon: give it a
343
+ class holding its state and the methods that change it, built on the framework's own
344
+ bricks (`core.Scene` scenes, `actors.StatBlock` stats, `battle.Creature` opponents,
345
+ `roguelike.Level` maps, `rpg.GridMover` movement, `core.EntityRegistry` identity).
346
+ Subclass the brick that already owns the concern instead of reimplementing it beside an
347
+ interface; no new base class is needed for ordinary actors.
348
+
349
+ The boundary is where serialization starts. `simulation` commands survive
350
+ `structuredClone`, `core.SaveSystem` stores JSON-serialisable state, and MWL rows are
351
+ records by design, so classes stop where those begin: flatten at the boundary the way
352
+ `rpg.GameState` does, and rebuild objects on load rather than storing them.
353
+
339
354
  ### On writing direction
340
355
 
341
356
  Supporting more than one language is mostly bookkeeping. Supporting more than one writing