@moku-labs/game 0.15.101 → 0.15.103

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 (36) hide show
  1. package/README.md +1 -1
  2. package/dist/app/page.d.mts +1 -1
  3. package/dist/app/page.mjs +1 -1
  4. package/dist/app/system.d.mts +3 -3
  5. package/dist/app.d.mts +3 -3
  6. package/dist/app.mjs +1 -1
  7. package/dist/assets.d.mts +1 -1
  8. package/dist/{commands-DFCBw6F2.d.mts → commands-TSyhs2-E.d.mts} +19 -10
  9. package/dist/control.d.mts +10 -6
  10. package/dist/control.mjs +2 -2
  11. package/dist/{define-6cjZwkJu.d.mts → define-DNF9A0ce.d.mts} +2 -2
  12. package/dist/{headless-WyPk3UrP.d.mts → headless-CEG1oR5D.d.mts} +1 -1
  13. package/dist/{index-Bz6p2alA.d.mts → index-DDZ9K9qO.d.mts} +24 -4
  14. package/dist/index.d.mts +5 -5
  15. package/dist/index.mjs +2 -2
  16. package/dist/inspect.d.mts +6 -6
  17. package/dist/inspect.mjs +2 -2
  18. package/dist/jsx-dev-runtime.d.mts +1 -1
  19. package/dist/jsx-runtime.d.mts +1 -1
  20. package/dist/{run-B5if0jxE.mjs → run-pCQlIaNP.mjs} +46 -3
  21. package/dist/{runtime-BDCv5mp-.d.mts → runtime-CcHPrVBm.d.mts} +1 -1
  22. package/dist/{session-D0AYRm5T.mjs → session-ClUqpGId.mjs} +138 -2
  23. package/dist/{sources-Cqqz-0-b.mjs → sources-BJyIJf_X.mjs} +1 -1
  24. package/dist/{src-DsyJR7Ds.mjs → src-DVJ0d04R.mjs} +433 -65
  25. package/dist/testing.d.mts +4 -4
  26. package/dist/testing.mjs +1 -1
  27. package/dist/{types-Co-6A6Y8.d.mts → types-BvgY7Ncf.d.mts} +23 -5
  28. package/dist/{types-Cx_-n0Ts.d.mts → types-C1B7-x7p.d.mts} +1 -1
  29. package/dist/{types-DyohsXF_.d.mts → types-C612npUH.d.mts} +2 -2
  30. package/dist/{types-Dx2qRDFg.d.mts → types-CMag4vDu.d.mts} +4 -4
  31. package/dist/{types-BzVQAaSX.d.mts → types-Ce5W0gZe.d.mts} +45 -7
  32. package/dist/{visual-D5L3ZtuQ.d.mts → visual-PsEr2KD-.d.mts} +6 -6
  33. package/dist/visual.d.mts +1 -1
  34. package/dist/visual.mjs +2 -2
  35. package/llms.txt +6 -6
  36. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { An as FeaturePlugin, Hn as Descriptor, Hr as Json, Ir as FakeClock, Kn as Hint, Mn as AnyFlow, Pr as ClockSource, Rn as NodeTable, qn as NodeFx } from "./types-BzVQAaSX.mjs";
2
- import { t as createApp } from "./index-Bz6p2alA.mjs";
3
- import { b as memory, x as saveOf, y as WithGameState } from "./types-Dx2qRDFg.mjs";
4
- import { a as createHeadless, i as ReproResult, n as HeadlessGame, o as runRepro, r as Repro, s as stepFrames, t as HeadlessApp } from "./headless-WyPk3UrP.mjs";
1
+ import { An as FeaturePlugin, Hn as Descriptor, Hr as Json, Ir as FakeClock, Kn as Hint, Mn as AnyFlow, Pr as ClockSource, Rn as NodeTable, qn as NodeFx } from "./types-Ce5W0gZe.mjs";
2
+ import { t as createApp } from "./index-DDZ9K9qO.mjs";
3
+ import { b as memory, x as saveOf, y as WithGameState } from "./types-CMag4vDu.mjs";
4
+ import { a as createHeadless, i as ReproResult, n as HeadlessGame, o as runRepro, r as Repro, s as stepFrames, t as HeadlessApp } from "./headless-CEG1oR5D.mjs";
5
5
  import { AnyPluginInstance } from "@moku-labs/core";
6
6
 
7
7
  //#region src/plugins/clock/fake.d.ts
package/dist/testing.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { C as flattenFeatures, fn as exit, hn as type, t as createApp, un as refuseStart } from "./src-DsyJR7Ds.mjs";
1
+ import { dn as refuseStart, gn as type, pn as exit, t as createApp, w as flattenFeatures } from "./src-DVJ0d04R.mjs";
2
2
  import { n as saveOf, t as memory } from "./memory-DeD9wis6.mjs";
3
3
  import { n as fakeClock } from "./fake-hnJcJeYf.mjs";
4
4
  import { i as stepFrames, r as runRepro, t as createHeadless } from "./headless-CCiUwvlp.mjs";
@@ -1,5 +1,5 @@
1
- import { $n as Ease, A as FilterSlotQuad, Hn as Descriptor, Hr as Json, O as FilterSlot, Or as Api$3, Vn as TypeTag, Vr as Events$3, Xn as AnchorTarget, Z as Api$4, _i as Events$2, at as PixiUniformGroup, b as Events$4, ci as Api$1, cr as TrackOptions, dr as AnyComponent, et as PixiFilter, fn as Api$2, gr as ComponentType, gt as Point, ii as Events$5, it as PixiTexture, j as SyncApi, k as FilterSlotInputs, lr as TrackSegment, mr as ComponentHandle, nr as MotionHandle, nt as PixiModule, or as ReducedMotion, pr as AnyComponentValue, rr as NumericFields, rt as PixiSprite, s as Events$1, t as Api$5, tt as PixiGpuProgram, vi as Require, vr as Entity, vt as FilterCache, zr as Api$6 } from "./types-BzVQAaSX.mjs";
2
- import { H as I18nApi, L as InputApi, T as TextApi, c as UiNode, et as StylesState, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion } from "./types-Cx_-n0Ts.mjs";
1
+ import { $n as Ease, A as FilterSlotQuad, Hn as Descriptor, Hr as Json, O as FilterSlot, Or as Api$3, Vn as TypeTag, Vr as Events$3, Xn as AnchorTarget, Z as Api$4, _i as Events$2, at as PixiUniformGroup, b as Events$4, ci as Api$1, cr as TrackOptions, dr as AnyComponent, et as PixiFilter, fn as Api$2, gr as ComponentType, gt as Point, ii as Events$5, it as PixiTexture, j as SyncApi, k as FilterSlotInputs, lr as TrackSegment, mr as ComponentHandle, nr as MotionHandle, nt as PixiModule, or as ReducedMotion, pr as AnyComponentValue, rr as NumericFields, rt as PixiSprite, s as Events$1, t as Api$5, tt as PixiGpuProgram, vi as Require, vr as Entity, vt as FilterCache, zr as Api$6 } from "./types-Ce5W0gZe.mjs";
2
+ import { H as I18nApi, L as InputApi, T as TextApi, c as UiNode, et as StylesState, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion } from "./types-C1B7-x7p.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
  import { PluginCtx } from "@moku-labs/core";
5
5
 
@@ -1634,7 +1634,9 @@ type FilterInput<Value> = {
1634
1634
  readonly stages: readonly FilterStage[];
1635
1635
  /**
1636
1636
  * The steps of the second texture for this value and resolution. Pure: no state, no randomness; the context object
1637
- * is the engine's and valid during the call only.
1637
+ * is the engine's and valid during the call only. The engine reads the steps during the call and copies the uniform
1638
+ * values it needs, so a chain may answer the same array on every call, its uniform objects written in place (what
1639
+ * `Bloom` does, so a tween allocates nothing in the chain).
1638
1640
  *
1639
1641
  * @param value - The stored value of the filter component.
1640
1642
  * @param context - The resolution of the texture the view is drawn into.
@@ -2398,8 +2400,24 @@ type FoldValue = {
2398
2400
  enabled: boolean;
2399
2401
  order: number;
2400
2402
  };
2403
+ /**
2404
+ * `Bloom`: light around the bright parts of the view: what is above `threshold` (0..1) of its light, blurred `radius`
2405
+ * CSS px wide and added back by `strength` (0..2).
2406
+ *
2407
+ * @example
2408
+ * ```ts
2409
+ * const value: BloomValue = { strength: 0.6, threshold: 0.7, radius: 16, enabled: true, order: 0 };
2410
+ * ```
2411
+ */
2412
+ type BloomValue = {
2413
+ strength: number;
2414
+ threshold: number;
2415
+ radius: number;
2416
+ enabled: boolean;
2417
+ order: number;
2418
+ };
2401
2419
  declare namespace types_d_exports$2 {
2402
- export { AlphaValue, AssetsReplaced$1 as AssetsReplaced, AuraValue, BlurValue, BundleUnloaded$1 as BundleUnloaded, ColorMatrixValue, Config$2 as Config, CoreKind, Curve, Deps$2 as Deps, DisplacementValue, DissolveValue, EffectsApi, EffectsCtx, EffectsDiagnostics, EffectsStats, EmitterConfig, EmitterDefinition, EmitterValue, FilterArea, FilterCache, FilterChainContext, FilterComponent, FilterDefinition, FilterInput, FilterInputDefinition, FilterSpec, FilterStage, FilterStep, FilterValueOf, FlashValue, FoldValue, GlowValue, GradeValue, HotSwap, KernelSlice$2 as KernelSlice, NoiseValue, OutlineValue, Range, ResolvedEmitterConfig, RevealLineValue, RevealRoundValue, Shape, ShineValue, State$2 as State, UniformDeclaration, UniformSpec, UniformValue, VignetteValue };
2420
+ export { AlphaValue, AssetsReplaced$1 as AssetsReplaced, AuraValue, BloomValue, BlurValue, BundleUnloaded$1 as BundleUnloaded, ColorMatrixValue, Config$2 as Config, CoreKind, Curve, Deps$2 as Deps, DisplacementValue, DissolveValue, EffectsApi, EffectsCtx, EffectsDiagnostics, EffectsStats, EmitterConfig, EmitterDefinition, EmitterValue, FilterArea, FilterCache, FilterChainContext, FilterComponent, FilterDefinition, FilterInput, FilterInputDefinition, FilterSpec, FilterStage, FilterStep, FilterValueOf, FlashValue, FoldValue, GlowValue, GradeValue, HotSwap, KernelSlice$2 as KernelSlice, NoiseValue, OutlineValue, Range, ResolvedEmitterConfig, RevealLineValue, RevealRoundValue, Shape, ShineValue, State$2 as State, UniformDeclaration, UniformSpec, UniformValue, VignetteValue };
2403
2421
  }
2404
2422
  /**
2405
2423
  * effects plugin config. `maxParticles` here is the global warning line; the `maxParticles` of an
@@ -3386,4 +3404,4 @@ type UiApi = {
3386
3404
  }> | undefined;
3387
3405
  };
3388
3406
  //#endregion
3389
- export { Step as $, EmitterValue as A, NoiseValue as B, GradeValue as C, VignetteValue as D, ShineValue as E, FilterArea as F, Config$3 as G, UniformDeclaration as H, FilterComponent as I, State$3 as J, FramesValue as K, FilterSpec as L, BlurValue as M, ColorMatrixValue as N, EmitterConfig as O, DisplacementValue as P, SfxDescriptor as Q, FilterValueOf as R, FoldValue as S, RevealRoundValue as T, AnimApi as U, OutlineValue as V, AnimPlayerValue as W, types_d_exports$3 as X, Target as Y, HapticKind as Z, State$2 as _, wait as _t, AudioApi as a, mark as at, DissolveValue as b, MusicDescriptor as c, sequence as ct, State$1 as d, spawn as dt, HAPTIC_KINDS as et, VolumesFor as f, spawned as ft, EffectsStats as g, use as gt, EffectsApi as h, tween as ht, types_d_exports as i, haptic as it, AlphaValue as j, EmitterDefinition as k, MusicOptions as l, set as lt, Config$2 as m, stopSfx as mt, State as n, external as nt, AudioContextLike as o, parallel as ot, types_d_exports$1 as p, stagger as pt, MotionKeyframe as q, UiApi as r, frames as rt, Config$1 as s, play as st, Config as t, defineAnimation as tt, SoundEntry as u, sfx as ut, types_d_exports$2 as v, OverlayApi as vt, RevealLineValue as w, FlashValue as x, AuraValue as y, types_d_exports$4 as yt, GlowValue as z };
3407
+ export { SfxDescriptor as $, EmitterDefinition as A, GlowValue as B, FoldValue as C, ShineValue as D, RevealRoundValue as E, DisplacementValue as F, AnimPlayerValue as G, OutlineValue as H, FilterArea as I, MotionKeyframe as J, Config$3 as K, FilterComponent as L, AlphaValue as M, BlurValue as N, VignetteValue as O, ColorMatrixValue as P, HapticKind as Q, FilterSpec as R, FlashValue as S, RevealLineValue as T, UniformDeclaration as U, NoiseValue as V, AnimApi as W, Target as X, State$3 as Y, types_d_exports$3 as Z, State$2 as _, use as _t, AudioApi as a, haptic as at, BloomValue as b, types_d_exports$4 as bt, MusicDescriptor as c, play as ct, State$1 as d, sfx as dt, Step as et, VolumesFor as f, spawn as ft, EffectsStats as g, tween as gt, EffectsApi as h, stopSfx as ht, types_d_exports as i, frames as it, EmitterValue as j, EmitterConfig as k, MusicOptions as l, sequence as lt, Config$2 as m, stagger as mt, State as n, defineAnimation as nt, AudioContextLike as o, mark as ot, types_d_exports$1 as p, spawned as pt, FramesValue as q, UiApi as r, external as rt, Config$1 as s, parallel as st, Config as t, HAPTIC_KINDS as tt, SoundEntry as u, set as ut, types_d_exports$2 as v, wait as vt, GradeValue as w, DissolveValue as x, AuraValue as y, OverlayApi as yt, FilterValueOf as z };
@@ -1,4 +1,4 @@
1
- import { $n as Ease, Dr as TagType, Hn as Descriptor, Hr as Json, J as TransformValue, Kn as Hint, Nr as Api$5, Or as Api$2, Xn as AnchorTarget, Yn as Answered, Z as Api$3, Zn as ChangeHook, _t as ViewportSize, ci as Api, dr as AnyComponent, er as Motion, fn as Api$1, fr as AnyComponentType, gr as ComponentType, ir as ProjectionMotion, nr as MotionHandle, or as ReducedMotion, pr as AnyComponentValue, rr as NumericFields, s as Events$1, t as Api$4, tr as MotionCause, ur as ViewHandle, vi as Require, vr as Entity } from "./types-BzVQAaSX.mjs";
1
+ import { $n as Ease, Dr as TagType, Hn as Descriptor, Hr as Json, J as TransformValue, Kn as Hint, Nr as Api$5, Or as Api$2, Xn as AnchorTarget, Yn as Answered, Z as Api$3, Zn as ChangeHook, _t as ViewportSize, ci as Api, dr as AnyComponent, er as Motion, fn as Api$1, fr as AnyComponentType, gr as ComponentType, ir as ProjectionMotion, nr as MotionHandle, or as ReducedMotion, pr as AnyComponentValue, rr as NumericFields, s as Events$1, t as Api$4, tr as MotionCause, ur as ViewHandle, vi as Require, vr as Entity } from "./types-Ce5W0gZe.mjs";
2
2
  import { Log } from "@moku-labs/common/browser";
3
3
  import { PluginCtx } from "@moku-labs/core";
4
4
  import { Node, Yoga } from "yoga-layout/load";
@@ -1,5 +1,5 @@
1
- import { Hr as Json, Zr as Snapshot } from "./types-BzVQAaSX.mjs";
2
- import { t as HeadlessApp } from "./headless-WyPk3UrP.mjs";
1
+ import { Hr as Json, Zr as Snapshot } from "./types-Ce5W0gZe.mjs";
2
+ import { t as HeadlessApp } from "./headless-CEG1oR5D.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
 
5
5
  //#region src/plugins/flow/doors/types.d.ts
@@ -1,7 +1,7 @@
1
- import { An as FeaturePlugin, Br as Config, Hr as Json, Ir as FakeClock, Jr as ProviderCall, Mn as AnyFlow, Pr as ClockSource, Q as Config$2, Qr as SnapshotOf, Vn as TypeTag, Yr as SaveDoc, a as Config$3, d as Manifest, ht as Orientation, mn as Config$1, n as AssetsIo, nt as PixiModule, qr as PlayerStateProvider } from "./types-BzVQAaSX.mjs";
2
- import { o as AudioContextLike, s as Config$4 } from "./types-Co-6A6Y8.mjs";
3
- import { H as I18nApi, J as TextKey, q as StringTable } from "./types-Cx_-n0Ts.mjs";
4
- import { Ct as platformPlugin, Ft as audioPlugin, Mt as effectsPlugin, Tt as PlatformProvider, i as screen, t as createApp } from "./index-Bz6p2alA.mjs";
1
+ import { An as FeaturePlugin, Br as Config, Hr as Json, Ir as FakeClock, Jr as ProviderCall, Mn as AnyFlow, Pr as ClockSource, Q as Config$2, Qr as SnapshotOf, Vn as TypeTag, Yr as SaveDoc, a as Config$3, d as Manifest, ht as Orientation, mn as Config$1, n as AssetsIo, nt as PixiModule, qr as PlayerStateProvider } from "./types-Ce5W0gZe.mjs";
2
+ import { o as AudioContextLike, s as Config$4 } from "./types-BvgY7Ncf.mjs";
3
+ import { H as I18nApi, J as TextKey, q as StringTable } from "./types-C1B7-x7p.mjs";
4
+ import { Et as PlatformProvider, It as audioPlugin, Nt as effectsPlugin, i as screen, t as createApp, wt as platformPlugin } from "./index-DDZ9K9qO.mjs";
5
5
  import { AnyPluginInstance } from "@moku-labs/core";
6
6
 
7
7
  //#region src/plugins/model/store/providers/memory.d.ts
@@ -1768,7 +1768,8 @@ type Config$5 = {
1768
1768
  */
1769
1769
  type State$5 = {
1770
1770
  source: ClockSource;
1771
- last: number;
1771
+ last: number; /** Milliseconds `advance` moved the clock forward, added to every reading of the source. */
1772
+ shift: number;
1772
1773
  dueAt: number | undefined;
1773
1774
  handle: unknown;
1774
1775
  listeners: Array<(input: Elapsed) => void>;
@@ -1843,6 +1844,26 @@ type Api$4 = {
1843
1844
  * ```
1844
1845
  */
1845
1846
  poke(): void;
1847
+ /**
1848
+ * Moves the clock forward, as if `ms` passed at once: every later `now()` is `ms` further, and a
1849
+ * pending moment that is due now is delivered at once, before the call returns; one still ahead
1850
+ * waits for the rest. The door `game.clock` calls it, so a visual test or the editor reaches a
1851
+ * moment the rules scheduled without waiting for it. Only forward.
1852
+ *
1853
+ * @param ms - Milliseconds forward, a finite number above 0.
1854
+ * @returns The trusted moment after the move.
1855
+ * @throws {RangeError} `[game] clock.advance moves the clock forward, not by 0 ms.` for 0, a
1856
+ * negative or a number that is not finite.
1857
+ * @example
1858
+ * ```ts
1859
+ * // A board tick is due in 60 s; the visual test moves the clock and the tick arrives.
1860
+ * app.clock.now(); // 1000000000
1861
+ * app.clock.scheduleAt(1_000_060_000);
1862
+ * app.clock.advance(60_000); // 1000060000: onElapsed listeners got { now: 1000060000 }
1863
+ * app.clock.dueAt(); // undefined
1864
+ * ```
1865
+ */
1866
+ advance(ms: number): number;
1846
1867
  /**
1847
1868
  * Reads the pending due moment, for inspection and tests.
1848
1869
  *
@@ -2075,6 +2096,7 @@ type QueryPlan = {
2075
2096
  */
2076
2097
  declare class SystemWalk implements Iterator<readonly unknown[], undefined> {
2077
2098
  private readonly ctx;
2099
+ private readonly hidesAside;
2078
2100
  /** The step handed back for every row: always the one row array. */
2079
2101
  private readonly step;
2080
2102
  /** The one row: the entity, then one stored value per name, sized at registration. */
@@ -2095,13 +2117,17 @@ declare class SystemWalk implements Iterator<readonly unknown[], undefined> {
2095
2117
  private started;
2096
2118
  /** The first store's size at the first step: a dev build compares it; -1 when not watched. */
2097
2119
  private size;
2120
+ /** The entities of the running aside build this run passes over, read at the first step; `undefined` for none. */
2121
+ private aside;
2098
2122
  /**
2099
2123
  * Prepares the walk of one system.
2100
2124
  *
2101
2125
  * @param ctx - Domain context of the world plugin.
2102
2126
  * @param plan - The system's resolved query.
2127
+ * @param hidesAside - True for a feature's system: it passes over the entities of a scene built aside until the
2128
+ * commit (F155).
2103
2129
  */
2104
- constructor(ctx: WorldCtx, plan: QueryPlan);
2130
+ constructor(ctx: WorldCtx, plan: QueryPlan, hidesAside?: boolean);
2105
2131
  /**
2106
2132
  * The walk is its own iterator, so the runner hands it to `run` as the rows. A second loop over
2107
2133
  * it in the same run finds it walked.
@@ -2116,7 +2142,7 @@ declare class SystemWalk implements Iterator<readonly unknown[], undefined> {
2116
2142
  */
2117
2143
  reset(): SystemWalk;
2118
2144
  /**
2119
- * Keeps one key of the first store when the entity carries every other name.
2145
+ * Keeps one key of the first store when the entity carries every other name and is not built aside.
2120
2146
  *
2121
2147
  * @param entity - The key.
2122
2148
  */
@@ -2130,8 +2156,8 @@ declare class SystemWalk implements Iterator<readonly unknown[], undefined> {
2130
2156
  next(): IteratorResult<readonly unknown[], undefined>;
2131
2157
  /**
2132
2158
  * Reads the stores of this run and collects the entities that carry every name, in the first
2133
- * store's order. Structural changes are queued until the phase ends, so the matches stay true
2134
- * while the rows are consumed.
2159
+ * store's order; a feature's system passes over the entities of a scene built aside. Structural
2160
+ * changes are queued until the phase ends, so the matches stay true while the rows are consumed.
2135
2161
  */
2136
2162
  private start;
2137
2163
  /**
@@ -2582,7 +2608,8 @@ type SystemEntry = {
2582
2608
  */
2583
2609
  readonly stores: Array<ComponentStore | undefined>; /** The scenes it runs on, read once at registration; `undefined` for every scene. */
2584
2610
  readonly scenes: readonly string[] | undefined; /** Its last chance to run was skipped: the next run is told so with `resumed`. */
2585
- skipped: boolean;
2611
+ skipped: boolean; /** A feature brought it: its rows pass over the entities of a scene built aside (F155). */
2612
+ readonly hidesAside?: boolean;
2586
2613
  /**
2587
2614
  * The walk of the declared query, made at registration; `undefined` for an empty query, which
2588
2615
  * the runner never walks. An entry built without one gets it on its first run.
@@ -3323,6 +3350,15 @@ type EcsApi = {
3323
3350
  * ecs methods the plugin root calls: frame phases, the owner listener, the clears. Not public.
3324
3351
  */
3325
3352
  type EcsInternal = {
3353
+ /**
3354
+ * Registers a system a feature brought: as `system`, and the rows of its declared `query` pass
3355
+ * over the entities of a scene built aside until the commit (F155). `world.query()`, `get` and
3356
+ * `has` inside its `run` still read them.
3357
+ *
3358
+ * @param definition - The system.
3359
+ * @returns The remover.
3360
+ */
3361
+ featureSystem(definition: AnySystem): () => void;
3326
3362
  /**
3327
3363
  * Registers a listener for `despawnOwnedBy`, so `projection` can drop the views of an owner
3328
3364
  * that left.
@@ -13455,11 +13491,13 @@ type Leaving = {
13455
13491
  outMs: number;
13456
13492
  /**
13457
13493
  * The floor on the swap (F130), for a loader that is on with `holdMs` above 0: the clock moment the swap may happen at,
13458
- * and the frame counter at the look's start. Absent: no floor. `state.leaving` is always the running switch's look
13494
+ * the game time it may happen at (F156: the stepped frames of a visual test move it where the clock stands), and the
13495
+ * frame counter at the look's start. Absent: no floor. `state.leaving` is always the running switch's look
13459
13496
  * (`dropLeftOver` and `leaveFor` keep it so), which is why the build reads it there.
13460
13497
  */
13461
13498
  hold?: {
13462
13499
  until: number;
13500
+ elapsedUntil: number;
13463
13501
  frame: number;
13464
13502
  };
13465
13503
  /**
@@ -1,9 +1,9 @@
1
- import { Nr as Api$4, Or as Api$1, Z as Api, ni as Api$3, zr as Api$2 } from "./types-BzVQAaSX.mjs";
2
- import { U as AnimApi, r as UiApi } from "./types-Co-6A6Y8.mjs";
3
- import { L as InputApi } from "./types-Cx_-n0Ts.mjs";
4
- import { r as Repro } from "./headless-WyPk3UrP.mjs";
5
- import { i as ControlApp, o as InputOf } from "./types-DyohsXF_.mjs";
6
- import { t as commands } from "./commands-DFCBw6F2.mjs";
1
+ import { Nr as Api$4, Or as Api$1, Z as Api, ni as Api$3, zr as Api$2 } from "./types-Ce5W0gZe.mjs";
2
+ import { W as AnimApi, r as UiApi } from "./types-BvgY7Ncf.mjs";
3
+ import { L as InputApi } from "./types-C1B7-x7p.mjs";
4
+ import { r as Repro } from "./headless-CEG1oR5D.mjs";
5
+ import { i as ControlApp, o as InputOf } from "./types-C612npUH.mjs";
6
+ import { t as commands } from "./commands-TSyhs2-E.mjs";
7
7
 
8
8
  //#region src/visual/types.d.ts
9
9
  /** The base commands of the `/control` door, keyed by their short names. */
package/dist/visual.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as VisualApp, c as VisualRenderer, d as VisualStart, f as VisualStep, h as VisualTolerance, i as CheckpointResult, l as VisualReport, m as VisualTestResult, n as runVisualTests, o as VisualOptions, p as VisualTest, r as defineVisualTest, s as VisualPage, t as parseVisualArgv, u as VisualSetup } from "./visual-D5L3ZtuQ.mjs";
1
+ import { a as VisualApp, c as VisualRenderer, d as VisualStart, f as VisualStep, h as VisualTolerance, i as CheckpointResult, l as VisualReport, m as VisualTestResult, n as runVisualTests, o as VisualOptions, p as VisualTest, r as defineVisualTest, s as VisualPage, t as parseVisualArgv, u as VisualSetup } from "./visual-PsEr2KD-.mjs";
2
2
  export { type CheckpointResult, type VisualApp, type VisualOptions, type VisualPage, type VisualRenderer, type VisualReport, type VisualSetup, type VisualStart, type VisualStep, type VisualTest, type VisualTestResult, type VisualTolerance, defineVisualTest, parseVisualArgv, runVisualTests };
package/dist/visual.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as VISUAL_CLOCK } from "./fake-hnJcJeYf.mjs";
2
- import { n as read, t as sources } from "./sources-Cqqz-0-b.mjs";
3
- import { n as commands, t as run } from "./run-B5if0jxE.mjs";
2
+ import { n as read, t as sources } from "./sources-BJyIJf_X.mjs";
3
+ import { n as commands, t as run } from "./run-pCQlIaNP.mjs";
4
4
  import path from "node:path";
5
5
  import { createBrandConsole } from "@moku-labs/common/cli";
6
6
  import { mkdir, readFile, writeFile } from "node:fs/promises";
package/llms.txt CHANGED
@@ -12,7 +12,7 @@ Facts: Bun only. ESM only. `"sideEffects"` lists the root entry `./dist/index.mj
12
12
  - `@moku-labs/game/app/system` (the browser, the native shell): `systemShellOf`, `fromSystem`, `storeSave`, `createSystemApp`, the type `SystemModules`, over the optional peer `@moku-labs/system`. The one entry that names it, in types only: the page hands it the loaders.
13
13
  - `@moku-labs/game/cli` (node and bun only): `runCli`, the bin `moku-game`, `preparePage`, the editor's dev page, `watchKeys`, the watch that keeps `generated/` fresh next to it, and `watchEngine`, the watch that tells when the installed engine changed.
14
14
  - `@moku-labs/game/testing`: headless play, repro runs, isolated feature tests (`isolate`, `stub`), fake clock, the `fx` of a node for a unit test (`fakeFx`), in-memory save provider. No `node:` import.
15
- - `@moku-labs/game/visual` (node and bun only): the visual tests `defineVisualTest`, `runVisualTests`, `parseVisualArgv`. The bin runs them: `moku-game visual`. A step is a `/control` command or `{ checkpoint: name, finish?: boolean }`: a checkpoint lands every motion before its snapshot, `finish: false` keeps them running (same frames in both legs). Both legs run on one clock: the pixel leg's dev page runs on a fake clock at the headless app's `clock.now()` (`startMoment`), standing still like the headless one.
15
+ - `@moku-labs/game/visual` (node and bun only): the visual tests `defineVisualTest`, `runVisualTests`, `parseVisualArgv`. The bin runs them: `moku-game visual`. A step is a `/control` command or `{ checkpoint: name, finish?: boolean }`: a checkpoint lands every motion before its snapshot, `finish: false` keeps them running (same frames in both legs). Both legs run on one clock: the pixel leg's dev page runs on a fake clock at the headless app's `clock.now()` (`startMoment`), standing still like the headless one. Frames move game time, not that clock: the step `{ clock: { advanceMs } }` moves it (`clock.advance`), so a moment armed with `schedule` comes due (F157). A floor on a scene swap (`loader.holdMs`) also passes in game time, so an `answer` that switches the scene settles in the pixel leg (F156).
16
16
  - `@moku-labs/game/assets` (node and bun only): the asset key scanner, the production packer and the string compiler. The package bin `moku-game-assets` runs it.
17
17
  - `@moku-labs/game/inspect`: the read door of the editor, safe in a production build. See "Doors for the editor".
18
18
  - `@moku-labs/game/control`: the write door of the editor, dev builds only. See "Doors for the editor".
@@ -28,7 +28,7 @@ Root exports:
28
28
  - Plugin instances: `timePlugin`, `lifecyclePlugin`, `modelPlugin`, `clockPlugin`, `flowPlugin`, `worldPlugin`, `rendererPlugin`, `inputPlugin`, `assetsPlugin`, `scenesPlugin`, `animPlugin`, `i18nPlugin`, `textPlugin`, `uiPlugin`, `audioPlugin`, `effectsPlugin`, `platformPlugin`; the list `screen` = `world`, `renderer`, `input`, `assets`, `scenes`, `anim`, `i18n`, `text`, `ui`. `effects`, `audio` and `platform` are opt-in: `plugins: [...screen, effectsPlugin, audioPlugin, platformPlugin]`, `platform` last.
29
29
  - Screen helpers from the root: `component`, `tag`, `resource`, `mut`, `system`, `projection`, `Layer`, `Order`, `Exiting`, `Tree`, `Now`, `Transform`, `Sprite`, `NineSlice`, `Shape`, `Parent`, `Display`, `Overlay`, `HudPart`, `sprite`, `Tappable`, `Pressable`, `Draggable`, `DropTarget`, `Swipeable`, `Traceable`, `Touchable`, `Held`, `Hovered`, `PointerOver`, `Pressed`, `Pointer`, `Traced`, `defineBundles`, `load`, `defineScene`.
30
30
  - Interface helpers from the root (V3): `defineAnimation`, `sequence`, `parallel`, `stagger`, `tween`, `set`, `wait`, `mark`, `frames`, `sfx`, `haptic`, `use`, `spawn`, `spawned`, `play`, `external`, `defineMotion`, `Animation`, `Frames`, the resource `AnimPlayer`; `tr`, `messageArgument`, `messageDuration`; `Text`, `label`, `defineTextStyles`, `defineTextFormats`, `bind`, `Countdown` and the types `BindOptions`, `CountdownValue`, `TextFormat`, `TextFormats`, `TextFormatAnswer`, `TextFormatFunction`, `FormattedNumber`; `defineComponent`, `popup`, `defineStyle`, `defineTokens`, `resolve`, `Box`, `LocalWrite`, `DebugTrigger`, `ScrollState`; `music`. Also `stopSfx(id, { fadeMs? })` (ends a named sound, see audio) and `cubicBezier(x1, y1, x2, y2)` (a CSS-style easing curve for `tween`'s `ease`).
31
- - Effects helpers from the root (V5): `defineEmitter`, `Emitter`, `defineFilter`, `Glow`, `Outline`, `Blur`, `ColorMatrix`, `Noise`, `Displacement`, `Alpha`; the effect set `Flash`, `Grade`, `Vignette`, `RevealLine`, `RevealRound`, `Dissolve`, `Shine`, `Aura`, `Fold` and their value types `FlashValue`, `GradeValue`, `VignetteValue`, `RevealLineValue`, `RevealRoundValue`, `DissolveValue`, `ShineValue`, `AuraValue`, `FoldValue`.
31
+ - Effects helpers from the root (V5): `defineEmitter`, `Emitter`, `defineFilter`, `Glow`, `Outline`, `Blur`, `ColorMatrix`, `Noise`, `Displacement`, `Alpha`; the effect set `Flash`, `Grade`, `Vignette`, `RevealLine`, `RevealRound`, `Dissolve`, `Shine`, `Aura`, `Fold`, `Bloom` and their value types `FlashValue`, `GradeValue`, `VignetteValue`, `RevealLineValue`, `RevealRoundValue`, `DissolveValue`, `ShineValue`, `AuraValue`, `FoldValue`, `BloomValue`.
32
32
  - Platform from the root (V6): the types `PlatformProvider`, `BackResult`, `HapticKind` and the frozen list `HAPTIC_KINDS`.
33
33
  - `defineGame<Types>()` returns, typed by the game's `player`, `session`, `assets`, `bundles`, `scenes`, `strings`, `textStyles` and `textFormats`: `defineNode`, `defineFlow`, `defineFeature`, `projection`, `sprite`, `Sprite`, `NineSlice`, `defineBundles`, `load`, `defineScene`, `defineAnimation`, `frames`, `sfx`, `play`, `tr`, `label`, `bind`, `defineTextStyles`, `defineTextFormats`, `defineComponent`, `defineStyle`, `defineTokens`, `popup`, `music`, `Frames`, `defineEmitter`, `Emitter`, `Displacement`, and `system` (its `ctx.snapshot` typed by `player` and `session`), `volumes` (the `audio` config's reader of the typed player), `key` (string keys from data, below). `Types` is `{ player; session; assets: string; bundles?: string; scenes?: string; strings: Record<string, unknown>; textStyles?: string; textFormats?: string; emitters?: string }`.
34
34
  - `@moku-labs/game/assets`: `scanAssets(options)`, `emitKeys`, `emitManifest`, `compileStrings(root, out, options?)`, `checkStrings`, `packAssets(options)`, `exportStrings`, `importStrings`, `runCli(argv, strings)` with `strings: StringsTools` = `{ compile: compileStrings, exportStrings, importStrings }`. Audio files are `.mp3` or `.m4a`. Asset key = feature (or layer name) + "." + path inside `assets/`; a sub-feature's own name, `features/episodes/ep01/assets/ward/room.png` → `ep01.ward.room`. `runCli` (a game's `bun run assets:keys`) scans the assets and compiles the `strings/<locale>.json` of every feature and sub-feature, and the `strings/` of every layer, into `generated/strings.ts` (the `Strings` type for `defineGame`), one `generated/strings.<locale>.ts` per locale for the top-level features and the layers, and `generated/strings.<feature>.<locale>.ts` per sub-feature with string files, its keys only, each starting with `<feature>.` (it imports `messageArgument` and `messageDuration` from `@moku-labs/game` when a message needs them, no helper is copied in); `--check` fails when any output is out of date; `--pack <dir>` writes the production build. `--layer <folder>[=<name>]`, repeatable and good with every mode, scans `<root>/<folder>/` like one more feature under `<name>` (`<folder>` alone maps to itself): its `assets.ts`, `assets/` and `strings/<locale>.json`. A game on the layered layout passes `--layer shared=ui`, so `shared/assets/*` keeps the `ui.*` keys. A missing layer folder is a warning. `scanAssets`, `compileStrings`, `exportStrings` and `importStrings` take the same map as `layers: { shared: "ui" }`. `--pseudo` also writes the pseudo-locale `en-XA`. `--export <dir>` and `--import <dir>` exchange strings with translators; `--source <locale>` names the locale they read from, `"en"` by default. The package bin `moku-game-assets` is this CLI: a script is `"assets:keys": "moku-game-assets --root src --manifest public/assets/manifest.json --keys src/generated/assets.ts"`. A game with `config.ts` runs `moku-game keys` and `moku-game pack` instead: they pass its paths and its layers.
@@ -558,12 +558,12 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
558
558
  ### Screen plugins (V2, built)
559
559
 
560
560
  `world`, `renderer`, `input`, `assets`, `scenes`. Each has a README at `src/plugins/<name>/README.md`; the root README lists their APIs, events and config. Rendering: WebGPU preferred, with Pixi's WebGL fallback.
561
- - `app.scenes`: `current()` the mounted scene id, `expect(id)` the scene the next node without its own `scene` mounts, a rest node or a transit node in live mode (the restore door calls it; an unknown id throws). An `over` node takes it the same way, also over another mounted scene. A live switch, before it builds the scene, warms the bundles the scene names (`assets.warm`): their textures go to the GPU `renderer.uploads` a drawn frame while the old scene is still up, so the first frame of the new scene uploads none of them; textures already there are not waited for, and a fast walk or a headless app never waits. A bundle the scene does not name (a `core` bundle of portraits the board shows) is not warmed: name it in the scene's `bundles` or call `app.assets.warm`. Then, with a drawing renderer, the next scene is built aside: its ui elements are made by root and by part, laid out once and applied in parts, and the renderer makes its Pixi views, over the next frames off the stage in a budget per frame, config `scenes.buildMs: number | "auto"` (default `"auto"`, two thirds of the frame interval: 11.1 ms at 60 Hz, 5.56 ms at 120 Hz; `0` throws), and it is swapped in one frame. Until the swap `current()` answers the old scene, nothing of the new one is drawn, hit or found by `ui.find`, its `enter` motions wait and the gate stays closed, so the first tap lands on a complete scene; `scenes:changed` is emitted at the swap. A fast walk, a world that is not live and a headless app mount in one block as before. Over the scene being left, a live switch shows the look of `scenes.leave` (a veil, and a loader once the switch is not done `afterMs` after its start); the veil goes up at the node's `"begin"` stage, before `assets` downloads the coming scene at `"load"`, so a cold first visit reacts in the next frame.
561
+ - `app.scenes`: `current()` the mounted scene id, `expect(id)` the scene the next node without its own `scene` mounts, a rest node or a transit node in live mode (the restore door calls it; an unknown id throws). An `over` node takes it the same way, also over another mounted scene. A live switch, before it builds the scene, warms the bundles the scene names (`assets.warm`): their textures go to the GPU `renderer.uploads` a drawn frame while the old scene is still up, so the first frame of the new scene uploads none of them; textures already there are not waited for, and a fast walk or a headless app never waits. A bundle the scene does not name (a `core` bundle of portraits the board shows) is not warmed: name it in the scene's `bundles` or call `app.assets.warm`. Then, with a drawing renderer, the next scene is built aside: its ui elements are made by root and by part, laid out once and applied in parts, and the renderer makes its Pixi views, over the next frames off the stage in a budget per frame, config `scenes.buildMs: number | "auto"` (default `"auto"`, two thirds of the frame interval: 11.1 ms at 60 Hz, 5.56 ms at 120 Hz; `0` throws), and it is swapped in one frame. Until the swap `current()` answers the old scene, nothing of the new one is drawn, hit or found by `ui.find`, the rows of a feature's system pass over its entities (a system without `scenes` sees the new scene whole from the commit frame, F155), its `enter` motions wait and the gate stays closed, so the first tap lands on a complete scene; `scenes:changed` is emitted at the swap. A fast walk, a world that is not live and a headless app mount in one block as before. Over the scene being left, a live switch shows the look of `scenes.leave` (a veil, and a loader once the switch is not done `afterMs` after its start); the veil goes up at the node's `"begin"` stage, before `assets` downloads the coming scene at `"load"`, so a cold first visit reacts in the next frame.
562
562
  - `Shape({ kind, w, h, fill, fillAlpha, alpha, radius, stroke, strokeWidth, dash, clip, sweep?, cap? })` (`kind: "rect"`; `sweep` and `cap` are optional, `1` and `"round"` when left out; only an arc reads them; a rectangle or a triangle ignores them, also when an earlier arc left them on the `Shape`): a rounded rectangle, `kind: "triangle"` (fills its box pointing right) or `kind: "arc"`: a stroke on the circle inscribed in the box (`min(w, h) − strokeWidth` across, centred) from 12 o'clock clockwise over `sweep` (0..1, clamped; 0 draws nothing, 1 a closed ring), ended by `cap` (`"round" | "butt"`); an arc draws no fill and ignores `radius` and `dash`. The path is built again only when a field changes: a still arc costs nothing a frame. `Shape({ kind: "arc", w: 28, h: 28, stroke: 0xc8a15a, strokeWidth: 2.2, sweep: 0.42 })` is a slot timer's ring with 42 % left.
563
563
  - Overlays: `Overlay({ dim, dimColor, cover, hud, fade, hold })` on the root of an overlay (in `components`) keeps everything drawn before it as one picture, retaken in the frame anything in it changes, and with `cover: "opaque"` draws none of it once landed at alpha 1; `hold: true` (default `false`) holds the endless loops under it while it stands, as under a cover or a blurred picture (their phase follows time), so a dimmed sheet over a sharp scene draws no frame at rest; the engine draws the dim (`dim × level`, right under the root); the level follows the root's own enter and exit motion, `fade` (250 ms) only when it has none; level and landing are read through `app.renderer.sync.debug.overlays()`. A `backdrop: true` filter inside the kept range runs no pass while the picture stands (its look is in the picture) and is drawn again in the frame the overlay is gone. Types: `OverlayValue` (the component's value) and `HudPartValue` (a part of the HUD an overlay keeps shown or lets fade).
564
564
  - HUD: a scene layer `{ above: "overlays" }` is the HUD layer, drawn above every overlay and never in a picture; a scene with a HUD layer and no `ui` gets `ui` right under it. Its roots never take the keyboard: Escape and the Back press reach the top sheet under it. `HudPart({ key })` tags a HUD view; an overlay's `hud` (`"all"`, `"none"` or keys) names the parts that stay shown, the others fade with its level and take no tap. `hud: "under"` draws the whole HUD layer under the overlay's own dim instead, dimmed with the rest (one Pixi `RenderLayer` right before the dim; the HUD and the veil each drawn once): `Overlay({ dim: 0.82, dimColor: 0x1e161a, hud: "under" })`. While held the HUD takes no tap; the topmost such overlay holds it, and a sheet without `"under"` over it shows the HUD above again until it goes; with `dim: 0` it is `"all"`. Keys are typed by `defineGame<{ …, hud: "energy" | "gems" }>()`.
565
565
  - Endless loops of views under an opaque or blurred overlay write nothing (`renderer.sync.loopsHeld(entity)`, the seam anim asks before an endless loop writes); their phase follows time.
566
- - Scene switch look: from the start of a live switch (before its bundles and textures are awaited) the renderer draws a veil over the scene being left, above every layer, and, when the switch is not done `afterMs` after its start, a loader above it until the swap; then the veil fades out over the new scene. Config `scenes.leave` (default `{ cover: { color: 0x000000, alpha: 0.45, inMs: 50, outMs: 150 }, loader: { afterMs: 400 } }`) and a scene's `leave` (`defineScene("ward", { ..., leave: false })`) are merged field by field (the scene being left decides; `false` turns a part or the whole off); the loader is the engine's white ring, `loader: { texture: "ui.loader.ring" }` a game texture turning, or `loader: { projection: "loading" }` a projection in a layer of its own the scene declares (no other projection of the scene may draw there), kept built and hidden while the scene stands and shown once the loader is due; `scenes` feeds that loader the switch (`projection.feed`), so its `from(player, session, sw)` reads a `SceneSwitch`: `{ from: "ward", to: "ward", progress: 0 }` while the ward stands, then `{ from: "ward", to: "board", progress }`, the share of the board's bundles loaded (from `assets:bundle-progress`; a bundle loaded at the start or once the scene stage has its loads counts whole), 0 to 1 in steps of 0.01, the last exactly 1; `loader: { holdMs: 260 }` (default 0) is a floor on the swap: the next scene builds at once and the old one stays until 260 ms after the switch start and one drawn frame of the look, so a switch slower than it gets nothing added; an abort or a throw drops both at once; fast walks, a world that is not live, headless apps and the first scene show nothing and hold nothing. The scene being entered sets the veil's colour and alpha: `defineScene("night", { ..., enter: { cover: { color: 0x0b1020, alpha: 0.7 } } })` wins over what the scene being left resolved, field by field; `inMs`/`outMs` stay the left scene's and a veil turned off stays off. Types `SceneLeave`, `SceneCover`, `SceneLoader`, `SceneEnter` (`Scenes`).
566
+ - Scene switch look: from the start of a live switch (before its bundles and textures are awaited) the renderer draws a veil over the scene being left, above every layer, and, when the switch is not done `afterMs` after its start, a loader above it until the swap; then the veil fades out over the new scene. Config `scenes.leave` (default `{ cover: { color: 0x000000, alpha: 0.45, inMs: 50, outMs: 150 }, loader: { afterMs: 400 } }`) and a scene's `leave` (`defineScene("ward", { ..., leave: false })`) are merged field by field (the scene being left decides; `false` turns a part or the whole off); the loader is the engine's white ring, `loader: { texture: "ui.loader.ring" }` a game texture turning, or `loader: { projection: "loading" }` a projection in a layer of its own the scene declares (no other projection of the scene may draw there), kept built and hidden while the scene stands and shown once the loader is due; `scenes` feeds that loader the switch (`projection.feed`), so its `from(player, session, sw)` reads a `SceneSwitch`: `{ from: "ward", to: "ward", progress: 0 }` while the ward stands, then `{ from: "ward", to: "board", progress }`, the share of the board's bundles loaded (from `assets:bundle-progress`; a bundle loaded at the start or once the scene stage has its loads counts whole), 0 to 1 in steps of 0.01, the last exactly 1; `loader: { holdMs: 260 }` (default 0) is a floor on the swap: the next scene builds at once and the old one stays until 260 ms after the switch start (on the clock or in game time, whichever passes first, so a visual test's stepped frames pass it while its fake clock stands, F156) and one drawn frame of the look, so a switch slower than it gets nothing added; an abort or a throw drops both at once; fast walks, a world that is not live, headless apps and the first scene show nothing and hold nothing. The scene being entered sets the veil's colour and alpha: `defineScene("night", { ..., enter: { cover: { color: 0x0b1020, alpha: 0.7 } } })` wins over what the scene being left resolved, field by field; `inMs`/`outMs` stay the left scene's and a veil turned off stays off. Types `SceneLeave`, `SceneCover`, `SceneLoader`, `SceneEnter` (`Scenes`).
567
567
  - A scene names bundles on top of its `bundle` from the committed state: `defineScene("ward", { bundle: "episodes-kit", bundles: ({ session }) => [session.episode], layers: {}, projections: [wardRoom] })`. `bundles` is read each time a node enters the scene, and every way in (a live entry, a restore, the `safeNode` recovery) waits for all of them before the scene is mounted and the node's gate opens. The keys are `BundleKey`s of `generated/assets.ts`.
568
568
  - `app.assets`: `load(bundle)`, `warm(bundle)` (loads it if needed, then puts its textures and atlas pages on the GPU through `renderer.sync.textures.upload`, `renderer.uploads` a drawn frame; joins a running or finished warm; an unload forgets it; resolves also when the renderer could not upload; headless at once), `unload(bundle)`, `isLoaded(bundle)`, `has(bundle)` (the manifest carries it, loaded or not), `texture(key)`, `font(key)`, `audio(key)`, `usage()`. Per bundle in a feature's `assets.ts`: `defineBundles({ ep01: { tier: "feature", release: "leave", mipmaps: ["items/**"] } })`. `release: "leave"` also unloads the bundle, with reason `"leave"`, at the next rest once nothing holds it: not pinned by the node entered, not named by the mounted scene, no node of its feature on the stack; a bundle the outgoing scene named leaves one rest later. The default `"budget"` leaves only under the texture budget. `mipmaps` (`true` or globs relative to `assets/`) uploads the textures with their full chain; such a texture stays loose in a pack. A sub-feature with resources gets its own bundles, named like its folder, with `dir` and `parent` in the manifest; a code-only one has none. The effect `ready(bundle | bundles)` (root export, also from `defineGame`) lets a node rest on a load and stay answerable: its handler (fast mode too) answers `true` headless, throws for an unknown bundle, answers `true` when every bundle is loaded and warmed or its last warm failed (`ctx.log.warn("assets:ready-failed", { bundle, error })`, cleared by a later successful load), otherwise starts `warm` for what is missing, answers `false` and posts `{ type: "ready" }` into `flow.inbox` once all of it settled. Recipe: a rest node `inbox: ["elapsed", "ready"]` with outcomes `ready` and `back`, and a transit node `if ((await fx(ready(list))) === false) return out.wait();`. `companions.add({ load(bundle), unload(bundle) })` adds what loads and unloads with every bundle; `i18n` adds the strings of a sub-feature that way, only when `assets` is composed. Events `assets:bundle-loaded`, `assets:bundle-progress`, `assets:bundle-unloaded` (`reason: "budget" | "request" | "leave"`), `assets:replaced` (dev). Config: `manifest`, `textureBudgetMb: 192`, `preloadDepth: 2`, `baseUrl`, `io`.
569
569
  - `resource(name, defaults)` clones plain JSON defaults into every world. `resource(name, () => value)` calls the factory once per world on first read, so the value may hold a `Map` or a function: `const Looks = resource("boardLooks", () => ({ shown: new Map<World.Entity, { look: string }>() }))`. A system keeps its own state there; `snapshot()` leaves a value that is not JSON out.
@@ -676,7 +676,7 @@ Cosmetic rendering extras as data, drawn by `effectsPlugin`: `plugins: [...scree
676
676
  - Filter inputs: `inputs: { blur: { stages: [FrostBox4, FrostGauss], chain: (value, { resolution }) => [{ stage, scale, uniforms? }] } }` gives the body `sampleBlur(uv)` in both languages: the last texture of a chain of stages (each a `defineFilter`, drawing alone) drawn from the view's input into pooled textures at `resolution × scale`. The chain runs only when a uniform or the resolution changed; a step naming a stage not in `stages` breaks the filter. The engine counts the passes (leave `passes` out). `fallback: OtherFilter` (a subset of the uniforms) draws when the filter is broken.
677
677
  - Shader checks run in every build: every body, stage and fallback compiles once on the device when the renderer first draws, and the first scene mounts after the checks (`effects:mount-waited`). A broken filter (`effects:broken` with reason `compile`, `apply` or `chain`) draws its fallback or the view unfiltered, never a blank frame; a dev build also draws magenta stripes over it.
678
678
  - Built-in filters: `Glow`, `Outline`, `Blur`, `ColorMatrix`, `Noise`, `Displacement` (`map` is an asset key), `Alpha`. A motion hook tweens them like any component: `view.tween(Glow, { strength: 0 }, { ms: 200 })`.
679
- - The effect set: ready filters a feature lists in `filters`, as a game's own (`filters: [Flash]`; two features may list the same one): `Flash({ amount: 0..1, color })` washes the view with a colour, `Grade({ brightness, contrast, saturation, tint })` grades it (each 1 for none, 0..2), `Vignette({ x, y, radius, soft, color, amount })` darkens it outside a disc in 0..1 of the view, `RevealLine({ progress: 0..1, angle, soft })` shows it up to a line that sweeps across at `angle` (0 hides all, 1 shows all), `RevealRound({ x, y, radius: 0..1.5, soft, wobble: 0..0.2 })` shows it inside a disc (radius 0 hides all), `Dissolve({ progress: 0..1, scale, edge, edgeColor })` eats it away by a fixed noise of `scale` cells with a rim in `edgeColor`, `Shine({ position: -0.5..1.5, width, angle, strength })` sweeps a band of light across it (light on the colour only, the alpha kept), `Aura({ color, strength: 0..2, spread })` puts a halo `spread` px wide around its shape (padded by `spread`, 13 samples), `Fold({ angle, axis: 0 | 1, perspective: 0..1, shade: 0..1 })` turns it about its vertical (`axis: 0`) or horizontal (`axis: 1`) axis, padded by 8 px. Each is one pass and one sample (`Aura` 13), `cache: "local"`, and on WebGPU a tween draws on the view's own quad from its third frame: `view.tween(Flash, { amount: 0 }, { ms: 160 })`. A view that carries a filter no feature lists draws unfiltered; a dev build warns `effects:filter-unlisted` once per id.
679
+ - The effect set: ready filters a feature lists in `filters`, as a game's own (`filters: [Flash]`; two features may list the same one): `Flash({ amount: 0..1, color })` washes the view with a colour, `Grade({ brightness, contrast, saturation, tint })` grades it (each 1 for none, 0..2), `Vignette({ x, y, radius, soft, color, amount })` darkens it outside a disc in 0..1 of the view, `RevealLine({ progress: 0..1, angle, soft })` shows it up to a line that sweeps across at `angle` (0 hides all, 1 shows all), `RevealRound({ x, y, radius: 0..1.5, soft, wobble: 0..0.2 })` shows it inside a disc (radius 0 hides all), `Dissolve({ progress: 0..1, scale, edge, edgeColor })` eats it away by a fixed noise of `scale` cells with a rim in `edgeColor`, `Shine({ position: -0.5..1.5, width, angle, strength })` sweeps a band of light across it (light on the colour only, the alpha kept), `Aura({ color, strength: 0..2, spread })` puts a halo `spread` px wide around its shape (padded by `spread`, 13 samples), `Fold({ angle, axis: 0 | 1, perspective: 0..1, shade: 0..1 })` turns it about its vertical (`axis: 0`) or horizontal (`axis: 1`) axis, padded by 8 px. Each is one pass and one sample (`Aura` 13), `cache: "local"`, and on WebGPU a tween draws on the view's own quad from its third frame: `view.tween(Flash, { amount: 0 }, { ms: 160 })`. `Bloom({ strength: 0..2, threshold: 0..1, radius })` adds light around what is above `threshold`, blurred `radius` CSS px wide: it reads a chain of two engine stages (cut and boxed down, then blurred), 3 passes with its body at any radius and resolution (`Bloom.filter.inputs[0]?.chain({ ...Bloom().value }, { resolution: 2 }).length` is 2 steps), so it is for an object, not the screen; it is kept as a picture at rest and never draws on the quad: a tween of it runs its chain and redraws its picture's filter in every frame, 3 passes a frame for `strength`. A view that carries a filter no feature lists draws unfiltered; a dev build warns `effects:filter-unlisted` once per id.
680
680
  - API: `app.effects.stats()` returns `{ particles, emitters, filters, renderPasses }`; headless every number is 0.
681
681
  - `app.effects.diagnostics`: `kinds()` (built-ins, then feature filters, after start), `disable(kind)`, `enable(kind)`, `disabled()` (the off kinds in registration order). A switch acts on a dev or agent page only and answers `false` elsewhere or for an unknown kind (`effects:diagnostics-unknown`, once per id); an off kind keeps its instances and is left out of what the renderer draws from the next frame (`stats().filters` stays, `renderPasses` drops); a switch logs `effects:diagnostics` and writes a `switch` event to the performance log.
682
682
  - Config: `maxParticles: 3000` and `maxPasses: 24`, each warns once per crossing; `phone: "auto"`; `blur: { quality: 2, phoneResolution: 0.5 }`.
@@ -703,7 +703,7 @@ A plugin that owns a resource stores it in its state and frees it in `onStop: ({
703
703
  Two subpaths, neither on the root (V4). An editor, MCP tools and e2e scripts reach a running game through them; `docs/doors.md` in the engine repository has the full catalogue.
704
704
 
705
705
  - `@moku-labs/game/inspect`: `read(app, source, input?)` reads once; `watch(app, source, input, fn)` reads on the `signals` phase when the source changes and returns the stop function; `defineSource`; the frozen catalogue `sources`; the types `Source`, `InputSchema`, `InputOf`. Every source only reads, so the door is safe in a production build. Keys of `sources`: `graph`, `position`, `history`, `tainted`, `cheats`, `model`, `entities`, `projections`, `ui`, `locate`, `render`, `sounds`, `audioMuted`, `effects`, `filters`, `assets`, `log`, `explain`, `diff`, `schema`, `at`; their ids are `game.<key>`. `filters` answers `{ kinds, off }` of `effects.diagnostics`. `locate` takes `{ key }` (a ui element) or `{ target }` (a view by projection key) and answers its box in CSS px, the numbers Playwright clicks. `at` takes `{ x, y }` in CSS px and lists the views under that point, topmost first. `explain` takes `{ entity }` and answers that entity in full, `undefined` for a stale id. `diff` takes `{ from, to }` frames and answers what changed per entity; it throws in a production build and for a frame outside the last 120. `schema` lists every component and tag type the world met, with the JSON kind of each field. `audioMuted` answers whether the master bus is muted. `sounds` throws `[game] The source game.sounds needs audioPlugin.`, `audioMuted` throws `[game] The source game.audioMuted needs audioPlugin.` and `effects` and `filters` throw `[game] The source game.effects needs effectsPlugin.` (`game.filters` for `filters`) when that plugin is not installed; the editor lists such a source as not installed.
706
- - `@moku-labs/game/control`: `run(app, command, input?)` resolves `{ value, state }`, `state` being `{ path, frame, tainted }`; `defineCommand`; `controlRefused`; `controlReadOnly`; the frozen catalogue `commands`; the types `Command`, `ChoiceInput`, `Ran`, `ControlReadOnlyError`. Keys of `commands`: `answer`, `tap`, `drag`, `key`, `fill`, `scroll`, `walk`, `bookmark`, `restore`, `saveExport`, `saveImport`, `step`, `pause`, `resume`, `capture`, `debug`, `reducedMotion`, `timeScale`, `frameRate`, `mute`, `trace`, `filter`. `capture` resolves `{ png }`, and `{ png, legend }` with `legend: true`; `undefined` while the renderer is inert. `timeScale` takes `{ scale }`; 0 freezes game time while the frames keep running. `frameRate` takes `{ fps? }`, calls `time.setRate(fps ?? "auto")` and answers `time.rate()`. `mute` takes `{ muted }`, mutes the master bus and answers the flag. Without `audioPlugin` it throws `[game] The command game.mute needs audioPlugin.` `trace` takes `{ path }`, a list of views by projection key, and answers whether the gate took the answer. `scroll` takes `{ key, to }`, calls `ui.scroll(key, to)` and answers what it answers; a visual test writes it as the step `{ scroll: { key, to } }`. `filter` takes `{ kind, on }`, switches the filter kind through `effects.diagnostics` (cosmetic) and answers the off kinds; an unknown kind throws `[game] No filter kind "fx.nope".` naming the known ones; without `effectsPlugin` it throws `[game] The command game.filter needs effectsPlugin.`
706
+ - `@moku-labs/game/control`: `run(app, command, input?)` resolves `{ value, state }`, `state` being `{ path, frame, tainted }`; `defineCommand`; `controlRefused`; `controlReadOnly`; the frozen catalogue `commands`; the types `Command`, `ChoiceInput`, `Ran`, `ControlReadOnlyError`. Keys of `commands`: `answer`, `tap`, `drag`, `key`, `fill`, `scroll`, `walk`, `bookmark`, `restore`, `saveExport`, `saveImport`, `step`, `clock`, `pause`, `resume`, `capture`, `debug`, `reducedMotion`, `timeScale`, `frameRate`, `mute`, `trace`, `filter`. `run` checks the input against the command's schema first (F154): an unknown field, a required field left out and a value of another kind (a `number` must be finite) throw `[game] The command game.scroll got the field "dy", which it does not take.` with the fields it takes, and nothing runs. `clock` takes `{ advanceMs }` (cheat), calls `clock.advance(advanceMs)` and answers `{ now }`: a moment armed with `clock.scheduleAt` that is due arrives as `elapsed`; a visual test writes it as the step `{ clock: { advanceMs: 60_000 } }` to reach a clock-armed rest node (F157). `capture` resolves `{ png }`, and `{ png, legend }` with `legend: true`; `undefined` while the renderer is inert. `timeScale` takes `{ scale }`; 0 freezes game time while the frames keep running. `frameRate` takes `{ fps? }`, calls `time.setRate(fps ?? "auto")` and answers `time.rate()`. `mute` takes `{ muted }`, mutes the master bus and answers the flag. Without `audioPlugin` it throws `[game] The command game.mute needs audioPlugin.` `trace` takes `{ path }`, a list of views by projection key, and answers whether the gate took the answer. `scroll` takes `{ key, to }`, calls `ui.scroll(key, to)` and answers what it answers; a visual test writes it as the step `{ scroll: { key, to } }`. `filter` takes `{ kind, on }`, switches the filter kind through `effects.diagnostics` (cosmetic) and answers the off kinds; an unknown kind throws `[game] No filter kind "fx.nope".` naming the known ones; without `effectsPlugin` it throws `[game] The command game.filter needs effectsPlugin.`
707
707
  - Commands run in dev builds and debug builds. `__MOKU_GAME_DEV__ === true` (the dev page, a test's `vi.stubGlobal("__MOKU_GAME_DEV__", true)`) or `__MOKU_GAME_CONTROL__ === true` (`--debug`) runs every command; `__MOKU_GAME_AGENT__ === true` alone (`--debug=read`) runs the `read` and `cosmetic` ones and `run` refuses the others with `controlReadOnly(id)`, an error with `reason: "read-only"`: `[game] The command game.tap changes the game: this debug build runs read and cosmetic commands only.`; no flag: `run` throws `[game] Control commands run in dev builds only.` `moku-game build` defines the three flags `false`; a game without the shell uses a bundler `define` and should add `__MOKU_GAME_AGENT__: "false"` and `__MOKU_GAME_CONTROL__: "false"`. `saveExport` answers the committed `{ player, session, rng }` (read); `saveImport` takes `{ save }` of `saveExport`, restores it at the main flow's start and flushes the store (raw: not on a `--debug=read` page).
708
708
  - A command's effect is `read`, `route`, `cosmetic`, `cheat` or `raw`. A `cheat` or `raw` command taints the session and is journaled; read it with `sources.tainted` and `sources.cheats`. Of the base commands `restore` and `saveImport` are `raw`; `capture` with `diff` writes the state too, so a `--debug=read` page refuses it. `bookmark` answers `flow.bookmark()` plus `scene`, the mounted scene; `restore` calls `scenes.expect(scene)` before `flow.restore`, so a bookmark at a popup restores the scene under it, also on a page that shows another scene. A bookmark taken while an effect that takes answers waits names the waiting transit node (`info/show` in the mini game) and carries `rest`; `restore` of it answers once that node's gate is open, with `pending.gate` in its value, and the popup shows on the next frame.
709
709
  - A game's own: `defineSource({ id, title, input, changes, read })` with `changes` `"frame"`, `"commit"` or `"edge"`, and `defineCommand({ id, title, input, effect, run, overlay?, value?, choices?, choice? })`: `overlay: "toggle"` (input exactly `{ on: "boolean" }` and `value: app => boolean`, the switch's state; with `choices: readonly [string, ...string[]]`, each word once or `defineCommand` throws, the input is exactly `{ on: "boolean", choice: "string" | "string?" }` and `choice: app => string` answers the marked one, run with `{ on, choice }`) or `overlay: "button"` (no required input, no value) lists the command in the editor's overlay, which shows only such commands; any other combination is a type error. The id is camelCase words joined by dots, at least two: `dice.rolls`. An input schema maps field names to `"string"`, `"number"`, `"boolean"` or `"json"`; a trailing `?` makes one optional. A command body starts with `if (typeof __MOKU_GAME_DEV__ === "undefined" || !__MOKU_GAME_DEV__) throw controlRefused();`: it runs in dev and is refused on a debug page. A `.dev` command meant for a debug page writes the agent form for a read or cosmetic effect, `if ((typeof __MOKU_GAME_DEV__ === "undefined" || !__MOKU_GAME_DEV__) && (typeof __MOKU_GAME_AGENT__ === "undefined" || !__MOKU_GAME_AGENT__)) throw controlRefused();`, and the control form (`__MOKU_GAME_CONTROL__` in place of `__MOKU_GAME_AGENT__`) for the others. Keep them in `.dev` modules that only the dev page, a debug page and the tests import: the editor's dev page (`preparePage` with agents) and `moku-game build --debug` import every `**/*.dev.ts`, `moku-game build` none.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.101",
3
+ "version": "0.15.103",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [