@moku-labs/game 0.15.122 → 0.15.124

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.
@@ -1,7 +1,7 @@
1
- import { Bn as NodeTable, Ir as ClockSource, Jn as Hint, Mn as FeaturePlugin, Pn as AnyFlow, Rr as FakeClock, Wn as Descriptor, Wr as Json, Yn as NodeFx } from "./types-DuGiHe3k.mjs";
2
- import { t as createApp } from "./index-BhMPDwA9.mjs";
3
- import { b as memory, x as saveOf, y as WithGameState } from "./types-Lh8Ql5Lv.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-CwH40XSw.mjs";
1
+ import { Bn as NodeTable, Ir as ClockSource, Jn as Hint, Mn as FeaturePlugin, Pn as AnyFlow, Rr as FakeClock, Wn as Descriptor, Wr as Json, Yn as NodeFx } from "./types-CUQ-ig2E.mjs";
2
+ import { t as createApp } from "./index-DY9NpxeK.mjs";
3
+ import { b as memory, x as saveOf, y as WithGameState } from "./types-eIlzV3Jf.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-w-BqXOjQ.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 { dn as refuseStart, gn as type, pn as exit, t as createApp, w as flattenFeatures } from "./src-uuF4Ry3D.mjs";
1
+ import { dn as refuseStart, gn as type, pn as exit, t as createApp, w as flattenFeatures } from "./src-DAwGHTaM.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 { A as FilterSlotInputs, Ar as Api$3, M as SyncApi, Q as Api$4, Qn as AnchorTarget, Un as TypeTag, Ur as Events$3, Vr as Api$6, Wn as Descriptor, Wr as Json, ar as NumericFields, at as PixiSprite, b as Events$4, bi as Require, br as Entity, bt as FilterCache, cr as ReducedMotion, dr as TrackSegment, gr as ComponentHandle, hr as AnyComponentValue, ir as MotionHandle, it as PixiModule, j as FilterSlotQuad, k as FilterSlot, mn as Api$2, nt as PixiFilter, oi as Events$5, ot as PixiTexture, pr as AnyComponent, rt as PixiGpuProgram, s as Events$1, st as PixiUniformGroup, t as Api$5, tr as Ease, ui as Api$1, ur as TrackOptions, vr as ComponentType, vt as Point, yi as Events$2 } from "./types-DuGiHe3k.mjs";
2
- import { R as InputApi, T as TextApi, U as I18nApi, c as UiNode, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion, tt as StylesState } from "./types-Dpd8geJW.mjs";
1
+ import { A as FilterSlotInputs, Ar as Api$3, M as SyncApi, Q as Api$4, Qn as AnchorTarget, Un as TypeTag, Ur as Events$3, Vr as Api$6, Wn as Descriptor, Wr as Json, ar as NumericFields, at as PixiSprite, b as Events$4, bi as Require, br as Entity, bt as FilterCache, cr as ReducedMotion, dr as TrackSegment, gr as ComponentHandle, hr as AnyComponentValue, ir as MotionHandle, it as PixiModule, j as FilterSlotQuad, k as FilterSlot, mn as Api$2, nt as PixiFilter, oi as Events$5, ot as PixiTexture, pr as AnyComponent, rt as PixiGpuProgram, s as Events$1, st as PixiUniformGroup, t as Api$5, tr as Ease, ui as Api$1, ur as TrackOptions, vr as ComponentType, vt as Point, yi as Events$2 } from "./types-CUQ-ig2E.mjs";
2
+ import { R as InputApi, T as TextApi, U as I18nApi, c as UiNode, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion, tt as StylesState } from "./types-Cbtr2GAO.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
  import { PluginCtx } from "@moku-labs/core";
5
5
 
@@ -1,5 +1,5 @@
1
- import { $r as Snapshot, Wr as Json } from "./types-DuGiHe3k.mjs";
2
- import { t as HeadlessApp } from "./headless-CwH40XSw.mjs";
1
+ import { $r as Snapshot, Wr as Json } from "./types-CUQ-ig2E.mjs";
2
+ import { t as HeadlessApp } from "./headless-w-BqXOjQ.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
 
5
5
  //#region src/plugins/flow/doors/types.d.ts
@@ -8484,8 +8484,17 @@ type TrimListener = (reason: TrimReason, freedMb: number) => void;
8484
8484
  type PoolState = {
8485
8485
  /** Clock ms of the last drawn frame; `undefined` before the first. */lastDrawnAt: number | undefined; /** Clock ms of a scene change no trim has followed yet. */
8486
8486
  sceneAt: number | undefined; /** A trim ran (or was judged not worth it) since the last drawn frame: one per rest. */
8487
- restDone: boolean; /** Render-target bytes right after the last trim; 0 at start. Growth is measured from here. */
8487
+ restDone: boolean;
8488
+ /**
8489
+ * Render-target bytes right after the last trim, less the held targets released since; 0 at start. Growth is
8490
+ * measured from here.
8491
+ */
8488
8492
  baseline: number;
8493
+ /**
8494
+ * Idle targets a trim took out of Pixi's pool while a bind group still held them (F187): destroyed after the first
8495
+ * frame that ends with nothing bound to them, so Pixi never sees a bound texture destroyed.
8496
+ */
8497
+ held: PixiTexture[];
8489
8498
  };
8490
8499
  /**
8491
8500
  * The engine's own WebGPU adapter and device of an agent build, handed to Pixi as `webgpu.gpu`.
@@ -8510,7 +8519,9 @@ type HostState = {
8510
8519
  * Run after every successful restore, where `onReady` must not run twice: `rebuilt` is true when a new application
8511
8520
  * replaced the old one (WebGPU), false when a WebGL context came back on the same one.
8512
8521
  */
8513
- onRestore: Array<(rebuilt: boolean) => void>; /** Run before the lost application is destroyed, while its display objects are still alive. */
8522
+ onRestore: Array<(rebuilt: boolean) => void>; /** Asked at every loss whether the page leaves (F189): one that answers true stops the restore. */
8523
+ lossDeciders: Array<(info: LossInfo) => boolean>; /** True once a loss decided that the page reloads: nothing is restored any more. */
8524
+ leaving: boolean; /** Run before the lost application is destroyed, while its display objects are still alive. */
8514
8525
  onLoss: Array<() => void>;
8515
8526
  cleanups: Array<() => void>;
8516
8527
  unsupported: HTMLElement | undefined;
@@ -8675,6 +8686,15 @@ type TextureUsage = {
8675
8686
  targets: number; /** Bytes of the sources the engine keeps as pictures. */
8676
8687
  kept: number;
8677
8688
  };
8689
+ /**
8690
+ * What a `decideLoss` callback hears of a loss: the backend, what the browser said, and the bytes of every texture
8691
+ * source the lost application held (art, targets and kept pictures), measured before it went. Not public.
8692
+ */
8693
+ type LossInfo = {
8694
+ kind: "webgpu" | "webgl";
8695
+ reason: string;
8696
+ textureBytes: number;
8697
+ };
8678
8698
  /**
8679
8699
  * host methods injected into `viewport`, `sync` and `monitor`, and driven by the plugin root. Not
8680
8700
  * public.
@@ -8696,6 +8716,21 @@ type HostInternal = {
8696
8716
  * @param fn - Called after every successful restore, told whether the application is new.
8697
8717
  */
8698
8718
  onRestore(fn: (rebuilt: boolean) => void): void;
8719
+ /**
8720
+ * Subscribes to every loss of the device, after `renderer:device-lost` went out: the callback answers whether the
8721
+ * page leaves (it reloads), and then nothing is restored (F189).
8722
+ *
8723
+ * @param fn - Told what was lost and the texture bytes the lost application held; answers true when the page leaves.
8724
+ */
8725
+ decideLoss(fn: (info: LossInfo) => boolean): void;
8726
+ /**
8727
+ * Tells whether Pixi has a GPU texture for a source on the application that draws now: it uploaded the source, at a
8728
+ * draw or through `initSource`. Reads Pixi's per-renderer slot of the source; allocates nothing.
8729
+ *
8730
+ * @param source - The source.
8731
+ * @returns True when the source is on the GPU of the drawing renderer; false while nothing draws.
8732
+ */
8733
+ onGpu(source: PixiTextureSource): boolean;
8699
8734
  /**
8700
8735
  * Subscribes to the moment just before a lost application is destroyed. This is the last point
8701
8736
  * at which a display object the game owns can be saved out of the tree.
@@ -8882,8 +8917,9 @@ type HostInternal = {
8882
8917
  */
8883
8918
  sceneChanged(): void;
8884
8919
  /**
8885
- * Gives back every idle render target of Pixi's pool now, with Pixi's public `TexturePool.clear(true)`: a texture
8886
- * handed out and not returned survives and is destroyed when it comes back; a kept picture is never in the pool.
8920
+ * Gives back every idle render target of Pixi's pool now: one no shader binds is destroyed, one a bind group still
8921
+ * holds is destroyed after the first frame that lets it go (F187); a texture handed out and not returned survives
8922
+ * and is destroyed when it comes back; a kept picture is never in the pool.
8887
8923
  * The new baseline is what the targets hold after it. Never call it inside a Pixi render call.
8888
8924
  *
8889
8925
  * @param reason - Why: a rest, a scene change, a pause.
@@ -11658,7 +11694,8 @@ type TexturesApi = {
11658
11694
  provide(fn: TextureProvider): () => void;
11659
11695
  /**
11660
11696
  * Makes a Pixi texture from a decoded image, so `assets` never imports Pixi. Once uploaded it stays on the GPU until
11661
- * `destroy`: Pixi's collector leaves it alone.
11697
+ * `destroy`: Pixi's collector leaves it alone. The renderer owns an `ImageBitmap` from here on: it closes it once
11698
+ * Pixi has the texture on the GPU (F189), so the caller never uses it again; `destroy` closes one not uploaded yet.
11662
11699
  *
11663
11700
  * @param image - The decoded image.
11664
11701
  * @param options - `nine` is left, top, right and bottom in pixels; it becomes the texture's
@@ -12710,6 +12747,18 @@ type SyncInternal = {
12710
12747
  * @returns True when it uploaded a source in this frame: the frame is then no sample of the adaptive rate.
12711
12748
  */
12712
12749
  uploadStep(): boolean;
12750
+ /**
12751
+ * Frees the decoded images Pixi has on the GPU now (F189), after the stage pass of a drawn frame: each bitmap is
12752
+ * closed and its source gets the 1x1 stand-in. One compare and no allocation while nothing waits.
12753
+ */
12754
+ releaseStep(): void;
12755
+ /**
12756
+ * How many textures hold the stand-in instead of their decoded image: after a lost device they can only come back
12757
+ * with a page reload (F189).
12758
+ *
12759
+ * @returns The count of freed textures still alive.
12760
+ */
12761
+ freedCount(): number;
12713
12762
  /**
12714
12763
  * Subscribes to the end of a warm-up run: the queue became empty (the monitor of an agent build writes the `warm`
12715
12764
  * event line). Emptied by `stopSync`.
@@ -12881,6 +12930,17 @@ type UploadState = {
12881
12930
  done: WeakSet<PixiTextureSource>; /** The one listener on `unload` of every source in `done`. */
12882
12931
  forget(source: PixiTextureSource): void;
12883
12932
  };
12933
+ /**
12934
+ * The decoded images of `textures.create` (F189): a source made from an `ImageBitmap` waits in `pending` until Pixi
12935
+ * has it on the GPU of the drawing renderer; then its bitmap is closed and a 1x1 stand-in takes its place, so no
12936
+ * upload ever reads a closed bitmap (WebGPU throws on one). A freed source cannot be uploaded again: after a lost
12937
+ * device the page reloads. Not public.
12938
+ */
12939
+ type ReleaseState = {
12940
+ /** The sources whose bitmap is still open, in the order they were made. */pending: PixiTextureSource[]; /** The sources that hold the stand-in, until they are destroyed. */
12941
+ freed: Set<PixiTextureSource>; /** The transparent 1x1 image every freed source holds; made at the first release. */
12942
+ standIn: OffscreenCanvas | undefined;
12943
+ };
12884
12944
  /**
12885
12945
  * What a nine-slice view's object offers `sync`, whichever class draws it: Pixi's `NineSliceSprite`, or the engine's
12886
12946
  * rim-only mesh of a `hollow` one (`hollow.ts`). The six numbers rebuild the panel when written, the tint and the
@@ -13147,7 +13207,8 @@ type SyncState = {
13147
13207
  */
13148
13208
  viewlessEntries: boolean; /** The pipeline warm-up (F4). */
13149
13209
  warm: WarmState; /** The texture upload queue (F60). */
13150
- upload: UploadState; /** The class of the rim-only nine-slice (F59), made at the first hollow view over the loaded Pixi module. */
13210
+ upload: UploadState; /** The decoded images waiting to be freed, and how each freed texture is filled again (F189). */
13211
+ release: ReleaseState; /** The class of the rim-only nine-slice (F59), made at the first hollow view over the loaded Pixi module. */
13151
13212
  hollowClass: HollowClass | undefined;
13152
13213
  /**
13153
13214
  * The kind of each Pixi filter a slot named, for the performance log of an agent build; a
@@ -1,4 +1,4 @@
1
- import { $n as ChangeHook, Ar as Api$2, D as AxisPose, Fr as Api$5, Jn as Hint, Q as Api$3, Qn as AnchorTarget, Wn as Descriptor, Wr as Json, Y as TransformValue, Zn as Answered, ar as NumericFields, bi as Require, br as Entity, cr as ReducedMotion, fr as ViewHandle, hr as AnyComponentValue, ir as MotionHandle, it as PixiModule, kr as TagType, mn as Api$1, mr as AnyComponentType, nr as Motion, or as ProjectionMotion, pr as AnyComponent, rr as MotionCause, s as Events$1, t as Api$4, tr as Ease, tt as PixiContainer, ui as Api, vr as ComponentType, yt as ViewportSize } from "./types-DuGiHe3k.mjs";
1
+ import { $n as ChangeHook, Ar as Api$2, D as AxisPose, Fr as Api$5, Jn as Hint, Q as Api$3, Qn as AnchorTarget, Wn as Descriptor, Wr as Json, Y as TransformValue, Zn as Answered, ar as NumericFields, bi as Require, br as Entity, cr as ReducedMotion, fr as ViewHandle, hr as AnyComponentValue, ir as MotionHandle, it as PixiModule, kr as TagType, mn as Api$1, mr as AnyComponentType, nr as Motion, or as ProjectionMotion, pr as AnyComponent, rr as MotionCause, s as Events$1, t as Api$4, tr as Ease, tt as PixiContainer, ui as Api, vr as ComponentType, yt as ViewportSize } from "./types-CUQ-ig2E.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,7 +1,7 @@
1
- import { $ as Config$2, Hr as Config, Ir as ClockSource, Mn as FeaturePlugin, Pn as AnyFlow, Rr as FakeClock, Un as TypeTag, Wr as Json, Xr as ProviderCall, Yr as PlayerStateProvider, Zr as SaveDoc, _t as Orientation, a as Config$3, d as Manifest, ei as SnapshotOf, gn as Config$1, it as PixiModule, n as AssetsIo } from "./types-DuGiHe3k.mjs";
2
- import { o as AudioContextLike, s as Config$4 } from "./types-wsgkqOXF.mjs";
3
- import { J as StringTable, U as I18nApi, Y as TextKey } from "./types-Dpd8geJW.mjs";
4
- import { Et as PlatformProvider, It as audioPlugin, Nt as effectsPlugin, i as screen, t as createApp, wt as platformPlugin } from "./index-BhMPDwA9.mjs";
1
+ import { $ as Config$2, Hr as Config, Ir as ClockSource, Mn as FeaturePlugin, Pn as AnyFlow, Rr as FakeClock, Un as TypeTag, Wr as Json, Xr as ProviderCall, Yr as PlayerStateProvider, Zr as SaveDoc, _t as Orientation, a as Config$3, d as Manifest, ei as SnapshotOf, gn as Config$1, it as PixiModule, n as AssetsIo } from "./types-CUQ-ig2E.mjs";
2
+ import { o as AudioContextLike, s as Config$4 } from "./types-B2oay3bJ.mjs";
3
+ import { J as StringTable, U as I18nApi, Y as TextKey } from "./types-Cbtr2GAO.mjs";
4
+ import { Et as PlatformProvider, It as audioPlugin, Nt as effectsPlugin, i as screen, t as createApp, wt as platformPlugin } from "./index-DY9NpxeK.mjs";
5
5
  import { AnyPluginInstance } from "@moku-labs/core";
6
6
 
7
7
  //#region src/plugins/model/store/providers/memory.d.ts
@@ -1,9 +1,9 @@
1
- import { Ar as Api$1, Fr as Api$4, Q as Api, Vr as Api$2, ii as Api$3 } from "./types-DuGiHe3k.mjs";
2
- import { W as AnimApi, r as UiApi } from "./types-wsgkqOXF.mjs";
3
- import { R as InputApi } from "./types-Dpd8geJW.mjs";
4
- import { r as Repro } from "./headless-CwH40XSw.mjs";
5
- import { i as ControlApp, o as InputOf } from "./types-B3OYUVNR.mjs";
6
- import { t as commands } from "./commands-BMeGOWws.mjs";
1
+ import { Ar as Api$1, Fr as Api$4, Q as Api, Vr as Api$2, ii as Api$3 } from "./types-CUQ-ig2E.mjs";
2
+ import { W as AnimApi, r as UiApi } from "./types-B2oay3bJ.mjs";
3
+ import { R as InputApi } from "./types-Cbtr2GAO.mjs";
4
+ import { r as Repro } from "./headless-w-BqXOjQ.mjs";
5
+ import { i as ControlApp, o as InputOf } from "./types-BelqIB0P.mjs";
6
+ import { t as commands } from "./commands-CslgzXLW.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-BN0LF0W1.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-VvIFdrWq.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
@@ -1535,12 +1535,18 @@ function pageScript() {
1535
1535
  * `screen.webgl.webp`. The pixels are compared in the page (`page-script.ts`); the files are written by
1536
1536
  * `files.ts`. A failure of the page itself fails the leg; a failure of a step ends its test only.
1537
1537
  */
1538
- /** The Chrome flags of `.planning/e2e/run.mjs`: WebGPU on Metal, on any GPU. */
1539
- const WEBGPU_FLAGS = [
1538
+ /**
1539
+ * The Chrome flags of every launch: WebGPU on Metal, on any GPU, and no macOS keychain (F186): a
1540
+ * Chrome without the two last flags asks the keychain for "Chrome Safe Storage" and opens a
1541
+ * dialog over the screen on every pixel run.
1542
+ */
1543
+ const CHROME_FLAGS = [
1540
1544
  "--enable-unsafe-webgpu",
1541
1545
  "--use-angle=metal",
1542
1546
  "--enable-gpu",
1543
- "--ignore-gpu-blocklist"
1547
+ "--ignore-gpu-blocklist",
1548
+ "--use-mock-keychain",
1549
+ "--password-store=basic"
1544
1550
  ];
1545
1551
  /** The page width in CSS px when the setup names none: a phone. */
1546
1552
  const DEFAULT_WIDTH = 390;
@@ -1644,7 +1650,7 @@ async function attempt(chromium, options) {
1644
1650
  }
1645
1651
  }
1646
1652
  /**
1647
- * Launches Chrome with the four WebGPU flags: the Chrome of `page.browser` when the setup names
1653
+ * Launches Chrome with the WebGPU flags and without the macOS keychain: the Chrome of `page.browser` when the setup names
1648
1654
  * one, else Playwright's own Chromium, else the system Chrome. Playwright's Chromium comes first
1649
1655
  * because its version is pinned by `playwright-core`, so the baselines do not move with a Chrome
1650
1656
  * update.
@@ -1655,7 +1661,7 @@ async function attempt(chromium, options) {
1655
1661
  * @throws {Error} When the named Chrome, or every default one, does not launch.
1656
1662
  */
1657
1663
  async function launchChrome(chromium, browser) {
1658
- const args = [...WEBGPU_FLAGS];
1664
+ const args = [...CHROME_FLAGS];
1659
1665
  if (browser !== void 0) {
1660
1666
  const given = await attempt(chromium, {
1661
1667
  ...browser,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.122",
3
+ "version": "0.15.124",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [