@moku-labs/game 0.15.161 → 0.15.163

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-CLhKYlot.d.mts → commands-CAvCuLaL.d.mts} +5 -5
  8. package/dist/control.d.mts +4 -4
  9. package/dist/{define-3zxu6rIq.d.mts → define-DSOTwTUY.d.mts} +2 -2
  10. package/dist/{headless-DFkrIVO4.d.mts → headless-PANjNy6-.d.mts} +1 -1
  11. package/dist/{index-CVmEBBm5.d.mts → index-oS9wiCoO.d.mts} +12 -12
  12. package/dist/index.d.mts +4 -4
  13. package/dist/index.mjs +1 -1
  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-CI8p6sVn.d.mts → runtime-Bb5sNTGb.d.mts} +1 -1
  19. package/dist/{sources-D9Fk3Z4d.mjs → sources-DRP-bS6e.mjs} +2 -1
  20. package/dist/{src-qeTzNTZA.mjs → src-DBhsppmi.mjs} +1075 -308
  21. package/dist/testing.d.mts +4 -4
  22. package/dist/testing.mjs +1 -1
  23. package/dist/{types-CM7Ng3EN.d.mts → types-BuN6rLDs.d.mts} +2 -2
  24. package/dist/{types-Bl9jyah_.d.mts → types-C4d1Ptfc.d.mts} +1881 -39
  25. package/dist/{types-D1xdKk_t.d.mts → types-DTkhpupa.d.mts} +91 -22
  26. package/dist/{types-DHWjH6p9.d.mts → types-SUCTOeQZ.d.mts} +4 -4
  27. package/dist/types-dSup2_q9.d.mts +1841 -0
  28. package/dist/{visual-D_4mmn1u.d.mts → visual-BZrQT1r1.d.mts} +5 -6
  29. package/dist/visual.d.mts +1 -1
  30. package/dist/visual.mjs +1 -1
  31. package/llms.txt +1 -1
  32. package/package.json +3 -3
  33. package/dist/types-D-vnlN3n.d.mts +0 -3632
@@ -8134,12 +8134,23 @@ type PerfSampleLine = PerfLine<"sample"> & {
8134
8134
  blockingMs: number | null;
8135
8135
  } | null;
8136
8136
  heapMb: number | null;
8137
+ /**
8138
+ * The GPU textures of the moment, MiB: the five kinds of `stats().textureMbSplit` add up to `mb`, `idle` is the share
8139
+ * of the targets and the kept pictures waiting in a pool (F236). The engine always writes `text`, `other` and `idle`;
8140
+ * optional for a reader of an older log.
8141
+ */
8137
8142
  textures: {
8138
8143
  count: number;
8139
8144
  mb: number;
8140
8145
  art: number;
8146
+ text?: number;
8141
8147
  targets: number;
8142
8148
  kept: number;
8149
+ other?: number;
8150
+ idle?: {
8151
+ targets: number;
8152
+ kept: number;
8153
+ };
8143
8154
  }; /** Kept pictures: the most drawn in a frame, their MiB, the takes and the stage-3 refreshes of the second. */
8144
8155
  kept: {
8145
8156
  pictures: number;
@@ -8618,6 +8629,11 @@ type OwnGpu = {
8618
8629
  adapter: GPUAdapter;
8619
8630
  device: GPUDevice;
8620
8631
  };
8632
+ /**
8633
+ * What `sync` made a texture source for: the art a game loaded through `assets`, or the page of a bitmap font. Not
8634
+ * public.
8635
+ */
8636
+ type SourceKind = "art" | "text";
8621
8637
  /**
8622
8638
  * host module state.
8623
8639
  */
@@ -8671,7 +8687,9 @@ type HostState = {
8671
8687
  resolution: ResolutionState; /** Run after a frame applied a new resolution; emptied by `stopHost`. */
8672
8688
  onResolutionChange: ResolutionListener[]; /** The engine's own adapter and device of an agent build on WebGPU; `undefined` otherwise. */
8673
8689
  ownGpu: OwnGpu | undefined; /** Texture sources the engine keeps as pictures (F12, C14): `textures()` counts them apart. */
8674
- kept: WeakSet<object>; /** A pixel read of the oracle failed and was logged: the next failures stay quiet. */
8690
+ kept: WeakSet<object>; /** What `sync` made a texture source for (F236): a game's art, or a font page. `textures()` splits by it. */
8691
+ marks: WeakMap<object, SourceKind>; /** The kept sources waiting in the kept pool (F119, F236): `textures()` counts them as idle too. */
8692
+ idle: WeakSet<object>; /** A pixel read of the oracle failed and was logged: the next failures stay quiet. */
8675
8693
  pixelsFailed: boolean; /** The pool trim of C14. */
8676
8694
  pool: PoolState; /** The trim listeners: the monitor's, in an agent build. Emptied by `stopHost`. */
8677
8695
  onTrim: TrimListener[]; /** The listener of the canvas passes that really begin: the monitor's, set at every attach; cleared by `stopHost`. */
@@ -8786,24 +8804,34 @@ type HostApi = {
8786
8804
  resolution(): number;
8787
8805
  };
8788
8806
  /**
8789
- * The textures the GPU holds: how many sources, their estimated bytes, and the bytes split into
8790
- * art, render targets and kept pictures.
8807
+ * The textures the GPU holds: how many sources, their estimated bytes, and the bytes split into five kinds that add up
8808
+ * to `bytes` (art, font pages, render targets, kept pictures, everything else), with the idle share of the targets and
8809
+ * of the kept pictures.
8791
8810
  *
8792
8811
  * @example
8793
8812
  * ```ts
8794
- * const usage: TextureUsage = { count: 2, bytes: 5_242_880, art: 4_194_304, targets: 1_048_576, kept: 0 };
8813
+ * // One 1024 x 1024 image a game loaded and one 512 x 512 filter target waiting in Pixi's pool.
8814
+ * const usage: TextureUsage = {
8815
+ * count: 2, bytes: 5_242_880, art: 4_194_304, text: 0, targets: 1_048_576, kept: 0, other: 0,
8816
+ * idleTargets: 1_048_576, idleKept: 0
8817
+ * };
8795
8818
  * ```
8796
8819
  */
8797
8820
  type TextureUsage = {
8798
- count: number;
8799
- bytes: number; /** Bytes of the sources a game loaded: images, atlases. */
8800
- art: number; /** Bytes of the render targets: filter textures, pictures Pixi renders into. */
8821
+ /** Live texture sources. */count: number; /** Their estimated bytes: the sum of the five kinds below. */
8822
+ bytes: number; /** Bytes of the sources a game loaded through `sync.textures.create`: images, atlases; font pages not. */
8823
+ art: number; /** Bytes of the font pages installed through `sync.fonts.install`. */
8824
+ text: number; /** Bytes of the render targets: filter textures, pictures Pixi renders into. */
8801
8825
  targets: number; /** Bytes of the sources the engine keeps as pictures. */
8802
- kept: number;
8826
+ kept: number; /** Bytes of every other live source: what Pixi made itself, a gradient, its own white texture. */
8827
+ other: number; /** Of `targets`: the idle textures of Pixi's pool and the targets the trim holds. Filled by `host.textures()`. */
8828
+ idleTargets: number; /** Of `kept`: the kept pictures waiting in the kept pool. */
8829
+ idleKept: number;
8803
8830
  };
8804
8831
  /**
8805
8832
  * What a `decideLoss` callback hears of a loss: the backend, what the browser said, and the bytes of every texture
8806
- * source the lost application held (art, targets and kept pictures), measured before it went. Not public.
8833
+ * source the lost application held (every kind: art, font pages, targets, kept pictures and the rest), measured before
8834
+ * it went. Not public.
8807
8835
  */
8808
8836
  type LossInfo = {
8809
8837
  kind: "webgpu" | "webgl";
@@ -8974,6 +9002,21 @@ type HostInternal = {
8974
9002
  * @param on - True to count it as kept.
8975
9003
  */
8976
9004
  keep(source: object, on: boolean): void;
9005
+ /**
9006
+ * Marks what a texture source was made for, so `textures()` counts it as art or as text. A later mark replaces an
9007
+ * earlier one: a font page made as art becomes text.
9008
+ *
9009
+ * @param source - The source.
9010
+ * @param kind - `"art"` for an image `sync` made, `"text"` for a font page.
9011
+ */
9012
+ mark(source: object, kind: SourceKind): void;
9013
+ /**
9014
+ * Counts a kept picture's source as idle in `textures()`, waiting in the kept pool, or no longer.
9015
+ *
9016
+ * @param source - The source.
9017
+ * @param on - True while it waits in the pool.
9018
+ */
9019
+ idle(source: object, on: boolean): void;
8977
9020
  /**
8978
9021
  * Draws the stage into a PNG over the whole canvas. Every container in `hidden` is set
8979
9022
  * `visible = false` around the synchronous render inside Pixi's extract and set back right after
@@ -8984,8 +9027,11 @@ type HostInternal = {
8984
9027
  */
8985
9028
  extract(hidden: readonly PixiContainer[]): Promise<string | undefined>;
8986
9029
  /**
8987
- * The texture sources the GPU holds and their estimated memory, read at call time, split into
8988
- * art, render targets and kept pictures.
9030
+ * The texture sources the GPU holds and their estimated memory, read at call time, split into art, font pages,
9031
+ * render targets, kept pictures and the rest, with the idle targets and kept pictures. Allocates nothing while the
9032
+ * application draws: the answer is one module-level object shared by every renderer of the page, written over by
9033
+ * the next call and also by the pool trim (`afterFrame`/`trimPool` in `host/pool.ts`) and a device loss
9034
+ * (`host/device.ts`), so a caller reads the numbers at once. While inert it answers a fresh zero object.
8989
9035
  *
8990
9036
  * @returns The usage; zero while nothing draws.
8991
9037
  */
@@ -9584,7 +9630,10 @@ type ViewportInternal = {
9584
9630
  * // The board of Timber Town in a dev build: one glowing button on screen, kept as a picture at rest.
9585
9631
  * const stats: RenderStats = {
9586
9632
  * fps: 60, drawn: 60, frameMs: 3.4, textures: 12, textureMb: 41.25,
9587
- * textureMbSplit: { art: 30.1, targets: 9.75, kept: 1.4 }, views: 180, pooled: 24,
9633
+ * textureMbSplit: {
9634
+ * art: 28.1, text: 2, targets: 9.75, kept: 1.4, other: 0, idle: { targets: 4, kept: 0 }
9635
+ * },
9636
+ * views: 180, pooled: 24,
9588
9637
  * renderPasses: 1, renderPassesMax: 3, canvasPasses: 1, canvasPassesMax: 2,
9589
9638
  * kept: { pictures: 1, mb: 1.4, retakes: 0, evicted: 0, refused: 0 }, drawCalls: 14
9590
9639
  * };
@@ -9615,13 +9664,24 @@ type RenderStats = {
9615
9664
  textures: number; /** Estimated GPU memory of those sources in MiB: 4 bytes per pixel, every mip level. */
9616
9665
  textureMb: number;
9617
9666
  /**
9618
- * The same memory split into the art a game loaded, the render targets Pixi draws into and the
9619
- * pictures the engine keeps, MiB with 2 decimals; all 0 while inert.
9667
+ * The same memory split five ways, MiB with 2 decimals; all 0 while inert. `art`: the sources made through
9668
+ * `sync.textures.create` (the bundles of `assets`), font pages left out. `text`: the font pages installed through
9669
+ * `sync.fonts.install`. `targets`: the render targets Pixi draws into (filters, effects, transitions). `kept`: the
9670
+ * pictures the engine keeps. `other`: every other live source, what Pixi made itself (gradients, its white texture).
9671
+ * A source counts once, the first that fits of kept, target, text, art, other, so the five add up to `textureMb` up
9672
+ * to the rounding. `idle` holds the share of `targets` and of `kept` that waits in a pool for reuse: the idle
9673
+ * textures of Pixi's `TexturePool` with the targets the trim holds, and the kept pool of pictures whose views left.
9620
9674
  */
9621
9675
  textureMbSplit: {
9622
9676
  art: number;
9677
+ text: number;
9623
9678
  targets: number;
9624
9679
  kept: number;
9680
+ other: number;
9681
+ idle: {
9682
+ targets: number;
9683
+ kept: number;
9684
+ };
9625
9685
  }; /** Display objects `sync` holds for entities. */
9626
9686
  views: number; /** Display objects waiting in the pools. */
9627
9687
  pooled: number;
@@ -10056,7 +10116,7 @@ type MonitorState = {
10056
10116
  * @example
10057
10117
  * ```ts
10058
10118
  * // A headless test: nothing is drawn, so every counter is 0 and there is no picture.
10059
- * app.renderer.stats(); // { fps: 0, drawn: 0, frameMs: 0, textures: 0, textureMb: 0, textureMbSplit: { art: 0, targets: 0, kept: 0 }, views: 0, pooled: 0, renderPasses: 0, renderPassesMax: 0, canvasPasses: 0, canvasPassesMax: 0, kept: { pictures: 0, mb: 0, retakes: 0, evicted: 0, refused: 0 } }
10119
+ * app.renderer.stats(); // { fps: 0, drawn: 0, frameMs: 0, textures: 0, textureMb: 0, textureMbSplit: { art: 0, text: 0, targets: 0, kept: 0, other: 0, idle: { targets: 0, kept: 0 } }, views: 0, pooled: 0, renderPasses: 0, renderPassesMax: 0, canvasPasses: 0, canvasPassesMax: 0, kept: { pictures: 0, mb: 0, retakes: 0, evicted: 0, refused: 0 } }
10060
10120
  * await app.renderer.capture(); // undefined
10061
10121
  * ```
10062
10122
  */
@@ -10068,14 +10128,15 @@ type MonitorApi = {
10068
10128
  * (the estimate of the filter slots where nothing counts). `drawCalls`, `redraws` and `rebuilds` are there in a dev
10069
10129
  * build only.
10070
10130
  *
10071
- * @returns Frames per second, frame work, GPU textures and their memory, views, pooled objects,
10131
+ * @returns Frames per second, frame work, GPU textures and their memory, split into art, text, targets, kept and other with the idle share of targets
10132
+ * and kept, views, pooled objects,
10072
10133
  * render passes and canvas passes with their most in the last second, the kept pictures, and in a dev build the
10073
10134
  * draw calls of the last frame and the Graphics redraws and Pixi rebuilds per second. Inert: all 0.
10074
10135
  * @example
10075
10136
  * ```ts
10076
10137
  * // The editor's stats panel reads it every frame. Here the game drew one sprite for 51 frames,
10077
10138
  * // 20 ms apart with 4 ms of work each, and its texture is not uploaded yet.
10078
- * app.renderer.stats(); // { fps: 50, drawn: 50, frameMs: 4, textures: 0, textureMb: 0, textureMbSplit: { art: 0, targets: 0, kept: 0 }, views: 1, pooled: 0, renderPasses: 1, renderPassesMax: 1, canvasPasses: 1, canvasPassesMax: 1, kept: { pictures: 0, mb: 0, retakes: 0, evicted: 0, refused: 0 } }
10139
+ * app.renderer.stats(); // { fps: 50, drawn: 50, frameMs: 4, textures: 0, textureMb: 0, textureMbSplit: { art: 0, text: 0, targets: 0, kept: 0, other: 0, idle: { targets: 0, kept: 0 } }, views: 1, pooled: 0, renderPasses: 1, renderPassesMax: 1, canvasPasses: 1, canvasPassesMax: 1, kept: { pictures: 0, mb: 0, retakes: 0, evicted: 0, refused: 0 } }
10079
10140
  * // The same frame in a dev build also counts the one sprite batch, and the one instruction build of the first
10080
10141
  * // frame: { ..., drawCalls: 1, redraws: 0, rebuilds: 1 }
10081
10142
  * app.renderer.stats(); // { fps: 120, drawn: 0, … }: a still board with onDemand
@@ -15126,16 +15187,22 @@ type BundleUsage = {
15126
15187
  lastUsed: number;
15127
15188
  };
15128
15189
  /**
15129
- * What `usage()` reports: the numbers a dev overlay and the tests read.
15190
+ * What `usage()` reports: the numbers a dev overlay and the tests read. `textureMb` is the cost of the loaded bundles
15191
+ * by the manifest (each bundle's `mb`), counted from the load on, drawn or not; the budget evicts by it. It is not GPU
15192
+ * memory: `renderer.stats().textureMb` is.
15130
15193
  *
15131
15194
  * @example
15132
15195
  * ```ts
15133
- * const report: Usage = { textureMb: 3.5, budgetMb: 192, bundles: [] };
15196
+ * const report: Usage = {
15197
+ * textureMb: 3.5,
15198
+ * budgetMb: 192,
15199
+ * bundles: [{ name: "board", tier: "scene", mb: 3.5, lastUsed: 12 }]
15200
+ * };
15134
15201
  * ```
15135
15202
  */
15136
15203
  type Usage = {
15137
- textureMb: number;
15138
- budgetMb: number;
15204
+ /** The manifest megabytes of the loaded bundles, from load on, drawn or not: what the budget evicts by. */textureMb: number; /** `textureBudgetMb` of the config. */
15205
+ budgetMb: number; /** One entry per loaded bundle, sorted by name. */
15139
15206
  bundles: readonly BundleUsage[];
15140
15207
  };
15141
15208
  /**
@@ -15338,7 +15405,9 @@ type Api = {
15338
15405
  */
15339
15406
  audio(key: string): AudioAsset | undefined;
15340
15407
  /**
15341
- * What the loaded bundles cost, sorted by name. `lastUsed` is the use counter, not a clock.
15408
+ * What the loaded bundles cost, sorted by name. `lastUsed` is the use counter, not a clock. `textureMb` is the
15409
+ * manifest cost of the loaded bundles, counted from the load on, drawn or not, and the budget evicts by it; it is not
15410
+ * GPU memory, which `renderer.stats().textureMb` gives.
15342
15411
  *
15343
15412
  * @returns The used and allowed megabytes and one entry per loaded bundle.
15344
15413
  * @example
@@ -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-D1xdKk_t.mjs";
2
- import { o as AudioContextLike, s as Config$4 } from "./types-D-vnlN3n.mjs";
3
- import { J as StringTable, U as I18nApi, Y as TextKey } from "./types-Bl9jyah_.mjs";
4
- import { Rt as effectsPlugin, Vt as audioPlugin, i as screen, jt as PlatformProvider, kt as platformPlugin, t as createApp } from "./index-CVmEBBm5.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-DTkhpupa.mjs";
2
+ import { H as I18nApi, J as TextKey, q as StringTable } from "./types-C4d1Ptfc.mjs";
3
+ import { n as AudioContextLike, r as Config$4 } from "./types-dSup2_q9.mjs";
4
+ import { Rt as effectsPlugin, Vt as audioPlugin, i as screen, jt as PlatformProvider, kt as platformPlugin, t as createApp } from "./index-oS9wiCoO.mjs";
5
5
  import { AnyPluginInstance } from "@moku-labs/core";
6
6
 
7
7
  //#region src/plugins/model/store/providers/memory.d.ts