@moku-labs/game 0.15.82 → 0.15.84

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 { Ft as audioPlugin, H as platformPlugin, i as screen, m as flattenFeatures, t as createApp, wt as effectsPlugin } from "./src-DX2UW8sT.mjs";
1
+ import { Ft as audioPlugin, H as platformPlugin, i as screen, m as flattenFeatures, t as createApp, wt as effectsPlugin } from "./src-D1J2QlGK.mjs";
2
2
  import { t as memory } from "./memory-CWlqhS7l.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 sfx, $t as worldPlugin, A as types_exports$7, At as Glow, B as defineMotion, Bt as Animation, C as types_exports$14, Ct as messageDuration, D as types_exports$10, Dt as Blur, E as types_exports$11, Et as Alpha, F as types_exports$2, Ft as audioPlugin, G as external, Gt as MONITOR_SECTIONS, H as platformPlugin, Ht as rendererPlugin, I as types_exports$1, It as scenesPlugin, J as mark, Jt as PERF_LOG_VERSION, K as frames, Kt as PERF_CAUSES, L as types_exports, Lt as assetsPlugin, M as types_exports$5, Mt as Outline, N as types_exports$4, Nt as defineFilter, O as types_exports$9, Ot as ColorMatrix, P as types_exports$3, Pt as debugPlugin, Q as set, Qt as DEMAND_REASONS, R as uiPlugin, Rt as animPlugin, S as types_exports$15, St as messageArgument, T as types_exports$12, Tt as Emitter, U as HAPTIC_KINDS, Ut as PASS_KINDS, V as textPlugin, Vt as Frames, W as defineAnimation, Wt as frameAt, X as play, Xt as SHADER_WHATS, Y as parallel, Yt as PROBLEM_RULES, Z as sequence, Zt as CANVAS_RESTARTS, _ as defineBundles, _t as Tappable, a as cubicBezier, an as to, at as use, b as types_exports$17, bt as Traced, c as hint, cn as SaveUnreadableError, ct as Draggable, d as defineScene, dn as clockPlugin, dt as Hovered, en as flowPlugin, et as spawn, f as tr, ft as Pointer, g as music, gt as Swipeable, h as defineEmitter, ht as Pressed, i as screen, in as slot, it as tween, j as types_exports$6, jt as Noise, k as types_exports$8, kt as Displacement, l as schedule, ln as lifecyclePlugin, lt as DropTarget, m as flattenFeatures, mt as Pressable, n as createPlugin, nn as contribution, nt as stagger, o as defineEffect, on as type, ot as wait, p as defineFeature, pt as PointerOver, q as haptic, qt as PERF_GAP_BUCKETS, r as defineGame, rn as exit, rt as stopSfx, s as guide, sn as modelPlugin, st as inputPlugin, t as createApp, tt as spawned, u as projection, un as timePlugin, ut as Held, v as load, vt as Touchable, w as types_exports$13, wt as effectsPlugin, x as types_exports$16, xt as i18nPlugin, y as ready, yt as Traceable, z as resolve, zt as AnimPlayer } from "./src-DX2UW8sT.mjs";
1
+ import { $ as sfx, $t as worldPlugin, A as types_exports$7, At as Glow, B as defineMotion, Bt as Animation, C as types_exports$14, Ct as messageDuration, D as types_exports$10, Dt as Blur, E as types_exports$11, Et as Alpha, F as types_exports$2, Ft as audioPlugin, G as external, Gt as MONITOR_SECTIONS, H as platformPlugin, Ht as rendererPlugin, I as types_exports$1, It as scenesPlugin, J as mark, Jt as PERF_LOG_VERSION, K as frames, Kt as PERF_CAUSES, L as types_exports, Lt as assetsPlugin, M as types_exports$5, Mt as Outline, N as types_exports$4, Nt as defineFilter, O as types_exports$9, Ot as ColorMatrix, P as types_exports$3, Pt as debugPlugin, Q as set, Qt as DEMAND_REASONS, R as uiPlugin, Rt as animPlugin, S as types_exports$15, St as messageArgument, T as types_exports$12, Tt as Emitter, U as HAPTIC_KINDS, Ut as PASS_KINDS, V as textPlugin, Vt as Frames, W as defineAnimation, Wt as frameAt, X as play, Xt as SHADER_WHATS, Y as parallel, Yt as PROBLEM_RULES, Z as sequence, Zt as CANVAS_RESTARTS, _ as defineBundles, _t as Tappable, a as cubicBezier, an as to, at as use, b as types_exports$17, bt as Traced, c as hint, cn as SaveUnreadableError, ct as Draggable, d as defineScene, dn as clockPlugin, dt as Hovered, en as flowPlugin, et as spawn, f as tr, ft as Pointer, g as music, gt as Swipeable, h as defineEmitter, ht as Pressed, i as screen, in as slot, it as tween, j as types_exports$6, jt as Noise, k as types_exports$8, kt as Displacement, l as schedule, ln as lifecyclePlugin, lt as DropTarget, m as flattenFeatures, mt as Pressable, n as createPlugin, nn as contribution, nt as stagger, o as defineEffect, on as type, ot as wait, p as defineFeature, pt as PointerOver, q as haptic, qt as PERF_GAP_BUCKETS, r as defineGame, rn as exit, rt as stopSfx, s as guide, sn as modelPlugin, st as inputPlugin, t as createApp, tt as spawned, u as projection, un as timePlugin, ut as Held, v as load, vt as Touchable, w as types_exports$13, wt as effectsPlugin, x as types_exports$16, xt as i18nPlugin, y as ready, yt as Traceable, z as resolve, zt as AnimPlayer } from "./src-D1J2QlGK.mjs";
2
2
  import { $ as Layer, B as Display, C as defineStyle, E as bind, G as Parent, H as NineSlice, J as Transform, K as Shape, O as defineTextStyles, Q as Exiting, S as defineTokens, T as Text, U as Overlay, V as HudPart, Z as sprite, _ as ScrollState, at as resource, b as popup, ct as tag, d as Box, et as Now, h as LocalWrite, it as mut, k as label, nt as Tree, ot as system, p as DebugTrigger, q as Sprite, rt as component, tt as Order, w as Countdown } from "./visual-B7TxMv1J.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, Blur, Box, CANVAS_RESTARTS, types_exports$3 as Clock, ColorMatrix, Countdown, DEMAND_REASONS, types_exports$4 as Debug, DebugTrigger, Displacement, Display, Draggable, DropTarget, types_exports$5 as Effects, Emitter, Exiting, types_exports$6 as Flow, Frames, Glow, 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, SHADER_WHATS, SaveUnreadableError, types_exports$13 as Scenes, ScrollState, Shape, Sprite, Swipeable, Tappable, Text, types_exports$14 as TextTypes, types_exports$15 as Time, Touchable, Traceable, Traced, Transform, Tree, types_exports$16 as Ui, 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, 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 };
@@ -17191,7 +17191,10 @@ function createHostApi(ctx, deps) {
17191
17191
  if (!state.ready || app === void 0) return void 0;
17192
17192
  return extractStage(ctx, app, hidden);
17193
17193
  },
17194
- resolution: () => state.app?.renderer.resolution ?? 1,
17194
+ resolution: () => {
17195
+ const app = state.app;
17196
+ return app === void 0 ? 1 : app.renderer.resolution;
17197
+ },
17195
17198
  textures: () => {
17196
17199
  const app = state.app;
17197
17200
  if (!state.ready || app === void 0) return {
@@ -17598,15 +17601,17 @@ function fitTexture(kctx, pixi, current, size, label) {
17598
17601
  return texture;
17599
17602
  }
17600
17603
  /**
17601
- * Takes a texture of the asked size out of the pool (F119): the first one of the same CSS size and resolution, its
17602
- * bytes no longer the pool's. The last one fills its place: the pool keeps no order.
17604
+ * Takes a texture out of the pool (F119): the first one of the same CSS size and resolution, its bytes no longer the
17605
+ * pool's. The last one fills its place: the pool keeps no order. With none of that size the last one is resized to it
17606
+ * (F132): a view that keeps leaving at one size and coming back at another would otherwise pile up textures of a size
17607
+ * no take asks for, until the budget is full.
17603
17608
  *
17604
17609
  * @param kctx - The kept context.
17605
17610
  * @param size - CSS px and texels per CSS px.
17606
17611
  * @param size.width - CSS width.
17607
17612
  * @param size.height - CSS height.
17608
17613
  * @param size.resolution - Texels per CSS px.
17609
- * @returns The texture, or `undefined` when none fits.
17614
+ * @returns The texture, or `undefined` when the pool is empty.
17610
17615
  */
17611
17616
  function fromPool(kctx, size) {
17612
17617
  const { pool } = kctx.state;
@@ -17621,6 +17626,11 @@ function fromPool(kctx, size) {
17621
17626
  unpool(kctx, texture);
17622
17627
  return texture;
17623
17628
  }
17629
+ const other = pool.pop();
17630
+ if (other === void 0) return void 0;
17631
+ unpool(kctx, other);
17632
+ other.resize(size.width, size.height, size.resolution);
17633
+ return other;
17624
17634
  }
17625
17635
  /**
17626
17636
  * Puts a texture of a record whose view left into the pool (F119), for the next take of its size: a scene that leaves
@@ -18758,26 +18768,15 @@ const BEFORE = {
18758
18768
  shown: false
18759
18769
  };
18760
18770
  /**
18761
- * The resolution one filter draws at: its own, or the target's for `"inherit"` (Pixi's own rule).
18762
- *
18763
- * @param filter - The filter.
18764
- * @param resolution - The target's resolution.
18765
- * @returns Texels per CSS px.
18766
- */
18767
- function resolutionOf$1(filter, resolution) {
18768
- const own = filter.resolution;
18769
- return own === "inherit" ? resolution : own;
18770
- }
18771
- /**
18772
18771
  * Reads what the enabled filters of a stack draw with: how many, the smallest resolution, the padding sum Pixi
18773
- * pads by (whole pixels), and the alpha they multiply by while every one is an `AlphaFilter`.
18772
+ * pads by (whole pixels), and the alpha they multiply by while every one is an `AlphaFilter`. A filter on `"inherit"`
18773
+ * draws at the renderer resolution (Pixi's own rule), the one `markAlphaDue` wrote to `NOW`.
18774
18774
  *
18775
18775
  * @param slots - The record's slots.
18776
- * @param resolution - The renderer resolution.
18777
18776
  * @param alphaFilter - Pixi's `AlphaFilter` class.
18778
18777
  * @param into - Where the numbers go.
18779
18778
  */
18780
- function readStack(slots, resolution, alphaFilter, into) {
18779
+ function readStack(slots, alphaFilter, into) {
18781
18780
  let enabled = 0;
18782
18781
  let rs = Number.POSITIVE_INFINITY;
18783
18782
  let padding = 0;
@@ -18788,12 +18787,13 @@ function readStack(slots, resolution, alphaFilter, into) {
18788
18787
  if (filter === void 0 || !filter.enabled) continue;
18789
18788
  enabled += 1;
18790
18789
  passes += slots[index]?.passes ?? 0;
18791
- rs = Math.min(rs, resolutionOf$1(filter, resolution));
18790
+ const own = filter.resolution;
18791
+ rs = own === "inherit" ? Math.min(rs, NOW.r) : Math.min(rs, own);
18792
18792
  padding += filter.padding;
18793
18793
  alpha *= filter instanceof alphaFilter ? filter.alpha : NaN;
18794
18794
  }
18795
18795
  into.enabled = enabled;
18796
- into.rs = enabled === 0 ? resolution : rs;
18796
+ into.rs = enabled === 0 ? NOW.r : rs;
18797
18797
  into.P = Math.trunc(padding);
18798
18798
  into.alpha = alpha;
18799
18799
  into.passes = passes;
@@ -18803,22 +18803,11 @@ function readStack(slots, resolution, alphaFilter, into) {
18803
18803
  * padding, at the renderer resolution. The quad then draws the picture itself at that alpha, as Pixi's alpha pass
18804
18804
  * draws its input: no stage 3, no pass when the alpha changes.
18805
18805
  *
18806
- * @param now - This frame's numbers.
18807
- * @returns True when it does.
18808
- */
18809
- function drawsDirect(now) {
18810
- return drawsDirectAt(now, now.r);
18811
- }
18812
- /**
18813
- * Tells whether a stack draws direct at a renderer resolution (F54): every enabled filter an `AlphaFilter`, no
18814
- * padding, at that resolution.
18815
- *
18816
18806
  * @param stack - The stack's numbers.
18817
- * @param resolution - The renderer resolution.
18818
18807
  * @returns True when it does.
18819
18808
  */
18820
- function drawsDirectAt(stack, resolution) {
18821
- return !Number.isNaN(stack.alpha) && stack.P === 0 && stack.rs === resolution;
18809
+ function drawsDirect(stack) {
18810
+ return !Number.isNaN(stack.alpha) && stack.P === 0 && stack.rs === NOW.r;
18822
18811
  }
18823
18812
  /**
18824
18813
  * Tells whether a take the budget refused still does not fit (P6.3); the pool's bytes are the take's to have (F119).
@@ -20205,22 +20194,23 @@ function stepCalm(kctx, record) {
20205
20194
  * Marks, before the step, the live records drawn direct that may be taken in this flush (F114): eligible, nothing
20206
20195
  * changed under them. An alpha take costs one pass and its live draw two, so while one is due no other first take
20207
20196
  * happens in this frame. A record due once that did not end its step kept is not due again until a change under it.
20208
- * The others drawn live are counted: a first take among a crowd of them is not spread (F119).
20197
+ * The others drawn live are counted: a first take among a crowd of them is not spread (F119). The resolution of the
20198
+ * flush is read here, once, for every record it steps.
20209
20199
  *
20210
20200
  * @param kctx - The kept context.
20211
20201
  * @param pixi - The module that draws.
20212
20202
  */
20213
20203
  function markAlphaDue(kctx, pixi) {
20214
20204
  const { state } = kctx;
20215
- const resolution = kctx.host.resolution();
20205
+ NOW.r = kctx.host.resolution();
20216
20206
  state.alphaDue = false;
20217
20207
  state.liveWaiting = 0;
20218
20208
  for (let index = 0; index < state.records.length; index += 1) {
20219
20209
  const record = state.records[index];
20220
20210
  const view = record === void 0 ? void 0 : kctx.ctx.state.sync.views.get(record.entity);
20221
20211
  if (record === void 0 || view === void 0 || !mayBeDue(kctx, record)) continue;
20222
- readStack(record.slots, resolution, pixi.AlphaFilter, DUE);
20223
- const direct = drawsDirectAt(DUE, resolution);
20212
+ readStack(record.slots, pixi.AlphaFilter, DUE);
20213
+ const direct = drawsDirect(DUE);
20224
20214
  record.alphaDue = direct && eligible(kctx, record, view, DUE) === 0;
20225
20215
  state.alphaDue ||= record.alphaDue;
20226
20216
  if (!direct && drawnLive(kctx, record)) state.liveWaiting += 1;
@@ -20257,8 +20247,7 @@ function stepRecord(kctx, pixi, matrices, record, view) {
20257
20247
  record.displays = void 0;
20258
20248
  record.idleSeen = false;
20259
20249
  }
20260
- NOW.r = kctx.host.resolution();
20261
- readStack(record.slots, NOW.r, pixi.AlphaFilter, NOW);
20250
+ readStack(record.slots, pixi.AlphaFilter, NOW);
20262
20251
  const why = eligible(kctx, record, view, NOW);
20263
20252
  if (why === 0) stepEligible(kctx, pixi, matrices, record, view);
20264
20253
  else stepIneligible(kctx, record, view, why);
@@ -20338,7 +20327,7 @@ function takenAfterInner(pixi, above) {
20338
20327
  const { key } = above;
20339
20328
  const drawn = drawnResolution(key, above.direct);
20340
20329
  if (above.mode !== "kept" || drawn >= NOW.r || key[KEY.rs] !== drawn) return false;
20341
- readStack(above.slots, NOW.r, pixi.AlphaFilter, DUE);
20330
+ readStack(above.slots, pixi.AlphaFilter, DUE);
20342
20331
  return above.direct || DUE.rs === NOW.r;
20343
20332
  }
20344
20333
  /**
package/dist/testing.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { m as flattenFeatures, on as type, rn as exit, t as createApp, tn as refuseStart } from "./src-DX2UW8sT.mjs";
1
+ import { m as flattenFeatures, on as type, rn as exit, t as createApp, tn as refuseStart } from "./src-D1J2QlGK.mjs";
2
2
  import { n as saveOf, t as memory } from "./memory-CWlqhS7l.mjs";
3
3
  import { n as fakeClock } from "./fake-hnJcJeYf.mjs";
4
4
  import { i as stepFrames, r as runRepro, t as createHeadless } from "./headless-CCiUwvlp.mjs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moku-labs/game",
3
- "version": "0.15.82",
3
+ "version": "0.15.84",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [