@moku-labs/game 0.2.0 → 0.3.0
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 +2 -0
- package/dist/assets.d.mts +181 -22
- package/dist/assets.mjs +1186 -160
- package/dist/{commands-C0BljsM5.d.mts → commands-DYO22lzi.d.mts} +22 -5
- package/dist/control.d.mts +3 -3
- package/dist/control.mjs +3 -3
- package/dist/{define-CjP_4H0G.d.mts → define-BKWjWgyQ.d.mts} +1 -1
- package/dist/dev-CQYJPmcD.mjs +1183 -0
- package/dist/flatten-BkXuscAV.mjs +100 -0
- package/dist/index.d.mts +85 -31
- package/dist/index.mjs +3208 -490
- package/dist/{session-DmAxY6Ll.mjs → input-CK4nxBO1.mjs} +41 -12
- package/dist/inspect.d.mts +32 -9
- package/dist/inspect.mjs +2 -2
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-dev-runtime.mjs +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{run-tlcn1w7y.mjs → run-BfuMLahc.mjs} +489 -213
- package/dist/{runtime-Bn5TXNxP.d.mts → runtime-Bhu442L8.d.mts} +1 -1
- package/dist/{runtime-DRlwxkIv.mjs → runtime-CBZgWgzx.mjs} +1 -57
- package/dist/{sources-BooL2MsX.mjs → sources-C1uGjz4l.mjs} +198 -21
- package/dist/testing.d.mts +5 -5
- package/dist/testing.mjs +5 -4
- package/dist/{types-CxZy7Pi4.d.mts → types-BnWH-75b.d.mts} +95 -21
- package/dist/{types-CqkrEY06.d.mts → types-CVUHPvMB.d.mts} +5 -434
- package/dist/{types-DmhTHRVW.d.mts → types-DtmFVCHf.d.mts} +1 -1
- package/dist/{types-BZ1OLf24.d.mts → types-Dy1xB68L.d.mts} +2318 -1169
- package/dist/{types-X9jXjka3.d.mts → types-VErbiEXy.d.mts} +867 -198
- package/dist/{visual-NPrDkvUk.mjs → visual-DUvvPPCt.mjs} +51 -1
- package/llms.txt +5 -5
- package/package.json +5 -5
- package/dist/component-DGg5DqKK.mjs +0 -44
- package/dist/dev-CcwFrwok.mjs +0 -413
- package/dist/types-C47fKNcn.d.mts +0 -695
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
//#region src/plugins/ui/jsx/component.ts
|
|
2
|
+
/** The local state a component that declares none starts every instance with. */
|
|
3
|
+
const noLocal = {};
|
|
4
|
+
/**
|
|
5
|
+
* Tells a component definition from a plain function component, which JSX calls at build time.
|
|
6
|
+
*
|
|
7
|
+
* @param type - What stood in the tag position.
|
|
8
|
+
* @returns True when `defineComponent` built it.
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* isComponentDefinition(() => ({ type: "row", props: {}, children: [] })); // false
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
function isComponentDefinition(type) {
|
|
15
|
+
return typeof type === "function" && type.isUiComponent === true;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* The one implementation behind the two overloads.
|
|
19
|
+
*
|
|
20
|
+
* @param name - Component name.
|
|
21
|
+
* @param spec - What the game declared.
|
|
22
|
+
* @returns The callable definition.
|
|
23
|
+
*/
|
|
24
|
+
function defineComponent(name, spec) {
|
|
25
|
+
const local = spec.local ?? noLocal;
|
|
26
|
+
const call = (props) => ({
|
|
27
|
+
type: name,
|
|
28
|
+
props,
|
|
29
|
+
children: []
|
|
30
|
+
});
|
|
31
|
+
const definition = Object.assign(call, {
|
|
32
|
+
outcomes: spec.outcomes,
|
|
33
|
+
local,
|
|
34
|
+
view: spec.view,
|
|
35
|
+
isUiComponent: true
|
|
36
|
+
});
|
|
37
|
+
Object.defineProperty(definition, "name", {
|
|
38
|
+
value: name,
|
|
39
|
+
configurable: true
|
|
40
|
+
});
|
|
41
|
+
return definition;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/plugins/ui/jsx/flatten.ts
|
|
45
|
+
/** The type of the node `Fragment` builds. It never reaches a reconcile: `flatten` lifts it. */
|
|
46
|
+
const FRAGMENT = "#fragment";
|
|
47
|
+
/**
|
|
48
|
+
* Builds the node a bare string or number child becomes.
|
|
49
|
+
*
|
|
50
|
+
* @param content - What stood between the tags.
|
|
51
|
+
* @returns A text node carrying it.
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* textNode(5); // { type: "text", props: { content: "5" }, children: [] }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
function textNode(content) {
|
|
58
|
+
return {
|
|
59
|
+
type: "text",
|
|
60
|
+
props: { content: String(content) },
|
|
61
|
+
children: []
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Tells a description node from the other things a child may be.
|
|
66
|
+
*
|
|
67
|
+
* @param child - One child of a tag.
|
|
68
|
+
* @returns True when it is a node.
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* isNode({ type: "row", props: {}, children: [] }); // true
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
function isNode(child) {
|
|
75
|
+
return typeof child === "object" && child !== null && !Array.isArray(child) && "type" in child;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Turns whatever stood between two tags into the children of that tag.
|
|
79
|
+
*
|
|
80
|
+
* @param child - One child, an array of children, or nothing.
|
|
81
|
+
* @returns The children as nodes, fragments lifted and empty values dropped.
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* flatten(["a", undefined, 2]).map(node => node.props.content); // ["a", "2"]
|
|
85
|
+
* ```
|
|
86
|
+
*/
|
|
87
|
+
function flatten(child) {
|
|
88
|
+
if (child === null || child === void 0 || typeof child === "boolean") return [];
|
|
89
|
+
if (typeof child === "string" || typeof child === "number") return [textNode(child)];
|
|
90
|
+
if (Array.isArray(child)) {
|
|
91
|
+
const nodes = [];
|
|
92
|
+
for (const item of child) nodes.push(...flatten(item));
|
|
93
|
+
return nodes;
|
|
94
|
+
}
|
|
95
|
+
if (!isNode(child)) return [];
|
|
96
|
+
if (child.type === "#fragment") return [...child.children];
|
|
97
|
+
return [child];
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { isComponentDefinition as i, flatten as n, defineComponent as r, FRAGMENT as t };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
4
|
-
import { A as
|
|
5
|
-
import { A as FilterValueOf, C as EmitterValue, D as DisplacementValue, E as ColorMatrixValue, M as NoiseValue, N as OutlineValue, O as FilterComponent, P as UniformDeclaration, S as EmitterDefinition, T as BlurValue, _ as EffectsApi, b as types_d_exports$4, c as AnySceneProjection, d as SceneDefinition, f as SceneSpec, g as Config$16, h as types_d_exports$12, i as MusicOptions, j as GlowValue, k as FilterSpec, l as DefineScene, m as State$16, n as Config$15, o as State$14, p as ScenesApi, r as MusicDescriptor, s as types_d_exports$2, t as AudioApi, u as LayerMap, w as AlphaValue, x as EmitterConfig, y as State$15 } from "./types-CxZy7Pi4.mjs";
|
|
1
|
+
import { $ as Ease, A as Config$8, B as ComponentValue, Bt as State$7, Ct as to, Dt as DefineNode, Ft as GuideOptions, G as Narrowed, Ht as types_d_exports$14, It as Hint, J as ResourceType, Jt as State$5, Kt as Json, L as ComponentHandle, M as State$8, Mt as SceneIdOf, N as types_d_exports$16, O as ViewportSize, Pt as Descriptor, Q as DescriptionNode, Rt as Api$5, S as types_d_exports$11, St as slot, Tt as FeatureDescription, W as Mut, Wt as Config$5, X as TagType, Xt as Patch, Y as SystemDefinition, Yt as types_d_exports$9, _n as Events$1, _t as State$3, a as DefineBundles, an as Api$3, at as ProjectionMotion, b as State$6, bt as defineFlow, c as LoadReason, cn as PauseReason, d as Tier, dn as Api$1, dt as BundlesOf, en as SaveUnreadableError, fn as Config$2, ft as Config$3, gn as Config$9, h as Config$6, hn as types_d_exports$3, ht as GameTypes, i as Config$1, it as NumericFields, k as Api$6, ln as State$4, m as Api$4, mn as State$2, mt as FeaturePlugin, n as BundleMap, nn as StoreApi, on as Config$4, ot as ProjectionSpec, p as types_d_exports$1, pt as EmitterIdOf, q as QueryTerm, qt as Root, r as BundleSpec, rn as RngApi, s as LoadBundles, sn as Events, t as Api, u as State$1, un as types_d_exports$8, ut as Api$2, vn as Require, vt as TextStylesOf, wt as type, xt as exit, yt as types_d_exports$5, z as ComponentType, zt as Config$7 } from "./types-Dy1xB68L.mjs";
|
|
2
|
+
import { $ as SpriteValue, A as TextStyleInput, B as types_d_exports$6, C as Config$12, D as TextApi, E as State$11, F as Config$10, G as Display, H as InputApi, I as I18nApi, J as Parent, K as NineSlice, L as Message, M as TextValue, N as types_d_exports$13, O as TextBind, P as Argument, Q as SpriteOptions, R as State$9, S as BindOptions, T as Point, U as State$10, V as Config$11, W as types_d_exports$7, X as ShapeValue, Y as Shape, Z as Sprite, _ as Style, b as defineComponent, d as popup, et as Transform, f as defineTokens, g as ResolvedStyle, h as IsFlags, j as TextStyles, k as TextFormat, l as Box, nt as sprite, p as IntrinsicElementsFor, q as NineSliceValue, s as PopupComponent, tt as TransformValue, u as LocalWrite, w as CountdownValue, x as BindField, y as WhenFlags, z as TypedTr } from "./types-VErbiEXy.mjs";
|
|
3
|
+
import { A as UiApi, C as spawned, D as wait, E as use, O as Config$14, S as spawn, T as tween, _ as parallel, a as State$12, b as set, c as HapticKind, d as HAPTIC_KINDS, f as defineAnimation, g as mark, h as haptic, i as MotionKeyframe, j as types_d_exports$15, k as State$13, l as SfxDescriptor, m as frames, n as Config$13, o as Target, p as external, r as FramesValue, s as types_d_exports, t as AnimApi, u as Step, v as play, w as stagger, x as sfx, y as sequence } from "./types-CVUHPvMB.mjs";
|
|
4
|
+
import { A as FilterValueOf, C as EmitterValue, D as DisplacementValue, E as ColorMatrixValue, M as NoiseValue, N as OutlineValue, O as FilterComponent, P as UniformDeclaration, S as EmitterDefinition, T as BlurValue, _ as EffectsApi, b as types_d_exports$4, c as AnySceneProjection, d as SceneDefinition, f as SceneSpec, g as Config$16, h as types_d_exports$12, i as MusicOptions, j as GlowValue, k as FilterSpec, l as DefineScene, m as State$16, n as Config$15, o as State$14, p as ScenesApi, r as MusicDescriptor, s as types_d_exports$2, t as AudioApi, u as LayerMap, w as AlphaValue, x as EmitterConfig, y as State$15 } from "./types-BnWH-75b.mjs";
|
|
6
5
|
import { Log } from "@moku-labs/common/browser";
|
|
7
6
|
import { PluginCtx } from "@moku-labs/core";
|
|
8
7
|
|
|
@@ -14,6 +13,45 @@ import { PluginCtx } from "@moku-labs/core";
|
|
|
14
13
|
* is patched in place, so a tween on it rebuilds nothing.
|
|
15
14
|
*/
|
|
16
15
|
declare const Text: ComponentType<TextValue>;
|
|
16
|
+
/**
|
|
17
|
+
* Shows a numeric component field of the label's own entity: read every frame, written to
|
|
18
|
+
* `Text.resolved` only when the shown string changes. The field must hold a number; the format
|
|
19
|
+
* is `"int"` (rounded) unless named. Reads the component's own name, so a renamed component
|
|
20
|
+
* cannot drift from its label.
|
|
21
|
+
*
|
|
22
|
+
* @param component - The component whose field the label shows.
|
|
23
|
+
* @param field - A numeric field of that component.
|
|
24
|
+
* @param options - How the number is shown.
|
|
25
|
+
* @returns The bind a `Text` carries.
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const Counter = component("Counter", { value: 0 });
|
|
29
|
+
*
|
|
30
|
+
* bind(Counter, "value"); // { component: "Counter", field: "value", format: "int" }
|
|
31
|
+
*
|
|
32
|
+
* // The chest timer: the time left, as minutes and seconds.
|
|
33
|
+
* Text({ style: "digits", bind: bind(Countdown, "left", { format: "mm:ss" }) });
|
|
34
|
+
* // bind is { component: "Countdown", field: "left", format: "mm:ss" }; 95 s left shows "01:35"
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
declare function bind<Value extends object>(component: ComponentHandle<Value>, field: BindField<Value>, options?: BindOptions): TextBind;
|
|
38
|
+
/**
|
|
39
|
+
* A moment to count down to. A game writes `until`, a moment of `clock` in epoch milliseconds;
|
|
40
|
+
* `text` keeps `left` at the time that is left, computed from one `clock.now()` per frame on the
|
|
41
|
+
* render side, and writes it only when the label bound to it changes. At zero both stay at zero.
|
|
42
|
+
* Nothing of it reaches the save.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* // The chest of the board opens at a moment of the save; clock.now() is 1_790_000_000_000.
|
|
47
|
+
* view: chest => [
|
|
48
|
+
* Countdown({ until: chest.opensAt }), // opensAt: 1_790_000_095_000
|
|
49
|
+
* Text({ style: "digits", bind: bind(Countdown, "left", { format: "mm:ss" }) })
|
|
50
|
+
* ]
|
|
51
|
+
* // after the frame that spawns it: Text.resolved is "01:35", Countdown.left is 95000
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
declare const Countdown: ComponentType<CountdownValue>;
|
|
17
55
|
/**
|
|
18
56
|
* What `label` takes: the two things every label needs, and the anchor that has a default.
|
|
19
57
|
*
|
|
@@ -113,7 +151,7 @@ type ProjectionFor<Player, Session> = <const LayerName extends string, const Lif
|
|
|
113
151
|
* app.anim.play(coinsFly, { from: purse, to: counter }).marks(); // []: the first frame is next
|
|
114
152
|
* ```
|
|
115
153
|
*/
|
|
116
|
-
declare const animPlugin: import("@moku-labs/core").PluginInstance<"anim", Config$
|
|
154
|
+
declare const animPlugin: import("@moku-labs/core").PluginInstance<"anim", Config$13, State$12, AnimApi, {
|
|
117
155
|
"anim:mark": {
|
|
118
156
|
animation: string;
|
|
119
157
|
mark: string;
|
|
@@ -139,7 +177,7 @@ declare const animPlugin: import("@moku-labs/core").PluginInstance<"anim", Confi
|
|
|
139
177
|
* app.assets.usage().textureMb; // 0.188, the boot tier
|
|
140
178
|
* ```
|
|
141
179
|
*/
|
|
142
|
-
declare const assetsPlugin: import("@moku-labs/core").PluginInstance<"assets", Config$
|
|
180
|
+
declare const assetsPlugin: import("@moku-labs/core").PluginInstance<"assets", Config$1, State$1, Api, {
|
|
143
181
|
"assets:bundle-loaded": {
|
|
144
182
|
bundle: string;
|
|
145
183
|
tier: Tier;
|
|
@@ -189,7 +227,7 @@ declare const audioPlugin: import("@moku-labs/core").PluginInstance<"audio", Con
|
|
|
189
227
|
* });
|
|
190
228
|
* ```
|
|
191
229
|
*/
|
|
192
|
-
declare const clockPlugin: import("@moku-labs/core").PluginInstance<"clock", Config$
|
|
230
|
+
declare const clockPlugin: import("@moku-labs/core").PluginInstance<"clock", Config$2, State$2, Api$1, {}> & Record<never, never>;
|
|
193
231
|
//#endregion
|
|
194
232
|
//#region src/plugins/effects/index.d.ts
|
|
195
233
|
/**
|
|
@@ -223,7 +261,7 @@ declare const effectsPlugin: import("@moku-labs/core").PluginInstance<"effects",
|
|
|
223
261
|
* });
|
|
224
262
|
* ```
|
|
225
263
|
*/
|
|
226
|
-
declare const flowPlugin: import("@moku-labs/core").PluginInstance<"flow", Config$
|
|
264
|
+
declare const flowPlugin: import("@moku-labs/core").PluginInstance<"flow", Config$3, State$3, Api$2, {
|
|
227
265
|
"flow:edge": {
|
|
228
266
|
flow: string;
|
|
229
267
|
node: string;
|
|
@@ -304,7 +342,7 @@ declare const inputPlugin: import("@moku-labs/core").PluginInstance<"input", Con
|
|
|
304
342
|
* });
|
|
305
343
|
* ```
|
|
306
344
|
*/
|
|
307
|
-
declare const lifecyclePlugin: import("@moku-labs/core").PluginInstance<"lifecycle", Config$
|
|
345
|
+
declare const lifecyclePlugin: import("@moku-labs/core").PluginInstance<"lifecycle", Config$4, State$4, Api$3, {
|
|
308
346
|
"lifecycle:changed": {
|
|
309
347
|
reason: PauseReason;
|
|
310
348
|
action: "push" | "pop";
|
|
@@ -329,7 +367,7 @@ declare const lifecyclePlugin: import("@moku-labs/core").PluginInstance<"lifecyc
|
|
|
329
367
|
* });
|
|
330
368
|
* ```
|
|
331
369
|
*/
|
|
332
|
-
declare const modelPlugin: import("@moku-labs/core").PluginInstance<"model", Config$
|
|
370
|
+
declare const modelPlugin: import("@moku-labs/core").PluginInstance<"model", Config$5, State$5, {
|
|
333
371
|
store: StoreApi;
|
|
334
372
|
rng: RngApi;
|
|
335
373
|
}, {
|
|
@@ -491,7 +529,7 @@ declare const platformPlugin: import("@moku-labs/core").PluginInstance<"platform
|
|
|
491
529
|
* app.renderer.host.kind(); // "webgpu" in Chrome, "webgl" on an older device
|
|
492
530
|
* ```
|
|
493
531
|
*/
|
|
494
|
-
declare const rendererPlugin: import("@moku-labs/core").PluginInstance<"renderer", Config$
|
|
532
|
+
declare const rendererPlugin: import("@moku-labs/core").PluginInstance<"renderer", Config$6, State$6, Api$4, {
|
|
495
533
|
"renderer:device-lost": {
|
|
496
534
|
kind: "webgpu" | "webgl";
|
|
497
535
|
reason: string;
|
|
@@ -539,7 +577,7 @@ declare const scenesPlugin: import("@moku-labs/core").PluginInstance<"scenes", R
|
|
|
539
577
|
* app.text.styles(); // ["body", "digits", "hud.digits"]
|
|
540
578
|
* ```
|
|
541
579
|
*/
|
|
542
|
-
declare const textPlugin: import("@moku-labs/core").PluginInstance<"text", Config$
|
|
580
|
+
declare const textPlugin: import("@moku-labs/core").PluginInstance<"text", Config$12, State$11, TextApi, {}> & Record<never, never>;
|
|
543
581
|
//#endregion
|
|
544
582
|
//#region src/plugins/time/index.d.ts
|
|
545
583
|
/**
|
|
@@ -554,7 +592,7 @@ declare const textPlugin: import("@moku-labs/core").PluginInstance<"text", Confi
|
|
|
554
592
|
* });
|
|
555
593
|
* ```
|
|
556
594
|
*/
|
|
557
|
-
declare const timePlugin: import("@moku-labs/core").PluginInstance<"time", Config$
|
|
595
|
+
declare const timePlugin: import("@moku-labs/core").PluginInstance<"time", Config$7, State$7, Api$5, {}> & Record<never, never>;
|
|
558
596
|
//#endregion
|
|
559
597
|
//#region src/plugins/ui/index.d.ts
|
|
560
598
|
/**
|
|
@@ -587,7 +625,7 @@ declare const uiPlugin: import("@moku-labs/core").PluginInstance<"ui", Config$14
|
|
|
587
625
|
* app.world.projection.entityOf("board.items", "i7"); // 1048576
|
|
588
626
|
* ```
|
|
589
627
|
*/
|
|
590
|
-
declare const worldPlugin: import("@moku-labs/core").PluginInstance<"world", Config$
|
|
628
|
+
declare const worldPlugin: import("@moku-labs/core").PluginInstance<"world", Config$8, State$8, Api$6, {
|
|
591
629
|
"world:reconciled": {
|
|
592
630
|
mode: "play" | "direct";
|
|
593
631
|
projections: number;
|
|
@@ -798,15 +836,18 @@ type IntentValue = {
|
|
|
798
836
|
payload: Json;
|
|
799
837
|
};
|
|
800
838
|
/**
|
|
801
|
-
* A view that can be carried. It names no intent: the drop target does.
|
|
839
|
+
* A view that can be carried. It names no intent: the drop target does. `carry` lists the
|
|
840
|
+
* projection keys of views of the same projection that ride along on top of it, such as the cards
|
|
841
|
+
* that lie on a solitaire card.
|
|
802
842
|
*
|
|
803
843
|
* @example
|
|
804
844
|
* ```ts
|
|
805
|
-
* const value: CarryValue = { payload: { from: "
|
|
845
|
+
* const value: CarryValue = { payload: { from: "c7" }, carry: ["c8", "c9"] };
|
|
806
846
|
* ```
|
|
807
847
|
*/
|
|
808
848
|
type CarryValue = {
|
|
809
849
|
payload: Json;
|
|
850
|
+
carry: readonly string[];
|
|
810
851
|
};
|
|
811
852
|
/**
|
|
812
853
|
* Where the one pointer is, in reference units. `justPressed` and `justReleased` are true for
|
|
@@ -835,7 +876,8 @@ declare const Tappable: ComponentType<IntentValue>;
|
|
|
835
876
|
*/
|
|
836
877
|
declare const Pressable: ComponentType<IntentValue>;
|
|
837
878
|
/**
|
|
838
|
-
* This view can be carried by the finger. It names no intent; the drop target does.
|
|
879
|
+
* This view can be carried by the finger. It names no intent; the drop target does. The views
|
|
880
|
+
* whose keys `carry` lists hang under it from the grab to the release and fly home with it.
|
|
839
881
|
*/
|
|
840
882
|
declare const Draggable: ComponentType<CarryValue>;
|
|
841
883
|
/**
|
|
@@ -846,6 +888,13 @@ declare const DropTarget: ComponentType<IntentValue>;
|
|
|
846
888
|
* A swipe on this view answers `{ intent, payload: { ...payload, direction } }`.
|
|
847
889
|
*/
|
|
848
890
|
declare const Swipeable: ComponentType<IntentValue>;
|
|
891
|
+
/**
|
|
892
|
+
* A finger drawn through views that carry this answers once, on the release:
|
|
893
|
+
* `{ intent, payload: { path } }`, the payloads of the cells in the order the finger went through
|
|
894
|
+
* them. Going back to the cell before the last takes the last one off. It wins over every other
|
|
895
|
+
* gesture component on the same view.
|
|
896
|
+
*/
|
|
897
|
+
declare const Traceable: ComponentType<IntentValue>;
|
|
849
898
|
/**
|
|
850
899
|
* Takes a press without naming a gesture: the hit test accepts a view that carries only this tag,
|
|
851
900
|
* and a tap on it runs the `onTap` listeners and answers nothing. `ui` tags the buttons that
|
|
@@ -860,6 +909,11 @@ declare const Held: TagType;
|
|
|
860
909
|
* On the topmost drop target under the finger during a drag. At most one, never the held view.
|
|
861
910
|
*/
|
|
862
911
|
declare const Hovered: TagType;
|
|
912
|
+
/**
|
|
913
|
+
* On every view of the trace in progress, from the moment the finger reaches it until it backs
|
|
914
|
+
* off it or the trace ends. A game system draws the line through them.
|
|
915
|
+
*/
|
|
916
|
+
declare const Traced: TagType;
|
|
863
917
|
/**
|
|
864
918
|
* On the pressed view, from pointer down until a tap, a long press, a grab, a swipe or a cancel.
|
|
865
919
|
*/
|
|
@@ -1302,7 +1356,7 @@ declare function defineEmitter(id: string, config: EmitterConfig): EmitterDefini
|
|
|
1302
1356
|
* });
|
|
1303
1357
|
* ```
|
|
1304
1358
|
*/
|
|
1305
|
-
declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs/core").AnyPluginInstance[] = readonly []>(options?: import("@moku-labs/core").CreateAppOptions<Config$
|
|
1359
|
+
declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs/core").AnyPluginInstance[] = readonly []>(options?: import("@moku-labs/core").CreateAppOptions<Config$9, Events$1, (import("@moku-labs/core").PluginInstance<"time", Config$7, State$7, Api$5, {}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"lifecycle", Config$4, State$4, Api$3, {
|
|
1306
1360
|
"lifecycle:changed": {
|
|
1307
1361
|
reason: PauseReason;
|
|
1308
1362
|
action: "push" | "pop";
|
|
@@ -1310,7 +1364,7 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
1310
1364
|
paused: boolean;
|
|
1311
1365
|
resumed: boolean;
|
|
1312
1366
|
};
|
|
1313
|
-
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"model", Config$
|
|
1367
|
+
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"model", Config$5, State$5, {
|
|
1314
1368
|
store: StoreApi;
|
|
1315
1369
|
rng: RngApi;
|
|
1316
1370
|
}, {
|
|
@@ -1318,7 +1372,7 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
1318
1372
|
roots: readonly Root[];
|
|
1319
1373
|
cause: "edge" | "rollback" | "restore" | "load";
|
|
1320
1374
|
};
|
|
1321
|
-
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"clock", Config$
|
|
1375
|
+
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"clock", Config$2, State$2, Api$1, {}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"flow", Config$3, State$3, Api$2, {
|
|
1322
1376
|
"flow:edge": {
|
|
1323
1377
|
flow: string;
|
|
1324
1378
|
node: string;
|
|
@@ -1342,7 +1396,7 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
1342
1396
|
rolledBackTo: string;
|
|
1343
1397
|
retry: boolean;
|
|
1344
1398
|
};
|
|
1345
|
-
}> & Record<never, never>) | ExtraPlugins[number], [...ExtraPlugins], import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", import("@moku-labs/common/browser").LogConfig, import("@moku-labs/common/browser").LogState, import("@moku-labs/common/browser").LogApi>, import("@moku-labs/core").CorePluginInstance<"env", import("@moku-labs/common/browser").EnvConfig, import("@moku-labs/common/browser").EnvState, import("@moku-labs/common/browser").EnvApi>]>> | undefined) => import("@moku-labs/core").App<Config$
|
|
1399
|
+
}> & Record<never, never>) | ExtraPlugins[number], [...ExtraPlugins], import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", import("@moku-labs/common/browser").LogConfig, import("@moku-labs/common/browser").LogState, import("@moku-labs/common/browser").LogApi>, import("@moku-labs/core").CorePluginInstance<"env", import("@moku-labs/common/browser").EnvConfig, import("@moku-labs/common/browser").EnvState, import("@moku-labs/common/browser").EnvApi>]>> | undefined) => import("@moku-labs/core").App<Config$9, Events$1, (import("@moku-labs/core").PluginInstance<"time", Config$7, State$7, Api$5, {}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"lifecycle", Config$4, State$4, Api$3, {
|
|
1346
1400
|
"lifecycle:changed": {
|
|
1347
1401
|
reason: PauseReason;
|
|
1348
1402
|
action: "push" | "pop";
|
|
@@ -1350,7 +1404,7 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
1350
1404
|
paused: boolean;
|
|
1351
1405
|
resumed: boolean;
|
|
1352
1406
|
};
|
|
1353
|
-
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"model", Config$
|
|
1407
|
+
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"model", Config$5, State$5, {
|
|
1354
1408
|
store: StoreApi;
|
|
1355
1409
|
rng: RngApi;
|
|
1356
1410
|
}, {
|
|
@@ -1358,7 +1412,7 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
1358
1412
|
roots: readonly Root[];
|
|
1359
1413
|
cause: "edge" | "rollback" | "restore" | "load";
|
|
1360
1414
|
};
|
|
1361
|
-
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"clock", Config$
|
|
1415
|
+
}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"clock", Config$2, State$2, Api$1, {}> & Record<never, never>) | (import("@moku-labs/core").PluginInstance<"flow", Config$3, State$3, Api$2, {
|
|
1362
1416
|
"flow:edge": {
|
|
1363
1417
|
flow: string;
|
|
1364
1418
|
node: string;
|
|
@@ -1395,7 +1449,7 @@ declare const createApp: <const ExtraPlugins extends readonly import("@moku-labs
|
|
|
1395
1449
|
* });
|
|
1396
1450
|
* ```
|
|
1397
1451
|
*/
|
|
1398
|
-
declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<Config$
|
|
1452
|
+
declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<Config$9, Events$1, import("@moku-labs/core").CoreApisFromTuple<[import("@moku-labs/core").CorePluginInstance<"log", import("@moku-labs/common/browser").LogConfig, import("@moku-labs/common/browser").LogState, import("@moku-labs/common/browser").LogApi>, import("@moku-labs/core").CorePluginInstance<"env", import("@moku-labs/common/browser").EnvConfig, import("@moku-labs/common/browser").EnvState, import("@moku-labs/common/browser").EnvApi>]>>;
|
|
1399
1453
|
/**
|
|
1400
1454
|
* Binds the authoring helpers to the types of one game: "createApp for a game". Each plugin binds
|
|
1401
1455
|
* its own helpers (`flowFor`, `projectionFor`, `componentsFor`, `bundlesFor`, `scenesFor`); this
|
|
@@ -1483,7 +1537,7 @@ declare function defineGame<Types extends GameTypes>(): {
|
|
|
1483
1537
|
* createApp({ plugins: [...screen, boardFeature], pluginConfigs: { renderer: { mount: "#game" } } });
|
|
1484
1538
|
* ```
|
|
1485
1539
|
*/
|
|
1486
|
-
declare const screen: readonly [import("@moku-labs/core").PluginInstance<"world", Config$
|
|
1540
|
+
declare const screen: readonly [import("@moku-labs/core").PluginInstance<"world", Config$8, State$8, Api$6, {
|
|
1487
1541
|
"world:reconciled": {
|
|
1488
1542
|
mode: "play" | "direct";
|
|
1489
1543
|
projections: number;
|
|
@@ -1495,12 +1549,12 @@ declare const screen: readonly [import("@moku-labs/core").PluginInstance<"world"
|
|
|
1495
1549
|
hintsRouted: number;
|
|
1496
1550
|
hintsDropped: number;
|
|
1497
1551
|
};
|
|
1498
|
-
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"renderer", Config$
|
|
1552
|
+
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"renderer", Config$6, State$6, Api$4, {
|
|
1499
1553
|
"renderer:device-lost": {
|
|
1500
1554
|
kind: "webgpu" | "webgl";
|
|
1501
1555
|
reason: string;
|
|
1502
1556
|
};
|
|
1503
|
-
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"input", Config$11, State$10, InputApi, {}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"assets", Config$
|
|
1557
|
+
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"input", Config$11, State$10, InputApi, {}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"assets", Config$1, State$1, Api, {
|
|
1504
1558
|
"assets:bundle-loaded": {
|
|
1505
1559
|
bundle: string;
|
|
1506
1560
|
tier: Tier;
|
|
@@ -1525,7 +1579,7 @@ declare const screen: readonly [import("@moku-labs/core").PluginInstance<"world"
|
|
|
1525
1579
|
to: string;
|
|
1526
1580
|
music: string | undefined;
|
|
1527
1581
|
};
|
|
1528
|
-
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"anim", Config$
|
|
1582
|
+
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"anim", Config$13, State$12, AnimApi, {
|
|
1529
1583
|
"anim:mark": {
|
|
1530
1584
|
animation: string;
|
|
1531
1585
|
mark: string;
|
|
@@ -1537,6 +1591,6 @@ declare const screen: readonly [import("@moku-labs/core").PluginInstance<"world"
|
|
|
1537
1591
|
"i18n:locale-changed": {
|
|
1538
1592
|
locale: string;
|
|
1539
1593
|
};
|
|
1540
|
-
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"text", Config$
|
|
1594
|
+
}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"text", Config$12, State$11, TextApi, {}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"ui", Config$14, State$13, UiApi, {}> & Record<never, never>];
|
|
1541
1595
|
//#endregion
|
|
1542
|
-
export { Alpha, types_d_exports as Anim, Animation, types_d_exports$1 as Assets, types_d_exports$2 as Audio, type BackResult, Blur, Box, types_d_exports$3 as Clock, ColorMatrix, type DescriptionNode, Displacement, Display, Draggable, DropTarget, types_d_exports$4 as Effects, Emitter, Exiting, types_d_exports$5 as Flow, Frames, Glow, HAPTIC_KINDS, type HapticKind, Held, Hovered, types_d_exports$6 as I18n, types_d_exports$7 as Input, Layer, types_d_exports$8 as Lifecycle, LocalWrite, types_d_exports$9 as Model, NineSlice, Noise, Order, Outline, Parent, types_d_exports$10 as Platform, type PlatformProvider, Pointer, PointerOver, Pressable, Pressed, types_d_exports$11 as Renderer, SaveUnreadableError, types_d_exports$12 as Scenes, Shape, Sprite, Swipeable, Tappable, Text, types_d_exports$13 as TextTypes, types_d_exports$14 as Time, Touchable, Transform, Tree, types_d_exports$15 as Ui, types_d_exports$16 as World, animPlugin, assetsPlugin, audioPlugin, 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, 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 };
|
|
1596
|
+
export { Alpha, types_d_exports as Anim, Animation, types_d_exports$1 as Assets, types_d_exports$2 as Audio, type BackResult, type BindOptions, Blur, Box, types_d_exports$3 as Clock, ColorMatrix, Countdown, type CountdownValue, type DescriptionNode, Displacement, Display, Draggable, DropTarget, types_d_exports$4 as Effects, Emitter, Exiting, types_d_exports$5 as Flow, Frames, Glow, HAPTIC_KINDS, type HapticKind, Held, Hovered, types_d_exports$6 as I18n, types_d_exports$7 as Input, Layer, types_d_exports$8 as Lifecycle, LocalWrite, types_d_exports$9 as Model, NineSlice, Noise, Order, Outline, Parent, types_d_exports$10 as Platform, type PlatformProvider, Pointer, PointerOver, Pressable, Pressed, types_d_exports$11 as Renderer, SaveUnreadableError, types_d_exports$12 as Scenes, Shape, Sprite, Swipeable, Tappable, Text, type TextFormat, types_d_exports$13 as TextTypes, types_d_exports$14 as Time, Touchable, Traceable, Traced, Transform, Tree, types_d_exports$15 as Ui, types_d_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, 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 };
|