@moku-labs/game 0.15.88 → 0.15.90

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 { An as AnyFlow, Bn as Descriptor, Gn as NodeFx, In as NodeTable, Nr as FakeClock, On as FeaturePlugin, Wn as Hint, jr as ClockSource, zr as Json } from "./types-w5_A5TPL.mjs";
2
- import { t as createApp } from "./index-nK7iVsWx.mjs";
3
- import { b as memory, x as saveOf, y as WithGameState } from "./types-BlXL-VC3.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-CtRq6Uij.mjs";
1
+ import { An as FeaturePlugin, Fr as FakeClock, Hn as Descriptor, Kn as Hint, Mn as AnyFlow, Nr as ClockSource, Rn as NodeTable, Vr as Json, qn as NodeFx } from "./types-D1lRinVJ.mjs";
2
+ import { t as createApp } from "./index-vPc22SoP.mjs";
3
+ import { b as memory, x as saveOf, y as WithGameState } from "./types-B2Dh7oWu.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-Dasz6dgy.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-BTPWdbHH.mjs";
1
+ import { m as flattenFeatures, on as type, rn as exit, t as createApp, tn as refuseStart } from "./src-D2-mFvog.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,7 +1,7 @@
1
- import { An as AnyFlow, Gr as ProviderCall, Kr as SaveDoc, Lr as Config, Nr as FakeClock, On as FeaturePlugin, Q as Config$2, Wr as PlayerStateProvider, Yr as SnapshotOf, a as Config$3, d as Manifest, fn as Config$1, jr as ClockSource, n as AssetsIo, nt as PixiModule, pt as Orientation, zn as TypeTag, zr as Json } from "./types-w5_A5TPL.mjs";
2
- import { o as AudioContextLike, s as Config$4 } from "./types-CJYudpme.mjs";
3
- import { H as I18nApi, J as TextKey, q as StringTable } from "./types-BbLjYfGR.mjs";
4
- import { St as effectsPlugin, Tt as audioPlugin, ht as PlatformProvider, i as screen, pt as platformPlugin, t as createApp } from "./index-nK7iVsWx.mjs";
1
+ import { An as FeaturePlugin, Fr as FakeClock, Jr as SaveDoc, Kr as PlayerStateProvider, Mn as AnyFlow, Nr as ClockSource, Q as Config$2, Vn as TypeTag, Vr as Json, Zr as SnapshotOf, a as Config$3, d as Manifest, ht as Orientation, mn as Config$1, n as AssetsIo, nt as PixiModule, qr as ProviderCall, zr as Config } from "./types-D1lRinVJ.mjs";
2
+ import { o as AudioContextLike, s as Config$4 } from "./types-Cc7uKiHX.mjs";
3
+ import { H as I18nApi, J as TextKey, q as StringTable } from "./types-BMUuyOcm.mjs";
4
+ import { St as effectsPlugin, Tt as audioPlugin, ht as PlatformProvider, i as screen, pt as platformPlugin, t as createApp } from "./index-vPc22SoP.mjs";
5
5
  import { AnyPluginInstance } from "@moku-labs/core";
6
6
 
7
7
  //#region src/plugins/model/store/providers/memory.d.ts
@@ -1,4 +1,4 @@
1
- import { $n as MotionHandle, Ar as Api$5, Bn as Descriptor, J as TransformValue, Jn as ChangeHook, Kn as Answer, Qn as MotionCause, Tr as Api$2, Wn as Hint, Xn as Ease, Z as Api$3, Zn as Motion, ai as Api, cr as AnyComponent, er as NumericFields, hi as Require, hr as Entity, ht as ViewportSize, lr as AnyComponentType, pr as ComponentType, qn as AnchorTarget, rr as ReducedMotion, s as Events$1, sr as ViewHandle, t as Api$4, tr as ProjectionMotion, un as Api$1, ur as AnyComponentValue, wr as TagType, zr as Json } from "./types-w5_A5TPL.mjs";
1
+ import { $n as Motion, Dr as Api$2, Er as TagType, Hn as Descriptor, J as TransformValue, Jn as Answer, Kn as Hint, Mr as Api$5, Qn as Ease, Vr as Json, Xn as ChangeHook, Yn as AnchorTarget, Z as Api$3, _i as Require, _r as Entity, _t as ViewportSize, ar as ReducedMotion, dr as AnyComponentType, er as MotionCause, fn as Api$1, fr as AnyComponentValue, hr as ComponentType, lr as ViewHandle, nr as NumericFields, rr as ProjectionMotion, s as Events$1, si as Api, t as Api$4, tr as MotionHandle, ur as AnyComponent } from "./types-D1lRinVJ.mjs";
2
2
  import { Log } from "@moku-labs/common/browser";
3
3
  import { PluginCtx } from "@moku-labs/core";
4
4
  import { Node, Yoga } from "yoga-layout/load";
@@ -1,5 +1,5 @@
1
- import { Jr as Snapshot, zr as Json } from "./types-w5_A5TPL.mjs";
2
- import { t as HeadlessApp } from "./headless-CtRq6Uij.mjs";
1
+ import { Vr as Json, Xr as Snapshot } from "./types-D1lRinVJ.mjs";
2
+ import { t as HeadlessApp } from "./headless-Dasz6dgy.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
 
5
5
  //#region src/plugins/flow/doors/types.d.ts
@@ -1,5 +1,5 @@
1
- import { $n as MotionHandle, A as FilterSlotQuad, Bn as Descriptor, Ir as Api$6, O as FilterSlot, Rr as Events$3, Tr as Api$3, Xn as Ease, Z as Api$4, ai as Api$1, ar as TrackOptions, at as PixiUniformGroup, b as Events$4, cr as AnyComponent, dr as ComponentHandle, er as NumericFields, et as PixiFilter, gt as FilterCache, hi as Require, hr as Entity, it as PixiTexture, j as SyncApi, k as FilterSlotInputs, mi as Events$2, mt as Point, nt as PixiModule, or as TrackSegment, pr as ComponentType, qn as AnchorTarget, rr as ReducedMotion, rt as PixiSprite, s as Events$1, t as Api$5, ti as Events$5, tt as PixiGpuProgram, un as Api$2, ur as AnyComponentValue, zn as TypeTag, zr as Json } from "./types-w5_A5TPL.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-BbLjYfGR.mjs";
1
+ import { A as FilterSlotQuad, Br as Events$3, Dr as Api$3, Hn as Descriptor, O as FilterSlot, Qn as Ease, Rr as Api$6, Vn as TypeTag, Vr as Json, Yn as AnchorTarget, Z as Api$4, _i as Require, _r as Entity, ar as ReducedMotion, at as PixiUniformGroup, b as Events$4, cr as TrackSegment, et as PixiFilter, fn as Api$2, fr as AnyComponentValue, gi as Events$2, gt as Point, hr as ComponentType, it as PixiTexture, j as SyncApi, k as FilterSlotInputs, nr as NumericFields, nt as PixiModule, pr as ComponentHandle, ri as Events$5, rt as PixiSprite, s as Events$1, si as Api$1, sr as TrackOptions, t as Api$5, tr as MotionHandle, tt as PixiGpuProgram, ur as AnyComponent, vt as FilterCache } from "./types-D1lRinVJ.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-BMUuyOcm.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
  import { PluginCtx } from "@moku-labs/core";
5
5
 
@@ -8625,6 +8625,20 @@ type HostInternal = {
8625
8625
  * @param source - The source of a texture `assets` loaded.
8626
8626
  */
8627
8627
  initSource(source: PixiTextureSource): void;
8628
+ /**
8629
+ * The texture of the canvas for this frame, read to be sampled: after `render` returned it holds the frame just
8630
+ * drawn, and it is gone when the task ends. Pixi configures the canvas with `TEXTURE_BINDING` and `COPY_SRC`.
8631
+ *
8632
+ * @returns The texture, or `undefined` while nothing draws and on WebGL.
8633
+ */
8634
+ canvasTexture(): GPUTexture | undefined;
8635
+ /**
8636
+ * The GPU texture Pixi holds for a source, made now when it has none.
8637
+ *
8638
+ * @param source - The source.
8639
+ * @returns The texture, or `undefined` while nothing draws and on WebGL.
8640
+ */
8641
+ gpuTexture(source: PixiTextureSource): GPUTexture | undefined;
8628
8642
  /**
8629
8643
  * Tells whether the stage pass clears the canvas before it draws (`renderer.background.clearBeforeRender`, Pixi's
8630
8644
  * default, which the engine never turns off): only then may a probe draw onto the canvas.
@@ -10149,8 +10163,145 @@ type PictureRequest = {
10149
10163
  resolve: (shot?: Shot) => void; /** Hands over why the shot cannot come. */
10150
10164
  reject: (error: Error) => void;
10151
10165
  };
10166
+ //#endregion
10167
+ //#region src/plugins/renderer/shots/types.d.ts
10168
+ /**
10169
+ * The shots of a game: small soft pictures of what stood on the screen, kept under asset keys. `undefined` by default,
10170
+ * and a game without it pays nothing: no pipeline is made and `take` does nothing. WebGPU only.
10171
+ *
10172
+ * @example
10173
+ * ```ts
10174
+ * // A loader that shows the place the player left, blurred, behind a ring.
10175
+ * const shots: ShotsConfig = { width: 96, height: 208, blur: 22 };
10176
+ * createApp({ pluginConfigs: { renderer: { mount: "#game", shots } } });
10177
+ * ```
10178
+ */
10179
+ type ShotsConfig = {
10180
+ /**
10181
+ * Texels across a shot, a whole number from 1 to 512. Anything else throws at `createApp`.
10182
+ *
10183
+ * @example
10184
+ * ```ts
10185
+ * // A soft backdrop needs few texels: a 96 x 208 shot holds 78 KiB on any screen.
10186
+ * createApp({ pluginConfigs: { renderer: { mount: "#game", shots: { width: 96, height: 208, blur: 22 } } } });
10187
+ * ```
10188
+ */
10189
+ width: number;
10190
+ /**
10191
+ * Texels down a shot, a whole number from 1 to 512. Anything else throws at `createApp`.
10192
+ *
10193
+ * @example
10194
+ * ```ts
10195
+ * // A landscape game keeps the shape of its frame: 208 x 96 for a 2340 x 1080 canvas.
10196
+ * createApp({ pluginConfigs: { renderer: { mount: "#game", shots: { width: 208, height: 96, blur: 22 } } } });
10197
+ * ```
10198
+ */
10199
+ height: number;
10200
+ /**
10201
+ * Sigma of the Gaussian in reference units of the frame's width, finite, 0 or more; 0 is no blur. It is the same
10202
+ * softness on every screen: each take converts it to `blur * width / viewport.size().width` texels, 10 at most.
10203
+ *
10204
+ * @example
10205
+ * ```ts
10206
+ * // On a 1080 u frame, 22 u is 1.96 texels of a 96 texel shot.
10207
+ * createApp({ pluginConfigs: { renderer: { mount: "#game", shots: { width: 96, height: 208, blur: 22 } } } });
10208
+ * // Only the reduction, no Gaussian: two passes fewer in a take.
10209
+ * createApp({ pluginConfigs: { renderer: { mount: "#game", shots: { width: 96, height: 208, blur: 0 } } } });
10210
+ * ```
10211
+ */
10212
+ blur: number;
10213
+ /**
10214
+ * Shots kept, a whole number of at least 1; 8 by default. At the limit a new key takes the texture of the oldest
10215
+ * taken, whose key stops answering: `has` says false, and a view that showed it draws the placeholder.
10216
+ *
10217
+ * @example
10218
+ * ```ts
10219
+ * // Two rooms in memory are enough for this game.
10220
+ * const shots: ShotsConfig = { width: 96, height: 208, blur: 22, keep: 2 };
10221
+ * app.renderer.shots.take("shot.hall"); // one drawn frame later, then the same for "shot.yard" and "shot.roof"
10222
+ * app.renderer.shots.has("shot.hall"); // false: the oldest went
10223
+ * app.renderer.shots.has("shot.roof"); // true
10224
+ * ```
10225
+ */
10226
+ keep?: number;
10227
+ };
10228
+ /**
10229
+ * The GPU objects of one device: the pipelines of the two filters and their one sampler. Not public.
10230
+ */
10231
+ type ShotPipes = {
10232
+ /** The box filter of a hop: 2 x 2 or 3 x 3 bilinear taps, its uniform says which. */box: GPURenderPipeline; /** One axis of the Gaussian: its weights live in a uniform, since they follow the frame's width. */
10233
+ blur: GPURenderPipeline; /** Linear, clamped at the edge. */
10234
+ sampler: GPUSampler;
10235
+ };
10236
+ /**
10237
+ * shots module state, `ctx.state.shots`.
10238
+ */
10239
+ type ShotsState = {
10240
+ /** Keys of the takes waiting for a drawn frame, each once. */wanted: string[]; /** The shots, by key. Insertion order is age: a retake deletes and sets. */
10241
+ taken: Map<string, PixiRenderTexture>; /** The pipelines of the live device; `undefined` until they compiled, and after a loss. */
10242
+ pipes: ShotPipes | undefined; /** Removes the texture provider; `undefined` until `start` provided it. */
10243
+ off: (() => void) | undefined; /** A failed compile was logged: the next stays quiet. */
10244
+ warned: boolean;
10245
+ };
10246
+ /**
10247
+ * shots module API, `app.renderer.shots`: what a game calls to keep the frame it is about to leave, and to ask whether
10248
+ * it is there. A shot is the frame as drawn on the canvas, HUD included, reduced and blurred on the GPU. Its key
10249
+ * resolves like any asset key through the texture providers: `image`, `Sprite`. `leave.loader.texture` reads its key once, as the look shows, so it needs a shot that already stands.
10250
+ *
10251
+ * @example
10252
+ * ```ts
10253
+ * // At the start of the switch, in a live node.
10254
+ * app.renderer.shots.take("shot.panorama.bolt");
10255
+ * app.renderer.shots.has("shot.panorama.bolt"); // true once the next frame was drawn
10256
+ * ```
10257
+ */
10258
+ type ShotsApi = {
10259
+ /**
10260
+ * Keeps what the next drawn frame shows under `key`, replacing a shot of that key, and asks for that frame. The
10261
+ * look of `scenes.leave` is not in the shot: the frame draws without it, and the look shows from the next frame on
10262
+ * its own clock. Two keys taken before a frame is drawn get the same picture. Does nothing without `shots` in the
10263
+ * config, while the renderer does not draw, on WebGL, before the pipelines compiled, and while `world.ecs.mode()` is
10264
+ * not `"live"`: nothing is thrown and nothing is warned, so a game draws its baked picture then.
10265
+ *
10266
+ * @param key - The asset key the shot answers to.
10267
+ * @example
10268
+ * ```ts
10269
+ * // The player taps the door: the room is kept before the next scene takes the screen.
10270
+ * if (run.mode === "live") app.renderer.shots.take("shot.room.hall");
10271
+ * app.renderer.shots.has("shot.room.hall"); // false until the frame was drawn, true after it
10272
+ * ```
10273
+ */
10274
+ take(key: string): void;
10275
+ /**
10276
+ * Tells whether a shot stands under a key. False before its frame was drawn, after the oldest went for a newer one,
10277
+ * after a lost device, and on any renderer that takes none: a game draws its baked picture then.
10278
+ *
10279
+ * @param key - The asset key.
10280
+ * @returns True while the key answers a shot.
10281
+ * @example
10282
+ * ```ts
10283
+ * // The loader of the next switch shows the room when it stands, and the baked one when it does not.
10284
+ * const backdrop = app.renderer.shots.has("shot.room.hall") ? "shot.room.hall" : "ui.backdrop";
10285
+ * ```
10286
+ */
10287
+ has(key: string): boolean;
10288
+ };
10289
+ /**
10290
+ * What the plugin root and the frame drive. Not public.
10291
+ */
10292
+ type ShotsInternal = {
10293
+ /** From `host.onReady` and a rebuilt `host.onRestore`: provides the textures once, compiles the pipelines. */start(): void;
10294
+ /**
10295
+ * Right after the stage render, in the same task, while the canvas texture is valid. One length read with nothing
10296
+ * wanted; with keys wanted it empties them, and when `drawn` takes the shot and asks for one more frame.
10297
+ *
10298
+ * @param drawn - False for a frame of the heat map or one Pixi did not render: it takes nothing.
10299
+ */
10300
+ after(drawn: boolean): void; /** From `host.onLoss`: the takes, the shots and the pipelines go with the device, silently. */
10301
+ forget(): void;
10302
+ };
10152
10303
  declare namespace types_d_exports$2 {
10153
- 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, 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 };
10304
+ 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 };
10154
10305
  }
10155
10306
  /**
10156
10307
  * The part of Pixi the engine uses: the classes `sync` builds views from (a `Rectangle` frames the
@@ -10369,6 +10520,8 @@ type AdaptiveScale = {
10369
10520
  * createApp({ pluginConfigs: { renderer: { mount: "#game", uploads: 2 } } });
10370
10521
  * // A game whose art must stay sharp: the adaptive frame rate drops the rate, never the resolution.
10371
10522
  * createApp({ pluginConfigs: { renderer: { mount: "#game", adaptiveScale: false } } });
10523
+ * // A loader that shows the place the player left, as a small soft picture.
10524
+ * createApp({ pluginConfigs: { renderer: { mount: "#game", shots: { width: 96, height: 208, blur: 22 } } } });
10372
10525
  * ```
10373
10526
  */
10374
10527
  type Config$2 = {
@@ -10442,6 +10595,11 @@ type Config$2 = {
10442
10595
  * of the scale redraws the canvas and retakes the kept pictures once.
10443
10596
  */
10444
10597
  adaptiveScale: AdaptiveScale | false;
10598
+ /**
10599
+ * The size and softness of the pictures `renderer.shots.take` keeps of the drawn frame. `undefined` by default: no
10600
+ * pipeline is made and `take` does nothing. Bad values throw at `createApp`.
10601
+ */
10602
+ shots: ShotsConfig | undefined;
10445
10603
  };
10446
10604
  /**
10447
10605
  * The performance monitor of an agent build (`__MOKU_GAME_AGENT__`: dev and `--debug` builds): the spike budget, the
@@ -10486,6 +10644,7 @@ type State$2 = {
10486
10644
  monitor: MonitorState;
10487
10645
  demand: DemandState;
10488
10646
  kept: KeptState;
10647
+ shots: ShotsState;
10489
10648
  };
10490
10649
  /**
10491
10650
  * renderer plugin API, `app.renderer`: grouped by module, and the two members of `monitor`,
@@ -10547,6 +10706,17 @@ type Api$1 = {
10547
10706
  * ```
10548
10707
  */
10549
10708
  monitor: PerfMonitorApi;
10709
+ /**
10710
+ * Small soft pictures of the frame just drawn, kept under asset keys. Needs `shots` in the config.
10711
+ *
10712
+ * @example
10713
+ * ```ts
10714
+ * // The start of a switch out of the panorama: the next drawn frame is kept for the loader.
10715
+ * app.renderer.shots.take("shot.panorama.bolt");
10716
+ * app.renderer.shots.has("shot.panorama.bolt"); // true once that frame was drawn
10717
+ * ```
10718
+ */
10719
+ shots: ShotsApi;
10550
10720
  /**
10551
10721
  * Tells the renderer that the Pixi object of an entity's view is about to be drawn differently in a way it cannot
10552
10722
  * see: a plugin or a game writes into its own `Display` object or a Pixi object it built, `effects` writes a filter
@@ -10643,7 +10813,11 @@ type DemandModule = DemandInternal;
10643
10813
  */
10644
10814
  type KeptModule = KeptInternal;
10645
10815
  /**
10646
- * The six modules in injection order.
10816
+ * Both halves of the `shots` module: what a game calls and what the plugin root and the frame drive.
10817
+ */
10818
+ type ShotsModule = ShotsApi & ShotsInternal;
10819
+ /**
10820
+ * The seven modules in injection order.
10647
10821
  */
10648
10822
  type Modules = {
10649
10823
  host: HostModule;
@@ -10651,6 +10825,7 @@ type Modules = {
10651
10825
  demand: DemandModule;
10652
10826
  kept: KeptModule;
10653
10827
  sync: SyncModule;
10828
+ shots: ShotsModule;
10654
10829
  monitor: MonitorModule;
10655
10830
  };
10656
10831
  /**
@@ -11613,7 +11788,7 @@ type FiltersApi = {
11613
11788
  * app, `warm: 0`), and `false` when the renderer stops first or a probe's render threw, which ends the warm-up of the
11614
11789
  * application (`renderer:warm-failed`). A filter handed over again on the same device answers `true` at once when its
11615
11790
  * draws were made. The renderer never destroys the filter. On WebGPU a `quad` asks for the pipelines of the filter's body
11616
- * on its mesh too, once, after the filter, so a kept view that later draws through it compiles
11791
+ * on its mesh too, two draws in one frame after the filter, so a kept view that later draws through it compiles
11617
11792
  * nothing in play; each of those draws runs in an error scope, and a program that does not fit logs
11618
11793
  * `renderer:warm-invalid` while the warm-up goes on. WebGL ignores it.
11619
11794
  *
@@ -12348,8 +12523,9 @@ type AreaEntry = {
12348
12523
  */
12349
12524
  type WarmSubject = "sprite" | "sprite-add" | "sprite-screen" | "graphics" | "particles-normal" | "particles-add" | "text" | PixiFilter | WarmQuad;
12350
12525
  /**
12351
- * A filter's body on its quad, as a probe of the warm-up draws it: on WebGPU, once, after the filter, in the first of
12352
- * the device's variants, so a kept view's first frame on its shader compiles nothing.
12526
+ * A filter's body on its quad, as a probe of the warm-up draws it: on WebGPU, after the filter, in the first of the
12527
+ * device's variants and into a target with no stencil, so a kept view's first frame on its shader compiles nothing: on
12528
+ * the canvas, under a filter of an ancestor, or inside an outer picture.
12353
12529
  */
12354
12530
  type WarmQuad = {
12355
12531
  readonly filter: PixiFilter;
@@ -12357,9 +12533,10 @@ type WarmQuad = {
12357
12533
  };
12358
12534
  /**
12359
12535
  * Where a probe draws: straight onto the canvas, or into a texture under a filter of the module's own, each with or
12360
- * without a stencil clip. A WebGPU pipeline is keyed by all four.
12536
+ * without a stencil clip. A WebGPU pipeline is keyed by all four. `"plain"` is a texture no clip ever drew into: the
12537
+ * texture of the texture variants keeps the stencil of its first clip, and a quad needs a target without one.
12361
12538
  */
12362
- type WarmVariant = "canvas" | "canvas+clip" | "texture" | "texture+clip";
12539
+ type WarmVariant = "canvas" | "canvas+clip" | "texture" | "texture+clip" | "plain";
12363
12540
  /**
12364
12541
  * One probe draw: one subject in one variant.
12365
12542
  */
@@ -12382,7 +12559,8 @@ type WarmObjects = {
12382
12559
  * The texture a texture variant is rendered into: the module's own, so the subject is drawn into a texture with no
12383
12560
  * filter around it, and a texture variant never touches the canvas.
12384
12561
  */
12385
- target: PixiRenderTexture; /** A filter subject's container: its `filters` is the draw's filter, during the draw only. */
12562
+ target: PixiRenderTexture; /** The texture of a `"plain"` draw: no stencil, since no clip ever draws into it. */
12563
+ plain: PixiRenderTexture; /** A filter subject's container: its `filters` is the draw's filter, during the draw only. */
12386
12564
  holder: PixiContainer; /** The one-entry list `holder.filters` is set from. */
12387
12565
  list: PixiFilter[];
12388
12566
  sprite: PixiSprite; /** The 4 × 4 white sprite of `sprite`, blending `"add"`: the batch pipeline of an added glow. */
@@ -14395,4 +14573,4 @@ type BundleCompanion = {
14395
14573
  unload(bundle: string): void;
14396
14574
  };
14397
14575
  //#endregion
14398
- export { MonitorConfig as $, MotionHandle as $n, Api$6 as $r, PerfThermalLine as $t, FilterSlotQuad as A, AnyFlow as An, Api$4 as Ar, PERF_GAP_BUCKETS as At, Parent as B, Descriptor as Bn, Root as Br, PerfDisplay as Bt, SceneSpec as C, exit as Cn, SystemFor as Cr, FrameRing as Ct, DebugSwitches as D, FeatureDescription as Dn, Explained as Dr, OverlayEventDetail as Dt, types_d_exports$1 as E, type as En, Config$4 as Er, MonitorSections as Et, HudPartValue as F, JournalEntry as Fn, types_d_exports$5 as Fr, PerfCause as Ft, SpriteOptions as G, NodeFx as Gn, ProviderCall as Gr, PerfLogLine as Gt, ShapeValue as H, EffectOptions as Hn, types_d_exports$6 as Hr, PerfEventName as Ht, NineSlice$1 as I, NodeTable as In, Api$5 as Ir, PerfChange as It, TransformValue as J, ChangeHook as Jn, Snapshot as Jr, PerfMeasured as Jt, SpriteValue as K, Answer as Kn, SaveDoc as Kr, PerfLongFrameLine as Kt, NineSliceValue as L, RouteStep as Ln, Config$6 as Lr, PerfChangeEntry as Lt, WhyEntry as M, DefineNode as Mn, Config$5 as Mr, PROBLEM_RULES as Mt, Display as N, FlowGraph as Nn, FakeClock as Nr, PassKind as Nt, FilterSlot as O, FeaturePlugin as On, State$4 as Or, OverlayWhat as Ot, HudPart as P, FlowState as Pn, State$5 as Pr, PassRecord as Pt, Config$2 as Q, MotionCause as Qn, RngState as Qr, PerfTelemetryLine as Qt, Overlay as R, SceneIdOf as Rn, Events$5 as Rr, PerfCollectorLine as Rt, SceneDefinition as S, defineFlow as Sn, SystemDefinition as Sr, FrameRecord as St, State$1 as T, to as Tn, Api$3 as Tr, MONITOR_SECTIONS as Tt, Sprite as U, GuideOptions as Un, Patch as Ur, PerfGapLine as Ut, Shape as V, Effect as Vn, State$6 as Vr, PerfEventLine as Vt, SpriteBlend as W, Hint as Wn, PlayerStateProvider as Wr, PerfHeaderLine as Wt, AdaptiveScale as X, Ease as Xn, StoreApi as Xr, PerfSpikeLine as Xt, sprite as Y, DescriptionNode as Yn, SnapshotOf as Yr, PerfSampleLine as Yt, Api$1 as Z, Motion as Zn, RngApi as Zr, PerfStartupLine as Zt, AnySceneProjection as _, State$3 as _n, FrameDiff as _r, RetakeWhy as _t, Config as a, Api$7 as ai, ShaderWhat as an, TrackOptions as ar, PixiUniformGroup as at, Events$1 as b, types_d_exports$3 as bn, QueryTerm as br, FrameReadResult as bt, LoadBundles as c, RateChange as ci, CanvasRestart as cn, AnyComponent as cr, Under as ct, Manifest as d, Time as di, BundlesOf as dn, ComponentHandle as dr, MonitorCounts as dt, Config$7 as ei, PoolTrimDetail as en, NumericFields as er, PixiFilter as et, ReadyBundles as f, types_d_exports$8 as fi, Config$3 as fn, ComponentSchema as fr, RenderStats as ft, types_d_exports as g, Position as gn, EntitySnapshot as gr, FilterCache as gt, Usage as h, Require as hi, HudKeysOf as hn, Entity as hr, ViewportSize as ht, BundleSpec as i, types_d_exports$7 as ii, ShaderEventDetail as in, SceneSwitch as ir, PixiTexture as it, SyncApi as j, Bookmark as jn, ClockSource as jr, PERF_LOG_VERSION as jt, FilterSlotInputs as k, FeatureTree as kn, types_d_exports$4 as kr, PERF_CAUSES as kt, LoadReason as l, State$8 as li, DEMAND_REASONS as ln, AnyComponentType as lr, types_d_exports$2 as lt, Tier as m, Events$8 as mi, GameTypes as mn, ComponentValue as mr, Point as mt, AssetsIo as n, PauseReason as ni, ProblemRule as nn, ProjectionSpec as nr, PixiModule as nt, DefineBundles as o, Config$8 as oi, WarmDetail as on, TrackSegment as or, PoolTrim as ot, State as p, Config$9 as pi, EmitterIdOf as pn, ComponentType as pr, Orientation as pt, Transform as q, AnchorTarget as qn, SaveUnreadableError as qr, PerfMarkLine as qt, BundleMap as r, State$7 as ri, SHADER_WHATS as rn, ReducedMotion as rr, PixiSprite as rt, Events as s, FrameRate as si, CANVAS_RESTARTS as sn, ViewHandle as sr, State$2 as st, Api as t, Events$6 as ti, ProblemEventDetail as tn, ProjectionMotion as tr, PixiGpuProgram as tt, LoadResult as u, ThermalReading as ui, Api$2 as un, AnyComponentValue as ur, Captured as ut, Config$1 as v, TextFormatsOf as vn, Mut as vr, WhyLive as vt, ScenesApi as w, slot as wn, TagType as wr, LongFrameEntry as wt, LayerMap as x, contribution as xn, ResourceType as xr, FrameReadout as xt, DefineScene as y, TextStylesOf as yn, Narrowed as yr, FrameColumns as yt, OverlayValue as z, TypeTag as zn, Json as zr, PerfCounts as zt };
14576
+ export { MonitorConfig as $, Motion as $n, RngApi as $r, PerfStartupLine as $t, FilterSlotQuad as A, FeaturePlugin as An, State$4 as Ar, OverlayWhat as At, Parent as B, SceneIdOf as Bn, Events$5 as Br, PerfCollectorLine as Bt, SceneSpec as C, contribution as Cn, ResourceType as Cr, FrameReadout as Ct, DebugSwitches as D, to as Dn, Api$3 as Dr, MONITOR_SECTIONS as Dt, types_d_exports$1 as E, slot as En, TagType as Er, LongFrameEntry as Et, HudPartValue as F, FlowGraph as Fn, FakeClock as Fr, PassKind as Ft, SpriteOptions as G, GuideOptions as Gn, Patch as Gr, PerfGapLine as Gt, ShapeValue as H, Descriptor as Hn, Root as Hr, PerfDisplay as Ht, NineSlice$1 as I, FlowState as In, State$5 as Ir, PassRecord as It, TransformValue as J, Answer as Jn, SaveDoc as Jr, PerfLongFrameLine as Jt, SpriteValue as K, Hint as Kn, PlayerStateProvider as Kr, PerfHeaderLine as Kt, NineSliceValue as L, JournalEntry as Ln, types_d_exports$5 as Lr, PerfCause as Lt, WhyEntry as M, AnyFlow as Mn, Api$4 as Mr, PERF_GAP_BUCKETS as Mt, Display as N, Bookmark as Nn, ClockSource as Nr, PERF_LOG_VERSION as Nt, FilterSlot as O, type as On, Config$4 as Or, MonitorSections as Ot, HudPart as P, DefineNode as Pn, Config$5 as Pr, PROBLEM_RULES as Pt, Config$2 as Q, Ease as Qn, StoreApi as Qr, PerfSpikeLine as Qt, Overlay as R, NodeTable as Rn, Api$5 as Rr, PerfChange as Rt, SceneDefinition as S, types_d_exports$3 as Sn, QueryTerm as Sr, FrameReadResult as St, State$1 as T, exit as Tn, SystemFor as Tr, FrameRing as Tt, Sprite as U, Effect as Un, State$6 as Ur, PerfEventLine as Ut, Shape as V, TypeTag as Vn, Json as Vr, PerfCounts as Vt, SpriteBlend as W, EffectOptions as Wn, types_d_exports$6 as Wr, PerfEventName as Wt, AdaptiveScale as X, ChangeHook as Xn, Snapshot as Xr, PerfMeasured as Xt, sprite as Y, AnchorTarget as Yn, SaveUnreadableError as Yr, PerfMarkLine as Yt, Api$1 as Z, DescriptionNode as Zn, SnapshotOf as Zr, PerfSampleLine as Zt, AnySceneProjection as _, Require as _i, HudKeysOf as _n, Entity as _r, ViewportSize as _t, Config as a, State$7 as ai, SHADER_WHATS as an, ReducedMotion as ar, PixiUniformGroup as at, Events$1 as b, TextFormatsOf as bn, Mut as br, WhyLive as bt, LoadBundles as c, Config$8 as ci, WarmDetail as cn, TrackSegment as cr, Under as ct, Manifest as d, State$8 as di, DEMAND_REASONS as dn, AnyComponentType as dr, ShotsConfig as dt, RngState as ei, PerfTelemetryLine as en, MotionCause as er, PixiFilter as et, ReadyBundles as f, ThermalReading as fi, Api$2 as fn, AnyComponentValue as fr, Captured as ft, types_d_exports as g, Events$8 as gi, GameTypes as gn, ComponentValue as gr, Point as gt, Usage as h, Config$9 as hi, EmitterIdOf as hn, ComponentType as hr, Orientation as ht, BundleSpec as i, PauseReason as ii, ProblemRule as in, ProjectionSpec as ir, PixiTexture as it, SyncApi as j, FeatureTree as jn, types_d_exports$4 as jr, PERF_CAUSES as jt, FilterSlotInputs as k, FeatureDescription as kn, Explained as kr, OverlayEventDetail as kt, LoadReason as l, FrameRate as li, CANVAS_RESTARTS as ln, ViewHandle as lr, types_d_exports$2 as lt, Tier as m, types_d_exports$8 as mi, Config$3 as mn, ComponentSchema as mr, RenderStats as mt, AssetsIo as n, Config$7 as ni, PoolTrimDetail as nn, NumericFields as nr, PixiModule as nt, DefineBundles as o, types_d_exports$7 as oi, ShaderEventDetail as on, SceneSwitch as or, PoolTrim as ot, State as p, Time as pi, BundlesOf as pn, ComponentHandle as pr, MonitorCounts as pt, Transform as q, NodeFx as qn, ProviderCall as qr, PerfLogLine as qt, BundleMap as r, Events$6 as ri, ProblemEventDetail as rn, ProjectionMotion as rr, PixiSprite as rt, Events as s, Api$7 as si, ShaderWhat as sn, TrackOptions as sr, State$2 as st, Api as t, Api$6 as ti, PerfThermalLine as tn, MotionHandle as tr, PixiGpuProgram as tt, LoadResult as u, RateChange as ui, CanvasRestart as un, AnyComponent as ur, ShotsApi as ut, Config$1 as v, Position as vn, EntitySnapshot as vr, FilterCache as vt, ScenesApi as w, defineFlow as wn, SystemDefinition as wr, FrameRecord as wt, LayerMap as x, TextStylesOf as xn, Narrowed as xr, FrameColumns as xt, DefineScene as y, State$3 as yn, FrameDiff as yr, RetakeWhy as yt, OverlayValue as z, RouteStep as zn, Config$6 as zr, PerfChangeEntry as zt };
@@ -1,9 +1,9 @@
1
- import { $r as Api$3, Ar as Api$4, Ir as Api$2, Tr as Api$1, Z as Api } from "./types-w5_A5TPL.mjs";
2
- import { P as AnimApi, r as UiApi } from "./types-CJYudpme.mjs";
3
- import { L as InputApi } from "./types-BbLjYfGR.mjs";
4
- import { r as Repro } from "./headless-CtRq6Uij.mjs";
5
- import { i as ControlApp, o as InputOf } from "./types-ehmvA6yu.mjs";
6
- import { t as commands } from "./commands-C6RMqrY8.mjs";
1
+ import { Dr as Api$1, Mr as Api$4, Rr as Api$2, Z as Api, ti as Api$3 } from "./types-D1lRinVJ.mjs";
2
+ import { P as AnimApi, r as UiApi } from "./types-Cc7uKiHX.mjs";
3
+ import { L as InputApi } from "./types-BMUuyOcm.mjs";
4
+ import { r as Repro } from "./headless-Dasz6dgy.mjs";
5
+ import { i as ControlApp, o as InputOf } from "./types-Btqe51cJ.mjs";
6
+ import { t as commands } from "./commands-DUco80gt.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-DvhjRhgP.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-BMyWTUgm.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/llms.txt CHANGED
@@ -584,6 +584,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
584
584
  - `app.renderer.viewport.size()` answers one frozen object, replaced only when the frame changes (a resize, a rotation, new insets, a new scale): compare frames with `===`; a write into it throws a `TypeError`.
585
585
  - `pluginConfigs.renderer.warm` (default `1`, 0 to 16) is the pipeline warm-up: while a game loads, each drawn frame first draws that many invisible probes (sprites, graphics, text, particles, every filter kind and stage `effects` registers, on the canvas and on a texture, with and without a clip), wiped by the stage pass, so no screen creates a GPU pipeline in the frame it opens in; `0` turns it off. `app.renderer.sync.filters.warm(filter)` warms a game's own filter (answers `true` once drawn). An agent build writes a `warm` event `{ draws }` when the queue empties.
586
586
  - `defineFilter(id, { area: value => [x, y, width, height] })` declares the box, in the entity's own units, outside of which the filter draws nothing: Pixi renders and fills only that box (a lens over a full-screen cover fills its disc, not the screen). The view gets the union of its enabled filters' areas, none when an enabled filter declares none (`renderer.sync.filters.area(entity, area)`). The area also clips the view's own children: Pixi draws nothing of the view outside it, so a shadow or a badge that overhangs the box is cut; make the box hold them. The full-screen filter budget and the kept-picture budget count a view with an area by that area, not by its box. Distance-field text uses device pixels for its edge: sharper at a resolution above 1. The type of that box is `FilterArea`.
587
+ - Shots: `pluginConfigs.renderer.shots` (`ShotsConfig`, default `undefined`): `{ width, height, blur, keep? }`, the size in texels (whole numbers from 1 to 512), `blur` the sigma in reference units of the frame's width (0 is no blur, 10 texels at most), `keep` the shots kept (default 8, the oldest taken goes first and its texture is reused). `app.renderer.shots` (`ShotsApi`): `take(key)` keeps what the next drawn frame shows under an asset key, HUD included, without the look of `scenes.leave`, as a small soft texture, and asks for that frame; `has(key)` answers true once it stands. The key resolves through the texture providers like any asset key: `image`, `Sprite`, `leave.loader.texture`. `take` does nothing and warns nothing without `shots`, headless, on WebGL, before the pipelines compiled, and while `world.ecs.mode()` is not `"live"`; a lost device loses the shots, so a game asks `has` and draws its baked picture otherwise. A failed compile logs `renderer:shots-unavailable` once. Not saved.
587
588
  - `pluginConfigs.renderer.poolTrim` (default `{ restMs: 1000, aboveMb: 16 }`) gives back the idle render targets Pixi's texture pool keeps, strictly between frames: after `restMs` of a still screen (`onDemand`), `restMs` after a scene change (each when the targets grew by `aboveMb` MiB), and on a pause (whatever grew); `false` keeps them. `stats().textureMbSplit.targets` shows the drop; an agent build writes a `pool-trim` event `{ reason, freedMb }`. Its type is `PoolTrim`.
588
589
  - `blend` on `Sprite` and `NineSlice` (optional, absent by default, type `SpriteBlend`): `"screen"` lightens what is under the view (CSS `mix-blend-mode: screen` on a dark background), `"add"` adds its colours (brighter), `"normal"` covers by alpha as without the field. Any other string draws normally and warns `renderer:blend-unknown` once. It goes on the view itself, so a glow's children draw normally; both are Pixi's native batch blends, no filter and no pass, and each switch between blends in draw order costs one draw call. In `ui`, `style.blend` on an `image`, an `icon` or a nine-slice style writes it (`style={{ blend: "screen" }}` for a soft glow, `"add"` for a spark); an element that never blended carries no `blend` field, so describe and saves stay as they were.
589
590
  - `app.renderer.viewport.size().safeArea` is read from four CSS custom properties on the page, `--moku-safe-top`, `--moku-safe-right`, `--moku-safe-bottom`, `--moku-safe-left`, each falling back to `env(safe-area-inset-*, 0px)`. Any CSS length works (`max()`, `calc()`, `env()`); a negative one counts as 0. A change of a property or of the page's insets, and the window event `moku-native:insets`, is laid out at the next frame. There is no `setInsets`: set the properties, e.g. `:root { --moku-safe-top: max(env(safe-area-inset-top, 0px), 24px); }`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.88",
3
+ "version": "0.15.90",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [