@datamoc/mw_games 0.7.9 → 0.8.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/mw_games.global.js +102 -102
  3. package/dist/mwl/catalog.d.ts +7 -2
  4. package/dist/mwl/catalog.d.ts.map +1 -1
  5. package/dist/mwl/catalog.js +0 -0
  6. package/dist/mwl/catalog.js.map +1 -1
  7. package/dist/mwl/grammar.d.ts.map +1 -1
  8. package/dist/mwl/grammar.js +37 -0
  9. package/dist/mwl/grammar.js.map +1 -1
  10. package/dist/mwl/hooks.d.ts +42 -1
  11. package/dist/mwl/hooks.d.ts.map +1 -1
  12. package/dist/mwl/hooks.js +41 -0
  13. package/dist/mwl/hooks.js.map +1 -1
  14. package/dist/mwl/index.d.ts +4 -4
  15. package/dist/mwl/index.d.ts.map +1 -1
  16. package/dist/mwl/index.js +2 -2
  17. package/dist/mwl/index.js.map +1 -1
  18. package/dist/mwl/runtime.d.ts +9 -0
  19. package/dist/mwl/runtime.d.ts.map +1 -1
  20. package/dist/mwl/runtime.js +62 -7
  21. package/dist/mwl/runtime.js.map +1 -1
  22. package/dist/mwl/schema.d.ts +33 -1
  23. package/dist/mwl/schema.d.ts.map +1 -1
  24. package/dist/mwl/schema.js +56 -5
  25. package/dist/mwl/schema.js.map +1 -1
  26. package/dist/roguelike/Targeting.d.ts +35 -0
  27. package/dist/roguelike/Targeting.d.ts.map +1 -1
  28. package/dist/roguelike/Targeting.js +72 -0
  29. package/dist/roguelike/Targeting.js.map +1 -1
  30. package/dist/roguelike/index.d.ts +2 -0
  31. package/dist/roguelike/index.d.ts.map +1 -1
  32. package/dist/roguelike/index.js +1 -0
  33. package/dist/roguelike/index.js.map +1 -1
  34. package/dist/two-d/render/Particles.d.ts +30 -9
  35. package/dist/two-d/render/Particles.d.ts.map +1 -1
  36. package/dist/two-d/render/Particles.js +42 -7
  37. package/dist/two-d/render/Particles.js.map +1 -1
  38. package/dist/two-d/render/SpriteSheet.d.ts +19 -3
  39. package/dist/two-d/render/SpriteSheet.d.ts.map +1 -1
  40. package/dist/two-d/render/SpriteSheet.js +26 -5
  41. package/dist/two-d/render/SpriteSheet.js.map +1 -1
  42. package/dist/two-d/ui/MessageBox.d.ts +10 -1
  43. package/dist/two-d/ui/MessageBox.d.ts.map +1 -1
  44. package/dist/two-d/ui/MessageBox.js +4 -1
  45. package/dist/two-d/ui/MessageBox.js.map +1 -1
  46. package/dist/two-d/ui/Window.d.ts +37 -1
  47. package/dist/two-d/ui/Window.d.ts.map +1 -1
  48. package/dist/two-d/ui/Window.js +55 -2
  49. package/dist/two-d/ui/Window.js.map +1 -1
  50. package/dist/two-d/ui/WindowStack.d.ts +24 -2
  51. package/dist/two-d/ui/WindowStack.d.ts.map +1 -1
  52. package/dist/two-d/ui/WindowStack.js +22 -1
  53. package/dist/two-d/ui/WindowStack.js.map +1 -1
  54. package/dist/version.d.ts +1 -1
  55. package/dist/version.js +1 -1
  56. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,93 @@ the public API may still change between minor versions.
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.8.0] - 2026-09-12
11
+
12
+ ### Added
13
+
14
+ - `MwlHookDeclaration` and `validateHookAttributes` (item 321), plus `validAttributeValue`/
15
+ `attributeTypeDescription`: a hook declares the attributes its own `[hook]` calls carry, and
16
+ `validateCatalog`'s `hooks` option takes that declaration where a bare `type:name` id used to
17
+ be the only accepted shape. A typo in a hook attribute is now a compile-time `MWL_VALUE` or
18
+ `MWL_UNKNOWN_ATTRIBUTE` instead of a throw mid-scenario. The tag schema's own value check now
19
+ calls the same two exported functions, so the two cannot disagree.
20
+ - `HookWorld.variableAt(path)` (item 319): the read that matches `Emit.setVariable`'s write, both
21
+ resolving a nested variable through the same walker `[variable] name=` uses, so a hook no
22
+ longer has to cast away `Readonly` and walk paths itself (which produced flat dotted keys no
23
+ reader finds). `Emit.setVariable` is documented as the write half. Any game implementing its
24
+ own `HookWorld` must now provide the method; only the runtime constructs one today.
25
+ - `[set_variable] path=` (item 318), on both spellings: the computed target a converter needs for
26
+ a dynamic name, expanded from `$name`/`$(expression)` references before the same path walker a
27
+ literal `name=` uses resolves it. `name=`/`target=` keep their literal meaning.
28
+ - `[set_variable] mode=literal|number|expression` (item 316), on both spellings of the effect
29
+ (`[set_variable]` and `[command] name="set_variable"`): content declares what its own `value=`
30
+ means instead of `MwlRuntime` inferring it from the text. `literal` keeps the text exactly as
31
+ written, `number` parses it and throws on anything that is not one, `expression` evaluates it
32
+ through the same context `[if] test=` uses. A value with no `mode` is inferred as before, so
33
+ hand-authored content is unaffected.
34
+ - `mwl.MwlAttributeType` (item 316): a schema attribute's type may be the closed list of values
35
+ it accepts, not only one of the shared value types. A value outside the list is a compile-time
36
+ `MWL_VALUE` diagnostic naming the alternatives.
37
+ - `key="""..."""` attribute values (item 317): the one form that may span lines, taken exactly
38
+ as written, so wrapped message, objective and option-label text no longer needs a converter to
39
+ collapse its whitespace. The `_` gettext marker applies to it as to any other value.
40
+ - `roguelike.coneSector` (item 322): a circular sector aimed at an angle. Rays are cast every 0.5
41
+ degrees across an arc of `degrees`, each clamped to `range` and stopped by the first wall, so a
42
+ wall shadows the part of the cone behind it while the rest still reaches. `coneCells` snaps the
43
+ aim to one of the eight directions and sprays linearly from there; a sector keeps the angle it
44
+ was aimed at, which is what a breath weapon, a searchlight or a gas cloud wants. It needs the
45
+ level - that is what stops its rays - so it is a function rather than one of `AreaShape`'s kinds,
46
+ whose resolver works without one. Ray offsets round away from zero, so a sector aimed along an
47
+ axis is exactly symmetric rather than a cell wider on one side. Six tests in
48
+ `tests/targeting-shapes.test.ts`.
49
+ - `ParticleEmitter` colour ranges, curves and flicker (item 323): `tint` takes a `[from, to]` pair
50
+ each particle draws its own colour from (mixed channel by channel, where interpolating the packed
51
+ value would carry from one channel into the next), `scale`/`alpha` take a `ParticleCurve` of the
52
+ particle's own age instead of only the birth-to-death pair, and `flicker` multiplies the scale by
53
+ a seeded draw every frame, which is a torch's wobble rather than its fade. Each of those draws
54
+ happens only when its option is used, so an existing seeded spray is unchanged, and reduced
55
+ motion drops the flicker along with the travel. Five tests in `tests/particles.test.ts`.
56
+ - `Window({ blocker: true })` (item 324): a full-viewport child under the window's chrome that
57
+ swallows clicks, so a window over a map or a toolbar stops passing them to what is underneath,
58
+ and dismisses the window when the click lands outside it. A window's own widgets are hit first,
59
+ and a click on the frame or an empty part of the body is swallowed without dismissing, so the
60
+ body is never a close button by accident. `handleOutsideClick(x, y)` is that decision on its own,
61
+ headless-testable the way `handleAction` is. Off by default: it changes what the whole screen
62
+ answers to. Seven tests in `tests/window-blocker.test.ts`.
63
+ - `WindowStack.handleAction(action)` is public (item 325): a scene with its own keyboard handling
64
+ can now ask the windows before acting, instead of discovering that registration order decided it.
65
+ `Input.onAction` offers an action to the most recently registered listener first, and the stack
66
+ registers in its constructor, so a scene that builds its stack in `create()` and registers a
67
+ handler after it is offered every key before the open window is, and returning true for one takes
68
+ it away from the window. The class doc spells the race out and gives the one-line chain
69
+ (`stack.handleAction(action) || myOwnHandling(action)`), and the same doc now says what a scene
70
+ that does not chain has to do instead. `Window`'s own doc gains the other half: its frame and
71
+ empty body are not clickable, which `blocker` is the option that changes. Three tests in
72
+ `tests/window-stack-routing.test.ts`.
73
+ - `SpriteSheet.rect(index, x, y, width, height)` (item 326): arbitrary rectangles for the sheets
74
+ that are not grids - a hand-packed icon atlas, a strip of bar segments, a nine-patch's corners,
75
+ an item whose art is smaller than its cell. A rect is cached under its index exactly like a grid
76
+ frame, so `get`/`region`/`name`/`pick` treat it as one and asking twice returns the same
77
+ `Texture`, where the hand-written path built a fresh one per site (about twenty of them in the
78
+ port, plus its own helper). Declaring a rect over a grid index replaces that frame, which is what
79
+ a tightened sub-rect is. `grid`/`fromTexture` now take no frame size at all, leaving a sheet with
80
+ no grid and only the rects declared on it. Five tests in `tests/sprite-sheet-rects.test.ts`.
81
+
82
+ ### Changed
83
+
84
+ - `MessageBox` swallows clicks by default (item 324), through the same `blocker` layer: a box with
85
+ a page still to read, or a choice to answer, is not something a click on the world should be able
86
+ to act past. It is not closable, so this can only ever swallow a click, never dismiss the box,
87
+ and `blocker: false` is the opt-out for a box the player is meant to click past (the same case
88
+ `dims: false` is for). `examples/interface` uses both new halves: its bag window takes
89
+ `blocker: true`, and its map handler now asks `windows.handleAction` rather than relying on
90
+ having registered before the stack did.
91
+ - `sbom.cdx.json` carries a `serialNumber` (item 315): a version-5 UUID over the document's own
92
+ content, so it stays stable for a given lockfile and changes when the dependency set does, which
93
+ keeps the drift check and gives the serial the meaning CycloneDX asks of it. `metadata.timestamp`
94
+ stays absent on purpose: a generation time stamped into a committed file is one stale moment
95
+ every later read is dated to, and `CHANGELOG.md` already dates each version.
96
+
10
97
  ## [0.7.9] - 2026-09-12
11
98
 
12
99
  ### Added