@moku-labs/game 0.15.8 → 0.15.10
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 +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-DWyII1jn.d.mts → commands-DoMH0hnR.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/{define-Bebctfvs.d.mts → define-B8A5IoeS.d.mts} +2 -2
- package/dist/{headless-DobgwTKK.d.mts → headless-CrxofjLt.d.mts} +1 -1
- package/dist/{index-B3dfnsUZ.d.mts → index-PbX7OQIC.d.mts} +3 -3
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/dist/inspect.d.mts +6 -6
- package/dist/inspect.mjs +1 -1
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{runtime-gnMApclv.d.mts → runtime-Bk_rHR3K.d.mts} +1 -1
- package/dist/{sources-OvHvyeJS.mjs → sources-QCowxSpC.mjs} +1 -1
- package/dist/{src-DNVAJHwd.mjs → src-zXAFOqEc.mjs} +359 -60
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +1 -1
- package/dist/{types-CPxx3NSG.d.mts → types-B73p1XBn.d.mts} +2 -2
- package/dist/{types-BcEtn9XV.d.mts → types-Dr5uC2fS.d.mts} +4 -4
- package/dist/{types-CYoGvBkh.d.mts → types-DwktxRrt.d.mts} +18 -6
- package/dist/{types-Mj75CDO6.d.mts → types-YXykgTOp.d.mts} +2 -2
- package/dist/{types-C4D9UVgb.d.mts → types-i77Nrrv-.d.mts} +29 -16
- package/dist/{visual-2m4wJL_z.mjs → visual-CIUx49C0.mjs} +26 -6
- package/dist/{visual-CxQ4Iqd3.d.mts → visual-CQnurNOj.d.mts} +6 -6
- package/dist/visual.d.mts +1 -1
- package/dist/visual.mjs +1 -1
- package/llms.txt +4 -3
- package/package.json +1 -1
package/dist/testing.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Cr as Json, Yn as FeaturePlugin, Zn as AnyFlow, _r as FakeClock, dr as Hint, fr as NodeFx, hr as ClockSource, rr as NodeTable, sr as Descriptor } from "./types-
|
|
2
|
-
import { t as createApp } from "./index-
|
|
3
|
-
import { b as saveOf, v as WithGameState, y as memory } from "./types-
|
|
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-
|
|
1
|
+
import { Cr as Json, Yn as FeaturePlugin, Zn as AnyFlow, _r as FakeClock, dr as Hint, fr as NodeFx, hr as ClockSource, rr as NodeTable, sr as Descriptor } from "./types-i77Nrrv-.mjs";
|
|
2
|
+
import { t as createApp } from "./index-PbX7OQIC.mjs";
|
|
3
|
+
import { b as saveOf, v as WithGameState, y as memory } from "./types-Dr5uC2fS.mjs";
|
|
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-CrxofjLt.mjs";
|
|
5
5
|
import { AnyPluginInstance } from "@moku-labs/core";
|
|
6
6
|
|
|
7
7
|
//#region src/plugins/clock/fake.d.ts
|
package/dist/testing.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { an as refuseStart, ln as type, m as flattenFeatures, on as exit, t as createApp } from "./src-
|
|
1
|
+
import { an as refuseStart, ln as type, m as flattenFeatures, on as exit, t as createApp } from "./src-zXAFOqEc.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-BA6ffzqD.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $r as Require, A as PixiModule, An as TrackOptions, At as FilterSlotInputs, Cr as Json, E as Api$4, En as NumericFields, M as PixiTexture, Mt as Point, Nn as Api$2, Pt as FilterCache, Qr as Events$2, Qt as Api$3, Sn as Ease, Sr as Events$3, Tn as MotionHandle, Ur as Api$1, an as AnyComponentValue, br as Api$6, cn as ComponentType, j as PixiSprite, jn as TrackSegment, k as PixiFilter, kn as ReducedMotion, kt as FilterSlot, on as ComponentHandle, or as TypeTag, rn as AnyComponent, s as Events$1, sr as Descriptor, t as Api$5, un as Entity, v as Events$4, zr as Events$5 } from "./types-
|
|
2
|
-
import { C as TextApi, L as I18nApi, M as InputApi, Y as StylesState, c as UiNode, i as Finding, n as ElementChange, o as JsxState, r as ElementMotion } from "./types-
|
|
1
|
+
import { $r as Require, A as PixiModule, An as TrackOptions, At as FilterSlotInputs, Cr as Json, E as Api$4, En as NumericFields, M as PixiTexture, Mt as Point, Nn as Api$2, Pt as FilterCache, Qr as Events$2, Qt as Api$3, Sn as Ease, Sr as Events$3, Tn as MotionHandle, Ur as Api$1, an as AnyComponentValue, br as Api$6, cn as ComponentType, j as PixiSprite, jn as TrackSegment, k as PixiFilter, kn as ReducedMotion, kt as FilterSlot, on as ComponentHandle, or as TypeTag, rn as AnyComponent, s as Events$1, sr as Descriptor, t as Api$5, un as Entity, v as Events$4, zr as Events$5 } from "./types-i77Nrrv-.mjs";
|
|
2
|
+
import { C as TextApi, L as I18nApi, M as InputApi, Y as StylesState, c as UiNode, i as Finding, n as ElementChange, o as JsxState, r as ElementMotion } from "./types-DwktxRrt.mjs";
|
|
3
3
|
import { Log } from "@moku-labs/common/browser";
|
|
4
4
|
import { PluginCtx } from "@moku-labs/core";
|
|
5
5
|
import { Node, Yoga } from "yoga-layout/load";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as PixiModule, Ar as SaveDoc, Cr as Json, D as Config$2, Fn as Config$1, Nr as SnapshotOf, Or as PlayerStateProvider, Yn as FeaturePlugin, Zn as AnyFlow, _r as FakeClock, a as Config$3, d as Manifest, hr as ClockSource, jt as Orientation, kr as ProviderCall, n as AssetsIo, or as TypeTag, xr as Config } from "./types-
|
|
2
|
-
import { o as AudioContextLike, s as Config$4 } from "./types-
|
|
3
|
-
import { H as StringTable, L as I18nApi, U as TextKey } from "./types-
|
|
4
|
-
import { ft as platformPlugin, i as screen, mt as PlatformProvider, t as createApp, wt as audioPlugin, xt as effectsPlugin } from "./index-
|
|
1
|
+
import { A as PixiModule, Ar as SaveDoc, Cr as Json, D as Config$2, Fn as Config$1, Nr as SnapshotOf, Or as PlayerStateProvider, Yn as FeaturePlugin, Zn as AnyFlow, _r as FakeClock, a as Config$3, d as Manifest, hr as ClockSource, jt as Orientation, kr as ProviderCall, n as AssetsIo, or as TypeTag, xr as Config } from "./types-i77Nrrv-.mjs";
|
|
2
|
+
import { o as AudioContextLike, s as Config$4 } from "./types-B73p1XBn.mjs";
|
|
3
|
+
import { H as StringTable, L as I18nApi, U as TextKey } from "./types-DwktxRrt.mjs";
|
|
4
|
+
import { ft as platformPlugin, i as screen, mt as PlatformProvider, t as createApp, wt as audioPlugin, xt as effectsPlugin } from "./index-PbX7OQIC.mjs";
|
|
5
5
|
import { AnyPluginInstance } from "@moku-labs/core";
|
|
6
6
|
|
|
7
7
|
//#region src/plugins/model/store/providers/memory.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $r as Require, Cn as Motion, Cr as Json, Dn as ProjectionMotion, E as Api$3, En as NumericFields, Mn as ViewHandle, Nn as Api$1, Nt as ViewportSize, Qt as Api$2, Tn as MotionHandle, Ur as Api, Yt as TransformValue, an as AnyComponentValue, bn as ChangeHook, cn as ComponentType, dr as Hint, in as AnyComponentType, mr as Api$5, pr as Answer, rn as AnyComponent, s as Events$1, sr as Descriptor, t as Api$4, un as Entity, wn as MotionCause, yn as TagType } from "./types-
|
|
1
|
+
import { $r as Require, Cn as Motion, Cr as Json, Dn as ProjectionMotion, E as Api$3, En as NumericFields, Mn as ViewHandle, Nn as Api$1, Nt as ViewportSize, Qt as Api$2, Tn as MotionHandle, Ur as Api, Yt as TransformValue, an as AnyComponentValue, bn as ChangeHook, cn as ComponentType, dr as Hint, in as AnyComponentType, mr as Api$5, pr as Answer, rn as AnyComponent, s as Events$1, sr as Descriptor, t as Api$4, un as Entity, wn as MotionCause, yn as TagType } from "./types-i77Nrrv-.mjs";
|
|
2
2
|
import { Log } from "@moku-labs/common/browser";
|
|
3
3
|
import { PluginCtx } from "@moku-labs/core";
|
|
4
4
|
|
|
@@ -126,6 +126,8 @@ type PositionStyle = {
|
|
|
126
126
|
* // The play glyph of the Watch button, and a dashed ring around a slot.
|
|
127
127
|
* const play: VisualStyle = { shape: "triangle", fill: 0xfffbe8 };
|
|
128
128
|
* const slot: VisualStyle = { stroke: 0x3a2212, strokeWidth: 4, dash: 10, radius: 24 };
|
|
129
|
+
* // The slot timer: the time left as 42 % of a ring, from 12 o'clock clockwise, with round ends.
|
|
130
|
+
* const timer: VisualStyle = { shape: "arc", stroke: 0xc8a15a, strokeWidth: 2.2, sweep: 0.42, cap: "round" };
|
|
129
131
|
* ```
|
|
130
132
|
*/
|
|
131
133
|
type VisualStyle<Asset extends string = string> = {
|
|
@@ -136,11 +138,19 @@ type VisualStyle<Asset extends string = string> = {
|
|
|
136
138
|
alpha?: number;
|
|
137
139
|
/**
|
|
138
140
|
* The shape of the rectangle an element without a nine-slice is drawn with: `"rect"` (the
|
|
139
|
-
* default)
|
|
140
|
-
* element with `rotation` for another direction
|
|
141
|
+
* default), `"triangle"`, which fills the box pointing right and ignores `radius` (turn the
|
|
142
|
+
* element with `rotation` for another direction), or `"arc"`, a `stroke` of `strokeWidth` on the
|
|
143
|
+
* circle inscribed in the box (`min(width, height) − strokeWidth` across, centred) from 12 o'clock
|
|
144
|
+
* clockwise over `sweep` of it. An arc draws no `fill` and ignores `radius` and `dash`.
|
|
141
145
|
*/
|
|
142
|
-
shape?: "rect" | "triangle"; /** The dash length of the stroke in reference units, with gaps of half a dash; 0 is solid. */
|
|
146
|
+
shape?: "rect" | "triangle" | "arc"; /** The dash length of the stroke in reference units, with gaps of half a dash; 0 is solid. */
|
|
143
147
|
dash?: number;
|
|
148
|
+
/**
|
|
149
|
+
* The share of the circle an arc sweeps, from 0 to 1 (1 by default): 0 draws nothing, 1 a
|
|
150
|
+
* closed ring; a value outside is clamped. A new value in a render draws the arc again once.
|
|
151
|
+
*/
|
|
152
|
+
sweep?: number; /** How an open arc ends: `"round"` (the default) or `"butt"`, flat at its end. */
|
|
153
|
+
cap?: "round" | "butt";
|
|
144
154
|
/**
|
|
145
155
|
* The asset key of a nine-slice drawn at the rect instead of the rounded rectangle. Any tag
|
|
146
156
|
* but `image`, `icon` and `text` takes it; a clipping element (`scroll`, `overflow: "hidden"`)
|
|
@@ -2531,7 +2541,8 @@ type StyleBasis = {
|
|
|
2531
2541
|
* `cause` is why the element appeared: `"mount"` when it came with the first build of its root and
|
|
2532
2542
|
* the root came by a mount, `"change"` otherwise; its `enter` hook is told. `rebuilds` counts the
|
|
2533
2543
|
* patches in a row that brought a loop of another reference that is not really another loop: a
|
|
2534
|
-
* dev build names the element once it reaches three.
|
|
2544
|
+
* dev build names the element once it reaches three. `endless` holds the motions a hook returned
|
|
2545
|
+
* after it started a track that repeats forever: they never end, so no exit waits for them (F42).
|
|
2535
2546
|
*/
|
|
2536
2547
|
type Element = {
|
|
2537
2548
|
entity: Entity;
|
|
@@ -2581,7 +2592,8 @@ type Element = {
|
|
|
2581
2592
|
width: number;
|
|
2582
2593
|
height: number;
|
|
2583
2594
|
};
|
|
2584
|
-
basis?: StyleBasis;
|
|
2595
|
+
basis?: StyleBasis; /** The motions of its hooks that started a `repeat: "forever"` track; made with the first one. */
|
|
2596
|
+
endless?: Set<MotionHandle>;
|
|
2585
2597
|
};
|
|
2586
2598
|
/**
|
|
2587
2599
|
* The popup side of a root: the handler that shows it now and the root it was opened over.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Cr as Json, Mr as Snapshot } from "./types-
|
|
2
|
-
import { t as HeadlessApp } from "./headless-
|
|
1
|
+
import { Cr as Json, Mr as Snapshot } from "./types-i77Nrrv-.mjs";
|
|
2
|
+
import { t as HeadlessApp } from "./headless-CrxofjLt.mjs";
|
|
3
3
|
import { Log } from "@moku-labs/common/browser";
|
|
4
4
|
|
|
5
5
|
//#region src/plugins/flow/doors/types.d.ts
|
|
@@ -6626,14 +6626,20 @@ type DisplayValue = {
|
|
|
6626
6626
|
object: unknown;
|
|
6627
6627
|
};
|
|
6628
6628
|
/**
|
|
6629
|
-
* A filled rounded rectangle or
|
|
6630
|
-
*
|
|
6631
|
-
*
|
|
6632
|
-
*
|
|
6633
|
-
*
|
|
6634
|
-
*
|
|
6635
|
-
*
|
|
6636
|
-
*
|
|
6629
|
+
* A filled rounded rectangle, a triangle or an arc, anchored at the top left of the `Transform`. `kind` picks the
|
|
6630
|
+
* outline: `"rect"` (the default), `"triangle"`, which fills its `w × h` box pointing right (rotate the element for
|
|
6631
|
+
* another direction) and ignores `radius`, or `"arc"`. `fillAlpha` is the alpha of the fill alone: 0 draws only the
|
|
6632
|
+
* stroke, a ring. `alpha` fades the whole shape and the entity's children: a disabled button at 0.6 draws its icon at
|
|
6633
|
+
* 0.6 too. `dash` is the dash length of the stroke in reference units, with gaps of half a dash; 0 strokes a solid
|
|
6634
|
+
* line. `clip` masks the children of the entity to the shape, always solid, which is how `ui` draws a scroll and an
|
|
6635
|
+
* overflow. The shape itself is never masked, so its stroke is drawn whole. An arc is a stroke on the circle inscribed
|
|
6636
|
+
* in the box: its diameter is `min(w, h) − strokeWidth`, centred, so the stroke stays inside the box. It starts at 12
|
|
6637
|
+
* o'clock and runs clockwise over `sweep` of the circle (0 to 1, clamped): 0 draws nothing, 1 a closed ring. `cap` ends
|
|
6638
|
+
* an open arc round or flat (`"butt"`). Both are optional: left out, `sweep` is 1 and `cap` is `"round"`
|
|
6639
|
+
* (`arcDefaults`). Only an arc reads them; a rectangle or a triangle ignores them. An arc draws only its stroke, in
|
|
6640
|
+
* `stroke`, `strokeWidth` and `alpha`: `fill`, `fillAlpha`, `radius` and `dash` are ignored, and `clip` masks the
|
|
6641
|
+
* children to its box. The path is built again only when a field it is drawn from changes: a still arc costs nothing a
|
|
6642
|
+
* frame, a new `fill` builds no arc again.
|
|
6637
6643
|
*
|
|
6638
6644
|
* @example
|
|
6639
6645
|
* ```ts
|
|
@@ -6649,10 +6655,12 @@ type DisplayValue = {
|
|
|
6649
6655
|
* // The play glyph of a watch button, and a dashed focus ring: 10 u dashes, 5 u gaps.
|
|
6650
6656
|
* const play: ShapeValue = { ...ring, kind: "triangle", w: 36, h: 40, fillAlpha: 1, strokeWidth: 0 };
|
|
6651
6657
|
* const focus: ShapeValue = { ...ring, w: 200, h: 80, stroke: 0x3a2212, strokeWidth: 4, dash: 10 };
|
|
6658
|
+
* // The time left on a slot's timer: 42 % of a ring 25.8 u across in a 28 u box, from 12 o'clock clockwise, round ends.
|
|
6659
|
+
* const timer: ShapeValue = { ...ring, kind: "arc", w: 28, h: 28, stroke: 0xc8a15a, strokeWidth: 2.2, sweep: 0.42 };
|
|
6652
6660
|
* ```
|
|
6653
6661
|
*/
|
|
6654
6662
|
type ShapeValue = {
|
|
6655
|
-
kind: "rect" | "triangle";
|
|
6663
|
+
kind: "rect" | "triangle" | "arc";
|
|
6656
6664
|
w: number;
|
|
6657
6665
|
h: number;
|
|
6658
6666
|
fill: number;
|
|
@@ -6662,7 +6670,9 @@ type ShapeValue = {
|
|
|
6662
6670
|
stroke: number;
|
|
6663
6671
|
strokeWidth: number;
|
|
6664
6672
|
dash: number;
|
|
6665
|
-
clip: boolean;
|
|
6673
|
+
clip: boolean; /** The share of the circle an arc sweeps, 0 to 1, from 12 o'clock clockwise; clamped. Only an arc reads it: 1 left out. */
|
|
6674
|
+
sweep?: number; /** How an open arc ends: `"round"` or `"butt"` (flat at its end). Only an arc reads it: `"round"` left out. */
|
|
6675
|
+
cap?: "round" | "butt";
|
|
6666
6676
|
};
|
|
6667
6677
|
/**
|
|
6668
6678
|
* What `sprite()` takes: the two things every visual needs, and the four that have defaults.
|
|
@@ -6762,9 +6772,10 @@ declare const Parent: ComponentType<{
|
|
|
6762
6772
|
*/
|
|
6763
6773
|
declare const Display: ComponentType<DisplayValue>;
|
|
6764
6774
|
/**
|
|
6765
|
-
* A filled rounded rectangle
|
|
6766
|
-
*
|
|
6767
|
-
* `clip: true` masks the children of the entity to the
|
|
6775
|
+
* A filled rounded rectangle, a right-pointing triangle or an arc (`kind: "arc"`, a stroke from 12 o'clock clockwise
|
|
6776
|
+
* over `sweep` of the circle in its box), drawn with Pixi `Graphics` and redrawn only when a field changed.
|
|
6777
|
+
* `fillAlpha: 0` draws only the stroke, `dash` above 0 dashes it. `clip: true` masks the children of the entity to the
|
|
6778
|
+
* shape.
|
|
6768
6779
|
*/
|
|
6769
6780
|
declare const Shape: ComponentType<ShapeValue>;
|
|
6770
6781
|
/**
|
|
@@ -7241,7 +7252,7 @@ type HitBox = {
|
|
|
7241
7252
|
*/
|
|
7242
7253
|
type DrawnShape = {
|
|
7243
7254
|
/** Drawn white, coloured by the object's tint (no stroke); false for a shape painted in its own colours. */tinted: boolean;
|
|
7244
|
-
kind: "
|
|
7255
|
+
kind: ShapeValue["kind"];
|
|
7245
7256
|
w: number;
|
|
7246
7257
|
h: number;
|
|
7247
7258
|
fill: number;
|
|
@@ -7249,14 +7260,16 @@ type DrawnShape = {
|
|
|
7249
7260
|
radius: number;
|
|
7250
7261
|
stroke: number;
|
|
7251
7262
|
strokeWidth: number;
|
|
7252
|
-
dash: number;
|
|
7263
|
+
dash: number; /** An arc's `sweep` as the value held it, `undefined` when left out. */
|
|
7264
|
+
sweep: number | undefined; /** An arc's `cap` as the value held it, `undefined` when left out. */
|
|
7265
|
+
cap: ShapeValue["cap"];
|
|
7253
7266
|
};
|
|
7254
7267
|
/**
|
|
7255
7268
|
* The fields of the clip rectangle last drawn into a view's mask: an equal value draws no mask again. Private to
|
|
7256
7269
|
* `sync`.
|
|
7257
7270
|
*/
|
|
7258
7271
|
type ClipDrawn = {
|
|
7259
|
-
kind: "
|
|
7272
|
+
kind: ShapeValue["kind"];
|
|
7260
7273
|
w: number;
|
|
7261
7274
|
h: number;
|
|
7262
7275
|
radius: number;
|
|
@@ -195,6 +195,18 @@ const Now = /*#__PURE__*/ resource("Now", { now: 0 });
|
|
|
195
195
|
* part), the engine's own overlay level, and the `sprite()` bundle helper. Pure: no ctx, no state, no Pixi. Made with the `component()` helper of `world`, so nothing has
|
|
196
196
|
* to be registered.
|
|
197
197
|
*/
|
|
198
|
+
/**
|
|
199
|
+
* What an arc draws with when its `Shape` leaves `sweep` or `cap` out: the whole ring, round ends.
|
|
200
|
+
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* arcDefaults.sweep; // 1
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
const arcDefaults = Object.freeze({
|
|
207
|
+
sweep: 1,
|
|
208
|
+
cap: "round"
|
|
209
|
+
});
|
|
198
210
|
const overlayDefaults = {
|
|
199
211
|
dim: 0,
|
|
200
212
|
dimColor: 0,
|
|
@@ -270,9 +282,10 @@ const Parent = /*#__PURE__*/ component("Parent", { entity: 0 });
|
|
|
270
282
|
*/
|
|
271
283
|
const Display = /*#__PURE__*/ component("Display", displayDefaults);
|
|
272
284
|
/**
|
|
273
|
-
* A filled rounded rectangle
|
|
274
|
-
*
|
|
275
|
-
* `clip: true` masks the children of the entity to the
|
|
285
|
+
* A filled rounded rectangle, a right-pointing triangle or an arc (`kind: "arc"`, a stroke from 12 o'clock clockwise
|
|
286
|
+
* over `sweep` of the circle in its box), drawn with Pixi `Graphics` and redrawn only when a field changed.
|
|
287
|
+
* `fillAlpha: 0` draws only the stroke, `dash` above 0 dashes it. `clip: true` masks the children of the entity to the
|
|
288
|
+
* shape.
|
|
276
289
|
*/
|
|
277
290
|
const Shape = /*#__PURE__*/ component("Shape", shapeDefaults);
|
|
278
291
|
/**
|
|
@@ -724,7 +737,8 @@ function contentOf(props) {
|
|
|
724
737
|
/**
|
|
725
738
|
* The visual component of an element: a sprite for an image or an icon, the text for a text, the
|
|
726
739
|
* nine-slice of its style (outlined when the style sets `debug`), or a rounded rectangle, a
|
|
727
|
-
* triangle with `shape: "triangle"`, its stroke dashed with `dash
|
|
740
|
+
* triangle with `shape: "triangle"`, its stroke dashed with `dash`, or an arc with `shape: "arc"`
|
|
741
|
+
* over the `sweep` of its style, ended by its `cap`. A clipping element (`scroll`,
|
|
728
742
|
* `overflow: "hidden"`) keeps the rectangle, which carries the clip; a text field's rectangle
|
|
729
743
|
* clips too, and a nine-slice field draws its slices and clips to them. A style with a stroke and
|
|
730
744
|
* no fill draws only the stroke, a ring. A container with no fill and no stroke gets a rectangle that draws
|
|
@@ -775,7 +789,7 @@ function visualOf(element) {
|
|
|
775
789
|
})];
|
|
776
790
|
const filled = style.fill !== void 0 || style.stroke !== void 0;
|
|
777
791
|
const invisible = isContainer(type) && !filled;
|
|
778
|
-
|
|
792
|
+
const shape = {
|
|
779
793
|
kind: style.shape ?? "rect",
|
|
780
794
|
w: rect.w,
|
|
781
795
|
h: rect.h,
|
|
@@ -787,6 +801,12 @@ function visualOf(element) {
|
|
|
787
801
|
strokeWidth: invisible ? 0 : style.strokeWidth ?? 0,
|
|
788
802
|
dash: style.dash ?? 0,
|
|
789
803
|
clip: clip || type === "input"
|
|
804
|
+
};
|
|
805
|
+
if (shape.kind !== "arc") return [Shape(shape)];
|
|
806
|
+
return [Shape({
|
|
807
|
+
...shape,
|
|
808
|
+
sweep: style.sweep ?? arcDefaults.sweep,
|
|
809
|
+
cap: style.cap ?? arcDefaults.cap
|
|
790
810
|
})];
|
|
791
811
|
}
|
|
792
812
|
/**
|
|
@@ -895,4 +915,4 @@ function drawnRect(pose, local) {
|
|
|
895
915
|
};
|
|
896
916
|
}
|
|
897
917
|
//#endregion
|
|
898
|
-
export {
|
|
918
|
+
export { Now as A, Sprite as C, sprite as D, componentsFor as E, resource as F, system as I, systemsFor as L, Tree as M, component as N, Exiting as O, mut as P, tag as R, Shape as S, arcDefaults as T, HudPart as _, scaleByFits as a, OverlayLevel as b, Countdown as c, builtInStyles as d, defineTextStyles as f, Display as g, textFor as h, samePose as i, Order as j, Layer as k, Text as l, readStyle as m, drawnRect as n, visualOf as o, label as p, fitScaleOf as r, visualRectOf as s, CONTENT as t, bind as u, NineSlice as v, Transform as w, Parent as x, Overlay as y };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { E as Api, Lr as Api$3, Qt as Api$1, br as Api$2 } from "./types-
|
|
2
|
-
import { P as AnimApi, r as UiApi } from "./types-
|
|
3
|
-
import { M 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 { E as Api, Lr as Api$3, Qt as Api$1, br as Api$2 } from "./types-i77Nrrv-.mjs";
|
|
2
|
+
import { P as AnimApi, r as UiApi } from "./types-B73p1XBn.mjs";
|
|
3
|
+
import { M as InputApi } from "./types-DwktxRrt.mjs";
|
|
4
|
+
import { r as Repro } from "./headless-CrxofjLt.mjs";
|
|
5
|
+
import { a as InputOf, r as ControlApp } from "./types-YXykgTOp.mjs";
|
|
6
|
+
import { t as commands } from "./commands-DoMH0hnR.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-CQnurNOj.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,4 +1,4 @@
|
|
|
1
|
-
import { n as read, t as sources } from "./sources-
|
|
1
|
+
import { n as read, t as sources } from "./sources-QCowxSpC.mjs";
|
|
2
2
|
import { n as commands, t as run } from "./run-BqYmcNo7.mjs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { createBrandConsole } from "@moku-labs/common/cli";
|
package/llms.txt
CHANGED
|
@@ -521,7 +521,8 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
|
|
|
521
521
|
|
|
522
522
|
`world`, `renderer`, `input`, `assets`, `scenes`. Each has a README at `src/plugins/<name>/README.md`; the root README lists their APIs, events and config. Rendering: WebGPU preferred, with Pixi's WebGL fallback.
|
|
523
523
|
- `app.scenes`: `current()` the mounted scene id, `expect(id)` the scene the next node without its own `scene` mounts, a rest node or a transit node in live mode (the restore door calls it; an unknown id throws). An `over` node takes it the same way, also over another mounted scene.
|
|
524
|
-
-
|
|
524
|
+
- `Shape({ kind, w, h, fill, fillAlpha, alpha, radius, stroke, strokeWidth, dash, clip, sweep?, cap? })` (`kind: "rect"`; `sweep` and `cap` are optional, `1` and `"round"` when left out; only an arc reads them; a rectangle or a triangle ignores them, also when an earlier arc left them on the `Shape`): a rounded rectangle, `kind: "triangle"` (fills its box pointing right) or `kind: "arc"`: a stroke on the circle inscribed in the box (`min(w, h) − strokeWidth` across, centred) from 12 o'clock clockwise over `sweep` (0..1, clamped; 0 draws nothing, 1 a closed ring), ended by `cap` (`"round" | "butt"`); an arc draws no fill and ignores `radius` and `dash`. The path is built again only when a field changes: a still arc costs nothing a frame. `Shape({ kind: "arc", w: 28, h: 28, stroke: 0xc8a15a, strokeWidth: 2.2, sweep: 0.42 })` is a slot timer's ring with 42 % left.
|
|
525
|
+
- Overlays: `Overlay({ dim, dimColor, cover, hud, fade })` 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; 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.
|
|
525
526
|
- 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" }>()`.
|
|
526
527
|
- 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.
|
|
527
528
|
- 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`.
|
|
@@ -540,7 +541,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
|
|
|
540
541
|
- Overdraw heat map (dev and debug builds): `app.renderer.sync.debug.overdraw(true)` (or `game.debug { overdraw: true }`) draws every frame so a pixel's brightness counts the layers drawn there: 1/16 white a layer, white at sixteen. While on, every frame is drawn (also with `onDemand`), kept pictures draw live and filters are off; only the stage pass changes, the tree between frames stays the game's, and off draws the game again from the next frame. Texels a texture leaves transparent count nothing.
|
|
541
542
|
- `app.renderer.viewport.size()` answers one frozen object, replaced only when the frame changes (a resize, a rotation, new insets, a new scale): compare frames with `===`; a write into it throws a `TypeError`.
|
|
542
543
|
- `pluginConfigs.renderer.warm` (default `1`, 0 to 16) is the pipeline warm-up: while a game loads, each drawn frame first draws that many invisible probes (sprites, graphics, text, particles, every filter kind and stage `effects` registers, on the canvas and on a texture, with and without a clip), wiped by the stage pass, so no screen creates a GPU pipeline in the frame it opens in; `0` turns it off. `app.renderer.sync.filters.warm(filter)` warms a game's own filter (answers `true` once drawn). An agent build writes a `warm` event `{ draws }` when the queue empties.
|
|
543
|
-
- `defineFilter(id, { area: value => [x, y, width, height] })` declares the box, in the entity's own units, outside of which the filter draws nothing: Pixi renders and fills only that box (a lens over a full-screen cover fills its disc, not the screen). The view gets the union of its enabled filters' areas, none when an enabled filter declares none (`renderer.sync.filters.area(entity, area)`). Distance-field text uses device pixels for its edge: sharper at a resolution above 1.
|
|
544
|
+
- `defineFilter(id, { area: value => [x, y, width, height] })` declares the box, in the entity's own units, outside of which the filter draws nothing: Pixi renders and fills only that box (a lens over a full-screen cover fills its disc, not the screen). The view gets the union of its enabled filters' areas, none when an enabled filter declares none (`renderer.sync.filters.area(entity, area)`). The area also clips the view's own children: Pixi draws nothing of the view outside it, so a shadow or a badge that overhangs the box is cut; make the box hold them. The full-screen filter budget and the kept-picture budget count a view with an area by that area, not by its box. Distance-field text uses device pixels for its edge: sharper at a resolution above 1.
|
|
544
545
|
- `pluginConfigs.renderer.poolTrim` (default `{ restMs: 1000, aboveMb: 16 }`) gives back the idle render targets Pixi's texture pool keeps, strictly between frames: after `restMs` of a still screen (`onDemand`), `restMs` after a scene change (each when the targets grew by `aboveMb` MiB), and on a pause (whatever grew); `false` keeps them. `stats().textureMbSplit.targets` shows the drop; an agent build writes a `pool-trim` event `{ reason, freedMb }`.
|
|
545
546
|
- `app.renderer.viewport.size().safeArea` is read from four CSS custom properties on the page, `--moku-safe-top`, `--moku-safe-right`, `--moku-safe-bottom`, `--moku-safe-left`, each falling back to `env(safe-area-inset-*, 0px)`. Any CSS length works (`max()`, `calc()`, `env()`); a negative one counts as 0. A change of a property or of the page's insets, and the window event `moku-native:insets`, is laid out at the next frame. There is no `setInsets`: set the properties, e.g. `:root { --moku-safe-top: max(env(safe-area-inset-top, 0px), 24px); }`.
|
|
546
547
|
|
|
@@ -549,7 +550,7 @@ The graph. Modules `runner`, `gate`, `inbox`, `fx`, `features`. Runner methods s
|
|
|
549
550
|
A screen is a projection whose `view` returns JSX. The game's `tsconfig.json` sets `"jsx": "react-jsx"` and `"jsxImportSource": "@moku-labs/game"`; screens are `.tsx` files. There is no DOM and no React.
|
|
550
551
|
|
|
551
552
|
- Tags: `screen`, `layer`, `row`, `column`, `stack`, `spacer`, `panel` (swallows taps), `image` (`texture`, `fit?: "contain" | "cover" | "fill"`), `icon` (`name`, `fit?`), `text` (`content: string | Message`, or `bind={bind(Counter, "value")}` with `components={[Counter({ value })]}`; formats `int`, `mm:ss`, `h:mm:ss`, `duration`; `Countdown({ until })` with `bind(Countdown, "left", { format: "mm:ss" })` counts down to a `clock` moment; `style` is a text style key), `button` (`intent` + `payload`, or `local`, never both), `scroll` (`axis?: "x" | "y"` (`"y"`), fixed at spawn, another one later warns `ui:scroll-axis-fixed`; children for a short list, laid out as a column on `y` and a row on `x`, or the windowed form `rows`, `rowHeight`, `overscan?` (5), `row: index => node`, on `y` only: `axis: "x"` with `rows` throws `[game] A windowed scroll moves on y only.`; row state belongs in the model, a row that leaves the window loses its local state; `snap?: number[]` stops in offsets, kept inside `0..max`: a release glides to the stop nearest `offset + v × 260` (v in units a ms) on `1 − (1 − p)³` over `min(620, 260 + distance × 1.1)` ms; without `snap` a release flings, `v ×= 0.998` a ms until under 0.02, 0 when the finger rested over 50 ms; `offset?: number` (0) where it stands from the start, drawn there in its first frame, a new value glides there, the same value does nothing; hard edges, nothing passes on to a parent scroll; a press on a child that leaves the tap slop along the scroll's axis goes to the scroll and the child answers nothing, a finger on a moving scroll only stops it; every number in `time.delta` ms, so a time scale applies; the public component `ScrollState { offset, max, moving }` on its entity, whole units `0..max`, written when it changes and once with `moving: false` when it stops, read by a system and by `game.explain`; `app.ui.scroll(key, to)` and the visual step `{ scroll: { key, to } }` set it at once), `input` (a text field; its text lives in the component's `local`, see the ui README). Common props: `key`, `style`, `state: { active?, disabled?, selected? }`, `motion`, `components` (extra component values for the element's entity, such as a filter: `components={[Glow({ strength: 2 })]}`, or `DebugTrigger()`: five taps within 3000 ms of wall time on that view call `app.debug.overlay.open()` on a page with the agent flag, nothing elsewhere; put it on a `button` naming nothing); containers take `hosts?: string[]` (projections drawn inside the element: world views hang under it from the slot's first frame; a JSX projection is laid out in the slot's content box). Children draw and are hit in markup order at equal `zIndex`; the roots of a scene draw in the order of its `projections` (the `ui` layer sorts by `Order`; `ui: { sort: "none" }` keeps insertion order). `defineMotion({ when: "change" })` plays its `enter` and `exit` only for a commit or a popup, never when its screen mounts or unmounts; declare a motion at module level (`ui:motion-rebuilt` names a loop rebuilt in a view). Style adds `nineSlice`, `tint`, `offsetX`, `offsetY`, `scale`, `origin`, `fit: "contain"`; state variants `is: { hover, pressed, disabled, active, selected, covered }`. `popup(Component, props, { over })` stacks a popup over a kept one.
|
|
552
|
-
- Style vocabulary (`defineStyle`, plain data): flow `direction`, `wrap`, `justify`, `align`, `alignSelf`, `gap`, `grow`, `shrink`; box `padding`, `margin`, `width`, `height`, `minWidth`, `minHeight`, `maxWidth`, `maxHeight`, `aspect`, `overflow`; position `position`, `left`, `top`, `right`, `bottom`, `reason`; visual `fill`, `stroke`, `strokeWidth`, `radius`, `alpha`; variants `is: { pressed?, disabled?, active?, selected? }` and `when: { portrait?, landscape?, tall?, wide? }`, each a partial style merged in when the flag holds. Lengths are reference units or `"safeArea.top" | "safeArea.right" | "safeArea.bottom" | "safeArea.left"`. No font size here: it comes from the text style.
|
|
553
|
+
- Style vocabulary (`defineStyle`, plain data): flow `direction`, `wrap`, `justify`, `align`, `alignSelf`, `gap`, `grow`, `shrink`; box `padding`, `margin`, `width`, `height`, `minWidth`, `minHeight`, `maxWidth`, `maxHeight`, `aspect`, `overflow`; position `position`, `left`, `top`, `right`, `bottom`, `reason`; visual `fill`, `stroke`, `strokeWidth`, `radius`, `alpha`, `shape: "rect" | "triangle" | "arc"` (`"rect"`; a triangle fills the box pointing right; an arc is only a `stroke` of `strokeWidth` on the circle inscribed in the box, `min(width, height) − strokeWidth` across, from 12 o'clock clockwise over `sweep`), `dash` (dash length of the stroke, gaps of half a dash; not on an arc), `sweep` (0..1, default 1, clamped; 0 draws nothing, 1 a closed ring), `cap: "round" | "butt"` (`"round"`; the ends of an open arc); variants `is: { pressed?, disabled?, active?, selected? }` and `when: { portrait?, landscape?, tall?, wide? }`, each a partial style merged in when the flag holds. Lengths are reference units or `"safeArea.top" | "safeArea.right" | "safeArea.bottom" | "safeArea.left"`. No font size here: it comes from the text style.
|
|
553
554
|
- `defineComponent(name, { local?, outcomes?, view(props, local) })`. A component with `outcomes` is a popup: `await fx(popup(Component, props))` opens the gate for its outcomes and resolves with `{ intent, payload }` of the pressed button. A button with `local` writes into the nearest component instance; it never reaches the graph.
|
|
554
555
|
- `tr(key, params?)` returns a frozen `Message` `{ key, params }`; no locale is read at the call site. Strings live in `strings/<locale>.json` of any feature or sub-feature, as ICU MessageFormat 1 (`{n, plural, one {# order} other {# orders}}`, `select`, `selectordinal`, `number`, `date`, `time`; no skeletons, no `currency`). `bun run assets:keys` compiles them. The keys of the top-level features and the layers go into `generated/strings.<locale>.ts`, which one feature registers; a sub-feature's keys start with `<name>.` (`ep01.title`) and go into `generated/strings.<name>.<locale>.ts`, which the sub-feature registers lazily, `strings: { en: () => import("@generated/strings.ep01.en"), ru: () => import("@generated/strings.ep01.ru") }`. With `assets` composed those modules load and unload with the bundle named like the sub-feature: every way the bundle comes (a node entry, a scene's `bundles`, `load`, a restore, the `safeNode`) brings its strings, a locale switch brings them in the new locale, and while the bundle is not loaded a key of it gives `⟦key⟧` and `has(key)` is false. A compiled module calls the root helpers `messageArgument(value, intl)` (an element stays an element part, a list goes through `Intl.ListFormat`, a number through `Intl.NumberFormat`, else text) and `messageDuration(ms)` (`95_000` gives `{ minutes: 1, seconds: 35 }`). `app.i18n`: `locale()`, `setLocale(locale)` (async, emits `i18n:locale-changed`), `format(message, locale?)` returns `Part[]`, `plain(message)` returns a string, `has(key)`, `isKey(value)`, `locales()`, `replace(locale, messages)` (dev hot swap of a generated strings file). Config: `locale: "en"`, `fallback: "en"`, `locales: {}`.
|
|
555
556
|
- Keys that come from data: `I18n.TextKey<Strings>` is the keys of the generated `Strings` without parameters (nothing new is generated). A data table types its keys `TextKey` or builds them with the kit's `key("board.hint.red")`; the kit's `tr` never takes a plain `string`. A key read back from a save is checked where the app is (an effect handler, app or page code, loading a save) with one `isKey(value)`: `defineGameApp({ ..., strings: type<Strings>() })` types the game's `app.i18n`, so a true `app.i18n.isKey(value)` narrows the value to `TextKey`; `ctx.require(i18nPlugin).isKey(value)` in a plugin narrows to `string`. `app.i18n.isKey(value)` answers true for a key of the loaded tables of the current locale or the fallback, and for the `<feature>.` prefix of a sub-feature whose strings are not loaded yet; a key that takes parameters answers true too.
|