@moku-labs/game 0.15.40 → 0.15.41
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/README.md +1 -1
- package/dist/app/page.d.mts +1 -1
- package/dist/app/system.d.mts +3 -3
- package/dist/app.d.mts +3 -3
- package/dist/app.mjs +1 -1
- package/dist/assets.d.mts +1 -1
- package/dist/{capture-PTJXDpxK.mjs → capture-BtS6_oWr.mjs} +61 -1
- package/dist/{commands-CvwzXCxM.d.mts → commands-DLk06fiL.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/control.mjs +1 -1
- package/dist/{define-DRRs7A6i.d.mts → define-CgU4dz0e.d.mts} +2 -2
- package/dist/{headless-CEwDAhgH.d.mts → headless-1e3gEF1Y.d.mts} +1 -1
- package/dist/{headless-Bxxl_mQX.mjs → headless-CCiUwvlp.mjs} +1 -1
- package/dist/{index-BQGifHXV.d.mts → index-D12s9KZ2.d.mts} +3 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +2 -2
- package/dist/inspect.d.mts +6 -6
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{run-G4m1APMv.mjs → run-8s7kh2QD.mjs} +2 -2
- package/dist/{runtime-7RDFd4Ti.d.mts → runtime-Bpg0WmM8.d.mts} +1 -1
- package/dist/{src-Cz-QeLTp.mjs → src-CWVwT9UM.mjs} +286 -37
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +2 -2
- package/dist/{types-CP22WjU9.d.mts → types-B-o8Ul1v.d.mts} +2 -2
- package/dist/{types-Dnh8LZxo.d.mts → types-CFEtGENK.d.mts} +1 -1
- package/dist/{types-B4DmdMle.d.mts → types-DQ9VHXun.d.mts} +4 -4
- package/dist/{types-DY_DRbGY.d.mts → types-DrkR03nL.d.mts} +121 -25
- package/dist/{types-CoTkzbEB.d.mts → types-gQATSj41.d.mts} +2 -2
- package/dist/{visual-BcS4CTps.d.mts → visual-pHKIFBSQ.d.mts} +6 -6
- package/dist/visual.d.mts +1 -1
- package/dist/visual.mjs +1 -1
- package/llms.txt +13 -4
- package/package.json +1 -1
|
@@ -2618,21 +2618,25 @@ type NodeSpec<Game extends GameState, Input, Tags extends OutcomeTags> = {
|
|
|
2618
2618
|
*/
|
|
2619
2619
|
type DefineNode<Game extends GameState> = <Input = void, const Tags extends OutcomeTags = OutcomeTags>(spec: NodeSpec<Game, Input, Tags>) => NodeDefinition<Input, Tags, Game>;
|
|
2620
2620
|
/**
|
|
2621
|
-
* An extension point inside a flow: a node whose body is "run the contributions in order".
|
|
2622
|
-
*
|
|
2621
|
+
* An extension point inside a flow: a node whose body is "run the contributions in order". Its
|
|
2622
|
+
* outcomes are `done` and the named outcomes `slot()` declares, so the flow that holds it routes
|
|
2623
|
+
* each of them with an ordinary edge. Without type arguments it is a slot that declares none.
|
|
2623
2624
|
*
|
|
2624
2625
|
* @example
|
|
2625
2626
|
* ```ts
|
|
2626
|
-
*
|
|
2627
|
+
* // A feature may send the player from the slot to the shop, on the tab it names.
|
|
2628
|
+
* const afterOrder: SlotNode<{ shop: TypeTag<{ tab: string }> }, "afterOrder"> = slot("afterOrder", {
|
|
2629
|
+
* shop: type<{ tab: string }>()
|
|
2630
|
+
* });
|
|
2627
2631
|
* // { kind: "slot", name: "afterOrder", input: { kind: "type" },
|
|
2628
|
-
* // outcomes: { done: { kind: "type" } } }
|
|
2632
|
+
* // outcomes: { done: { kind: "type" }, shop: { kind: "type" } } }
|
|
2629
2633
|
* ```
|
|
2630
2634
|
*/
|
|
2631
|
-
type SlotNode = Wired<void, {
|
|
2635
|
+
type SlotNode<Tags extends OutcomeTags = Record<never, never>, Name extends string = string> = Wired<void, {
|
|
2632
2636
|
readonly done: TypeTag<void>;
|
|
2633
|
-
}> & {
|
|
2637
|
+
} & Tags> & {
|
|
2634
2638
|
readonly kind: "slot";
|
|
2635
|
-
readonly name:
|
|
2639
|
+
readonly name: Name;
|
|
2636
2640
|
};
|
|
2637
2641
|
/**
|
|
2638
2642
|
* Edge target that leaves the sub-flow with this outcome. The payload passes through.
|
|
@@ -2774,6 +2778,32 @@ type CheckTarget<Nodes extends NodeTable, FlowTags extends OutcomeTags, NodeName
|
|
|
2774
2778
|
* ```
|
|
2775
2779
|
*/
|
|
2776
2780
|
type CheckedEdges<Nodes extends NodeTable, FlowTags extends OutcomeTags, Table> = { readonly [Name in keyof Nodes & string]: { readonly [Outcome in keyof Nodes[Name]["outcomes"] & string]: Name extends keyof Table ? Outcome extends keyof Table[Name] ? CheckTarget<Nodes, FlowTags, Name, Outcome, PayloadOf<Nodes[Name]["outcomes"][Outcome]>, Table[Name][Outcome]> : AnyTargetOf<Nodes, FlowTags> : AnyTargetOf<Nodes, FlowTags> } & (Name extends keyof Table ? { readonly [Extra in Exclude<keyof Table[Name], keyof Nodes[Name]["outcomes"]> & string]: GraphError<`Node "${Name}" has no outcome "${Extra}".`> } : unknown) } & { readonly [Extra in Exclude<keyof Table, keyof Nodes> & string]: GraphError<`"${Extra}" is not a node of this flow.`> };
|
|
2781
|
+
/**
|
|
2782
|
+
* Checks one outcome `Outcome` of the contributed flow `Contributed` against the slot `Host`:
|
|
2783
|
+
* `never` when it is `done`, or an outcome the slot declares whose payload fits; a `GraphError`
|
|
2784
|
+
* sentence otherwise.
|
|
2785
|
+
*/
|
|
2786
|
+
type OutcomeFit<Contributed extends AnyFlow, Host extends SlotNode<OutcomeTags, string>, Outcome extends keyof Contributed["outcomes"]> = Outcome extends "done" ? never : Outcome extends Exclude<keyof Host["outcomes"], "done"> ? Accepts<PayloadOf<Contributed["outcomes"][Outcome]>, PayloadOf<Host["outcomes"][Outcome]>> extends true ? never : GraphError<`Payload of outcome "${Outcome & string}" does not fit slot "${Host["name"]}".`> : GraphError<`Slot "${Host["name"]}" declares no outcome "${Outcome & string}".`>;
|
|
2787
|
+
/**
|
|
2788
|
+
* The outcomes of `Contributed` that do not fit the slot `Host`, as `GraphError` sentences, or
|
|
2789
|
+
* `never` when every outcome fits.
|
|
2790
|
+
*/
|
|
2791
|
+
type MisfitOutcomes<Contributed extends AnyFlow, Host extends SlotNode<OutcomeTags, string>> = { [Outcome in keyof Contributed["outcomes"]]: OutcomeFit<Contributed, Host, Outcome> }[keyof Contributed["outcomes"]];
|
|
2792
|
+
/**
|
|
2793
|
+
* Checking type of `contribution()`: whether the flow `Contributed` fits the slot `Host`. Every
|
|
2794
|
+
* outcome of the flow is `done`, or an outcome the slot declares whose payload fits; then it is
|
|
2795
|
+
* `unknown`, otherwise the `GraphError` sentence of the misfit. A slot that declares no outcome
|
|
2796
|
+
* accepts any flow, and a flow without outcomes fits any slot.
|
|
2797
|
+
*
|
|
2798
|
+
* @example
|
|
2799
|
+
* ```ts
|
|
2800
|
+
* // episodeStep = slot("episodeStep", { shop: type<{ tab: string }>() })
|
|
2801
|
+
* type Fitting = Fits<typeof storyFlow, typeof episodeStep>; // unknown: outcomes done and shop
|
|
2802
|
+
* type Misfit = Fits<typeof giftFlow, typeof episodeStep>; // giftFlow exits "gift":
|
|
2803
|
+
* // GraphError<'Slot "episodeStep" declares no outcome "gift".'>
|
|
2804
|
+
* ```
|
|
2805
|
+
*/
|
|
2806
|
+
type Fits<Contributed extends AnyFlow, Host extends SlotNode<OutcomeTags, string>> = [Exclude<keyof Host["outcomes"], "done">] extends [never] ? unknown : [MisfitOutcomes<Contributed, Host>] extends [never] ? unknown : MisfitOutcomes<Contributed, Host>;
|
|
2777
2807
|
/**
|
|
2778
2808
|
* A flow as `defineFlow` returns it: plain data. A flow that declares `input` and `outcomes`
|
|
2779
2809
|
* is used as a node of another flow.
|
|
@@ -3118,7 +3148,13 @@ type RunnerState = {
|
|
|
3118
3148
|
* transit nodes, so `bookmark()` writes its `rest` only when these frames name a rest node.
|
|
3119
3149
|
*/
|
|
3120
3150
|
restFrame: Frame[] | undefined; /** Inside a slot: the contribution the loop just finished. The slot continues after it. */
|
|
3121
|
-
slotAfter: string | undefined; /**
|
|
3151
|
+
slotAfter: string | undefined; /** Inside a slot: the declared outcome a contribution left on. The slot takes its edge next. */
|
|
3152
|
+
slotLeave: {
|
|
3153
|
+
outcome: string;
|
|
3154
|
+
payload: Json;
|
|
3155
|
+
} | undefined; /** Edges committed since the loop last arrived at a rest node. */
|
|
3156
|
+
restless: number; /** Edges without a rest node after which the next one fails: `max(64, 4 × expanded nodes)`. */
|
|
3157
|
+
restlessCap: number; /** Edges since the last checkpoint. */
|
|
3122
3158
|
journal: JournalEntry[];
|
|
3123
3159
|
journalIndex: number; /** The promise of `run()`. `undefined`: not started. */
|
|
3124
3160
|
running: Promise<void> | undefined; /** Aborts the active node. */
|
|
@@ -3442,12 +3478,19 @@ type FeatureTextStyles = {
|
|
|
3442
3478
|
*/
|
|
3443
3479
|
type FeatureDescription = {
|
|
3444
3480
|
/** Nodes the feature owns. Recorded for `describe()` and hot swap. */nodes?: readonly AnyNode[]; /** Flows the feature owns. */
|
|
3445
|
-
flows?: readonly AnyFlow[];
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
|
|
3481
|
+
flows?: readonly AnyFlow[];
|
|
3482
|
+
/**
|
|
3483
|
+
* Slot name to the sub-flow run in that slot. Written by hand, an entry is checked by name at
|
|
3484
|
+
* `run()`; `...contribution(slot, spec)` also checks its outcomes against the slot at compile time.
|
|
3485
|
+
*
|
|
3486
|
+
* @example
|
|
3487
|
+
* ```ts
|
|
3488
|
+
* // The story runs in the slot "episodeStep" and may leave it on one of the slot's outcomes.
|
|
3489
|
+
* contribute: { ...contribution(episodeStep, { flow: storyFlow, order: 10 }) }
|
|
3490
|
+
* // { episodeStep: { flow: storyFlow, order: 10 } }
|
|
3491
|
+
* ```
|
|
3492
|
+
*/
|
|
3493
|
+
contribute?: Record<string, ContributionSpec>;
|
|
3451
3494
|
/**
|
|
3452
3495
|
* Sub-features this feature declares, each in a folder of its own inside this feature's folder,
|
|
3453
3496
|
* in the order they are composed. `defineGameApp` composes them right after this feature; this
|
|
@@ -3483,19 +3526,37 @@ type FeaturePlugin = AnyPluginInstance & {
|
|
|
3483
3526
|
readonly features: readonly FeaturePlugin[];
|
|
3484
3527
|
};
|
|
3485
3528
|
/**
|
|
3486
|
-
* One sub-flow
|
|
3529
|
+
* One entry of a feature's `contribute`: the sub-flow a slot runs, its place among the slot's
|
|
3530
|
+
* contributions (lowest `order` first) and the `when` that may skip it. `when` reads the committed
|
|
3531
|
+
* state. `contribution(slot, spec)` builds the entry under the slot's name.
|
|
3487
3532
|
*
|
|
3488
3533
|
* @example
|
|
3489
3534
|
* ```ts
|
|
3490
|
-
*
|
|
3535
|
+
* // The story of episode 1 runs in the slot "episodeStep" while the player is in episode 1.
|
|
3536
|
+
* // `episodeOf` is the game's reader of the committed player tree.
|
|
3537
|
+
* const story: ContributionSpec = {
|
|
3538
|
+
* flow: storyFlow,
|
|
3539
|
+
* order: 10,
|
|
3540
|
+
* when: snapshot => episodeOf(snapshot.player) === "ep01"
|
|
3541
|
+
* };
|
|
3491
3542
|
* ```
|
|
3492
3543
|
*/
|
|
3493
|
-
type
|
|
3494
|
-
feature: string;
|
|
3544
|
+
type ContributionSpec = {
|
|
3495
3545
|
flow: AnyFlow;
|
|
3496
3546
|
order: number;
|
|
3497
3547
|
when?: (snapshot: Snapshot) => boolean;
|
|
3498
3548
|
};
|
|
3549
|
+
/**
|
|
3550
|
+
* One sub-flow contributed to a slot, with the feature that contributed it.
|
|
3551
|
+
*
|
|
3552
|
+
* @example
|
|
3553
|
+
* ```ts
|
|
3554
|
+
* const contribution: Contribution = { feature: "reward", flow: rewardFlow, order: 10 };
|
|
3555
|
+
* ```
|
|
3556
|
+
*/
|
|
3557
|
+
type Contribution = ContributionSpec & {
|
|
3558
|
+
feature: string;
|
|
3559
|
+
};
|
|
3499
3560
|
/**
|
|
3500
3561
|
* features module state.
|
|
3501
3562
|
*/
|
|
@@ -3652,20 +3713,55 @@ declare function exit<const Name extends string>(outcome: Name): Exit<Name>;
|
|
|
3652
3713
|
declare function to<const TargetName extends string, Payload, Output>(target: TargetName, map: (payload: Payload) => Output): Mapped<TargetName, Payload, Output>;
|
|
3653
3714
|
/**
|
|
3654
3715
|
* Defines an extension point: a node whose body is "run the contributions of this slot in order".
|
|
3655
|
-
* Its
|
|
3716
|
+
* Its outcomes are `done` and the ones declared here; the flow that holds the slot gives each an
|
|
3717
|
+
* edge. A contribution that exits `done` hands over to the next contribution whose `when` holds,
|
|
3718
|
+
* and with none left the slot takes its `done` edge. A contribution that exits a declared outcome
|
|
3719
|
+
* leaves the slot at once with its payload: the later contributions do not run, and the slot takes
|
|
3720
|
+
* its own edge of that outcome, journalled like `done`. The next entry of the slot starts again at
|
|
3721
|
+
* its first contribution. Without `outcomes` the slot declares only `done`.
|
|
3656
3722
|
*
|
|
3657
3723
|
* @param name - Slot name features contribute to.
|
|
3724
|
+
* @param outcomes - The named outcomes besides `done`, with the type tag of each payload.
|
|
3658
3725
|
* @returns The slot node as plain data.
|
|
3726
|
+
* @throws {TypeError} When `outcomes` declares `done`, which is every slot's own outcome.
|
|
3727
|
+
* @example
|
|
3728
|
+
* ```ts
|
|
3729
|
+
* // After an order a feature may send the player to the shop, on the tab it names.
|
|
3730
|
+
* slot("afterOrder", { shop: type<{ tab: string }>() });
|
|
3731
|
+
* // { kind: "slot", name: "afterOrder", input: { kind: "type" },
|
|
3732
|
+
* // outcomes: { done: { kind: "type" }, shop: { kind: "type" } } }
|
|
3733
|
+
* ```
|
|
3734
|
+
*/
|
|
3735
|
+
declare function slot<const Name extends string, const Tags extends OutcomeTags = Record<never, never>>(name: Name, outcomes?: Tags & {
|
|
3736
|
+
readonly done?: never;
|
|
3737
|
+
}): SlotNode<Tags, Name>;
|
|
3738
|
+
/**
|
|
3739
|
+
* Builds one typed entry of a feature's `contribute`: the flow a slot runs, under the slot's
|
|
3740
|
+
* name. The compiler checks every outcome of the flow: `done`, or an outcome the slot declares
|
|
3741
|
+
* whose payload fits; a slot that declares none accepts any flow. A raw `contribute` entry stays
|
|
3742
|
+
* valid and is checked by name at `run()` only.
|
|
3743
|
+
*
|
|
3744
|
+
* @param host - The slot node the flow runs in, as `slot()` returned it.
|
|
3745
|
+
* @param spec - The flow, its `order` among the slot's contributions and an optional `when`.
|
|
3746
|
+
* @param spec.flow - The contributed flow; an outcome the slot does not take is a compile error.
|
|
3747
|
+
* @param spec.order - Place among the contributions of the slot, lowest first.
|
|
3748
|
+
* @param spec.when - Skips the contribution while it returns false, read on the committed state.
|
|
3749
|
+
* @returns `{ [host.name]: spec }`, spread into `contribute`; no `when` key when none was given.
|
|
3659
3750
|
* @example
|
|
3660
3751
|
* ```ts
|
|
3661
|
-
* // The
|
|
3662
|
-
*
|
|
3663
|
-
* //
|
|
3752
|
+
* // The story feature fills the episode step of the main flow: spread the entry into contribute.
|
|
3753
|
+
* contribution(episodeStep, { flow: storyFlow, order: 10 });
|
|
3754
|
+
* // { episodeStep: { flow: storyFlow, order: 10 } }
|
|
3755
|
+
* contribute: { ...contribution(episodeStep, { flow: storyFlow, order: 10 }) }
|
|
3664
3756
|
* ```
|
|
3665
3757
|
*/
|
|
3666
|
-
declare function
|
|
3758
|
+
declare function contribution<S extends SlotNode<OutcomeTags, string>, F extends AnyFlow>(host: S, spec: {
|
|
3759
|
+
flow: F & Fits<F, S>;
|
|
3760
|
+
order: number;
|
|
3761
|
+
when?: (snapshot: Snapshot) => boolean;
|
|
3762
|
+
}): Readonly<Record<S["name"], ContributionSpec>>;
|
|
3667
3763
|
declare namespace types_d_exports$4 {
|
|
3668
|
-
export { Allow, Answer, AnyFlow, AnyNode, AnyNodeContext, Api$3 as Api, Bookmark, BundlesOf, CheckedEdges, Config$4 as Config, Contribution, DefineNode, Deps$4 as Deps, Descriptor, Edges, Effect, EffectHandler, EffectOptions, EmitterIdOf, EnterCallback, Events$4 as Events, Exit, FeatureDescription, FeatureEmitter, FeatureFilter, FeaturePlugin, FeatureTree, FeaturesApi, FlowCtx, FlowDefinition, FlowEntry, FlowGraph, FlowKit, FlowSpec, FlowState, FxApi, FxHandler, GameState, GameTypes, GateApi, GraphError, GraphNode, GuideOptions, Hint, HudKeysOf, InboxApi, JournalEntry, KernelSlice$4 as KernelSlice, LifecycleChanged, Mapped, NodeContext, NodeDefinition, NodeFx, NodeInfo, NodeSpec, NodeTable, OutcomeTags, Position, RecoverContext, RegisteredFeature, Result, RouteStep, RunnerApi, SceneIdOf, SlotNode, Stage, State$4 as State, StringTableLike, Target, TextStylesOf, TypeTag, WorldEvent };
|
|
3764
|
+
export { Allow, Answer, AnyFlow, AnyNode, AnyNodeContext, Api$3 as Api, Bookmark, BundlesOf, CheckedEdges, Config$4 as Config, Contribution, ContributionSpec, DefineNode, Deps$4 as Deps, Descriptor, Edges, Effect, EffectHandler, EffectOptions, EmitterIdOf, EnterCallback, Events$4 as Events, Exit, FeatureDescription, FeatureEmitter, FeatureFilter, FeaturePlugin, FeatureTree, FeaturesApi, FlowCtx, FlowDefinition, FlowEntry, FlowGraph, FlowKit, FlowSpec, FlowState, FxApi, FxHandler, GameState, GameTypes, GateApi, GraphError, GraphNode, GuideOptions, Hint, HudKeysOf, InboxApi, JournalEntry, KernelSlice$4 as KernelSlice, LifecycleChanged, Mapped, NodeContext, NodeDefinition, NodeFx, NodeInfo, NodeSpec, NodeTable, OutcomeTags, Position, RecoverContext, RegisteredFeature, Result, RouteStep, RunnerApi, SceneIdOf, SlotNode, Stage, State$4 as State, StringTableLike, Target, TextStylesOf, TypeTag, WorldEvent };
|
|
3669
3765
|
}
|
|
3670
3766
|
/**
|
|
3671
3767
|
* flow plugin events.
|
|
@@ -13253,4 +13349,4 @@ type BundleCompanion = {
|
|
|
13253
13349
|
unload(bundle: string): void;
|
|
13254
13350
|
};
|
|
13255
13351
|
//#endregion
|
|
13256
|
-
export { PixiModule as $,
|
|
13352
|
+
export { PixiModule as $, FeatureDescription as $n, ThermalReading as $r, ShaderWhat as $t, SyncApi as A, NumericFields as An, State$6 as Ar, PerfChange as At, ShapeValue as B, EmitterIdOf as Bn, RngApi as Br, PerfLongFrameLine as Bt, SceneSpec as C, TagType as Cn, State$5 as Cr, PERF_CAUSES as Ct, DebugSwitches as D, Motion as Dn, Events$5 as Dr, PassKind as Dt, types_d_exports$1 as E, Ease as En, Config$6 as Er, PROBLEM_RULES as Et, NineSliceValue as F, TrackSegment as Fn, SaveDoc as Fr, PerfEventLine as Ft, Transform as G, TextStylesOf as Gn, PauseReason as Gr, PerfStartupLine as Gt, SpriteBlend as H, HudKeysOf as Hn, Api$6 as Hr, PerfMeasured as Ht, Overlay as I, ViewHandle as In, SaveUnreadableError as Ir, PerfEventName as It, AdaptiveScale as J, defineFlow as Jn, Api$7 as Jr, PoolTrimDetail as Jt, TransformValue as K, types_d_exports$4 as Kn, State$7 as Kr, PerfTelemetryLine as Kt, OverlayValue as L, Api$3 as Ln, Snapshot as Lr, PerfGapLine as Lt, HudPart as M, ProjectionSpec as Mn, Patch as Mr, PerfCollectorLine as Mt, HudPartValue as N, ReducedMotion as Nn, PlayerStateProvider as Nr, PerfCounts as Nt, FilterSlot as O, MotionCause as On, Json as Or, PassRecord as Ot, NineSlice$1 as P, TrackOptions as Pn, ProviderCall as Pr, PerfDisplay as Pt, PixiFilter as Q, type as Qn, State$8 as Qr, ShaderEventDetail as Qt, Parent as R, BundlesOf as Rn, SnapshotOf as Rr, PerfHeaderLine as Rt, SceneDefinition as S, SystemFor as Sn, FakeClock as Sr, OverlayWhat as St, State$1 as T, DescriptionNode as Tn, Api$5 as Tr, PERF_LOG_VERSION as Tt, SpriteOptions as U, Position as Un, Config$7 as Ur, PerfSampleLine as Ut, Sprite as V, GameTypes as Vn, RngState as Vr, PerfMarkLine as Vt, SpriteValue as W, State$4 as Wn, Events$6 as Wr, PerfSpikeLine as Wt, Config$2 as X, slot as Xn, FrameRate as Xr, ProblemRule as Xt, Api$1 as Y, exit as Yn, Config$8 as Yr, ProblemEventDetail as Yt, MonitorConfig as Z, to as Zn, RateChange as Zr, SHADER_WHATS as Zt, AnySceneProjection as _, Mut as _n, NodeFx as _r, FrameRing as _t, Config as a, State$3 as an, FlowGraph as ar, types_d_exports$2 as at, Events$1 as b, ResourceType as bn, ClockSource as br, MonitorSections as bt, LoadBundles as c, AnyComponentType as cn, NodeTable as cr, RenderStats as ct, Manifest as d, ComponentSchema as dn, TypeTag as dr, ViewportSize as dt, Time as ei, WarmDetail as en, FeaturePlugin as er, PixiSprite as et, ReadyBundles as f, ComponentType as fn, Descriptor as fr, FilterCache as ft, types_d_exports as g, FrameDiff as gn, Hint as gr, FrameRecord as gt, Usage as h, EntitySnapshot as hn, GuideOptions as hr, FrameReadout as ht, BundleSpec as i, Require as ii, Explained as in, DefineNode as ir, Under as it, Display as j, ProjectionMotion as jn, types_d_exports$6 as jr, PerfChangeEntry as jt, FilterSlotInputs as k, MotionHandle as kn, Root as kr, PerfCause as kt, LoadReason as l, AnyComponentValue as ln, RouteStep as lr, Orientation as lt, Tier as m, Entity as mn, EffectOptions as mr, FrameReadResult as mt, AssetsIo as n, Config$9 as ni, Api$2 as nn, AnyFlow as nr, PoolTrim as nt, DefineBundles as o, types_d_exports$3 as on, FlowState as or, Captured as ot, State as p, ComponentValue as pn, Effect as pr, FrameColumns as pt, sprite as q, contribution as qn, types_d_exports$7 as qr, PerfThermalLine as qt, BundleMap as r, Events$8 as ri, Config$3 as rn, Bookmark as rr, State$2 as rt, Events as s, AnyComponent as sn, JournalEntry as sr, MonitorCounts as st, Api as t, types_d_exports$8 as ti, DEMAND_REASONS as tn, FeatureTree as tr, PixiTexture as tt, LoadResult as u, ComponentHandle as un, SceneIdOf as ur, Point as ut, Config$1 as v, Narrowed as vn, Answer as vr, LongFrameEntry as vt, ScenesApi as w, ChangeHook as wn, types_d_exports$5 as wr, PERF_GAP_BUCKETS as wt, LayerMap as x, SystemDefinition as xn, Config$5 as xr, OverlayEventDetail as xt, DefineScene as y, QueryTerm as yn, Api$4 as yr, MONITOR_SECTIONS as yt, Shape as z, Config$4 as zn, StoreApi as zr, PerfLogLine as zt };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as HeadlessApp } from "./headless-
|
|
1
|
+
import { Lr as Snapshot, Or as Json } from "./types-DrkR03nL.mjs";
|
|
2
|
+
import { t as HeadlessApp } from "./headless-1e3gEF1Y.mjs";
|
|
3
3
|
import { Log } from "@moku-labs/common/browser";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/flow/doors/types.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { P as AnimApi, r as UiApi } from "./types-
|
|
3
|
-
import { N as InputApi } from "./types-
|
|
4
|
-
import { r as Repro } from "./headless-
|
|
5
|
-
import { a as InputOf, r as ControlApp } from "./types-
|
|
6
|
-
import { t as commands } from "./commands-
|
|
1
|
+
import { Hr as Api$3, Tr as Api$2, Y as Api, nn as Api$1, yr as Api$4 } from "./types-DrkR03nL.mjs";
|
|
2
|
+
import { P as AnimApi, r as UiApi } from "./types-B-o8Ul1v.mjs";
|
|
3
|
+
import { N as InputApi } from "./types-CFEtGENK.mjs";
|
|
4
|
+
import { r as Repro } from "./headless-1e3gEF1Y.mjs";
|
|
5
|
+
import { a as InputOf, r as ControlApp } from "./types-gQATSj41.mjs";
|
|
6
|
+
import { t as commands } from "./commands-DLk06fiL.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-pHKIFBSQ.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,6 +1,6 @@
|
|
|
1
1
|
import { t as VISUAL_CLOCK } from "./fake-hnJcJeYf.mjs";
|
|
2
2
|
import { n as read, t as sources } from "./sources-MfRpM8sV.mjs";
|
|
3
|
-
import { n as commands, t as run } from "./run-
|
|
3
|
+
import { n as commands, t as run } from "./run-8s7kh2QD.mjs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { createBrandConsole } from "@moku-labs/common/cli";
|
|
6
6
|
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
package/llms.txt
CHANGED
|
@@ -23,7 +23,7 @@ Facts: Bun only. ESM only. `"sideEffects"` lists the root entry `./dist/index.mj
|
|
|
23
23
|
- `@moku-labs/game/jsx-runtime` and `@moku-labs/game/jsx-dev-runtime`: what `"jsxImportSource": "@moku-labs/game"` resolves to. A game never imports them by hand.
|
|
24
24
|
|
|
25
25
|
Root exports:
|
|
26
|
-
- Functions: `createApp`, `createPlugin`, `defineGame`, `defineFeature`, `flattenFeatures`, `type`, `exit`, `to`, `slot`, `schedule`, `guide`, `hint`, `defineEffect`.
|
|
26
|
+
- Functions: `createApp`, `createPlugin`, `defineGame`, `defineFeature`, `flattenFeatures`, `type`, `exit`, `to`, `slot`, `contribution`, `schedule`, `guide`, `hint`, `defineEffect`.
|
|
27
27
|
- Class: `SaveUnreadableError`.
|
|
28
28
|
- Plugin instances: `timePlugin`, `lifecyclePlugin`, `modelPlugin`, `clockPlugin`, `flowPlugin`, `worldPlugin`, `rendererPlugin`, `inputPlugin`, `assetsPlugin`, `scenesPlugin`, `animPlugin`, `i18nPlugin`, `textPlugin`, `uiPlugin`, `audioPlugin`, `effectsPlugin`, `platformPlugin`; the list `screen` = `world`, `renderer`, `input`, `assets`, `scenes`, `anim`, `i18n`, `text`, `ui`. `effects`, `audio` and `platform` are opt-in: `plugins: [...screen, effectsPlugin, audioPlugin, platformPlugin]`, `platform` last.
|
|
29
29
|
- Screen helpers from the root: `component`, `tag`, `resource`, `mut`, `system`, `projection`, `Layer`, `Order`, `Exiting`, `Tree`, `Now`, `Transform`, `Sprite`, `NineSlice`, `Shape`, `Parent`, `Display`, `Overlay`, `HudPart`, `sprite`, `Tappable`, `Pressable`, `Draggable`, `DropTarget`, `Swipeable`, `Traceable`, `Touchable`, `Held`, `Hovered`, `PointerOver`, `Pressed`, `Pointer`, `Traced`, `defineBundles`, `load`, `defineScene`.
|
|
@@ -54,7 +54,7 @@ Root exports:
|
|
|
54
54
|
- Path: node names joined by `/` through sub-flows and slots. Examples: `"home"`, `"board/awaitIntent"`, `"afterBonus/thanks"`.
|
|
55
55
|
- Edge target: a node name, `exit(...)` or `to(...)`. A payload must fit the input of the target. A node without input accepts any payload.
|
|
56
56
|
- Sub-flow: a flow that declares `outcomes` is used as a node of another flow. `exit("name")` leaves it with that outcome.
|
|
57
|
-
- Slot: `slot("name")` is a node with the
|
|
57
|
+
- Slot: `slot("name")` is a node with the outcome `done`; `slot("name", { shop: type<{ tab: string }>() })` declares more outcomes (never `done`), and the flow that holds the slot gives each an edge, as for a node. Features contribute sub-flows to it. They run in `order`. `when(snapshot)` can skip one; it always reads the committed state, also what an earlier contribution of the same slot wrote. A contribution may hold a slot of its own. A contribution that exits `done` hands over to the next one, and the slot ends with its own `done` edge after the last. A contribution that exits an outcome the slot declares leaves the slot at once with its payload: the later contributions do not run, and the slot takes its own edge of that outcome (a journal entry and a `flow:edge`, like `done`). The next entry of a slot starts at its first contribution. `contribution(slot, { flow, order, when? })` builds the `contribute` entry and checks at compile time that every outcome of the flow is `done` or a declared outcome whose payload fits. `run()` refuses a contribution of a slot with declared outcomes that declares another outcome, and one slot name declared with different outcomes; it warns about named exits into a slot that declares none, and about two contributions without `when` in a slot that declares some. A slot never counts as a rest node: more than `max(64, 4 × n)` edges without one fail the node, `n` being the nodes of the graph expanded from the main flow (a sub-flow once per entry that uses it, a slot with all its contributions).
|
|
58
58
|
- Feature: `defineFeature(name, description)` makes an ordinary plugin that registers into `flow.features` in `onInit`. Pass it in `createApp({ plugins: [...] })`. `feature.logicOnly` is the same plugin with the V1 keys only, for headless tests. `features: [episodesKitFeature, ep01Feature, ep02Feature]` declares sub-features, each in a folder of its own inside the parent's (`features/episodes/ep01/`); `flattenFeatures([homeFeature, episodesFeature])` gives the flat plugin list, a parent before its children, depth first, and a parent's `onInit` throws when a declared sub-feature is not composed. `flow.features.all()` gives `{ name, description, parent? }` per feature.
|
|
59
59
|
- Modes: `"live"` and `"fast"`. In fast mode effects answer instantly, hints are dropped and only `runInFast` handlers run. All node logic runs for real.
|
|
60
60
|
|
|
@@ -92,13 +92,22 @@ function to<const TargetName extends string, Payload, Output>(
|
|
|
92
92
|
target: TargetName,
|
|
93
93
|
map: (payload: Payload) => Output // annotate the parameter type yourself
|
|
94
94
|
): Mapped<TargetName, Payload, Output>;
|
|
95
|
-
function slot
|
|
95
|
+
function slot<const Name extends string, const Tags extends OutcomeTags = Record<never, never>>(
|
|
96
|
+
name: Name,
|
|
97
|
+
outcomes?: Tags // { shop: type<{ tab: string }>() }; declaring done throws a TypeError
|
|
98
|
+
): SlotNode<Tags, Name>; // outcomes: done, then the declared ones
|
|
99
|
+
function contribution<S extends SlotNode<OutcomeTags, string>, F extends AnyFlow>(
|
|
100
|
+
slot: S,
|
|
101
|
+
spec: { flow: F; order: number; when?: (snapshot: Snapshot) => boolean }
|
|
102
|
+
): Readonly<Record<S["name"], ContributionSpec>>; // { [slot.name]: { flow, order, when? } }
|
|
103
|
+
// contribute: { ...contribution(episodeStep, { flow: storyFlow, order: 10 }) }
|
|
104
|
+
// compile error when storyFlow declares an outcome episodeStep does not declare, or its payload does not fit
|
|
96
105
|
|
|
97
106
|
function defineFeature(name: string, description: FeatureDescription): FeaturePlugin;
|
|
98
107
|
// FeatureDescription = {
|
|
99
108
|
// nodes?: readonly AnyNode[];
|
|
100
109
|
// flows?: readonly AnyFlow[];
|
|
101
|
-
// contribute?: Record<string, { flow: AnyFlow; order: number; when?: (snapshot: Snapshot) => boolean }
|
|
110
|
+
// contribute?: Record<string, ContributionSpec>; // ContributionSpec = { flow: AnyFlow; order: number; when?: (snapshot: Snapshot) => boolean }
|
|
102
111
|
// features?: readonly FeaturePlugin[]; // sub-features, composed right after this one
|
|
103
112
|
// projections?, systems?, components?, scenes?, assets?; // V2 keys, read by world, scenes and assets
|
|
104
113
|
// systemsRun?: never; // the 0.15.3 key, removed: a system runs while its query has an entity
|