@moku-labs/game 0.15.95 → 0.15.97

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 (33) hide show
  1. package/dist/app/page.d.mts +1 -1
  2. package/dist/app/page.mjs +1 -1
  3. package/dist/app/system.d.mts +3 -3
  4. package/dist/app.d.mts +3 -3
  5. package/dist/app.mjs +1 -1
  6. package/dist/assets.d.mts +1 -1
  7. package/dist/{commands-DcGoU3wp.d.mts → commands-DQXSQB_C.d.mts} +5 -5
  8. package/dist/control.d.mts +4 -4
  9. package/dist/{define-CZ1_l9Hn.d.mts → define-hPbGjPAY.d.mts} +2 -2
  10. package/dist/{headless-9UyUfvF5.d.mts → headless-Co3SEFi5.d.mts} +1 -1
  11. package/dist/{index-B8XphAxo.d.mts → index-U_AN5j0L.d.mts} +5 -4
  12. package/dist/index.d.mts +4 -4
  13. package/dist/index.mjs +2 -2
  14. package/dist/inspect.d.mts +6 -6
  15. package/dist/inspect.mjs +1 -1
  16. package/dist/jsx-dev-runtime.d.mts +1 -1
  17. package/dist/jsx-runtime.d.mts +1 -1
  18. package/dist/{runtime-DsAz7KUU.d.mts → runtime-B69fIYx_.d.mts} +1 -1
  19. package/dist/{sources-DIl02J8z.mjs → sources-Cqqz-0-b.mjs} +1 -1
  20. package/dist/{src-D-i4qig2.mjs → src-C32BYdgi.mjs} +724 -158
  21. package/dist/testing.d.mts +4 -4
  22. package/dist/testing.mjs +1 -1
  23. package/dist/{types-B-n_yE-i.d.mts → types-BE6tcAFX.d.mts} +2 -2
  24. package/dist/{types-0QTB6RV7.d.mts → types-Brsj29M-.d.mts} +4 -4
  25. package/dist/{types-Dhnc_iQk.d.mts → types-Cffn9Rbm.d.mts} +13 -6
  26. package/dist/{types-D8tWWOCK.d.mts → types-L3E-YS4N.d.mts} +46 -3
  27. package/dist/{types-CenejHAB.d.mts → types-qCcSw8YI.d.mts} +48 -12
  28. package/dist/{visual-B0ZwgkDL.d.mts → visual-72OVwKM4.d.mts} +6 -6
  29. package/dist/{visual-Cl7Q7pO9.mjs → visual-DhqD6W3v.mjs} +15 -5
  30. package/dist/visual.d.mts +1 -1
  31. package/dist/visual.mjs +1 -1
  32. package/llms.txt +4 -4
  33. 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-CenejHAB.mjs";
2
- import { t as createApp } from "./index-B8XphAxo.mjs";
3
- import { b as memory, x as saveOf, y as WithGameState } from "./types-0QTB6RV7.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-9UyUfvF5.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-qCcSw8YI.mjs";
2
+ import { t as createApp } from "./index-U_AN5j0L.mjs";
3
+ import { b as memory, x as saveOf, y as WithGameState } from "./types-Brsj29M-.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-Co3SEFi5.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 { m as flattenFeatures, on as type, rn as exit, t as createApp, tn as refuseStart } from "./src-D-i4qig2.mjs";
1
+ import { m as flattenFeatures, on as type, rn as exit, t as createApp, tn as refuseStart } from "./src-C32BYdgi.mjs";
2
2
  import { n as saveOf, t as memory } from "./memory-CWlqhS7l.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 { Hr as Json, Zr as Snapshot } from "./types-CenejHAB.mjs";
2
- import { t as HeadlessApp } from "./headless-9UyUfvF5.mjs";
1
+ import { Hr as Json, Zr as Snapshot } from "./types-qCcSw8YI.mjs";
2
+ import { t as HeadlessApp } from "./headless-Co3SEFi5.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-CenejHAB.mjs";
2
- import { o as AudioContextLike, s as Config$4 } from "./types-Dhnc_iQk.mjs";
3
- import { H as I18nApi, J as TextKey, q as StringTable } from "./types-D8tWWOCK.mjs";
4
- import { Ct as effectsPlugin, Et as audioPlugin, gt as PlatformProvider, i as screen, mt as platformPlugin, t as createApp } from "./index-B8XphAxo.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-qCcSw8YI.mjs";
2
+ import { o as AudioContextLike, s as Config$4 } from "./types-Cffn9Rbm.mjs";
3
+ import { H as I18nApi, J as TextKey, q as StringTable } from "./types-L3E-YS4N.mjs";
4
+ import { Ct as effectsPlugin, Et as audioPlugin, gt as PlatformProvider, i as screen, mt as platformPlugin, t as createApp } from "./index-U_AN5j0L.mjs";
5
5
  import { AnyPluginInstance } from "@moku-labs/core";
6
6
 
7
7
  //#region src/plugins/model/store/providers/memory.d.ts
@@ -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-CenejHAB.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-D8tWWOCK.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-qCcSw8YI.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-L3E-YS4N.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
  import { PluginCtx } from "@moku-labs/core";
5
5
 
@@ -2647,7 +2647,11 @@ type Config$1 = {
2647
2647
  * new sound with its id replaces it and names no `fadeMs`, or a stop names none.
2648
2648
  */
2649
2649
  sfxFadeMs: number; /** Reads the player's choice from the committed player. `undefined`: the buses stay at `buses`. */
2650
- volumes: Volumes | undefined; /** Context factory, the test seam. `undefined`: `new AudioContext()` when the global exists, otherwise headless. */
2650
+ volumes: Volumes | undefined;
2651
+ /**
2652
+ * Context factory, the test seam. `undefined`: `new AudioContext()` when the global exists, otherwise headless.
2653
+ * On iOS the plugin calls it again after a return from the background, so each call returns a new context.
2654
+ */
2651
2655
  context: (() => AudioContextLike) | undefined; /** How many started sounds `journal()` keeps, newest last. `0` turns the journal off. */
2652
2656
  journal: number; /** How music plays. `"stream"` needs MP3 or AAC: WebM Opus is silent through a media element in WebKit (bug 276813). Sounds always decode. */
2653
2657
  music: MusicMode; /** Set on `navigator.audioSession.type` in `onStart`, before the context exists. No-op where the API is missing (every Chromium, Firefox). */
@@ -2742,7 +2746,9 @@ type State$1 = {
2742
2746
  warnedVolumes: boolean;
2743
2747
  music: MusicTrack | undefined; /** The latest switch still decoding; `undefined` once it started or a later request replaced it. */
2744
2748
  musicPending: MusicSwitch | undefined; /** Removes the two window listeners of the unlock. */
2745
- unlock: (() => void) | undefined; /** The removers of the three fx handlers. */
2749
+ unlock: (() => void) | undefined; /** Cancels the renewal that waits after a return from the background: its timer and its two listeners. */
2750
+ renewal: (() => void) | undefined; /** The token of the renewal that runs; a stop or a newer renewal replaces it, and the old one makes nothing. */
2751
+ renewing: object | undefined; /** The removers of the three fx handlers. */
2746
2752
  removers: Array<() => void>; /** The `navigator.audioSession` that took `config.session`; `stop` writes `"auto"` back to it. */
2747
2753
  session: AudioSessionLike | undefined; /** Streamed tracks that fade out, each freed by its timer. */
2748
2754
  retiring: Set<RetiringTrack>;
@@ -2830,8 +2836,9 @@ type AudioApi = {
2830
2836
  * Tells whether the audio context runs. A shell that lets audio play with no gesture, such as a
2831
2837
  * native webview with the requirement switched off, makes it true at start: at once when the
2832
2838
  * context is created running, otherwise when the `resume()` of `onStart` fulfils. A browser
2833
- * that wants a gesture keeps it false until the first pointer event on the page resumed the
2834
- * context. It is false for the whole of a headless run.
2839
+ * that wants a gesture keeps it false until the first touch or click on the page resumed the
2840
+ * context and it runs; on iOS that resume may stay pending until iOS gives the sound back. It is
2841
+ * false for the whole of a headless run, and for the moment an iOS renewal closes the old context.
2835
2842
  *
2836
2843
  * @returns True once the context is running.
2837
2844
  * @example
@@ -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-CenejHAB.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-qCcSw8YI.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";
@@ -1713,11 +1713,31 @@ type TextStyleInput = {
1713
1713
  * ```
1714
1714
  */
1715
1715
  lineHeight?: number;
1716
+ /**
1717
+ * Evens the lines of a wrapped block, like CSS `text-wrap: balance`: a block that wraps to 2 to 6
1718
+ * lines is laid out at the narrowest width that keeps its number of lines, so its last line is
1719
+ * no lone word. `wrap` keeps the width, `balance` says how it is used; no line is wider than the
1720
+ * wrap. One line, no wrap, more than 6 lines or a word wider than the wrap: the greedy lines.
1721
+ * `measure`, the `ui` layout and the drawn label share the answer. False when left out.
1722
+ *
1723
+ * @example
1724
+ * ```ts
1725
+ * // The hint under the order board: greedy, its second line was «один.» alone.
1726
+ * defineTextStyles({
1727
+ * "shop.hint": { font: "ui.font-body", size: 32, fill: 0x3b2a1a, wrap: 800, balance: true }
1728
+ * });
1729
+ *
1730
+ * app.text.measure("Здесь то, что ждут ваши заказы. Возьмите один.", "shop.hint");
1731
+ * // { width: 441.6, height: 76.8 } on the 0.6 em fallback: «Здесь то, что ждут ваши» /
1732
+ * // «заказы. Возьмите один.». Without balance the width is its first line, 40 glyphs × 19.2.
1733
+ * ```
1734
+ */
1735
+ balance?: boolean;
1716
1736
  };
1717
1737
  /**
1718
1738
  * One style as the plugin stores it: every field filled, `bold` and `italic` only when the game
1719
1739
  * shipped those MSDF fonts, `shadow` only when the style has one, `lineHeight` only when the style
1720
- * names its line (`undefined` is the font's line).
1740
+ * names its line (`undefined` is the font's line), and `balance` only on a style that balances.
1721
1741
  *
1722
1742
  * @example
1723
1743
  * ```ts
@@ -1742,6 +1762,7 @@ type TextStyle = {
1742
1762
  digits: boolean;
1743
1763
  shadow: TextShadow | undefined;
1744
1764
  lineHeight: number | undefined;
1765
+ balance?: true;
1745
1766
  };
1746
1767
  /**
1747
1768
  * What `defineTextStyles` returns and a feature registers under its `textStyles` key. Structural
@@ -2170,6 +2191,24 @@ type ScrollSnap = readonly number[] & Brand<"ScrollSnap">;
2170
2191
  * ```
2171
2192
  */
2172
2193
  type ScrollOffset = number & Brand<"ScrollOffset">;
2194
+ /**
2195
+ * Whether a new `offset` prop of this render stands there at once instead of gliding: in the same
2196
+ * solve as the content's new rects, so content that moved inside the track and an offset that moves
2197
+ * by as much keep what the player sees in place. A running fling or glide stops and `ScrollState`
2198
+ * says `moving: false`. A scroll the finger holds only remembers the prop; left out or false, a new
2199
+ * prop glides. A `snap` release always glides.
2200
+ *
2201
+ * @example
2202
+ * ```tsx
2203
+ * // The order strip opens on 0. A first tile of 82 u comes in at the start of the track: the
2204
+ * // track and the offset shift 82 in one render, and the cards stay where they were drawn.
2205
+ * <scroll key="strip" axis="x" offset={82} jump style={{ width: 306, height: 120 }}>
2206
+ * <row key="track" style={{ width: 778, height: 120 }} />
2207
+ * </scroll>;
2208
+ * // the frame of that render: ScrollState { offset: 82, max: 472, moving: false }
2209
+ * ```
2210
+ */
2211
+ type ScrollJump = boolean & Brand<"ScrollJump">;
2173
2212
  /** How many rows a windowed scroll has. */
2174
2213
  type ScrollRows = number & Brand<"ScrollRows">;
2175
2214
  /** The height of every row, in reference units; above 0. */
@@ -2348,13 +2387,16 @@ type ScrollWindowForm = {
2348
2387
  /**
2349
2388
  * What a scroll container takes: children for a short list, or `rows`, `rowHeight` and `row` for
2350
2389
  * a long one, whose rows exist only in the window; the `axis` it moves on, the `snap` stops a
2351
- * release glides to, and the `offset` it stands at.
2390
+ * release glides to, the `offset` it stands at, and whether a new `offset` stands there at once
2391
+ * (`jump`).
2352
2392
  *
2353
2393
  * @example
2354
2394
  * ```ts
2355
2395
  * const props: ScrollProps = { axis: "y" };
2356
2396
  * // The order strip: sideways, three stops, opened on the orders.
2357
2397
  * const strip: ScrollProps = { axis: "x", snap: [0, 318, 390], offset: 318 };
2398
+ * // A first tile of 82 u came in at the start of the track: the strip stands on 82 at once.
2399
+ * const shifted: ScrollProps = { axis: "x", offset: 82, jump: true };
2358
2400
  * // 1000 orders of 120 u in a 1600 u list: rows 0 to 18 exist at offset 0.
2359
2401
  * const orders: ScrollProps = {
2360
2402
  * style: { height: 1600 },
@@ -2368,6 +2410,7 @@ type ScrollProps = CommonProps & {
2368
2410
  axis?: ScrollAxis;
2369
2411
  snap?: ScrollSnap;
2370
2412
  offset?: ScrollOffset;
2413
+ jump?: ScrollJump;
2371
2414
  } & (ScrollChildForm | ScrollWindowForm);
2372
2415
  /**
2373
2416
  * What a text field takes. `local` is required: every keystroke writes that field of the local
@@ -10323,7 +10323,7 @@ type ShotsInternal = {
10323
10323
  forget(): void;
10324
10324
  };
10325
10325
  declare namespace types_d_exports$2 {
10326
- export { AdaptiveScale, Api$1 as Api, AspectRange, BitmapFontData, CanvasRestart, CaptureOptions, Captured, Config$2 as Config, CountingClasses, CoverFrame, CreateTextureOptions$1 as CreateTextureOptions, DebugApi, DebugSwitches, DemandFrame, DemandModule, DemandReason, DemandState, Deps$2 as Deps, DisplayAdapter, DisplayEntry, DisplaysApi, DrawCounter, Events$2 as Events, FilterCache, FilterSlot, FilterSlotInputs, FilterSlotQuad, FiltersApi, FontsApi, FrameColumns, FrameReadResult, FrameReadout, FrameRecord, FrameRing, HitBox, HostApi, HostInternal, HostModule, HostState, HudPartValue, KeptInternal, KeptModule, KeptRange, KeptState, KeptStats, KernelSlice$2 as KernelSlice, LayerEntry, LeaveApi, LeaveCover, LeaveLoader, LeaveLook, LegendEntry, LongFrameEntry, Modules, MonitorApi, MonitorConfig, MonitorCounts, MonitorDeps, MonitorInternal, MonitorModule, MonitorSections, MonitorState, NineBorders$1 as NineBorders, Orientation, OverlayEventDetail, OverlayLevelValue, OverlayMode, OverlayPhase, OverlayReport, OverlayValue, OverlayWhat, PassKind, PassRecord, PerfCause, PerfChange, PerfChangeEntry, PerfCollectorLine, PerfCounts, PerfDisplay, PerfEventLine, PerfEventName, PerfGapLine, PerfHeaderLine, PerfLogLine, PerfLongFrameLine, PerfMarkLine, PerfMeasured, PerfMonitorApi, PerfSampleLine, PerfSpikeLine, PerfStartupLine, PerfTelemetryLine, PerfThermalLine, PictureRect, PixiApplication, PixiBitmapFont, PixiBounds, PixiContainer, PixiFilter, PixiFilterManager, PixiGpuProgram, PixiGraphics, PixiMatrix, PixiMesh, PixiMeshGeometry, PixiModule, PixiNineSliceSprite, PixiRectangle, PixiRenderTexture, PixiShader, PixiSprite, PixiTexture, PixiTextureSource, PixiUniformGroup, Point, PoolTrim, PoolTrimDetail, ProblemEventDetail, ProblemRule, Rect, RenderStats, RendererCtx, RendererKind, RetakeWhy, SafeArea, ShaderEventDetail, ShaderWhat, ShotPipes, ShotsApi, ShotsConfig, ShotsInternal, ShotsModule, ShotsState, SliceFrame, State$2 as State, SyncApi, SyncCounts, SyncInternal, SyncModule, SyncState, TeardownScope, TextureProvider, TextureUsage, TexturesApi, Under, View, ViewKind, ViewportApi, ViewportInternal, ViewportModule, ViewportSize, ViewportState, WarmDetail, WhyEntry, WhyLive };
10326
+ export { AdaptiveScale, Api$1 as Api, AspectRange, BitmapFontData, CanvasRestart, CaptureOptions, Captured, Config$2 as Config, CountingClasses, CoverFrame, CreateTextureOptions$1 as CreateTextureOptions, DebugApi, DebugSwitches, DemandFrame, DemandModule, DemandReason, DemandState, Deps$2 as Deps, DisplayAdapter, DisplayEntry, DisplaysApi, DrawCounter, Events$2 as Events, FilterCache, FilterSlot, FilterSlotInputs, FilterSlotQuad, FiltersApi, FontsApi, FrameColumns, FrameReadResult, FrameReadout, FrameRecord, FrameRing, HitBox, HostApi, HostInternal, HostModule, HostState, HudPartValue, KeptInternal, KeptModule, KeptRange, KeptState, KeptStats, KernelSlice$2 as KernelSlice, LayerEntry, LeaveApi, LeaveCover, LeaveLoader, LeaveLook, LegendEntry, LongFrameEntry, Modules, MonitorApi, MonitorConfig, MonitorCounts, MonitorDeps, MonitorInternal, MonitorModule, MonitorSections, MonitorState, NineBorders$1 as NineBorders, Orientation, OverlayEventDetail, OverlayLevelValue, OverlayMode, OverlayPhase, OverlayReport, OverlayValue, OverlayWhat, PassKind, PassRecord, PerfCause, PerfChange, PerfChangeEntry, PerfCollectorLine, PerfCounts, PerfDisplay, PerfEventLine, PerfEventName, PerfGapLine, PerfHeaderLine, PerfLogLine, PerfLongFrameLine, PerfMarkLine, PerfMeasured, PerfMonitorApi, PerfSampleLine, PerfSpikeLine, PerfStartupLine, PerfTelemetryLine, PerfThermalLine, PictureRect, PixiApplication, PixiBitmapFont, PixiBounds, PixiContainer, PixiFilter, PixiFilterManager, PixiGpuProgram, PixiGraphics, PixiMatrix, PixiMesh, PixiMeshGeometry, PixiModule, PixiNineSliceSprite, PixiRectangle, PixiRenderLayer, PixiRenderTexture, PixiShader, PixiSprite, PixiTexture, PixiTextureSource, PixiUniformGroup, Point, PoolTrim, PoolTrimDetail, ProblemEventDetail, ProblemRule, Rect, RenderStats, RendererCtx, RendererKind, RetakeWhy, SafeArea, ShaderEventDetail, ShaderWhat, ShotPipes, ShotsApi, ShotsConfig, ShotsInternal, ShotsModule, ShotsState, SliceFrame, State$2 as State, SyncApi, SyncCounts, SyncInternal, SyncModule, SyncState, TeardownScope, TextureProvider, TextureUsage, TexturesApi, Under, View, ViewKind, ViewportApi, ViewportInternal, ViewportModule, ViewportSize, ViewportState, WarmDetail, WhyEntry, WhyLive };
10327
10327
  }
10328
10328
  /**
10329
10329
  * The part of Pixi the engine uses: the classes `sync` builds views from (a `Rectangle` frames the
@@ -10338,7 +10338,8 @@ declare namespace types_d_exports$2 {
10338
10338
  * and the batcher pipe it subclasses, and the WGSL and GLSL shader pieces of the batch's SDF shader, and the WebGPU
10339
10339
  * render target system with its adaptor, the pipeline system and the stencil system the lazy canvas pass of `host`
10340
10340
  * subclasses or registers again (`host/render-pass.ts`), and the mesh and its geometry the rim-only nine-slice of
10341
- * `sync` is drawn with (`sync/hollow.ts`). The module object
10341
+ * `sync` is drawn with (`sync/hollow.ts`), and the render layer an overlay with `hud: "under"` draws the HUD layer in,
10342
+ * under its dim (`sync/overlay-look.ts`). The module object
10342
10343
  * never arrives through a static import: `config.loadPixi()` returns it, so a game without a screen carries no
10343
10344
  * Pixi in its bundle.
10344
10345
  *
@@ -10354,7 +10355,7 @@ declare namespace types_d_exports$2 {
10354
10355
  * pixi.defaultFilterVert.startsWith("in vec2 aPosition;"); // true
10355
10356
  * ```
10356
10357
  */
10357
- type PixiModule = Pick<typeof import("pixi.js"), "AlphaFilter" | "Application" | "Batcher" | "BatcherPipe" | "BitmapFont" | "BitmapText" | "BitmapTextPipe" | "BlurFilter" | "Bounds" | "Buffer" | "BufferUsage" | "Cache" | "ColorMatrixFilter" | "Container" | "DefaultBatcher" | "DisplacementFilter" | "ExtensionType" | "Filter" | "FilterSystem" | "Geometry" | "GlProgram" | "GlTextureSystem" | "GpuBatchAdaptor" | "GpuEncoderSystem" | "GpuGraphicsAdaptor" | "GpuProgram" | "GpuRenderTargetAdaptor" | "GpuRenderTargetSystem" | "GpuStencilSystem" | "GpuTextureSystem" | "Graphics" | "Matrix" | "Mesh" | "MeshGeometry" | "NineSliceSprite" | "NoiseFilter" | "Particle" | "ParticleContainer" | "PipelineSystem" | "Rectangle" | "RenderGroupPipe" | "RenderTexture" | "Shader" | "Sprite" | "Texture" | "TexturePool" | "UniformGroup" | "bitmapFontTextParser" | "bitmapFontXMLStringParser" | "colorBit" | "colorBitGl" | "compileHighShaderGlProgram" | "compileHighShaderGpuProgram" | "defaultFilterVert" | "extensions" | "generateTextureBatchBit" | "generateTextureBatchBitGl" | "getBatchSamplersUniformGroup" | "mSDFBit" | "mSDFBitGl" | "roundPixelsBit" | "roundPixelsBitGl">;
10358
+ type PixiModule = Pick<typeof import("pixi.js"), "AlphaFilter" | "Application" | "Batcher" | "BatcherPipe" | "BitmapFont" | "BitmapText" | "BitmapTextPipe" | "BlurFilter" | "Bounds" | "Buffer" | "BufferUsage" | "Cache" | "ColorMatrixFilter" | "Container" | "DefaultBatcher" | "DisplacementFilter" | "ExtensionType" | "Filter" | "FilterSystem" | "Geometry" | "GlProgram" | "GlTextureSystem" | "GpuBatchAdaptor" | "GpuEncoderSystem" | "GpuGraphicsAdaptor" | "GpuProgram" | "GpuRenderTargetAdaptor" | "GpuRenderTargetSystem" | "GpuStencilSystem" | "GpuTextureSystem" | "Graphics" | "Matrix" | "Mesh" | "MeshGeometry" | "NineSliceSprite" | "NoiseFilter" | "Particle" | "ParticleContainer" | "PipelineSystem" | "Rectangle" | "RenderGroupPipe" | "RenderLayer" | "RenderTexture" | "Shader" | "Sprite" | "Texture" | "TexturePool" | "UniformGroup" | "bitmapFontTextParser" | "bitmapFontXMLStringParser" | "colorBit" | "colorBitGl" | "compileHighShaderGlProgram" | "compileHighShaderGpuProgram" | "defaultFilterVert" | "extensions" | "generateTextureBatchBit" | "generateTextureBatchBitGl" | "getBatchSamplersUniformGroup" | "mSDFBit" | "mSDFBitGl" | "roundPixelsBit" | "roundPixelsBitGl">;
10358
10359
  /**
10359
10360
  * One Pixi application: renderer, canvas and stage.
10360
10361
  */
@@ -10372,6 +10373,10 @@ type PixiBounds = InstanceType<PixiModule["Bounds"]>;
10372
10373
  * A Pixi sprite.
10373
10374
  */
10374
10375
  type PixiSprite = InstanceType<PixiModule["Sprite"]>;
10376
+ /**
10377
+ * A Pixi render layer: it draws the containers attached to it at its own place in the tree, their parents unchanged.
10378
+ */
10379
+ type PixiRenderLayer = InstanceType<PixiModule["RenderLayer"]>;
10375
10380
  /**
10376
10381
  * A Pixi nine-slice sprite.
10377
10382
  */
@@ -11098,13 +11103,22 @@ type SpriteOptions = {
11098
11103
  * const shop: OverlayValue = {
11099
11104
  * dim: 0.56, dimColor: 0x1b1430, cover: "none", hud: ["energy", "gems"], fade: 270, hold: true
11100
11105
  * };
11106
+ * // The pyramid choice: the board and the whole HUD dim to 82 % together under it.
11107
+ * const pyramid: OverlayValue = {
11108
+ * dim: 0.82, dimColor: 0x1e161a, cover: "none", hud: "under", fade: 250, hold: false
11109
+ * };
11101
11110
  * ```
11102
11111
  */
11103
11112
  type OverlayValue = {
11104
11113
  /** How dark the dim is at full level, 0 to 1; 0 draws no dim. */dim: number; /** The colour of the dim, 0xRRGGBB. */
11105
11114
  dimColor: number; /** `"opaque"`: the overlay covers the whole screen once it has landed at alpha 1, so nothing under it is drawn. */
11106
- cover: "none" | "opaque"; /** The HUD parts that stay shown: every part, none, or the parts with these keys. */
11107
- hud: "all" | "none" | readonly string[];
11115
+ cover: "none" | "opaque";
11116
+ /**
11117
+ * The HUD parts that stay shown above the dim: every part, none, or the parts with these keys. `"under"`: the whole
11118
+ * HUD layer is drawn under this overlay's dim, dimmed with the rest, every part kept, and it takes no tap while it is
11119
+ * there; with a dim of 0 it is `"all"`.
11120
+ */
11121
+ hud: "all" | "none" | "under" | readonly string[];
11108
11122
  /**
11109
11123
  * Milliseconds the dim and the HUD parts take to come and go when the root plays no enter or exit motion; a root
11110
11124
  * with a motion is followed for its own length. 0 follows at once.
@@ -11180,8 +11194,9 @@ declare const Shape: ComponentType<ShapeValue>;
11180
11194
  * Marks the view an overlay is drawn from. Everything drawn before the root of that view is kept as one picture while
11181
11195
  * the overlay is there, and drawn again in the same frame anything in it changes; `cover: "opaque"` draws nothing
11182
11196
  * under it while it is fully shown. The engine draws its dim and fades the HUD parts it does not keep, with the root's
11183
- * own enter and exit motion (`fade` when it has none). `hold: true` holds the endless loops of what lies under it
11184
- * while it stands, so a dimmed sheet over a sharp scene draws no frame at rest.
11197
+ * own enter and exit motion (`fade` when it has none); `hud: "under"` draws the whole HUD under the dim instead.
11198
+ * `hold: true` holds the endless loops of what lies under it while it stands, so a dimmed sheet over a sharp scene
11199
+ * draws no frame at rest.
11185
11200
  *
11186
11201
  * @example
11187
11202
  * ```tsx
@@ -11189,6 +11204,8 @@ declare const Shape: ComponentType<ShapeValue>;
11189
11204
  * <panel key="caseSheet" motion={sheetFade} components={[Overlay({ cover: "opaque" })]} />
11190
11205
  * // The shop: the ward dims to 56 % and its glints rest while the shop stands; the energy and the gems stay shown.
11191
11206
  * <stack key="shopDimLayer" components={[Overlay({ dim: 0.56, hold: true, hud: ["energy", "gems"] })]} />
11207
+ * // The pyramid choice: the ward and the whole HUD dim to 82 % under it, and the HUD takes no tap until it leaves.
11208
+ * <stack key="pyramidChoice" components={[Overlay({ dim: 0.82, dimColor: 0x1e161a, hud: "under" })]} />
11192
11209
  * ```
11193
11210
  */
11194
11211
  declare const Overlay: ComponentType<OverlayValue>;
@@ -12751,7 +12768,12 @@ type OverlayRecord = {
12751
12768
  phase: OverlayPhase; /** The phase it turned to this frame: `"shown"` at landing, `"exiting"` at the first exit frame. */
12752
12769
  turned: OverlayPhase | undefined;
12753
12770
  mode: OverlayMode; /** The engine's dim, made when `dim` is above 0. */
12754
- dim: PixiSprite | undefined; /** The dim was sized for the canvas at least once. */
12771
+ dim: PixiSprite | undefined;
12772
+ /**
12773
+ * The render layer right under the dim that draws the HUD layer there while this overlay holds it: made once, with
12774
+ * the dim, for `hud: "under"`, and destroyed with the record, a restore or new layers.
12775
+ */
12776
+ under: PixiRenderLayer | undefined; /** The dim was sized for the canvas at least once. */
12755
12777
  sized: boolean; /** Seen by the step this frame; a record not seen is dropped. */
12756
12778
  seen: boolean; /** The event to log once the step has decided the modes: `"open"`, `"landed"` or `"leave"`. */
12757
12779
  news: OverlayEventDetail["what"] | undefined;
@@ -12766,7 +12788,7 @@ type ActiveRange = {
12766
12788
  reason: HiddenReason | undefined; /** Bottom first: lower layer containers, then roots and engine objects of the owner's layer. */
12767
12789
  readonly entries: PixiContainer[]; /** What the range picture hides for its render: layers above, the owner and above. */
12768
12790
  readonly others: PixiContainer[]; /** The entries, for the membership walk. */
12769
- set: Set<PixiContainer>; /** The node the picture stands before: the owner's dim, or its root. */
12791
+ set: Set<PixiContainer>; /** The node the picture stands before: the owner's HUD render layer, its dim, or its root. */
12770
12792
  before: PixiContainer | undefined; /** A picture holds the range (freeze only). */
12771
12793
  kept: boolean; /** The last take was refused; tried again when the owner or the entries change. */
12772
12794
  refused: boolean;
@@ -12782,6 +12804,16 @@ type ActiveRange = {
12782
12804
  calm: number; /** Drawn live because it changed in every frame. */
12783
12805
  fallback: boolean;
12784
12806
  };
12807
+ /**
12808
+ * What changed for the range since the last frame, written in place by the overlay step for the freeze rules: one
12809
+ * object for the life of the state, so a frame makes none. Private to the renderer.
12810
+ */
12811
+ type RangeStep = {
12812
+ /** The owner is new, or changed between cover and freeze. */fresh: boolean; /** The entries differ from the last frame. */
12813
+ entriesChanged: boolean; /** The others differ from the last frame. */
12814
+ othersChanged: boolean; /** The whole-frame reasons of this decision. */
12815
+ wholes: ReadonlySet<DemandReason>;
12816
+ };
12785
12817
  /**
12786
12818
  * The overlay step's state, `ctx.state.sync.overlay`. Collections and arrays are reused: a frame allocates nothing.
12787
12819
  * Private to the renderer.
@@ -12792,15 +12824,19 @@ type OverlayState = {
12792
12824
  records: Map<Entity, OverlayRecord>; /** The records bottom first, reused. */
12793
12825
  order: OverlayRecord[]; /** The range of the owner, or `undefined` with none. */
12794
12826
  active: ActiveRange | undefined; /** The range object, made once and reused. */
12795
- range: ActiveRange | undefined; /** Top objects of the HUD parts that take no tap. */
12796
- offTops: Set<PixiContainer>; /** `"<code>:<entity>"` of the warnings logged once. */
12827
+ range: ActiveRange | undefined; /** Top objects of the HUD parts that take no tap; a HUD layer held under a veil is skipped by the hit test through `held`. */
12828
+ offTops: Set<PixiContainer>; /** The HUD layer container attached to `heldBy`; `undefined` while it draws in its own place, above the overlays. */
12829
+ held: PixiContainer | undefined; /** The render layer of the overlay that holds the HUD under its dim (`hud: "under"`), or none. */
12830
+ heldBy: PixiRenderLayer | undefined; /** `"<code>:<entity>"` of the warnings logged once. */
12797
12831
  warned: Set<string>; /** The `overlay` event lines of an agent build, until the frame hands them to the monitor. */
12798
12832
  events: OverlayEventDetail[]; /** Scratch: the entries and others wanted this frame, and the set of the entries. */
12799
12833
  wantEntries: PixiContainer[];
12800
12834
  wantOthers: PixiContainer[];
12801
12835
  wantSet: Set<PixiContainer>; /** Entities whose reason the step itself flipped this frame: their marks are no change of the range's pixels. */
12802
12836
  flipped: Set<Entity>; /** Scratch of the tap set. */
12803
- nextOff: Set<PixiContainer>; /** A view left its place in the held range since the last step (it moved, or its view went). */
12837
+ nextOff: Set<PixiContainer>; /** Scratch: the tops of the parts faded this frame, written in place; the tap set is built from it on a change. */
12838
+ offList: PixiContainer[]; /** Scratch of the freeze rules: what changed for the range this frame. */
12839
+ step: RangeStep; /** A view left its place in the held range since the last step (it moved, or its view went). */
12804
12840
  left: boolean; /** Scratch of the cover test of `blurred`: made on first use from the Pixi module the renderer loaded. */
12805
12841
  bounds: PixiBounds | undefined;
12806
12842
  };
@@ -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-CenejHAB.mjs";
2
- import { P as AnimApi, r as UiApi } from "./types-Dhnc_iQk.mjs";
3
- import { L as InputApi } from "./types-D8tWWOCK.mjs";
4
- import { r as Repro } from "./headless-9UyUfvF5.mjs";
5
- import { i as ControlApp, o as InputOf } from "./types-B-n_yE-i.mjs";
6
- import { t as commands } from "./commands-DcGoU3wp.mjs";
1
+ import { Nr as Api$4, Or as Api$1, Z as Api, ni as Api$3, zr as Api$2 } from "./types-qCcSw8YI.mjs";
2
+ import { P as AnimApi, r as UiApi } from "./types-Cffn9Rbm.mjs";
3
+ import { L as InputApi } from "./types-L3E-YS4N.mjs";
4
+ import { r as Repro } from "./headless-Co3SEFi5.mjs";
5
+ import { i as ControlApp, o as InputOf } from "./types-BE6tcAFX.mjs";
6
+ import { t as commands } from "./commands-DQXSQB_C.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. */
@@ -296,8 +296,9 @@ const Shape = /*#__PURE__*/ component("Shape", shapeDefaults);
296
296
  * Marks the view an overlay is drawn from. Everything drawn before the root of that view is kept as one picture while
297
297
  * the overlay is there, and drawn again in the same frame anything in it changes; `cover: "opaque"` draws nothing
298
298
  * under it while it is fully shown. The engine draws its dim and fades the HUD parts it does not keep, with the root's
299
- * own enter and exit motion (`fade` when it has none). `hold: true` holds the endless loops of what lies under it
300
- * while it stands, so a dimmed sheet over a sharp scene draws no frame at rest.
299
+ * own enter and exit motion (`fade` when it has none); `hud: "under"` draws the whole HUD under the dim instead.
300
+ * `hold: true` holds the endless loops of what lies under it while it stands, so a dimmed sheet over a sharp scene
301
+ * draws no frame at rest.
301
302
  *
302
303
  * @example
303
304
  * ```tsx
@@ -305,6 +306,8 @@ const Shape = /*#__PURE__*/ component("Shape", shapeDefaults);
305
306
  * <panel key="caseSheet" motion={sheetFade} components={[Overlay({ cover: "opaque" })]} />
306
307
  * // The shop: the ward dims to 56 % and its glints rest while the shop stands; the energy and the gems stay shown.
307
308
  * <stack key="shopDimLayer" components={[Overlay({ dim: 0.56, hold: true, hud: ["energy", "gems"] })]} />
309
+ * // The pyramid choice: the ward and the whole HUD dim to 82 % under it, and the HUD takes no tap until it leaves.
310
+ * <stack key="pyramidChoice" components={[Overlay({ dim: 0.82, dimColor: 0x1e161a, hud: "under" })]} />
308
311
  * ```
309
312
  */
310
313
  const Overlay = /*#__PURE__*/ component("Overlay", overlayDefaults);
@@ -760,19 +763,22 @@ function isLineHeight(lineHeight) {
760
763
  }
761
764
  /**
762
765
  * Fills the defaults of one style and refuses a wrap that is not a width, `"box"` or `"none"`,
763
- * and a line height that is not a number above zero.
766
+ * a line height that is not a number above zero, and a balance that is not true or false. The
767
+ * stored style carries `balance` only when it balances.
764
768
  *
765
769
  * @param name - The style name, for the error.
766
770
  * @param input - What the game wrote.
767
771
  * @returns The style with every field filled.
768
772
  * @throws {Error} When `wrap` is a number that is not greater than zero, or another word.
769
773
  * @throws {Error} When `lineHeight` is not a finite number greater than zero.
774
+ * @throws {Error} When `balance` is neither left out nor a boolean.
770
775
  */
771
776
  function normalizeStyle(name, input) {
772
777
  const wrap = input.wrap ?? "none";
773
778
  if (!isWrap(wrap)) throw new Error(`[game] Text style "${name}" has wrap ${wrap}.\n Use a width in reference px, "box" or "none".`);
774
779
  if (!isLineHeight(input.lineHeight)) throw new Error(`[game] Text style "${name}" has lineHeight ${input.lineHeight}.\n Use a multiple of size above 0, such as 1.2.`);
775
- return {
780
+ if (input.balance !== void 0 && typeof input.balance !== "boolean") throw new Error(`[game] Text style "${name}" has balance ${String(input.balance)}.\n Use true or false.`);
781
+ const style = {
776
782
  font: input.font,
777
783
  bold: input.bold,
778
784
  italic: input.italic,
@@ -787,6 +793,8 @@ function normalizeStyle(name, input) {
787
793
  shadow: shadowOf(input.shadow),
788
794
  lineHeight: input.lineHeight
789
795
  };
796
+ if (input.balance === true) style.balance = true;
797
+ return style;
790
798
  }
791
799
  /**
792
800
  * Declares the text styles of a feature. The result goes under the `textStyles` key of the
@@ -796,6 +804,7 @@ function normalizeStyle(name, input) {
796
804
  * @returns The registration a feature carries.
797
805
  * @throws {Error} When a style names a wrap that is not a width, `"box"` or `"none"`.
798
806
  * @throws {Error} When a style names a lineHeight that is not a number above 0.
807
+ * @throws {Error} When a style names a balance that is not true or false.
799
808
  * @example
800
809
  * ```ts
801
810
  * defineTextStyles({ "hud.digits": { font: "ui.font-digits", size: 40, fill: 0xffe082 } });
@@ -880,7 +889,8 @@ function readStyle(name, value) {
880
889
  wrap: value.wrap,
881
890
  digits: value.digits,
882
891
  shadow: readShadow(value.shadow),
883
- lineHeight: value.lineHeight
892
+ lineHeight: value.lineHeight,
893
+ balance: value.balance
884
894
  };
885
895
  return normalizeStyle(name, {
886
896
  ...input,
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-B0ZwgkDL.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-72OVwKM4.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,5 +1,5 @@
1
1
  import { t as VISUAL_CLOCK } from "./fake-hnJcJeYf.mjs";
2
- import { n as read, t as sources } from "./sources-DIl02J8z.mjs";
2
+ import { n as read, t as sources } from "./sources-Cqqz-0-b.mjs";
3
3
  import { n as commands, t as run } from "./run-B5if0jxE.mjs";
4
4
  import path from "node:path";
5
5
  import { createBrandConsole } from "@moku-labs/common/cli";
package/llms.txt CHANGED
@@ -561,7 +561,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
561
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.
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
- - 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. Keys are typed by `defineGame<{ …, hud: "energy" | "gems" }>()`.
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
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`).
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`.
@@ -594,15 +594,15 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
594
594
 
595
595
  A screen is a projection whose `view` returns JSX. The game's `tsconfig.json` sets `"jsx": "react-jsx"` and `"jsxImportSource": "@moku-labs/game"`; screens are `.tsx` files. There is no DOM and no React.
596
596
 
597
- - Tags: `screen`, `layer`, `row`, `column`, `stack`, `spacer`, `panel` (swallows taps), `image` (`texture`, `fit?: "contain" | "cover" | "fill"`), `icon` (`name`, `fit?`), `text` (`content: string | Message`, or `bind={bind(Counter, "value")}` with `components={[Counter({ value })]}`; formats `int`, `mm:ss`, `h:mm:ss`, `duration`; `Countdown({ until })` with `bind(Countdown, "left", { format: "mm:ss" })` counts down to a `clock` moment; `style` is a text style key), `button` (`intent` + `payload`, or `local`, never both; `point` beside `intent` adds `payload.point: { x, y }` of a finger tap, the press-down point in the button's own units, (0, 0) its top-left corner, absent for keyboard taps: `<button intent="kitTap" point />`), `scroll` (`axis?: "x" | "y"` (`"y"`), fixed at spawn, another one later warns `ui:scroll-axis-fixed`; children for a short list, laid out as a column on `y` and a row on `x`, or the windowed form `rows`, `rowHeight`, `overscan?` (5), `row: index => node`, on `y` only: `axis: "x"` with `rows` throws `[game] A windowed scroll moves on y only.`; row state belongs in the model, a row that leaves the window loses its local state; `snap?: number[]` stops in offsets, kept inside `0..max`: a release glides to the stop nearest `offset + v × 260` (v in units a ms) on `1 − (1 − p)³` over `min(620, 260 + distance × 1.1)` ms; without `snap` a release flings, `v ×= 0.998` a ms until under 0.02, 0 when the finger rested over 50 ms; `offset?: number` (0) where it stands from the start, drawn there in its first frame, a new value glides there, the same value does nothing; hard edges, nothing passes on to a parent scroll; a press on a child that leaves the tap slop along the scroll's axis goes to the scroll and the child answers nothing, a finger on a moving scroll only stops it; every number in `time.delta` ms, so a time scale applies; the public component `ScrollState { offset, max, moving }` on its entity, whole units `0..max`, written when it changes and once with `moving: false` when it stops, read by a system and by `game.explain`; `app.ui.scroll(key, to)` and the visual step `{ scroll: { key, to } }` set it at once), `input` (a text field; its text lives in the component's `local`, see the ui README), `anchor` (`to: AnchorTarget | AnchorTarget[]`, `AnchorTarget` = `{ projection, key }`, a ui element keyed under its root's projection; `pad?: number` (0) outward in its root's units: its rect is where its targets are drawn, the union of the shown ones, in the frame they are laid out, scrolled or moved, through fits, slots and ancestor motion, rotation left out; children lay out inside it; a `width`/`height`/`position` in its style is ignored (`ui:anchor-style`, dev); with no target shown it is drawn at alpha 0 and takes no tap, stays, and comes back with its target; `ui:anchor-target-missing` `{ key, to }` once (dev) after a key named nothing two frames in a row; a target inside the anchor is refused, `[game] An anchor cannot point at its own child "key".`; its `change.Box` motion plays only when its targets change (a new `to`, a key naming another entity), never on a follow, and a glide that runs is carried so it lands on the moving target; 0 B a frame still or following: `<anchor key="window" to={{ projection: "board.strip", key: "seat0" }} pad={4} motion={glide}>`). Common props: `key`, `style`, `state: { active?, disabled?, selected? }`, `motion`, `components` (extra component values for the element's entity, such as a filter: `components={[Glow({ strength: 2 })]}`, or `DebugTrigger()`: five taps within 3000 ms of wall time on that view call `app.debug.overlay.open()` on a page with the agent flag, nothing elsewhere; put it on a `button` naming nothing); containers take `hosts?: string[]` (projections drawn inside the element: world views hang under it from the slot's first frame; a JSX projection is laid out in the slot's content box). Children draw and are hit in markup order at equal `zIndex`; the roots of a scene draw in the order of its `projections` (the `ui` layer sorts by `Order`; `ui: { sort: "none" }` keeps insertion order). `defineMotion({ when: "change" })` plays its `enter` and `exit` only for a commit or a popup, never when its screen mounts or unmounts; declare a motion at module level (`ui:motion-rebuilt` names a loop rebuilt in a view). `motion.change` plays `Box` (the rects), `Transform` (the rest poses), the visual the element is drawn with (`Shape`, `Sprite`, `NineSlice`, `Text`, when a render or a restyle moves a number of it: `sweep`, `alpha`, `w`; a returned motion brings the numbers home from where they stand and the other fields land at once; the last motion of that name is cancelled first) and each extra of `components`, each as `(view, previous, next, hint)`; a dev build names any other `change` hook once, `ui:change-never-plays` `{ key, name }`. An element a render replaces (a root whose view returns another key or tag, a child of another key or tag) plays its exit with `"change"`, everything under it plays its own, and it leaves `find` at once, so the new element takes the keys they share. Style adds `nineSlice`, `tint`, `offsetX`, `offsetY`, `scale`, `origin`, `fit: "contain"`; state variants `is: { hover, pressed, disabled, active, selected, covered }`. `popup(Component, props, { over })` stacks a popup over a kept one.
597
+ - Tags: `screen`, `layer`, `row`, `column`, `stack`, `spacer`, `panel` (swallows taps), `image` (`texture`, `fit?: "contain" | "cover" | "fill"`), `icon` (`name`, `fit?`), `text` (`content: string | Message`, or `bind={bind(Counter, "value")}` with `components={[Counter({ value })]}`; formats `int`, `mm:ss`, `h:mm:ss`, `duration`; `Countdown({ until })` with `bind(Countdown, "left", { format: "mm:ss" })` counts down to a `clock` moment; `style` is a text style key), `button` (`intent` + `payload`, or `local`, never both; `point` beside `intent` adds `payload.point: { x, y }` of a finger tap, the press-down point in the button's own units, (0, 0) its top-left corner, absent for keyboard taps: `<button intent="kitTap" point />`), `scroll` (`axis?: "x" | "y"` (`"y"`), fixed at spawn, another one later warns `ui:scroll-axis-fixed`; children for a short list, laid out as a column on `y` and a row on `x`, or the windowed form `rows`, `rowHeight`, `overscan?` (5), `row: index => node`, on `y` only: `axis: "x"` with `rows` throws `[game] A windowed scroll moves on y only.`; row state belongs in the model, a row that leaves the window loses its local state; `snap?: number[]` stops in offsets, kept inside `0..max`: a release glides to the stop nearest `offset + v × 260` (v in units a ms) on `1 − (1 − p)³` over `min(620, 260 + distance × 1.1)` ms; without `snap` a release flings, `v ×= 0.998` a ms until under 0.02, 0 when the finger rested over 50 ms; `offset?: number` (0) where it stands from the start, drawn there in its first frame, a new value glides there, the same value does nothing; `jump?: boolean` makes a new `offset` value of that render stand there at once, in the same solve as the content's new rects (track and offset shifted 82 together keep the cards in place), its fling or glide stopped, `moving: false`; a held scroll only remembers it; left out, a new value glides; hard edges, nothing passes on to a parent scroll; a press on a child that leaves the tap slop along the scroll's axis goes to the scroll and the child answers nothing, a finger on a moving scroll only stops it; every number in `time.delta` ms, so a time scale applies; the public component `ScrollState { offset, max, moving }` on its entity, whole units `0..max`, written when it changes and once with `moving: false` when it stops, read by a system and by `game.explain`; `app.ui.scroll(key, to)` and the visual step `{ scroll: { key, to } }` set it at once), `input` (a text field; its text lives in the component's `local`, see the ui README), `anchor` (`to: AnchorTarget | AnchorTarget[]`, `AnchorTarget` = `{ projection, key }`, a ui element keyed under its root's projection; `pad?: number` (0) outward in its root's units: its rect is where its targets are drawn, the union of the shown ones, in the frame they are laid out, scrolled or moved, through fits, slots and ancestor motion, rotation left out; children lay out inside it; a `width`/`height`/`position` in its style is ignored (`ui:anchor-style`, dev); with no target shown it is drawn at alpha 0 and takes no tap, stays, and comes back with its target; `ui:anchor-target-missing` `{ key, to }` once (dev) after a key named nothing two frames in a row; a target inside the anchor is refused, `[game] An anchor cannot point at its own child "key".`; its `change.Box` motion plays only when its targets change (a new `to`, a key naming another entity), never on a follow, and a glide that runs is carried so it lands on the moving target; 0 B a frame still or following: `<anchor key="window" to={{ projection: "board.strip", key: "seat0" }} pad={4} motion={glide}>`). Common props: `key`, `style`, `state: { active?, disabled?, selected? }`, `motion`, `components` (extra component values for the element's entity, such as a filter: `components={[Glow({ strength: 2 })]}`, or `DebugTrigger()`: five taps within 3000 ms of wall time on that view call `app.debug.overlay.open()` on a page with the agent flag, nothing elsewhere; put it on a `button` naming nothing); containers take `hosts?: string[]` (projections drawn inside the element: world views hang under it from the slot's first frame; a JSX projection is laid out in the slot's content box). Children draw and are hit in markup order at equal `zIndex`; the roots of a scene draw in the order of its `projections` (the `ui` layer sorts by `Order`; `ui: { sort: "none" }` keeps insertion order). `defineMotion({ when: "change" })` plays its `enter` and `exit` only for a commit or a popup, never when its screen mounts or unmounts; declare a motion at module level (`ui:motion-rebuilt` names a loop rebuilt in a view). `motion.change` plays `Box` (the rects), `Transform` (the rest poses), the visual the element is drawn with (`Shape`, `Sprite`, `NineSlice`, `Text`, when a render or a restyle moves a number of it: `sweep`, `alpha`, `w`; a returned motion brings the numbers home from where they stand and the other fields land at once; the last motion of that name is cancelled first) and each extra of `components`, each as `(view, previous, next, hint)`; a dev build names any other `change` hook once, `ui:change-never-plays` `{ key, name }`. An element a render replaces (a root whose view returns another key or tag, a child of another key or tag) plays its exit with `"change"`, everything under it plays its own, and it leaves `find` at once, so the new element takes the keys they share. Style adds `nineSlice`, `tint`, `offsetX`, `offsetY`, `scale`, `origin`, `fit: "contain"`; state variants `is: { hover, pressed, disabled, active, selected, covered }`. `popup(Component, props, { over })` stacks a popup over a kept one.
598
598
  - Style vocabulary (`defineStyle`, plain data): flow `direction`, `wrap`, `justify`, `align`, `alignSelf`, `gap`, `grow`, `shrink`; box `padding`, `margin`, `width`, `height`, `minWidth`, `minHeight`, `maxWidth`, `maxHeight`, `aspect`, `overflow`; position `position`, `left`, `top`, `right`, `bottom`, `reason`; visual `fill`, `stroke`, `strokeWidth`, `radius`, `alpha`, `shape: "rect" | "triangle" | "arc"` (`"rect"`; a triangle fills the box pointing right; an arc is only a `stroke` of `strokeWidth` on the circle inscribed in the box, `min(width, height) − strokeWidth` across, from 12 o'clock clockwise over `sweep`), `dash` (dash length of the stroke, gaps of half a dash; not on an arc), `sweep` (0..1, default 1, clamped; 0 draws nothing, 1 a closed ring), `cap: "round" | "butt"` (`"round"`; the ends of an open arc); variants `is: { pressed?, disabled?, active?, selected? }` and `when: { portrait?, landscape?, tall?, wide? }`, each a partial style merged in when the flag holds. Lengths are reference units or `"safeArea.top" | "safeArea.right" | "safeArea.bottom" | "safeArea.left"`. No font size here: it comes from the text style.
599
599
  - `defineComponent(name, { local?, outcomes?, view(props, local) })`. A component with `outcomes` is a popup: `await fx(popup(Component, props))` opens the gate for its outcomes and resolves with `{ intent, payload, at }` of the pressed button, `at` the clock moment of the answer. A button with `local` writes into the nearest component instance; it never reaches the graph.
600
600
  - `tr(key, params?)` returns a frozen `Message` `{ key, params }`; no locale is read at the call site. Strings live in `strings/<locale>.json` of any feature or sub-feature, as ICU MessageFormat 1 (`{n, plural, one {# order} other {# orders}}`, `select`, `selectordinal`, `number`, `date`, `time`; no skeletons, no `currency`). `bun run assets:keys` compiles them. The keys of the top-level features and the layers go into `generated/strings.<locale>.ts`, which one feature registers; a sub-feature's keys start with `<name>.` (`ep01.title`) and go into `generated/strings.<name>.<locale>.ts`, which the sub-feature registers lazily, `strings: { en: () => import("@generated/strings.ep01.en"), ru: () => import("@generated/strings.ep01.ru") }`. With `assets` composed those modules load and unload with the bundle named like the sub-feature: every way the bundle comes (a node entry, a scene's `bundles`, `load`, a restore, the `safeNode`) brings its strings, a locale switch brings them in the new locale, and while the bundle is not loaded a key of it gives `⟦key⟧` and `has(key)` is false. A compiled module calls the root helpers `messageArgument(value, intl)` (an element stays an element part, a list goes through `Intl.ListFormat`, a number through `Intl.NumberFormat`, else text) and `messageDuration(ms)` (`95_000` gives `{ minutes: 1, seconds: 35 }`). `app.i18n`: `locale()`, `setLocale(locale)` (async, emits `i18n:locale-changed`), `format(message, locale?)` returns `Part[]`, `plain(message)` returns a string, `has(key)`, `isKey(value)`, `locales()`, `replace(locale, messages)` (dev hot swap of a generated strings file). Config: `locale: "en"`, `fallback: "en"`, `locales: {}`.
601
601
  - Keys that come from data: `I18n.TextKey<Strings>` is the keys of the generated `Strings` without parameters (nothing new is generated). A data table types its keys `TextKey` or builds them with the kit's `key("board.hint.red")`; the kit's `tr` never takes a plain `string`. A key read back from a save is checked where the app is (an effect handler, app or page code, loading a save) with one `isKey(value)`: `defineGameApp({ ..., strings: type<Strings>() })` types the game's `app.i18n`, so a true `app.i18n.isKey(value)` narrows the value to `TextKey`; `ctx.require(i18nPlugin).isKey(value)` in a plugin narrows to `string`. `app.i18n.isKey(value)` answers true for a key of the loaded tables of the current locale or the fallback, and for the `<feature>.` prefix of a sub-feature whose strings are not loaded yet; a key that takes parameters answers true too.
602
- - Text: `Text` component, `label({ text, style, at, anchor? })` for board text in a projection view, `defineTextStyles({ "hud.digits": { font, size, fill, bold?, italic?, stroke?, strokeWidth?, letterSpacing?, align?, wrap? (a width, "none" or "box": wrap at the laid-out width of its ui element; lines break between words, after a hyphen inside a word and at a soft hyphen U+00AD, drawn as `-` only where the line breaks), digits?, lineHeight? (the line as a multiple of size above 0, such as 1.28; glyphs sit in the middle of the line; absent: the font's own line) } })` under the feature's `textStyles` key. Tags inside a string: `<b>`, `<i>`, `<color=#rrggbb>`, `<icon=key>`, `\<`, `\n`. Built-in styles `body` and `digits` from config `fonts: { body: "ui.font-body", digits: "ui.font-digits" }`. `app.text.measure(content, style, width?)` gives the same numbers in a browser and in Bun. `app.text.replaceStyles(styles)` is the dev hot swap of a saved `defineTextStyles` value. A game's own number format: `defineTextFormats({ "pill.number": value => ({ content, style }) })` under the feature's `textFormats` key, named by the `bind` of `defineGame` (`GameTypes.textFormats`): `bind(Counter, "value", { format: "pill.number" })`. It takes the whole value, is pure over value and language, is not called while the whole value and the locale stand, and owns `Text.style`; a `Countdown` calls it every frame. `app.text.formatted(name, value)` answers `{ text, style }`, `undefined` for an unknown or built-in name and for a format that threw. A saved module exporting formats reloads the page.
602
+ - Text: `Text` component, `label({ text, style, at, anchor? })` for board text in a projection view, `defineTextStyles({ "hud.digits": { font, size, fill, bold?, italic?, stroke?, strokeWidth?, letterSpacing?, align?, wrap? (a width, "none" or "box": wrap at the laid-out width of its ui element; lines break between words, after a hyphen inside a word and at a soft hyphen U+00AD, drawn as `-` only where the line breaks), digits?, lineHeight? (the line as a multiple of size above 0, such as 1.28; glyphs sit in the middle of the line; absent: the font's own line), balance? (true evens a wrapped block of 2–6 lines at the narrowest width that keeps its number of lines, like CSS `text-wrap: balance`; never wider than the wrap; one line, more than 6 or a word wider than the wrap stay greedy) } })` under the feature's `textStyles` key. Tags inside a string: `<b>`, `<i>`, `<color=#rrggbb>`, `<icon=key>`, `\<`, `\n`. Built-in styles `body` and `digits` from config `fonts: { body: "ui.font-body", digits: "ui.font-digits" }`. `app.text.measure(content, style, width?)` gives the same numbers in a browser and in Bun. `app.text.replaceStyles(styles)` is the dev hot swap of a saved `defineTextStyles` value. A game's own number format: `defineTextFormats({ "pill.number": value => ({ content, style }) })` under the feature's `textFormats` key, named by the `bind` of `defineGame` (`GameTypes.textFormats`): `bind(Counter, "value", { format: "pill.number" })`. It takes the whole value, is pure over value and language, is not called while the whole value and the locale stand, and owns `Text.style`; a `Countdown` calls it every frame. `app.text.formatted(name, value)` answers `{ text, style }`, `undefined` for an unknown or built-in name and for a format that threw. A saved module exporting formats reloads the page.
603
603
  - Animation is data: `defineAnimation(id, { slots: { name: type<Anim.Target>() }, build: (slots, { at }) => Step })`. Steps: `sequence(...)`, `parallel(...)`, `stagger(items, ms, item => Step)`, `tween(target, Component, to, { ms, ease?, delayMs?, additive?, space?, reduced? })`, `set(target, Component, patch)`, `wait(ms)`, `mark(name)`, `frames(target, { keys, fps, loop? })`, `sfx(key, { bus? })`, `haptic(kind)`, `use(animation, slots, tools?)`, `spawn` (a temporary entity, flying coins, that the timeline despawns when it ends; see the anim README). `Frames({ keys, fps, loop, playing })` is a component that walks a sprite through its textures for the entity's whole life. A target is `{ projection, key }` or an entity. A timeline resolves each `{ projection, key }` target once, when it starts: every step writes the view that held the key then, also after a commit removed it and while its exit plays, until it despawns; a view spawned again under the same key is not followed, and a key nothing held at the start is looked up at its step. `reduced: "keep"` (on a `tween` step, `transition` and `loop` of `defineMotion`, `TweenOptions`, `RestOptions`) plays a track as written under reduced motion, a fade for one; the default `"cut"` lands it at once or holds a loop on its first key. A node plays it with `await fx(play(animation, slots))`; in fast mode it finishes at once. `defineMotion({ states, transition?, on: { enter?, exit?, change? }, when? })` builds the enter, exit and change hooks for a projection or the `motion` prop of a tag; `when: "change"` plays enter and exit only for a commit, so an element that comes or goes with its screen stands at rest and leaves without a motion (default `"always"`). Events `anim:mark` `{ animation, mark }` and `anim:finished` `{ animation }`. `app.anim.replace(definition)` is the dev hot swap: the next `play` builds the new tree. A system cannot `require` a plugin, so it plays through the resource `AnimPlayer`: `res(AnimPlayer).play(animation, slots)` returns the same handle as `app.anim.play`, and the registered animation of `animation.id` wins, so a hot swap reaches the system. Play on a change, never every frame; from phase `input` the tree moves in `animate` of the same frame. Before `anim` starts it throws `[game] AnimPlayer is not ready: anim has not started.` Config `maxTracks: 2000`.
604
604
  - A `tween` step takes `segments` and `repeat` as `ViewHandle.tween` does: `tween(chest, Transform, { y: 0, scale: 0 }, { ms: 2400, additive: true, repeat: "forever", segments: [{ at: 0.08, ease: "out", to: { y: -14, scale: 0.06 } }, { at: 1, to: { y: 0, scale: 0 } }] })`. Segments walk over `ms` on one clock, `to` is where the last one ends, an additive walk names offsets; a number counts the extra runs. A definition error throws for empty segments, an `at` outside 0..1 or out of order, a last segment before 1, a bad repeat, and a `sequence` step after one that never ends. A forever step ends only by cancel or finish (a finish and a fast world land it on its start pose), does not play under reduced motion `"cut"`, writes nothing while its view is unseen, and lets the clock idle; a system plays it once through `AnimPlayer` and keeps the handle.
605
- - Audio is opt-in: `plugins: [...screen, audioPlugin]`. `fx(sfx("orders.complete"))` resolves when the sound started. `await fx(music("board.theme"))` cross-fades; `music(null)` fades out; a scene's `music` key switches the track on `scenes:changed`. Buses `master`, `music`, `sfx`. Volumes come from the committed player: config `volumes: player => (player as Player).settings.audio`, applied on every `model:committed`. `app.audio`: `setVolume(bus, value)`, `volume(bus)`, `mute(bus, on)`, `muted(bus)`, `unlocked()`, `journal()` (the last started sounds, empty unless config `journal` is above 0). Config: `buses: { master: 1, music: 0.6, sfx: 1 }`, `musicFadeMs: 600`, `volumes`, `context`, `journal: 0`, `music: "decode" | "stream"` default `"decode"` (gapless buffer; `"stream"` is an `<audio>` element, less memory, a gap at every loop), `session: "ambient" | "playback" | "auto"` default `"ambient"` (iOS only: ambient mixes with other apps and obeys the silent switch). The context is asked to run at start: where the shell lets audio play (a native webview with the gesture requirement off) `unlocked()` is true with no touch; a browser that wants a gesture unlocks on the first `pointerdown` or `touchend`. Without `audio` every `sfx` and `music` effect resolves `undefined` at once, so the same node runs in a game with no sound. Named sounds: `sfx(key, { bus?, id?, fadeMs? })` with an `id` plays through its own gain, and the next sound with the same `id` fades the old one out over `fadeMs`, else config `sfxFadeMs` (default `120`, real milliseconds); `fx.start(stopSfx(id, { fadeMs? }))` and `app.audio.stop(id, { fadeMs? })` fade it out and end it (`fadeMs: 0` cuts it); an `id` nothing plays under changes nothing, and a sound of that `id` still decoding never starts. Without `id` an `sfx` plays to its end as before.
605
+ - Audio is opt-in: `plugins: [...screen, audioPlugin]`. `fx(sfx("orders.complete"))` resolves when the sound started. `await fx(music("board.theme"))` cross-fades; `music(null)` fades out; a scene's `music` key switches the track on `scenes:changed`. Buses `master`, `music`, `sfx`. Volumes come from the committed player: config `volumes: player => (player as Player).settings.audio`, applied on every `model:committed`. `app.audio`: `setVolume(bus, value)`, `volume(bus)`, `mute(bus, on)`, `muted(bus)`, `unlocked()`, `journal()` (the last started sounds, empty unless config `journal` is above 0). Config: `buses: { master: 1, music: 0.6, sfx: 1 }`, `musicFadeMs: 600`, `volumes`, `context`, `journal: 0`, `music: "decode" | "stream"` default `"decode"` (gapless buffer; `"stream"` is an `<audio>` element, less memory, a gap at every loop), `session: "ambient" | "playback" | "auto"` default `"ambient"` (iOS only: ambient mixes with other apps and obeys the silent switch). The context is asked to run at start: where the shell lets audio play (a native webview with the gesture requirement off) `unlocked()` is true with no touch; a browser that wants a gesture unlocks on the first `pointerdown` or `touchend`. iOS: after a pause the touch unlock stays armed until the context really runs (WebKit holds `resume()` pending after a screenshot or Control Center); on a return from the background (WebKit with `navigator.audioSession`, a touch screen, `session` not `"playback"`) the plugin renews its context one second later or at the first touch: session `"auto"`, old context closed, `session` again, a new context from `config.context` (called again, so return a new context each call) at the same volumes, decoded buffers kept, the scene's music restarted, sounds in flight dropped. Without `audio` every `sfx` and `music` effect resolves `undefined` at once, so the same node runs in a game with no sound. Named sounds: `sfx(key, { bus?, id?, fadeMs? })` with an `id` plays through its own gain, and the next sound with the same `id` fades the old one out over `fadeMs`, else config `sfxFadeMs` (default `120`, real milliseconds); `fx.start(stopSfx(id, { fadeMs? }))` and `app.audio.stop(id, { fadeMs? })` fade it out and end it (`fadeMs: 0` cuts it); an `id` nothing plays under changes nothing, and a sound of that `id` still decoding never starts. Without `id` an `sfx` plays to its end as before.
606
606
  - `app.ui`: `tree()` the live screen as plain data (a text node carries `content`, the words it draws after `tr()` and `bind`; a text field carries `value`), `find(key)` the entity of a keyed element, `fill(key, value)` types into the text field with that `key`, `scroll(key, to)` puts the `scroll` with that `key` at `to` from its start at once, inside `0..max`, its fling or glide stopped (`false` and `ui:scroll-without-scroll` for no live `scroll`, `false` and `ui:scroll-before-solve` for a `scroll` its first solve has not placed yet), `rectOf(target)` where an `AnchorTarget` (or the shown ones of a list) is drawn, in screen reference units, the rect an `<anchor>` sits on, a target of no area shown at its point (`{ x, y, w: 0, h: 0 }`; an `<anchor>` on it stands there at size 0, takes no tap, its children lay out and hit as usual; an inward `pad` past half the target leaves it at size 0 on the centre), `undefined` when none is shown (an `image` whose style states a size, `width`/`height` or both edges of an absolute one, laid out at 0 draws nothing and counts as not shown; one whose style states no size keeps its alpha and draws as its `Sprite` says, ui never writing the size a game's system gives it), any build, a new object per call (`app.ui.rectOf({ projection: "board.strip", key: "seat0" })` → `{ x: 40, y: 1500, w: 116, h: 120 }`), `lint()` tap targets under `tapTargetPt` (default `44`), text that overflows in some locale, absolute elements without `reason`. Config: `tapTargetPt: 44`, `breakpoints: { tall: 2, wide: 1.5 }`. `ui` emits only the dev global event `ui:hot-swap`, see "Hot swap".
607
607
 
608
608
  ```tsx
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.95",
3
+ "version": "0.15.97",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [