@moku-labs/game 0.15.39 → 0.15.40
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.
- package/dist/app/page.d.mts +1 -1
- package/dist/app/system.d.mts +3 -3
- package/dist/app.d.mts +3 -3
- package/dist/app.mjs +1 -1
- package/dist/assets.d.mts +1 -1
- package/dist/{commands-CMFdiDcg.d.mts → commands-CvwzXCxM.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/{define-D27mfOhZ.d.mts → define-DRRs7A6i.d.mts} +2 -2
- package/dist/{headless-CRqMxzqv.d.mts → headless-CEwDAhgH.d.mts} +1 -1
- package/dist/{index-DFAjLwxi.d.mts → index-BQGifHXV.d.mts} +19 -7
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/inspect.d.mts +6 -6
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{runtime-CbLZyDXj.d.mts → runtime-7RDFd4Ti.d.mts} +1 -1
- package/dist/{src-B2vblgmb.mjs → src-Cz-QeLTp.mjs} +1572 -684
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +1 -1
- package/dist/{types-H1FiWmKa.d.mts → types-B4DmdMle.d.mts} +4 -4
- package/dist/{types-54KzmAA6.d.mts → types-CP22WjU9.d.mts} +2 -2
- package/dist/{types-CGPWYbZO.d.mts → types-CoTkzbEB.d.mts} +2 -2
- package/dist/{types-C_dk-lXz.d.mts → types-DY_DRbGY.d.mts} +292 -6
- package/dist/{types-0Br0SjTB.d.mts → types-Dnh8LZxo.d.mts} +1 -1
- package/dist/{visual-DjTJ02c3.d.mts → visual-BcS4CTps.d.mts} +6 -6
- package/dist/visual.d.mts +1 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
package/dist/testing.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $n as FeaturePlugin, Dr as Json, dr as Descriptor, gr as NodeFx, hr as Hint, sr as NodeTable, tr as AnyFlow, xr as FakeClock, yr as ClockSource } from "./types-
|
|
2
|
-
import { t as createApp } from "./index-
|
|
3
|
-
import { b as saveOf, v as WithGameState, y as memory } from "./types-
|
|
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-
|
|
1
|
+
import { $n as FeaturePlugin, Dr as Json, dr as Descriptor, gr as NodeFx, hr as Hint, sr as NodeTable, tr as AnyFlow, xr as FakeClock, yr as ClockSource } from "./types-DY_DRbGY.mjs";
|
|
2
|
+
import { t as createApp } from "./index-BQGifHXV.mjs";
|
|
3
|
+
import { b as saveOf, v as WithGameState, y as memory } from "./types-B4DmdMle.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-CEwDAhgH.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 { en as refuseStart, in as type, m as flattenFeatures, t as createApp, tn as exit } from "./src-
|
|
1
|
+
import { en as refuseStart, in as type, m as flattenFeatures, t as createApp, tn as exit } from "./src-Cz-QeLTp.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-Bxxl_mQX.mjs";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as PixiModule, $n as FeaturePlugin, Dr as Json, Lr as SnapshotOf, Mr as PlayerStateProvider, Nr as ProviderCall, Pr as SaveDoc, Tr as Config, X as Config$2, a as Config$3, d as Manifest, lt as Orientation, n as AssetsIo, tr as AnyFlow, ur as TypeTag, xr as FakeClock, yr as ClockSource, zn as Config$1 } from "./types-
|
|
2
|
-
import { o as AudioContextLike, s as Config$4 } from "./types-
|
|
3
|
-
import { R as I18nApi, U as StringTable, W as TextKey } from "./types-
|
|
4
|
-
import { St as effectsPlugin, Tt as audioPlugin, ht as PlatformProvider, i as screen, pt as platformPlugin, t as createApp } from "./index-
|
|
1
|
+
import { $ as PixiModule, $n as FeaturePlugin, Dr as Json, Lr as SnapshotOf, Mr as PlayerStateProvider, Nr as ProviderCall, Pr as SaveDoc, Tr as Config, X as Config$2, a as Config$3, d as Manifest, lt as Orientation, n as AssetsIo, tr as AnyFlow, ur as TypeTag, xr as FakeClock, yr as ClockSource, zn as Config$1 } from "./types-DY_DRbGY.mjs";
|
|
2
|
+
import { o as AudioContextLike, s as Config$4 } from "./types-CP22WjU9.mjs";
|
|
3
|
+
import { R as I18nApi, U as StringTable, W as TextKey } from "./types-Dnh8LZxo.mjs";
|
|
4
|
+
import { St as effectsPlugin, Tt as audioPlugin, ht as PlatformProvider, i as screen, pt as platformPlugin, t as createApp } from "./index-BQGifHXV.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 { $ as PixiModule, A as SyncApi, An as NumericFields, Dr as Json, En as Ease, Er as Events$3, Fn as TrackSegment, Ln as Api$2, Nn as ReducedMotion, O as FilterSlot, Pn as TrackOptions, Q as PixiFilter, Ur as Events$5, Y as Api$4, b as Events$4, dr as Descriptor, et as PixiSprite, fn as ComponentType, ft as FilterCache, k as FilterSlotInputs, kn as MotionHandle, ln as AnyComponentValue, mn as Entity, ni as Events$2, nn as Api$3, qr as Api$1, ri as Require, s as Events$1, sn as AnyComponent, t as Api$5, tt as PixiTexture, un as ComponentHandle, ur as TypeTag, ut as Point, wr as Api$6 } from "./types-
|
|
2
|
-
import { N as InputApi, R as I18nApi, X as StylesState, c as UiNode, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion, w as TextApi } from "./types-
|
|
1
|
+
import { $ as PixiModule, A as SyncApi, An as NumericFields, Dr as Json, En as Ease, Er as Events$3, Fn as TrackSegment, Ln as Api$2, Nn as ReducedMotion, O as FilterSlot, Pn as TrackOptions, Q as PixiFilter, Ur as Events$5, Y as Api$4, b as Events$4, dr as Descriptor, et as PixiSprite, fn as ComponentType, ft as FilterCache, k as FilterSlotInputs, kn as MotionHandle, ln as AnyComponentValue, mn as Entity, ni as Events$2, nn as Api$3, qr as Api$1, ri as Require, s as Events$1, sn as AnyComponent, t as Api$5, tt as PixiTexture, un as ComponentHandle, ur as TypeTag, ut as Point, wr as Api$6 } from "./types-DY_DRbGY.mjs";
|
|
2
|
+
import { N as InputApi, R as I18nApi, X as StylesState, c as UiNode, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion, w as TextApi } from "./types-Dnh8LZxo.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 { Dr as Json, Ir as Snapshot } from "./types-
|
|
2
|
-
import { t as HeadlessApp } from "./headless-
|
|
1
|
+
import { Dr as Json, Ir as Snapshot } from "./types-DY_DRbGY.mjs";
|
|
2
|
+
import { t as HeadlessApp } from "./headless-CEwDAhgH.mjs";
|
|
3
3
|
import { Log } from "@moku-labs/common/browser";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/flow/doors/types.d.ts
|
|
@@ -9320,7 +9320,7 @@ type PictureRequest = {
|
|
|
9320
9320
|
reject: (error: Error) => void;
|
|
9321
9321
|
};
|
|
9322
9322
|
declare namespace types_d_exports$2 {
|
|
9323
|
-
export { AdaptiveScale, Api$1 as Api, AspectRange, BitmapFontData, 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, FiltersApi, FontsApi, FrameColumns, FrameReadResult, FrameReadout, FrameRecord, FrameRing, HitBox, HostApi, HostInternal, HostModule, HostState, HudPartValue, KeptInternal, KeptModule, KeptRange, KeptState, KeptStats, KernelSlice$2 as KernelSlice, LayerEntry, 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, PixiGraphics, PixiMatrix, PixiMesh, PixiModule, PixiNineSliceSprite, PixiRectangle, PixiRenderTexture, PixiSprite, PixiTexture, PixiTextureSource, Point, PoolTrim, PoolTrimDetail, ProblemEventDetail, ProblemRule, Rect, RenderStats, RendererCtx, RendererKind, 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 };
|
|
9323
|
+
export { AdaptiveScale, Api$1 as Api, AspectRange, BitmapFontData, 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, 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, PixiGraphics, PixiMatrix, PixiMesh, PixiModule, PixiNineSliceSprite, PixiRectangle, PixiRenderTexture, PixiSprite, PixiTexture, PixiTextureSource, Point, PoolTrim, PoolTrimDetail, ProblemEventDetail, ProblemRule, Rect, RenderStats, RendererCtx, RendererKind, 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 };
|
|
9324
9324
|
}
|
|
9325
9325
|
/**
|
|
9326
9326
|
* The part of Pixi the engine uses: the classes `sync` builds views from (a `Rectangle` frames the
|
|
@@ -10874,6 +10874,158 @@ type DebugApi = {
|
|
|
10874
10874
|
*/
|
|
10875
10875
|
state(): DebugSwitches;
|
|
10876
10876
|
};
|
|
10877
|
+
/**
|
|
10878
|
+
* The veil of a scene being left, every field resolved: a full-canvas rect in one colour that fades from 0 to `alpha`
|
|
10879
|
+
* over `inMs` from the switch start, and back to 0 over `outMs` after the swap.
|
|
10880
|
+
*
|
|
10881
|
+
* @example
|
|
10882
|
+
* ```ts
|
|
10883
|
+
* // A game that writes nothing: black at 45 %, 150 ms in, 150 ms out.
|
|
10884
|
+
* const cover: LeaveCover = { color: 0x000000, alpha: 0.45, inMs: 150, outMs: 150 };
|
|
10885
|
+
* ```
|
|
10886
|
+
*/
|
|
10887
|
+
type LeaveCover = {
|
|
10888
|
+
/** The colour of the veil, `0xRRGGBB`. */color: number; /** The alpha the veil fades in to, 0 to 1. */
|
|
10889
|
+
alpha: number; /** Clock milliseconds from 0 to `alpha`; 0 shows it at once. */
|
|
10890
|
+
inMs: number; /** Clock milliseconds from where it stands at the swap back to 0; 0 takes it away at once. */
|
|
10891
|
+
outMs: number;
|
|
10892
|
+
};
|
|
10893
|
+
/**
|
|
10894
|
+
* The loader of a scene being left, drawn above the veil when the switch is not done `afterMs` after its start, until
|
|
10895
|
+
* the swap: a game texture turning at the centre (`texture`), a layer of the scene drawn above the veil (`due`, which
|
|
10896
|
+
* makes what the loader draws only once it is due and answers its layer: `scenes` mounts a loader projection there),
|
|
10897
|
+
* or, with neither, a white ring the engine draws.
|
|
10898
|
+
*
|
|
10899
|
+
* @example
|
|
10900
|
+
* ```ts
|
|
10901
|
+
* const ring: LeaveLoader = { afterMs: 400 };
|
|
10902
|
+
* const spinner: LeaveLoader = { afterMs: 400, texture: "ui.loader.ring" };
|
|
10903
|
+
* // The layer "loading" above the veil, its views made only if the switch takes 250 ms.
|
|
10904
|
+
* const screen: LeaveLoader = { afterMs: 250, due: () => "loading" };
|
|
10905
|
+
* ```
|
|
10906
|
+
*/
|
|
10907
|
+
type LeaveLoader = {
|
|
10908
|
+
/** Clock milliseconds after the switch start the loader waits for. */afterMs: number; /** An asset key: the texture turns at the centre of the frame. A key no provider answers draws the ring. */
|
|
10909
|
+
texture?: string;
|
|
10910
|
+
/**
|
|
10911
|
+
* Called once, in the first frame the loader is due and before it is drawn, never for a switch done sooner: it
|
|
10912
|
+
* makes what the loader draws and answers the layer of the scene that holds it, whose container is drawn above the
|
|
10913
|
+
* veil from then until the swap. `undefined`, or a throw, draws the ring; a layer the scene does not declare draws
|
|
10914
|
+
* nothing.
|
|
10915
|
+
*
|
|
10916
|
+
* @returns The layer, or `undefined` for the ring.
|
|
10917
|
+
*/
|
|
10918
|
+
due?: () => string | undefined;
|
|
10919
|
+
};
|
|
10920
|
+
/**
|
|
10921
|
+
* What a scene switch shows over the scene being left: the veil, the loader, or both. A part left out is not drawn.
|
|
10922
|
+
*
|
|
10923
|
+
* @example
|
|
10924
|
+
* ```ts
|
|
10925
|
+
* // The default of `scenes`: the veil from the start, the engine's ring once the switch took 400 ms.
|
|
10926
|
+
* const look: LeaveLook = { cover: { color: 0x000000, alpha: 0.45, inMs: 150, outMs: 150 }, loader: { afterMs: 400 } };
|
|
10927
|
+
* ```
|
|
10928
|
+
*/
|
|
10929
|
+
type LeaveLook = {
|
|
10930
|
+
/** The veil; absent for none. */cover?: LeaveCover; /** The loader; absent for none. */
|
|
10931
|
+
loader?: LeaveLoader;
|
|
10932
|
+
};
|
|
10933
|
+
/**
|
|
10934
|
+
* The picture of a scene being left, `app.renderer.sync.leave` (spec 33, slice A2): a veil over the whole canvas and a
|
|
10935
|
+
* loader at its centre, drawn in a container of the engine above the root and every layer. `scenes` drives it: it
|
|
10936
|
+
* shows it at the start of a live switch, lands it at the swap and drops it on an abort. It takes no hit: the hit test
|
|
10937
|
+
* walks the layers of the scene only.
|
|
10938
|
+
*
|
|
10939
|
+
* @example
|
|
10940
|
+
* ```ts
|
|
10941
|
+
* // `scenes`, at the start of a switch from the ward, whose bundles are still loading.
|
|
10942
|
+
* const renderer = ctx.require(rendererPlugin);
|
|
10943
|
+
* renderer.sync.leave.show({ cover: { color: 0x000000, alpha: 0.45, inMs: 150, outMs: 150 }, loader: { afterMs: 400 } });
|
|
10944
|
+
* renderer.sync.leave.land(); // the board stands: the veil fades out over 150 ms, the ring is gone
|
|
10945
|
+
* ```
|
|
10946
|
+
*/
|
|
10947
|
+
type LeaveApi = {
|
|
10948
|
+
/**
|
|
10949
|
+
* Shows a look from now: the veil fades in from where it stands (0, or the level of a veil still fading out after
|
|
10950
|
+
* the last swap), the loader waits for its `afterMs`. A look shown while another runs replaces it. Asks for a frame.
|
|
10951
|
+
* Inert, nothing is drawn and nothing is kept.
|
|
10952
|
+
*
|
|
10953
|
+
* @param look - The veil and the loader, resolved.
|
|
10954
|
+
* @example
|
|
10955
|
+
* ```ts
|
|
10956
|
+
* // `scenes` leaves a scene whose `leave` names a turning texture: the veil from the next frame, the texture at 400 ms.
|
|
10957
|
+
* ctx.require(rendererPlugin).sync.leave.show({
|
|
10958
|
+
* cover: { color: 0x0b1020, alpha: 0.6, inMs: 150, outMs: 150 },
|
|
10959
|
+
* loader: { afterMs: 400, texture: "ui.loader.ring" }
|
|
10960
|
+
* });
|
|
10961
|
+
* ```
|
|
10962
|
+
*/
|
|
10963
|
+
show(look: LeaveLook): void;
|
|
10964
|
+
/**
|
|
10965
|
+
* The switch swapped the next scene in: the loader goes at once, the veil fades out over its `outMs` from where it
|
|
10966
|
+
* stands and is taken off the stage. Nothing runs: nothing happens.
|
|
10967
|
+
*
|
|
10968
|
+
* @example
|
|
10969
|
+
* ```ts
|
|
10970
|
+
* // `scenes`, right after the swap to the board: the board is drawn under the veil, which is gone 150 ms later.
|
|
10971
|
+
* ctx.require(rendererPlugin).sync.leave.land();
|
|
10972
|
+
* ```
|
|
10973
|
+
*/
|
|
10974
|
+
land(): void;
|
|
10975
|
+
/**
|
|
10976
|
+
* The switch ended without a swap (an abort, a throw): the veil and the loader go at once, in the next frame.
|
|
10977
|
+
* Nothing runs: nothing happens.
|
|
10978
|
+
*
|
|
10979
|
+
* @example
|
|
10980
|
+
* ```ts
|
|
10981
|
+
* // `scenes`, when a restore aborts the switch to the board: the ward stands as it was, undimmed.
|
|
10982
|
+
* ctx.require(rendererPlugin).sync.leave.drop();
|
|
10983
|
+
* ```
|
|
10984
|
+
*/
|
|
10985
|
+
drop(): void;
|
|
10986
|
+
};
|
|
10987
|
+
/**
|
|
10988
|
+
* The engine's objects of the picture of a scene being left, made once per application at the first step that needs
|
|
10989
|
+
* them and kept: `top` hangs on the stage above the root while a look runs; `veil` (the white texture, tinted) covers
|
|
10990
|
+
* the canvas; `frame` carries the root's transform, so `ring`, `spinner` and `held` (where a lifted layer hangs) are in
|
|
10991
|
+
* reference units. Not public.
|
|
10992
|
+
*/
|
|
10993
|
+
type LeaveObjects = {
|
|
10994
|
+
top: PixiContainer;
|
|
10995
|
+
veil: PixiSprite;
|
|
10996
|
+
frame: PixiContainer;
|
|
10997
|
+
ring: PixiGraphics;
|
|
10998
|
+
spinner: PixiSprite;
|
|
10999
|
+
held: PixiContainer;
|
|
11000
|
+
};
|
|
11001
|
+
/** What the loader of a running look draws once it is due. Not public. */
|
|
11002
|
+
type LoaderKind = "none" | "ring" | "texture" | "layer";
|
|
11003
|
+
/**
|
|
11004
|
+
* A running look: the moments it started and was last stepped at on the clock, the veil's level (0 to 1, the share of
|
|
11005
|
+
* its `alpha`), whether the swap came, what its loader draws and whether it shows, and the layer container it lifted
|
|
11006
|
+
* above the veil. Not public.
|
|
11007
|
+
*/
|
|
11008
|
+
type LeaveRun = {
|
|
11009
|
+
look: LeaveLook;
|
|
11010
|
+
startedAt: number;
|
|
11011
|
+
steppedAt: number;
|
|
11012
|
+
level: number;
|
|
11013
|
+
landed: boolean;
|
|
11014
|
+
loader: LoaderKind; /** The texture of a `"texture"` loader, resolved at `show`. */
|
|
11015
|
+
texture?: PixiTexture; /** A `"layer"` loader's `due` was called: once, the first frame it was due. */
|
|
11016
|
+
asked: boolean; /** The layer a `"layer"` loader's `due` answered; absent before. */
|
|
11017
|
+
layer?: string; /** The layer container a `"layer"` loader drew above the veil; absent while none hangs there. */
|
|
11018
|
+
lifted?: PixiContainer; /** The loader is shown: past its `afterMs`, before the swap. */
|
|
11019
|
+
shown: boolean;
|
|
11020
|
+
};
|
|
11021
|
+
/**
|
|
11022
|
+
* The picture of a scene being left (spec 33, slice A2): the running look, absent while none runs, and the engine's
|
|
11023
|
+
* objects, absent until the first look needs them and after the application that held them was lost. Not public.
|
|
11024
|
+
*/
|
|
11025
|
+
type LeaveState = {
|
|
11026
|
+
run?: LeaveRun;
|
|
11027
|
+
objects?: LeaveObjects;
|
|
11028
|
+
};
|
|
10877
11029
|
/**
|
|
10878
11030
|
* sync module API, `app.renderer.sync`. The one owner of every display object: it builds them
|
|
10879
11031
|
* from components, sorts them inside the named layers of the scene and answers hit tests.
|
|
@@ -11008,6 +11160,18 @@ type SyncApi = {
|
|
|
11008
11160
|
* ```
|
|
11009
11161
|
*/
|
|
11010
11162
|
filters: FiltersApi;
|
|
11163
|
+
/**
|
|
11164
|
+
* The picture of a scene being left: the veil and the loader `scenes` shows during a live switch.
|
|
11165
|
+
*
|
|
11166
|
+
* @example
|
|
11167
|
+
* ```ts
|
|
11168
|
+
* // `scenes`, at the start of a switch from the ward, and at the swap to the board.
|
|
11169
|
+
* const renderer = ctx.require(rendererPlugin);
|
|
11170
|
+
* renderer.sync.leave.show({ cover: { color: 0x000000, alpha: 0.45, inMs: 150, outMs: 150 }, loader: { afterMs: 400 } });
|
|
11171
|
+
* renderer.sync.leave.land(); // the veil fades out over the board in 150 ms
|
|
11172
|
+
* ```
|
|
11173
|
+
*/
|
|
11174
|
+
leave: LeaveApi;
|
|
11011
11175
|
/**
|
|
11012
11176
|
* The render passes of the frame, the number `stats().renderPasses` reports: 1 for the frame,
|
|
11013
11177
|
* plus, for every view in the tree with an enabled filter, 1 for its content and the passes of
|
|
@@ -11114,6 +11278,12 @@ type SyncInternal = {
|
|
|
11114
11278
|
*/
|
|
11115
11279
|
layerOf(entity: Entity): string | undefined; /** The overlays of this frame: modes, ranges, reasons, dims, HUD parts, and the pictures to take (spec 22). */
|
|
11116
11280
|
stepOverlays(): void;
|
|
11281
|
+
/**
|
|
11282
|
+
* The picture of a scene being left, for this frame (spec 33, slice A2): the veil's level from the clock, the loader
|
|
11283
|
+
* once due, both placed over the canvas as it stands; a frame is asked for while either moves. Run by the draw
|
|
11284
|
+
* callback before the decision. One field read and no allocation while no look runs.
|
|
11285
|
+
*/
|
|
11286
|
+
stepLeave(): void;
|
|
11117
11287
|
/**
|
|
11118
11288
|
* Hands Pixi again the filters of every view whose filters were switched on or off since they were written: Pixi
|
|
11119
11289
|
* holds only the enabled ones (E3). Run by the draw callback before anything reads the tree, so a switch is drawn in
|
|
@@ -11561,7 +11731,8 @@ type SyncState = {
|
|
|
11561
11731
|
passes: PassCount; /** The name of the scene's HUD layer (`above: "overlays"`), kept with the layers; `undefined` without one. */
|
|
11562
11732
|
hudLayer: string | undefined; /** The building entities waiting for their view (spec 31). */
|
|
11563
11733
|
aside: AsideQueue; /** The held tops of the scene build, attached in the pass after its commit (spec 31). */
|
|
11564
|
-
heldViews: HeldViews;
|
|
11734
|
+
heldViews: HeldViews; /** The picture of a scene being left: the running look and the engine's objects (spec 33, slice A2). */
|
|
11735
|
+
leave: LeaveState;
|
|
11565
11736
|
cleanups: Array<() => void>;
|
|
11566
11737
|
};
|
|
11567
11738
|
/**
|
|
@@ -11596,7 +11767,7 @@ type PassCount = {
|
|
|
11596
11767
|
enabled: boolean[];
|
|
11597
11768
|
};
|
|
11598
11769
|
declare namespace types_d_exports$1 {
|
|
11599
|
-
export { AnySceneProjection, CheckedProjections, Config$1 as Config, DefineScene, Deps$1 as Deps, Events$1 as Events, KernelSlice$1 as KernelSlice, LayerMap, RunContext, SceneBuild, SceneDefinition, SceneLayer, SceneOwner, SceneProjection, SceneSpec, SceneState, ScenesApi, ScenesCtx, SortRule, State$1 as State, UiLayer };
|
|
11770
|
+
export { AnySceneProjection, CheckedProjections, Config$1 as Config, DefineScene, Deps$1 as Deps, Events$1 as Events, FullCover, FullLeave, FullLoader, KernelSlice$1 as KernelSlice, LayerMap, Leaving, RunContext, SceneBuild, SceneCover, SceneDefinition, SceneLayer, SceneLeave, SceneLoader, SceneOwner, SceneProjection, SceneSpec, SceneState, ScenesApi, ScenesCtx, SortRule, State$1 as State, UiLayer };
|
|
11600
11771
|
}
|
|
11601
11772
|
/**
|
|
11602
11773
|
* How a layer orders what is drawn in it. The scene's name for the rule `world` stores.
|
|
@@ -11696,6 +11867,65 @@ type CheckedProjection<Layer extends string, Spec> = Spec extends {
|
|
|
11696
11867
|
* ```
|
|
11697
11868
|
*/
|
|
11698
11869
|
type CheckedProjections<Layer extends string, List> = { readonly [Index in keyof List]: CheckedProjection<Layer, List[Index]> };
|
|
11870
|
+
/**
|
|
11871
|
+
* The veil a live switch lays over the scene being left, from the switch start: a full-screen rect the engine draws
|
|
11872
|
+
* above every layer, fading from 0 to `alpha` over `inMs`; after the swap the next scene is under it and it fades out
|
|
11873
|
+
* over `outMs`. It takes no tap. A field left out keeps the one of the level below: the scene's over the config's over
|
|
11874
|
+
* the engine's.
|
|
11875
|
+
*
|
|
11876
|
+
* @example
|
|
11877
|
+
* ```ts
|
|
11878
|
+
* // A navy veil at 60 %, the engine's 150 ms in and out.
|
|
11879
|
+
* const cover: SceneCover = { color: 0x0b1020, alpha: 0.6 };
|
|
11880
|
+
* ```
|
|
11881
|
+
*/
|
|
11882
|
+
type SceneCover = {
|
|
11883
|
+
/** Colour of the veil, `0xRRGGBB`. Default `0x000000`. */color?: number; /** The alpha it fades in to, 0 to 1. Default 0.45. */
|
|
11884
|
+
alpha?: number; /** Milliseconds from 0 to `alpha`, from the switch start. Default 150. */
|
|
11885
|
+
inMs?: number; /** Milliseconds back to 0 after the swap. Default 150. */
|
|
11886
|
+
outMs?: number;
|
|
11887
|
+
};
|
|
11888
|
+
/**
|
|
11889
|
+
* What a live switch shows above the veil when it is not done `afterMs` after its start, until the swap: a game
|
|
11890
|
+
* texture turning at the centre (`texture`), a projection of the game drawn above the veil (`projection`), or, with
|
|
11891
|
+
* neither, a white ring the engine draws. `texture` and `projection` are one choice: a level that names either replaces
|
|
11892
|
+
* both of the level below, and with both named `projection` is drawn. A projection loader draws in a layer of its own
|
|
11893
|
+
* that the scene being left declares, mounted only once the loader is due: the whole layer is drawn above the veil
|
|
11894
|
+
* while the loader shows.
|
|
11895
|
+
*
|
|
11896
|
+
* @example
|
|
11897
|
+
* ```ts
|
|
11898
|
+
* // The game's ring texture, shown once the switch took 400 ms.
|
|
11899
|
+
* const loader: SceneLoader<"ui.loader.ring"> = { texture: "ui.loader.ring" };
|
|
11900
|
+
* // The game's own loading screen, the projection "loading" in the layer "loading", after 250 ms.
|
|
11901
|
+
* const screen: SceneLoader = { afterMs: 250, projection: "loading" };
|
|
11902
|
+
* ```
|
|
11903
|
+
*/
|
|
11904
|
+
type SceneLoader<Asset extends string = string> = {
|
|
11905
|
+
/** Milliseconds after the switch start the loader waits for. Default 400. */afterMs?: number; /** An asset key of the game: the texture turns at the centre of the frame. */
|
|
11906
|
+
texture?: Asset; /** The name of a registered projection: mounted once the loader is due, its layer drawn above the veil. */
|
|
11907
|
+
projection?: string;
|
|
11908
|
+
};
|
|
11909
|
+
/**
|
|
11910
|
+
* What a live switch shows over the scene being left: the veil and the loader. The scene being left decides: its
|
|
11911
|
+
* `leave` is merged field by field over `config.leave`, which is merged over the engine's default (`{ cover: { color:
|
|
11912
|
+
* 0x000000, alpha: 0.45, inMs: 150, outMs: 150 }, loader: { afterMs: 400 } }`). `false` turns a part or the whole off;
|
|
11913
|
+
* a part written over `false` starts from the engine's default. Fast mode, a headless app and the first scene of a run
|
|
11914
|
+
* show nothing.
|
|
11915
|
+
*
|
|
11916
|
+
* @example
|
|
11917
|
+
* ```ts
|
|
11918
|
+
* // The board leaves under a navy veil with the game's ring texture; the ward leaves with nothing at all.
|
|
11919
|
+
* const board: SceneLeave<"ui.loader.ring"> = { cover: { color: 0x0b1020, alpha: 0.6 }, loader: { texture: "ui.loader.ring" } };
|
|
11920
|
+
* const ward: SceneLeave = false;
|
|
11921
|
+
* // The veil without a loader.
|
|
11922
|
+
* const quiet: SceneLeave = { loader: false };
|
|
11923
|
+
* ```
|
|
11924
|
+
*/
|
|
11925
|
+
type SceneLeave<Asset extends string = string> = {
|
|
11926
|
+
cover?: SceneCover | false;
|
|
11927
|
+
loader?: SceneLoader<Asset> | false;
|
|
11928
|
+
} | false;
|
|
11699
11929
|
/**
|
|
11700
11930
|
* What the author passes to `defineScene`. The layer names come from the keys of `layers` plus
|
|
11701
11931
|
* the appended `ui`; `NoInfer` keeps `projections` out of that inference, so a wrong name is
|
|
@@ -11727,7 +11957,8 @@ type SceneSpec<Layers extends LayerMap, Projections extends readonly AnyScenePro
|
|
|
11727
11957
|
bundles?(state: SceneState<Player, Session>): readonly Bundle[];
|
|
11728
11958
|
layers: Layers;
|
|
11729
11959
|
projections: Projections & NoInfer<CheckedProjections<SceneLayer<Layers>, Projections>>;
|
|
11730
|
-
music?: Asset;
|
|
11960
|
+
music?: Asset; /** What a live switch shows over this scene when it is left: merged field by field over `config.leave`. */
|
|
11961
|
+
leave?: SceneLeave<Asset>;
|
|
11731
11962
|
};
|
|
11732
11963
|
/**
|
|
11733
11964
|
* The signature of `defineScene` bound to the asset and bundle keys and to the `Player` and
|
|
@@ -11762,7 +11993,8 @@ type SceneDefinition = {
|
|
|
11762
11993
|
* @param state - The committed `player` and `session`, frozen.
|
|
11763
11994
|
* @returns The bundle names the scene needs on top of `bundle`.
|
|
11764
11995
|
*/
|
|
11765
|
-
bundles?(state: SceneState): readonly string[];
|
|
11996
|
+
bundles?(state: SceneState): readonly string[]; /** What `defineScene` was given as `leave`; absent when the scene takes the config's. */
|
|
11997
|
+
readonly leave?: SceneLeave;
|
|
11766
11998
|
};
|
|
11767
11999
|
/**
|
|
11768
12000
|
* The committed state a scene's `bundles` reads: the frozen `player` and `session` of `model.store.snapshot()`, never a
|
|
@@ -11791,7 +12023,8 @@ type SceneOwner = Owner & {
|
|
|
11791
12023
|
name: "scenes";
|
|
11792
12024
|
};
|
|
11793
12025
|
/**
|
|
11794
|
-
* scenes plugin config. A scene is data in a feature; the
|
|
12026
|
+
* scenes plugin config. A scene is data in a feature; the keys are the budget of a live switch and what it shows over
|
|
12027
|
+
* the scene being left.
|
|
11795
12028
|
*
|
|
11796
12029
|
* @example
|
|
11797
12030
|
* ```ts
|
|
@@ -11800,6 +12033,9 @@ type SceneOwner = Owner & {
|
|
|
11800
12033
|
*
|
|
11801
12034
|
* // A game on a slow phone gives the next scene a fixed 3 ms of each frame: the switch takes more frames.
|
|
11802
12035
|
* const fixed: Config = { buildMs: 3 };
|
|
12036
|
+
*
|
|
12037
|
+
* // Every switch shows the veil and no loader.
|
|
12038
|
+
* const quiet: Config = { buildMs: "auto", leave: { loader: false } };
|
|
11803
12039
|
* ```
|
|
11804
12040
|
*/
|
|
11805
12041
|
type Config$1 = {
|
|
@@ -11809,6 +12045,23 @@ type Config$1 = {
|
|
|
11809
12045
|
* frame interval the loop runs at, `(1000 / time.rate().fps) * 2 / 3`, read once at the build start.
|
|
11810
12046
|
*/
|
|
11811
12047
|
buildMs: number | "auto";
|
|
12048
|
+
/**
|
|
12049
|
+
* What a live switch shows over the scene being left, for every scene; a scene's own `leave` is merged over it field
|
|
12050
|
+
* by field. A field left out keeps the engine's default, `{ cover: { color: 0x000000, alpha: 0.45, inMs: 150,
|
|
12051
|
+
* outMs: 150 }, loader: { afterMs: 400 } }`; `false` turns a part or the whole off.
|
|
12052
|
+
*
|
|
12053
|
+
* @example
|
|
12054
|
+
* ```ts
|
|
12055
|
+
* // The veil a little darker for every scene, and the game's ring texture after 300 ms instead of the white ring.
|
|
12056
|
+
* createApp({
|
|
12057
|
+
* plugins: [...screen, boardFeature],
|
|
12058
|
+
* pluginConfigs: { scenes: { leave: { cover: { alpha: 0.6 }, loader: { afterMs: 300, texture: "ui.loader.ring" } } } }
|
|
12059
|
+
* });
|
|
12060
|
+
* // No veil and no loader on any switch.
|
|
12061
|
+
* createApp({ plugins: [...screen, boardFeature], pluginConfigs: { scenes: { leave: false } } });
|
|
12062
|
+
* ```
|
|
12063
|
+
*/
|
|
12064
|
+
leave?: SceneLeave;
|
|
11812
12065
|
};
|
|
11813
12066
|
/**
|
|
11814
12067
|
* The running build of the next scene (spec 31): what the commit needs, and how to stop
|
|
@@ -11856,6 +12109,39 @@ type State$1 = {
|
|
|
11856
12109
|
* Absent otherwise: deleted, never written as `undefined`.
|
|
11857
12110
|
*/
|
|
11858
12111
|
build?: SceneBuild;
|
|
12112
|
+
/**
|
|
12113
|
+
* The veil and the loader of the running switch, from its start to its swap or its end without one. Absent
|
|
12114
|
+
* otherwise: deleted, never written as `undefined`.
|
|
12115
|
+
*/
|
|
12116
|
+
leaving?: Leaving;
|
|
12117
|
+
};
|
|
12118
|
+
/**
|
|
12119
|
+
* The veil and the loader a switch showed over the scene being left (spec 33, slice A2): whether they were taken down
|
|
12120
|
+
* already, the loader projection it mounted once its loader was due, and how to stop listening to the abort of its node.
|
|
12121
|
+
*/
|
|
12122
|
+
type Leaving = {
|
|
12123
|
+
/** Landed or dropped: a second end does nothing. */done: boolean; /** The loader projection the switch mounted, unmounted at the end; absent while it mounted none. */
|
|
12124
|
+
projection?: string; /** Removes the abort listener of the switch's node. */
|
|
12125
|
+
off: () => void;
|
|
12126
|
+
};
|
|
12127
|
+
/**
|
|
12128
|
+
* A veil with every field: what a level of `leave` resolves to.
|
|
12129
|
+
*/
|
|
12130
|
+
type FullCover = Required<SceneCover>;
|
|
12131
|
+
/**
|
|
12132
|
+
* A loader with its delay and at most one look: what a level of `leave` resolves to.
|
|
12133
|
+
*/
|
|
12134
|
+
type FullLoader = {
|
|
12135
|
+
afterMs: number;
|
|
12136
|
+
texture?: string;
|
|
12137
|
+
projection?: string;
|
|
12138
|
+
};
|
|
12139
|
+
/**
|
|
12140
|
+
* What a switch shows over the scene being left, every level merged: each part resolved or off.
|
|
12141
|
+
*/
|
|
12142
|
+
type FullLeave = {
|
|
12143
|
+
cover: FullCover | false;
|
|
12144
|
+
loader: FullLoader | false;
|
|
11859
12145
|
};
|
|
11860
12146
|
/**
|
|
11861
12147
|
* scenes plugin events.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { An as NumericFields, Cn as TagType, Dn as Motion, Dr as Json, En as Ease, In as ViewHandle, K as TransformValue, Ln as Api$1, Nn as ReducedMotion, On as MotionCause, Y as Api$3, _r as Answer, cn as AnyComponentType, dr as Descriptor, dt as ViewportSize, fn as ComponentType, hr as Hint, jn as ProjectionMotion, kn as MotionHandle, ln as AnyComponentValue, mn as Entity, nn as Api$2, qr as Api, ri as Require, s as Events$1, sn as AnyComponent, t as Api$4, vr as Api$5, wn as ChangeHook } from "./types-
|
|
1
|
+
import { An as NumericFields, Cn as TagType, Dn as Motion, Dr as Json, En as Ease, In as ViewHandle, K as TransformValue, Ln as Api$1, Nn as ReducedMotion, On as MotionCause, Y as Api$3, _r as Answer, cn as AnyComponentType, dr as Descriptor, dt as ViewportSize, fn as ComponentType, hr as Hint, jn as ProjectionMotion, kn as MotionHandle, ln as AnyComponentValue, mn as Entity, nn as Api$2, qr as Api, ri as Require, s as Events$1, sn as AnyComponent, t as Api$4, vr as Api$5, wn as ChangeHook } from "./types-DY_DRbGY.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,9 +1,9 @@
|
|
|
1
|
-
import { Vr as Api$3, Y as Api, nn as Api$1, vr as Api$4, wr as Api$2 } from "./types-
|
|
2
|
-
import { P as AnimApi, r as UiApi } from "./types-
|
|
3
|
-
import { N as InputApi } from "./types-
|
|
4
|
-
import { r as Repro } from "./headless-
|
|
5
|
-
import { a as InputOf, r as ControlApp } from "./types-
|
|
6
|
-
import { t as commands } from "./commands-
|
|
1
|
+
import { Vr as Api$3, Y as Api, nn as Api$1, vr as Api$4, wr as Api$2 } from "./types-DY_DRbGY.mjs";
|
|
2
|
+
import { P as AnimApi, r as UiApi } from "./types-CP22WjU9.mjs";
|
|
3
|
+
import { N as InputApi } from "./types-Dnh8LZxo.mjs";
|
|
4
|
+
import { r as Repro } from "./headless-CEwDAhgH.mjs";
|
|
5
|
+
import { a as InputOf, r as ControlApp } from "./types-CoTkzbEB.mjs";
|
|
6
|
+
import { t as commands } from "./commands-CvwzXCxM.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-
|
|
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-BcS4CTps.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
|
@@ -525,6 +525,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
|
|
|
525
525
|
- 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).
|
|
526
526
|
- 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" }>()`.
|
|
527
527
|
- 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.
|
|
528
|
+
- 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: 150, 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 mounted only once the loader is due, in a layer of its own the scene declares (no other projection of the scene may draw there); 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; types `SceneLeave`, `SceneCover`, `SceneLoader` (`Scenes`).
|
|
528
529
|
- 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`.
|
|
529
530
|
- `app.assets`: `load(bundle)`, `warm(bundle)` (loads it if needed, then puts its textures and atlas pages on the GPU through `renderer.sync.textures.upload`, `renderer.uploads` a drawn frame; joins a running or finished warm; an unload forgets it; resolves also when the renderer could not upload; headless at once), `unload(bundle)`, `isLoaded(bundle)`, `has(bundle)` (the manifest carries it, loaded or not), `texture(key)`, `font(key)`, `audio(key)`, `usage()`. Per bundle in a feature's `assets.ts`: `defineBundles({ ep01: { tier: "feature", release: "leave", mipmaps: ["items/**"] } })`. `release: "leave"` also unloads the bundle, with reason `"leave"`, at the next rest once nothing holds it: not pinned by the node entered, not named by the mounted scene, no node of its feature on the stack; a bundle the outgoing scene named leaves one rest later. The default `"budget"` leaves only under the texture budget. `mipmaps` (`true` or globs relative to `assets/`) uploads the textures with their full chain; such a texture stays loose in a pack. A sub-feature with resources gets its own bundles, named like its folder, with `dir` and `parent` in the manifest; a code-only one has none. The effect `ready(bundle | bundles)` (root export, also from `defineGame`) lets a node rest on a load and stay answerable: its handler (fast mode too) answers `true` headless, throws for an unknown bundle, answers `true` when every bundle is loaded and warmed or its last warm failed (`ctx.log.warn("assets:ready-failed", { bundle, error })`, cleared by a later successful load), otherwise starts `warm` for what is missing, answers `false` and posts `{ type: "ready" }` into `flow.inbox` once all of it settled. Recipe: a rest node `inbox: ["elapsed", "ready"]` with outcomes `ready` and `back`, and a transit node `if ((await fx(ready(list))) === false) return out.wait();`. `companions.add({ load(bundle), unload(bundle) })` adds what loads and unloads with every bundle; `i18n` adds the strings of a sub-feature that way, only when `assets` is composed. Events `assets:bundle-loaded`, `assets:bundle-progress`, `assets:bundle-unloaded` (`reason: "budget" | "request" | "leave"`), `assets:replaced` (dev). Config: `manifest`, `textureBudgetMb: 192`, `preloadDepth: 2`, `baseUrl`, `io`.
|
|
530
531
|
- `resource(name, defaults)` clones plain JSON defaults into every world. `resource(name, () => value)` calls the factory once per world on first read, so the value may hold a `Map` or a function: `const Looks = resource("boardLooks", () => ({ shown: new Map<World.Entity, { look: string }>() }))`. A system keeps its own state there; `snapshot()` leaves a value that is not JSON out.
|