@moku-labs/game 0.15.89 → 0.15.91
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/cli.mjs +3 -2
- package/dist/{commands-COLf1y-2.d.mts → commands-DUco80gt.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/{define-CegLUMAK.d.mts → define-C-EbeoLA.d.mts} +2 -2
- package/dist/{headless-DhNDRVXy.d.mts → headless-Dasz6dgy.d.mts} +1 -1
- package/dist/{index-B1bdw4B2.d.mts → index-vPc22SoP.d.mts} +3 -3
- package/dist/index.d.mts +5 -5
- 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-a9AK--Fj.d.mts → runtime-CW4HJWqC.d.mts} +1 -1
- package/dist/{src-CZSz-mMz.mjs → src-BBJh9Uxh.mjs} +790 -33
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +1 -1
- package/dist/{types-Fbq4snuX.d.mts → types-B2Dh7oWu.d.mts} +4 -4
- package/dist/{types-CXbcEveH.d.mts → types-BMUuyOcm.d.mts} +1 -1
- package/dist/{types-CJzm90e_.d.mts → types-Btqe51cJ.d.mts} +2 -2
- package/dist/{types-CgrPwBjC.d.mts → types-Cc7uKiHX.d.mts} +2 -2
- package/dist/{types--QXvRPXM.d.mts → types-D1lRinVJ.d.mts} +178 -3
- package/dist/{visual-xduW0Ojp.d.mts → visual-BMyWTUgm.d.mts} +6 -6
- package/dist/visual.d.mts +1 -1
- package/llms.txt +3 -2
- package/package.json +1 -1
package/dist/testing.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { An as
|
|
2
|
-
import { t as createApp } from "./index-
|
|
3
|
-
import { b as memory, x as saveOf, y as WithGameState } 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 { 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-
|
|
1
|
+
import { m as flattenFeatures, on as type, rn as exit, t as createApp, tn as refuseStart } from "./src-BBJh9Uxh.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
|
|
2
|
-
import { o as AudioContextLike, s as Config$4 } from "./types-
|
|
3
|
-
import { H as I18nApi, J as TextKey, q as StringTable } 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 { 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
|
|
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 {
|
|
2
|
-
import { t as HeadlessApp } from "./headless-
|
|
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 {
|
|
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-
|
|
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
|
-
*
|
|
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
|
/**
|
|
@@ -14398,4 +14573,4 @@ type BundleCompanion = {
|
|
|
14398
14573
|
unload(bundle: string): void;
|
|
14399
14574
|
};
|
|
14400
14575
|
//#endregion
|
|
14401
|
-
export { MonitorConfig as $,
|
|
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 {
|
|
2
|
-
import { P as AnimApi, r as UiApi } from "./types-
|
|
3
|
-
import { L as InputApi } from "./types-
|
|
4
|
-
import { r as Repro } from "./headless-
|
|
5
|
-
import { i as ControlApp, o as InputOf } from "./types-
|
|
6
|
-
import { t as commands } from "./commands-
|
|
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-
|
|
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
|
@@ -303,7 +303,7 @@ app.model.store.snapshot().session; // { rolls: 2 }
|
|
|
303
303
|
await run.stop();
|
|
304
304
|
```
|
|
305
305
|
|
|
306
|
-
`config.ts` keys and defaults: `page.title` (required, never empty), `page.lang` (`"en"`), `page.background` (`"#000000"`: the page behind the canvas, the `theme-color` meta and the native window; the canvas clear colour stays `pluginConfigs.renderer.background`), `page.orientation` (`"portrait"`, or `"landscape"`, `"any"`: the native build locks it), `page.icons: { favicon?, appleTouch? }` (files relative to the game, `<link>` tags), `page.head` (raw tags, verbatim), `page.boot: { image, width?, fadeMs? }` (absent by default; an `<img id="moku-boot">` centred over the canvas from the first paint until the first scene drew, then faded over `fadeMs`, `300`, and removed; `image` a file relative to the game, `width` `"40vmin"`), `native: { name, identifier, icon?, targets?, signing?, ios?, dev? }` (absent: no native build; `signing.android: { keystorePath, keystorePasswordEnv, keyPasswordEnv?, keyAlias }`, the path absolute, `~/...` or relative to the game, the passwords by env var name only; `signing.apple: { teamId }
|
|
306
|
+
`config.ts` keys and defaults: `page.title` (required, never empty), `page.lang` (`"en"`), `page.background` (`"#000000"`: the page behind the canvas, the `theme-color` meta and the native window; the canvas clear colour stays `pluginConfigs.renderer.background`), `page.orientation` (`"portrait"`, or `"landscape"`, `"any"`: the native build locks it), `page.icons: { favicon?, appleTouch? }` (files relative to the game, `<link>` tags), `page.head` (raw tags, verbatim), `page.boot: { image, width?, fadeMs? }` (absent by default; an `<img id="moku-boot">` centred over the canvas from the first paint until the first scene drew, then faded over `fadeMs`, `300`, and removed; `image` a file relative to the game, `width` `"40vmin"`), `native: { name, identifier, icon?, targets?, signing?, ios?, dev? }` (absent: no native build; `signing.android: { keystorePath, keystorePasswordEnv, keyPasswordEnv?, keyAlias }`, the path absolute, `~/...` or relative to the game, the passwords by env var name only; `signing.apple: { teamId }`, and an iOS store build signs from the command line with an App Store Connect team key in Tauri's env vars `APPLE_API_ISSUER` (the issuer id), `APPLE_API_KEY` (the key id) and `APPLE_API_KEY_PATH` (the `.p8` file, kept outside the repo): an Xcode account sign-in is not seen by `xcodebuild` on the command line, which fails with "No Accounts" and no provisioning profiles; `ios: { minimumVersion?, infoPlist?, privacyManifest? }`, the minimum `"26.0"` by default, `infoPlist` of `PlistValue`: strings, booleans, arrays, dictionaries, a number or `null` refused; the manifest relative to the game; `dev: { identifier, name?, icon? }`, the test app of `--store --dev`, the identifier ending in `.dev` and not `native.identifier`, `name` `"<name> DEV"` and `icon` `native.icon` by default), `system` (`[]`; names `lifecycle`, `back`, `haptics`, `keepAwake`, `store`), `save` (`"memory"`, or `"local"`, `"store"`), `assets.layers` (`{}`; `{ shared: "ui" }` becomes `--layer shared=ui`), `debug.overlay` (`"closed"`, or `"pill"`, `"open"`: how the editor's overlay shows when a debug page starts; the page calls `app.debug.overlay.open({ mode })` right after the agents started; only a page with the agent reads it). A refused value throws, for example `[game] config.save is "disk".` or `[game] config.system names "tray", which the game shell does not wire.`
|
|
307
307
|
|
|
308
308
|
```ts
|
|
309
309
|
// config.ts of a game in a native shell
|
|
@@ -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); }`.
|
|
@@ -597,7 +598,7 @@ A screen is a projection whose `view` returns JSX. The game's `tsconfig.json` se
|
|
|
597
598
|
- `defineComponent(name, { local?, outcomes?, view(props, local) })`. A component with `outcomes` is a popup: `await fx(popup(Component, props))` opens the gate for its outcomes and resolves with `{ intent, payload }` of the pressed button. A button with `local` writes into the nearest component instance; it never reaches the graph.
|
|
598
599
|
- `tr(key, params?)` returns a frozen `Message` `{ key, params }`; no locale is read at the call site. Strings live in `strings/<locale>.json` of any feature or sub-feature, as ICU MessageFormat 1 (`{n, plural, one {# order} other {# orders}}`, `select`, `selectordinal`, `number`, `date`, `time`; no skeletons, no `currency`). `bun run assets:keys` compiles them. The keys of the top-level features and the layers go into `generated/strings.<locale>.ts`, which one feature registers; a sub-feature's keys start with `<name>.` (`ep01.title`) and go into `generated/strings.<name>.<locale>.ts`, which the sub-feature registers lazily, `strings: { en: () => import("@generated/strings.ep01.en"), ru: () => import("@generated/strings.ep01.ru") }`. With `assets` composed those modules load and unload with the bundle named like the sub-feature: every way the bundle comes (a node entry, a scene's `bundles`, `load`, a restore, the `safeNode`) brings its strings, a locale switch brings them in the new locale, and while the bundle is not loaded a key of it gives `⟦key⟧` and `has(key)` is false. A compiled module calls the root helpers `messageArgument(value, intl)` (an element stays an element part, a list goes through `Intl.ListFormat`, a number through `Intl.NumberFormat`, else text) and `messageDuration(ms)` (`95_000` gives `{ minutes: 1, seconds: 35 }`). `app.i18n`: `locale()`, `setLocale(locale)` (async, emits `i18n:locale-changed`), `format(message, locale?)` returns `Part[]`, `plain(message)` returns a string, `has(key)`, `isKey(value)`, `locales()`, `replace(locale, messages)` (dev hot swap of a generated strings file). Config: `locale: "en"`, `fallback: "en"`, `locales: {}`.
|
|
599
600
|
- Keys that come from data: `I18n.TextKey<Strings>` is the keys of the generated `Strings` without parameters (nothing new is generated). A data table types its keys `TextKey` or builds them with the kit's `key("board.hint.red")`; the kit's `tr` never takes a plain `string`. A key read back from a save is checked where the app is (an effect handler, app or page code, loading a save) with one `isKey(value)`: `defineGameApp({ ..., strings: type<Strings>() })` types the game's `app.i18n`, so a true `app.i18n.isKey(value)` narrows the value to `TextKey`; `ctx.require(i18nPlugin).isKey(value)` in a plugin narrows to `string`. `app.i18n.isKey(value)` answers true for a key of the loaded tables of the current locale or the fallback, and for the `<feature>.` prefix of a sub-feature whose strings are not loaded yet; a key that takes parameters answers true too.
|
|
600
|
-
- Text: `Text` component, `label({ text, style, at, anchor? })` for board text in a projection view, `defineTextStyles({ "hud.digits": { font, size, fill, bold?, italic?, stroke?, strokeWidth?, letterSpacing?, align?, wrap? (a width, "none" or "box": wrap at the laid-out width of its ui element), digits?, lineHeight? (the line as a multiple of size above 0, such as 1.28; glyphs sit in the middle of the line; absent: the font's own line) } })` under the feature's `textStyles` key. Tags inside a string: `<b>`, `<i>`, `<color=#rrggbb>`, `<icon=key>`, `\<`, `\n`. Built-in styles `body` and `digits` from config `fonts: { body: "ui.font-body", digits: "ui.font-digits" }`. `app.text.measure(content, style, width?)` gives the same numbers in a browser and in Bun. `app.text.replaceStyles(styles)` is the dev hot swap of a saved `defineTextStyles` value. A game's own number format: `defineTextFormats({ "pill.number": value => ({ content, style }) })` under the feature's `textFormats` key, named by the `bind` of `defineGame` (`GameTypes.textFormats`): `bind(Counter, "value", { format: "pill.number" })`. It takes the whole value, is pure over value and language, is not called while the whole value and the locale stand, and owns `Text.style`; a `Countdown` calls it every frame. `app.text.formatted(name, value)` answers `{ text, style }`, `undefined` for an unknown or built-in name and for a format that threw. A saved module exporting formats reloads the page.
|
|
601
|
+
- Text: `Text` component, `label({ text, style, at, anchor? })` for board text in a projection view, `defineTextStyles({ "hud.digits": { font, size, fill, bold?, italic?, stroke?, strokeWidth?, letterSpacing?, align?, wrap? (a width, "none" or "box": wrap at the laid-out width of its ui element; lines break between words, after a hyphen inside a word and at a soft hyphen U+00AD, drawn as `-` only where the line breaks), digits?, lineHeight? (the line as a multiple of size above 0, such as 1.28; glyphs sit in the middle of the line; absent: the font's own line) } })` under the feature's `textStyles` key. Tags inside a string: `<b>`, `<i>`, `<color=#rrggbb>`, `<icon=key>`, `\<`, `\n`. Built-in styles `body` and `digits` from config `fonts: { body: "ui.font-body", digits: "ui.font-digits" }`. `app.text.measure(content, style, width?)` gives the same numbers in a browser and in Bun. `app.text.replaceStyles(styles)` is the dev hot swap of a saved `defineTextStyles` value. A game's own number format: `defineTextFormats({ "pill.number": value => ({ content, style }) })` under the feature's `textFormats` key, named by the `bind` of `defineGame` (`GameTypes.textFormats`): `bind(Counter, "value", { format: "pill.number" })`. It takes the whole value, is pure over value and language, is not called while the whole value and the locale stand, and owns `Text.style`; a `Countdown` calls it every frame. `app.text.formatted(name, value)` answers `{ text, style }`, `undefined` for an unknown or built-in name and for a format that threw. A saved module exporting formats reloads the page.
|
|
601
602
|
- Animation is data: `defineAnimation(id, { slots: { name: type<Anim.Target>() }, build: (slots, { at }) => Step })`. Steps: `sequence(...)`, `parallel(...)`, `stagger(items, ms, item => Step)`, `tween(target, Component, to, { ms, ease?, delayMs?, additive?, space?, reduced? })`, `set(target, Component, patch)`, `wait(ms)`, `mark(name)`, `frames(target, { keys, fps, loop? })`, `sfx(key, { bus? })`, `haptic(kind)`, `use(animation, slots, tools?)`, `spawn` (a temporary entity, flying coins, that the timeline despawns when it ends; see the anim README). `Frames({ keys, fps, loop, playing })` is a component that walks a sprite through its textures for the entity's whole life. A target is `{ projection, key }` or an entity. A timeline resolves each `{ projection, key }` target once, when it starts: every step writes the view that held the key then, also after a commit removed it and while its exit plays, until it despawns; a view spawned again under the same key is not followed, and a key nothing held at the start is looked up at its step. `reduced: "keep"` (on a `tween` step, `transition` and `loop` of `defineMotion`, `TweenOptions`, `RestOptions`) plays a track as written under reduced motion, a fade for one; the default `"cut"` lands it at once or holds a loop on its first key. A node plays it with `await fx(play(animation, slots))`; in fast mode it finishes at once. `defineMotion({ states, transition?, on: { enter?, exit?, change? }, when? })` builds the enter, exit and change hooks for a projection or the `motion` prop of a tag; `when: "change"` plays enter and exit only for a commit, so an element that comes or goes with its screen stands at rest and leaves without a motion (default `"always"`). Events `anim:mark` `{ animation, mark }` and `anim:finished` `{ animation }`. `app.anim.replace(definition)` is the dev hot swap: the next `play` builds the new tree. A system cannot `require` a plugin, so it plays through the resource `AnimPlayer`: `res(AnimPlayer).play(animation, slots)` returns the same handle as `app.anim.play`, and the registered animation of `animation.id` wins, so a hot swap reaches the system. Play on a change, never every frame; from phase `input` the tree moves in `animate` of the same frame. Before `anim` starts it throws `[game] AnimPlayer is not ready: anim has not started.` Config `maxTracks: 2000`.
|
|
602
603
|
- A `tween` step takes `segments` and `repeat` as `ViewHandle.tween` does: `tween(chest, Transform, { y: 0, scale: 0 }, { ms: 2400, additive: true, repeat: "forever", segments: [{ at: 0.08, ease: "out", to: { y: -14, scale: 0.06 } }, { at: 1, to: { y: 0, scale: 0 } }] })`. Segments walk over `ms` on one clock, `to` is where the last one ends, an additive walk names offsets; a number counts the extra runs. A definition error throws for empty segments, an `at` outside 0..1 or out of order, a last segment before 1, a bad repeat, and a `sequence` step after one that never ends. A forever step ends only by cancel or finish (a finish and a fast world land it on its start pose), does not play under reduced motion `"cut"`, writes nothing while its view is unseen, and lets the clock idle; a system plays it once through `AnimPlayer` and keeps the handle.
|
|
603
604
|
- Audio is opt-in: `plugins: [...screen, audioPlugin]`. `fx(sfx("orders.complete"))` resolves when the sound started. `await fx(music("board.theme"))` cross-fades; `music(null)` fades out; a scene's `music` key switches the track on `scenes:changed`. Buses `master`, `music`, `sfx`. Volumes come from the committed player: config `volumes: player => (player as Player).settings.audio`, applied on every `model:committed`. `app.audio`: `setVolume(bus, value)`, `volume(bus)`, `mute(bus, on)`, `muted(bus)`, `unlocked()`, `journal()` (the last started sounds, empty unless config `journal` is above 0). Config: `buses: { master: 1, music: 0.6, sfx: 1 }`, `musicFadeMs: 600`, `volumes`, `context`, `journal: 0`, `music: "decode" | "stream"` default `"decode"` (gapless buffer; `"stream"` is an `<audio>` element, less memory, a gap at every loop), `session: "ambient" | "playback" | "auto"` default `"ambient"` (iOS only: ambient mixes with other apps and obeys the silent switch). The context is asked to run at start: where the shell lets audio play (a native webview with the gesture requirement off) `unlocked()` is true with no touch; a browser that wants a gesture unlocks on the first `pointerdown` or `touchend`. Without `audio` every `sfx` and `music` effect resolves `undefined` at once, so the same node runs in a game with no sound. Named sounds: `sfx(key, { bus?, id?, fadeMs? })` with an `id` plays through its own gain, and the next sound with the same `id` fades the old one out over `fadeMs`, else config `sfxFadeMs` (default `120`, real milliseconds); `fx.start(stopSfx(id, { fadeMs? }))` and `app.audio.stop(id, { fadeMs? })` fade it out and end it (`fadeMs: 0` cuts it); an `id` nothing plays under changes nothing, and a sound of that `id` still decoding never starts. Without `id` an `sfx` plays to its end as before.
|