@moku-labs/game 0.15.55 → 0.15.57
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 +3 -3
- package/dist/app.mjs +1 -1
- package/dist/assets.d.mts +1 -1
- package/dist/{commands-C7qVsYsu.d.mts → commands-B208rrQE.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/{define-BeFMCdMd.d.mts → define-U9QpSza7.d.mts} +2 -2
- package/dist/{headless-C4YDmZv1.d.mts → headless-7IBMNGda.d.mts} +1 -1
- package/dist/{index-BgJZZmqB.d.mts → index-m2g9-8_E.d.mts} +24 -11
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- 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/{runtime-DAid26Eo.d.mts → runtime-DLCg0viS.d.mts} +1 -1
- package/dist/{src-9Oy89OMt.mjs → src-CJtaTza4.mjs} +1163 -280
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +1 -1
- package/dist/{types-BdwZpZce.d.mts → types-BEW2Y3au.d.mts} +2 -2
- package/dist/{types-VWk999Gp.d.mts → types-C0As3dEe.d.mts} +2 -2
- package/dist/{types-D9YSrw2Z.d.mts → types-C6PML3Il.d.mts} +310 -40
- package/dist/{types-Dj8OQDCY.d.mts → types-DuqbyY_j.d.mts} +4 -4
- package/dist/{types-CGofZbu2.d.mts → types-FtzEwwWY.d.mts} +1 -1
- package/dist/{visual-CugfNrMB.d.mts → visual-CpTnNnas.d.mts} +6 -6
- package/dist/visual.d.mts +1 -1
- package/llms.txt +4 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $n as
|
|
1
|
+
import { $n as AnyComponent, Ar as Json, Fn as Hint, Gn as NumericFields, Hn as Motion, Jn as ReducedMotion, K as TransformValue, Kn as ProjectionMotion, Ln as Answer, Qn as ViewHandle, Rn as AnchorTarget, Un as MotionCause, Vn as Ease, Wn as MotionHandle, Xr as Api, Y as Api$3, dt as ViewportSize, er as AnyComponentType, gr as Api$2, hr as TagType, ir as ComponentType, jn as Descriptor, nn as Api$1, oi as Require, or as Entity, s as Events$1, t as Api$4, tr as AnyComponentValue, xr as Api$5, zn as ChangeHook } from "./types-C6PML3Il.mjs";
|
|
2
2
|
import { Log } from "@moku-labs/common/browser";
|
|
3
3
|
import { PluginCtx } from "@moku-labs/core";
|
|
4
4
|
import { Node, Yoga } from "yoga-layout/load";
|
|
@@ -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 { Dr as Api$2, Wr as Api$3, Y as Api, gr as Api$1, xr as Api$4 } from "./types-C6PML3Il.mjs";
|
|
2
|
+
import { P as AnimApi, r as UiApi } from "./types-C0As3dEe.mjs";
|
|
3
|
+
import { N as InputApi } from "./types-FtzEwwWY.mjs";
|
|
4
|
+
import { r as Repro } from "./headless-7IBMNGda.mjs";
|
|
5
|
+
import { a as InputOf, r as ControlApp } from "./types-BEW2Y3au.mjs";
|
|
6
|
+
import { t as commands } from "./commands-B208rrQE.mjs";
|
|
7
7
|
|
|
8
8
|
//#region src/visual/types.d.ts
|
|
9
9
|
/** The base commands of the `/control` door, keyed by their short names. */
|
package/dist/visual.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as VisualApp, c as VisualRenderer, d as VisualStart, f as VisualStep, h as VisualTolerance, i as CheckpointResult, l as VisualReport, m as VisualTestResult, n as runVisualTests, o as VisualOptions, p as VisualTest, r as defineVisualTest, s as VisualPage, t as parseVisualArgv, u as VisualSetup } from "./visual-
|
|
1
|
+
import { a as VisualApp, c as VisualRenderer, d as VisualStart, f as VisualStep, h as VisualTolerance, i as CheckpointResult, l as VisualReport, m as VisualTestResult, n as runVisualTests, o as VisualOptions, p as VisualTest, r as defineVisualTest, s as VisualPage, t as parseVisualArgv, u as VisualSetup } from "./visual-CpTnNnas.mjs";
|
|
2
2
|
export { type CheckpointResult, type VisualApp, type VisualOptions, type VisualPage, type VisualRenderer, type VisualReport, type VisualSetup, type VisualStart, type VisualStep, type VisualTest, type VisualTestResult, type VisualTolerance, defineVisualTest, parseVisualArgv, runVisualTests };
|
package/llms.txt
CHANGED
|
@@ -461,14 +461,14 @@ export const awaitIntent = defineNode({
|
|
|
461
461
|
target: [{ projection: "board.items", key: "c2" }, { projection: "board.items", key: "c3" }],
|
|
462
462
|
pad: 8,
|
|
463
463
|
veil: false, // the game draws its own look in an <anchor>
|
|
464
|
-
blocked: { intent: "tutorialBlocked" } // a press outside the window answers this
|
|
464
|
+
blocked: { intent: "tutorialBlocked" } // a press outside the window, or one inside the narrow refuses, answers this
|
|
465
465
|
}
|
|
466
466
|
: undefined
|
|
467
467
|
});
|
|
468
468
|
```
|
|
469
469
|
|
|
470
470
|
- `guide` runs when the node is entered (after its `onEnter` stages) and again after a commit while it waits at its gate (never for the commit of an edge); an equal result (deep JSON) changes nothing, a new one replaces the guide, `undefined` lifts it. It goes when the node is left; a restore enters the node again, so it is derived again. Fast mode: only the narrow. A `guide` that throws fails the node: `[game] The guide of node "path" threw: <message>` (rollback, retry, safe node). A dev build fails it when `blocked.intent` is no outcome of the node.
|
|
471
|
-
- The gate takes only `allow` and `blocked` while a guide stands; `app.flow.gate.state()` reports `blocked`.
|
|
471
|
+
- The gate takes only `allow` and `blocked` while a guide stands; `app.flow.gate.state()` reports `blocked`. A press `input` gives that the open gate's narrow refuses (another intent, or `allow`'s intent with another payload, a drop on the wrong cell) answers `blocked` in its place, once, with its payload; without `blocked` it answers nothing. A press at a closed gate is held as it is, not converted.
|
|
472
472
|
- `ui` draws a veil (black 0.6, or `veil: { color, alpha }`; `alpha: 0` invisible, `false` none) around a window over the target or the union of the shown targets, grown by `pad`, placed every frame (it follows a moving or scrolling target), and locks `input` outside the window: a press there reaches no view (no `Tappable`, `LocalWrite`, scroll, drag, trace) and answers `blocked`, or nothing. No target, or none shown: the veil covers the screen and every press is locked, so a target key that never shows soft-locks the step (only `blocked` and the keyboard answer); a dev build warns `ui:guide-target-missing` `{ targets }` once after a key named no entity two frames in a row. A guide derived again with the same targets keeps the previous window for two frames while its targets are not laid out yet. A text field outside the window opens no keyboard. The doors `app.input.tap/press/drag` do no hit test and are not locked; a press reads the window of the frame before (input runs before layout). 0 B a frame.
|
|
473
473
|
- `await fx(guide({ allow: { intent: "roll" } }))` in a body still works, with the same options. The rounded window, the rim, the glide, the hand and the text are the game's: an `<anchor>` on the same targets with `veil: false`.
|
|
474
474
|
|
|
@@ -561,7 +561,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
|
|
|
561
561
|
- Overlays: `Overlay({ dim, dimColor, cover, hud, fade, hold })` on the root of an overlay (in `components`) keeps everything drawn before it as one picture, retaken in the frame anything in it changes, and with `cover: "opaque"` draws none of it once landed at alpha 1; `hold: true` (default `false`) holds the endless loops under it while it stands, as under a cover or a blurred picture (their phase follows time), so a dimmed sheet over a sharp scene draws no frame at rest; the engine draws the dim (`dim × level`, right under the root); the level follows the root's own enter and exit motion, `fade` (250 ms) only when it has none; level and landing are read through `app.renderer.sync.debug.overlays()`. A `backdrop: true` filter inside the kept range runs no pass while the picture stands (its look is in the picture) and is drawn again in the frame the overlay is gone. Types: `OverlayValue` (the component's value) and `HudPartValue` (a part of the HUD an overlay keeps shown or lets fade).
|
|
562
562
|
- HUD: a scene layer `{ above: "overlays" }` is the HUD layer, drawn above every overlay and never in a picture; a scene with a HUD layer and no `ui` gets `ui` right under it. Its roots never take the keyboard: Escape and the Back press reach the top sheet under it. `HudPart({ key })` tags a HUD view; an overlay's `hud` (`"all"`, `"none"` or keys) names the parts that stay shown, the others fade with its level and take no tap. Keys are typed by `defineGame<{ …, hud: "energy" | "gems" }>()`.
|
|
563
563
|
- Endless loops of views under an opaque or blurred overlay write nothing (`renderer.sync.loopsHeld(entity)`, the seam anim asks before an endless loop writes); their phase follows time.
|
|
564
|
-
- Scene switch look: from the start of a live switch (before its bundles and textures are awaited) the renderer draws a veil over the scene being left, above every layer, and, when the switch is not done `afterMs` after its start, a loader above it until the swap; then the veil fades out over the new scene. Config `scenes.leave` (default `{ cover: { color: 0x000000, alpha: 0.45, inMs: 50, outMs: 150 }, loader: { afterMs: 400 } }`) and a scene's `leave` (`defineScene("ward", { ..., leave: false })`) are merged field by field (the scene being left decides; `false` turns a part or the whole off); the loader is the engine's white ring, `loader: { texture: "ui.loader.ring" }` a game texture turning, or `loader: { projection: "loading" }` a projection
|
|
564
|
+
- Scene switch look: from the start of a live switch (before its bundles and textures are awaited) the renderer draws a veil over the scene being left, above every layer, and, when the switch is not done `afterMs` after its start, a loader above it until the swap; then the veil fades out over the new scene. Config `scenes.leave` (default `{ cover: { color: 0x000000, alpha: 0.45, inMs: 50, outMs: 150 }, loader: { afterMs: 400 } }`) and a scene's `leave` (`defineScene("ward", { ..., leave: false })`) are merged field by field (the scene being left decides; `false` turns a part or the whole off); the loader is the engine's white ring, `loader: { texture: "ui.loader.ring" }` a game texture turning, or `loader: { projection: "loading" }` a projection in a layer of its own the scene declares (no other projection of the scene may draw there), kept built and hidden while the scene stands and shown once the loader is due; `scenes` feeds that loader the switch (`projection.feed`), so its `from(player, session, sw)` reads a `SceneSwitch`: `{ from: "ward", to: "ward", progress: 0 }` while the ward stands, then `{ from: "ward", to: "board", progress }`, the share of the board's bundles loaded (from `assets:bundle-progress`; a bundle loaded at the start or once the scene stage has its loads counts whole), 0 to 1 in steps of 0.01, the last exactly 1; an abort or a throw drops both at once; fast walks, a world that is not live, headless apps and the first scene show nothing. The scene being entered sets the veil's colour and alpha: `defineScene("night", { ..., enter: { cover: { color: 0x0b1020, alpha: 0.7 } } })` wins over what the scene being left resolved, field by field; `inMs`/`outMs` stay the left scene's and a veil turned off stays off. Types `SceneLeave`, `SceneCover`, `SceneLoader`, `SceneEnter` (`Scenes`).
|
|
565
565
|
- A scene names bundles on top of its `bundle` from the committed state: `defineScene("ward", { bundle: "episodes-kit", bundles: ({ session }) => [session.episode], layers: {}, projections: [wardRoom] })`. `bundles` is read each time a node enters the scene, and every way in (a live entry, a restore, the `safeNode` recovery) waits for all of them before the scene is mounted and the node's gate opens. The keys are `BundleKey`s of `generated/assets.ts`.
|
|
566
566
|
- `app.assets`: `load(bundle)`, `warm(bundle)` (loads it if needed, then puts its textures and atlas pages on the GPU through `renderer.sync.textures.upload`, `renderer.uploads` a drawn frame; joins a running or finished warm; an unload forgets it; resolves also when the renderer could not upload; headless at once), `unload(bundle)`, `isLoaded(bundle)`, `has(bundle)` (the manifest carries it, loaded or not), `texture(key)`, `font(key)`, `audio(key)`, `usage()`. Per bundle in a feature's `assets.ts`: `defineBundles({ ep01: { tier: "feature", release: "leave", mipmaps: ["items/**"] } })`. `release: "leave"` also unloads the bundle, with reason `"leave"`, at the next rest once nothing holds it: not pinned by the node entered, not named by the mounted scene, no node of its feature on the stack; a bundle the outgoing scene named leaves one rest later. The default `"budget"` leaves only under the texture budget. `mipmaps` (`true` or globs relative to `assets/`) uploads the textures with their full chain; such a texture stays loose in a pack. A sub-feature with resources gets its own bundles, named like its folder, with `dir` and `parent` in the manifest; a code-only one has none. The effect `ready(bundle | bundles)` (root export, also from `defineGame`) lets a node rest on a load and stay answerable: its handler (fast mode too) answers `true` headless, throws for an unknown bundle, answers `true` when every bundle is loaded and warmed or its last warm failed (`ctx.log.warn("assets:ready-failed", { bundle, error })`, cleared by a later successful load), otherwise starts `warm` for what is missing, answers `false` and posts `{ type: "ready" }` into `flow.inbox` once all of it settled. Recipe: a rest node `inbox: ["elapsed", "ready"]` with outcomes `ready` and `back`, and a transit node `if ((await fx(ready(list))) === false) return out.wait();`. `companions.add({ load(bundle), unload(bundle) })` adds what loads and unloads with every bundle; `i18n` adds the strings of a sub-feature that way, only when `assets` is composed. Events `assets:bundle-loaded`, `assets:bundle-progress`, `assets:bundle-unloaded` (`reason: "budget" | "request" | "leave"`), `assets:replaced` (dev). Config: `manifest`, `textureBudgetMb: 192`, `preloadDepth: 2`, `baseUrl`, `io`.
|
|
567
567
|
- `resource(name, defaults)` clones plain JSON defaults into every world. `resource(name, () => value)` calls the factory once per world on first read, so the value may hold a `Map` or a function: `const Looks = resource("boardLooks", () => ({ shown: new Map<World.Entity, { look: string }>() }))`. A system keeps its own state there; `snapshot()` leaves a value that is not JSON out.
|
|
@@ -570,6 +570,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
|
|
|
570
570
|
- Motion hooks are told why they play: `enter(view, item, hint, cause)` and `exit(view, item, hint, cause)` get `World.MotionCause`, `"mount"` (the view comes or goes with its screen: a mount, an unmount, a load, a restore, a paused or fast world) or `"change"` (a commit). A world projection plays them only for `"change"`; `ui` plays them for both. `app.world.projection.causeOf(entity)` answers how a view came or how it is leaving, also in a removal hook of its despawn, until the next frame.
|
|
571
571
|
- `app.world.projection.replace(spec)` swaps the spec of a registered projection; a mounted one runs its new `view` on the next frame. An unknown name throws. The caller is the dev hot swap.
|
|
572
572
|
- `projection({ …, initialOnly: [[Shape, ["sweep"]]] })`: `view` gives those fields once, at the birth of a view; after that they belong to another writer (a system drawing a timer arc from `Now`), and no changed item, motion, end-of-motion check (`world:view-corrected`), rollback, `settle`, restore or load writes or compares them, as with `mute()` for every view's whole life. Field names are checked per component; a pair with no field throws at register. Absent, every field is the projection's.
|
|
573
|
+
- `from(player, session, sw)`: the third argument is the switch another plugin last handed the projection with `projection.feed(name, sw)`, a `SceneSwitch` `{ from, to, progress }` (the scene left, the scene entered, `progress` 0 to 1), `undefined` for a projection never fed; a `from` with two parameters reads the state alone, as before. A loader reads it: `from: (_player, _session, sw: SceneSwitch | undefined) => ({ to: sw?.to ?? "", progress: sw?.progress ?? 0 })`. World README, "Feeding a projection".
|
|
573
574
|
- `app.input.lock.window(rect | null | undefined)`: the input lock `ui` sets for a guide (`Input.LockWindow` = `{ x, y, w, h }` in reference units, kept by reference and written in place); a press outside reaches no view and answers `flow.gate.state().blocked` or nothing, a drop or trace sample outside finds nothing; `null` locks everything, `undefined` lifts it. The doors `tap`, `press`, `drag`, `swipe`, `trace` are never locked.
|
|
574
575
|
- `input`: one followed pointer. A finger that has not started a gesture (pressed, inside the tap slop, no long press, no trace) gives way to the next finger that goes down, wherever it rests, and its press is cancelled; a finger that started a gesture keeps it. `Pointer.id` is the followed `pointerId` (`-1` at rest): a system that measures the finger's travel starts over when it changes.
|
|
575
576
|
- `Draggable({ payload, carry?, aim? })`: `aim: { x, y }`, a point of the view in its own units, moves the hover and the drop lookup from the finger to that point of the view in the hand; `null` (default) is the finger.
|