@moku-labs/game 0.15.105 → 0.15.106

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 { h as StartedPage, r as GameConfig, t as AnyGameApp, u as PageOptions } from "../types-COMxJbej.mjs";
1
+ import { h as StartedPage, r as GameConfig, t as AnyGameApp, u as PageOptions } from "../types-BXfauLJW.mjs";
2
2
 
3
3
  //#region src/app/page.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { Jr as PlayerStateProvider } from "../types-KRAWEuUs.mjs";
2
- import { Et as PlatformProvider } from "../index-DuPTdMhJ.mjs";
3
- import { _ as SystemName, g as SystemModules, v as SystemShellFactory } from "../types-COMxJbej.mjs";
1
+ import { Jr as PlayerStateProvider } from "../types-DQWTawIz.mjs";
2
+ import { Et as PlatformProvider } from "../index-CFq7H9zQ.mjs";
3
+ import { _ as SystemName, g as SystemModules, v as SystemShellFactory } from "../types-BXfauLJW.mjs";
4
4
  import { Back, Haptics, KeepAwake, Lifecycle, Store } from "@moku-labs/system";
5
5
 
6
6
  //#region src/app/system.d.ts
package/dist/app.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { Ur as Json } from "./types-KRAWEuUs.mjs";
2
- import { J as StringTable } from "./types-BFWYGikY.mjs";
3
- import { _ as SystemName, a as GameHandle, c as MemoryProvider, d as PlistValue, f as SaveKind, i as GameDefinition, l as PageAgent, m as ScreenSeams, n as GameApp, o as GamePluginConfigs, p as Scenario, r as GameConfig, s as HeadlessSeams, y as WithGameState } from "./types-COMxJbej.mjs";
1
+ import { Ur as Json } from "./types-DQWTawIz.mjs";
2
+ import { J as StringTable } from "./types-B7maCx9u.mjs";
3
+ import { _ as SystemName, a as GameHandle, c as MemoryProvider, d as PlistValue, f as SaveKind, i as GameDefinition, l as PageAgent, m as ScreenSeams, n as GameApp, o as GamePluginConfigs, p as Scenario, r as GameConfig, s as HeadlessSeams, y as WithGameState } from "./types-BXfauLJW.mjs";
4
4
  import { AnyPluginInstance } from "@moku-labs/core";
5
5
 
6
6
  //#region src/app/define.d.ts
package/dist/app.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { Gt as audioPlugin, Pt as effectsPlugin, Q as platformPlugin, i as screen, t as createApp, w as flattenFeatures } from "./src-DnqlJ1XY.mjs";
1
+ import { Gt as audioPlugin, Pt as effectsPlugin, Q as platformPlugin, i as screen, t as createApp, w as flattenFeatures } from "./src-BLbBo_Ih.mjs";
2
2
  import { t as memory } from "./memory-DeD9wis6.mjs";
3
3
  import { n as fakeClock, r as isFakeClock } from "./fake-hnJcJeYf.mjs";
4
4
  //#region src/app/define.ts
package/dist/assets.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { d as Manifest } from "./types-KRAWEuUs.mjs";
1
+ import { d as Manifest } from "./types-DQWTawIz.mjs";
2
2
 
3
3
  //#region src/plugins/assets/scan/cli.d.ts
4
4
  /**
@@ -1,8 +1,8 @@
1
- import { D as DebugSwitches, Ln as FlowState, Pn as Bookmark, Pr as Api, Qr as Snapshot, Z as Api$2, di as FrameRate, ei as StoreApi, hi as Time, kr as Api$3, pt as Captured, ri as Api$1, w as ScenesApi } from "./types-KRAWEuUs.mjs";
2
- import { W as AnimApi, a as AudioApi, h as EffectsApi, r as UiApi } from "./types-CpoZ-UDH.mjs";
3
- import { R as InputApi } from "./types-BFWYGikY.mjs";
4
- import { t as HeadlessApp } from "./headless-DDAKncmX.mjs";
5
- import { i as ControlApp, r as Command } from "./types-Ca0PmSri.mjs";
1
+ import { D as DebugSwitches, Ln as FlowState, Pn as Bookmark, Pr as Api, Qr as Snapshot, Z as Api$2, di as FrameRate, ei as StoreApi, hi as Time, kr as Api$3, pt as Captured, ri as Api$1, w as ScenesApi } from "./types-DQWTawIz.mjs";
2
+ import { W as AnimApi, a as AudioApi, h as EffectsApi, r as UiApi } from "./types-BTR9r8se.mjs";
3
+ import { R as InputApi } from "./types-B7maCx9u.mjs";
4
+ import { t as HeadlessApp } from "./headless-CWa3MHQi.mjs";
5
+ import { i as ControlApp, r as Command } from "./types-CThqFAwa.mjs";
6
6
 
7
7
  //#region src/plugins/flow/doors/commands.d.ts
8
8
  /**
@@ -1,7 +1,7 @@
1
- import { t as HeadlessApp } from "./headless-DDAKncmX.mjs";
2
- import { a as InputArguments, c as Ran, n as ChoiceInput, r as Command, s as InputSchema, u as ToggleInput } from "./types-Ca0PmSri.mjs";
3
- import { t as commands } from "./commands-DW0HRGor.mjs";
4
- import { t as defineCommand } from "./define-DnQHkikh.mjs";
1
+ import { t as HeadlessApp } from "./headless-CWa3MHQi.mjs";
2
+ import { a as InputArguments, c as Ran, n as ChoiceInput, r as Command, s as InputSchema, u as ToggleInput } from "./types-CThqFAwa.mjs";
3
+ import { t as commands } from "./commands-wfLkpPZC.mjs";
4
+ import { t as defineCommand } from "./define--35FWvH9.mjs";
5
5
 
6
6
  //#region src/plugins/flow/doors/dev.d.ts
7
7
  /**
@@ -1,5 +1,5 @@
1
- import { t as HeadlessApp } from "./headless-DDAKncmX.mjs";
2
- import { l as Source, r as Command, s as InputSchema } from "./types-Ca0PmSri.mjs";
1
+ import { t as HeadlessApp } from "./headless-CWa3MHQi.mjs";
2
+ import { l as Source, r as Command, s as InputSchema } from "./types-CThqFAwa.mjs";
3
3
 
4
4
  //#region src/plugins/flow/doors/define.d.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { Bn as RouteStep, Ln as FlowState, Rn as JournalEntry, Ur as Json, Yn as Answer, li as Api, ni as RngState, pn as Api$1 } from "./types-KRAWEuUs.mjs";
1
+ import { Bn as RouteStep, Ln as FlowState, Rn as JournalEntry, Ur as Json, Yn as Answer, li as Api, ni as RngState, pn as Api$1 } from "./types-DQWTawIz.mjs";
2
2
 
3
3
  //#region src/plugins/flow/headless.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { $n as DescriptionNode, An as FeatureDescription, Ar as Config$9, C as SceneSpec, Cr as Narrowed, Dr as SystemFor, Er as SystemDefinition, Et as FrameRing, F as HudPartValue, Fn as DefineNode, G as SpriteOptions, Gn as EffectOptions, Gr as State$5, H as ShapeValue, Ir as Config$2, It as PassKind, J as TransformValue, K as SpriteValue, Kn as GuideOptions, L as NineSliceValue, Mn as FeatureTree, Mr as State$9, Or as TagType, Pr as Api$1, Q as Config$6, Rr as State$2, S as SceneDefinition, Sn as TextStylesOf, Sr as Mut, T as State$7, Tn as defineFlow, Tr as ResourceType, Tt as FrameRecord, Un as Descriptor, Ur as Json, Vn as SceneIdOf, Vr as Config$5, Wn as Effect, Wr as Root, Xn as Answered, Y as sprite, Z as Api$4, _ as AnySceneProjection, _i as Config$10, _n as GameTypes, _r as ComponentType, a as Config$1, ai as Events, ar as ProjectionMotion, bn as State$3, c as LoadBundles, ct as State$6, ei as StoreApi, er as Ease, f as ReadyBundles, fi as RateChange, gn as EmitterIdOf, hn as Config$3, hr as ComponentHandle, i as BundleSpec, ii as Config$4, ir as NumericFields, jn as FeaturePlugin, kr as Api$6, l as LoadReason, li as Api$5, m as Tier, mi as ThermalReading, mn as BundlesOf, o as DefineBundles, oi as PauseReason, or as ProjectionSpec, p as State$1, pi as State$8, pn as Api$2, qn as Hint, qr as Patch, r as BundleMap, ri as Api$3, si as State$4, sr as ReducedMotion, t as Api, ti as RngApi, u as LoadResult, ui as Config$8, v as Config$7, vi as Events$1, vn as HudKeysOf, vr as ComponentValue, vt as ViewportSize, w as ScenesApi, wr as QueryTerm, x as LayerMap, xn as TextFormatsOf, y as DefineScene, yi as Require, z as OverlayValue } from "./types-KRAWEuUs.mjs";
2
- import { $ as SfxDescriptor, A as EmitterDefinition, B as GlowValue, C as FoldValue, D as ShineValue, E as RevealRoundValue, F as DisplacementValue, G as AnimPlayerValue, H as OutlineValue, J as MotionKeyframe, K as Config$11, L as FilterComponent, M as AlphaValue, N as BlurValue, O as VignetteValue, P as ColorMatrixValue, Q as HapticKind, R as FilterSpec, S as FlashValue, T as RevealLineValue, U as UniformDeclaration, V as NoiseValue, W as AnimApi, X as Target, Y as State$10, _ as State$12, a as AudioApi, b as BloomValue, c as MusicDescriptor, ct as play, d as State$11, et as Step, f as VolumesFor, h as EffectsApi, j as EmitterValue, k as EmitterConfig, l as MusicOptions, m as Config$13, n as State$13, nt as defineAnimation, q as FramesValue, r as UiApi, s as Config$12, t as Config$14, w as GradeValue, x as DissolveValue, y as AuraValue, yt as OverlayApi, z as FilterValueOf } from "./types-CpoZ-UDH.mjs";
3
- import { $ as ResolvedStyle, A as TextFormats, C as Point, E as TextBind, G as Message, H as Config$15, I as defineComponent, K as Part, L as Config$16, M as TextStyleInput, N as TextStyles, P as TextValue, Q as IsFlags, R as InputApi, T as TextApi, U as I18nApi, V as Argument, W as IntlKit, X as TypedTr, Y as TextKey, b as Config$17, et as Style, g as IntrinsicElementsFor, h as defineTokens, j as TextRunStyle, k as TextFormatFunction, nt as WhenFlags, q as State$14, s as PopupComponent, v as BindField, w as State$16, x as CountdownValue, y as BindOptions, z as State$15 } from "./types-BFWYGikY.mjs";
1
+ import { $n as DescriptionNode, An as FeatureDescription, Ar as Config$9, C as SceneSpec, Cr as Narrowed, Dr as SystemFor, Er as SystemDefinition, Et as FrameRing, F as HudPartValue, Fn as DefineNode, G as SpriteOptions, Gn as EffectOptions, Gr as State$5, H as ShapeValue, Ir as Config$2, It as PassKind, J as TransformValue, K as SpriteValue, Kn as GuideOptions, L as NineSliceValue, Mn as FeatureTree, Mr as State$9, Or as TagType, Pr as Api$1, Q as Config$6, Rr as State$2, S as SceneDefinition, Sn as TextStylesOf, Sr as Mut, T as State$7, Tn as defineFlow, Tr as ResourceType, Tt as FrameRecord, Un as Descriptor, Ur as Json, Vn as SceneIdOf, Vr as Config$5, Wn as Effect, Wr as Root, Xn as Answered, Y as sprite, Z as Api$4, _ as AnySceneProjection, _i as Config$10, _n as GameTypes, _r as ComponentType, a as Config$1, ai as Events, ar as ProjectionMotion, bn as State$3, c as LoadBundles, ct as State$6, ei as StoreApi, er as Ease, f as ReadyBundles, fi as RateChange, gn as EmitterIdOf, hn as Config$3, hr as ComponentHandle, i as BundleSpec, ii as Config$4, ir as NumericFields, jn as FeaturePlugin, kr as Api$6, l as LoadReason, li as Api$5, m as Tier, mi as ThermalReading, mn as BundlesOf, o as DefineBundles, oi as PauseReason, or as ProjectionSpec, p as State$1, pi as State$8, pn as Api$2, qn as Hint, qr as Patch, r as BundleMap, ri as Api$3, si as State$4, sr as ReducedMotion, t as Api, ti as RngApi, u as LoadResult, ui as Config$8, v as Config$7, vi as Events$1, vn as HudKeysOf, vr as ComponentValue, vt as ViewportSize, w as ScenesApi, wr as QueryTerm, x as LayerMap, xn as TextFormatsOf, y as DefineScene, yi as Require, z as OverlayValue } from "./types-DQWTawIz.mjs";
2
+ import { $ as SfxDescriptor, A as EmitterDefinition, B as GlowValue, C as FoldValue, D as ShineValue, E as RevealRoundValue, F as DisplacementValue, G as AnimPlayerValue, H as OutlineValue, J as MotionKeyframe, K as Config$11, L as FilterComponent, M as AlphaValue, N as BlurValue, O as VignetteValue, P as ColorMatrixValue, Q as HapticKind, R as FilterSpec, S as FlashValue, T as RevealLineValue, U as UniformDeclaration, V as NoiseValue, W as AnimApi, X as Target, Y as State$10, _ as State$12, a as AudioApi, b as BloomValue, c as MusicDescriptor, ct as play, d as State$11, et as Step, f as VolumesFor, h as EffectsApi, j as EmitterValue, k as EmitterConfig, l as MusicOptions, m as Config$13, n as State$13, nt as defineAnimation, q as FramesValue, r as UiApi, s as Config$12, t as Config$14, w as GradeValue, x as DissolveValue, y as AuraValue, yt as OverlayApi, z as FilterValueOf } from "./types-BTR9r8se.mjs";
3
+ import { $ as ResolvedStyle, A as TextFormats, C as Point, E as TextBind, G as Message, H as Config$15, I as defineComponent, K as Part, L as Config$16, M as TextStyleInput, N as TextStyles, P as TextValue, Q as IsFlags, R as InputApi, T as TextApi, U as I18nApi, V as Argument, W as IntlKit, X as TypedTr, Y as TextKey, b as Config$17, et as Style, g as IntrinsicElementsFor, h as defineTokens, j as TextRunStyle, k as TextFormatFunction, nt as WhenFlags, q as State$14, s as PopupComponent, v as BindField, w as State$16, x as CountdownValue, y as BindOptions, z as State$15 } from "./types-B7maCx9u.mjs";
4
4
  import { Log } from "@moku-labs/common/browser";
5
5
  import { PluginCtx } from "@moku-labs/core";
6
6
 
@@ -126,7 +126,8 @@ declare function defineTextFormats(map: Readonly<Record<string, TextFormatFuncti
126
126
  * Types a projection: keyed items of the model turned into entities. `Item` is inferred from the
127
127
  * return of `from` and reaches `key`, `view` and every motion hook; `layer` and `lift` stay
128
128
  * literal, so `defineScene` can check them against the layers of the scene. Each pair of
129
- * `initialOnly` has its field names checked against its own component.
129
+ * `initialOnly` has its field names checked against its own component, and its `when`, if any,
130
+ * takes the item.
130
131
  *
131
132
  * @param spec - Name, layer, optional lift layer, `from`, `key`, `view`, the motion hooks and
132
133
  * the `initialOnly` fields.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as MonitorConfig, $n as DescriptionNode, $t as PerfSpikeLine, At as OverlayEventDetail, B as Parent, Bt as PerfChangeEntry, Cn as types_d_exports$6, Ct as FrameReadResult, Dn as slot, Dt as LongFrameEntry, E as types_d_exports$13, En as exit, Et as FrameRing, F as HudPartValue, Ft as PROBLEM_RULES, Gt as PerfEventName, Ht as PerfCounts, I as NineSlice, It as PassKind, Jt as PerfLogLine, Kr as types_d_exports$10, Kt as PerfGapLine, Lt as PassRecord, M as WhyEntry, Mt as PERF_CAUSES, N as Display, Nr as types_d_exports$17, Nt as PERF_GAP_BUCKETS, On as to, Ot as MONITOR_SECTIONS, P as HudPart, Pt as PERF_LOG_VERSION, Qt as PerfSampleLine, R as Overlay, Rt as PerfCause, St as FrameColumns, Tt as FrameRecord, U as Sprite, Ut as PerfDisplay, V as Shape, Vt as PerfCollectorLine, W as SpriteBlend, Wt as PerfEventLine, X as AdaptiveScale, Xt as PerfMarkLine, Y as sprite, Yt as PerfLongFrameLine, Zn as AnchorTarget, Zr as SaveUnreadableError, Zt as PerfMeasured, an as ProblemRule, bt as RetakeWhy, ci as types_d_exports$9, cn as ShaderWhat, cr as SceneSwitch, dn as CanvasRestart, dt as ShotsApi, en as PerfStartupLine, fn as DEMAND_REASONS, ft as ShotsConfig, g as types_d_exports$1, gi as types_d_exports$15, in as ProblemEventDetail, jt as OverlayWhat, kn as type, kt as MonitorSections, ln as WarmDetail, mt as MonitorCounts, nn as PerfThermalLine, on as SHADER_WHATS, q as Transform, qt as PerfHeaderLine, rn as PoolTrimDetail, sn as ShaderEventDetail, st as PoolTrim, tn as PerfTelemetryLine, un as CANVAS_RESTARTS, ut as types_d_exports$12, wn as contribution, wt as FrameReadout, xt as WhyLive, z as OverlayValue, zr as types_d_exports$3, zt as PerfChange } from "./types-KRAWEuUs.mjs";
2
- import { C as FoldValue, D as ShineValue, E as RevealRoundValue, I as FilterArea, O as VignetteValue, Q as HapticKind, S as FlashValue, T as RevealLineValue, Z as types_d_exports, _t as use, at as haptic, b as BloomValue, bt as types_d_exports$4, ct as play, dt as sfx, ft as spawn, gt as tween, ht as stopSfx, i as types_d_exports$16, it as frames, lt as sequence, mt as stagger, nt as defineAnimation, ot as mark, p as types_d_exports$2, pt as spawned, rt as external, st as parallel, tt as HAPTIC_KINDS, ut as set, v as types_d_exports$5, vt as wait, w as GradeValue, x as DissolveValue, y as AuraValue } from "./types-CpoZ-UDH.mjs";
3
- import { A as TextFormats, B as types_d_exports$8, D as TextFormat, F as types_d_exports$14, I as defineComponent, O as TextFormatAnswer, S as FormattedNumber, Z as types_d_exports$7, d as DebugTrigger, f as LocalWrite, h as defineTokens, j as TextRunStyle, k as TextFormatFunction, m as popup, p as ScrollState, u as Box, x as CountdownValue, y as BindOptions } from "./types-BFWYGikY.mjs";
4
- import { $ as Traced, A as messageDuration, At as inputPlugin, B as Draggable, Bt as Countdown, C as Noise, Ct as rendererPlugin, D as defineStyle, Dt as types_d_exports$11, E as resolve, Et as PlatformProvider, F as Frames, Ft as clockPlugin, G as PointerOver, Gt as label, H as Held, Ht as bind, I as defineScene, It as audioPlugin, J as Swipeable, K as Pressable, L as defineBundles, Lt as assetsPlugin, M as defineMotion, Mt as flowPlugin, N as AnimPlayer, Nt as effectsPlugin, O as tr, Ot as modelPlugin, P as Animation, Pt as debugPlugin, Q as Traceable, R as load, Rt as animPlugin, S as Glow, St as scenesPlugin, T as music, Tt as BackResult, U as Hovered, Ut as defineTextFormats, V as DropTarget, Vt as Text, W as Pointer, Wt as defineTextStyles, X as Tappable, Y as TapValue, Z as Touchable, _ as defineFilter, _t as flattenFeatures, a as defineEmitter, at as Order, b as ColorMatrix, bt as timePlugin, c as Shine, ct as mut, d as Grade, dt as tag, et as PASS_KINDS, f as Fold, ft as defineEffect, g as Aura, gt as defineFeature, h as Bloom, ht as schedule, i as screen, it as Now, j as cubicBezier, jt as i18nPlugin, k as messageArgument, kt as lifecyclePlugin, l as RevealRound, lt as resource, m as Dissolve, mt as hint, n as createPlugin, nt as Exiting, o as Emitter, ot as Tree, p as Flash, pt as guide, q as Pressed, r as defineGame, rt as Layer, s as Vignette, st as component, t as createApp, tt as frameAt, u as RevealLine, ut as system, v as Alpha, vt as worldPlugin, w as Outline, wt as platformPlugin, x as Displacement, xt as textPlugin, y as Blur, yt as uiPlugin, z as ready, zt as projection } from "./index-DuPTdMhJ.mjs";
1
+ import { $ as MonitorConfig, $n as DescriptionNode, $t as PerfSpikeLine, At as OverlayEventDetail, B as Parent, Bt as PerfChangeEntry, Cn as types_d_exports$6, Ct as FrameReadResult, Dn as slot, Dt as LongFrameEntry, E as types_d_exports$13, En as exit, Et as FrameRing, F as HudPartValue, Ft as PROBLEM_RULES, Gt as PerfEventName, Ht as PerfCounts, I as NineSlice, It as PassKind, Jt as PerfLogLine, Kr as types_d_exports$10, Kt as PerfGapLine, Lt as PassRecord, M as WhyEntry, Mt as PERF_CAUSES, N as Display, Nr as types_d_exports$17, Nt as PERF_GAP_BUCKETS, On as to, Ot as MONITOR_SECTIONS, P as HudPart, Pt as PERF_LOG_VERSION, Qt as PerfSampleLine, R as Overlay, Rt as PerfCause, St as FrameColumns, Tt as FrameRecord, U as Sprite, Ut as PerfDisplay, V as Shape, Vt as PerfCollectorLine, W as SpriteBlend, Wt as PerfEventLine, X as AdaptiveScale, Xt as PerfMarkLine, Y as sprite, Yt as PerfLongFrameLine, Zn as AnchorTarget, Zr as SaveUnreadableError, Zt as PerfMeasured, an as ProblemRule, bt as RetakeWhy, ci as types_d_exports$9, cn as ShaderWhat, cr as SceneSwitch, dn as CanvasRestart, dt as ShotsApi, en as PerfStartupLine, fn as DEMAND_REASONS, ft as ShotsConfig, g as types_d_exports$1, gi as types_d_exports$15, in as ProblemEventDetail, jt as OverlayWhat, kn as type, kt as MonitorSections, ln as WarmDetail, mt as MonitorCounts, nn as PerfThermalLine, on as SHADER_WHATS, q as Transform, qt as PerfHeaderLine, rn as PoolTrimDetail, sn as ShaderEventDetail, st as PoolTrim, tn as PerfTelemetryLine, un as CANVAS_RESTARTS, ut as types_d_exports$12, wn as contribution, wt as FrameReadout, xt as WhyLive, z as OverlayValue, zr as types_d_exports$3, zt as PerfChange } from "./types-DQWTawIz.mjs";
2
+ import { C as FoldValue, D as ShineValue, E as RevealRoundValue, I as FilterArea, O as VignetteValue, Q as HapticKind, S as FlashValue, T as RevealLineValue, Z as types_d_exports, _t as use, at as haptic, b as BloomValue, bt as types_d_exports$4, ct as play, dt as sfx, ft as spawn, gt as tween, ht as stopSfx, i as types_d_exports$16, it as frames, lt as sequence, mt as stagger, nt as defineAnimation, ot as mark, p as types_d_exports$2, pt as spawned, rt as external, st as parallel, tt as HAPTIC_KINDS, ut as set, v as types_d_exports$5, vt as wait, w as GradeValue, x as DissolveValue, y as AuraValue } from "./types-BTR9r8se.mjs";
3
+ import { A as TextFormats, B as types_d_exports$8, D as TextFormat, F as types_d_exports$14, I as defineComponent, O as TextFormatAnswer, S as FormattedNumber, Z as types_d_exports$7, d as DebugTrigger, f as LocalWrite, h as defineTokens, j as TextRunStyle, k as TextFormatFunction, m as popup, p as ScrollState, u as Box, x as CountdownValue, y as BindOptions } from "./types-B7maCx9u.mjs";
4
+ import { $ as Traced, A as messageDuration, At as inputPlugin, B as Draggable, Bt as Countdown, C as Noise, Ct as rendererPlugin, D as defineStyle, Dt as types_d_exports$11, E as resolve, Et as PlatformProvider, F as Frames, Ft as clockPlugin, G as PointerOver, Gt as label, H as Held, Ht as bind, I as defineScene, It as audioPlugin, J as Swipeable, K as Pressable, L as defineBundles, Lt as assetsPlugin, M as defineMotion, Mt as flowPlugin, N as AnimPlayer, Nt as effectsPlugin, O as tr, Ot as modelPlugin, P as Animation, Pt as debugPlugin, Q as Traceable, R as load, Rt as animPlugin, S as Glow, St as scenesPlugin, T as music, Tt as BackResult, U as Hovered, Ut as defineTextFormats, V as DropTarget, Vt as Text, W as Pointer, Wt as defineTextStyles, X as Tappable, Y as TapValue, Z as Touchable, _ as defineFilter, _t as flattenFeatures, a as defineEmitter, at as Order, b as ColorMatrix, bt as timePlugin, c as Shine, ct as mut, d as Grade, dt as tag, et as PASS_KINDS, f as Fold, ft as defineEffect, g as Aura, gt as defineFeature, h as Bloom, ht as schedule, i as screen, it as Now, j as cubicBezier, jt as i18nPlugin, k as messageArgument, kt as lifecyclePlugin, l as RevealRound, lt as resource, m as Dissolve, mt as hint, n as createPlugin, nt as Exiting, o as Emitter, ot as Tree, p as Flash, pt as guide, q as Pressed, r as defineGame, rt as Layer, s as Vignette, st as component, t as createApp, tt as frameAt, u as RevealLine, ut as system, v as Alpha, vt as worldPlugin, w as Outline, wt as platformPlugin, x as Displacement, xt as textPlugin, y as Blur, yt as uiPlugin, z as ready, zt as projection } from "./index-CFq7H9zQ.mjs";
5
5
  export { type AdaptiveScale, Alpha, type AnchorTarget, types_d_exports as Anim, AnimPlayer, Animation, types_d_exports$1 as Assets, types_d_exports$2 as Audio, Aura, type AuraValue, type BackResult, type BindOptions, Bloom, type BloomValue, Blur, Box, CANVAS_RESTARTS, type CanvasRestart, types_d_exports$3 as Clock, ColorMatrix, Countdown, type CountdownValue, DEMAND_REASONS, types_d_exports$4 as Debug, DebugTrigger, type DescriptionNode, Displacement, Display, Dissolve, type DissolveValue, Draggable, DropTarget, types_d_exports$5 as Effects, Emitter, Exiting, type FilterArea, Flash, type FlashValue, types_d_exports$6 as Flow, Fold, type FoldValue, type FormattedNumber, type FrameColumns, type FrameReadResult, type FrameReadout, type FrameRecord, type FrameRing, Frames, Glow, Grade, type GradeValue, HAPTIC_KINDS, type HapticKind, Held, Hovered, HudPart, type HudPartValue, types_d_exports$7 as I18n, types_d_exports$8 as Input, Layer, types_d_exports$9 as Lifecycle, LocalWrite, type LongFrameEntry, MONITOR_SECTIONS, types_d_exports$10 as Model, type MonitorConfig, type MonitorCounts, type MonitorSections, NineSlice, Noise, Now, Order, Outline, Overlay, type OverlayEventDetail, type OverlayValue, type OverlayWhat, PASS_KINDS, PERF_CAUSES, PERF_GAP_BUCKETS, PERF_LOG_VERSION, PROBLEM_RULES, Parent, type PassKind, type PassRecord, type PerfCause, type PerfChange, type PerfChangeEntry, type PerfCollectorLine, type PerfCounts, type PerfDisplay, type PerfEventLine, type PerfEventName, type PerfGapLine, type PerfHeaderLine, type PerfLogLine, type PerfLongFrameLine, type PerfMarkLine, type PerfMeasured, type PerfSampleLine, type PerfSpikeLine, type PerfStartupLine, type PerfTelemetryLine, type PerfThermalLine, types_d_exports$11 as Platform, type PlatformProvider, Pointer, PointerOver, type PoolTrim, type PoolTrimDetail, Pressable, Pressed, type ProblemEventDetail, type ProblemRule, types_d_exports$12 as Renderer, type RetakeWhy, RevealLine, type RevealLineValue, RevealRound, type RevealRoundValue, SHADER_WHATS, SaveUnreadableError, type SceneSwitch, types_d_exports$13 as Scenes, ScrollState, type ShaderEventDetail, type ShaderWhat, Shape, Shine, type ShineValue, type ShotsApi, type ShotsConfig, Sprite, type SpriteBlend, Swipeable, type TapValue, Tappable, Text, type TextFormat, type TextFormatAnswer, type TextFormatFunction, type TextFormats, type TextRunStyle, types_d_exports$14 as TextTypes, types_d_exports$15 as Time, Touchable, Traceable, Traced, Transform, Tree, types_d_exports$16 as Ui, Vignette, type VignetteValue, type WarmDetail, type WhyEntry, type WhyLive, types_d_exports$17 as World, animPlugin, assetsPlugin, audioPlugin, bind, clockPlugin, component, contribution, createApp, createPlugin, cubicBezier, debugPlugin, defineAnimation, defineBundles, defineComponent, defineEffect, defineEmitter, defineFeature, defineFilter, defineGame, defineMotion, defineScene, defineStyle, defineTextFormats, defineTextStyles, defineTokens, effectsPlugin, exit, external, flattenFeatures, flowPlugin, frameAt, frames, guide, haptic, hint, i18nPlugin, inputPlugin, label, lifecyclePlugin, load, mark, messageArgument, messageDuration, modelPlugin, music, mut, parallel, platformPlugin, play, popup, projection, ready, rendererPlugin, resolve, resource, scenesPlugin, schedule, screen, sequence, set, sfx, slot, spawn, spawned, sprite, stagger, stopSfx, system, tag, textPlugin, timePlugin, to, tr, tween, type, uiPlugin, use, wait, worldPlugin };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as HAPTIC_KINDS, $t as PASS_KINDS, A as types_exports$17, At as Traced, B as types_exports$7, Bt as Glow, C as defineFeature, Ct as PointerOver, D as defineBundles, Dt as Tappable, E as music, Et as Swipeable, F as types_exports$12, Ft as Emitter, G as types_exports$2, Gt as audioPlugin, H as types_exports$5, Ht as Outline, I as types_exports$11, It as Alpha, J as uiPlugin, Jt as animPlugin, K as types_exports$1, Kt as scenesPlugin, L as types_exports$10, Lt as Blur, M as types_exports$15, Mt as messageArgument, N as types_exports$14, Nt as messageDuration, O as load, Ot as Touchable, P as types_exports$13, Pt as effectsPlugin, Q as platformPlugin, Qt as rendererPlugin, R as types_exports$9, Rt as ColorMatrix, S as tr, St as Pointer, T as defineEmitter, Tt as Pressed, U as types_exports$4, Ut as defineFilter, V as types_exports$6, Vt as Noise, W as types_exports$3, Wt as debugPlugin, X as defineMotion, Xt as Animation, Y as resolve, Yt as AnimPlayer, Z as textPlugin, Zt as Frames, _ as guide, _n as modelPlugin, _t as inputPlugin, a as Vignette, an as PROBLEM_RULES, at as parallel, b as projection, bn as timePlugin, bt as Held, c as RevealLine, cn as DEMAND_REASONS, ct as set, d as Flash, dt as spawned, en as frameAt, et as defineAnimation, f as Dissolve, fn as contribution, ft as stagger, g as defineEffect, gn as type, gt as wait, h as cubicBezier, hn as to, ht as use, i as screen, in as PERF_LOG_VERSION, it as mark, j as types_exports$16, jt as i18nPlugin, k as ready, kt as Traceable, l as Grade, ln as worldPlugin, lt as sfx, m as Aura, mn as slot, mt as tween, n as createPlugin, nn as PERF_CAUSES, nt as frames, o as Shine, on as SHADER_WHATS, ot as play, p as Bloom, pn as exit, pt as stopSfx, q as types_exports, qt as assetsPlugin, r as defineGame, rn as PERF_GAP_BUCKETS, rt as haptic, s as RevealRound, sn as CANVAS_RESTARTS, st as sequence, t as createApp, tn as MONITOR_SECTIONS, tt as external, u as Fold, un as flowPlugin, ut as spawn, v as hint, vn as SaveUnreadableError, vt as Draggable, w as flattenFeatures, wt as Pressable, x as defineScene, xn as clockPlugin, xt as Hovered, y as schedule, yn as lifecyclePlugin, yt as DropTarget, z as types_exports$8, zt as Displacement } from "./src-DnqlJ1XY.mjs";
1
+ import { $ as HAPTIC_KINDS, $t as PASS_KINDS, A as types_exports$17, At as Traced, B as types_exports$7, Bt as Glow, C as defineFeature, Ct as PointerOver, D as defineBundles, Dt as Tappable, E as music, Et as Swipeable, F as types_exports$12, Ft as Emitter, G as types_exports$2, Gt as audioPlugin, H as types_exports$5, Ht as Outline, I as types_exports$11, It as Alpha, J as uiPlugin, Jt as animPlugin, K as types_exports$1, Kt as scenesPlugin, L as types_exports$10, Lt as Blur, M as types_exports$15, Mt as messageArgument, N as types_exports$14, Nt as messageDuration, O as load, Ot as Touchable, P as types_exports$13, Pt as effectsPlugin, Q as platformPlugin, Qt as rendererPlugin, R as types_exports$9, Rt as ColorMatrix, S as tr, St as Pointer, T as defineEmitter, Tt as Pressed, U as types_exports$4, Ut as defineFilter, V as types_exports$6, Vt as Noise, W as types_exports$3, Wt as debugPlugin, X as defineMotion, Xt as Animation, Y as resolve, Yt as AnimPlayer, Z as textPlugin, Zt as Frames, _ as guide, _n as modelPlugin, _t as inputPlugin, a as Vignette, an as PROBLEM_RULES, at as parallel, b as projection, bn as timePlugin, bt as Held, c as RevealLine, cn as DEMAND_REASONS, ct as set, d as Flash, dt as spawned, en as frameAt, et as defineAnimation, f as Dissolve, fn as contribution, ft as stagger, g as defineEffect, gn as type, gt as wait, h as cubicBezier, hn as to, ht as use, i as screen, in as PERF_LOG_VERSION, it as mark, j as types_exports$16, jt as i18nPlugin, k as ready, kt as Traceable, l as Grade, ln as worldPlugin, lt as sfx, m as Aura, mn as slot, mt as tween, n as createPlugin, nn as PERF_CAUSES, nt as frames, o as Shine, on as SHADER_WHATS, ot as play, p as Bloom, pn as exit, pt as stopSfx, q as types_exports, qt as assetsPlugin, r as defineGame, rn as PERF_GAP_BUCKETS, rt as haptic, s as RevealRound, sn as CANVAS_RESTARTS, st as sequence, t as createApp, tn as MONITOR_SECTIONS, tt as external, u as Fold, un as flowPlugin, ut as spawn, v as hint, vn as SaveUnreadableError, vt as Draggable, w as flattenFeatures, wt as Pressable, x as defineScene, xn as clockPlugin, xt as Hovered, y as schedule, yn as lifecyclePlugin, yt as DropTarget, z as types_exports$8, zt as Displacement } from "./src-BLbBo_Ih.mjs";
2
2
  import { $ as Parent, A as Countdown, F as defineTextFormats, I as defineTextStyles, J as Display, L as label, M as bind, S as popup, T as defineStyle, X as NineSlice, Y as HudPart, Z as Overlay, _ as LocalWrite, at as sprite, ct as Now, dt as component, et as Shape, ft as mut, gt as tag, h as DebugTrigger, j as Text, lt as Order, mt as system, nt as Transform, ot as Exiting, p as Box, pt as resource, st as Layer, tt as Sprite, ut as Tree, w as defineTokens, y as ScrollState } from "./visual-fyUJwUJf.mjs";
3
3
  import { t as defineComponent } from "./component-DGg5DqKK.mjs";
4
4
  export { Alpha, types_exports as Anim, AnimPlayer, Animation, types_exports$1 as Assets, types_exports$2 as Audio, Aura, Bloom, Blur, Box, CANVAS_RESTARTS, types_exports$3 as Clock, ColorMatrix, Countdown, DEMAND_REASONS, types_exports$4 as Debug, DebugTrigger, Displacement, Display, Dissolve, Draggable, DropTarget, types_exports$5 as Effects, Emitter, Exiting, Flash, types_exports$6 as Flow, Fold, Frames, Glow, Grade, HAPTIC_KINDS, Held, Hovered, HudPart, types_exports$7 as I18n, types_exports$8 as Input, Layer, types_exports$9 as Lifecycle, LocalWrite, MONITOR_SECTIONS, types_exports$10 as Model, NineSlice, Noise, Now, Order, Outline, Overlay, PASS_KINDS, PERF_CAUSES, PERF_GAP_BUCKETS, PERF_LOG_VERSION, PROBLEM_RULES, Parent, types_exports$11 as Platform, Pointer, PointerOver, Pressable, Pressed, types_exports$12 as Renderer, RevealLine, RevealRound, SHADER_WHATS, SaveUnreadableError, types_exports$13 as Scenes, ScrollState, Shape, Shine, Sprite, Swipeable, Tappable, Text, types_exports$14 as TextTypes, types_exports$15 as Time, Touchable, Traceable, Traced, Transform, Tree, types_exports$16 as Ui, Vignette, types_exports$17 as World, animPlugin, assetsPlugin, audioPlugin, bind, clockPlugin, component, contribution, createApp, createPlugin, cubicBezier, debugPlugin, defineAnimation, defineBundles, defineComponent, defineEffect, defineEmitter, defineFeature, defineFilter, defineGame, defineMotion, defineScene, defineStyle, defineTextFormats, defineTextStyles, defineTokens, effectsPlugin, exit, external, flattenFeatures, flowPlugin, frameAt, frames, guide, haptic, hint, i18nPlugin, inputPlugin, label, lifecyclePlugin, load, mark, messageArgument, messageDuration, modelPlugin, music, mut, parallel, platformPlugin, play, popup, projection, ready, rendererPlugin, resolve, resource, scenesPlugin, schedule, screen, sequence, set, sfx, slot, spawn, spawned, sprite, stagger, stopSfx, system, tag, textPlugin, timePlugin, to, tr, tween, type, uiPlugin, use, wait, worldPlugin };
@@ -1,9 +1,9 @@
1
- import { Br as Api, In as FlowGraph, Qr as Snapshot, Rn as JournalEntry, Z as Api$2, br as EntitySnapshot, gr as ComponentSchema, h as Usage, ht as RenderStats, jr as Explained, kr as Api$1, lt as Under, t as Api$3, xr as FrameDiff, yn as Position } from "./types-KRAWEuUs.mjs";
2
- import { a as AudioApi, g as EffectsStats, h as EffectsApi, r as UiApi, u as SoundEntry } from "./types-CpoZ-UDH.mjs";
3
- import { c as UiNode } from "./types-BFWYGikY.mjs";
4
- import { t as HeadlessApp } from "./headless-DDAKncmX.mjs";
5
- import { a as InputArguments, d as WatchApp, f as WatchInput, l as Source, o as InputOf, s as InputSchema, t as CheatEntry } from "./types-Ca0PmSri.mjs";
6
- import { n as defineSource } from "./define-DnQHkikh.mjs";
1
+ import { Br as Api, In as FlowGraph, Qr as Snapshot, Rn as JournalEntry, Z as Api$2, br as EntitySnapshot, gr as ComponentSchema, h as Usage, ht as RenderStats, jr as Explained, kr as Api$1, lt as Under, t as Api$3, xr as FrameDiff, yn as Position } from "./types-DQWTawIz.mjs";
2
+ import { a as AudioApi, g as EffectsStats, h as EffectsApi, r as UiApi, u as SoundEntry } from "./types-BTR9r8se.mjs";
3
+ import { c as UiNode } from "./types-B7maCx9u.mjs";
4
+ import { t as HeadlessApp } from "./headless-CWa3MHQi.mjs";
5
+ import { a as InputArguments, d as WatchApp, f as WatchInput, l as Source, o as InputOf, s as InputSchema, t as CheatEntry } from "./types-CThqFAwa.mjs";
6
+ import { n as defineSource } from "./define--35FWvH9.mjs";
7
7
 
8
8
  //#region src/plugins/flow/doors/read.d.ts
9
9
  /**
@@ -1,2 +1,2 @@
1
- import { a as jsxs, i as jsxDEV, n as JSX, r as jsx, t as Fragment } from "./runtime-RUEeOVCg.mjs";
1
+ import { a as jsxs, i as jsxDEV, n as JSX, r as jsx, t as Fragment } from "./runtime-CIpfTDsz.mjs";
2
2
  export { Fragment, type JSX, jsx, jsxDEV, jsxs };
@@ -1,2 +1,2 @@
1
- import { a as jsxs, n as JSX, r as jsx, t as Fragment } from "./runtime-RUEeOVCg.mjs";
1
+ import { a as jsxs, n as JSX, r as jsx, t as Fragment } from "./runtime-CIpfTDsz.mjs";
2
2
  export { Fragment, type JSX, jsx, jsxs };
@@ -1,4 +1,4 @@
1
- import { _ as UiIntrinsicElements, a as JsxChild, t as DescriptionNode } from "./types-BFWYGikY.mjs";
1
+ import { _ as UiIntrinsicElements, a as JsxChild, t as DescriptionNode } from "./types-B7maCx9u.mjs";
2
2
 
3
3
  //#region src/plugins/ui/jsx/runtime.d.ts
4
4
  /** What the compiler passes as props: the children plus whatever the tag declared. */
@@ -10823,7 +10823,10 @@ function createViewRecord(entity, projection, key, item, rest, cause = "mount")
10823
10823
  dropWhenStill: false,
10824
10824
  loopOwed: false,
10825
10825
  exiting: false,
10826
- cause
10826
+ cause,
10827
+ seed: void 0,
10828
+ mask: 0,
10829
+ maskWarned: false
10827
10830
  };
10828
10831
  }
10829
10832
  //#endregion
@@ -11575,6 +11578,8 @@ function routeHint(hints, projection, key) {
11575
11578
  }
11576
11579
  //#endregion
11577
11580
  //#region src/plugins/world/projection/mutes.ts
11581
+ /** The most pairs with a `when` one spec may list: one bit each of a 32-bit mask. */
11582
+ const MOST_WHENS = 32;
11578
11583
  /**
11579
11584
  * Tells a table `mute()` made apart from a shared `initialOnly` seed, which is frozen.
11580
11585
  *
@@ -11614,17 +11619,15 @@ function ownFields(stored) {
11614
11619
  return isOwnFields(stored) ? stored : new Set(stored);
11615
11620
  }
11616
11621
  /**
11617
- * The `initialOnly` fields of one component of a view, from the spec of its projection.
11622
+ * The `initialOnly` fields of one component of a view, from the seed the view was born with.
11618
11623
  *
11619
11624
  * @param state - The projection branch of the plugin state.
11620
11625
  * @param entity - The entity of the view.
11621
11626
  * @param name - The component name.
11622
- * @returns The seed set, or `undefined` for an entity that is no view of such a projection.
11627
+ * @returns The seed set, or `undefined` for an entity that is no view, or one no pair covers.
11623
11628
  */
11624
11629
  function initialFieldsOf(state, entity, name) {
11625
- const projection = state.byEntity.get(entity)?.projection;
11626
- const spec = projection === void 0 ? void 0 : state.specs.get(projection);
11627
- return spec === void 0 ? void 0 : state.initialOnly.get(spec)?.get(name);
11630
+ return state.byEntity.get(entity)?.seed?.get(name);
11628
11631
  }
11629
11632
  /**
11630
11633
  * Deletes a released field set once it is empty, and the entity's table once no component is
@@ -11644,8 +11647,8 @@ function dropEmptyMute(mutes, entity, table, name, owned) {
11644
11647
  }
11645
11648
  /**
11646
11649
  * Hands fields of one component of one entity to another writer, until the remover runs. A view
11647
- * born with an `initialOnly` seed gets its own copy first. The remover keeps the seed fields, asked
11648
- * when it runs: a mute made inside the spawn came before the view was known.
11650
+ * born with an `initialOnly` seed gets its own copy first. The remover keeps the fields of the
11651
+ * view's seed, asked when it runs: a mute made inside the spawn came before the view was known.
11649
11652
  *
11650
11653
  * @param state - The projection branch of the plugin state.
11651
11654
  * @param entity - The entity.
@@ -11671,39 +11674,141 @@ function muteFields(state, entity, name, fields) {
11671
11674
  };
11672
11675
  }
11673
11676
  /**
11674
- * Builds the frozen seed of a projection's `initialOnly` list: component name to its fields, a
11675
- * component named twice with both lists joined.
11677
+ * Checks one pair of a spec's `initialOnly` list.
11676
11678
  *
11677
11679
  * @param spec - The projection spec.
11678
- * @param pairs - Its `initialOnly` list, not empty.
11679
- * @returns The seed.
11680
- * @throws {Error} For a pair with no field.
11680
+ * @param pair - The pair.
11681
+ * @throws {Error} For a pair with no field, and for a third element that is no function.
11681
11682
  */
11682
- function buildSeed(spec, pairs) {
11683
+ function checkPair(spec, pair) {
11684
+ const [component, fields, when] = pair;
11685
+ const name = component.componentName;
11686
+ if (fields.length === 0) throw new Error(`[game] Projection "${spec.name}" lists ${name} in initialOnly with no field.\n Name the fields only the birth of a view writes, or drop the pair.`);
11687
+ if (pair.length > 2 && typeof when !== "function") throw new Error(`[game] Projection "${spec.name}" lists ${name} in initialOnly with a "when" that is no function.\n Give a function of the item, or drop the third element.`);
11688
+ }
11689
+ /**
11690
+ * The indices of the pairs with a `when`, in order.
11691
+ *
11692
+ * @param spec - The projection spec.
11693
+ * @param pairs - Its checked `initialOnly` list.
11694
+ * @returns The indices.
11695
+ * @throws {Error} For more pairs with a `when` than a mask holds.
11696
+ */
11697
+ function asksOf(spec, pairs) {
11698
+ const asks = [];
11699
+ for (const [index, pair] of pairs.entries()) if (pair[2] !== void 0) asks.push(index);
11700
+ if (asks.length > MOST_WHENS) throw new Error(`[game] Projection "${spec.name}" lists ${asks.length} initialOnly pairs with a "when".\n Join pairs that ask the same, to ${MOST_WHENS} at most.`);
11701
+ return asks;
11702
+ }
11703
+ /**
11704
+ * Builds the frozen seed of one answer mask: component name to its fields, from the pairs without
11705
+ * a `when` and the pairs whose bit is set, a component named twice with both lists joined.
11706
+ *
11707
+ * @param book - The seed book of the spec.
11708
+ * @param mask - The answers, bit i for the i-th pair with a `when`.
11709
+ * @returns The seed, or `undefined` when the mask covers no pair.
11710
+ */
11711
+ function buildSeed(book, mask) {
11683
11712
  const seed = /* @__PURE__ */ new Map();
11684
- for (const [component, fields] of pairs) {
11713
+ let whenBit = 0;
11714
+ for (const [component, fields, when] of book.pairs) {
11715
+ if (when !== void 0) {
11716
+ const covered = (mask & 1 << whenBit) !== 0;
11717
+ whenBit += 1;
11718
+ if (!covered) continue;
11719
+ }
11685
11720
  const name = component.componentName;
11686
- if (fields.length === 0) throw new Error(`[game] Projection "${spec.name}" lists ${name} in initialOnly with no field.\n Name the fields only the birth of a view writes, or drop the pair.`);
11687
11721
  seed.set(name, Object.freeze(/* @__PURE__ */ new Set([...seed.get(name) ?? [], ...fields])));
11688
11722
  }
11689
- return Object.freeze(seed);
11723
+ return seed.size === 0 ? void 0 : Object.freeze(seed);
11690
11724
  }
11691
11725
  /**
11692
- * Checks the `initialOnly` list of a spec and keeps its seed: once per spec, since a name is
11693
- * registered once and `replace` brings a new spec. A spec without the option, or with an empty
11694
- * list, has none.
11726
+ * The seed of one answer mask, built the first time a view is born with it, then the same table.
11727
+ *
11728
+ * @param book - The seed book of the spec.
11729
+ * @param mask - The answers.
11730
+ * @returns The shared seed, or `undefined` for a mask that covers no pair.
11731
+ */
11732
+ function seedFor(book, mask) {
11733
+ if (book.seeds.has(mask)) return book.seeds.get(mask);
11734
+ const seed = buildSeed(book, mask);
11735
+ book.seeds.set(mask, seed);
11736
+ return seed;
11737
+ }
11738
+ /**
11739
+ * Creates the empty seed table of a book. It lives in its own non-exported function because lint
11740
+ * rule L5 refuses a collection built inside an exported declaration.
11741
+ *
11742
+ * @returns An empty table of mask to seed.
11743
+ */
11744
+ function emptySeeds() {
11745
+ return /* @__PURE__ */ new Map();
11746
+ }
11747
+ /**
11748
+ * Checks the `initialOnly` list of a spec and makes its seed book, keeping nothing. A spec whose
11749
+ * pairs have no `when` gets the one seed of mask 0 now, as before.
11695
11750
  *
11696
- * @param state - The projection branch of the plugin state.
11697
11751
  * @param spec - The spec `register` or `replace` stores.
11698
- * @returns The seed, or `undefined`.
11699
- * @throws {Error} For a pair with no field; nothing is kept then.
11752
+ * @returns The book, or `undefined` for a spec without the option or with an empty list.
11753
+ * @throws {Error} For a pair with no field, a `when` that is no function, or too many `when`s.
11700
11754
  */
11701
- function learnSeed(state, spec) {
11755
+ function checkBook(spec) {
11702
11756
  const pairs = spec.initialOnly;
11703
11757
  if (pairs === void 0 || pairs.length === 0) return void 0;
11704
- const seed = buildSeed(spec, pairs);
11705
- state.initialOnly.set(spec, seed);
11706
- return seed;
11758
+ for (const pair of pairs) checkPair(spec, pair);
11759
+ const book = {
11760
+ pairs,
11761
+ asks: asksOf(spec, pairs),
11762
+ seeds: emptySeeds()
11763
+ };
11764
+ if (book.asks.length === 0) seedFor(book, 0);
11765
+ return book;
11766
+ }
11767
+ /**
11768
+ * Checks the `initialOnly` list of a spec and keeps its seed book: once per spec, since a name is
11769
+ * registered once and `replace` brings a new spec.
11770
+ *
11771
+ * @param state - The projection branch of the plugin state.
11772
+ * @param spec - The spec `register` stores.
11773
+ * @throws {Error} For a pair with no field, a `when` that is no function, or too many `when`s;
11774
+ * nothing is kept then.
11775
+ */
11776
+ function learnSeed(state, spec) {
11777
+ const book = checkBook(spec);
11778
+ if (book !== void 0) state.initialOnly.set(spec, book);
11779
+ }
11780
+ /**
11781
+ * Asks the `when`s of a book on one item.
11782
+ *
11783
+ * @param book - The seed book of the spec, if it has one.
11784
+ * @param item - The item.
11785
+ * @returns The answers, bit i set when the i-th `when` answers true; 0 with no book or no `when`.
11786
+ * @throws {Error} What a `when` throws.
11787
+ */
11788
+ function maskOfBook(book, item) {
11789
+ if (book === void 0) return 0;
11790
+ const { asks, pairs } = book;
11791
+ const count = asks.length;
11792
+ let mask = 0;
11793
+ for (let bit = 0; bit < count; bit += 1) {
11794
+ const when = pairs[asks[bit] ?? 0]?.[2];
11795
+ if (when?.(item) === true) mask |= 1 << bit;
11796
+ }
11797
+ return mask;
11798
+ }
11799
+ /**
11800
+ * The answers a view is born with: the `when`s of its projection asked on the item it is born
11801
+ * with. Asked before the spawn, so a `when` that throws spawns nothing, as a `view` that throws.
11802
+ *
11803
+ * @param state - The projection branch of the plugin state.
11804
+ * @param spec - The projection spec.
11805
+ * @param item - The item of the birth: the model item, or the warm item for a warm build.
11806
+ * @returns The mask; 0 for a spec without a `when`.
11807
+ * @throws {Error} What a `when` throws.
11808
+ */
11809
+ function birthMask(state, spec, item) {
11810
+ if (spec.initialOnly === void 0) return 0;
11811
+ return maskOfBook(state.initialOnly.get(spec), item);
11707
11812
  }
11708
11813
  /**
11709
11814
  * Joins a seed into a table of the entity's own, in place, so the remover of every mute that wrote
@@ -11728,26 +11833,58 @@ function joinSeed(state, table, seed) {
11728
11833
  }
11729
11834
  }
11730
11835
  /**
11731
- * Gives a view that was just born the seed of its projection, so from now on nothing of the
11732
- * projection writes or compares those fields. The birth itself wrote them from `view`. A view a
11733
- * listener of its spawn muted already keeps its table, and the seed joins it.
11836
+ * Gives a view that was just born the seed of its answers (`view.mask`), so from now on nothing of
11837
+ * the projection writes or compares those fields. The birth itself wrote them from `view`. The
11838
+ * view keeps the seed. A view a listener of its spawn muted already keeps its table, and the seed
11839
+ * joins it.
11734
11840
  *
11735
11841
  * @param state - The projection branch of the plugin state.
11736
11842
  * @param spec - The projection spec.
11737
- * @param entity - The entity of the new view.
11843
+ * @param view - The new view, its mask set.
11738
11844
  */
11739
- function seedMutes(state, spec, entity) {
11845
+ function seedMutes(state, spec, view) {
11740
11846
  if (spec.initialOnly === void 0) return;
11741
- const seed = state.initialOnly.get(spec);
11847
+ const book = state.initialOnly.get(spec);
11848
+ const seed = book === void 0 ? void 0 : seedFor(book, view.mask);
11742
11849
  if (seed === void 0) return;
11743
- const stored = state.mutes.get(entity);
11850
+ view.seed = seed;
11851
+ const stored = state.mutes.get(view.entity);
11744
11852
  if (stored === void 0) {
11745
- state.mutes.set(entity, seed);
11853
+ state.mutes.set(view.entity, seed);
11746
11854
  return;
11747
11855
  }
11748
11856
  const table = ownTable(stored);
11749
11857
  joinSeed(state, table, seed);
11750
- state.mutes.set(entity, table);
11858
+ state.mutes.set(view.entity, table);
11859
+ }
11860
+ /**
11861
+ * The dev check after a view took a new item: when the `when`s of its projection answer otherwise
11862
+ * on it than at the birth, `world:initial-only-changed` is warned, once per view. Nothing changes
11863
+ * in the view. A release build asks nothing: the guard is inline, so a `define` of `false` folds
11864
+ * it. A `when` that throws here warns nothing: the reconcile of a dev build stops nowhere a release
11865
+ * build goes on.
11866
+ *
11867
+ * @param pctx - Domain context of the projection module.
11868
+ * @param spec - The projection spec.
11869
+ * @param view - The view, its item the new one.
11870
+ */
11871
+ function checkDrift(pctx, spec, view) {
11872
+ if (typeof __MOKU_GAME_DEV__ === "undefined" || !__MOKU_GAME_DEV__) return;
11873
+ if (view.maskWarned || spec.initialOnly === void 0) return;
11874
+ const book = pctx.ctx.state.projection.initialOnly.get(spec);
11875
+ if (book === void 0 || book.asks.length === 0) return;
11876
+ let mask;
11877
+ try {
11878
+ mask = maskOfBook(book, view.item);
11879
+ } catch {
11880
+ return;
11881
+ }
11882
+ if (mask === view.mask) return;
11883
+ view.maskWarned = true;
11884
+ pctx.ctx.log.warn("world:initial-only-changed", {
11885
+ projection: spec.name,
11886
+ key: view.key
11887
+ });
11751
11888
  }
11752
11889
  /**
11753
11890
  * Moves a view with a table of its own from one seed to the next: a set of the old seed goes, the
@@ -11757,7 +11894,7 @@ function seedMutes(state, spec, entity) {
11757
11894
  * @param state - The projection branch of the plugin state.
11758
11895
  * @param entity - The entity of the view.
11759
11896
  * @param stored - The table the view has now, if any.
11760
- * @param from - The seed of the old spec, if any.
11897
+ * @param from - The seed the view held, if any.
11761
11898
  * @param to - The seed of the new spec, if any.
11762
11899
  */
11763
11900
  function reseedOwn(state, entity, stored, from, to) {
@@ -11768,24 +11905,54 @@ function reseedOwn(state, entity, stored, from, to) {
11768
11905
  else state.mutes.set(entity, table);
11769
11906
  }
11770
11907
  /**
11771
- * Moves the views of a replaced projection from the seed of the old spec to the seed of the new
11772
- * one. A view that holds the old seed, or none when the old spec had none, takes the new seed. A
11773
- * view a `mute()` gave its own table keeps it: the sets of the old seed in it go, the new seed
11774
- * joins it.
11908
+ * Moves one view from the seed it holds to a new one. A view that holds its seed, or none, takes
11909
+ * the new seed. A view a `mute()` gave its own table keeps it: the sets of the old seed in it go,
11910
+ * the new seed joins it.
11775
11911
  *
11776
11912
  * @param state - The projection branch of the plugin state.
11777
- * @param name - The projection name.
11778
- * @param from - The seed of the old spec, if any.
11779
- * @param to - The seed of the new spec, if any.
11913
+ * @param view - The view.
11914
+ * @param to - The new seed, if any.
11780
11915
  */
11781
- function reseedViews(state, name, from, to) {
11916
+ function reseedView(state, view, to) {
11917
+ const from = view.seed;
11918
+ view.seed = to;
11782
11919
  if (from === to) return;
11783
- for (const view of state.byEntity.values()) {
11784
- if (view.projection !== name) continue;
11785
- const stored = state.mutes.get(view.entity);
11786
- if (stored !== from) reseedOwn(state, view.entity, stored, from, to);
11787
- else if (to === void 0) state.mutes.delete(view.entity);
11788
- else state.mutes.set(view.entity, to);
11920
+ const stored = state.mutes.get(view.entity);
11921
+ if (stored !== from) reseedOwn(state, view.entity, stored, from, to);
11922
+ else if (to === void 0) state.mutes.delete(view.entity);
11923
+ else state.mutes.set(view.entity, to);
11924
+ }
11925
+ /**
11926
+ * The views of one projection, in the order of `byEntity`.
11927
+ *
11928
+ * @param state - The projection branch of the plugin state.
11929
+ * @param name - The projection name.
11930
+ * @returns A new list.
11931
+ */
11932
+ function viewsOf(state, name) {
11933
+ const views = [];
11934
+ for (const view of state.byEntity.values()) if (view.projection === name) views.push(view);
11935
+ return views;
11936
+ }
11937
+ /**
11938
+ * Replaces the `initialOnly` of a registered projection: checks the new spec, asks its `when`s on
11939
+ * the item every view of the projection shows now, then keeps its seed book and moves each view
11940
+ * from the seed it holds to the seed of its new answers. Every mask is asked before anything
11941
+ * moves, so a `when` that throws leaves the state as it was.
11942
+ *
11943
+ * @param state - The projection branch of the plugin state.
11944
+ * @param spec - The new spec, not yet stored.
11945
+ * @throws {Error} For a spec `learnSeed` refuses, and what a `when` throws; nothing moves then.
11946
+ */
11947
+ function replaceSeed(state, spec) {
11948
+ const book = checkBook(spec);
11949
+ const views = viewsOf(state, spec.name);
11950
+ const masks = views.map((view) => maskOfBook(book, view.item));
11951
+ if (book !== void 0) state.initialOnly.set(spec, book);
11952
+ for (const [index, view] of views.entries()) {
11953
+ const mask = masks[index] ?? 0;
11954
+ view.mask = mask;
11955
+ reseedView(state, view, book === void 0 ? void 0 : seedFor(book, mask));
11789
11956
  }
11790
11957
  }
11791
11958
  //#endregion
@@ -12094,19 +12261,22 @@ function coolShown(state, name, view) {
12094
12261
  /**
12095
12262
  * Writes the difference between a view's rest pose and a new output of `view` straight onto its entity: added and
12096
12263
  * changed components are written, removed ones taken off, no hook runs and no motion plays. The direct write of a
12097
- * changed item, for a held view and for the one the open shows.
12264
+ * changed item, for a held view and for the one the open shows. The view takes the new item, so a dev build checks
12265
+ * the `initialOnly` answers of its birth against it (`checkDrift`).
12098
12266
  *
12099
12267
  * @param pctx - Domain context of the projection module.
12268
+ * @param spec - The projection spec.
12100
12269
  * @param view - The view.
12101
12270
  * @param next - The new output of `view(item)`, by component name.
12102
12271
  * @param item - The item it was made from.
12103
12272
  */
12104
- function writeDifference(pctx, view, next, item) {
12273
+ function writeDifference(pctx, spec, view, next, item) {
12105
12274
  const { changed } = diffComponents(view.rest, next, pctx.deps.components.Tree.componentName);
12106
12275
  for (const [name, value] of next) if (!view.rest.has(name)) writeValue(pctx, view.entity, value);
12107
12276
  for (const [name, value] of view.rest) if (!next.has(name)) pctx.deps.ecs.remove(view.entity, value.type);
12108
12277
  view.rest = next;
12109
12278
  view.item = item;
12279
+ checkDrift(pctx, spec, view);
12110
12280
  finishHandles(view);
12111
12281
  writeRestNow(pctx, view, changed);
12112
12282
  }
@@ -12204,6 +12374,22 @@ function viewOfItem(pctx, spec, item) {
12204
12374
  }
12205
12375
  }
12206
12376
  /**
12377
+ * Asks the `initialOnly` `when`s of a spec on a warm item. A throw is logged as a projection that failed.
12378
+ *
12379
+ * @param pctx - Domain context of the projection module.
12380
+ * @param spec - The projection spec.
12381
+ * @param item - The warm item.
12382
+ * @returns The answer mask, or `undefined` when a `when` threw.
12383
+ */
12384
+ function maskOfItem(pctx, spec, item) {
12385
+ try {
12386
+ return birthMask(pctx.ctx.state.projection, spec, item);
12387
+ } catch (error) {
12388
+ pctx.ctx.log.error("world:projection-failed", { projection: spec.name }, asError$2(error));
12389
+ return;
12390
+ }
12391
+ }
12392
+ /**
12207
12393
  * Starts the work of a record: it becomes the record in work, `left()` counts the warm budget from the frame rate
12208
12394
  * the loop runs at, and the loop is woken, so the building frames come at the full rate.
12209
12395
  *
@@ -12221,7 +12407,7 @@ function startWork(pctx, record) {
12221
12407
  * Spawns the held view of a warm item, as a scene build spawns a view: bare, flagged held, then its `Layer` and its
12222
12408
  * view components, so an `onAdded` hook already asks `isBuilding` true, and with `"change"` as its cause, so its
12223
12409
  * enter plays when it is shown. The record is in work from before the spawn: what ui marks in its hooks is the
12224
- * record's. Nothing is spawned when `view` throws.
12410
+ * record's. The `initialOnly` `when`s are asked on the warm item. Nothing is spawned when `view` or a `when` throws.
12225
12411
  *
12226
12412
  * @param pctx - Domain context of the projection module.
12227
12413
  * @param spec - The projection spec.
@@ -12233,12 +12419,15 @@ function startWork(pctx, record) {
12233
12419
  function spawnWarm(pctx, spec, record, warm) {
12234
12420
  const values = viewOfItem(pctx, spec, warm.item);
12235
12421
  if (values === void 0) return;
12422
+ const mask = maskOfItem(pctx, spec, warm.item);
12423
+ if (mask === void 0) return;
12236
12424
  const state = pctx.ctx.state.projection;
12237
12425
  startWork(pctx, record);
12238
12426
  const entity = spawnFlagged(pctx, spec, values, state.warmHeld);
12239
12427
  const view = createViewRecord(entity, spec.name, warm.key, warm.item, values, "change");
12240
12428
  record.entities.add(entity);
12241
- seedMutes(state, spec, entity);
12429
+ view.mask = mask;
12430
+ seedMutes(state, spec, view);
12242
12431
  state.byEntity.set(entity, view);
12243
12432
  record.view = view;
12244
12433
  record.key = warm.key;
@@ -12267,7 +12456,7 @@ function refreshWarm(pctx, spec, record, warm) {
12267
12456
  return true;
12268
12457
  }
12269
12458
  startWork(pctx, record);
12270
- writeDifference(pctx, view, next, warm.item);
12459
+ writeDifference(pctx, spec, view, next, warm.item);
12271
12460
  record.item = warm.item;
12272
12461
  return true;
12273
12462
  }
@@ -12456,6 +12645,7 @@ function playEnter$1(pctx, spec, view, entry) {
12456
12645
  function enterEntry(pctx, spec, mounted, entry) {
12457
12646
  const values = collectView(pctx, spec, entry.item);
12458
12647
  const state = pctx.ctx.state.projection;
12648
+ const mask = birthMask(state, spec, entry.item);
12459
12649
  const building = state.building;
12460
12650
  let entity;
12461
12651
  if (building?.mounted.get(spec.name) === mounted) entity = spawnFlagged(pctx, spec, values, building.entities);
@@ -12467,7 +12657,8 @@ function enterEntry(pctx, spec, mounted, entry) {
12467
12657
  }, [layer, ...values.values()]);
12468
12658
  }
12469
12659
  const view = createViewRecord(entity, spec.name, entry.key, entry.item, values, entry.direct ? "mount" : "change");
12470
- seedMutes(state, spec, entity);
12660
+ view.mask = mask;
12661
+ seedMutes(state, spec, view);
12471
12662
  mounted.live.set(entry.key, view);
12472
12663
  state.byEntity.set(entity, view);
12473
12664
  state.membershipVersion += 1;
@@ -12495,8 +12686,10 @@ function adoptEntry(pctx, spec, mounted, record, entry) {
12495
12686
  const view = record.view;
12496
12687
  const next = sameItem(record.item, entry.item) ? void 0 : collectView(pctx, spec, entry.item);
12497
12688
  showHeld$1(pctx, mounted, record, entry.direct ? "mount" : "change");
12498
- if (next === void 0) view.item = entry.item;
12499
- else writeDifference(pctx, view, next, entry.item);
12689
+ if (next === void 0) {
12690
+ view.item = entry.item;
12691
+ checkDrift(pctx, spec, view);
12692
+ } else writeDifference(pctx, spec, view, next, entry.item);
12500
12693
  playEnter$1(pctx, spec, view, entry);
12501
12694
  }
12502
12695
  /**
@@ -12529,12 +12722,14 @@ function changeEntry(pctx, spec, view, entry) {
12529
12722
  const previous = view.item;
12530
12723
  if (!entry.direct && !entry.force && added.length + changed.length + removed.length === 0) {
12531
12724
  view.item = entry.item;
12725
+ checkDrift(pctx, spec, view);
12532
12726
  return false;
12533
12727
  }
12534
12728
  for (const value of valuesOf(next, added)) writeValue(pctx, view.entity, value);
12535
12729
  for (const value of valuesOf(view.rest, removed)) pctx.deps.ecs.remove(view.entity, value.type);
12536
12730
  view.rest = next;
12537
12731
  view.item = entry.item;
12732
+ checkDrift(pctx, spec, view);
12538
12733
  if (entry.direct) {
12539
12734
  finishHandles(view);
12540
12735
  writeRestNow(pctx, view, [...next.keys()]);
@@ -12585,6 +12780,7 @@ function reviveEntry(pctx, spec, mounted, view, entry) {
12585
12780
  for (const value of valuesOf(view.rest, removed)) pctx.deps.ecs.remove(view.entity, value.type);
12586
12781
  view.rest = next;
12587
12782
  view.item = entry.item;
12783
+ checkDrift(pctx, spec, view);
12588
12784
  if (entry.direct) {
12589
12785
  writeRestNow(pctx, view, [...next.keys()]);
12590
12786
  entry.rewritten.push(view);
@@ -13552,14 +13748,11 @@ function createProjectionApi(ctx, deps) {
13552
13748
  state.specs.set(spec.name, spec);
13553
13749
  },
13554
13750
  replace: (spec) => {
13555
- const previous = state.specs.get(spec.name);
13556
- if (previous === void 0) throw new Error(`[game] Projection "${spec.name}" is not registered.\n Register it before replacing it.`);
13751
+ if (state.specs.get(spec.name) === void 0) throw new Error(`[game] Projection "${spec.name}" is not registered.\n Register it before replacing it.`);
13557
13752
  const mounted = state.mounted.has(spec.name);
13558
13753
  if (mounted) checkLayers(spec, state.layers);
13559
- const from = state.initialOnly.get(previous);
13560
- const seed = learnSeed(state, spec);
13754
+ replaceSeed(state, spec);
13561
13755
  state.specs.set(spec.name, spec);
13562
- reseedViews(state, spec.name, from, seed);
13563
13756
  if (!mounted) return;
13564
13757
  if (spec.warm === void 0 && !state.held.has(spec.name)) forgetWarm(pctx, spec.name);
13565
13758
  else ensureWarm(state, spec);
@@ -74983,7 +75176,8 @@ function scenesFor() {
74983
75176
  * Types a projection: keyed items of the model turned into entities. `Item` is inferred from the
74984
75177
  * return of `from` and reaches `key`, `view` and every motion hook; `layer` and `lift` stay
74985
75178
  * literal, so `defineScene` can check them against the layers of the scene. Each pair of
74986
- * `initialOnly` has its field names checked against its own component.
75179
+ * `initialOnly` has its field names checked against its own component, and its `when`, if any,
75180
+ * takes the item.
74987
75181
  *
74988
75182
  * @param spec - Name, layer, optional lift layer, `from`, `key`, `view`, the motion hooks and
74989
75183
  * the `initialOnly` fields.
@@ -1,7 +1,7 @@
1
- import { Fr as ClockSource, Jn as NodeFx, Lr as FakeClock, Nn as AnyFlow, Un as Descriptor, Ur as Json, jn as FeaturePlugin, qn as Hint, zn as NodeTable } from "./types-KRAWEuUs.mjs";
2
- import { t as createApp } from "./index-DuPTdMhJ.mjs";
3
- import { b as memory, x as saveOf, y as WithGameState } from "./types-COMxJbej.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-DDAKncmX.mjs";
1
+ import { Fr as ClockSource, Jn as NodeFx, Lr as FakeClock, Nn as AnyFlow, Un as Descriptor, Ur as Json, jn as FeaturePlugin, qn as Hint, zn as NodeTable } from "./types-DQWTawIz.mjs";
2
+ import { t as createApp } from "./index-CFq7H9zQ.mjs";
3
+ import { b as memory, x as saveOf, y as WithGameState } from "./types-BXfauLJW.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-CWa3MHQi.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 { dn as refuseStart, gn as type, pn as exit, t as createApp, w as flattenFeatures } from "./src-DnqlJ1XY.mjs";
1
+ import { dn as refuseStart, gn as type, pn as exit, t as createApp, w as flattenFeatures } from "./src-BLbBo_Ih.mjs";
2
2
  import { n as saveOf, t as memory } from "./memory-DeD9wis6.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,4 +1,4 @@
1
- import { J as TransformValue, Or as TagType, Pr as Api$5, Qn as ChangeHook, Un as Descriptor, Ur as Json, Xn as Answered, Z as Api$3, Zn as AnchorTarget, _r as ComponentType, ar as ProjectionMotion, dr as ViewHandle, er as Ease, et as PixiContainer, fr as AnyComponent, ir as NumericFields, kr as Api$2, li as Api, mr as AnyComponentValue, nr as MotionCause, pn as Api$1, pr as AnyComponentType, qn as Hint, rr as MotionHandle, rt as PixiModule, s as Events$1, sr as ReducedMotion, t as Api$4, tr as Motion, vt as ViewportSize, yi as Require, yr as Entity } from "./types-KRAWEuUs.mjs";
1
+ import { J as TransformValue, Or as TagType, Pr as Api$5, Qn as ChangeHook, Un as Descriptor, Ur as Json, Xn as Answered, Z as Api$3, Zn as AnchorTarget, _r as ComponentType, ar as ProjectionMotion, dr as ViewHandle, er as Ease, et as PixiContainer, fr as AnyComponent, ir as NumericFields, kr as Api$2, li as Api, mr as AnyComponentValue, nr as MotionCause, pn as Api$1, pr as AnyComponentType, qn as Hint, rr as MotionHandle, rt as PixiModule, s as Events$1, sr as ReducedMotion, t as Api$4, tr as Motion, vt as ViewportSize, yi as Require, yr as Entity } from "./types-DQWTawIz.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 { A as FilterSlotQuad, Br as Api$6, Hn as TypeTag, Hr as Events$3, O as FilterSlot, Un as Descriptor, Ur as Json, Z as Api$4, Zn as AnchorTarget, _r as ComponentType, _t as Point, ai as Events$5, at as PixiTexture, b as Events$4, er as Ease, fr as AnyComponent, hr as ComponentHandle, ir as NumericFields, it as PixiSprite, j as SyncApi, k as FilterSlotInputs, kr as Api$3, li as Api$1, lr as TrackOptions, mr as AnyComponentValue, nt as PixiGpuProgram, ot as PixiUniformGroup, pn as Api$2, rr as MotionHandle, rt as PixiModule, s as Events$1, sr as ReducedMotion, t as Api$5, tt as PixiFilter, ur as TrackSegment, vi as Events$2, yi as Require, yr as Entity, yt as FilterCache } from "./types-KRAWEuUs.mjs";
2
- import { R as InputApi, T as TextApi, U as I18nApi, c as UiNode, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion, tt as StylesState } from "./types-BFWYGikY.mjs";
1
+ import { A as FilterSlotQuad, Br as Api$6, Hn as TypeTag, Hr as Events$3, O as FilterSlot, Un as Descriptor, Ur as Json, Z as Api$4, Zn as AnchorTarget, _r as ComponentType, _t as Point, ai as Events$5, at as PixiTexture, b as Events$4, er as Ease, fr as AnyComponent, hr as ComponentHandle, ir as NumericFields, it as PixiSprite, j as SyncApi, k as FilterSlotInputs, kr as Api$3, li as Api$1, lr as TrackOptions, mr as AnyComponentValue, nt as PixiGpuProgram, ot as PixiUniformGroup, pn as Api$2, rr as MotionHandle, rt as PixiModule, s as Events$1, sr as ReducedMotion, t as Api$5, tt as PixiFilter, ur as TrackSegment, vi as Events$2, yi as Require, yr as Entity, yt as FilterCache } from "./types-DQWTawIz.mjs";
2
+ import { R as InputApi, T as TextApi, U as I18nApi, c as UiNode, i as Finding, l as LayoutState, n as ElementChange, o as JsxState, r as ElementMotion, tt as StylesState } from "./types-B7maCx9u.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
  import { PluginCtx } from "@moku-labs/core";
5
5
 
@@ -1,7 +1,7 @@
1
- import { $r as SnapshotOf, Fr as ClockSource, Hn as TypeTag, Jr as PlayerStateProvider, Lr as FakeClock, Nn as AnyFlow, Q as Config$2, Ur as Json, Vr as Config, Xr as SaveDoc, Yr as ProviderCall, a as Config$3, d as Manifest, gt as Orientation, hn as Config$1, jn as FeaturePlugin, n as AssetsIo, rt as PixiModule } from "./types-KRAWEuUs.mjs";
2
- import { o as AudioContextLike, s as Config$4 } from "./types-CpoZ-UDH.mjs";
3
- import { J as StringTable, U as I18nApi, Y as TextKey } from "./types-BFWYGikY.mjs";
4
- import { Et as PlatformProvider, It as audioPlugin, Nt as effectsPlugin, i as screen, t as createApp, wt as platformPlugin } from "./index-DuPTdMhJ.mjs";
1
+ import { $r as SnapshotOf, Fr as ClockSource, Hn as TypeTag, Jr as PlayerStateProvider, Lr as FakeClock, Nn as AnyFlow, Q as Config$2, Ur as Json, Vr as Config, Xr as SaveDoc, Yr as ProviderCall, a as Config$3, d as Manifest, gt as Orientation, hn as Config$1, jn as FeaturePlugin, n as AssetsIo, rt as PixiModule } from "./types-DQWTawIz.mjs";
2
+ import { o as AudioContextLike, s as Config$4 } from "./types-BTR9r8se.mjs";
3
+ import { J as StringTable, U as I18nApi, Y as TextKey } from "./types-B7maCx9u.mjs";
4
+ import { Et as PlatformProvider, It as audioPlugin, Nt as effectsPlugin, i as screen, t as createApp, wt as platformPlugin } from "./index-CFq7H9zQ.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 { Qr as Snapshot, Ur as Json } from "./types-KRAWEuUs.mjs";
2
- import { t as HeadlessApp } from "./headless-DDAKncmX.mjs";
1
+ import { Qr as Snapshot, Ur as Json } from "./types-DQWTawIz.mjs";
2
+ import { t as HeadlessApp } from "./headless-CWa3MHQi.mjs";
3
3
  import { Log } from "@moku-labs/common/browser";
4
4
 
5
5
  //#region src/plugins/flow/doors/types.d.ts
@@ -3746,28 +3746,51 @@ type AnyProjectionMotion = {
3746
3746
  };
3747
3747
  /**
3748
3748
  * One pair of `ProjectionSpec.initialOnly`: a component and the fields of it that `view` gives a
3749
- * view once, when it is born. The field names are checked against the component's own value.
3749
+ * view once, when it is born. The field names are checked against the component's own value. A
3750
+ * third element, `when`, covers only the views whose item answers true at their birth; `Item` is
3751
+ * the item `from` gives, so `when` reads its fields checked. The answer is fixed for the life of
3752
+ * the view. Without `when` the pair covers every view.
3750
3753
  *
3751
3754
  * @example
3752
3755
  * ```ts
3756
+ * // The arc of every ring is the system's.
3753
3757
  * const arc: InitialOnlyPair<ShapeValue> = [Shape, ["sweep"]];
3758
+ * // Only the hand of the stopwatch turns with the clock; its bolt keeps the rotation `view` gives.
3759
+ * type Part = { id: string; role: "bolt" | "restHand" };
3760
+ * const hand: InitialOnlyPair<TransformValue, Part> = [Transform, ["rotation"], part => part.role === "restHand"];
3761
+ * hand[2]?.({ id: "hand", role: "restHand" }); // true
3762
+ * hand[2]?.({ id: "bolt", role: "bolt" }); // false
3754
3763
  * ```
3755
3764
  */
3756
- type InitialOnlyPair<Value extends object> = readonly [ComponentHandle<Value>, readonly (keyof Value & string)[]];
3765
+ type InitialOnlyPair<Value extends object, Item = unknown> = readonly [ComponentHandle<Value>, readonly (keyof Value & string)[]] | readonly [ComponentHandle<Value>, readonly (keyof Value & string)[], (item: NoInfer<Item>) => boolean];
3757
3766
  /**
3758
3767
  * The `initialOnly` list of a projection: one pair for each value type of `Values`, each pair
3759
- * checked against its own component. `projection()` infers `Values` from the list, so
3760
- * `[[Shape, ["swep"]]]` is a type error.
3768
+ * checked against its own component, and each `when` typed with the item `Item` of `from`.
3769
+ * `projection()` infers `Values` from the list and `Item` from `from`, so `[[Shape, ["swep"]]]`
3770
+ * and a `when` that reads a field the item lacks are type errors.
3761
3771
  *
3762
3772
  * @example
3763
3773
  * ```ts
3764
- * const fields: InitialOnly<[ShapeValue, TransformValue]> = [
3774
+ * type Part = { id: string; role: "bolt" | "restHand" };
3775
+ * const fields: InitialOnly<[ShapeValue, TransformValue], Part> = [
3765
3776
  * [Shape, ["sweep", "alpha"]],
3766
- * [Transform, ["rotation"]]
3777
+ * [Transform, ["rotation"], part => part.role === "restHand"]
3767
3778
  * ];
3768
3779
  * ```
3769
3780
  */
3770
- type InitialOnly<Values extends readonly object[]> = { readonly [Index in keyof Values]: InitialOnlyPair<Values[Index]> };
3781
+ type InitialOnly<Values extends readonly object[], Item = unknown> = { readonly [Index in keyof Values]: InitialOnlyPair<Values[Index], Item> };
3782
+ /**
3783
+ * The `when` of an `initialOnly` pair with the item type erased, as the world stores it. A method
3784
+ * signature, so a `when` typed for a game's item still reaches the erased spec.
3785
+ */
3786
+ type AnyWhen = {
3787
+ bivariant(item: unknown): boolean;
3788
+ }["bivariant"];
3789
+ /**
3790
+ * One `initialOnly` pair of an erased spec: the component, its field names no longer tied to it,
3791
+ * and the `when` if any.
3792
+ */
3793
+ type AnyInitialOnlyPair = readonly [ComponentHandle<object>, readonly string[], AnyWhen?];
3771
3794
  /**
3772
3795
  * A scene switch, as a plugin hands it to a projection with `projection.feed`: the scene left, the scene entered, and
3773
3796
  * the share of the switch's bundles loaded, 0 to 1. The projection's `from` reads it as its third argument. `scenes`
@@ -3844,6 +3867,13 @@ type ProjectionSpec<Item, LayerName extends string, LiftName extends string, Pla
3844
3867
  * rules of `mute()`, for every view of the projection and for its whole life. A `mute()` on the
3845
3868
  * view adds to them, and its release keeps them. Left out, the projection writes every field.
3846
3869
  *
3870
+ * A third element, `when(item)`, covers only some views: it is asked once, at the birth of a
3871
+ * view (for a view a warm window builds, on the warm item), and the answer holds for the life of
3872
+ * the view. A `when` that throws is a failed birth, `world:projection-failed`, as a `view` that
3873
+ * throws. A dev build warns `world:initial-only-changed` once per view when a later item would
3874
+ * answer otherwise; nothing changes in the view. `replace` asks the new spec's `when` on the item
3875
+ * each live view shows.
3876
+ *
3847
3877
  * @example
3848
3878
  * ```ts
3849
3879
  * // The timer ring of a chest: born full, then the system `board.rings` draws its arc from `Now`.
@@ -3863,8 +3893,23 @@ type ProjectionSpec<Item, LayerName extends string, LiftName extends string, Pla
3863
3893
  * });
3864
3894
  * // The fade ends with the 0.42 the system wrote: no full ring, no `world:view-corrected`.
3865
3895
  * ```
3896
+ * @example
3897
+ * ```ts
3898
+ * // The stopwatch: its bolt tweens home with the enter motion, its hand turns with `Now`.
3899
+ * export const stopwatch = projection({
3900
+ * name: "board.stopwatch",
3901
+ * layer: "marks",
3902
+ * from: (player: Player) => player.board.stopwatch.parts,
3903
+ * key: part => part.id,
3904
+ * view: part => [Transform({ x: part.x, y: part.y, rotation: part.rotation })],
3905
+ * motion: { enter: view => view.toRest(Transform, { ms: 300 }) },
3906
+ * initialOnly: [[Transform, ["rotation"], part => part.role === "restHand"]]
3907
+ * });
3908
+ * // The hand keeps the angle `board.hand` writes through the enter, a lift and the way home;
3909
+ * // the bolt still ends at its rest rotation.
3910
+ * ```
3866
3911
  */
3867
- readonly initialOnly?: InitialOnly<Values>;
3912
+ readonly initialOnly?: InitialOnly<Values, Item>;
3868
3913
  /**
3869
3914
  * The item a closed window of this projection is kept built for, so it opens in the frame after the tap. While
3870
3915
  * `from` does not show its key (`key(item)`, or the name of the projection without `key`), the engine builds its
@@ -3921,8 +3966,8 @@ type AnyProjectionSpec = {
3921
3966
  from(player: Json, session: Json, sw: SceneSwitch | undefined): unknown;
3922
3967
  key?(item: unknown): string;
3923
3968
  view(item: unknown): ViewOutput;
3924
- readonly motion?: AnyProjectionMotion; /** The `initialOnly` pairs, their field names no longer tied to the component. */
3925
- readonly initialOnly?: readonly (readonly [ComponentHandle<object>, readonly string[]])[]; /** The item a closed window is kept built for, its type erased as `from`'s. */
3969
+ readonly motion?: AnyProjectionMotion; /** The `initialOnly` pairs, their field names no longer tied to the component, each with its `when` if any. */
3970
+ readonly initialOnly?: readonly AnyInitialOnlyPair[]; /** The item a closed window is kept built for, its type erased as `from`'s. */
3926
3971
  warm?(player: Json, session: Json): unknown;
3927
3972
  };
3928
3973
  /**
@@ -3962,6 +4007,13 @@ type View$1 = {
3962
4007
  loopOwed: boolean;
3963
4008
  exiting: boolean; /** How the view came, then how it leaves. */
3964
4009
  cause: MotionCause;
4010
+ /**
4011
+ * The `initialOnly` seed the view was born with, the table of its answers: what the release of a
4012
+ * `mute()` keeps. `undefined` for a view no pair covers. A `replace` moves it to the new spec's.
4013
+ */
4014
+ seed: MuteTable | undefined; /** The answers of the `when`s at the birth (or the last `replace`): bit i for the i-th pair with a `when`. */
4015
+ mask: number; /** A dev build warned `world:initial-only-changed` for this view: it warns once. */
4016
+ maskWarned: boolean;
3965
4017
  };
3966
4018
  /**
3967
4019
  * One mounted projection: its owner, the live views by key, the despawn queue, the items of the
@@ -4071,6 +4123,16 @@ type Dirty = {
4071
4123
  * it, and `mute()` copies it before it adds a field.
4072
4124
  */
4073
4125
  type MuteTable = ReadonlyMap<string, ReadonlySet<string>>;
4126
+ /**
4127
+ * The `initialOnly` of one spec, checked: its pairs, where the pairs with a `when` are, and the
4128
+ * frozen seed of every answer mask a view was born with so far. Views with the same answers share
4129
+ * one seed. A mask that covers no pair has `undefined`: no seed.
4130
+ */
4131
+ type SeedBook = {
4132
+ /** The spec's `initialOnly` pairs, checked at `register` or `replace`: every one has a field, every `when` is a function. */readonly pairs: readonly AnyInitialOnlyPair[]; /** The indices in `pairs` of the pairs with a `when`, in order: the i-th is bit i of a mask. */
4133
+ readonly asks: readonly number[]; /** Answer mask to its frozen seed, filled the first time a view is born with that mask; `undefined` covers no pair. */
4134
+ readonly seeds: Map<number, MuteTable | undefined>;
4135
+ };
4074
4136
  /**
4075
4137
  * A mute's fields joined with a type's owned fields, and the owned set they were joined with.
4076
4138
  */
@@ -4106,8 +4168,8 @@ type ProjectionState = {
4106
4168
  * the shared `initialOnly` seed a view of such a projection is born with. A view a listener of
4107
4169
  * its spawn muted keeps that table, and the seed joins it.
4108
4170
  */
4109
- mutes: Map<Entity, MuteTable>; /** The `initialOnly` seed of each registered spec that has one, frozen, built at `register` and `replace`. */
4110
- initialOnly: WeakMap<AnyProjectionSpec, MuteTable>; /** The owned fields of each component type as a set, by the type's frozen `owned` list: made once. */
4171
+ mutes: Map<Entity, MuteTable>; /** The `initialOnly` seed book of each registered spec that has the option, checked at `register` and `replace`. */
4172
+ initialOnly: WeakMap<AnyProjectionSpec, SeedBook>; /** The owned fields of each component type as a set, by the type's frozen `owned` list: made once. */
4111
4173
  ownedSets: WeakMap<readonly string[], ReadonlySet<string>>; /** The muted and the owned fields joined, by the mute's field set: dropped when `mute()` or its release changes it. */
4112
4174
  joinedMutes: WeakMap<ReadonlySet<string>, JoinedFields>; /** The `onConverged` listeners: the owners of elements, told after a restore or a load. */
4113
4175
  converged: Array<() => void>;
@@ -4246,11 +4308,14 @@ type ProjectionApi = {
4246
4308
  /**
4247
4309
  * Swaps the stored spec of a registered projection. A mounted one has its layers checked against
4248
4310
  * the current scene and runs the new `view` for every item on the next frame, directly. An
4249
- * unmounted one is only stored; its next `mount` uses it. Nothing changes when the call throws.
4311
+ * unmounted one is only stored; its next `mount` uses it. The new spec's `initialOnly` `when`s
4312
+ * are asked on the item each live view shows now, before any view moves to the fields of its new
4313
+ * answers. Nothing changes when the call throws, also when a `when` throws.
4250
4314
  *
4251
4315
  * @param spec - The new projection, under the name it was registered with.
4252
- * @throws {Error} When no projection of that name is registered, or when a mounted one names a
4253
- * `layer` or `lift` the scene does not declare.
4316
+ * @throws {Error} When no projection of that name is registered, when a mounted one names a
4317
+ * `layer` or `lift` the scene does not declare, when its `initialOnly` is refused, or what a
4318
+ * `when` throws.
4254
4319
  * @example
4255
4320
  * ```ts
4256
4321
  * // The dev hot swap in `ui`: the saved `view.ts` exports a new `boardItems`.
@@ -1,9 +1,9 @@
1
- import { Br as Api$2, Pr as Api$4, Z as Api, kr as Api$1, ri as Api$3 } from "./types-KRAWEuUs.mjs";
2
- import { W as AnimApi, r as UiApi } from "./types-CpoZ-UDH.mjs";
3
- import { R as InputApi } from "./types-BFWYGikY.mjs";
4
- import { r as Repro } from "./headless-DDAKncmX.mjs";
5
- import { i as ControlApp, o as InputOf } from "./types-Ca0PmSri.mjs";
6
- import { t as commands } from "./commands-DW0HRGor.mjs";
1
+ import { Br as Api$2, Pr as Api$4, Z as Api, kr as Api$1, ri as Api$3 } from "./types-DQWTawIz.mjs";
2
+ import { W as AnimApi, r as UiApi } from "./types-BTR9r8se.mjs";
3
+ import { R as InputApi } from "./types-B7maCx9u.mjs";
4
+ import { r as Repro } from "./headless-CWa3MHQi.mjs";
5
+ import { i as ControlApp, o as InputOf } from "./types-CThqFAwa.mjs";
6
+ import { t as commands } from "./commands-wfLkpPZC.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-pvIoUjpL.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-D62TNaW-.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.105",
3
+ "version": "0.15.106",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [