@moku-labs/game 0.13.1 → 0.13.3
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/system.d.mts +3 -3
- package/dist/app.d.mts +2 -2
- package/dist/app.mjs +1 -1
- package/dist/assets.d.mts +1 -1
- package/dist/assets.mjs +1 -1
- package/dist/{capture-fpd83Mi5.mjs → capture-D7XvoHdH.mjs} +78 -1
- package/dist/cli.d.mts +7 -5
- package/dist/cli.mjs +74 -36
- package/dist/{commands-DvFr8Uwp.d.mts → commands-DRhJ_LIH.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/control.mjs +1 -1
- package/dist/{define-CCc0ozKe.d.mts → define-Ckp70_GR.d.mts} +2 -2
- package/dist/{headless-BsNdJs9W.mjs → headless-BA6ffzqD.mjs} +30 -9
- package/dist/{headless-G4nuZ-xz.d.mts → headless-CYgYzro0.d.mts} +1 -1
- package/dist/hot.d.mts +3 -3
- package/dist/hot.mjs +11 -9
- package/dist/{index-rnOYAriI.d.mts → index-CjuObHhF.d.mts} +12 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/inspect.d.mts +7 -7
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{memory-DwDhfFWK.d.mts → memory-DKo9rRWW.d.mts} +1 -1
- package/dist/project.mjs +1 -1
- package/dist/{run-wYty_Lwo.mjs → run-BtyrJjmW.mjs} +130 -40
- package/dist/{runtime-B276Gg0s.d.mts → runtime-iTxTcukZ.d.mts} +1 -1
- package/dist/{src-SmT-XxVf.mjs → src-DlyYl_9X.mjs} +1414 -277
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +2 -2
- package/dist/{types-ZQLYXo5X.d.mts → types-BSMmnpFm.d.mts} +138 -29
- package/dist/{types-Bcdo5-2w.d.mts → types-B_Bp2tWK.d.mts} +7 -3
- package/dist/{types-DAdwEJMp.d.mts → types-Bonifz5M.d.mts} +2 -2
- package/dist/{types-DLghaGEy.d.mts → types-DkO3s9YX.d.mts} +4 -4
- package/dist/{types-BrTpz9oL.d.mts → types-Dm5Oh5bH.d.mts} +19 -6
- package/dist/{types-D_2G6Q68.d.mts → types-dJMOXXL3.d.mts} +21 -13
- package/dist/visual.d.mts +6 -6
- package/dist/visual.mjs +1 -1
- package/llms.txt +10 -7
- package/package.json +4 -2
- package/dist/{assets-DYiKxPBX.mjs → assets-BrKSg1O6.mjs} +1 -1
- package/dist/{watch-CB8IWDBi.mjs → watch-CWI_on4T.mjs} +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as sfx, A as types_exports$3, At as Noise, B as defineStyle, Bt as rendererPlugin, C as types_exports$10, Ct as effectsPlugin, D as types_exports$6, Dt as ColorMatrix, E as types_exports$7, Et as Blur, F as resolve, Ft as assetsPlugin, G as external, Gt as to, H as platformPlugin, Ht as flowPlugin, I as Box, It as animPlugin, J as mark, Jt as SaveUnreadableError, K as frames, Kt as type, L as LocalWrite, Lt as AnimPlayer, M as types_exports$1, Mt as defineFilter, N as types_exports, Nt as audioPlugin, O as types_exports$5, Ot as Displacement, P as uiPlugin, Pt as scenesPlugin, Q as set, R as popup, Rt as Animation, S as types_exports$11, St as messageDuration, T as types_exports$8, Tt as Alpha, U as HAPTIC_KINDS, Ut as exit, V as textPlugin, Vt as worldPlugin, W as defineAnimation, Wt as slot, X as play, Xt as timePlugin, Y as parallel, Yt as lifecyclePlugin, Z as sequence, Zt as clockPlugin, _ as types_exports$16, _t as Touchable, a as defineMotion, at as wait, b as types_exports$13, bt as i18nPlugin, c as schedule, ct as DropTarget, d as tr, dt as Pointer, et as spawn, f as defineFeature, ft as PointerOver, g as load, gt as Tappable, h as defineBundles, ht as Swipeable, i as screen, it as use, j as types_exports$2, jt as Outline, k as types_exports$4, kt as Glow, l as projection, lt as Held, m as music, mt as Pressed, n as createPlugin, nt as stagger, o as guide, ot as inputPlugin, p as defineEmitter, pt as Pressable, q as haptic, qt as modelPlugin, r as defineGame, rt as tween, s as hint, st as Draggable, t as createApp, tt as spawned, u as defineScene, ut as Hovered, v as types_exports$15, vt as Traceable, w as types_exports$9, wt as Emitter, x as types_exports$12, xt as messageArgument, y as types_exports$14, yt as Traced, z as defineTokens, zt as Frames } from "./src-
|
|
1
|
+
import { $ as sfx, A as types_exports$3, At as Noise, B as defineStyle, Bt as rendererPlugin, C as types_exports$10, Ct as effectsPlugin, D as types_exports$6, Dt as ColorMatrix, E as types_exports$7, Et as Blur, F as resolve, Ft as assetsPlugin, G as external, Gt as to, H as platformPlugin, Ht as flowPlugin, I as Box, It as animPlugin, J as mark, Jt as SaveUnreadableError, K as frames, Kt as type, L as LocalWrite, Lt as AnimPlayer, M as types_exports$1, Mt as defineFilter, N as types_exports, Nt as audioPlugin, O as types_exports$5, Ot as Displacement, P as uiPlugin, Pt as scenesPlugin, Q as set, R as popup, Rt as Animation, S as types_exports$11, St as messageDuration, T as types_exports$8, Tt as Alpha, U as HAPTIC_KINDS, Ut as exit, V as textPlugin, Vt as worldPlugin, W as defineAnimation, Wt as slot, X as play, Xt as timePlugin, Y as parallel, Yt as lifecyclePlugin, Z as sequence, Zt as clockPlugin, _ as types_exports$16, _t as Touchable, a as defineMotion, at as wait, b as types_exports$13, bt as i18nPlugin, c as schedule, ct as DropTarget, d as tr, dt as Pointer, et as spawn, f as defineFeature, ft as PointerOver, g as load, gt as Tappable, h as defineBundles, ht as Swipeable, i as screen, it as use, j as types_exports$2, jt as Outline, k as types_exports$4, kt as Glow, l as projection, lt as Held, m as music, mt as Pressed, n as createPlugin, nt as stagger, o as guide, ot as inputPlugin, p as defineEmitter, pt as Pressable, q as haptic, qt as modelPlugin, r as defineGame, rt as tween, s as hint, st as Draggable, t as createApp, tt as spawned, u as defineScene, ut as Hovered, v as types_exports$15, vt as Traceable, w as types_exports$9, wt as Emitter, x as types_exports$12, xt as messageArgument, y as types_exports$14, yt as Traced, z as defineTokens, zt as Frames } from "./src-DlyYl_9X.mjs";
|
|
2
2
|
import { A as system, C as Exiting, D as component, E as Tree, O as mut, S as sprite, T as Order, _ as Parent, b as Transform, c as Text, d as defineTextStyles, f as label, g as NineSlice, h as Display, j as tag, k as resource, l as bind, s as Countdown, v as Shape, w as Layer, y as Sprite } from "./visual-dMW8iqAE.mjs";
|
|
3
3
|
import { r as defineComponent } from "./flatten-BkXuscAV.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, Displacement, Display, Draggable, DropTarget, types_exports$4 as Effects, Emitter, Exiting, types_exports$5 as Flow, Frames, Glow, HAPTIC_KINDS, Held, Hovered, types_exports$6 as I18n, types_exports$7 as Input, Layer, types_exports$8 as Lifecycle, LocalWrite, types_exports$9 as Model, NineSlice, Noise, Order, Outline, Parent, types_exports$10 as Platform, Pointer, PointerOver, Pressable, Pressed, types_exports$11 as Renderer, SaveUnreadableError, types_exports$12 as Scenes, Shape, Sprite, Swipeable, Tappable, Text, types_exports$13 as TextTypes, types_exports$14 as Time, Touchable, Traceable, Traced, Transform, Tree, types_exports$15 as Ui, types_exports$16 as World, animPlugin, assetsPlugin, audioPlugin, bind, clockPlugin, component, createApp, createPlugin, defineAnimation, defineBundles, defineComponent, defineEmitter, defineFeature, defineFilter, defineGame, defineMotion, defineScene, defineStyle, defineTextStyles, defineTokens, effectsPlugin, exit, external, flowPlugin, frames, guide, haptic, hint, i18nPlugin, inputPlugin, label, lifecyclePlugin, load, mark, messageArgument, messageDuration, modelPlugin, music, mut, parallel, platformPlugin, play, popup, projection, rendererPlugin, resolve, resource, scenesPlugin, schedule, screen, sequence, set, sfx, slot, spawn, spawned, sprite, stagger, system, tag, textPlugin, timePlugin, to, tr, tween, type, uiPlugin, use, wait, worldPlugin };
|
package/dist/inspect.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { A as Api$1, At as FlowGraph, M as Explained, Mt as JournalEntry, S as Under, T as RenderStats, U as EntitySnapshot, W as FrameDiff, _t as Position, an as Snapshot, h as Api$2, p as Usage, qt as Api, t as Api$3, z as ComponentSchema } from "./types-
|
|
2
|
-
import { a as AudioApi, r as UiApi, u as SoundEntry } from "./types-
|
|
3
|
-
import { n as EffectsApi, r as EffectsStats } from "./types-
|
|
4
|
-
import { c as UiNode } from "./types-
|
|
5
|
-
import { t as HeadlessApp } from "./headless-
|
|
6
|
-
import { a as InputOf, c as Source, i as InputArguments, l as WatchApp, o as InputSchema, t as CheatEntry, u as WatchInput } from "./types-
|
|
7
|
-
import { n as defineSource } from "./define-
|
|
1
|
+
import { A as Api$1, At as FlowGraph, M as Explained, Mt as JournalEntry, S as Under, T as RenderStats, U as EntitySnapshot, W as FrameDiff, _t as Position, an as Snapshot, h as Api$2, p as Usage, qt as Api, t as Api$3, z as ComponentSchema } from "./types-BSMmnpFm.mjs";
|
|
2
|
+
import { a as AudioApi, r as UiApi, u as SoundEntry } from "./types-dJMOXXL3.mjs";
|
|
3
|
+
import { n as EffectsApi, r as EffectsStats } from "./types-B_Bp2tWK.mjs";
|
|
4
|
+
import { c as UiNode } from "./types-Dm5Oh5bH.mjs";
|
|
5
|
+
import { t as HeadlessApp } from "./headless-CYgYzro0.mjs";
|
|
6
|
+
import { a as InputOf, c as Source, i as InputArguments, l as WatchApp, o as InputSchema, t as CheatEntry, u as WatchInput } from "./types-Bonifz5M.mjs";
|
|
7
|
+
import { n as defineSource } from "./define-Ckp70_GR.mjs";
|
|
8
8
|
|
|
9
9
|
//#region src/plugins/flow/doors/read.d.ts
|
|
10
10
|
/**
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as jsxs, i as jsxDEV, n as JSX, r as jsx, t as Fragment } from "./runtime-
|
|
1
|
+
import { a as jsxs, i as jsxDEV, n as JSX, r as jsx, t as Fragment } from "./runtime-iTxTcukZ.mjs";
|
|
2
2
|
export { Fragment, type JSX, jsx, jsxDEV, jsxs };
|
package/dist/jsx-runtime.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as jsxs, n as JSX, r as jsx, t as Fragment } from "./runtime-
|
|
1
|
+
import { a as jsxs, n as JSX, r as jsx, t as Fragment } from "./runtime-iTxTcukZ.mjs";
|
|
2
2
|
export { Fragment, type JSX, jsx, jsxs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Xt as Json, nn as ProviderCall, rn as SaveDoc, tn as PlayerStateProvider } from "./types-
|
|
1
|
+
import { Xt as Json, nn as ProviderCall, rn as SaveDoc, tn as PlayerStateProvider } from "./types-BSMmnpFm.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/model/store/providers/memory.d.ts
|
|
4
4
|
/**
|
package/dist/project.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as readInside, _ as declaredFunctions, a as reindexPath, b as unwrap, c as definerOfCall, d as sha1, f as definersOf, g as holeOf, h as hasHole, i as openSession, l as JSX, m as HOLE, n as createHub, o as serialize, p as collectJsx, s as parseCached, u as jsxShapes, v as propertyNameOf, y as propertyOfValue } from "./watch-
|
|
1
|
+
import { S as readInside, _ as declaredFunctions, a as reindexPath, b as unwrap, c as definerOfCall, d as sha1, f as definersOf, g as holeOf, h as hasHole, i as openSession, l as JSX, m as HOLE, n as createHub, o as serialize, p as collectJsx, s as parseCached, u as jsxShapes, v as propertyNameOf, y as propertyOfValue } from "./watch-CWI_on4T.mjs";
|
|
2
2
|
import { createBrandConsole } from "@moku-labs/common/cli";
|
|
3
3
|
//#region src/project/locate.ts
|
|
4
4
|
/** The kind of a style key. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as sheetAlone } from "./capture-
|
|
1
|
+
import { a as sheetAlone } from "./capture-D7XvoHdH.mjs";
|
|
2
2
|
import { n as isDev, r as notInstalled, t as controlRefused } from "./dev-Cc50Dk7H.mjs";
|
|
3
|
-
import { n as reproBookmark } from "./headless-
|
|
3
|
+
import { n as reproBookmark } from "./headless-BA6ffzqD.mjs";
|
|
4
4
|
import { a as readTarget, i as isProjectionTarget, n as isTainted, o as inputOrEmpty, r as recordCheat, s as defineCommand } from "./session-DgukhR_7.mjs";
|
|
5
5
|
//#region src/plugins/anim/control.ts
|
|
6
6
|
/**
|
|
@@ -342,8 +342,61 @@ function invalidBookmark() {
|
|
|
342
342
|
return /* @__PURE__ */ new Error("[game] The bookmark is not a flow.bookmark() value.\n Pass the JSON that game.bookmark returned.");
|
|
343
343
|
}
|
|
344
344
|
/**
|
|
345
|
+
* Tells whether a JSON value has the shape of a rest point: an object with a path and an input.
|
|
346
|
+
*
|
|
347
|
+
* @param value - The `rest` field of a bookmark.
|
|
348
|
+
* @returns True when `path` is a string and `input` is there.
|
|
349
|
+
* @example
|
|
350
|
+
* ```ts
|
|
351
|
+
* isRestPoint({ path: "home", input: null }); // true
|
|
352
|
+
* isRestPoint({ path: "home" }); // false: a rest point has an input, `null` when it is empty
|
|
353
|
+
* ```
|
|
354
|
+
*/
|
|
355
|
+
function isRestPoint(value) {
|
|
356
|
+
return isRecord(value) && typeof value.path === "string" && value.input !== void 0;
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Reads the rest point of a bookmark taken at a transit node.
|
|
360
|
+
*
|
|
361
|
+
* @param value - The `rest` field of a bookmark.
|
|
362
|
+
* @returns The rest point, or `undefined` when the value is not one.
|
|
363
|
+
* @example
|
|
364
|
+
* ```ts
|
|
365
|
+
* readRest({ path: "home", input: null }); // { path: "home", input: null }
|
|
366
|
+
* readRest("home"); // undefined
|
|
367
|
+
* ```
|
|
368
|
+
*/
|
|
369
|
+
function readRest(value) {
|
|
370
|
+
if (!isRestPoint(value)) return void 0;
|
|
371
|
+
return {
|
|
372
|
+
path: value.path,
|
|
373
|
+
input: value.input
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Reads the optional fields of a bookmark onto it: the `scene` the `game.bookmark` door added and
|
|
378
|
+
* the `rest` point of a bookmark taken at a transit node. An absent field leaves no key.
|
|
379
|
+
*
|
|
380
|
+
* @param value - The JSON object of the bookmark.
|
|
381
|
+
* @param bookmark - The bookmark with its required fields.
|
|
382
|
+
* @returns The bookmark with its scene and its rest point.
|
|
383
|
+
* @throws {Error} When the scene or the rest point has the wrong shape.
|
|
384
|
+
*/
|
|
385
|
+
function readBookmarkOptions(value, bookmark) {
|
|
386
|
+
const { scene, rest } = value;
|
|
387
|
+
if (scene !== void 0 && typeof scene !== "string") throw invalidBookmark();
|
|
388
|
+
if (scene !== void 0) bookmark.scene = scene;
|
|
389
|
+
if (rest !== void 0) {
|
|
390
|
+
const point = readRest(rest);
|
|
391
|
+
if (point === void 0) throw invalidBookmark();
|
|
392
|
+
bookmark.rest = point;
|
|
393
|
+
}
|
|
394
|
+
return bookmark;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
345
397
|
* Reads a bookmark out of JSON, the value `flow.bookmark()` made and the editor kept. The
|
|
346
|
-
* `scene` the `game.bookmark` door added
|
|
398
|
+
* `scene` the `game.bookmark` door added and the `rest` point of a bookmark taken at a transit
|
|
399
|
+
* node are kept when present.
|
|
347
400
|
*
|
|
348
401
|
* @param value - The JSON the editor sent.
|
|
349
402
|
* @returns The bookmark.
|
|
@@ -358,25 +411,14 @@ function readBookmark(value) {
|
|
|
358
411
|
const { path, input, player, session, graph } = value;
|
|
359
412
|
const rng = readRng(value.rng);
|
|
360
413
|
if (!(typeof path === "string" && typeof graph === "string") || !(input !== void 0 && player !== void 0 && session !== void 0) || rng === void 0) throw invalidBookmark();
|
|
361
|
-
|
|
362
|
-
if (scene === void 0) return {
|
|
414
|
+
return readBookmarkOptions(value, {
|
|
363
415
|
path,
|
|
364
416
|
input,
|
|
365
417
|
player,
|
|
366
418
|
session,
|
|
367
419
|
rng,
|
|
368
420
|
graph
|
|
369
|
-
};
|
|
370
|
-
if (typeof scene !== "string") throw invalidBookmark();
|
|
371
|
-
return {
|
|
372
|
-
path,
|
|
373
|
-
input,
|
|
374
|
-
player,
|
|
375
|
-
session,
|
|
376
|
-
rng,
|
|
377
|
-
graph,
|
|
378
|
-
scene
|
|
379
|
-
};
|
|
421
|
+
});
|
|
380
422
|
}
|
|
381
423
|
/**
|
|
382
424
|
* Builds the error of a value that is not a repro.
|
|
@@ -577,29 +619,66 @@ function nextFrame(app) {
|
|
|
577
619
|
});
|
|
578
620
|
}
|
|
579
621
|
/**
|
|
580
|
-
*
|
|
622
|
+
* Starts the restore of a bookmark and does not wait for it. Both ways it can end are marked on
|
|
623
|
+
* the entry, so a restore that rejects while a frame is waited on is never left unhandled.
|
|
581
624
|
*
|
|
582
625
|
* @param app - The app.
|
|
583
|
-
* @
|
|
626
|
+
* @param bookmark - The bookmark to enter.
|
|
627
|
+
* @returns The restore in flight.
|
|
584
628
|
*/
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}
|
|
590
|
-
|
|
629
|
+
function startRestore(app, bookmark) {
|
|
630
|
+
const entry = {
|
|
631
|
+
restore: app.flow.restore(bookmark),
|
|
632
|
+
state: "pending"
|
|
633
|
+
};
|
|
634
|
+
entry.restore.then(() => {
|
|
635
|
+
entry.state = "entered";
|
|
636
|
+
}, () => {
|
|
637
|
+
entry.state = "failed";
|
|
638
|
+
});
|
|
639
|
+
return entry;
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* Tells whether a restore still has frames to wait for: it has not settled, or it resolved and
|
|
643
|
+
* the graph does not rest at a gate yet. A gate counts only after the restore resolved: until
|
|
644
|
+
* then it can be the gate of the node the restore leaves. A failed restore waits for nothing.
|
|
645
|
+
*
|
|
646
|
+
* @param app - The app.
|
|
647
|
+
* @param entry - The restore in flight.
|
|
648
|
+
* @returns True while another frame is needed.
|
|
649
|
+
*/
|
|
650
|
+
function waiting(app, entry) {
|
|
651
|
+
if (entry.state === "pending") return true;
|
|
652
|
+
return entry.state === "entered" && !atRest(app.flow.state());
|
|
653
|
+
}
|
|
654
|
+
/**
|
|
655
|
+
* Waits on drawn frames until a restore resolved and the graph rests at a gate, or the restore
|
|
656
|
+
* failed: at most 600.
|
|
657
|
+
*
|
|
658
|
+
* @param app - The app.
|
|
659
|
+
* @param entry - The restore in flight.
|
|
660
|
+
* @returns False when frames are still needed after 600 drawn ones.
|
|
661
|
+
*/
|
|
662
|
+
async function waitForRest(app, entry) {
|
|
663
|
+
for (let frame = 0; frame < REST_FRAMES && waiting(app, entry); frame += 1) await nextFrame(app);
|
|
664
|
+
return !waiting(app, entry);
|
|
591
665
|
}
|
|
592
666
|
/**
|
|
593
667
|
* Restores a bookmark and waits until the graph rests at a gate, then two drawn frames more, so
|
|
594
|
-
* the screen of the gate is built and drawn.
|
|
668
|
+
* the screen of the gate is built and drawn. The frames run while the restore is in flight: a
|
|
669
|
+
* bookmark of a transit node resolves only at its gate, and on a paused clock no frame but the
|
|
670
|
+
* ones stepped here brings its node there.
|
|
595
671
|
*
|
|
596
672
|
* @param app - The app.
|
|
597
673
|
* @param bookmark - The bookmark to enter.
|
|
598
|
-
* @throws {Error} When the graph does not rest within 600 drawn frames
|
|
674
|
+
* @throws {Error} When the graph does not rest within 600 drawn frames, and whatever the restore
|
|
675
|
+
* rejects with.
|
|
599
676
|
*/
|
|
600
677
|
async function restoreAtRest(app, bookmark) {
|
|
601
|
-
|
|
602
|
-
|
|
678
|
+
const entry = startRestore(app, bookmark);
|
|
679
|
+
const rested = await waitForRest(app, entry);
|
|
680
|
+
if (entry.state !== "pending") await entry.restore;
|
|
681
|
+
if (!rested) throw new Error("[game] game.capture diff: the bookmark did not come to rest in 600 frames.\n Capture a bookmark taken at a gate.");
|
|
603
682
|
for (let frame = 0; frame < AFTER_REST_FRAMES; frame += 1) await nextFrame(app);
|
|
604
683
|
}
|
|
605
684
|
/**
|
|
@@ -881,7 +960,8 @@ const fillCommand = defineCommand({
|
|
|
881
960
|
//#region src/plugins/flow/control.ts
|
|
882
961
|
/**
|
|
883
962
|
* Enters a bookmark, or a repro's bookmark followed by its route. A bookmark's `scene` is handed
|
|
884
|
-
* to `scenes.expect` first, so a
|
|
963
|
+
* to `scenes.expect` first, so a node without a scene of its own mounts it: a rest node, or the
|
|
964
|
+
* transit node of a bookmark taken while an effect that takes answers waited.
|
|
885
965
|
*
|
|
886
966
|
* @param app - The app; with `scenes`, the bookmark's scene is expected before the restore.
|
|
887
967
|
* @param input - Exactly one of a bookmark and a repro, as JSON.
|
|
@@ -892,13 +972,15 @@ const fillCommand = defineCommand({
|
|
|
892
972
|
*/
|
|
893
973
|
async function restoreFrom(app, input) {
|
|
894
974
|
const { bookmark, repro } = input;
|
|
895
|
-
|
|
975
|
+
const bookmarkOnly = bookmark !== void 0 && repro === void 0;
|
|
976
|
+
const reproOnly = repro !== void 0 && bookmark === void 0;
|
|
977
|
+
if (bookmarkOnly) {
|
|
896
978
|
const read = readBookmark(bookmark);
|
|
897
979
|
if (read.scene !== void 0) app.scenes?.expect(read.scene);
|
|
898
980
|
await app.flow.restore(read);
|
|
899
981
|
return app.flow.state();
|
|
900
982
|
}
|
|
901
|
-
if (
|
|
983
|
+
if (reproOnly) {
|
|
902
984
|
const parsed = readRepro(repro);
|
|
903
985
|
await app.flow.restore(reproBookmark(app, parsed));
|
|
904
986
|
return app.flow.walk(parsed.route);
|
|
@@ -959,15 +1041,19 @@ const walkCommand = defineCommand({
|
|
|
959
1041
|
}
|
|
960
1042
|
});
|
|
961
1043
|
/**
|
|
962
|
-
* Takes a bookmark of the
|
|
963
|
-
*
|
|
1044
|
+
* Takes a bookmark of where the graph stands: the node plus the committed state, plain JSON. The
|
|
1045
|
+
* node is the last rest node, or, while a transit node waits for an effect that takes answers (a
|
|
1046
|
+
* `popup`, or a hand-written descriptor with `answers`), that node; `rest` then names the rest
|
|
1047
|
+
* point before it. An app with the screen plugins adds the mounted `scene`, so a restore in a
|
|
1048
|
+
* fresh page builds it again.
|
|
964
1049
|
*
|
|
965
1050
|
* @example
|
|
966
1051
|
* ```ts
|
|
967
|
-
* // The editor keeps the position while the
|
|
1052
|
+
* // The editor keeps the position while the info popup of the mini game is open over Home.
|
|
968
1053
|
* const { value } = await run(app, commands.bookmark);
|
|
969
|
-
* value.path; // "
|
|
1054
|
+
* value.path; // "info/show": the node that waits for the popup's answer
|
|
970
1055
|
* value.scene; // "home"
|
|
1056
|
+
* value.rest; // { path: "home", input: null }
|
|
971
1057
|
* ```
|
|
972
1058
|
*/
|
|
973
1059
|
const bookmarkCommand = defineCommand({
|
|
@@ -990,6 +1076,10 @@ const bookmarkCommand = defineCommand({
|
|
|
990
1076
|
* Restores a bookmark, or a repro: its state at its checkpoint, then its route. Replaces the
|
|
991
1077
|
* state outside the graph, so the session is tainted and the command journaled. A bookmark's
|
|
992
1078
|
* `scene` goes to `scenes.expect` first: a bookmark at a popup comes back with the scene under it.
|
|
1079
|
+
* A bookmark taken while a transit node waited for an effect that takes answers (a `popup`, or a
|
|
1080
|
+
* hand-written descriptor with `answers`) runs that node again, and the command answers once its
|
|
1081
|
+
* gate is open: the state it returns already lists the answers. The popup is drawn on the next
|
|
1082
|
+
* frame. A repro starts at a rest node only.
|
|
993
1083
|
*
|
|
994
1084
|
* @example
|
|
995
1085
|
* ```ts
|
|
@@ -998,11 +1088,11 @@ const bookmarkCommand = defineCommand({
|
|
|
998
1088
|
* const ran = await run(app, commands.restore, { repro });
|
|
999
1089
|
* ran.state; // { path: "board/awaitIntent", frame: 12, tainted: true }
|
|
1000
1090
|
*
|
|
1001
|
-
* // A fresh page restores the bookmark game.bookmark took at the
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
1004
|
-
*
|
|
1005
|
-
* app.scenes.current(); // "home"
|
|
1091
|
+
* // A fresh page restores the bookmark game.bookmark took at the info popup of the mini game.
|
|
1092
|
+
* const { value } = await run(app, commands.restore, { bookmark });
|
|
1093
|
+
* value.path; // "info/show"
|
|
1094
|
+
* value.pending.gate; // ["ok", "close"]: the popup waits for its answer again
|
|
1095
|
+
* app.scenes.current(); // "home": the scene the bookmark named, under the popup
|
|
1006
1096
|
* ```
|
|
1007
1097
|
*/
|
|
1008
1098
|
const restoreCommand = defineCommand({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as JsxChild, m as UiIntrinsicElements, t as DescriptionNode } from "./types-
|
|
1
|
+
import { a as JsxChild, m as UiIntrinsicElements, t as DescriptionNode } from "./types-Dm5Oh5bH.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/plugins/ui/jsx/runtime.d.ts
|
|
4
4
|
/** What the compiler passes as props: the children plus whatever the tag declared. */
|