@moku-labs/game 0.15.29 → 0.15.31
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.d.mts +1 -1
- package/dist/app/page.mjs +1 -1
- package/dist/app/system.d.mts +2 -2
- package/dist/app.d.mts +1 -1
- package/dist/app.mjs +1 -1
- package/dist/{commands-BOxMqhVe.d.mts → commands-C8N_rpwt.d.mts} +28 -28
- package/dist/control.d.mts +1 -1
- package/dist/control.mjs +2 -2
- package/dist/{index-Cl5zwodk.d.mts → index-DMeqKGSu.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/inspect.d.mts +11 -11
- package/dist/inspect.mjs +2 -2
- package/dist/{run-DRcc2SKF.mjs → run-BnriyKUu.mjs} +16 -44
- package/dist/{session-CeKgO2hy.mjs → session-DuZfGZWk.mjs} +20 -1
- package/dist/{sources-ncFMQIus.mjs → sources-DM5Zcl4o.mjs} +8 -17
- package/dist/{src-wyJYr12n.mjs → src-5qdNjLKN.mjs} +255 -43
- package/dist/testing.d.mts +2 -2
- package/dist/testing.mjs +1 -1
- package/dist/{types-DjQkfbfZ.d.mts → types-DHamyZq1.d.mts} +46 -22
- package/dist/{types-Cyu_jKop.d.mts → types-DmU_qlvA.d.mts} +2 -2
- package/dist/{visual-DhNLNtl8.d.mts → visual-HGn_TF2x.d.mts} +2 -2
- package/dist/visual.d.mts +1 -1
- package/dist/visual.mjs +2 -2
- package/llms.txt +13 -11
- package/package.json +1 -1
|
@@ -8878,7 +8878,7 @@ function schemaOfType(type) {
|
|
|
8878
8878
|
defaults: notJson,
|
|
8879
8879
|
owned
|
|
8880
8880
|
};
|
|
8881
|
-
const fields =
|
|
8881
|
+
const fields = Object.create(null);
|
|
8882
8882
|
for (const [field, value] of Object.entries(defaults)) fields[field] = fieldKind(value);
|
|
8883
8883
|
return {
|
|
8884
8884
|
name,
|
|
@@ -32876,36 +32876,91 @@ function spriteOf(cctx, step) {
|
|
|
32876
32876
|
function startTween(cctx, step) {
|
|
32877
32877
|
const entity = targetOf$2(cctx, step);
|
|
32878
32878
|
if (entity === void 0) return void 0;
|
|
32879
|
-
return cctx.rt.start(entity, step.component,
|
|
32879
|
+
return cctx.rt.start(entity, step.component, inSpace(cctx, entity, step, step.to), trackOptionsOf$1(cctx, entity, step));
|
|
32880
|
+
}
|
|
32881
|
+
/**
|
|
32882
|
+
* The options a `tween` step starts its track with. The keyframe segments and the repeat are
|
|
32883
|
+
* passed only when the step has them, the segment targets turned like `to` in the root space.
|
|
32884
|
+
*
|
|
32885
|
+
* @param cctx - What the cursor carries down the tree.
|
|
32886
|
+
* @param entity - The entity the step moves.
|
|
32887
|
+
* @param step - The tween step.
|
|
32888
|
+
* @returns The track options.
|
|
32889
|
+
*/
|
|
32890
|
+
function trackOptionsOf$1(cctx, entity, step) {
|
|
32891
|
+
const options = {
|
|
32880
32892
|
ms: step.ms,
|
|
32881
32893
|
ease: step.ease,
|
|
32882
32894
|
delayMs: step.delayMs,
|
|
32883
32895
|
additive: step.additive,
|
|
32884
32896
|
reduced: step.reduced
|
|
32885
|
-
}
|
|
32897
|
+
};
|
|
32898
|
+
const segments = step.segments;
|
|
32899
|
+
if (segments !== void 0) options.segments = step.space === "root" ? segments.map((segment) => ({
|
|
32900
|
+
...segment,
|
|
32901
|
+
to: inSpace(cctx, entity, step, segment.to)
|
|
32902
|
+
})) : segments;
|
|
32903
|
+
if (step.repeat !== void 0) options.repeat = step.repeat;
|
|
32904
|
+
return options;
|
|
32886
32905
|
}
|
|
32887
32906
|
/**
|
|
32888
|
-
*
|
|
32889
|
-
*
|
|
32907
|
+
* Target fields of a `tween` step for one entity: as written in the local space, turned into the
|
|
32908
|
+
* space of the entity's parent in the root space.
|
|
32890
32909
|
*
|
|
32891
32910
|
* @param cctx - What the cursor carries down the tree.
|
|
32892
32911
|
* @param entity - The entity the step moves.
|
|
32893
32912
|
* @param step - The tween step.
|
|
32913
|
+
* @param fields - Its `to`, the target of one of its segments, or where it lands.
|
|
32894
32914
|
* @returns The fields the track or the write aims at.
|
|
32895
32915
|
*/
|
|
32896
|
-
function
|
|
32897
|
-
if (step.space === "root") return cctx.rt.toLocal(entity, step.component,
|
|
32898
|
-
return { ...
|
|
32916
|
+
function inSpace(cctx, entity, step, fields) {
|
|
32917
|
+
if (step.space === "root") return cctx.rt.toLocal(entity, step.component, fields);
|
|
32918
|
+
return { ...fields };
|
|
32919
|
+
}
|
|
32920
|
+
/**
|
|
32921
|
+
* The last value each field reaches over a list of segments.
|
|
32922
|
+
*
|
|
32923
|
+
* @param segments - The segments of a step.
|
|
32924
|
+
* @returns One value per field any segment names.
|
|
32925
|
+
* @example
|
|
32926
|
+
* ```ts
|
|
32927
|
+
* lastValues([{ at: 0.5, to: { y: 10, rotation: 2 } }, { at: 1, to: { y: 0 } }]); // { y: 0, rotation: 2 }
|
|
32928
|
+
* ```
|
|
32929
|
+
*/
|
|
32930
|
+
function lastValues$1(segments) {
|
|
32931
|
+
const values = {};
|
|
32932
|
+
for (const segment of segments) Object.assign(values, segment.to);
|
|
32933
|
+
return values;
|
|
32934
|
+
}
|
|
32935
|
+
/**
|
|
32936
|
+
* Where a `tween` step that never started lands when it is finished: its target, and for a
|
|
32937
|
+
* keyframe walk every field its segments name too, at the last value they give it. A step that
|
|
32938
|
+
* repeats forever lands on its start pose, where it already stands, and an additive walk names
|
|
32939
|
+
* offsets that end with it: neither writes anything.
|
|
32940
|
+
*
|
|
32941
|
+
* @param step - The tween step.
|
|
32942
|
+
* @returns The fields to write, or `undefined` when the step writes nothing.
|
|
32943
|
+
*/
|
|
32944
|
+
function landingOf(step) {
|
|
32945
|
+
if (step.repeat === "forever") return void 0;
|
|
32946
|
+
if (step.segments === void 0) return step.to;
|
|
32947
|
+
if (step.additive) return void 0;
|
|
32948
|
+
return {
|
|
32949
|
+
...lastValues$1(step.segments),
|
|
32950
|
+
...step.to
|
|
32951
|
+
};
|
|
32899
32952
|
}
|
|
32900
32953
|
/**
|
|
32901
|
-
* Writes
|
|
32954
|
+
* Writes where a `tween` step that never started lands, in the space the step names.
|
|
32902
32955
|
*
|
|
32903
32956
|
* @param cctx - What the cursor carries down the tree.
|
|
32904
32957
|
* @param step - The tween step.
|
|
32905
32958
|
*/
|
|
32906
32959
|
function writeTween(cctx, step) {
|
|
32960
|
+
const landing = landingOf(step);
|
|
32961
|
+
if (landing === void 0) return;
|
|
32907
32962
|
const entity = targetOf$2(cctx, step);
|
|
32908
|
-
if (entity !== void 0) cctx.rt.write(entity, step.component,
|
|
32963
|
+
if (entity !== void 0) cctx.rt.write(entity, step.component, inSpace(cctx, entity, step, landing));
|
|
32909
32964
|
}
|
|
32910
32965
|
/**
|
|
32911
32966
|
* Writes the patch of a `set` step.
|
|
@@ -33126,7 +33181,9 @@ function advanceCursor(cctx, cursor, deltaMs) {
|
|
|
33126
33181
|
/**
|
|
33127
33182
|
* Ends one step at its own end: a track writes its exact target, a step that never started writes
|
|
33128
33183
|
* it at once, the marks are jumped in tree order, no effect is fired and nothing is spawned: the
|
|
33129
|
-
* timeline despawns its entities as it ends, so a skipped spawn would only flash.
|
|
33184
|
+
* timeline despawns its entities as it ends, so a skipped spawn would only flash. A track that
|
|
33185
|
+
* repeats forever has no end: it lands on its start pose, and one that never started writes
|
|
33186
|
+
* nothing.
|
|
33130
33187
|
*
|
|
33131
33188
|
* @param cctx - What the cursor carries down the tree.
|
|
33132
33189
|
* @param cursor - The cursor of the step.
|
|
@@ -34447,7 +34504,8 @@ function repeatsOf(repeat) {
|
|
|
34447
34504
|
* keyframe segments walks them over `ms` and books every field they name; one with `repeat`
|
|
34448
34505
|
* walks again when a run ends. With reduced motion on, every track but a loop takes 0 ms, its
|
|
34449
34506
|
* delay and its repeats dropped: it lands on its target at its first frame step. A track started
|
|
34450
|
-
* with `reduced: "keep"` keeps its length, its delay and its repeats.
|
|
34507
|
+
* with `reduced: "keep"` keeps its length, its delay and its repeats. A timeline's loop under
|
|
34508
|
+
* reduced motion does not play at all: it is born ended, writes nothing, and its step goes on.
|
|
34451
34509
|
*
|
|
34452
34510
|
* @param actx - Domain context of the anim plugin.
|
|
34453
34511
|
* @param entity - The entity to animate.
|
|
@@ -34462,9 +34520,11 @@ function startTrack$1(actx, entity, component, to, options, muted, driven = fals
|
|
|
34462
34520
|
const target = targetOf$1(to, options.segments);
|
|
34463
34521
|
const repeats = repeatsOf(options.repeat);
|
|
34464
34522
|
const keep = options.reduced === "keep";
|
|
34465
|
-
const
|
|
34523
|
+
const cut = actx.state.reducedMotion && !keep;
|
|
34524
|
+
const instant = cut && repeats !== Number.POSITIVE_INFINITY;
|
|
34466
34525
|
const keys = keysOf(entity, component.componentName, target);
|
|
34467
34526
|
const names = Object.keys(target);
|
|
34527
|
+
const bornEnded = names.length === 0 || cut && driven && repeats === Number.POSITIVE_INFINITY;
|
|
34468
34528
|
const track = {
|
|
34469
34529
|
id: actx.state.nextId,
|
|
34470
34530
|
entity,
|
|
@@ -34488,7 +34548,7 @@ function startTrack$1(actx, entity, component, to, options, muted, driven = fals
|
|
|
34488
34548
|
additive: options.additive === true,
|
|
34489
34549
|
driven,
|
|
34490
34550
|
bornFrame: actx.state.frame,
|
|
34491
|
-
ended:
|
|
34551
|
+
ended: bornEnded,
|
|
34492
34552
|
segments: options.segments,
|
|
34493
34553
|
repeatsLeft: instant ? 0 : repeats,
|
|
34494
34554
|
held: false,
|
|
@@ -34593,7 +34653,7 @@ function advanceTrack(actx, track, deltaMs) {
|
|
|
34593
34653
|
const run = clock[1] ?? 0;
|
|
34594
34654
|
const fraction = track.ms <= 0 ? 1 : Math.min(run / track.ms, 1);
|
|
34595
34655
|
const final = fraction >= 1 && (track.repeatsLeft === 0 || track.ms <= 0);
|
|
34596
|
-
if (
|
|
34656
|
+
if (isHeldLoop(actx, track, final)) return 0;
|
|
34597
34657
|
clock[1] = fraction;
|
|
34598
34658
|
writeFields(actx, track, final);
|
|
34599
34659
|
if (!final) return 0;
|
|
@@ -34601,15 +34661,29 @@ function advanceTrack(actx, track, deltaMs) {
|
|
|
34601
34661
|
return Math.max(0, run - track.ms);
|
|
34602
34662
|
}
|
|
34603
34663
|
/**
|
|
34604
|
-
*
|
|
34664
|
+
* Tells whether an endless loop writes nothing this frame because the player cannot see it.
|
|
34665
|
+
*
|
|
34666
|
+
* @param actx - Domain context of the anim plugin.
|
|
34667
|
+
* @param track - The track that advances.
|
|
34668
|
+
* @param final - Whether this step lands the track.
|
|
34669
|
+
* @returns True when the loop is held.
|
|
34670
|
+
*/
|
|
34671
|
+
function isHeldLoop(actx, track, final) {
|
|
34672
|
+
return !final && track.repeatsLeft === Number.POSITIVE_INFINITY && actx.state.loopsHeld?.(track.entity, track.reveals) === true;
|
|
34673
|
+
}
|
|
34674
|
+
/**
|
|
34675
|
+
* Writes the exact target of a track and ends it. Muted fields are left alone here too. A
|
|
34676
|
+
* timeline's loop has no end to land on: it lands on its first key, the pose its walk starts
|
|
34677
|
+
* from, which is where a cut or a fast walk leaves it (F75).
|
|
34605
34678
|
*
|
|
34606
34679
|
* @param actx - Domain context of the anim plugin.
|
|
34607
34680
|
* @param track - The track to finish.
|
|
34608
34681
|
*/
|
|
34609
34682
|
function finishTrack(actx, track) {
|
|
34610
34683
|
if (track.ended) return;
|
|
34611
|
-
track.
|
|
34612
|
-
|
|
34684
|
+
const final = !track.driven || track.repeatsLeft !== Number.POSITIVE_INFINITY;
|
|
34685
|
+
track.clock[1] = final ? 1 : 0;
|
|
34686
|
+
writeFields(actx, track, final);
|
|
34613
34687
|
endTrack(actx, track);
|
|
34614
34688
|
}
|
|
34615
34689
|
/**
|
|
@@ -49843,6 +49917,102 @@ function createHandlers$1(ctx) {
|
|
|
49843
49917
|
} };
|
|
49844
49918
|
}
|
|
49845
49919
|
//#endregion
|
|
49920
|
+
//#region src/plugins/anim/timeline/checks.ts
|
|
49921
|
+
/**
|
|
49922
|
+
* Checks the keyframe segments of a `tween` step: at least one, every `at` in 0..1, each after the
|
|
49923
|
+
* one before, and the last at 1, because `to` is where the walk lands.
|
|
49924
|
+
*
|
|
49925
|
+
* @param component - Name of the component the step drives, for the error.
|
|
49926
|
+
* @param segments - The segments the author gave.
|
|
49927
|
+
* @throws {Error} When the list is empty, an `at` is out of range or out of order, or the last
|
|
49928
|
+
* segment ends before 1.
|
|
49929
|
+
* @example
|
|
49930
|
+
* ```ts
|
|
49931
|
+
* checkSegments("Transform", [{ at: 0.5 }, { at: 1 }]); // returns; [{ at: 0.5 }] throws
|
|
49932
|
+
* ```
|
|
49933
|
+
*/
|
|
49934
|
+
function checkSegments(component, segments) {
|
|
49935
|
+
if (segments.length === 0) throw new Error(`[game] A tween of ${component} has no segments.\n Give it at least one segment, the last one at 1.`);
|
|
49936
|
+
let previous = Number.NEGATIVE_INFINITY;
|
|
49937
|
+
for (const { at } of segments) {
|
|
49938
|
+
if (Number.isNaN(at) || at < 0 || at > 1) throw new Error(`[game] A tween of ${component} has a segment at ${at}.\n Keep every at between 0 and 1.`);
|
|
49939
|
+
if (at <= previous) throw new Error(`[game] A tween of ${component} has its segments out of order at ${at}.\n Sort the segments by at, each one after the one before.`);
|
|
49940
|
+
previous = at;
|
|
49941
|
+
}
|
|
49942
|
+
if (previous !== 1) throw new Error(`[game] A tween of ${component} ends its last segment at ${previous}.\n End the last segment at 1: to is where the walk lands.`);
|
|
49943
|
+
}
|
|
49944
|
+
/**
|
|
49945
|
+
* Checks the space of a keyframe walk: an additive one names offsets, and the root space would
|
|
49946
|
+
* turn each offset as if it were a root position, so a chest under a slot at root y 500 would jump
|
|
49947
|
+
* by about 500 at its first segment. An additive walk stays in the local space.
|
|
49948
|
+
*
|
|
49949
|
+
* @param component - Name of the component the step drives, for the error.
|
|
49950
|
+
* @param additive - Whether the walk adds offsets.
|
|
49951
|
+
* @param space - The space the step names.
|
|
49952
|
+
* @throws {Error} When an additive walk names the root space.
|
|
49953
|
+
* @example
|
|
49954
|
+
* ```ts
|
|
49955
|
+
* checkWalkSpace("Transform", true, "local"); // returns; (…, true, "root") throws
|
|
49956
|
+
* ```
|
|
49957
|
+
*/
|
|
49958
|
+
function checkWalkSpace(component, additive, space) {
|
|
49959
|
+
if (!additive || space === "local") return;
|
|
49960
|
+
throw new Error(`[game] An additive tween of ${component} walks segments in the root space.\n Use space "local" for an additive walk.`);
|
|
49961
|
+
}
|
|
49962
|
+
/**
|
|
49963
|
+
* Checks the repeat of a `tween` step: a whole number of extra runs, 0 or more, or `"forever"`.
|
|
49964
|
+
*
|
|
49965
|
+
* @param component - Name of the component the step drives, for the error.
|
|
49966
|
+
* @param repeat - The repeat the author gave.
|
|
49967
|
+
* @throws {Error} When the repeat is negative, not whole or not a number.
|
|
49968
|
+
* @example
|
|
49969
|
+
* ```ts
|
|
49970
|
+
* checkRepeat("Transform", "forever"); // returns; checkRepeat("Transform", 1.5) throws
|
|
49971
|
+
* ```
|
|
49972
|
+
*/
|
|
49973
|
+
function checkRepeat(component, repeat) {
|
|
49974
|
+
if (repeat === "forever" || Number.isInteger(repeat) && repeat >= 0) return;
|
|
49975
|
+
throw new Error(`[game] A tween of ${component} has repeat ${repeat}.\n Give repeat a whole number of extra runs, 0 or more, or "forever".`);
|
|
49976
|
+
}
|
|
49977
|
+
/**
|
|
49978
|
+
* Tells whether a step never ends by itself: a `tween` that repeats forever, a `parallel` or a
|
|
49979
|
+
* `sequence` that holds one, and a `use` of one. Only a cancel or a finish ends it.
|
|
49980
|
+
*
|
|
49981
|
+
* @param step - The step to look into.
|
|
49982
|
+
* @returns True when the step never ends by itself.
|
|
49983
|
+
* @example
|
|
49984
|
+
* ```ts
|
|
49985
|
+
* neverEnds(wait(100)); // false
|
|
49986
|
+
* neverEnds(tween(1_048_576, Transform, { y: 0 }, { ms: 2400, repeat: "forever" })); // true
|
|
49987
|
+
* ```
|
|
49988
|
+
*/
|
|
49989
|
+
function neverEnds(step) {
|
|
49990
|
+
switch (step.kind) {
|
|
49991
|
+
case "tween": return step.repeat === "forever";
|
|
49992
|
+
case "sequence":
|
|
49993
|
+
case "parallel": return step.steps.some((child) => neverEnds(child));
|
|
49994
|
+
case "use": return neverEnds(step.step);
|
|
49995
|
+
default: return false;
|
|
49996
|
+
}
|
|
49997
|
+
}
|
|
49998
|
+
/**
|
|
49999
|
+
* Checks the children of a `sequence`: a child that never ends may only be the last one, since
|
|
50000
|
+
* the children after it would never play. A `parallel` takes one anywhere.
|
|
50001
|
+
*
|
|
50002
|
+
* @param steps - The children, in order.
|
|
50003
|
+
* @throws {Error} When a child that never ends has another child after it.
|
|
50004
|
+
* @example
|
|
50005
|
+
* ```ts
|
|
50006
|
+
* checkSequence([wait(100), mark("landed")]); // returns; a forever tween before the mark throws
|
|
50007
|
+
* ```
|
|
50008
|
+
*/
|
|
50009
|
+
function checkSequence(steps) {
|
|
50010
|
+
for (let index = 0; index < steps.length - 1; index++) {
|
|
50011
|
+
const step = steps[index];
|
|
50012
|
+
if (step !== void 0 && neverEnds(step)) throw new Error(`[game] Step ${index + 1} of a sequence never ends, so the steps after it would never play.\n Put the forever step last, or run it in a parallel.`);
|
|
50013
|
+
}
|
|
50014
|
+
}
|
|
50015
|
+
//#endregion
|
|
49846
50016
|
//#region src/plugins/anim/timeline/steps.ts
|
|
49847
50017
|
/**
|
|
49848
50018
|
* Every haptic tick `haptic(kind)` takes, in one frozen list: the three impacts, the selection
|
|
@@ -49943,10 +50113,13 @@ function slotsJson(slots) {
|
|
|
49943
50113
|
}
|
|
49944
50114
|
/**
|
|
49945
50115
|
* Runs the steps one after another. The remainder past a step's end reaches the next step in the
|
|
49946
|
-
* same frame, so the tree takes exactly the sum of its durations.
|
|
50116
|
+
* same frame, so the tree takes exactly the sum of its durations. A step that never ends (a
|
|
50117
|
+
* `tween` with `repeat: "forever"`, or a `parallel`, `sequence` or `use` that holds one) may only
|
|
50118
|
+
* come last: the steps after it would never play.
|
|
49947
50119
|
*
|
|
49948
50120
|
* @param steps - The steps, in order.
|
|
49949
50121
|
* @returns The sequence step.
|
|
50122
|
+
* @throws {Error} When a step that never ends has another step after it.
|
|
49950
50123
|
* @example
|
|
49951
50124
|
* ```ts
|
|
49952
50125
|
* sequence(wait(100), mark("done"));
|
|
@@ -49954,6 +50127,7 @@ function slotsJson(slots) {
|
|
|
49954
50127
|
* ```
|
|
49955
50128
|
*/
|
|
49956
50129
|
function sequence(...steps) {
|
|
50130
|
+
checkSequence(steps);
|
|
49957
50131
|
return Object.freeze({
|
|
49958
50132
|
kind: "sequence",
|
|
49959
50133
|
steps: Object.freeze([...steps])
|
|
@@ -50026,6 +50200,28 @@ function mark(name) {
|
|
|
50026
50200
|
});
|
|
50027
50201
|
}
|
|
50028
50202
|
/**
|
|
50203
|
+
* Copies one keyframe segment into frozen plain data: its `at`, its ease when it names one and
|
|
50204
|
+
* its numeric target fields.
|
|
50205
|
+
*
|
|
50206
|
+
* @param segment - The segment the author gave.
|
|
50207
|
+
* @param segment.at - Where it ends, as a fraction of the track's `ms`.
|
|
50208
|
+
* @param segment.ease - Its curve; the step's `ease` when left out.
|
|
50209
|
+
* @param segment.to - The fields it reaches.
|
|
50210
|
+
* @returns A frozen copy.
|
|
50211
|
+
* @example
|
|
50212
|
+
* ```ts
|
|
50213
|
+
* frozenSegment({ at: 1, to: { y: 0, texture: "a" } }); // { at: 1, to: { y: 0 } }
|
|
50214
|
+
* ```
|
|
50215
|
+
*/
|
|
50216
|
+
function frozenSegment(segment) {
|
|
50217
|
+
const frozen = {
|
|
50218
|
+
at: segment.at,
|
|
50219
|
+
to: Object.freeze(numbersOf(segment.to))
|
|
50220
|
+
};
|
|
50221
|
+
if (segment.ease !== void 0) frozen.ease = segment.ease;
|
|
50222
|
+
return Object.freeze(frozen);
|
|
50223
|
+
}
|
|
50224
|
+
/**
|
|
50029
50225
|
* Moves the numeric fields of one component of one target to an exact target value. The component
|
|
50030
50226
|
* is any handle `world.ecs` takes, so the kit's `Sprite` and `NineSlice` of `defineGame` pass as
|
|
50031
50227
|
* they are.
|
|
@@ -50033,10 +50229,12 @@ function mark(name) {
|
|
|
50033
50229
|
* By default the fields are local: they are written into the target's own `Transform`. With
|
|
50034
50230
|
* `space: "root"` the `x`, `y`, `rotation` and `scale` of a `Transform` are a root pose, the space
|
|
50035
50231
|
* `at()` answers in, and are turned into the space of the target's `Parent` when the track starts.
|
|
50036
|
-
* That aims a hosted view
|
|
50037
|
-
*
|
|
50038
|
-
*
|
|
50039
|
-
*
|
|
50232
|
+
* That aims a hosted view at another element: an order's board item inside the scaled board slot
|
|
50233
|
+
* flies onto the order card with `{ x: at(card).x, y: at(card).y, scale: at(card).scale }` in the
|
|
50234
|
+
* root space, covers the card at the card's size, and its `Transform` stays slot-local. A field
|
|
50235
|
+
* the step does not name stays where it is, so under a turned parent name `x` and `y` together. A
|
|
50236
|
+
* target without a parent, and a component other than `Transform`, move as in the local space. An
|
|
50237
|
+
* additive walk names offsets, so it stays in the local space.
|
|
50040
50238
|
*
|
|
50041
50239
|
* @param target - The projection key or the entity to animate.
|
|
50042
50240
|
* @param component - The component to animate.
|
|
@@ -50049,30 +50247,34 @@ function mark(name) {
|
|
|
50049
50247
|
* @param options.space - `"root"` reads the `Transform` fields as a root pose; `"local"` when
|
|
50050
50248
|
* omitted.
|
|
50051
50249
|
* @param options.reduced - `"keep"` plays the track at its length under reduced motion, a fade
|
|
50052
|
-
* for one; `"cut"` (the default) lands it at once.
|
|
50053
|
-
* @
|
|
50054
|
-
*
|
|
50055
|
-
*
|
|
50056
|
-
*
|
|
50057
|
-
*
|
|
50058
|
-
*
|
|
50059
|
-
*
|
|
50060
|
-
*
|
|
50061
|
-
*
|
|
50062
|
-
*
|
|
50063
|
-
*
|
|
50064
|
-
*
|
|
50065
|
-
*
|
|
50066
|
-
*
|
|
50067
|
-
* }
|
|
50068
|
-
*
|
|
50250
|
+
* for one; `"cut"` (the default) lands it at once, and a `"forever"` track does not play.
|
|
50251
|
+
* @param options.segments - Keyframe segments `{ at, ease?, to }` walked one after another over
|
|
50252
|
+
* `ms` on one clock; a field a segment does not name holds, `to` is where the last one ends. An
|
|
50253
|
+
* additive walk names offsets. The same as `TweenOptions` of `ViewHandle.tween`.
|
|
50254
|
+
* @param options.repeat - How many more times the walk runs, or `"forever"`: the step never ends
|
|
50255
|
+
* by itself, so it comes last in a `sequence`.
|
|
50256
|
+
* @returns The tween step; `segments` and `repeat` are in it only when given.
|
|
50257
|
+
* @throws {Error} When the segments are empty, an `at` is outside 0..1 or out of order, the last
|
|
50258
|
+
* segment ends before 1, an additive walk names the root space, or the repeat is not a whole
|
|
50259
|
+
* number of 0 or more.
|
|
50260
|
+
* @example
|
|
50261
|
+
* ```ts
|
|
50262
|
+
* // A ready chest (entity 1048576) hops 14 up and back every 2.4 s, as offsets over its pose.
|
|
50263
|
+
* const chestBounce = defineAnimation("board.chestBounce", { slots: { chest: type<Target>() },
|
|
50264
|
+
* build: ({ chest }) => tween(chest, Transform, { y: 0, scale: 0 }, { ms: 2400, additive: true,
|
|
50265
|
+
* repeat: "forever", segments: [{ at: 0.08, ease: "out", to: { y: -14, scale: 0.06 } },
|
|
50266
|
+
* { at: 0.22, ease: "in", to: { y: 0, scale: 0 } }, { at: 1, to: { y: 0, scale: 0 } }] }) });
|
|
50267
|
+
* const bounce = res(AnimPlayer).play(chestBounce, { chest: 1_048_576 });
|
|
50268
|
+
* // 192 ms later the chest stands 14 higher, its scale 0.06 larger; it bounces until cancelled
|
|
50269
|
+
* bounce.cancel(); // it stands on its own pose again
|
|
50069
50270
|
* ```
|
|
50070
50271
|
*/
|
|
50071
50272
|
function tween(target, component, to, options) {
|
|
50072
|
-
|
|
50273
|
+
const erased = asComponent(component);
|
|
50274
|
+
const step = {
|
|
50073
50275
|
kind: "tween",
|
|
50074
50276
|
target,
|
|
50075
|
-
component:
|
|
50277
|
+
component: erased,
|
|
50076
50278
|
to: Object.freeze(numbersOf(to)),
|
|
50077
50279
|
ms: options.ms,
|
|
50078
50280
|
ease: options.ease ?? "out",
|
|
@@ -50080,7 +50282,17 @@ function tween(target, component, to, options) {
|
|
|
50080
50282
|
additive: options.additive === true,
|
|
50081
50283
|
space: options.space ?? "local",
|
|
50082
50284
|
reduced: options.reduced ?? "cut"
|
|
50083
|
-
}
|
|
50285
|
+
};
|
|
50286
|
+
if (options.segments !== void 0) {
|
|
50287
|
+
checkSegments(erased.componentName, options.segments);
|
|
50288
|
+
checkWalkSpace(erased.componentName, step.additive, step.space);
|
|
50289
|
+
step.segments = Object.freeze(options.segments.map((segment) => frozenSegment(segment)));
|
|
50290
|
+
}
|
|
50291
|
+
if (options.repeat !== void 0) {
|
|
50292
|
+
checkRepeat(erased.componentName, options.repeat);
|
|
50293
|
+
step.repeat = options.repeat;
|
|
50294
|
+
}
|
|
50295
|
+
return Object.freeze(step);
|
|
50084
50296
|
}
|
|
50085
50297
|
/**
|
|
50086
50298
|
* Writes a component patch at once. Any field may be written, not only the numeric ones. The
|
package/dist/testing.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $n as FeaturePlugin, Dr as Json, dr as Descriptor, gr as NodeFx, hr as Hint, sr as NodeTable, tr as AnyFlow, xr as FakeClock, yr as ClockSource } from "./types-D27I4Q7b.mjs";
|
|
2
|
-
import { t as createApp } from "./index-
|
|
3
|
-
import { b as saveOf, v as WithGameState, y as memory } from "./types-
|
|
2
|
+
import { t as createApp } from "./index-DMeqKGSu.mjs";
|
|
3
|
+
import { b as saveOf, v as WithGameState, y as memory } from "./types-DmU_qlvA.mjs";
|
|
4
4
|
import { a as createHeadless, i as ReproResult, n as HeadlessGame, o as runRepro, r as Repro, s as stepFrames, t as HeadlessApp } from "./headless-f31cEZ7f.mjs";
|
|
5
5
|
import { AnyPluginInstance } from "@moku-labs/core";
|
|
6
6
|
|
package/dist/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { en as refuseStart, in as type, m as flattenFeatures, t as createApp, tn as exit } from "./src-
|
|
1
|
+
import { en as refuseStart, in as type, m as flattenFeatures, t as createApp, tn as exit } from "./src-5qdNjLKN.mjs";
|
|
2
2
|
import { n as saveOf, t as memory } from "./memory-CWlqhS7l.mjs";
|
|
3
3
|
import { t as fakeClock } from "./fake-6mazmHK3.mjs";
|
|
4
4
|
import { i as stepFrames, r as runRepro, t as createHeadless } from "./headless-Bxxl_mQX.mjs";
|
|
@@ -207,10 +207,13 @@ type StepMotion = MotionHandle & {
|
|
|
207
207
|
declare const HAPTIC_KINDS: readonly ["light", "medium", "heavy", "selection", "success", "warning", "error"];
|
|
208
208
|
/**
|
|
209
209
|
* Runs the steps one after another. The remainder past a step's end reaches the next step in the
|
|
210
|
-
* same frame, so the tree takes exactly the sum of its durations.
|
|
210
|
+
* same frame, so the tree takes exactly the sum of its durations. A step that never ends (a
|
|
211
|
+
* `tween` with `repeat: "forever"`, or a `parallel`, `sequence` or `use` that holds one) may only
|
|
212
|
+
* come last: the steps after it would never play.
|
|
211
213
|
*
|
|
212
214
|
* @param steps - The steps, in order.
|
|
213
215
|
* @returns The sequence step.
|
|
216
|
+
* @throws {Error} When a step that never ends has another step after it.
|
|
214
217
|
* @example
|
|
215
218
|
* ```ts
|
|
216
219
|
* sequence(wait(100), mark("done"));
|
|
@@ -275,10 +278,12 @@ declare function mark(name: string): Step;
|
|
|
275
278
|
* By default the fields are local: they are written into the target's own `Transform`. With
|
|
276
279
|
* `space: "root"` the `x`, `y`, `rotation` and `scale` of a `Transform` are a root pose, the space
|
|
277
280
|
* `at()` answers in, and are turned into the space of the target's `Parent` when the track starts.
|
|
278
|
-
* That aims a hosted view
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
281
|
+
* That aims a hosted view at another element: an order's board item inside the scaled board slot
|
|
282
|
+
* flies onto the order card with `{ x: at(card).x, y: at(card).y, scale: at(card).scale }` in the
|
|
283
|
+
* root space, covers the card at the card's size, and its `Transform` stays slot-local. A field
|
|
284
|
+
* the step does not name stays where it is, so under a turned parent name `x` and `y` together. A
|
|
285
|
+
* target without a parent, and a component other than `Transform`, move as in the local space. An
|
|
286
|
+
* additive walk names offsets, so it stays in the local space.
|
|
282
287
|
*
|
|
283
288
|
* @param target - The projection key or the entity to animate.
|
|
284
289
|
* @param component - The component to animate.
|
|
@@ -291,23 +296,26 @@ declare function mark(name: string): Step;
|
|
|
291
296
|
* @param options.space - `"root"` reads the `Transform` fields as a root pose; `"local"` when
|
|
292
297
|
* omitted.
|
|
293
298
|
* @param options.reduced - `"keep"` plays the track at its length under reduced motion, a fade
|
|
294
|
-
* for one; `"cut"` (the default) lands it at once.
|
|
295
|
-
* @
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* }
|
|
310
|
-
*
|
|
299
|
+
* for one; `"cut"` (the default) lands it at once, and a `"forever"` track does not play.
|
|
300
|
+
* @param options.segments - Keyframe segments `{ at, ease?, to }` walked one after another over
|
|
301
|
+
* `ms` on one clock; a field a segment does not name holds, `to` is where the last one ends. An
|
|
302
|
+
* additive walk names offsets. The same as `TweenOptions` of `ViewHandle.tween`.
|
|
303
|
+
* @param options.repeat - How many more times the walk runs, or `"forever"`: the step never ends
|
|
304
|
+
* by itself, so it comes last in a `sequence`.
|
|
305
|
+
* @returns The tween step; `segments` and `repeat` are in it only when given.
|
|
306
|
+
* @throws {Error} When the segments are empty, an `at` is outside 0..1 or out of order, the last
|
|
307
|
+
* segment ends before 1, an additive walk names the root space, or the repeat is not a whole
|
|
308
|
+
* number of 0 or more.
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* // A ready chest (entity 1048576) hops 14 up and back every 2.4 s, as offsets over its pose.
|
|
312
|
+
* const chestBounce = defineAnimation("board.chestBounce", { slots: { chest: type<Target>() },
|
|
313
|
+
* build: ({ chest }) => tween(chest, Transform, { y: 0, scale: 0 }, { ms: 2400, additive: true,
|
|
314
|
+
* repeat: "forever", segments: [{ at: 0.08, ease: "out", to: { y: -14, scale: 0.06 } },
|
|
315
|
+
* { at: 0.22, ease: "in", to: { y: 0, scale: 0 } }, { at: 1, to: { y: 0, scale: 0 } }] }) });
|
|
316
|
+
* const bounce = res(AnimPlayer).play(chestBounce, { chest: 1_048_576 });
|
|
317
|
+
* // 192 ms later the chest stands 14 higher, its scale 0.06 larger; it bounces until cancelled
|
|
318
|
+
* bounce.cancel(); // it stands on its own pose again
|
|
311
319
|
* ```
|
|
312
320
|
*/
|
|
313
321
|
declare function tween<Value extends object>(target: Target, component: ComponentHandle<Value>, to: Partial<NumericFields<Value>>, options: {
|
|
@@ -317,6 +325,12 @@ declare function tween<Value extends object>(target: Target, component: Componen
|
|
|
317
325
|
additive?: boolean;
|
|
318
326
|
space?: "local" | "root";
|
|
319
327
|
reduced?: ReducedMotion;
|
|
328
|
+
segments?: readonly {
|
|
329
|
+
at: number;
|
|
330
|
+
ease?: Ease;
|
|
331
|
+
to: Partial<NumericFields<Value>>;
|
|
332
|
+
}[];
|
|
333
|
+
repeat?: number | "forever";
|
|
320
334
|
}): Step;
|
|
321
335
|
/**
|
|
322
336
|
* Writes a component patch at once. Any field may be written, not only the numeric ones. The
|
|
@@ -658,6 +672,16 @@ type Step = {
|
|
|
658
672
|
readonly additive: boolean; /** `"root"`: the `Transform` fields are a root pose, turned local when the track starts. */
|
|
659
673
|
readonly space: "local" | "root"; /** `"keep"`: reduced motion plays the track as written; `"cut"` lands it at once. */
|
|
660
674
|
readonly reduced: ReducedMotion;
|
|
675
|
+
/**
|
|
676
|
+
* The keyframe segments the track walks over `ms`, frozen; only on a step built with them.
|
|
677
|
+
* In the root space each segment's target is turned local when the track starts, like `to`.
|
|
678
|
+
*/
|
|
679
|
+
readonly segments?: readonly TrackSegment[];
|
|
680
|
+
/**
|
|
681
|
+
* The runs after the first one, or `"forever"` for a step that never ends by itself; only on
|
|
682
|
+
* a step built with it.
|
|
683
|
+
*/
|
|
684
|
+
readonly repeat?: number | "forever";
|
|
661
685
|
} | {
|
|
662
686
|
readonly kind: "set";
|
|
663
687
|
readonly target: Target;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { $ as PixiModule, $n as FeaturePlugin, Dr as Json, Lr as SnapshotOf, Mr as PlayerStateProvider, Nr as ProviderCall, Pr as SaveDoc, Tr as Config, X as Config$2, a as Config$3, d as Manifest, lt as Orientation, n as AssetsIo, tr as AnyFlow, ur as TypeTag, xr as FakeClock, yr as ClockSource, zn as Config$1 } from "./types-D27I4Q7b.mjs";
|
|
2
|
-
import { o as AudioContextLike, s as Config$4 } from "./types-
|
|
2
|
+
import { o as AudioContextLike, s as Config$4 } from "./types-DHamyZq1.mjs";
|
|
3
3
|
import { R as I18nApi, U as StringTable, W as TextKey } from "./types-BAp9HdR4.mjs";
|
|
4
|
-
import { St as effectsPlugin, Tt as audioPlugin, ht as PlatformProvider, i as screen, pt as platformPlugin, t as createApp } from "./index-
|
|
4
|
+
import { St as effectsPlugin, Tt as audioPlugin, ht as PlatformProvider, i as screen, pt as platformPlugin, t as createApp } from "./index-DMeqKGSu.mjs";
|
|
5
5
|
import { AnyPluginInstance } from "@moku-labs/core";
|
|
6
6
|
|
|
7
7
|
//#region src/plugins/model/store/providers/memory.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Vr as Api$3, Y as Api, nn as Api$1, wr as Api$2 } from "./types-D27I4Q7b.mjs";
|
|
2
|
-
import { P as AnimApi, r as UiApi } from "./types-
|
|
2
|
+
import { P as AnimApi, r as UiApi } from "./types-DHamyZq1.mjs";
|
|
3
3
|
import { N as InputApi } from "./types-BAp9HdR4.mjs";
|
|
4
4
|
import { r as Repro } from "./headless-f31cEZ7f.mjs";
|
|
5
5
|
import { a as InputOf, r as ControlApp } from "./types-CgE5L_7f.mjs";
|
|
6
|
-
import { t as commands } from "./commands-
|
|
6
|
+
import { t as commands } from "./commands-C8N_rpwt.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-HGn_TF2x.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
|
-
import { n as read, t as sources } from "./sources-
|
|
2
|
-
import { n as commands, t as run } from "./run-
|
|
1
|
+
import { n as read, t as sources } from "./sources-DM5Zcl4o.mjs";
|
|
2
|
+
import { n as commands, t as run } from "./run-BnriyKUu.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createBrandConsole } from "@moku-labs/common/cli";
|
|
5
5
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|