@moku-labs/game 0.15.58 → 0.15.59

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-CJtaTza4.mjs";
1
+ import { Ft as audioPlugin, H as platformPlugin, i as screen, m as flattenFeatures, t as createApp, wt as effectsPlugin } from "./src-BIiNB7Fz.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
@@ -137,8 +137,8 @@ declare const commands: Readonly<{
137
137
  readonly ui: Pick<UiApi, "fill">;
138
138
  }>;
139
139
  scroll: Command<{
140
- readonly to: "number";
141
140
  readonly key: "string";
141
+ readonly to: "number";
142
142
  }, boolean, HeadlessApp & {
143
143
  readonly log: import("@moku-labs/common/browser").LogApi;
144
144
  } & {
@@ -1,6 +1,6 @@
1
1
  import { t as HeadlessApp } from "./headless-7IBMNGda.mjs";
2
2
  import { i as InputArguments, n as Command, o as InputSchema, s as Ran } from "./types-BEW2Y3au.mjs";
3
- import { t as commands } from "./commands-B208rrQE.mjs";
3
+ import { t as commands } from "./commands-OYwZDclg.mjs";
4
4
  import { t as defineCommand } from "./define-U9QpSza7.mjs";
5
5
 
6
6
  //#region src/plugins/flow/doors/dev.d.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-CJtaTza4.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-BIiNB7Fz.mjs";
2
2
  import { $ as Tree, B as Overlay, C as bind, E as label, G as Transform, H as Parent, J as sprite, L as Display, Q as Order, R as HudPart, S as Text, T as defineTextStyles, U as Shape, W as Sprite, X as Layer, Y as Exiting, Z as Now, _ as popup, at as tag, b as defineStyle, c as Box, et as component, f as LocalWrite, m as ScrollState, nt as resource, rt as system, tt as mut, u as DebugTrigger, x as Countdown, y as defineTokens, z as NineSlice } from "./visual-ciZa6Rza.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 };
@@ -122,8 +122,8 @@ declare const sources: Readonly<{
122
122
  readonly world: Api$1;
123
123
  }>;
124
124
  diff: Source<{
125
- readonly from: "number";
126
125
  readonly to: "number";
126
+ readonly from: "number";
127
127
  }, FrameDiff, HeadlessApp & {
128
128
  readonly world: Api$1;
129
129
  }>;
@@ -18395,13 +18395,16 @@ function topDrawn(sync, view) {
18395
18395
  return !(hiddenBy(view, "empty") && view.wrapper === void 0);
18396
18396
  }
18397
18397
  /**
18398
- * Tells whether an ancestor draws what is under it unchanged: visible, opaque, untinted, blending normally.
18398
+ * Tells whether an ancestor draws what is under it as a picture would: visible, untinted, blending normally. Its alpha
18399
+ * is not read (F113): the quad hangs in the top's parent and Pixi multiplies it by the ancestors' alpha, while stage 1
18400
+ * renders the top as a root without them. A fading ancestor so draws the picture at `A·F(x)`, live draws `F(A·x)`: the
18401
+ * same for an alpha-linear filter, the whole picture faded for one that is not.
18399
18402
  *
18400
18403
  * @param node - The ancestor.
18401
18404
  * @returns True when it does.
18402
18405
  */
18403
18406
  function drawsPlain(node) {
18404
- return node.visible && node.alpha === 1 && node.tint === WHITE$2 && plainBlend(node.blendMode);
18407
+ return node.visible && node.tint === WHITE$2 && plainBlend(node.blendMode);
18405
18408
  }
18406
18409
  /**
18407
18410
  * Tells whether an ancestor is drawn: renderable, or hidden only by an overlay's range or a kept ancestor's picture,
@@ -18427,8 +18430,8 @@ function filtersPlaced(kctx, record, node) {
18427
18430
  return record.category === "placed" && (holdsFilters(node) || kctx.state.byTop.get(node)?.mode === "kept");
18428
18431
  }
18429
18432
  /**
18430
- * Tells whether every ancestor up to the stage draws the view as a picture would: visible, opaque, untinted, blending
18431
- * normally, drawn (an overlay's range and a kept ancestor's picture count), and for a placed filter without a filter
18433
+ * Tells whether every ancestor up to the stage draws the view as a picture would: visible, untinted (its alpha is not
18434
+ * read, F113), blending normally, drawn (an overlay's range and a kept ancestor's picture count), and for a placed filter without a filter
18432
18435
  * above it (its canvas position would not be the canvas pixel live).
18433
18436
  *
18434
18437
  * @param kctx - The kept context.
@@ -18763,7 +18766,8 @@ function writeTakeKeys(record, now, box) {
18763
18766
  * Takes or retakes the picture of a record: stages 1, 2 (when its first filter has inputs) and 3, at the phase of this
18764
18767
  * frame. The bounds are cut to the filter area of the top when it holds one (F43). Refused, and the view drawn live,
18765
18768
  * for a `Display` in the subtree without `onDemand`, a node under the top that blends otherwise (F68, warned once per
18766
- * top), empty bounds, a picture over 4096 device pixels, or a budget that has no room (P6.3, warned once).
18769
+ * top), empty bounds, a picture over 4096 device pixels, a picture cut to the canvas while its linear part moves (it
18770
+ * is never drawn scaled, F113), or a budget that has no room (P6.3, warned once).
18767
18771
  *
18768
18772
  * @param kctx - The kept context.
18769
18773
  * @param pixi - The module that draws.
@@ -18771,9 +18775,10 @@ function writeTakeKeys(record, now, box) {
18771
18775
  * @param record - The record.
18772
18776
  * @param view - Its view.
18773
18777
  * @param now - This frame's numbers.
18778
+ * @param turned - True when the linear part moved since the last frame: a first take under a zoom.
18774
18779
  * @returns True when every stage rendered.
18775
18780
  */
18776
- function takePicture(kctx, pixi, matrices, record, view, now) {
18781
+ function takePicture(kctx, pixi, matrices, record, view, now, turned = false) {
18777
18782
  const { top } = record;
18778
18783
  if (!kctx.ctx.config.onDemand && holdsDisplay(kctx, top)) return false;
18779
18784
  if (blendedBelow(kctx, record)) return false;
@@ -18789,6 +18794,11 @@ function takePicture(kctx, pixi, matrices, record, view, now) {
18789
18794
  const across = cutSpan(now.tx + box.x0, now.tx + box.x1, width, Ps);
18790
18795
  const down = cutSpan(now.ty + box.y0, now.ty + box.y1, height, Ps);
18791
18796
  if (isEmptySpan(across) || isEmptySpan(down)) return false;
18797
+ const cut = across.start > now.tx + box.x0 || across.end < now.tx + box.x1 || down.start > now.ty + box.y0 || down.end < now.ty + box.y1;
18798
+ if (cut && turned) {
18799
+ record.cut = true;
18800
+ return false;
18801
+ }
18792
18802
  const x = gridSpan(across.start, across.end, now.rs);
18793
18803
  const y = gridSpan(down.start, down.end, now.rs);
18794
18804
  const w1 = x.texels / now.rs;
@@ -18805,9 +18815,7 @@ function takePicture(kctx, pixi, matrices, record, view, now) {
18805
18815
  return false;
18806
18816
  }
18807
18817
  record.refused = 0;
18808
- const cutAcross = across.start > now.tx + box.x0 || across.end < now.tx + box.x1;
18809
- const cutDown = down.start > now.ty + box.y0 || down.end < now.ty + box.y1;
18810
- record.cut = cutAcross || cutDown;
18818
+ record.cut = cut;
18811
18819
  record.key[KEY.sw] = width;
18812
18820
  record.key[KEY.sh] = height;
18813
18821
  writeTakeKeys(record, now, {
@@ -19115,9 +19123,21 @@ function wrapBare(kctx, record, view) {
19115
19123
  writeSeen(record, NOW);
19116
19124
  }
19117
19125
  /**
19118
- * A live record's frame (P4.2): still frames are counted; at two (eight after churning) the record is taken, a bare
19119
- * view in a wrapper of its own (D4). A record with a node under its top that blends otherwise stays live, before any
19120
- * wrap (F68).
19126
+ * Tells whether a move of a live record's linear part or stack resolution resets its still frames (F113): a zoom or a
19127
+ * turn of an ancestor does not, the picture is taken at it and drawn scaled (F67). It does for a new stack resolution,
19128
+ * a `"placed"` record (never drawn scaled), a calm one (a picture that churned waits for real rest) and one cut to the
19129
+ * canvas at its last take or refusal (never drawn scaled either).
19130
+ *
19131
+ * @param record - The record, live, whose linear part or stack resolution moved since the last frame.
19132
+ * @returns True when the move resets its still frames.
19133
+ */
19134
+ function linearResets(record) {
19135
+ return record.key[KEY.seenRs] !== NOW.rs || record.category === "placed" || record.calm || record.cut;
19136
+ }
19137
+ /**
19138
+ * A live record's frame (P4.2): still frames are counted, and a zoom or turn of an ancestor counts as still (F113); at
19139
+ * two (eight after churning) the record is taken, a bare view in a wrapper of its own (D4). A record with a node under
19140
+ * its top that blends otherwise stays live, before any wrap (F68).
19121
19141
  *
19122
19142
  * @param kctx - The kept context.
19123
19143
  * @param pixi - The module that draws.
@@ -19127,14 +19147,15 @@ function wrapBare(kctx, record, view) {
19127
19147
  */
19128
19148
  function stepLive(kctx, pixi, matrices, record, view) {
19129
19149
  const { state } = kctx;
19130
- const changed = record.dirtyS1 || linearDiffers(record.key, NOW, KEY.seenA, KEY.seenRs);
19150
+ const turned = linearDiffers(record.key, NOW, KEY.seenA, KEY.seenRs);
19151
+ const changed = record.dirtyS1 || turned && linearResets(record);
19131
19152
  writeSeen(record, NOW);
19132
19153
  record.still = changed ? 0 : record.still + 1;
19133
19154
  if (record.still < (record.calm ? 8 : 2)) return;
19134
19155
  if (record.refused > 0 && state.bytes + record.refused - record.bytes > state.budget) return;
19135
19156
  if (blendedBelow(kctx, record)) return;
19136
19157
  wrapBare(kctx, record, view);
19137
- if (takePicture(kctx, pixi, matrices, record, view, NOW)) toKept(kctx, record, view);
19158
+ if (takePicture(kctx, pixi, matrices, record, view, NOW, turned)) toKept(kctx, record, view);
19138
19159
  else record.still = 0;
19139
19160
  }
19140
19161
  /**
@@ -19446,6 +19467,17 @@ function offGrid(kctx, record) {
19446
19467
  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);
19447
19468
  }
19448
19469
  /**
19470
+ * Tells whether a kept record hangs under a translucent ancestor (F113): its quad draws `A·F(x)` where live draws
19471
+ * `F(A·x)`, which differ by design for a filter that is not alpha-linear, not by a stale picture.
19472
+ *
19473
+ * @param record - The record, kept.
19474
+ * @returns True when an ancestor's alpha is under 1.
19475
+ */
19476
+ function fadedAbove(record) {
19477
+ for (let node = record.top.parent; node !== null; node = node.parent) if (node.alpha < 1) return true;
19478
+ return false;
19479
+ }
19480
+ /**
19449
19481
  * Tells whether the padded picture of a kept record reaches past the canvas edge, where Pixi clips the live filter.
19450
19482
  *
19451
19483
  * @param record - The record, kept.
@@ -19534,7 +19566,8 @@ function logStale(kctx, pixels, records, ranges) {
19534
19566
  }
19535
19567
  /**
19536
19568
  * The pixel leg after a drawn frame: the picture as drawn against the same frame with every picture live. Frames in
19537
- * which a picture moves off its grid are skipped and counted; at rest every picture is compared.
19569
+ * which a picture moves off its grid or hangs under a translucent ancestor (F113) are skipped and counted; at rest
19570
+ * under opaque ancestors every picture is compared.
19538
19571
  *
19539
19572
  * @param kctx - The kept context.
19540
19573
  * @param bypass - Draws every kept record live (true) or as its picture again (false).
@@ -19545,7 +19578,7 @@ function verifyPictures(kctx, bypass, recover) {
19545
19578
  const records = shownRecords(kctx);
19546
19579
  const ranges = [...state.ranges.values()].filter((range) => range.sprite !== void 0);
19547
19580
  if (records.length === 0 && ranges.length === 0) return;
19548
- if (records.some((record) => offGrid(kctx, record))) {
19581
+ if (records.some((record) => offGrid(kctx, record) || fadedAbove(record))) {
19549
19582
  state.verifySkipped += 1;
19550
19583
  return;
19551
19584
  }
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-CJtaTza4.mjs";
1
+ import { an as type, en as refuseStart, m as flattenFeatures, nn as exit, t as createApp } from "./src-BIiNB7Fz.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";
@@ -3,7 +3,7 @@ import { P as AnimApi, r as UiApi } from "./types-C0As3dEe.mjs";
3
3
  import { N as InputApi } from "./types-FtzEwwWY.mjs";
4
4
  import { r as Repro } from "./headless-7IBMNGda.mjs";
5
5
  import { a as InputOf, r as ControlApp } from "./types-BEW2Y3au.mjs";
6
- import { t as commands } from "./commands-B208rrQE.mjs";
6
+ import { t as commands } from "./commands-OYwZDclg.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-CpTnNnas.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-mPbBWlEz.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.58",
3
+ "version": "0.15.59",
4
4
  "description": "2D puzzle game engine on TypeScript and PixiJS, built on @moku-labs/core.",
5
5
  "type": "module",
6
6
  "sideEffects": [