@moku-labs/game 0.15.1 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { An as Api$1, At as ViewportSize, Br as Api, Cn as NumericFields, Kt as TransformValue, Sn as MotionHandle, T as Api$3, Xr as Require, Yt as Api$2, _n as ChangeHook, an as ComponentType, bn as Motion, br as Json, cr as Hint, dr as Api$5, en as AnyComponent, gn as TagType, ir as Descriptor, kn as ViewHandle, nn as AnyComponentValue, s as Events$1, sn as Entity, t as Api$4, tn as AnyComponentType, ur as Answer, wn as ProjectionMotion, xn as MotionCause } from "./types-E2ykwIUO.mjs";
1
+ import { Cn as MotionCause, En as ProjectionMotion, Hr as Api, Jt as TransformValue, Mn as Api$1, Mt as ViewportSize, Qr as Require, Sn as Motion, Sr as Json, T as Api$3, Tn as NumericFields, Zt as Api$2, fr as Answer, in as AnyComponentValue, jn as ViewHandle, ln as Entity, nn as AnyComponent, or as Descriptor, pr as Api$5, rn as AnyComponentType, s as Events$1, sn as ComponentType, t as Api$4, ur as Hint, vn as TagType, wn as MotionHandle, yn as ChangeHook } from "./types-BHgJ1F6f.mjs";
2
2
  import { Log } from "@moku-labs/common/browser";
3
3
  import { PluginCtx } from "@moku-labs/core";
4
4
 
@@ -1630,11 +1630,6 @@ type DrawnLabel = {
1630
1630
  /**
1631
1631
  * A dev warning that is written once per key. Pure modules take it as an argument, so nothing
1632
1632
  * below the plugin context reaches the log itself.
1633
- *
1634
- * @example
1635
- * ```ts
1636
- * const warn: Warn = (key, message) => seen.has(key) || log.warn(message);
1637
- * ```
1638
1633
  */
1639
1634
  type Warn = (key: string, message: string, data?: Record<string, unknown>) => void;
1640
1635
  /**
@@ -1651,18 +1646,21 @@ type LayoutOptions = {
1651
1646
  /**
1652
1647
  * What was resolved for one entity last, so the frame step knows whether anything moved. `unit`
1653
1648
  * is what the shown string of a bound label was built from: the rounded value for `"int"`, whole
1654
- * seconds for a time format.
1649
+ * seconds for a time format. `bindRef` is the bind object `bind` was keyed from, so the key is
1650
+ * built once per attached bind and a frame compares one reference.
1655
1651
  *
1656
1652
  * @example
1657
1653
  * ```ts
1654
+ * const left = bind(Countdown, "left", { format: "mm:ss" });
1658
1655
  * const seen: SeenText = {
1659
- * content: "", style: "digits", bind: "Countdown.left:mm:ss", locale: "ru", unit: 95
1656
+ * content: "", style: "digits", bindRef: left, bind: "Countdown.left:mm:ss", locale: "ru", unit: 95
1660
1657
  * };
1661
1658
  * ```
1662
1659
  */
1663
1660
  type SeenText = {
1664
1661
  content: unknown;
1665
1662
  style: string;
1663
+ bindRef: TextBind | undefined;
1666
1664
  bind: string | undefined;
1667
1665
  locale: string;
1668
1666
  unit: number | undefined;
@@ -2483,6 +2481,8 @@ type PopupLink = {
2483
2481
  * popup (its open is an event), the cause of its projection view otherwise, `"mount"` after a
2484
2482
  * restore or a load. `slot` is the host element the root is laid out in (`undefined` for the
2485
2483
  * viewport), `slotRect` the content box it was last solved in, in the host's own units.
2484
+ * `pending` is true while the solve running now still waits to lay the root out; `mountRoot`
2485
+ * creates it `false`.
2486
2486
  */
2487
2487
  type Root = {
2488
2488
  entity: Entity;
@@ -2503,6 +2503,7 @@ type Root = {
2503
2503
  w: number;
2504
2504
  h: number;
2505
2505
  } | undefined;
2506
+ pending?: boolean;
2506
2507
  };
2507
2508
  /**
2508
2509
  * Where the focus ring was last drawn: the layer and order of its root, the rect grown by the
@@ -2632,7 +2633,10 @@ type TextState = {
2632
2633
  * the element that hosts it; `fields` holds the text fields by entity. `hints` buffers the hints
2633
2634
  * released since the last frame step; `scrolls` holds the scroll containers; `windowRenders`
2634
2635
  * counts the re-renders of a windowed list its range made. `styled` and `written` count the style
2635
- * passes and the write passes of the reconcile, for `UiCounters`.
2636
+ * passes and the write passes of the reconcile, for `UiCounters`. `hostsVersion` moves on when a
2637
+ * host came, went, became live or was patched, and when a view lost its `Parent` or its `Held`;
2638
+ * `hostsSeen` and `membershipSeen` are that version and the world's membership version at the
2639
+ * last full hosting step, which runs again only when one of them moved.
2636
2640
  */
2637
2641
  type JsxState = {
2638
2642
  components: Map<string, AnyComponentDefinition>;
@@ -2644,7 +2648,10 @@ type JsxState = {
2644
2648
  exiting: Set<Entity>;
2645
2649
  removing: Set<Entity>;
2646
2650
  hosts: Set<Entity>;
2647
- hosted: Map<Entity, Entity>; /** The host elements that became live in this solve: the solve hosts their views in the same frame (spec 16 U2). */
2651
+ hosted: Map<Entity, Entity>;
2652
+ hostsVersion: number;
2653
+ hostsSeen: number;
2654
+ membershipSeen: number; /** The host elements that became live in this solve: the solve hosts their views in the same frame (spec 16 U2). */
2648
2655
  risen: Set<Entity>; /** The views the full hosting step of this frame took back from their host; their removal lands at the flush. */
2649
2656
  released: Set<Entity>; /** The cause the elements entered by the diff running now take: the root's for its first build, else `"change"`. */
2650
2657
  building: MotionCause | undefined;
@@ -1,7 +1,7 @@
1
- import { Ar as SnapshotOf, Dr as SaveDoc, E as Config$2, Er as ProviderCall, Jn as AnyFlow, Kn as FeaturePlugin, Mn as Config$1, Ot as Orientation, Tr as PlayerStateProvider, a as Config$3, br as Json, d as Manifest, fr as ClockSource, k as PixiModule, mr as FakeClock, n as AssetsIo, rr as TypeTag, vr as Config } from "./types-E2ykwIUO.mjs";
2
- import { o as AudioContextLike, s as Config$4 } from "./types-Bw-qLjFZ.mjs";
3
- import { H as TextKey, I as I18nApi, V as StringTable } from "./types-G3ZAAsbd.mjs";
4
- import { Ct as audioPlugin, bt as effectsPlugin, dt as platformPlugin, i as screen, pt as PlatformProvider, t as createApp } from "./index-CCiTo1_3.mjs";
1
+ import { At as Orientation, Dr as PlayerStateProvider, E as Config$2, Jn as FeaturePlugin, Mr as SnapshotOf, Or as ProviderCall, Pn as Config$1, Sr as Json, Xn as AnyFlow, a as Config$3, ar as TypeTag, br as Config, d as Manifest, gr as FakeClock, k as PixiModule, kr as SaveDoc, mr as ClockSource, n as AssetsIo } from "./types-BHgJ1F6f.mjs";
2
+ import { o as AudioContextLike, s as Config$4 } from "./types-fpFKYm6E.mjs";
3
+ import { H as TextKey, I as I18nApi, V as StringTable } from "./types-Bm7DVtA_.mjs";
4
+ import { Ct as audioPlugin, bt as effectsPlugin, dt as platformPlugin, i as screen, pt as PlatformProvider, t as createApp } from "./index-w2uyRKkj.mjs";
5
5
  import { AnyPluginInstance } from "@moku-labs/core";
6
6
 
7
7
  //#region src/plugins/model/store/providers/memory.d.ts
@@ -1,5 +1,5 @@
1
- import { A as PixiSprite, An as Api$2, Br as Api$1, Cn as NumericFields, Dn as TrackOptions, Dt as FilterSlotInputs, En as ReducedMotion, Et as FilterSlot, Ir as Events$5, O as PixiFilter, On as TrackSegment, Sn as MotionHandle, T as Api$4, Xr as Require, Yr as Events$2, Yt as Api$3, _r as Api$6, an as ComponentType, br as Json, en as AnyComponent, ir as Descriptor, j as PixiTexture, jt as FilterCache, k as PixiModule, kt as Point, nn as AnyComponentValue, rn as ComponentHandle, rr as TypeTag, s as Events$1, sn as Entity, t as Api$5, v as Events$4, yn as Ease, yr as Events$3 } from "./types-E2ykwIUO.mjs";
2
- import { I as I18nApi, J as StylesState, S as TextApi, c as UiNode, i as Finding, j as InputApi, n as ElementChange, o as JsxState, r as ElementMotion } from "./types-G3ZAAsbd.mjs";
1
+ import { A as PixiSprite, An as TrackSegment, Hr as Api$1, Mn as Api$2, Nt as FilterCache, O as PixiFilter, On as ReducedMotion, Ot as FilterSlot, Qr as Require, Rr as Events$5, Sr as Json, T as Api$4, Tn as NumericFields, Zr as Events$2, Zt as Api$3, an as ComponentHandle, ar as TypeTag, in as AnyComponentValue, j as PixiTexture, jt as Point, k as PixiModule, kn as TrackOptions, kt as FilterSlotInputs, ln as Entity, nn as AnyComponent, or as Descriptor, s as Events$1, sn as ComponentType, t as Api$5, v as Events$4, wn as MotionHandle, xn as Ease, xr as Events$3, yr as Api$6 } from "./types-BHgJ1F6f.mjs";
2
+ import { I as I18nApi, J as StylesState, S as TextApi, c as UiNode, i as Finding, j as InputApi, n as ElementChange, o as JsxState, r as ElementMotion } from "./types-Bm7DVtA_.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
  import { PluginCtx } from "@moku-labs/core";
5
5
  import { Node, Yoga } from "yoga-layout/load";
@@ -91,22 +91,15 @@ type Api = {
91
91
  * One running track: the numeric fields of one component of one entity moving from the values
92
92
  * read at the end of the delay to the exact target, straight or through keyframe segments. A
93
93
  * track with repeats walks again from its first segment each time a run ends.
94
- *
95
- * @example
96
- * ```ts
97
- * const track: Track = {
98
- * id: 1, entity: 1_048_576, component: Transform, to: { x: 200 },
99
- * keys: { x: "1048576:Transform:x" }, ms: 350, ease: "out", delayMs: 0, elapsed: 0,
100
- * from: undefined, muted: () => new Set(), additive: false, driven: false, bornFrame: 4,
101
- * ended: false, segments: undefined, repeatsLeft: 0, held: false, masked: new Set(), keep: false,
102
- * reveals: "place"
103
- * };
104
- * ```
105
94
  */
106
95
  type Track = {
107
96
  readonly id: number;
108
97
  readonly entity: Entity;
109
- readonly component: AnyComponent; /** The target fields. Retarget deletes the fields a newer absolute track took over. */
98
+ readonly component: AnyComponent;
99
+ /**
100
+ * The target fields. Retarget deletes the fields a newer absolute track took over. A frame reads
101
+ * the slots (`names`, `targets`, `live`) instead.
102
+ */
110
103
  to: Record<string, number>;
111
104
  /**
112
105
  * The key of the owner, bases and offsets tables per field, built once when the track starts.
@@ -116,8 +109,30 @@ type Track = {
116
109
  readonly ms: number;
117
110
  readonly ease: Ease;
118
111
  readonly delayMs: number;
119
- elapsed: number; /** Read when the delay ends, never earlier. */
120
- from: Record<string, number> | undefined;
112
+ /**
113
+ * `[0]`: the milliseconds the track has run, its delay included; `[1]`: the normalised time of
114
+ * the write that runs. Cells and not fields, so a frame writes them in place: a double stored in
115
+ * an object field is a new heap number.
116
+ */
117
+ readonly clock: Float64Array; /** True once the start values are read, when the delay ends, never earlier. */
118
+ begun: boolean; /** The target fields in slot order: every field `to` held when the track started. */
119
+ readonly names: readonly string[]; /** The key of each slot: the strings of `keys`, by slot. */
120
+ readonly slotKeys: readonly string[]; /** The target of each slot. */
121
+ readonly targets: Float64Array; /** The start value of each slot, read when the delay ends. */
122
+ readonly starts: Float64Array; /** `1` while the track drives the slot, `0` once a newer absolute track took its field. */
123
+ readonly live: Uint8Array; /** `1` for a slot the frame that runs moved: a write of only some fields reads it. */
124
+ readonly moved: Uint8Array;
125
+ /**
126
+ * Per slot, the numbers of the write that runs: first what the slot contributes, then what the
127
+ * field reads, the base plus every offset. Kept here so no number crosses a call boxed.
128
+ */
129
+ readonly values: Float64Array;
130
+ /**
131
+ * Per slot, the value this track last left in the field or found there, `NaN` while unknown: at
132
+ * the start and while another writer holds the field. A frame whose value moved off it writes
133
+ * without reading the field back.
134
+ */
135
+ readonly seen: Float64Array;
121
136
  readonly muted: () => ReadonlySet<string>;
122
137
  readonly additive: boolean; /** True for a track a timeline step advances by hand; the frame step leaves it alone. */
123
138
  readonly driven: boolean; /** The frame step the track was born in. That step does not advance it a second time. */
@@ -151,16 +166,16 @@ type Track = {
151
166
  * that cannot (a tint, a fill colour). Computed once when the track is made.
152
167
  */
153
168
  readonly reveals: "alpha" | "place" | "both" | undefined;
169
+ /**
170
+ * The patch the track writes, one per track with every field of `to` in it: a frame fills it in
171
+ * place instead of building one. A field the frame leaves alone carries its stored value back.
172
+ * Rebuilt when the track loses a field.
173
+ */
174
+ patch: Record<string, unknown>;
154
175
  };
155
176
  /**
156
177
  * A motion handle that can also be advanced by hand: what the timeline cursor needs, so a track
157
178
  * born inside a frame step still consumes the remainder of that step's delta.
158
- *
159
- * @example
160
- * ```ts
161
- * const motion: StepMotion = { ...inert, advance: () => 0 };
162
- * motion.advance(16); // 0: nothing is left over
163
- * ```
164
179
  */
165
180
  type StepMotion = MotionHandle & {
166
181
  /**
@@ -624,8 +639,12 @@ type ExternalPlayer = {
624
639
  type Cursor = {
625
640
  readonly step: Step;
626
641
  readonly children: readonly Cursor[]; /** Position in a `sequence`, and the last written key of a `frames` step. */
627
- index: number; /** Consumed milliseconds of a `wait` or a `frames` step. */
628
- elapsed: number;
642
+ index: number;
643
+ /**
644
+ * `[0]`: the consumed milliseconds of a `wait` or a `frames` step. A cell and not a field, so a
645
+ * frame writes it in place: a double stored in an object field is a new heap number.
646
+ */
647
+ readonly clock: Float64Array;
629
648
  motion: StepMotion | undefined;
630
649
  started: boolean;
631
650
  ended: boolean; /** The entity a running `frames` step holds against its `Frames` loop, until the step ends. */
@@ -720,6 +739,18 @@ type TimelineRuntime = {
720
739
  */
721
740
  releaseFrames(entity: Entity): void;
722
741
  };
742
+ /**
743
+ * What the cursor functions carry down the tree: the runtime, the animation id marks are
744
+ * reported under, the list of marks reached so far, the entities the timeline spawned, by id, and
745
+ * the entities its key targets named when it started.
746
+ */
747
+ type CursorCtx = {
748
+ /** The runtime of the frame step that walks the tree now. */rt: TimelineRuntime; /** Swapped for the nested id while a `use` step walks its tree, and set back after. */
749
+ animation: string;
750
+ readonly marks: string[];
751
+ readonly spawned: Map<string, Entity>; /** The entities the key targets named when the timeline started, by target object. */
752
+ readonly targets: ReadonlyMap<Target, Entity>;
753
+ };
723
754
  /**
724
755
  * One running timeline: its cursor, the marks it reached, the entities it counts on, the entities
725
756
  * its key targets named at its start, the entities it spawned and despawns at its end, and the
@@ -730,11 +761,12 @@ type RunningTimeline = {
730
761
  readonly animation: string;
731
762
  readonly cursor: Cursor;
732
763
  readonly marks: string[];
733
- readonly entities: readonly Entity[]; /** The entities its `{ projection, key }` targets named when it started, by target key. */
734
- readonly targets: ReadonlyMap<string, Entity>; /** The entities its `spawn` steps made, by spawn id. Despawned when the timeline ends. */
764
+ readonly entities: readonly Entity[]; /** The entities its `{ projection, key }` targets named when it started, by target object. */
765
+ readonly targets: ReadonlyMap<Target, Entity>; /** The entities its `spawn` steps made, by spawn id. Despawned when the timeline ends. */
735
766
  readonly spawned: Map<string, Entity>;
736
767
  readonly resolve: () => void;
737
- ended: boolean;
768
+ ended: boolean; /** The one cursor context of the timeline, made at its start and reused by every frame. */
769
+ readonly cctx: CursorCtx;
738
770
  };
739
771
  declare namespace types_d_exports$3 {
740
772
  export { AnimApi, AnimCtx, AnimPlayerValue, AnimationDefinition, AnimationSpec, AnyAnimationDefinition, BuildTools, Config$3 as Config, Cursor, Deps$3 as Deps, ErasedFields, Events, ExternalPlayer, FrameLoop, FramesValue, FxStep, HapticDescriptor, HapticKind, KernelSlice$3 as KernelSlice, MarkListener, MotionKeyframe, PlayDescriptor, PlayHandle, Pose, RunningTimeline, SfxDescriptor, SlotRecord, SlotTags, SlotValue, SlotValues, State$3 as State, Step, StepMotion, Target, TimelineRuntime, Track };
@@ -1002,17 +1034,35 @@ type Config$3 = {
1002
1034
  * offsets accumulator, the running timelines and the animation registry.
1003
1035
  */
1004
1036
  type State$3 = {
1005
- /** The one track table. Insertion order is advance order. */tracks: Map<number, Track>; /** Ids of tracks and timelines. */
1037
+ /** The one track table. Insertion order is advance order. */tracks: Map<number, Track>;
1038
+ /**
1039
+ * The tracks of the table in start order, as a dense list the frame step walks by index. An ended
1040
+ * track stays in it until the next frame step drops it.
1041
+ */
1042
+ trackList: Track[]; /** Ids of tracks and timelines. */
1006
1043
  nextId: number; /** `"<entity>:<component>:<field>"` to the id of the absolute track that drives the field. */
1007
- owner: Map<string, number>; /** Per field key, the delta each additive track contributes. */
1008
- offsets: Map<string, Map<number, number>>; /** Per field key, the value the offsets are added to. Dropped when no track drives the field. */
1009
- bases: Map<string, number>;
1044
+ owner: Map<string, number>;
1045
+ /**
1046
+ * Per field key, the delta each additive track contributes, in a one-number cell per track that
1047
+ * a frame writes in place.
1048
+ */
1049
+ offsets: Map<string, Map<number, Float64Array>>;
1050
+ /**
1051
+ * Per field key, the value the offsets are added to, in a one-number cell a frame writes in
1052
+ * place. Dropped when no track drives the field.
1053
+ */
1054
+ bases: Map<string, Float64Array>;
1010
1055
  /**
1011
1056
  * Per entity, its running additive tracks. `offsetsOf` of the driver reads it, so the cost of
1012
1057
  * one answer is the loops of that entity and not every track of the game.
1013
1058
  */
1014
1059
  additive: Map<Entity, Set<Track>>; /** The running timelines, by id. */
1015
- timelines: Map<number, RunningTimeline>; /** The `animations` of every feature, read in `onStart`. */
1060
+ timelines: Map<number, RunningTimeline>;
1061
+ /**
1062
+ * The timelines in start order, as a dense list the frame step walks by index. An ended timeline
1063
+ * stays in it until the next frame step drops it.
1064
+ */
1065
+ timelineList: RunningTimeline[]; /** The `animations` of every feature, read in `onStart`. */
1016
1066
  registry: Map<string, AnyAnimationDefinition>; /** `onMark` subscribers, in subscription order. */
1017
1067
  markListeners: Set<MarkListener>; /** Counter of the frame steps. A track born in the running step is not advanced by it. */
1018
1068
  frame: number; /** True while the track count is over `maxTracks`, so the warning is one per crossing. */
@@ -1702,29 +1752,34 @@ type FilterBody = {
1702
1752
  } | {
1703
1753
  readonly kind: "blur";
1704
1754
  readonly filter: InstanceType<PixiModule["BlurFilter"]>; /** The fields the setters were last given; compared before a write. */
1705
- readonly applied: Record<string, FilterField>;
1755
+ readonly applied: Record<string, FilterField>; /** The keys of `applied`, listed once: a compare walks them by index, with no `Object.keys` per frame. */
1756
+ readonly fields: readonly string[];
1706
1757
  passes: number;
1707
1758
  } | {
1708
1759
  readonly kind: "colorMatrix";
1709
1760
  readonly filter: InstanceType<PixiModule["ColorMatrixFilter"]>; /** The fields the setters were last given; compared before a write. */
1710
- readonly applied: Record<string, FilterField>;
1761
+ readonly applied: Record<string, FilterField>; /** The keys of `applied`, listed once: a compare walks them by index, with no `Object.keys` per frame. */
1762
+ readonly fields: readonly string[];
1711
1763
  passes: number;
1712
1764
  } | {
1713
1765
  readonly kind: "noise";
1714
1766
  readonly filter: InstanceType<PixiModule["NoiseFilter"]>; /** The fields the setters were last given; compared before a write. */
1715
- readonly applied: Record<string, FilterField>;
1767
+ readonly applied: Record<string, FilterField>; /** The keys of `applied`, listed once: a compare walks them by index, with no `Object.keys` per frame. */
1768
+ readonly fields: readonly string[];
1716
1769
  passes: number;
1717
1770
  } | {
1718
1771
  readonly kind: "displacement";
1719
1772
  readonly filter: InstanceType<PixiModule["DisplacementFilter"]>;
1720
1773
  readonly sprite: PixiSprite; /** The fields the setters were last given; compared before a write. */
1721
- readonly applied: Record<string, FilterField>; /** The asset key the map sprite shows now. */
1774
+ readonly applied: Record<string, FilterField>; /** The keys of `applied`, listed once: a compare walks them by index, with no `Object.keys` per frame. */
1775
+ readonly fields: readonly string[]; /** The asset key the map sprite shows now. */
1722
1776
  map: string;
1723
1777
  passes: number;
1724
1778
  } | {
1725
1779
  readonly kind: "alpha";
1726
1780
  readonly filter: InstanceType<PixiModule["AlphaFilter"]>; /** The fields the setters were last given; compared before a write. */
1727
- readonly applied: Record<string, FilterField>;
1781
+ readonly applied: Record<string, FilterField>; /** The keys of `applied`, listed once: a compare walks them by index, with no `Object.keys` per frame. */
1782
+ readonly fields: readonly string[];
1728
1783
  passes: number;
1729
1784
  };
1730
1785
  /**
@@ -1758,6 +1813,11 @@ type FilterInstance = FilterBody & {
1758
1813
  readonly kindId: string; /** True for an instance that draws in place of a broken kind or instance (E5). */
1759
1814
  readonly standIn: boolean; /** A stand-in built while this broken instance was drawing; the next sync puts it in its place. */
1760
1815
  replacement: FilterInstance | undefined;
1816
+ /**
1817
+ * The entity of the view it draws on, set when the filter sync takes it in; 0 for a warm-up probe. A break inside a
1818
+ * render tells the renderer about this view (`renderer.invalidate`) before it switches the filter off.
1819
+ */
1820
+ entity: Entity;
1761
1821
  };
1762
1822
  /**
1763
1823
  * One of our bodies: a `Filter` over the assembled programs, the kind of every place of a chain and of a mark.
@@ -1815,21 +1875,48 @@ type CheckState = {
1815
1875
  /**
1816
1876
  * What the filter sync keeps for one entity: the kinds it carries, one instance per kind, the
1817
1877
  * instances waiting to be destroyed after the next assignment, the slots last handed to
1818
- * `renderer.sync.filters.set`, the core kinds whose component changed this frame, the
1819
- * instances of this frame in their sorted order (one array, reused every frame), and the one
1820
- * `renderer.invalidate` call a visible filter write of the frame makes.
1878
+ * `renderer.sync.filters.set`, the run in which each core kind's component last changed, the
1879
+ * instances of this frame in their sorted order (one array, reused every frame), the one
1880
+ * `renderer.invalidate` call a visible filter write of the frame makes, and whether the next run
1881
+ * syncs it.
1821
1882
  */
1822
1883
  type FilteredView = {
1884
+ /** The entity the record is kept for. */readonly entity: Entity;
1823
1885
  readonly kinds: Set<string>;
1824
1886
  readonly instances: Map<string, FilterInstance>;
1825
1887
  readonly retired: FilterInstance[];
1826
1888
  assigned: readonly FilterSlot[];
1827
- readonly changed: Set<string>;
1889
+ /**
1890
+ * Per kind `index`, the run of the filter sync in which its component was last seen changed; read only for a
1891
+ * Pixi-core kind, which is written only in such a run. A number per kind, so marking allocates nothing.
1892
+ */
1893
+ readonly marks: number[];
1828
1894
  readonly placed: FilterInstance[]; /** True once `renderer.invalidate` was called for this view in the current frame. */
1829
1895
  signalled: boolean; /** Calls `renderer.invalidate(entity)` once per frame for this view, before the write; made once with the record. */
1830
1896
  readonly signal: () => void; /** The area last handed to `renderer.sync.filters.area`, written in place (B4). */
1831
1897
  readonly areaSent: AreaBox; /** The `enabled` switches of the placed instances when the area was last judged, one bit each in placed order. */
1832
1898
  areaMask: number;
1899
+ /**
1900
+ * The next run of the filter sync brings the view up to date: a filter component of it changed, came or left, its
1901
+ * map was retired, a kind of it still waits for its instance, or a chain left places to destroy.
1902
+ */
1903
+ dirty: boolean; /** Forgotten: out of `State.views`; the next run drops it from `State.viewList`. */
1904
+ gone: boolean;
1905
+ };
1906
+ /**
1907
+ * Where the filter sync stands between two runs. It syncs only the views marked dirty, and judges the full-screen
1908
+ * budget only when something it depends on moved.
1909
+ */
1910
+ type FilterSyncState = {
1911
+ /** The current run, counted from 1: a core kind's change mark holds the run it was made in. */round: number;
1912
+ /**
1913
+ * Every view syncs at the next run: a debug switch turned a kind off or on, or a filter broke or ran its chains at a
1914
+ * new resolution inside a render, where the view it belongs to is not known.
1915
+ */
1916
+ all: boolean; /** A view was marked dirty or forgotten since the last walk: the next run walks the dense list, otherwise it skips it. */
1917
+ pending: boolean; /** The viewport width the full-screen budget was last judged at; -1 before the first judgement. */
1918
+ width: number; /** The viewport height the full-screen budget was last judged at; -1 before the first judgement. */
1919
+ height: number;
1833
1920
  };
1834
1921
  //#endregion
1835
1922
  //#region src/plugins/effects/particles/types.d.ts
@@ -1973,7 +2060,12 @@ type BakedEmitter = {
1973
2060
  readonly config: ResolvedEmitterConfig; /** Scale per 1/64 of the life. */
1974
2061
  readonly scaleTable: Float32Array; /** Alpha per 1/64 of the life, 0..1. */
1975
2062
  readonly alphaTable: Float32Array; /** Tint per 1/64 of the life, packed as Pixi's `0xbbggrr`. */
1976
- readonly tintTable: Uint32Array; /** Half side of the box no particle leaves, in reference units. */
2063
+ readonly tintTable: Uint32Array;
2064
+ /**
2065
+ * The colour a particle is drawn with per 1/64 of the life, packed as Pixi's `0xaabbggrr`: the tint under the alpha
2066
+ * byte. Read straight from the table every frame: a number above the small integers handed back by a call is boxed.
2067
+ */
2068
+ readonly colorTable: Uint32Array; /** Half side of the box no particle leaves, in reference units. */
1977
2069
  readonly reach: number;
1978
2070
  readonly textures: readonly PixiTexture[]; /** The texture source of the first texture: every texture of the effect samples it. */
1979
2071
  readonly source: PixiTexture["source"] | undefined; /** The largest side of the textures, in pixels. */
@@ -2052,7 +2144,14 @@ type State$2 = {
2052
2144
  ready: Set<string>; /** The filter kinds, built-ins first, then the filters of every feature. */
2053
2145
  kinds: Map<string, FilterKind>; /** The shader check of every definition a kind can draw, in every build. */
2054
2146
  checks: CheckState; /** Entity to the filters the sync keeps for it. */
2055
- views: Map<Entity, FilteredView>; /** Keys of the one-shot warnings: `"emitter:fx.x"`, `"texture:board.cell"`, `"atlas:fx.x"`. */
2147
+ views: Map<Entity, FilteredView>;
2148
+ /**
2149
+ * The records of `views` in the order they were first seen: the dense list the filter sync walks by index. A
2150
+ * forgotten record stays, `gone`, until the next run drops it.
2151
+ */
2152
+ viewList: FilteredView[]; /** The filter kinds in registration order, one per `index`: the change sets the filter sync reads, by index. */
2153
+ kindList: FilterKind[]; /** Where the filter sync stands between two runs. */
2154
+ filterSync: FilterSyncState; /** Keys of the one-shot warnings: `"emitter:fx.x"`, `"texture:board.cell"`, `"atlas:fx.x"`. */
2056
2155
  warned: Set<string>; /** Whether each budget warning is in force, so a crossing warns once. */
2057
2156
  over: {
2058
2157
  particles: boolean;
@@ -1,5 +1,5 @@
1
- import { br as Json, kr as Snapshot } from "./types-E2ykwIUO.mjs";
2
- import { t as HeadlessApp } from "./headless-B0mH9qYg.mjs";
1
+ import { Sr as Json, jr as Snapshot } from "./types-BHgJ1F6f.mjs";
2
+ import { t as HeadlessApp } from "./headless-D6BrEwCf.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
 
5
5
  //#region src/plugins/flow/doors/types.d.ts
@@ -1,9 +1,9 @@
1
- import { Pr as Api$3, T as Api, Yt as Api$1, _r as Api$2 } from "./types-E2ykwIUO.mjs";
2
- import { P as AnimApi, r as UiApi } from "./types-Bw-qLjFZ.mjs";
3
- import { j as InputApi } from "./types-G3ZAAsbd.mjs";
4
- import { r as Repro } from "./headless-B0mH9qYg.mjs";
5
- import { a as InputOf, r as ControlApp } from "./types-D44EL4gT.mjs";
6
- import { t as commands } from "./commands-BynjWVVy.mjs";
1
+ import { Ir as Api$3, T as Api, Zt as Api$1, yr as Api$2 } from "./types-BHgJ1F6f.mjs";
2
+ import { P as AnimApi, r as UiApi } from "./types-fpFKYm6E.mjs";
3
+ import { j as InputApi } from "./types-Bm7DVtA_.mjs";
4
+ import { r as Repro } from "./headless-D6BrEwCf.mjs";
5
+ import { a as InputOf, r as ControlApp } from "./types-jiWJhLPE.mjs";
6
+ import { t as commands } from "./commands-C_GccOFq.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-DoHwXeQi.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-BvkKJOSz.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.1",
3
+ "version": "0.15.2",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -102,10 +102,12 @@
102
102
  "lint:fix": "biome check --write . && eslint --fix .",
103
103
  "format": "biome format --write .",
104
104
  "typecheck": "tsc --noEmit && tsc --noEmit -p tests/fixtures/episodes-game",
105
- "test": "bun --bun vitest run",
105
+ "test": "bun --bun vitest run --project unit --project integration",
106
106
  "test:unit": "bun --bun vitest run --project unit",
107
107
  "test:integration": "bun --bun vitest run --project integration",
108
108
  "test:coverage": "bun --bun vitest run --project unit --project integration --coverage",
109
+ "test:perf": "node ./node_modules/vitest/vitest.mjs run --project perf",
110
+ "bench:perf": "node ./node_modules/vitest/vitest.mjs bench --run --project perf",
109
111
  "build": "tsdown",
110
112
  "mini:pack": "bun tests/fixtures/moku-game.ts pack --root tests/fixtures/mini-game",
111
113
  "mini:dev": "bun tests/fixtures/moku-game.ts dev --root tests/fixtures/mini-game",