@moku-labs/game 0.15.59 → 0.15.60
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/page.mjs +1 -1
- package/dist/app.mjs +1 -1
- package/dist/{commands-OYwZDclg.d.mts → commands-B208rrQE.d.mts} +1 -1
- package/dist/control.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/inspect.d.mts +1 -1
- package/dist/inspect.mjs +1 -1
- package/dist/{sources-Bp9xmX3f.mjs → sources-Djd8MjP9.mjs} +1 -1
- package/dist/{src-BIiNB7Fz.mjs → src-B3cwICTC.mjs} +16 -60
- package/dist/testing.mjs +1 -1
- package/dist/{visual-ciZa6Rza.mjs → visual-B7TxMv1J.mjs} +93 -5
- package/dist/{visual-mPbBWlEz.d.mts → visual-CpTnNnas.d.mts} +1 -1
- package/dist/visual.d.mts +1 -1
- package/dist/visual.mjs +1 -1
- package/llms.txt +1 -1
- package/package.json +1 -1
package/dist/app/page.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { r as systemSource, t as memory } from "../memory-CWlqhS7l.mjs";
|
|
|
2
2
|
import { t as applyTo } from "../drafts-BawpSaVp.mjs";
|
|
3
3
|
import { i as isControl } from "../dev-BNndV-hU.mjs";
|
|
4
4
|
import { n as fakeClock, t as VISUAL_CLOCK } from "../fake-hnJcJeYf.mjs";
|
|
5
|
-
import { n as read, r as watch, t as sources } from "../sources-
|
|
5
|
+
import { n as read, r as watch, t as sources } from "../sources-Djd8MjP9.mjs";
|
|
6
6
|
import { t as resolveConfig } from "../config-HpC-p8Ow.mjs";
|
|
7
7
|
//#region src/app/boot.ts
|
|
8
8
|
/** How long after the fade the timer removes a picture whose transition never ended, ms. */
|
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-
|
|
1
|
+
import { Ft as audioPlugin, H as platformPlugin, i as screen, m as flattenFeatures, t as createApp, wt as effectsPlugin } from "./src-B3cwICTC.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 key: "string";
|
|
141
140
|
readonly to: "number";
|
|
141
|
+
readonly key: "string";
|
|
142
142
|
}, boolean, HeadlessApp & {
|
|
143
143
|
readonly log: import("@moku-labs/common/browser").LogApi;
|
|
144
144
|
} & {
|
package/dist/control.d.mts
CHANGED
|
@@ -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-
|
|
3
|
+
import { t as commands } from "./commands-B208rrQE.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-
|
|
2
|
-
import { $ as
|
|
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-B3cwICTC.mjs";
|
|
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 };
|
package/dist/inspect.d.mts
CHANGED
package/dist/inspect.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { c as defineSource } from "./session-DuZfGZWk.mjs";
|
|
2
|
-
import { n as read, r as watch, t as sources } from "./sources-
|
|
2
|
+
import { n as read, r as watch, t as sources } from "./sources-Djd8MjP9.mjs";
|
|
3
3
|
import "./inspect-la_KkjCS.mjs";
|
|
4
4
|
export { defineSource, read, sources, watch };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as Layer, F as parentOf, H as NineSlice, K as Shape, d as Box, r as drawnRect, z as rootPoseOf } from "./visual-B7TxMv1J.mjs";
|
|
2
2
|
import { o as notInstalled } from "./dev-BNndV-hU.mjs";
|
|
3
3
|
import { a as readTarget, c as defineSource, l as inputSchema, n as isTainted, o as inputOrEmpty, t as cheatsOf } from "./session-DuZfGZWk.mjs";
|
|
4
4
|
//#region src/plugins/flow/doors/read.ts
|
|
@@ -2,7 +2,7 @@ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
|
2
2
|
import { r as systemSource, t as memory } from "./memory-CWlqhS7l.mjs";
|
|
3
3
|
import { a as finishDrafts, i as enableDraftPatches, n as deepFreeze$1, o as openDrafts, r as dropDrafts } from "./drafts-BawpSaVp.mjs";
|
|
4
4
|
import { _ as compact, c as collectFlows, d as findNode, f as framePath, g as slotNames, h as restlessCapOf, i as servePaused, l as describeGraph, m as isRestCheckpoint, n as captureFrame, o as epochOf, p as graphHash, r as serveCaptures, s as pageNow$1, t as cancelCaptures, v as pushEntry } from "./capture-BtS6_oWr.mjs";
|
|
5
|
-
import { $ as
|
|
5
|
+
import { $ as Layer, A as readStyle, B as Display, D as builtInStyles, F as parentOf$1, G as Parent, H as NineSlice, I as poseUnder, J as Transform, K as Shape, L as rootPointOf, M as applyPose, N as isLeaving, P as localPoseOf, Q as Exiting, R as rootPoseInto, T as Text, U as Overlay, V as HudPart, W as OverlayLevel, X as componentsFor, Y as arcDefaults, _ as ScrollState, a as fitScaleOf, at as resource, c as samePose, ct as tag, d as Box, et as Now, f as Covered, g as Scroll, h as LocalWrite, i as fieldsLeftAlone, j as textFor, l as visualOf$1, m as Escapable, n as CONTENT$1, nt as Tree, o as livePatch, ot as system, p as DebugTrigger, q as Sprite, r as drawnRect, rt as component, s as restValueOf, st as systemsFor, tt as Order, u as visualRectOf, v as UI_OWNER, w as Countdown, x as uiFor, y as UiCounters, z as rootPoseOf } from "./visual-B7TxMv1J.mjs";
|
|
6
6
|
import { a as isDev } from "./dev-BNndV-hU.mjs";
|
|
7
7
|
import { n as isComponentDefinition } from "./component-DGg5DqKK.mjs";
|
|
8
8
|
import { n as flatten } from "./flatten-nUX9PpGo.mjs";
|
|
@@ -60349,46 +60349,10 @@ function defineMotion(spec) {
|
|
|
60349
60349
|
//#endregion
|
|
60350
60350
|
//#region src/plugins/ui/jsx/extras.ts
|
|
60351
60351
|
/**
|
|
60352
|
-
* The patch a live element writes into one of its components: every field but the ones the
|
|
60353
|
-
* component type gives to a plugin. That plugin keeps such a field for the life of the entity, so
|
|
60354
|
-
* a re-render never puts it back to its default: a label keeps the string `text` resolved for it.
|
|
60355
|
-
*
|
|
60356
|
-
* @param value - The component value the element carries now.
|
|
60357
|
-
* @param owned - The fields the component type gives to a plugin.
|
|
60358
|
-
* @returns The fields to write.
|
|
60359
|
-
* @example
|
|
60360
|
-
* ```ts
|
|
60361
|
-
* livePatch({ content: "Play", resolved: "" }, ["resolved"]); // { content: "Play" }
|
|
60362
|
-
* ```
|
|
60363
|
-
*/
|
|
60364
|
-
function livePatch(value, owned) {
|
|
60365
|
-
if (owned.length === 0) return value;
|
|
60366
|
-
return Object.fromEntries(Object.entries(value).filter(([field]) => !owned.includes(field)));
|
|
60367
|
-
}
|
|
60368
|
-
/**
|
|
60369
|
-
* The rest pose recorded for an extra component: the value of this render, but the fields the
|
|
60370
|
-
* component type gives to a plugin stay as the entity carries them, so a render never resets them.
|
|
60371
|
-
*
|
|
60372
|
-
* @param current - The value the entity carries now; none before the component is added.
|
|
60373
|
-
* @param value - The value of this render.
|
|
60374
|
-
* @param owned - The fields the component type gives to a plugin.
|
|
60375
|
-
* @returns The rest value.
|
|
60376
|
-
* @example
|
|
60377
|
-
* ```ts
|
|
60378
|
-
* restValueOf({ until: 2000, left: 42 }, { until: 5000, left: 0 }, ["left"]); // { until: 5000, left: 42 }
|
|
60379
|
-
* ```
|
|
60380
|
-
*/
|
|
60381
|
-
function restValueOf(current, value, owned) {
|
|
60382
|
-
if (current === void 0 || owned.length === 0) return value;
|
|
60383
|
-
return {
|
|
60384
|
-
...current,
|
|
60385
|
-
...livePatch(value, owned)
|
|
60386
|
-
};
|
|
60387
|
-
}
|
|
60388
|
-
/**
|
|
60389
60352
|
* Records the rest pose of one extra component with a value, so a `change` hook can bring it
|
|
60390
|
-
* home with `view.toRest`; a tag has no rest. The fields the type gives to a plugin
|
|
60391
|
-
*
|
|
60353
|
+
* home with `view.toRest`; a tag has no rest. The fields the type gives to a plugin, and the size
|
|
60354
|
+
* a game's own system gives a self-sized image (F111), stay as the entity carries them. The
|
|
60355
|
+
* visual of a live element is recorded the same way each time its look is written or it moves.
|
|
60392
60356
|
*
|
|
60393
60357
|
* @param ctx - Domain context of the ui plugin.
|
|
60394
60358
|
* @param element - The element that carries the component.
|
|
@@ -60397,7 +60361,9 @@ function restValueOf(current, value, owned) {
|
|
|
60397
60361
|
function recordRest(ctx, element, value) {
|
|
60398
60362
|
if (value.value === true) return;
|
|
60399
60363
|
const type = value.type;
|
|
60400
|
-
const
|
|
60364
|
+
const owned = fieldsLeftAlone(element, type, type.owned);
|
|
60365
|
+
const current = owned.length === 0 ? void 0 : ctx.deps.world.ecs.get(element.entity, type);
|
|
60366
|
+
const rest = restValueOf(current, value.value, owned);
|
|
60401
60367
|
ctx.deps.world.projection.setRest(element.entity, type, rest);
|
|
60402
60368
|
}
|
|
60403
60369
|
/**
|
|
@@ -62770,7 +62736,7 @@ function createReconciler(ctx, modules, fields) {
|
|
|
62770
62736
|
* @param type - Its component type.
|
|
62771
62737
|
*/
|
|
62772
62738
|
function writeOthers(element, value, type) {
|
|
62773
|
-
const others = otherFields(value, ecs.typeOf(type.componentName)?.owned ?? NO_OWNED);
|
|
62739
|
+
const others = otherFields(value, fieldsLeftAlone(element, type, ecs.typeOf(type.componentName)?.owned ?? NO_OWNED));
|
|
62774
62740
|
if (others !== void 0) ecs.set(element.entity, asHandle(type), others);
|
|
62775
62741
|
}
|
|
62776
62742
|
/**
|
|
@@ -62787,7 +62753,8 @@ function createReconciler(ctx, modules, fields) {
|
|
|
62787
62753
|
return;
|
|
62788
62754
|
}
|
|
62789
62755
|
if (value.value === true || SCROLL_STATE.has(value.type.componentName)) return;
|
|
62790
|
-
const
|
|
62756
|
+
const typeOwned = ecs.typeOf(value.type.componentName)?.owned ?? NO_OWNED;
|
|
62757
|
+
const owned = fieldsLeftAlone(element, value.type, typeOwned);
|
|
62791
62758
|
ecs.set(element.entity, asHandle(value.type), livePatch(value.value, owned));
|
|
62792
62759
|
}
|
|
62793
62760
|
/**
|
|
@@ -64466,21 +64433,6 @@ function restTransform(rect, parent, style = {}, fit = 1) {
|
|
|
64466
64433
|
};
|
|
64467
64434
|
}
|
|
64468
64435
|
/**
|
|
64469
|
-
* The rest value of the visual that is actually on the element: the same value the entity is
|
|
64470
|
-
* drawn with, so a motion returns to exactly that.
|
|
64471
|
-
*
|
|
64472
|
-
* @param element - The element whose rect is known.
|
|
64473
|
-
* @returns The component and the value to record, or `undefined` for an element with no visual.
|
|
64474
|
-
*/
|
|
64475
|
-
function restVisual(element) {
|
|
64476
|
-
const [visual] = visualOf$1(element);
|
|
64477
|
-
if (visual === void 0 || visual.value === true) return void 0;
|
|
64478
|
-
return {
|
|
64479
|
-
component: visual.type,
|
|
64480
|
-
value: visual.value
|
|
64481
|
-
};
|
|
64482
|
-
}
|
|
64483
|
-
/**
|
|
64484
64436
|
* Records the rest pose of one element before a hook runs: the transform from `Box` and the
|
|
64485
64437
|
* style, and the visual the element is actually drawn with. The content of a scroll records no
|
|
64486
64438
|
* rest `Transform`: the scroll step owns its pose, and the world brings an element back to every
|
|
@@ -64493,8 +64445,12 @@ function restVisual(element) {
|
|
|
64493
64445
|
function writeRest(ctx, element, parent) {
|
|
64494
64446
|
const projection = ctx.deps.world.projection;
|
|
64495
64447
|
if (element.type !== "content") projection.setRest(element.entity, Transform, restTransform(element.rect, parent, element.style, element.fit));
|
|
64496
|
-
const visual =
|
|
64497
|
-
if (visual
|
|
64448
|
+
const [visual] = visualOf$1(element);
|
|
64449
|
+
if (visual === void 0 || visual.value === true) return;
|
|
64450
|
+
const type = visual.type;
|
|
64451
|
+
const left = fieldsLeftAlone(element, type, type.owned);
|
|
64452
|
+
const current = left.length === 0 ? void 0 : ctx.deps.world.ecs.get(element.entity, type);
|
|
64453
|
+
projection.setRest(element.entity, type, restValueOf(current, visual.value, left));
|
|
64498
64454
|
}
|
|
64499
64455
|
/**
|
|
64500
64456
|
* Tells whether an element waits for the swap of a scene `world` builds aside (spec 31), or for the
|
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-
|
|
1
|
+
import { an as type, en as refuseStart, m as flattenFeatures, nn as exit, t as createApp } from "./src-B3cwICTC.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";
|
|
@@ -1280,6 +1280,25 @@ function boxOf(element) {
|
|
|
1280
1280
|
return element.boxed === true ? { box: 0 } : {};
|
|
1281
1281
|
}
|
|
1282
1282
|
/**
|
|
1283
|
+
* Tells whether a style states the width of its element: a width, or both side edges of an absolute element.
|
|
1284
|
+
*
|
|
1285
|
+
* @param style - The resolved style.
|
|
1286
|
+
* @returns True when it does.
|
|
1287
|
+
*/
|
|
1288
|
+
function statesWidth(style) {
|
|
1289
|
+
return style.width !== void 0 || style.position === "absolute" && style.left !== void 0 && style.right !== void 0;
|
|
1290
|
+
}
|
|
1291
|
+
/**
|
|
1292
|
+
* Tells whether a style states the height of its element: a height, or both top and bottom edges of an absolute
|
|
1293
|
+
* element.
|
|
1294
|
+
*
|
|
1295
|
+
* @param style - The resolved style.
|
|
1296
|
+
* @returns True when it does.
|
|
1297
|
+
*/
|
|
1298
|
+
function statesHeight(style) {
|
|
1299
|
+
return style.height !== void 0 || style.position === "absolute" && style.top !== void 0 && style.bottom !== void 0;
|
|
1300
|
+
}
|
|
1301
|
+
/**
|
|
1283
1302
|
* Whether the layout sized an image to nothing: an axis whose size its style states (a width or a
|
|
1284
1303
|
* height, or both edges of an absolute element) came out at 0. An image whose style states no size
|
|
1285
1304
|
* is 0 by 0 too, and draws as its `Sprite` says: at its texture's size, or at the size a game's own
|
|
@@ -1290,10 +1309,79 @@ function boxOf(element) {
|
|
|
1290
1309
|
* @returns True when it draws nothing.
|
|
1291
1310
|
*/
|
|
1292
1311
|
function sizedToNothing(style, rect) {
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1312
|
+
return statesWidth(style) && rect.w <= 0 || statesHeight(style) && rect.h <= 0;
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* The patch a live element writes into one of its components: every field but the ones the
|
|
1316
|
+
* component type gives to a plugin. That plugin keeps such a field for the life of the entity, so
|
|
1317
|
+
* a re-render never puts it back to its default: a label keeps the string `text` resolved for it.
|
|
1318
|
+
*
|
|
1319
|
+
* @param value - The component value the element carries now.
|
|
1320
|
+
* @param owned - The fields the component type gives to a plugin.
|
|
1321
|
+
* @returns The fields to write.
|
|
1322
|
+
* @example
|
|
1323
|
+
* ```ts
|
|
1324
|
+
* livePatch({ content: "Play", resolved: "" }, ["resolved"]); // { content: "Play" }
|
|
1325
|
+
* ```
|
|
1326
|
+
*/
|
|
1327
|
+
function livePatch(value, owned) {
|
|
1328
|
+
if (owned.length === 0) return value;
|
|
1329
|
+
return Object.fromEntries(Object.entries(value).filter(([field]) => !owned.includes(field)));
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* The rest pose recorded for an extra component: the value of this render, but the fields the
|
|
1333
|
+
* component type gives to a plugin stay as the entity carries them, so a render never resets them.
|
|
1334
|
+
*
|
|
1335
|
+
* @param current - The value the entity carries now; none before the component is added.
|
|
1336
|
+
* @param value - The value of this render.
|
|
1337
|
+
* @param owned - The fields the component type gives to a plugin.
|
|
1338
|
+
* @returns The rest value.
|
|
1339
|
+
* @example
|
|
1340
|
+
* ```ts
|
|
1341
|
+
* restValueOf({ until: 2000, left: 42 }, { until: 5000, left: 0 }, ["left"]); // { until: 5000, left: 42 }
|
|
1342
|
+
* ```
|
|
1343
|
+
*/
|
|
1344
|
+
function restValueOf(current, value, owned) {
|
|
1345
|
+
if (current === void 0 || owned.length === 0) return value;
|
|
1346
|
+
return {
|
|
1347
|
+
...current,
|
|
1348
|
+
...livePatch(value, owned)
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
/** The sizes of a sprite ui leaves alone, by axis: one list each, never a new one. */
|
|
1352
|
+
const LEFT_NONE = [];
|
|
1353
|
+
const LEFT_WIDTH = ["width"];
|
|
1354
|
+
const LEFT_HEIGHT = ["height"];
|
|
1355
|
+
const LEFT_BOTH = ["width", "height"];
|
|
1356
|
+
/**
|
|
1357
|
+
* The list of sizes left alone for the axes that are.
|
|
1358
|
+
*
|
|
1359
|
+
* @param width - The width is left alone.
|
|
1360
|
+
* @param height - The height is left alone.
|
|
1361
|
+
* @returns One of the four lists.
|
|
1362
|
+
*/
|
|
1363
|
+
function leftSizes(width, height) {
|
|
1364
|
+
if (width && height) return LEFT_BOTH;
|
|
1365
|
+
if (width) return LEFT_WIDTH;
|
|
1366
|
+
return height ? LEFT_HEIGHT : LEFT_NONE;
|
|
1367
|
+
}
|
|
1368
|
+
/**
|
|
1369
|
+
* The fields of a value ui does not write onto a live element, or record as its rest: those its component type gives
|
|
1370
|
+
* to a plugin and, for the `Sprite` of an image or an icon, the size on an axis its style does not state and the layout
|
|
1371
|
+
* left at 0. A game's own system sizes such a sprite; written again by ui (a new viewport, a covered root, a restore)
|
|
1372
|
+
* it went back to 0 by 0, drawn at its texture's size (F111). On a first add the size is 0 anyway, the texture's.
|
|
1373
|
+
*
|
|
1374
|
+
* @param element - The element.
|
|
1375
|
+
* @param type - The component type of the value.
|
|
1376
|
+
* @param owned - The fields its type gives to a plugin.
|
|
1377
|
+
* @returns The fields left alone.
|
|
1378
|
+
*/
|
|
1379
|
+
function fieldsLeftAlone(element, type, owned) {
|
|
1380
|
+
const { style, rect } = element;
|
|
1381
|
+
if (!(element.type === "image" || element.type === "icon") || type !== Sprite) return owned;
|
|
1382
|
+
const sizes = leftSizes(rect.w <= 0 && !statesWidth(style), rect.h <= 0 && !statesHeight(style));
|
|
1383
|
+
if (owned.length === 0) return sizes;
|
|
1384
|
+
return sizes.length === 0 ? owned : [...owned, ...sizes];
|
|
1297
1385
|
}
|
|
1298
1386
|
/**
|
|
1299
1387
|
* The visual component of an element: a sprite for an image or an icon (at alpha 0 while its style
|
|
@@ -1487,4 +1575,4 @@ function drawnRect(pose, local) {
|
|
|
1487
1575
|
};
|
|
1488
1576
|
}
|
|
1489
1577
|
//#endregion
|
|
1490
|
-
export {
|
|
1578
|
+
export { Layer as $, readStyle as A, Display as B, defineStyle as C, builtInStyles as D, bind as E, parentOf as F, Parent as G, NineSlice as H, poseUnder as I, Transform as J, Shape as K, rootPointOf as L, applyPose as M, isLeaving as N, defineTextStyles as O, localPoseOf as P, Exiting as Q, rootPoseInto as R, defineTokens as S, Text as T, Overlay as U, HudPart as V, OverlayLevel as W, componentsFor as X, arcDefaults as Y, sprite as Z, ScrollState as _, fitScaleOf as a, resource as at, popup as b, samePose as c, tag as ct, Box as d, Now as et, Covered as f, Scroll as g, LocalWrite as h, fieldsLeftAlone as i, mut as it, textFor as j, label as k, visualOf as l, Escapable as m, CONTENT as n, Tree as nt, livePatch as o, system as ot, DebugTrigger as p, Sprite as q, drawnRect as r, component as rt, restValueOf as s, systemsFor as st, ANCHOR as t, Order as tt, visualRectOf as u, UI_OWNER as v, Countdown as w, uiFor as x, UiCounters as y, rootPoseOf as z };
|
|
@@ -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-
|
|
6
|
+
import { t as commands } from "./commands-B208rrQE.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-
|
|
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";
|
|
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/dist/visual.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as VISUAL_CLOCK } from "./fake-hnJcJeYf.mjs";
|
|
2
|
-
import { n as read, t as sources } from "./sources-
|
|
2
|
+
import { n as read, t as sources } from "./sources-Djd8MjP9.mjs";
|
|
3
3
|
import { n as commands, t as run } from "./run-3QhrffgM.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { createBrandConsole } from "@moku-labs/common/cli";
|
package/llms.txt
CHANGED
|
@@ -599,7 +599,7 @@ A screen is a projection whose `view` returns JSX. The game's `tsconfig.json` se
|
|
|
599
599
|
- Animation is data: `defineAnimation(id, { slots: { name: type<Anim.Target>() }, build: (slots, { at }) => Step })`. Steps: `sequence(...)`, `parallel(...)`, `stagger(items, ms, item => Step)`, `tween(target, Component, to, { ms, ease?, delayMs?, additive?, space?, reduced? })`, `set(target, Component, patch)`, `wait(ms)`, `mark(name)`, `frames(target, { keys, fps, loop? })`, `sfx(key, { bus? })`, `haptic(kind)`, `use(animation, slots, tools?)`, `spawn` (a temporary entity, flying coins, that the timeline despawns when it ends; see the anim README). `Frames({ keys, fps, loop, playing })` is a component that walks a sprite through its textures for the entity's whole life. A target is `{ projection, key }` or an entity. A timeline resolves each `{ projection, key }` target once, when it starts: every step writes the view that held the key then, also after a commit removed it and while its exit plays, until it despawns; a view spawned again under the same key is not followed, and a key nothing held at the start is looked up at its step. `reduced: "keep"` (on a `tween` step, `transition` and `loop` of `defineMotion`, `TweenOptions`, `RestOptions`) plays a track as written under reduced motion, a fade for one; the default `"cut"` lands it at once or holds a loop on its first key. A node plays it with `await fx(play(animation, slots))`; in fast mode it finishes at once. `defineMotion({ states, transition?, on: { enter?, exit?, change? }, when? })` builds the enter, exit and change hooks for a projection or the `motion` prop of a tag; `when: "change"` plays enter and exit only for a commit, so an element that comes or goes with its screen stands at rest and leaves without a motion (default `"always"`). Events `anim:mark` `{ animation, mark }` and `anim:finished` `{ animation }`. `app.anim.replace(definition)` is the dev hot swap: the next `play` builds the new tree. A system cannot `require` a plugin, so it plays through the resource `AnimPlayer`: `res(AnimPlayer).play(animation, slots)` returns the same handle as `app.anim.play`, and the registered animation of `animation.id` wins, so a hot swap reaches the system. Play on a change, never every frame; from phase `input` the tree moves in `animate` of the same frame. Before `anim` starts it throws `[game] AnimPlayer is not ready: anim has not started.` Config `maxTracks: 2000`.
|
|
600
600
|
- A `tween` step takes `segments` and `repeat` as `ViewHandle.tween` does: `tween(chest, Transform, { y: 0, scale: 0 }, { ms: 2400, additive: true, repeat: "forever", segments: [{ at: 0.08, ease: "out", to: { y: -14, scale: 0.06 } }, { at: 1, to: { y: 0, scale: 0 } }] })`. Segments walk over `ms` on one clock, `to` is where the last one ends, an additive walk names offsets; a number counts the extra runs. A definition error throws for empty segments, an `at` outside 0..1 or out of order, a last segment before 1, a bad repeat, and a `sequence` step after one that never ends. A forever step ends only by cancel or finish (a finish and a fast world land it on its start pose), does not play under reduced motion `"cut"`, writes nothing while its view is unseen, and lets the clock idle; a system plays it once through `AnimPlayer` and keeps the handle.
|
|
601
601
|
- Audio is opt-in: `plugins: [...screen, audioPlugin]`. `fx(sfx("orders.complete"))` resolves when the sound started. `await fx(music("board.theme"))` cross-fades; `music(null)` fades out; a scene's `music` key switches the track on `scenes:changed`. Buses `master`, `music`, `sfx`. Volumes come from the committed player: config `volumes: player => (player as Player).settings.audio`, applied on every `model:committed`. `app.audio`: `setVolume(bus, value)`, `volume(bus)`, `mute(bus, on)`, `muted(bus)`, `unlocked()`, `journal()` (the last started sounds, empty unless config `journal` is above 0). Config: `buses: { master: 1, music: 0.6, sfx: 1 }`, `musicFadeMs: 600`, `volumes`, `context`, `journal: 0`, `music: "decode" | "stream"` default `"decode"` (gapless buffer; `"stream"` is an `<audio>` element, less memory, a gap at every loop), `session: "ambient" | "playback" | "auto"` default `"ambient"` (iOS only: ambient mixes with other apps and obeys the silent switch). The context is asked to run at start: where the shell lets audio play (a native webview with the gesture requirement off) `unlocked()` is true with no touch; a browser that wants a gesture unlocks on the first `pointerdown` or `touchend`. Without `audio` every `sfx` and `music` effect resolves `undefined` at once, so the same node runs in a game with no sound. Named sounds: `sfx(key, { bus?, id?, fadeMs? })` with an `id` plays through its own gain, and the next sound with the same `id` fades the old one out over `fadeMs`, else config `sfxFadeMs` (default `120`, real milliseconds); `fx.start(stopSfx(id, { fadeMs? }))` and `app.audio.stop(id, { fadeMs? })` fade it out and end it (`fadeMs: 0` cuts it); an `id` nothing plays under changes nothing, and a sound of that `id` still decoding never starts. Without `id` an `sfx` plays to its end as before.
|
|
602
|
-
- `app.ui`: `tree()` the live screen as plain data (a text node carries `content`, the words it draws after `tr()` and `bind`; a text field carries `value`), `find(key)` the entity of a keyed element, `fill(key, value)` types into the text field with that `key`, `scroll(key, to)` puts the `scroll` with that `key` at `to` from its start at once, inside `0..max`, its fling or glide stopped (`false` and `ui:scroll-without-scroll` for no live `scroll`, `false` and `ui:scroll-before-solve` for a `scroll` its first solve has not placed yet), `rectOf(target)` where an `AnchorTarget` (or the shown ones of a list) is drawn, in screen reference units, the rect an `<anchor>` sits on, a target of no area shown at its point (`{ x, y, w: 0, h: 0 }`; an `<anchor>` on it stands there at size 0, takes no tap, its children lay out and hit as usual; an inward `pad` past half the target leaves it at size 0 on the centre), `undefined` when none is shown (an `image` whose style states a size, `width`/`height` or both edges of an absolute one, laid out at 0 draws nothing and counts as not shown; one whose style states no size keeps its alpha and draws as its `Sprite` says), any build, a new object per call (`app.ui.rectOf({ projection: "board.strip", key: "seat0" })` → `{ x: 40, y: 1500, w: 116, h: 120 }`), `lint()` tap targets under `tapTargetPt` (default `44`), text that overflows in some locale, absolute elements without `reason`. Config: `tapTargetPt: 44`, `breakpoints: { tall: 2, wide: 1.5 }`. `ui` emits only the dev global event `ui:hot-swap`, see "Hot swap".
|
|
602
|
+
- `app.ui`: `tree()` the live screen as plain data (a text node carries `content`, the words it draws after `tr()` and `bind`; a text field carries `value`), `find(key)` the entity of a keyed element, `fill(key, value)` types into the text field with that `key`, `scroll(key, to)` puts the `scroll` with that `key` at `to` from its start at once, inside `0..max`, its fling or glide stopped (`false` and `ui:scroll-without-scroll` for no live `scroll`, `false` and `ui:scroll-before-solve` for a `scroll` its first solve has not placed yet), `rectOf(target)` where an `AnchorTarget` (or the shown ones of a list) is drawn, in screen reference units, the rect an `<anchor>` sits on, a target of no area shown at its point (`{ x, y, w: 0, h: 0 }`; an `<anchor>` on it stands there at size 0, takes no tap, its children lay out and hit as usual; an inward `pad` past half the target leaves it at size 0 on the centre), `undefined` when none is shown (an `image` whose style states a size, `width`/`height` or both edges of an absolute one, laid out at 0 draws nothing and counts as not shown; one whose style states no size keeps its alpha and draws as its `Sprite` says, ui never writing the size a game's system gives it), any build, a new object per call (`app.ui.rectOf({ projection: "board.strip", key: "seat0" })` → `{ x: 40, y: 1500, w: 116, h: 120 }`), `lint()` tap targets under `tapTargetPt` (default `44`), text that overflows in some locale, absolute elements without `reason`. Config: `tapTargetPt: 44`, `breakpoints: { tall: 2, wide: 1.5 }`. `ui` emits only the dev global event `ui:hot-swap`, see "Hot swap".
|
|
603
603
|
|
|
604
604
|
```tsx
|
|
605
605
|
// features/hud/view.tsx
|