@moku-labs/game 0.15.71 → 0.15.73

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-DvoCl9R3.mjs";
1
+ import { Ft as audioPlugin, H as platformPlugin, i as screen, m as flattenFeatures, t as createApp, wt as effectsPlugin } from "./src-DDgQ9IPm.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 flowPlugin, 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 worldPlugin, 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 DEMAND_REASONS, _ as defineBundles, _t as Tappable, a as cubicBezier, an as type, at as use, b as types_exports$17, bt as Traced, c as hint, cn as lifecyclePlugin, ct as Draggable, d as defineScene, dt as Hovered, 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 to, it as tween, j as types_exports$6, jt as Noise, k as types_exports$8, kt as Displacement, l as schedule, ln as timePlugin, lt as DropTarget, m as flattenFeatures, mt as Pressable, n as createPlugin, nn as exit, nt as stagger, o as defineEffect, on as modelPlugin, ot as wait, p as defineFeature, pt as PointerOver, q as haptic, qt as PERF_GAP_BUCKETS, r as defineGame, rn as slot, rt as stopSfx, s as guide, sn as SaveUnreadableError, st as inputPlugin, t as createApp, tn as contribution, tt as spawned, u as projection, un as clockPlugin, 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-DvoCl9R3.mjs";
1
+ import { $ as sfx, $t as flowPlugin, 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 worldPlugin, 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 DEMAND_REASONS, _ as defineBundles, _t as Tappable, a as cubicBezier, an as type, at as use, b as types_exports$17, bt as Traced, c as hint, cn as lifecyclePlugin, ct as Draggable, d as defineScene, dt as Hovered, 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 to, it as tween, j as types_exports$6, jt as Noise, k as types_exports$8, kt as Displacement, l as schedule, ln as timePlugin, lt as DropTarget, m as flattenFeatures, mt as Pressable, n as createPlugin, nn as exit, nt as stagger, o as defineEffect, on as modelPlugin, ot as wait, p as defineFeature, pt as PointerOver, q as haptic, qt as PERF_GAP_BUCKETS, r as defineGame, rn as slot, rt as stopSfx, s as guide, sn as SaveUnreadableError, st as inputPlugin, t as createApp, tn as contribution, tt as spawned, u as projection, un as clockPlugin, 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-DDgQ9IPm.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, 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 };
@@ -17356,8 +17356,29 @@ function storeMatrix(cells, at, matrix) {
17356
17356
  return true;
17357
17357
  }
17358
17358
  //#endregion
17359
+ //#region src/plugins/renderer/sources.ts
17360
+ /**
17361
+ * Destroys a texture with its source, after the `change` listeners of the source and of its style
17362
+ * are removed: Pixi 8.22 caches batch and filter bind groups forever, and each one warns
17363
+ * `[BindGroup] ... destroyed while still bound to a shader` when a source it holds goes. For every
17364
+ * texture the renderer owns whole: loaded files, kept pictures, the warm-up target.
17365
+ *
17366
+ * @param texture - The texture, its source its own.
17367
+ */
17368
+ function destroyWhole(texture) {
17369
+ texture.source.style.removeAllListeners("change");
17370
+ texture.source.removeAllListeners("change");
17371
+ texture.destroy(true);
17372
+ }
17373
+ //#endregion
17359
17374
  //#region src/plugins/renderer/kept/render.ts
17360
17375
  /**
17376
+ * @file renderer/kept — the three stages of one cached view: the subtree picture (stage 1), the pre-pass result of the
17377
+ * first filter with inputs (stage 2), the filter output (stage 3), and the quad that draws it beside the view. Every
17378
+ * render is a public `renderer.render` call made before the stage pass (`host.renderTo`); every texture is the
17379
+ * engine's own, registered with `host.keep` and destroyed explicitly.
17380
+ */
17381
+ /**
17361
17382
  * Tells whether a Pixi module can draw kept pictures: it has render textures and matrices. A stand-in module of the
17362
17383
  * tests without them draws every view live.
17363
17384
  *
@@ -17440,7 +17461,7 @@ function fitTexture(kctx, pixi, current, size, label) {
17440
17461
  */
17441
17462
  function dropTexture(kctx, texture) {
17442
17463
  kctx.host.keep(texture.source, false);
17443
- texture.destroy(true);
17464
+ destroyWhole(texture);
17444
17465
  }
17445
17466
  /**
17446
17467
  * The bytes a record's textures hold now (P6.1).
@@ -17506,7 +17527,11 @@ function renderStage1(kctx, pixi, matrices, record) {
17506
17527
  record.s1 = s1;
17507
17528
  matrices.m1.set(key[KEY.a] ?? 1, key[KEY.b] ?? 0, key[KEY.c] ?? 0, key[KEY.d] ?? 1, (key[KEY.tx] ?? 0) - (key[KEY.X0] ?? 0), (key[KEY.ty] ?? 0) - (key[KEY.Y0] ?? 0));
17508
17529
  const group = top.isRenderGroup;
17509
- if (!kctx.host.renderTo(top, s1, matrices.m1, true)) return false;
17530
+ const alpha = top.alpha;
17531
+ if (alpha !== 1) top.alpha = 1;
17532
+ const rendered = kctx.host.renderTo(top, s1, matrices.m1, true);
17533
+ if (alpha !== 1) top.alpha = alpha;
17534
+ if (!rendered) return false;
17510
17535
  if (!group && !record.wasGroup) kctx.state.madeGroups.add(top);
17511
17536
  record.s1Version += 1;
17512
17537
  kctx.state.takesOpen += 1;
@@ -18341,7 +18366,7 @@ function destroyRange(range, drop) {
18341
18366
  * @param texture - The texture.
18342
18367
  */
18343
18368
  function destroyTexture$1(texture) {
18344
- texture.destroy(true);
18369
+ destroyWhole(texture);
18345
18370
  }
18346
18371
  /**
18347
18372
  * Destroys every engine object and texture of the cache and empties its collections, while the application still
@@ -18359,7 +18384,7 @@ function stopKept(state) {
18359
18384
  destroyRecord(record, destroyTexture$1);
18360
18385
  }
18361
18386
  for (const range of state.ranges.values()) destroyRange(range, destroyTexture$1);
18362
- state.spare?.destroy(true);
18387
+ if (state.spare !== void 0) destroyWhole(state.spare);
18363
18388
  state.spare = void 0;
18364
18389
  state.records.length = 0;
18365
18390
  state.byEntity.clear();
@@ -19203,7 +19228,7 @@ function placeQuad(sync, pixi, matrices, record, view) {
19203
19228
  const { top, key } = record;
19204
19229
  const parent = top.parent;
19205
19230
  const output = (record.direct ? record.s1 : record.s3) ?? pixi.Texture.EMPTY;
19206
- const alpha = record.direct ? NOW.alpha : 1;
19231
+ const alpha = (record.direct ? NOW.alpha : 1) * top.alpha;
19207
19232
  if (record.quad === void 0 || record.quad.destroyed) {
19208
19233
  record.quad = new pixi.Sprite(output);
19209
19234
  record.quad.label = `kept:${labelOf$3(top)}`;
@@ -19728,14 +19753,15 @@ function offGrid(kctx, record) {
19728
19753
  return world.a !== key[KEY.a] || world.b !== key[KEY.b] || world.c !== key[KEY.c] || world.d !== key[KEY.d] || !onGrid(world.tx - (key[KEY.tx] ?? 0), rs, r) || !onGrid(world.ty - (key[KEY.ty] ?? 0), rs, r);
19729
19754
  }
19730
19755
  /**
19731
- * Tells whether a kept record hangs under a translucent ancestor (F113): its quad draws `A·F(x)` where live draws
19732
- * `F(A·x)`, which differ by design for a filter that is not alpha-linear, not by a stale picture.
19756
+ * Tells whether a kept record is translucent, by its top's own alpha (F120) or an ancestor's (F113): its quad draws
19757
+ * `A·F(x)` where live draws `F(A·x)`, which differ by design for a filter that is not alpha-linear, not by a stale
19758
+ * picture.
19733
19759
  *
19734
19760
  * @param record - The record, kept.
19735
- * @returns True when an ancestor's alpha is under 1.
19761
+ * @returns True when the top's alpha or an ancestor's is under 1.
19736
19762
  */
19737
- function fadedAbove(record) {
19738
- for (let node = record.top.parent; node !== null; node = node.parent) if (node.alpha < 1) return true;
19763
+ function faded(record) {
19764
+ for (let node = record.top; node !== null; node = node.parent) if (node.alpha < 1) return true;
19739
19765
  return false;
19740
19766
  }
19741
19767
  /**
@@ -19827,8 +19853,8 @@ function logStale(kctx, pixels, records, ranges) {
19827
19853
  }
19828
19854
  /**
19829
19855
  * The pixel leg after a drawn frame: the picture as drawn against the same frame with every picture live. Frames in
19830
- * which a picture moves off its grid or hangs under a translucent ancestor (F113) are skipped and counted; at rest
19831
- * under opaque ancestors every picture is compared.
19856
+ * which a picture moves off its grid, is translucent itself (F120) or hangs under a translucent ancestor (F113) are
19857
+ * skipped and counted; at rest, opaque, under opaque ancestors every picture is compared.
19832
19858
  *
19833
19859
  * @param kctx - The kept context.
19834
19860
  * @param bypass - Draws every kept record live (true) or as its picture again (false).
@@ -19839,7 +19865,7 @@ function verifyPictures(kctx, bypass, recover) {
19839
19865
  const records = shownRecords(kctx);
19840
19866
  const ranges = [...state.ranges.values()].filter((range) => range.sprite !== void 0);
19841
19867
  if (records.length === 0 && ranges.length === 0) return;
19842
- if (records.some((record) => offGrid(kctx, record) || fadedAbove(record))) {
19868
+ if (records.some((record) => offGrid(kctx, record) || faded(record))) {
19843
19869
  state.verifySkipped += 1;
19844
19870
  return;
19845
19871
  }
@@ -26244,6 +26270,20 @@ function renderPassesOf(state, kept) {
26244
26270
  }
26245
26271
  //#endregion
26246
26272
  //#region src/plugins/renderer/sync/warm.ts
26273
+ /**
26274
+ * @file renderer/sync — the pipeline warm-up (F4): invisible probe draws, before the stage pass of a drawn frame, that
26275
+ * create the GPU pipelines a game will need while it loads, instead of in the frame that first needs them. A WebGPU
26276
+ * pipeline is keyed by the bound target's formats and stencil state, so every subject is drawn onto the canvas and into
26277
+ * a texture, each with and without a stencil clip; WebGL compiles one program per shader whatever the target, so one
26278
+ * draw is enough there. The probes hang in a tree of their own, never in the stage. A canvas variant is rendered onto
26279
+ * the canvas without a clear just before the stage pass, which clears the canvas first: nothing shows. A texture variant
26280
+ * is rendered into a small texture the module owns, never through a filter of its own: a filter probe is always the one
26281
+ * filter of its render, so the warm-up never opens a second level of Pixi's filter stack (Pixi 8.21 reads the stale
26282
+ * input texture of that level at its next push, and a pool trim destroys it in between). A probe whose render throws
26283
+ * ends the warm-up of the application: a throw inside Pixi's render leaves its filter stack unbalanced, which no public
26284
+ * API rebalances, so another probe would only throw again. The end of a run reaches the monitor through `onWarm`; this
26285
+ * file never imports the monitor (LEAD-FIXES-3 O24).
26286
+ */
26247
26287
  /** The side of every probe, in CSS pixels: the smallest thing that still draws a triangle. */
26248
26288
  const PROBE_SIZE = 4;
26249
26289
  /** The content subjects the renderer warms itself, in queue order; the text follows once a font is installed. */
@@ -26400,7 +26440,7 @@ function dropObjects(warm) {
26400
26440
  objects.text
26401
26441
  ];
26402
26442
  for (const node of nodes) node?.destroy({ children: true });
26403
- objects.target.destroy(true);
26443
+ destroyWhole(objects.target);
26404
26444
  }
26405
26445
  /**
26406
26446
  * Logs one warning once per key: a probe tree Pixi could not build, or the canvas variants left out.
@@ -28432,9 +28472,7 @@ function destroyTexture(state, texture) {
28432
28472
  texture.destroy(false);
28433
28473
  return;
28434
28474
  }
28435
- texture.source.style.removeAllListeners("change");
28436
- texture.source.removeAllListeners("change");
28437
- texture.destroy(true);
28475
+ destroyWhole(texture);
28438
28476
  }
28439
28477
  //#endregion
28440
28478
  //#region src/plugins/renderer/sync/leave.ts
@@ -30151,7 +30189,9 @@ function ownsAlpha(view) {
30151
30189
  * Writes the alpha of a built-in visual. It fades the entity's whole subtree: on a view with a
30152
30190
  * wrapper it goes on the wrapper, over the visual and the children, and the visual inside stays
30153
30191
  * at 1, so the alpha is applied once. A view without a wrapper keeps it on its object. Only a
30154
- * value that differs from what Pixi holds is written, and the entity is marked before. A view
30192
+ * value that differs from what Pixi holds is written, and the entity is marked before, as a move
30193
+ * of its top (F120): a kept picture of the view is taken without its top's alpha, and its quad
30194
+ * draws it at that alpha, as a move draws it at another place. A view
30155
30195
  * drawn at alpha 0, its HUD factor counted, is not drawn at all (spec 26 B9): it leaves Pixi's
30156
30196
  * build, its bounds and the passes of its filters, with its subtree.
30157
30197
  *
@@ -30165,7 +30205,7 @@ function applyAlpha(sctx, entity, view, look) {
30165
30205
  const target = view.wrapper ?? view.object;
30166
30206
  const drawn = look.alpha * view.hud;
30167
30207
  if (target.alpha !== drawn) {
30168
- markView(sctx, entity);
30208
+ markMoved(sctx, entity);
30169
30209
  target.alpha = drawn;
30170
30210
  }
30171
30211
  if (view.wrapper !== void 0 && view.object.alpha !== 1) {
package/dist/testing.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { an as type, en as refuseStart, m as flattenFeatures, nn as exit, t as createApp } from "./src-DvoCl9R3.mjs";
1
+ import { an as type, en as refuseStart, m as flattenFeatures, nn as exit, t as createApp } from "./src-DDgQ9IPm.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.71",
3
+ "version": "0.15.73",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [