@moku-labs/game 0.15.143 → 0.15.144

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/app.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-Dq7gGhN4.mjs";
1
+ import { Gt as audioPlugin, Pt as effectsPlugin, Q as platformPlugin, i as screen, t as createApp, w as flattenFeatures } from "./src-Ckz4E7D4.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/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 lifecyclePlugin, 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 timePlugin, xt as Hovered, y as schedule, yn as clockPlugin, yt as DropTarget, z as types_exports$8, zt as Displacement } from "./src-Dq7gGhN4.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 lifecyclePlugin, 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 timePlugin, xt as Hovered, y as schedule, yn as clockPlugin, yt as DropTarget, z as types_exports$8, zt as Displacement } from "./src-Ckz4E7D4.mjs";
2
2
  import { $ as Overlay, D as defineStyle, E as defineTokens, L as defineTextFormats, M as Countdown, N as Text, P as bind, Q as NineSlice, R as defineTextStyles, X as Display, Z as HudPart, _ as DebugTrigger, ct as Exiting, dt as Order, ft as Tree, gt as system, h as Box, ht as resource, it as Transform, lt as Layer, mt as mut, nt as Shape, pt as component, rt as Sprite, st as sprite, tt as Parent, ut as Now, vt as tag, w as popup, x as ScrollState, y as LocalWrite, z as label } from "./visual-x0TPowBE.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 };
@@ -41083,6 +41083,26 @@ function easeCell(ease, cells, at) {
41083
41083
  case "outBack": cells[at] = 1 + 2.70158 * (t - 1) ** 3 + BACK * (t - 1) ** 2;
41084
41084
  }
41085
41085
  }
41086
+ /** The cell `applyEase` eases in. */
41087
+ const EASED = /* @__PURE__ */ new Float64Array(1);
41088
+ /**
41089
+ * Eases a normalised time. A curve nobody knows is linear, and a function ease is called with
41090
+ * the same normalised time.
41091
+ *
41092
+ * @param ease - The curve to apply.
41093
+ * @param t - Normalised time between 0 and 1.
41094
+ * @returns The eased fraction. `inBack` dips below 0 and `outBack` rises above 1 in the middle.
41095
+ * @example
41096
+ * ```ts
41097
+ * applyEase("out", 0.5); // 0.75
41098
+ * applyEase("inCubic", 0.5); // 0.125
41099
+ * ```
41100
+ */
41101
+ function applyEase(ease, t) {
41102
+ EASED[0] = t;
41103
+ easeCell(ease, EASED, 0);
41104
+ return EASED[0] ?? 0;
41105
+ }
41086
41106
  //#endregion
41087
41107
  //#region src/plugins/anim/tween/advance.ts
41088
41108
  /**
@@ -68035,24 +68055,49 @@ function levelTo(ctx, layout, element, target) {
68035
68055
  layout.playTrack(element, (view) => view.tween(OverlayLevel, { level }, track));
68036
68056
  }
68037
68057
  /**
68058
+ * The fade of an entering overlay from its mount frame on (F205). Its track starts in phase `sync`, after that frame's
68059
+ * `animate` step, so it first moves in the next frame and the mount frame would draw the dim at 0. So the level is
68060
+ * written now where the fade is after the frame's time, and the track runs the rest of the fade: it lands `fade` after
68061
+ * the mount, on the same curve within a hundredth. A frame as long as the fade sets the level at once.
68062
+ *
68063
+ * @param ctx - Domain context of the ui plugin.
68064
+ * @param element - The entering overlay.
68065
+ * @param fade - The track of its `fade`.
68066
+ * @param deltaMs - The game time of the mount frame.
68067
+ * @returns The rest of the track, or `undefined` for a level written at once.
68068
+ */
68069
+ function fadeFromMount(ctx, element, fade, deltaMs) {
68070
+ if (deltaMs <= 0) return fade;
68071
+ if (deltaMs >= fade.ms) return void 0;
68072
+ const level = applyEase(fade.ease ?? "out", deltaMs / fade.ms);
68073
+ ctx.deps.world.ecs.set(element.entity, OverlayLevel, { level });
68074
+ return {
68075
+ ...fade,
68076
+ ms: fade.ms - deltaMs
68077
+ };
68078
+ }
68079
+ /**
68038
68080
  * Starts the level of an entering overlay with its enter motion: 0 to 1 over the root's own motion, or over `fade`
68039
- * when it played none; `fade` 0 sets it at once, and the next solve lands it.
68081
+ * when it played none, already the mount frame's time into it (F205); `fade` 0 sets it at once, and the next solve
68082
+ * lands it.
68040
68083
  *
68041
68084
  * @param ctx - Domain context of the ui plugin.
68042
68085
  * @param state - The jsx state.
68043
68086
  * @param layout - The layout module.
68044
- * @param entering - The entering element and the longest timed track its enter hook started.
68087
+ * @param entering - The entering element, the longest timed track its enter hook started, and the frame's time.
68045
68088
  * @param entering.element - The entering element.
68046
68089
  * @param entering.span - The span its enter hook played.
68090
+ * @param entering.deltaMs - The game time of the frame it enters in.
68047
68091
  */
68048
68092
  function enterOverlay(ctx, state, layout, entering) {
68049
- const { element, span } = entering;
68093
+ const { element, span, deltaMs } = entering;
68050
68094
  const value = overlayOf(element);
68051
68095
  if (value === void 0) return;
68052
68096
  state.overlays.add(element.entity);
68097
+ const track = levelTrack(span, value.fade, "out");
68053
68098
  levelTo(ctx, layout, element, {
68054
68099
  level: 1,
68055
- track: levelTrack(span, value.fade, "out")
68100
+ track: track === void 0 || span.end > 0 ? track : fadeFromMount(ctx, element, track, deltaMs)
68056
68101
  });
68057
68102
  }
68058
68103
  /**
@@ -70881,8 +70926,10 @@ function createReconciler(ctx, modules, fields) {
70881
70926
  * loop and the level of an overlay start in the frame the root is first drawn. While nothing was
70882
70927
  * queued since the last call and no root was released, the queue holds only held enters and is
70883
70928
  * not walked.
70929
+ *
70930
+ * @param time - The frame's time: the level of a fading overlay starts that far into its fade (F205).
70884
70931
  */
70885
- function playEntered() {
70932
+ function playEntered(time = NO_TIME) {
70886
70933
  const entering = state.entering;
70887
70934
  const version = ctx.deps.world.projection.membershipVersion();
70888
70935
  if (entering.count === heldEnters && version === enteredSeen) return;
@@ -70895,7 +70942,7 @@ function createReconciler(ctx, modules, fields) {
70895
70942
  if (isAside(element.root)) {
70896
70943
  entering.list[held] = entity;
70897
70944
  held += 1;
70898
- } else playEnter(element);
70945
+ } else playEnter(element, time.delta);
70899
70946
  }
70900
70947
  entering.count = held;
70901
70948
  heldEnters = held;
@@ -70905,8 +70952,9 @@ function createReconciler(ctx, modules, fields) {
70905
70952
  * scrolled in is not new: it plays no `enter` hook, only its loop starts.
70906
70953
  *
70907
70954
  * @param element - The element the `Box` was attached to.
70955
+ * @param deltaMs - The game time of the frame it enters in.
70908
70956
  */
70909
- function playEnter(element) {
70957
+ function playEnter(element, deltaMs) {
70910
70958
  if (element.entered) return;
70911
70959
  element.entered = true;
70912
70960
  if (element.scrolledIn) modules.layout.loop(element);
@@ -70916,7 +70964,8 @@ function createReconciler(ctx, modules, fields) {
70916
70964
  modules.layout.enter(element, span);
70917
70965
  enterOverlay(ctx, state, modules.layout, {
70918
70966
  element,
70919
- span
70967
+ span,
70968
+ deltaMs
70920
70969
  });
70921
70970
  }
70922
70971
  }
@@ -75797,7 +75846,7 @@ function openRegistrations(ctx, jsx, layout) {
75797
75846
  name: "ui.enter",
75798
75847
  phase: "sync",
75799
75848
  query: [],
75800
- run: () => jsx.playEntered()
75849
+ run: (_rows, frame) => jsx.playEntered(frame.time)
75801
75850
  })), ecs.onAdded(Tree, (entity) => {
75802
75851
  const place = projection.keyOf(entity);
75803
75852
  jsx.mountRoot(entity, place?.projection ?? "ui", ecs.get(entity, Layer)?.name ?? "ui");
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-Dq7gGhN4.mjs";
1
+ import { dn as refuseStart, gn as type, pn as exit, t as createApp, w as flattenFeatures } from "./src-Ckz4E7D4.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-BuXptVI_.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.143",
3
+ "version": "0.15.144",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [