@moku-labs/game 0.15.93 → 0.15.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/app/page.d.mts +1 -1
  2. package/dist/app/page.mjs +1 -1
  3. package/dist/app/system.d.mts +3 -3
  4. package/dist/app.d.mts +3 -3
  5. package/dist/app.mjs +1 -1
  6. package/dist/assets.d.mts +1 -1
  7. package/dist/{commands-DUco80gt.d.mts → commands-DcGoU3wp.d.mts} +5 -5
  8. package/dist/control.d.mts +4 -4
  9. package/dist/{define-C-EbeoLA.d.mts → define-CZ1_l9Hn.d.mts} +2 -2
  10. package/dist/{headless-Dasz6dgy.d.mts → headless-9UyUfvF5.d.mts} +1 -1
  11. package/dist/{index-vPc22SoP.d.mts → index-B8XphAxo.d.mts} +26 -7
  12. package/dist/index.d.mts +5 -5
  13. package/dist/index.mjs +2 -2
  14. package/dist/inspect.d.mts +6 -6
  15. package/dist/inspect.mjs +1 -1
  16. package/dist/jsx-dev-runtime.d.mts +1 -1
  17. package/dist/jsx-runtime.d.mts +1 -1
  18. package/dist/{runtime-CW4HJWqC.d.mts → runtime-DsAz7KUU.d.mts} +1 -1
  19. package/dist/{sources-kL64Svgl.mjs → sources-DIl02J8z.mjs} +1 -1
  20. package/dist/{src-BBJh9Uxh.mjs → src-D-i4qig2.mjs} +180 -63
  21. package/dist/testing.d.mts +4 -4
  22. package/dist/testing.mjs +1 -1
  23. package/dist/{types-CNNxfAsF.d.mts → types-0QTB6RV7.d.mts} +4 -4
  24. package/dist/{types-Btqe51cJ.d.mts → types-B-n_yE-i.d.mts} +2 -2
  25. package/dist/{types-D1lRinVJ.d.mts → types-CenejHAB.d.mts} +33 -7
  26. package/dist/{types-BMUuyOcm.d.mts → types-D8tWWOCK.d.mts} +28 -7
  27. package/dist/{types-Cc7uKiHX.d.mts → types-Dhnc_iQk.d.mts} +7 -5
  28. package/dist/{visual-BMyWTUgm.d.mts → visual-B0ZwgkDL.d.mts} +6 -6
  29. package/dist/{visual-CULAJg6b.mjs → visual-Cl7Q7pO9.mjs} +4 -2
  30. package/dist/visual.d.mts +1 -1
  31. package/dist/visual.mjs +1 -1
  32. package/llms.txt +4 -3
  33. package/package.json +1 -1
@@ -4894,6 +4894,23 @@ type Answer<Intent extends string = string> = {
4894
4894
  intent: Intent;
4895
4895
  payload?: Json;
4896
4896
  };
4897
+ /**
4898
+ * What `await fx(descriptor)` resolves with for a descriptor that takes answers, a `popup` among
4899
+ * them: the gate's answer plus `at`, the moment of the answer in game ms of `clock`. `at` is read
4900
+ * when the answer arrives, in live mode and in a fast walk alike, so a replayed route gives the same
4901
+ * `at` for the same clock position. A payload-less answer stays without a `payload` key.
4902
+ *
4903
+ * @example
4904
+ * ```ts
4905
+ * // The popup opened at 60000; the player taps "again" 5 s later. The node is still at its own
4906
+ * // `now` of 60000, so it times the closing animation from the answer.
4907
+ * const answer = await fx(popup(Retry, {})); // { intent: "again", at: 65000 }
4908
+ * const until = answer.at + 780; // 65780: the close ends 780 ms after the tap
4909
+ * ```
4910
+ */
4911
+ type Answered<Intent extends string = string> = Answer<Intent> & {
4912
+ at: number;
4913
+ };
4897
4914
  /**
4898
4915
  * The one answer a `guide` lets through. `payload` is compared by deep equality when present.
4899
4916
  *
@@ -5284,7 +5301,7 @@ type FxApi = {
5284
5301
  * @example
5285
5302
  * ```ts
5286
5303
  * // Inside a node body: wait for the player's pick, then sparkle once the edge has committed.
5287
- * const pick = await fx(popup(Retry, {})); // Answer<"again" | "home">: { intent: "again" }
5304
+ * const pick = await fx(popup(Retry, {})); // Answered<"again" | "home">: { intent: "again", at: 65000 }
5288
5305
  * fx.emit(hint("sparkle", { cell: "c3" }));
5289
5306
  * ```
5290
5307
  */
@@ -6996,7 +7013,7 @@ declare function contribution<S extends SlotNode<OutcomeTags, string>, F extends
6996
7013
  when?: (snapshot: Snapshot) => boolean;
6997
7014
  }): Readonly<Record<S["name"], ContributionSpec>>;
6998
7015
  declare namespace types_d_exports$3 {
6999
- export { Allow, Answer, AnyFlow, AnyNode, AnyNodeContext, Api$2 as Api, Bookmark, BundlesOf, CheckedEdges, Config$3 as Config, Contribution, ContributionSpec, DefineNode, Deps$3 as Deps, Descriptor, Edges, Effect, EffectHandler, EffectOptions, EmitterIdOf, EnterCallback, Events$3 as Events, Exit, FeatureDescription, FeatureEmitter, FeatureFilter, FeaturePlugin, FeatureTextFormats, FeatureTree, FeaturesApi, FlowCtx, FlowDefinition, FlowEntry, FlowGraph, FlowKit, FlowSpec, FlowState, FxApi, FxHandler, GameState, GameTypes, GateApi, GraphError, GraphNode, GuideOptions, Hint, HudKeysOf, InboxApi, JournalEntry, KernelSlice$3 as KernelSlice, LifecycleChanged, Mapped, NodeContext, NodeDefinition, NodeFx, NodeInfo, NodeSpec, NodeTable, OutcomeTags, Position, RecoverContext, RegisteredFeature, Result, RouteStep, RunnerApi, SceneIdOf, SlotNode, Stage, State$3 as State, StringTableLike, Target, TextFormatsOf, TextStylesOf, TypeTag, WorldEvent };
7016
+ export { Allow, Answer, Answered, AnyFlow, AnyNode, AnyNodeContext, Api$2 as Api, Bookmark, BundlesOf, CheckedEdges, Config$3 as Config, Contribution, ContributionSpec, DefineNode, Deps$3 as Deps, Descriptor, Edges, Effect, EffectHandler, EffectOptions, EmitterIdOf, EnterCallback, Events$3 as Events, Exit, FeatureDescription, FeatureEmitter, FeatureFilter, FeaturePlugin, FeatureTextFormats, FeatureTree, FeaturesApi, FlowCtx, FlowDefinition, FlowEntry, FlowGraph, FlowKit, FlowSpec, FlowState, FxApi, FxHandler, GameState, GameTypes, GateApi, GraphError, GraphNode, GuideOptions, Hint, HudKeysOf, InboxApi, JournalEntry, KernelSlice$3 as KernelSlice, LifecycleChanged, Mapped, NodeContext, NodeDefinition, NodeFx, NodeInfo, NodeSpec, NodeTable, OutcomeTags, Position, RecoverContext, RegisteredFeature, Result, RouteStep, RunnerApi, SceneIdOf, SlotNode, Stage, State$3 as State, StringTableLike, Target, TextFormatsOf, TextStylesOf, TypeTag, WorldEvent };
7000
7017
  }
7001
7018
  /**
7002
7019
  * flow plugin events.
@@ -8784,7 +8801,8 @@ type FilterGlobals = {
8784
8801
  //#region src/plugins/renderer/kept/types.d.ts
8785
8802
  /**
8786
8803
  * What a slot's filter lets the cache do with it: `"local"` (kept anywhere), `"placed"` (kept with its canvas origin
8787
- * through `canvasPixel`), `"screen"` (drawn live).
8804
+ * through `canvasPixel`), `"screen"` (a body that reads the screen: its subtree picture is kept while the body runs on
8805
+ * its quad, on WebGPU; drawn live otherwise).
8788
8806
  *
8789
8807
  * @example
8790
8808
  * ```ts
@@ -8925,8 +8943,12 @@ type KeptRecord = {
8925
8943
  top: PixiContainer; /** True when the top was a render group before the cache rendered it (then it stays one at release). */
8926
8944
  wasGroup: boolean;
8927
8945
  mode: KeptMode; /** The slots last handed over by effects (sync/filters), the record's own copy of the reference. */
8928
- slots: readonly FilterSlot[]; /** "local" or "placed": the worst category of the enabled slots; a "screen" slot makes no record (P4.1). */
8929
- category: "local" | "placed"; /** Sprite(stage 1): carries the filters while kept (P3.3). */
8946
+ slots: readonly FilterSlot[];
8947
+ /**
8948
+ * The worst category of the slots (P4.1). A `"screen"` record is kept only on its quad, from its first take on, and
8949
+ * never leaves it at rest; a `"screen"` slot without a quad makes no record.
8950
+ */
8951
+ category: FilterCache; /** Sprite(stage 1): carries the filters while kept (P3.3). */
8930
8952
  standIn: PixiSprite | undefined; /** A second Sprite(stage 1) whose filters are [keeper] only (P3.2). */
8931
8953
  keeperStandIn: PixiSprite | undefined; /** Sprite(stage 3), in the tree beside the top; the mesh of `shade` while the record is shaded. */
8932
8954
  quad: KeptQuad | undefined; /** What the record draws through while shaded; made at its first entry, kept while the record lives. */
@@ -11628,7 +11650,11 @@ type FilterSlot = {
11628
11650
  filter: PixiFilter;
11629
11651
  passes: number; /** The filter kind id, for the performance log; optional: a slot without it counts as "other". */
11630
11652
  kind?: string; /** The stages of a filter's inputs and the seam of the kept-picture cache; filled by effects, left out by a game. */
11631
- inputs?: FilterSlotInputs; /** What the kept-picture cache may do with the filter; left out, it is `"screen"` (drawn live). */
11653
+ inputs?: FilterSlotInputs;
11654
+ /**
11655
+ * What the kept-picture cache may do with the filter; left out, the view is drawn live. A `"screen"` slot is kept only
11656
+ * on its `quad`: without one the view is drawn live too.
11657
+ */
11632
11658
  cache?: FilterCache; /** The filter's `keptOrigin` uniform, which the renderer sets to the canvas origin of a picture. */
11633
11659
  origin?: Float32Array;
11634
11660
  /**
@@ -14573,4 +14599,4 @@ type BundleCompanion = {
14573
14599
  unload(bundle: string): void;
14574
14600
  };
14575
14601
  //#endregion
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 };
14602
+ export { MonitorConfig as $, Ease as $n, StoreApi as $r, PerfStartupLine as $t, FilterSlotQuad as A, FeaturePlugin as An, Explained as Ar, OverlayWhat as At, Parent as B, SceneIdOf as Bn, Config$6 as Br, PerfCollectorLine as Bt, SceneSpec as C, contribution as Cn, QueryTerm as Cr, FrameReadout as Ct, DebugSwitches as D, to as Dn, TagType as Dr, MONITOR_SECTIONS as Dt, types_d_exports$1 as E, slot as En, SystemFor as Er, LongFrameEntry as Et, HudPartValue as F, FlowGraph as Fn, Config$5 as Fr, PassKind as Ft, SpriteOptions as G, GuideOptions as Gn, types_d_exports$6 as Gr, PerfGapLine as Gt, ShapeValue as H, Descriptor as Hn, Json as Hr, PerfDisplay as Ht, NineSlice$1 as I, FlowState as In, FakeClock as Ir, PassRecord as It, TransformValue as J, Answer as Jn, ProviderCall as Jr, PerfLongFrameLine as Jt, SpriteValue as K, Hint as Kn, Patch as Kr, PerfHeaderLine as Kt, NineSliceValue as L, JournalEntry as Ln, State$5 as Lr, PerfCause as Lt, WhyEntry as M, AnyFlow as Mn, types_d_exports$4 as Mr, PERF_GAP_BUCKETS as Mt, Display as N, Bookmark as Nn, Api$4 as Nr, PERF_LOG_VERSION as Nt, FilterSlot as O, type as On, Api$3 as Or, MonitorSections as Ot, HudPart as P, DefineNode as Pn, ClockSource as Pr, PROBLEM_RULES as Pt, Config$2 as Q, DescriptionNode as Qn, SnapshotOf as Qr, PerfSpikeLine as Qt, Overlay as R, NodeTable as Rn, types_d_exports$5 as Rr, PerfChange as Rt, SceneDefinition as S, types_d_exports$3 as Sn, Narrowed as Sr, FrameReadResult as St, State$1 as T, exit as Tn, SystemDefinition as Tr, FrameRing as Tt, Sprite as U, Effect as Un, Root as Ur, PerfEventLine as Ut, Shape as V, TypeTag as Vn, Events$5 as Vr, PerfCounts as Vt, SpriteBlend as W, EffectOptions as Wn, State$6 as Wr, PerfEventName as Wt, AdaptiveScale as X, AnchorTarget as Xn, SaveUnreadableError as Xr, PerfMeasured as Xt, sprite as Y, Answered as Yn, SaveDoc as Yr, PerfMarkLine as Yt, Api$1 as Z, ChangeHook as Zn, Snapshot as Zr, PerfSampleLine as Zt, AnySceneProjection as _, Events$8 as _i, HudKeysOf as _n, ComponentValue as _r, ViewportSize as _t, Config as a, PauseReason as ai, SHADER_WHATS as an, ProjectionSpec as ar, PixiUniformGroup as at, Events$1 as b, TextFormatsOf as bn, FrameDiff as br, WhyLive as bt, LoadBundles as c, Api$7 as ci, WarmDetail as cn, TrackOptions as cr, Under as ct, Manifest as d, RateChange as di, DEMAND_REASONS as dn, AnyComponent as dr, ShotsConfig as dt, RngApi as ei, PerfTelemetryLine as en, Motion as er, PixiFilter as et, ReadyBundles as f, State$8 as fi, Api$2 as fn, AnyComponentType as fr, Captured as ft, types_d_exports as g, Config$9 as gi, GameTypes as gn, ComponentType as gr, Point as gt, Usage as h, types_d_exports$8 as hi, EmitterIdOf as hn, ComponentSchema as hr, Orientation as ht, BundleSpec as i, Events$6 as ii, ProblemRule as in, ProjectionMotion as ir, PixiTexture as it, SyncApi as j, FeatureTree as jn, State$4 as jr, PERF_CAUSES as jt, FilterSlotInputs as k, FeatureDescription as kn, Config$4 as kr, OverlayEventDetail as kt, LoadReason as l, Config$8 as li, CANVAS_RESTARTS as ln, TrackSegment as lr, types_d_exports$2 as lt, Tier as m, Time as mi, Config$3 as mn, ComponentHandle as mr, RenderStats as mt, AssetsIo as n, Api$6 as ni, PoolTrimDetail as nn, MotionHandle as nr, PixiModule as nt, DefineBundles as o, State$7 as oi, ShaderEventDetail as on, ReducedMotion as or, PoolTrim as ot, State as p, ThermalReading as pi, BundlesOf as pn, AnyComponentValue as pr, MonitorCounts as pt, Transform as q, NodeFx as qn, PlayerStateProvider as qr, PerfLogLine as qt, BundleMap as r, Config$7 as ri, ProblemEventDetail as rn, NumericFields as rr, PixiSprite as rt, Events as s, types_d_exports$7 as si, ShaderWhat as sn, SceneSwitch as sr, State$2 as st, Api as t, RngState as ti, PerfThermalLine as tn, MotionCause as tr, PixiGpuProgram as tt, LoadResult as u, FrameRate as ui, CanvasRestart as un, ViewHandle as ur, ShotsApi as ut, Config$1 as v, Require as vi, Position as vn, Entity as vr, FilterCache as vt, ScenesApi as w, defineFlow as wn, ResourceType as wr, FrameRecord as wt, LayerMap as x, TextStylesOf as xn, Mut as xr, FrameColumns as xt, DefineScene as y, State$3 as yn, EntitySnapshot as yr, RetakeWhy as yt, OverlayValue as z, RouteStep as zn, Api$5 as zr, PerfChangeEntry as zt };
@@ -1,4 +1,4 @@
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";
1
+ import { $n as Ease, Dr as TagType, Hn as Descriptor, Hr as Json, J as TransformValue, Kn as Hint, Nr as Api$5, Or as Api$2, Xn as AnchorTarget, Yn as Answered, Z as Api$3, Zn as ChangeHook, _t as ViewportSize, ci as Api, dr as AnyComponent, er as Motion, fn as Api$1, fr as AnyComponentType, gr as ComponentType, ir as ProjectionMotion, nr as MotionHandle, or as ReducedMotion, pr as AnyComponentValue, rr as NumericFields, s as Events$1, t as Api$4, tr as MotionCause, ur as ViewHandle, vi as Require, vr as Entity } from "./types-CenejHAB.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";
@@ -1118,18 +1118,27 @@ type State$1 = {
1118
1118
  */
1119
1119
  type InputApi = {
1120
1120
  /**
1121
- * Reads the `Tappable` of a view and answers its intent.
1121
+ * Reads the `Tappable` of a view and answers its intent. On a view whose `Tappable` has
1122
+ * `point: true`, a given point is added to the payload under `point`, as the finger's press
1123
+ * point would be. It is already in the view's own units, the units of its hit box, and is used
1124
+ * as it is. Without a point, or on a view without the flag, the payload is answered unchanged,
1125
+ * with no `point` key: the keyboard taps of ui (Enter on the focused button, Escape) give none.
1122
1126
  *
1123
1127
  * @param target - The projection key of a live view, or an entity.
1128
+ * @param point - The press point in the view's own units; read only by a view with `point: true`.
1124
1129
  * @returns What `flow.gate.answer` returned: true when the gate took the answer.
1125
1130
  * @example
1126
1131
  * ```ts
1127
1132
  * // A hidden-object test finds one object without touching a pixel.
1128
1133
  * app.input.tap({ projection: "scene.objects", key: "lamp" });
1129
1134
  * // true: answers { intent: "found", payload: { id: "lamp" } }
1135
+ *
1136
+ * // A headless test taps the gift sphere (Tappable { intent: "kitTap", point: true }) at its left edge.
1137
+ * app.input.tap({ projection: "kit", key: "sphere" }, { x: 10, y: 60 });
1138
+ * // true: answers { intent: "kitTap", payload: { point: { x: 10, y: 60 } } }
1130
1139
  * ```
1131
1140
  */
1132
- tap(target: Target): boolean;
1141
+ tap(target: Target, point?: Point$1): boolean;
1133
1142
  /**
1134
1143
  * Reads the `Pressable` of a view and answers its intent, the way a long press would.
1135
1144
  *
@@ -2104,6 +2113,8 @@ type ButtonPayload = Json & Brand<"ButtonPayload">;
2104
2113
  type ButtonLocal = Record<string, unknown> & Brand<"ButtonLocal">;
2105
2114
  /** Makes a button the control the Escape key taps while its root is the top one. */
2106
2115
  type ButtonEscape = boolean & Brand<"ButtonEscape">;
2116
+ /** Asks a button that answers an intent to add the press point to its payload. */
2117
+ type ButtonPoint = boolean & Brand<"ButtonPoint">;
2107
2118
  /** What a text draws: a plain string, or a message of the game's string table. */
2108
2119
  type TextContent = (string | Message) & Brand<"TextContent">;
2109
2120
  /** The text style key, or a layout style when the built-in `body` is meant. */
@@ -2235,13 +2246,19 @@ type HostProps = CommonProps & {
2235
2246
  /**
2236
2247
  * What a button takes. `intent` and `local` exclude each other: a button either answers the gate
2237
2248
  * or writes local state. `escape` marks the control the Escape key taps: the close button or the
2238
- * backdrop of a dismissable popup.
2249
+ * backdrop of a dismissable popup. `point`, only beside `intent`, adds the press point of a finger
2250
+ * tap to the payload under `point`, in the button's own layout units: (0, 0) its top-left corner,
2251
+ * (width, height) its bottom-right, whatever its offset, scale or parent. A keyboard tap (Enter on
2252
+ * the focused button, Escape) has no press point and answers the payload as it is.
2239
2253
  *
2240
2254
  * @example
2241
2255
  * ```ts
2242
2256
  * const props: ButtonTagProps = { intent: "claim", payload: { orderId: "o1" } };
2243
2257
  * // The close button of the settings popup: Escape taps it while the popup is on top.
2244
2258
  * const close: ButtonTagProps = { intent: "close", escape: true };
2259
+ * // The gift sphere of 400 x 200, `<button intent="kitTap" point />`: a finger 10 in from its
2260
+ * // left edge and 150 down answers { intent: "kitTap", payload: { point: { x: 10, y: 150 } } }.
2261
+ * const sphere: ButtonTagProps = { intent: "kitTap", point: true };
2245
2262
  * ```
2246
2263
  */
2247
2264
  type ButtonTagProps = CommonProps & {
@@ -2249,10 +2266,12 @@ type ButtonTagProps = CommonProps & {
2249
2266
  } & ({
2250
2267
  intent?: ButtonIntent;
2251
2268
  payload?: ButtonPayload;
2269
+ point?: ButtonPoint;
2252
2270
  local?: never;
2253
2271
  } | {
2254
2272
  intent?: never;
2255
2273
  payload?: never;
2274
+ point?: never;
2256
2275
  local?: ButtonLocal;
2257
2276
  });
2258
2277
  /**
@@ -2568,7 +2587,8 @@ declare const ScrollState: ComponentType<{
2568
2587
  declare const DebugTrigger: TagType;
2569
2588
  /**
2570
2589
  * Builds the effect a node awaits to show a popup. The gate opens for the outcomes of the
2571
- * component, so the node resolves with the intent one of its buttons answered. `over` names the
2590
+ * component, so the node resolves with the intent one of its buttons answered, its payload, and
2591
+ * `at`: the clock moment the answer arrived, in game ms. `over` names the
2572
2592
  * component of a popup that stays mounted beneath this one, drawn covered, until this one is gone.
2573
2593
  *
2574
2594
  * @param component - A component declared with `outcomes`.
@@ -2584,7 +2604,8 @@ declare const DebugTrigger: TagType;
2584
2604
  * });
2585
2605
  * popup(Reward, { gold: 5 });
2586
2606
  * // { kind: "popup", payload: { component: "Reward", props: { gold: 5 } }, answers: ["claim"] }
2587
- * await fx(popup(Reward, { gold: 5 })); // Answer<"claim">: { intent: "claim" }
2607
+ * // The player claims 5 s after the popup opened at 60000.
2608
+ * await fx(popup(Reward, { gold: 5 })); // Answered<"claim">: { intent: "claim", at: 65000 }
2588
2609
  * ```
2589
2610
  * @example
2590
2611
  * ```ts
@@ -2600,7 +2621,7 @@ declare const DebugTrigger: TagType;
2600
2621
  */
2601
2622
  declare function popup<Properties extends object, Local extends object, Outcomes extends Record<string, unknown>>(component: PopupComponent<Properties, Local, Outcomes>, props: Properties, options?: {
2602
2623
  over?: string;
2603
- }): Descriptor<Answer<keyof Outcomes & string>>;
2624
+ }): Descriptor<Answered<keyof Outcomes & string>>;
2604
2625
  //#endregion
2605
2626
  //#region src/plugins/ui/layout/types.d.ts
2606
2627
  /**
@@ -1,5 +1,5 @@
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";
1
+ import { $n as Ease, A as FilterSlotQuad, Hn as Descriptor, Hr as Json, O as FilterSlot, Or as Api$3, Vn as TypeTag, Vr as Events$3, Xn as AnchorTarget, Z as Api$4, _i as Events$2, at as PixiUniformGroup, b as Events$4, ci as Api$1, cr as TrackOptions, dr as AnyComponent, et as PixiFilter, fn as Api$2, gr as ComponentType, gt as Point, ii as Events$5, it as PixiTexture, j as SyncApi, k as FilterSlotInputs, lr as TrackSegment, mr as ComponentHandle, nr as MotionHandle, nt as PixiModule, or as ReducedMotion, pr as AnyComponentValue, rr as NumericFields, rt as PixiSprite, s as Events$1, t as Api$5, tt as PixiGpuProgram, vi as Require, vr as Entity, vt as FilterCache, zr as Api$6 } from "./types-CenejHAB.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-D8tWWOCK.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
  import { PluginCtx } from "@moku-labs/core";
5
5
 
@@ -1475,9 +1475,11 @@ type FilterSpec<Uniforms extends Record<string, UniformDeclaration>> = {
1475
1475
  * default) keeps it as a picture, also while the view moves; `"placed"` keeps it with its canvas origin, for a body
1476
1476
  * that reads where it is drawn through `canvasPixel(uv)` (a body that calls the helper is placed by itself); set
1477
1477
  * `false` for a body whose look depends on where the view is drawn in a way the engine cannot see (a time read from
1478
- * a texture, a hash of the screen position): the view is then drawn live in every frame. A body that reads
1479
- * `uGlobalFrame`, `@builtin(position)`, `gl_FragCoord`, `uOutputTexture` or the origin of `uOutputFrame` and
1480
- * declares nothing is drawn live as well, and a dev build warns once: declare `cache: false`.
1478
+ * a texture, a hash of the screen position): no output of it is kept. On WebGPU the view's subtree picture is kept
1479
+ * and the body runs on its quad in every frame, the canvas place in `uOutputFrame.xy`; on WebGL, or when it does not
1480
+ * fit the quad, it is drawn live in every frame. A body that reads `uGlobalFrame`, `@builtin(position)`,
1481
+ * `gl_FragCoord`, `uOutputTexture` or the origin of `uOutputFrame` and declares nothing is treated as `false`, and a
1482
+ * dev build warns once: declare `cache: false`.
1481
1483
  */
1482
1484
  readonly cache?: "local" | "placed" | false;
1483
1485
  /**
@@ -1,9 +1,9 @@
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";
1
+ import { Nr as Api$4, Or as Api$1, Z as Api, ni as Api$3, zr as Api$2 } from "./types-CenejHAB.mjs";
2
+ import { P as AnimApi, r as UiApi } from "./types-Dhnc_iQk.mjs";
3
+ import { L as InputApi } from "./types-D8tWWOCK.mjs";
4
+ import { r as Repro } from "./headless-9UyUfvF5.mjs";
5
+ import { i as ControlApp, o as InputOf } from "./types-B-n_yE-i.mjs";
6
+ import { t as commands } from "./commands-DcGoU3wp.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. */
@@ -1208,7 +1208,8 @@ const UiCounters = /*#__PURE__*/ resource("UiCounters", {
1208
1208
  });
1209
1209
  /**
1210
1210
  * Builds the effect a node awaits to show a popup. The gate opens for the outcomes of the
1211
- * component, so the node resolves with the intent one of its buttons answered. `over` names the
1211
+ * component, so the node resolves with the intent one of its buttons answered, its payload, and
1212
+ * `at`: the clock moment the answer arrived, in game ms. `over` names the
1212
1213
  * component of a popup that stays mounted beneath this one, drawn covered, until this one is gone.
1213
1214
  *
1214
1215
  * @param component - A component declared with `outcomes`.
@@ -1224,7 +1225,8 @@ const UiCounters = /*#__PURE__*/ resource("UiCounters", {
1224
1225
  * });
1225
1226
  * popup(Reward, { gold: 5 });
1226
1227
  * // { kind: "popup", payload: { component: "Reward", props: { gold: 5 } }, answers: ["claim"] }
1227
- * await fx(popup(Reward, { gold: 5 })); // Answer<"claim">: { intent: "claim" }
1228
+ * // The player claims 5 s after the popup opened at 60000.
1229
+ * await fx(popup(Reward, { gold: 5 })); // Answered<"claim">: { intent: "claim", at: 65000 }
1228
1230
  * ```
1229
1231
  * @example
1230
1232
  * ```ts
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-BMyWTUgm.mjs";
1
+ import { a as VisualApp, c as VisualRenderer, d as VisualStart, f as VisualStep, h as VisualTolerance, i as CheckpointResult, l as VisualReport, m as VisualTestResult, n as runVisualTests, o as VisualOptions, p as VisualTest, r as defineVisualTest, s as VisualPage, t as parseVisualArgv, u as VisualSetup } from "./visual-B0ZwgkDL.mjs";
2
2
  export { type CheckpointResult, type VisualApp, type VisualOptions, type VisualPage, type VisualRenderer, type VisualReport, type VisualSetup, type VisualStart, type VisualStep, type VisualTest, type VisualTestResult, type VisualTolerance, defineVisualTest, parseVisualArgv, runVisualTests };
package/dist/visual.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as VISUAL_CLOCK } from "./fake-hnJcJeYf.mjs";
2
- import { n as read, t as sources } from "./sources-kL64Svgl.mjs";
2
+ import { n as read, t as sources } from "./sources-DIl02J8z.mjs";
3
3
  import { n as commands, t as run } from "./run-B5if0jxE.mjs";
4
4
  import path from "node:path";
5
5
  import { createBrandConsole } from "@moku-labs/common/cli";
package/llms.txt CHANGED
@@ -44,7 +44,7 @@ Root exports:
44
44
  - A pure wait ends in two ways. A gate answer whose `intent` is an outcome name: the answer payload becomes the outcome payload. Or a world event whose `type` is listed in the node's `inbox`: the event payload becomes the outcome payload.
45
45
  - Transition: rest node to rest node. It is a transaction. On an error the runner discards, rolls back to the last rest point, retries `retries` times, then enters `safeNode`. A failure inside `safeNode` rejects `run()`.
46
46
  - Three ways to run an effect in a node. `await fx(descriptor)`: the node waits for it. `fx.start(descriptor)`: it starts now and the node goes on; write it in place of `void fx(...)`. A failure of a started effect is the log entry `flow:fx-start-failed` and never fails the node. A `cosmetic` descriptor (`sfx`, `play`, `haptic`, `music`) that fails, awaited or started, is the warn entry `flow:fx-cosmetic-failed` with `{ kind, message }` and resolves `undefined`; a descriptor with `answers` and a `guide` are refused, they have to be awaited. `fx.emit(hint(...))`: released after the commit of the edge, dropped in fast mode.
47
- - `await fx(descriptor)` is typed by the descriptor (`Flow.Descriptor<Result>`): `schedule`, `guide`, `music`, `sfx`, `haptic`, `play` resolve `void`; `load` resolves `Assets.LoadResult | undefined` (`undefined` without `assets`, as in `game.headless()`); `ready` resolves `boolean | undefined` (`true` when every bundle is loaded and on the GPU, `undefined` without `assets`, so compare `=== false`); `popup(Component, props)` resolves `Flow.Answer<outcome names>`, so comparing it with an intent the component does not declare is a compile error; a descriptor written by hand resolves `unknown`. A game declares its own: `const envRead = defineEffect<{ notice: boolean }, EnvRead>("view-env.read", { fast: "run" })`, then `await fx(envRead({ notice: true }))` is `EnvRead` and `envRead.handle(ctx.require(flowPlugin).fx, payload => ...)` registers the one handler (returns the remover). Only `{ fast: "run" }` without `cosmetic` resolves `Result`; any other declaration resolves `Result | undefined`. `NodeFx` is generic: a hand-written fake is typed `as NodeFx`, or use `fakeFx`.
47
+ - `await fx(descriptor)` is typed by the descriptor (`Flow.Descriptor<Result>`): `schedule`, `guide`, `music`, `sfx`, `haptic`, `play` resolve `void`; `load` resolves `Assets.LoadResult | undefined` (`undefined` without `assets`, as in `game.headless()`); `ready` resolves `boolean | undefined` (`true` when every bundle is loaded and on the GPU, `undefined` without `assets`, so compare `=== false`); `popup(Component, props)` resolves `Flow.Answered<outcome names>`, `{ intent, payload?, at }` with `at` the `clock.now()` moment the answer arrived (live and in a fast walk alike), so comparing it with an intent the component does not declare is a compile error; a descriptor written by hand resolves `unknown`. A game declares its own: `const envRead = defineEffect<{ notice: boolean }, EnvRead>("view-env.read", { fast: "run" })`, then `await fx(envRead({ notice: true }))` is `EnvRead` and `envRead.handle(ctx.require(flowPlugin).fx, payload => ...)` registers the one handler (returns the remover). Only `{ fast: "run" }` without `cosmetic` resolves `Result`; any other declaration resolves `Result | undefined`. `NodeFx` is generic: a hand-written fake is typed `as NodeFx`, or use `fakeFx`.
48
48
  - Every failure is written into the log by the engine: an `error` entry `flow:error` with `{ path, rolledBackTo, retry, error: { message, stack } }`. Read it with `app.log.trace()`. A game needs no plugin for it.
49
49
  - `recover` on a rest node: `recover: async ({ player, session, rng, fx, signal, now }) => { ... }`. It runs only when the runner gave up on a transition and enters this node as `safeNode`, before the node is entered. The rollback left the state of the failed rest point; `recover` writes the drafts so the safe node can draw itself. What it wrote commits as one edge with `outcome: "recover"` and becomes the rest point. A `recover` that throws rejects `run()`. A retry does not run it. So the safe node stays a pure wait: no `run` body, no extra outcome, no self edge.
50
50
  - Entering a rest node calls `model.store.markRest()`: the save provider gets the patches. Leaving a `barrier` node calls `markBarrier(txId)`: a durable write, and rollback cannot cross it.
@@ -575,6 +575,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
575
575
  - `from(player, session, sw)`: the third argument is the switch another plugin last handed the projection with `projection.feed(name, sw)`, a `SceneSwitch` `{ from, to, progress }` (the scene left, the scene entered, `progress` 0 to 1), `undefined` for a projection never fed; a `from` with two parameters reads the state alone, as before. A loader reads it: `from: (_player, _session, sw: SceneSwitch | undefined) => ({ to: sw?.to ?? "", progress: sw?.progress ?? 0 })`. World README, "Feeding a projection".
576
576
  - `app.input.lock.window(rect | null | undefined)`: the input lock `ui` sets for a guide (`Input.LockWindow` = `{ x, y, w, h }` in reference units, kept by reference and written in place); a press outside reaches no view and answers `flow.gate.state().blocked` or nothing, a drop or trace sample outside finds nothing; `null` locks everything, `undefined` lifts it. The doors `tap`, `press`, `drag`, `swipe`, `trace` are never locked.
577
577
  - `input`: one followed pointer. A finger that has not started a gesture (pressed, inside the tap slop, no long press, no trace) gives way to the next finger that goes down, wherever it rests, and its press is cancelled; a finger that started a gesture keeps it. `Pointer.id` is the followed `pointerId` (`-1` at rest): a system that measures the finger's travel starts over when it changes.
578
+ - `Tappable({ intent, payload, point: true })`: a finger tap answers `{ intent, payload: { ...payload, point: { x, y } } }`, the press-down point in the view's own units (a ui `button` with `point`: (0, 0) its top-left corner); `app.input.tap(target, point?)` hands a point already in those units to a flagged view. No `point` key without the flag, without a point (Enter, Escape, `tap(target)`) or on a long press; `point` absent by default, so a `Tappable` serialises as before. Type: `TapValue` (the component's value, `IntentValue & { point?: true }`).
578
579
  - `Draggable({ payload, carry?, aim? })`: `aim: { x, y }`, a point of the view in its own units, moves the hover and the drop lookup from the finger to that point of the view in the hand; `null` (default) is the finger.
579
580
  - `pluginConfigs.renderer.onDemand: true` draws a frame only when something visible changed (a written view, a filter value, a resize, a wake, a capture); `app.renderer.stats().drawn` is the frames drawn per second (`fps` without it); a game that writes into its own `Display` object calls `app.renderer.invalidate(entity)` before the write; `renderer.sync.debug.verifyFrames(true)` (dev/debug) checks skipped frames by pixels and logs `renderer:missed-frame`; a dev build warns `renderer:missed-mark` for a write without the call.
580
581
  - `app.renderer.stats()` adds `textureMbSplit: { art, targets, kept }` (MiB). `app.renderer.host.resolution()` is the resolution drawn at: `override ?? min(devicePixelRatio, maxResolution)`; `maxResolution` is a number (default 2), a change of `devicePixelRatio` is followed from the next frame, and `app.renderer.monitor.setResolution(n | undefined)` overrides it in every build, the way to apply a player's graphics setting from an effect (0.5 to 4, else a `RangeError`).
@@ -593,9 +594,9 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
593
594
 
594
595
  A screen is a projection whose `view` returns JSX. The game's `tsconfig.json` sets `"jsx": "react-jsx"` and `"jsxImportSource": "@moku-labs/game"`; screens are `.tsx` files. There is no DOM and no React.
595
596
 
596
- - Tags: `screen`, `layer`, `row`, `column`, `stack`, `spacer`, `panel` (swallows taps), `image` (`texture`, `fit?: "contain" | "cover" | "fill"`), `icon` (`name`, `fit?`), `text` (`content: string | Message`, or `bind={bind(Counter, "value")}` with `components={[Counter({ value })]}`; formats `int`, `mm:ss`, `h:mm:ss`, `duration`; `Countdown({ until })` with `bind(Countdown, "left", { format: "mm:ss" })` counts down to a `clock` moment; `style` is a text style key), `button` (`intent` + `payload`, or `local`, never both), `scroll` (`axis?: "x" | "y"` (`"y"`), fixed at spawn, another one later warns `ui:scroll-axis-fixed`; children for a short list, laid out as a column on `y` and a row on `x`, or the windowed form `rows`, `rowHeight`, `overscan?` (5), `row: index => node`, on `y` only: `axis: "x"` with `rows` throws `[game] A windowed scroll moves on y only.`; row state belongs in the model, a row that leaves the window loses its local state; `snap?: number[]` stops in offsets, kept inside `0..max`: a release glides to the stop nearest `offset + v × 260` (v in units a ms) on `1 − (1 − p)³` over `min(620, 260 + distance × 1.1)` ms; without `snap` a release flings, `v ×= 0.998` a ms until under 0.02, 0 when the finger rested over 50 ms; `offset?: number` (0) where it stands from the start, drawn there in its first frame, a new value glides there, the same value does nothing; hard edges, nothing passes on to a parent scroll; a press on a child that leaves the tap slop along the scroll's axis goes to the scroll and the child answers nothing, a finger on a moving scroll only stops it; every number in `time.delta` ms, so a time scale applies; the public component `ScrollState { offset, max, moving }` on its entity, whole units `0..max`, written when it changes and once with `moving: false` when it stops, read by a system and by `game.explain`; `app.ui.scroll(key, to)` and the visual step `{ scroll: { key, to } }` set it at once), `input` (a text field; its text lives in the component's `local`, see the ui README), `anchor` (`to: AnchorTarget | AnchorTarget[]`, `AnchorTarget` = `{ projection, key }`, a ui element keyed under its root's projection; `pad?: number` (0) outward in its root's units: its rect is where its targets are drawn, the union of the shown ones, in the frame they are laid out, scrolled or moved, through fits, slots and ancestor motion, rotation left out; children lay out inside it; a `width`/`height`/`position` in its style is ignored (`ui:anchor-style`, dev); with no target shown it is drawn at alpha 0 and takes no tap, stays, and comes back with its target; `ui:anchor-target-missing` `{ key, to }` once (dev) after a key named nothing two frames in a row; a target inside the anchor is refused, `[game] An anchor cannot point at its own child "key".`; its `change.Box` motion plays only when its targets change (a new `to`, a key naming another entity), never on a follow, and a glide that runs is carried so it lands on the moving target; 0 B a frame still or following: `<anchor key="window" to={{ projection: "board.strip", key: "seat0" }} pad={4} motion={glide}>`). Common props: `key`, `style`, `state: { active?, disabled?, selected? }`, `motion`, `components` (extra component values for the element's entity, such as a filter: `components={[Glow({ strength: 2 })]}`, or `DebugTrigger()`: five taps within 3000 ms of wall time on that view call `app.debug.overlay.open()` on a page with the agent flag, nothing elsewhere; put it on a `button` naming nothing); containers take `hosts?: string[]` (projections drawn inside the element: world views hang under it from the slot's first frame; a JSX projection is laid out in the slot's content box). Children draw and are hit in markup order at equal `zIndex`; the roots of a scene draw in the order of its `projections` (the `ui` layer sorts by `Order`; `ui: { sort: "none" }` keeps insertion order). `defineMotion({ when: "change" })` plays its `enter` and `exit` only for a commit or a popup, never when its screen mounts or unmounts; declare a motion at module level (`ui:motion-rebuilt` names a loop rebuilt in a view). `motion.change` plays `Box` (the rects), `Transform` (the rest poses), the visual the element is drawn with (`Shape`, `Sprite`, `NineSlice`, `Text`, when a render or a restyle moves a number of it: `sweep`, `alpha`, `w`; a returned motion brings the numbers home from where they stand and the other fields land at once; the last motion of that name is cancelled first) and each extra of `components`, each as `(view, previous, next, hint)`; a dev build names any other `change` hook once, `ui:change-never-plays` `{ key, name }`. An element a render replaces (a root whose view returns another key or tag, a child of another key or tag) plays its exit with `"change"`, everything under it plays its own, and it leaves `find` at once, so the new element takes the keys they share. Style adds `nineSlice`, `tint`, `offsetX`, `offsetY`, `scale`, `origin`, `fit: "contain"`; state variants `is: { hover, pressed, disabled, active, selected, covered }`. `popup(Component, props, { over })` stacks a popup over a kept one.
597
+ - Tags: `screen`, `layer`, `row`, `column`, `stack`, `spacer`, `panel` (swallows taps), `image` (`texture`, `fit?: "contain" | "cover" | "fill"`), `icon` (`name`, `fit?`), `text` (`content: string | Message`, or `bind={bind(Counter, "value")}` with `components={[Counter({ value })]}`; formats `int`, `mm:ss`, `h:mm:ss`, `duration`; `Countdown({ until })` with `bind(Countdown, "left", { format: "mm:ss" })` counts down to a `clock` moment; `style` is a text style key), `button` (`intent` + `payload`, or `local`, never both; `point` beside `intent` adds `payload.point: { x, y }` of a finger tap, the press-down point in the button's own units, (0, 0) its top-left corner, absent for keyboard taps: `<button intent="kitTap" point />`), `scroll` (`axis?: "x" | "y"` (`"y"`), fixed at spawn, another one later warns `ui:scroll-axis-fixed`; children for a short list, laid out as a column on `y` and a row on `x`, or the windowed form `rows`, `rowHeight`, `overscan?` (5), `row: index => node`, on `y` only: `axis: "x"` with `rows` throws `[game] A windowed scroll moves on y only.`; row state belongs in the model, a row that leaves the window loses its local state; `snap?: number[]` stops in offsets, kept inside `0..max`: a release glides to the stop nearest `offset + v × 260` (v in units a ms) on `1 − (1 − p)³` over `min(620, 260 + distance × 1.1)` ms; without `snap` a release flings, `v ×= 0.998` a ms until under 0.02, 0 when the finger rested over 50 ms; `offset?: number` (0) where it stands from the start, drawn there in its first frame, a new value glides there, the same value does nothing; hard edges, nothing passes on to a parent scroll; a press on a child that leaves the tap slop along the scroll's axis goes to the scroll and the child answers nothing, a finger on a moving scroll only stops it; every number in `time.delta` ms, so a time scale applies; the public component `ScrollState { offset, max, moving }` on its entity, whole units `0..max`, written when it changes and once with `moving: false` when it stops, read by a system and by `game.explain`; `app.ui.scroll(key, to)` and the visual step `{ scroll: { key, to } }` set it at once), `input` (a text field; its text lives in the component's `local`, see the ui README), `anchor` (`to: AnchorTarget | AnchorTarget[]`, `AnchorTarget` = `{ projection, key }`, a ui element keyed under its root's projection; `pad?: number` (0) outward in its root's units: its rect is where its targets are drawn, the union of the shown ones, in the frame they are laid out, scrolled or moved, through fits, slots and ancestor motion, rotation left out; children lay out inside it; a `width`/`height`/`position` in its style is ignored (`ui:anchor-style`, dev); with no target shown it is drawn at alpha 0 and takes no tap, stays, and comes back with its target; `ui:anchor-target-missing` `{ key, to }` once (dev) after a key named nothing two frames in a row; a target inside the anchor is refused, `[game] An anchor cannot point at its own child "key".`; its `change.Box` motion plays only when its targets change (a new `to`, a key naming another entity), never on a follow, and a glide that runs is carried so it lands on the moving target; 0 B a frame still or following: `<anchor key="window" to={{ projection: "board.strip", key: "seat0" }} pad={4} motion={glide}>`). Common props: `key`, `style`, `state: { active?, disabled?, selected? }`, `motion`, `components` (extra component values for the element's entity, such as a filter: `components={[Glow({ strength: 2 })]}`, or `DebugTrigger()`: five taps within 3000 ms of wall time on that view call `app.debug.overlay.open()` on a page with the agent flag, nothing elsewhere; put it on a `button` naming nothing); containers take `hosts?: string[]` (projections drawn inside the element: world views hang under it from the slot's first frame; a JSX projection is laid out in the slot's content box). Children draw and are hit in markup order at equal `zIndex`; the roots of a scene draw in the order of its `projections` (the `ui` layer sorts by `Order`; `ui: { sort: "none" }` keeps insertion order). `defineMotion({ when: "change" })` plays its `enter` and `exit` only for a commit or a popup, never when its screen mounts or unmounts; declare a motion at module level (`ui:motion-rebuilt` names a loop rebuilt in a view). `motion.change` plays `Box` (the rects), `Transform` (the rest poses), the visual the element is drawn with (`Shape`, `Sprite`, `NineSlice`, `Text`, when a render or a restyle moves a number of it: `sweep`, `alpha`, `w`; a returned motion brings the numbers home from where they stand and the other fields land at once; the last motion of that name is cancelled first) and each extra of `components`, each as `(view, previous, next, hint)`; a dev build names any other `change` hook once, `ui:change-never-plays` `{ key, name }`. An element a render replaces (a root whose view returns another key or tag, a child of another key or tag) plays its exit with `"change"`, everything under it plays its own, and it leaves `find` at once, so the new element takes the keys they share. Style adds `nineSlice`, `tint`, `offsetX`, `offsetY`, `scale`, `origin`, `fit: "contain"`; state variants `is: { hover, pressed, disabled, active, selected, covered }`. `popup(Component, props, { over })` stacks a popup over a kept one.
597
598
  - Style vocabulary (`defineStyle`, plain data): flow `direction`, `wrap`, `justify`, `align`, `alignSelf`, `gap`, `grow`, `shrink`; box `padding`, `margin`, `width`, `height`, `minWidth`, `minHeight`, `maxWidth`, `maxHeight`, `aspect`, `overflow`; position `position`, `left`, `top`, `right`, `bottom`, `reason`; visual `fill`, `stroke`, `strokeWidth`, `radius`, `alpha`, `shape: "rect" | "triangle" | "arc"` (`"rect"`; a triangle fills the box pointing right; an arc is only a `stroke` of `strokeWidth` on the circle inscribed in the box, `min(width, height) − strokeWidth` across, from 12 o'clock clockwise over `sweep`), `dash` (dash length of the stroke, gaps of half a dash; not on an arc), `sweep` (0..1, default 1, clamped; 0 draws nothing, 1 a closed ring), `cap: "round" | "butt"` (`"round"`; the ends of an open arc); variants `is: { pressed?, disabled?, active?, selected? }` and `when: { portrait?, landscape?, tall?, wide? }`, each a partial style merged in when the flag holds. Lengths are reference units or `"safeArea.top" | "safeArea.right" | "safeArea.bottom" | "safeArea.left"`. No font size here: it comes from the text style.
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.
599
+ - `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, at }` of the pressed button, `at` the clock moment of the answer. A button with `local` writes into the nearest component instance; it never reaches the graph.
599
600
  - `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: {}`.
600
601
  - 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.
601
602
  - 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.93",
3
+ "version": "0.15.95",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [