@moku-labs/game 0.15.86 → 0.15.88

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.
Files changed (39) hide show
  1. package/README.md +4 -3
  2. package/dist/app/page.d.mts +1 -1
  3. package/dist/app/page.mjs +2 -2
  4. package/dist/app/system.d.mts +3 -3
  5. package/dist/app.d.mts +3 -3
  6. package/dist/app.mjs +1 -1
  7. package/dist/assets.d.mts +1 -1
  8. package/dist/cli.mjs +351 -83
  9. package/dist/{commands-CeBF2nRY.d.mts → commands-C6RMqrY8.d.mts} +5 -5
  10. package/dist/{config-Cn1VZ-tx.mjs → config-BYx_7HL1.mjs} +24 -5
  11. package/dist/control.d.mts +12 -8
  12. package/dist/control.mjs +2 -2
  13. package/dist/{define-N-2nQNK_.d.mts → define-DE1XcBwC.d.mts} +27 -5
  14. package/dist/{headless-DtDdn5gg.d.mts → headless-CtRq6Uij.d.mts} +1 -1
  15. package/dist/{index-Bn0pFiae.d.mts → index-nK7iVsWx.d.mts} +30 -7
  16. package/dist/index.d.mts +5 -5
  17. package/dist/index.mjs +3 -3
  18. package/dist/inspect.d.mts +6 -6
  19. package/dist/inspect.mjs +2 -2
  20. package/dist/jsx-dev-runtime.d.mts +1 -1
  21. package/dist/jsx-runtime.d.mts +1 -1
  22. package/dist/{run-3QhrffgM.mjs → run-B5if0jxE.mjs} +1 -1
  23. package/dist/{runtime-DOvgFNLH.d.mts → runtime-CmRqaHmz.d.mts} +1 -1
  24. package/dist/{session-DuZfGZWk.mjs → session-D0AYRm5T.mjs} +39 -3
  25. package/dist/{sources-Djd8MjP9.mjs → sources-kL64Svgl.mjs} +2 -2
  26. package/dist/{src-BFa-zMmW.mjs → src-BTPWdbHH.mjs} +268 -158
  27. package/dist/testing.d.mts +4 -4
  28. package/dist/testing.mjs +1 -1
  29. package/dist/{types-OBpR0u05.d.mts → types-BbLjYfGR.d.mts} +113 -16
  30. package/dist/{types-CyPbo757.d.mts → types-BlXL-VC3.d.mts} +15 -5
  31. package/dist/{types-C5gLBKbm.d.mts → types-CJYudpme.d.mts} +2 -2
  32. package/dist/{types-DNWWlVky.d.mts → types-ehmvA6yu.d.mts} +41 -11
  33. package/dist/{types-CbVXXqPs.d.mts → types-w5_A5TPL.d.mts} +35 -4
  34. package/dist/{visual-B7TxMv1J.mjs → visual-CULAJg6b.mjs} +161 -10
  35. package/dist/{visual-Di8ecxYD.d.mts → visual-DvhjRhgP.d.mts} +6 -6
  36. package/dist/visual.d.mts +1 -1
  37. package/dist/visual.mjs +2 -2
  38. package/llms.txt +10 -9
  39. package/package.json +3 -3
@@ -1,8 +1,8 @@
1
- import { An as Bookmark, D as DebugSwitches, Nn as FlowState, Qr as Api, Yr as StoreApi, Z as Api$1, oi as FrameRate, qr as Snapshot, ui as Time, ut as Captured, w as ScenesApi, wr as Api$2 } from "./types-CbVXXqPs.mjs";
2
- import { P as AnimApi, a as AudioApi, h as EffectsApi, r as UiApi } from "./types-C5gLBKbm.mjs";
3
- import { N as InputApi } from "./types-OBpR0u05.mjs";
4
- import { t as HeadlessApp } from "./headless-DtDdn5gg.mjs";
5
- import { n as Command, r as ControlApp } from "./types-DNWWlVky.mjs";
1
+ import { $r as Api, D as DebugSwitches, Jr as Snapshot, Pn as FlowState, Tr as Api$2, Xr as StoreApi, Z as Api$1, di as Time, jn as Bookmark, si as FrameRate, ut as Captured, w as ScenesApi } from "./types-w5_A5TPL.mjs";
2
+ import { P as AnimApi, a as AudioApi, h as EffectsApi, r as UiApi } from "./types-CJYudpme.mjs";
3
+ import { L as InputApi } from "./types-BbLjYfGR.mjs";
4
+ import { t as HeadlessApp } from "./headless-CtRq6Uij.mjs";
5
+ import { i as ControlApp, r as Command } from "./types-ehmvA6yu.mjs";
6
6
 
7
7
  //#region src/plugins/flow/doors/commands.d.ts
8
8
  /**
@@ -9,6 +9,8 @@ const ANDROID_SIGNING_FIELDS = [
9
9
  "keystorePasswordEnv",
10
10
  "keyAlias"
11
11
  ];
12
+ /** The last part of a test app's identifier. */
13
+ const TEST_APP_SUFFIX = ".dev";
12
14
  /** An iOS version as native takes it: `26.0` or `26.0.1`. */
13
15
  const IOS_VERSION = /^\d+\.\d+(\.\d+)?$/;
14
16
  /**
@@ -124,13 +126,29 @@ function checkIos(ios) {
124
126
  }
125
127
  }
126
128
  /**
129
+ * Throws for a `native.dev` that cannot name a test app.
130
+ *
131
+ * @param native - `native` of the config.
132
+ * @throws {Error} When the block has no `identifier`, or one that does not end in `.dev` or is
133
+ * `native.identifier` itself, or when `name` or `icon` is an empty string.
134
+ */
135
+ function checkTestApp(native) {
136
+ const dev = native?.dev;
137
+ if (dev === void 0) return;
138
+ if (!isFilled(dev.identifier)) throw new Error("[game] config.native.dev has no identifier.\n Name one that ends in .dev.");
139
+ if (!dev.identifier.endsWith(".dev")) throw new Error(`[game] config.native.dev.identifier is "${dev.identifier}".\n Use one that ends in .dev.`);
140
+ if (dev.identifier === native?.identifier) throw new Error(`[game] config.native.dev.identifier is "${dev.identifier}", the same as native.identifier.\n The test app needs an id of its own.`);
141
+ if (dev.name === "") throw new Error("[game] config.native.dev.name is empty.\n Name the test app, or leave the field out.");
142
+ if (dev.icon === "") throw new Error("[game] config.native.dev.icon is empty.\n Name a 1024 px PNG, or leave the field out.");
143
+ }
144
+ /**
127
145
  * Throws for the first value of a config that TypeScript would have refused.
128
146
  *
129
147
  * @param config - The default export of `config.ts`.
130
148
  * @throws {Error} When `save` is not a save kind, a `system` name is not wired, the title is empty,
131
149
  * `debug.overlay` is not a start mode, `page.boot` has no image, `page.boot.fadeMs` is not a finite number of 0
132
- * or more, `native.signing` is half filled, `native.ios.minimumVersion` is no iOS version, or a value of
133
- * `native.ios.infoPlist` is no plist value.
150
+ * or more, `native.signing` is half filled, `native.ios.minimumVersion` is no iOS version, a value of
151
+ * `native.ios.infoPlist` is no plist value, or `native.dev` cannot name a test app.
134
152
  */
135
153
  function checkConfig(config) {
136
154
  if (config.save !== void 0 && !saveKinds().has(config.save)) throw new Error(`[game] config.save is "${config.save}".\n Use "memory", "local" or "store".`);
@@ -146,6 +164,7 @@ function checkConfig(config) {
146
164
  if (fadeMs !== void 0 && !(Number.isFinite(fadeMs) && fadeMs >= 0)) throw new Error(`[game] config.page.boot.fadeMs is ${String(fadeMs)}.\n Use a number of milliseconds, 0 or more.`);
147
165
  checkSigning(config.native?.signing);
148
166
  checkIos(config.native?.ios);
167
+ checkTestApp(config.native);
149
168
  }
150
169
  /**
151
170
  * Fills the defaults of `page.boot`: the width `"40vmin"`, the fade 300 ms.
@@ -174,8 +193,8 @@ function resolveBoot(boot) {
174
193
  * @returns The config with every field set.
175
194
  * @throws {Error} When `save` is not a save kind, a `system` name is not wired, the title is empty,
176
195
  * `debug.overlay` is not a start mode, `page.boot` has no image, `page.boot.fadeMs` is not a finite number of 0
177
- * or more, `native.signing` is half filled, `native.ios.minimumVersion` is no iOS version, or a value of
178
- * `native.ios.infoPlist` is no plist value.
196
+ * or more, `native.signing` is half filled, `native.ios.minimumVersion` is no iOS version, a value of
197
+ * `native.ios.infoPlist` is no plist value, or `native.dev` cannot name a test app.
179
198
  * @example
180
199
  * ```ts
181
200
  * resolveConfig({ page: { title: "T" } }).save; // "memory"
@@ -201,4 +220,4 @@ function resolveConfig(config) {
201
220
  };
202
221
  }
203
222
  //#endregion
204
- export { resolveConfig as t };
223
+ export { resolveConfig as n, TEST_APP_SUFFIX as t };
@@ -1,7 +1,7 @@
1
- import { t as HeadlessApp } from "./headless-DtDdn5gg.mjs";
2
- import { i as InputArguments, n as Command, o as InputSchema, s as Ran } from "./types-DNWWlVky.mjs";
3
- import { t as commands } from "./commands-CeBF2nRY.mjs";
4
- import { t as defineCommand } from "./define-N-2nQNK_.mjs";
1
+ import { t as HeadlessApp } from "./headless-CtRq6Uij.mjs";
2
+ import { a as InputArguments, c as Ran, n as ChoiceInput, r as Command, s as InputSchema, u as ToggleInput } from "./types-ehmvA6yu.mjs";
3
+ import { t as commands } from "./commands-C6RMqrY8.mjs";
4
+ import { t as defineCommand } from "./define-DE1XcBwC.mjs";
5
5
 
6
6
  //#region src/plugins/flow/doors/dev.d.ts
7
7
  /**
@@ -76,19 +76,23 @@ declare global {
76
76
  var __MOKU_GAME_ENGINE__: string | undefined;
77
77
  /**
78
78
  * Where the page agent of a debug build finds the editor: `host:port`, written by `--editor` (default
79
- * `"127.0.0.1:47600"`). Undefined on the dev page, whose agent talks to the server that served it, and on a release
80
- * build.
79
+ * `"127.0.0.1:47600"`). Exactly `"off"` on the page of a test app (`native build --store --dev`): the agent opens no
80
+ * socket and the overlay works alone, a contract with `@moku-labs/editor` 0.10.19 and later. Any other string is an
81
+ * address. Undefined on the dev page, whose agent talks to the server that served it, and on a release build.
81
82
  *
82
83
  * @example
83
84
  * ```ts
84
85
  * // moku-game build --debug --editor 192.168.1.20:47600
85
86
  * globalThis.__MOKU_GAME_EDITOR__; // "192.168.1.20:47600"
87
+ * // moku-game native build android --store --dev --build-number 13
88
+ * globalThis.__MOKU_GAME_EDITOR__; // "off"
86
89
  * ```
87
90
  */
88
91
  var __MOKU_GAME_EDITOR__: string | undefined;
89
92
  /**
90
93
  * The app id of a debug build, so the editor pairs a device stream with its project: `native.identifier` of
91
- * `config.ts`, with `.debug` in the native debug app (`MOKU_NATIVE_PROFILE=debug`), which installs under that id.
94
+ * `config.ts`, with `.debug` in the native debug app (`MOKU_NATIVE_PROFILE=debug`), which installs under that id, and
95
+ * `native.dev.identifier` in a test app (`MOKU_NATIVE_PROFILE=dev`).
92
96
  * Undefined on a debug build of a game with no native section, on the dev page and on a release build.
93
97
  *
94
98
  * @example
@@ -197,4 +201,4 @@ declare function controlReadOnly(id: string): ControlReadOnlyError;
197
201
  */
198
202
  declare function run<S extends InputSchema, O, App extends HeadlessApp>(app: App, command: Command<S, O, App>, ...input: InputArguments<S>): Promise<Ran<O>>;
199
203
  //#endregion
200
- export { type Command, type ControlReadOnlyError, type ControlRefusedError, type Ran, commands, controlReadOnly, controlRefused, defineCommand, run };
204
+ export { type ChoiceInput, type Command, type ControlReadOnlyError, type ControlRefusedError, type Ran, type ToggleInput, commands, controlReadOnly, controlRefused, defineCommand, run };
package/dist/control.mjs CHANGED
@@ -1,4 +1,4 @@
1
1
  import { n as controlRefused, t as controlReadOnly } from "./dev-BNndV-hU.mjs";
2
- import { s as defineCommand } from "./session-DuZfGZWk.mjs";
3
- import { n as commands, t as run } from "./run-3QhrffgM.mjs";
2
+ import { s as defineCommand } from "./session-D0AYRm5T.mjs";
3
+ import { n as commands, t as run } from "./run-B5if0jxE.mjs";
4
4
  export { commands, controlReadOnly, controlRefused, defineCommand, run };
@@ -1,5 +1,5 @@
1
- import { t as HeadlessApp } from "./headless-DtDdn5gg.mjs";
2
- import { c as Source, n as Command, o as InputSchema } from "./types-DNWWlVky.mjs";
1
+ import { t as HeadlessApp } from "./headless-CtRq6Uij.mjs";
2
+ import { l as Source, r as Command, s as InputSchema } from "./types-ehmvA6yu.mjs";
3
3
 
4
4
  //#region src/plugins/flow/doors/define.d.ts
5
5
  /**
@@ -30,12 +30,14 @@ declare function defineSource<S extends InputSchema, O, App = HeadlessApp>(sourc
30
30
  * control form for the others (see docs/doors.md), so a production build drops it. A game's
31
31
  * `.dev` command with only the `__MOKU_GAME_DEV__` guard runs in dev and is refused on a debug
32
32
  * page. `overlay` shows it in the editor's overlay: `"toggle"` with the input `{ on: "boolean" }`
33
- * and a `value(app)` the switch is drawn from, `"button"` with no required input and no value;
34
- * any other combination is a type error.
33
+ * and a `value(app)` the switch is drawn from, or with `choices` and a `choice(app)` too and
34
+ * `choice` in the input, `"button"` with no required input and no value; any other combination is
35
+ * a type error.
35
36
  *
36
37
  * @param command - The descriptor.
37
38
  * @returns The same descriptor, frozen.
38
- * @throws {Error} When the id is not a dotted name such as `"game.answer"`.
39
+ * @throws {Error} When the id is not a dotted name such as `"game.answer"`, or `choices` holds a
40
+ * word twice.
39
41
  * @example
40
42
  * ```ts
41
43
  * // A game's .dev module: open the shop from anywhere, through the graph.
@@ -74,6 +76,26 @@ declare function defineSource<S extends InputSchema, O, App = HeadlessApp>(sourc
74
76
  * });
75
77
  * // The overlay draws a switch "Glow", on; a tap runs it with { on: false } and the next frame draws no glow.
76
78
  * ```
79
+ * @example
80
+ * ```ts
81
+ * // features/purchases/simulate.dev.ts — a tester on a phone picks how a purchase ends.
82
+ * export const simulate = defineCommand({
83
+ * id: "purchases.simulate",
84
+ * title: "Simulated purchases",
85
+ * input: { on: "boolean", choice: "string" },
86
+ * effect: "cheat",
87
+ * overlay: "toggle",
88
+ * choices: ["success", "failure", "delay"],
89
+ * value: (app: { readonly purchases: PurchasesApi }) => app.purchases.overridden(),
90
+ * choice: () => readSetting().mode, // the game's own .dev module remembers the pick
91
+ * run: (app, { on, choice }) => {
92
+ * // The control guard, then:
93
+ * writeSetting({ mode: choice });
94
+ * app.purchases.simulate(on ? choice : undefined);
95
+ * }
96
+ * });
97
+ * // The overlay draws a switch with the row success, failure, delay; a tap on failure runs { on: true, choice: "failure" }.
98
+ * ```
77
99
  */
78
100
  declare function defineCommand<S extends InputSchema, O, App = HeadlessApp>(command: Command<S, O, App>): Command<S, O, App>;
79
101
  //#endregion
@@ -1,4 +1,4 @@
1
- import { Gn as Answer, In as RouteStep, Nn as FlowState, Pn as JournalEntry, Rr as Json, Zr as RngState, ii as Api, un as Api$1 } from "./types-CbVXXqPs.mjs";
1
+ import { Fn as JournalEntry, Kn as Answer, Ln as RouteStep, Pn as FlowState, Qr as RngState, ai as Api, un as Api$1, zr as Json } from "./types-w5_A5TPL.mjs";
2
2
 
3
3
  //#region src/plugins/flow/headless.d.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { $n as NumericFields, $r as Config$4, Bn as Effect, Br as State$5, C as SceneSpec, Cr as TagType, Ct as FrameRing, Dn as FeaturePlugin, Dr as State$9, En as FeatureDescription, F as HudPartValue, G as SpriteOptions, Gn as Answer, H as ShapeValue, Hn as GuideOptions, Hr as Patch, Ir as Config$5, J as TransformValue, Jn as DescriptionNode, K as SpriteValue, L as NineSliceValue, Ln as SceneIdOf, Nr as State$2, Nt as PassKind, On as FeatureTree, Q as Config$6, Qr as Api$3, Rr as Json, S as SceneDefinition, Sr as SystemFor, St as FrameRecord, T as State$7, Tr as Config$9, Un as Hint, Vn as EffectOptions, Xr as RngApi, Y as sprite, Yn as Ease, Yr as StoreApi, Z as Api$4, _ as AnySceneProjection, _n as State$3, _r as Mut, a as Config$1, ai as Config$8, br as ResourceType, c as LoadBundles, ci as State$8, dn as BundlesOf, ei as Events, er as ProjectionMotion, f as ReadyBundles, fi as Config$10, fn as Config$3, fr as ComponentType, hn as HudKeysOf, ht as ViewportSize, i as BundleSpec, ii as Api$5, jn as DefineNode, jr as Config$2, kr as Api$1, l as LoadReason, li as ThermalReading, m as Tier, mi as Require, mn as GameTypes, ni as State$4, nr as ReducedMotion, o as DefineBundles, p as State$1, pi as Events$1, pn as EmitterIdOf, pr as ComponentValue, r as BundleMap, si as RateChange, st as State$6, t as Api, ti as PauseReason, tr as ProjectionSpec, u as LoadResult, un as Api$2, ur as ComponentHandle, v as Config$7, vn as TextStylesOf, vr as Narrowed, w as ScenesApi, wr as Api$6, x as LayerMap, xn as defineFlow, xr as SystemDefinition, y as DefineScene, yr as QueryTerm, z as OverlayValue, zn as Descriptor, zr as Root } from "./types-CbVXXqPs.mjs";
2
- import { A as GlowValue, B as Target, C as BlurValue, D as FilterComponent, F as AnimPlayerValue, H as HapticKind, I as Config$11, K as defineAnimation, L as FramesValue, M as OutlineValue, N as UniformDeclaration, O as FilterSpec, P as AnimApi, Q as play, R as MotionKeyframe, S as AlphaValue, T as DisplacementValue, U as SfxDescriptor, W as Step, _ as State$12, a as AudioApi, b as EmitterDefinition, c as MusicDescriptor, d as State$11, f as VolumesFor, h as EffectsApi, j as NoiseValue, k as FilterValueOf, l as MusicOptions, lt as OverlayApi, m as Config$13, n as State$13, r as UiApi, s as Config$12, t as Config$14, w as ColorMatrixValue, x as EmitterValue, y as EmitterConfig, z as State$10 } from "./types-C5gLBKbm.mjs";
3
- import { B as Message, C as State$16, D as TextStyleInput, G as TypedTr, H as State$14, I as Argument, J as ResolvedStyle, L as Config$15, M as Config$16, N as InputApi, O as TextStyles, P as State$15, R as I18nApi, S as Point, T as TextBind, V as Part, W as TextKey, Y as Style, Z as WhenFlags, b as Config$17, g as IntrinsicElementsFor, h as defineTokens, j as defineComponent, k as TextValue, q as IsFlags, s as PopupComponent, v as BindField, w as TextApi, x as CountdownValue, y as BindOptions, z as IntlKit } from "./types-OBpR0u05.mjs";
1
+ import { $r as Api$3, Ar as Api$1, Bn as Descriptor, Br as Root, C as SceneSpec, Cr as SystemFor, Ct as FrameRing, Dn as FeatureDescription, Er as Config$9, F as HudPartValue, G as SpriteOptions, H as ShapeValue, Hn as EffectOptions, J as TransformValue, K as SpriteValue, Kn as Answer, L as NineSliceValue, Lr as Config$5, Mn as DefineNode, Mr as Config$2, Nt as PassKind, On as FeaturePlugin, Or as State$9, Pr as State$2, Q as Config$6, Rn as SceneIdOf, S as SceneDefinition, Sn as defineFlow, Sr as SystemDefinition, St as FrameRecord, T as State$7, Tr as Api$6, Un as GuideOptions, Ur as Patch, Vn as Effect, Vr as State$5, Wn as Hint, Xn as Ease, Xr as StoreApi, Y as sprite, Yn as DescriptionNode, Z as Api$4, Zr as RngApi, _ as AnySceneProjection, _n as State$3, a as Config$1, ai as Api$5, br as QueryTerm, c as LoadBundles, ci as RateChange, dn as BundlesOf, dr as ComponentHandle, ei as Config$4, er as NumericFields, f as ReadyBundles, fn as Config$3, hi as Require, hn as HudKeysOf, ht as ViewportSize, i as BundleSpec, kn as FeatureTree, l as LoadReason, li as State$8, m as Tier, mi as Events$1, mn as GameTypes, mr as ComponentValue, ni as PauseReason, nr as ProjectionSpec, o as DefineBundles, oi as Config$8, p as State$1, pi as Config$10, pn as EmitterIdOf, pr as ComponentType, r as BundleMap, ri as State$4, rr as ReducedMotion, st as State$6, t as Api, ti as Events, tr as ProjectionMotion, u as LoadResult, ui as ThermalReading, un as Api$2, v as Config$7, vn as TextFormatsOf, vr as Mut, w as ScenesApi, wr as TagType, x as LayerMap, xr as ResourceType, y as DefineScene, yn as TextStylesOf, yr as Narrowed, z as OverlayValue, zr as Json } from "./types-w5_A5TPL.mjs";
2
+ import { A as GlowValue, B as Target, C as BlurValue, D as FilterComponent, F as AnimPlayerValue, H as HapticKind, I as Config$11, K as defineAnimation, L as FramesValue, M as OutlineValue, N as UniformDeclaration, O as FilterSpec, P as AnimApi, Q as play, R as MotionKeyframe, S as AlphaValue, T as DisplacementValue, U as SfxDescriptor, W as Step, _ as State$12, a as AudioApi, b as EmitterDefinition, c as MusicDescriptor, d as State$11, f as VolumesFor, h as EffectsApi, j as NoiseValue, k as FilterValueOf, l as MusicOptions, lt as OverlayApi, m as Config$13, n as State$13, r as UiApi, s as Config$12, t as Config$14, w as ColorMatrixValue, x as EmitterValue, y as EmitterConfig, z as State$10 } from "./types-CJYudpme.mjs";
3
+ import { $ as Style, A as TextFormats, B as Argument, C as Point, E as TextBind, F as defineComponent, G as Part, H as I18nApi, I as Config$16, J as TextKey, K as State$14, L as InputApi, M as TextStyles, N as TextValue, Q as ResolvedStyle, R as State$15, T as TextApi, U as IntlKit, V as Config$15, W as Message, Y as TypedTr, Z as IsFlags, b as Config$17, g as IntrinsicElementsFor, h as defineTokens, j as TextStyleInput, k as TextFormatFunction, s as PopupComponent, tt as WhenFlags, v as BindField, w as State$16, x as CountdownValue, y as BindOptions } from "./types-BbLjYfGR.mjs";
4
4
  import { Log } from "@moku-labs/common/browser";
5
5
  import { PluginCtx } from "@moku-labs/core";
6
6
 
@@ -16,8 +16,9 @@ declare const Text: ComponentType<TextValue>;
16
16
  /**
17
17
  * Shows a numeric component field of the label's own entity: read every frame, written to
18
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.
19
+ * is `"int"` (rounded) unless named. This root `bind` takes the four built-in formats; the `bind`
20
+ * of `defineGame` is this function and takes the names of the game's `defineTextFormats` too. Reads
21
+ * the component's own name, so a renamed component cannot drift from its label.
21
22
  *
22
23
  * @param component - The component whose field the label shows.
23
24
  * @param field - A numeric field of that component.
@@ -99,6 +100,24 @@ declare function label(options: LabelOptions): [ComponentValue<TextValue>, Compo
99
100
  * ```
100
101
  */
101
102
  declare function defineTextStyles(map: Record<string, TextStyleInput>): TextStyles;
103
+ /**
104
+ * Declares the number formats of a feature. The result goes under the `textFormats` key of the
105
+ * feature description, and `text` reads it in `onStart`; a label names a format in its `bind`. A
106
+ * format takes the whole value and answers what the label shows and its style.
107
+ *
108
+ * @param map - Format name to its function. The four built-in names are refused at start.
109
+ * @returns The registration a feature carries.
110
+ * @example
111
+ * ```ts
112
+ * const formats = defineTextFormats({
113
+ * "pill.number": value => ({ content: String(value), style: "digits.17" })
114
+ * });
115
+ *
116
+ * formats.kind; // "textFormats"
117
+ * formats.map["pill.number"]?.(950); // { content: "950", style: "digits.17" }
118
+ * ```
119
+ */
120
+ declare function defineTextFormats(map: Readonly<Record<string, TextFormatFunction>>): TextFormats;
102
121
  //#endregion
103
122
  //#region src/plugins/world/projection/define.d.ts
104
123
  /**
@@ -1881,7 +1900,9 @@ declare const createPlugin: import("@moku-labs/core").BoundCreatePluginFunction<
1881
1900
  * a string key written in code (a key that comes from data is checked with `app.i18n.isKey`).
1882
1901
  *
1883
1902
  * @returns The helpers typed with the game's `player`, `session`, `assets`, `bundles`, `strings`,
1884
- * `emitters` and `hud` (the HUD part keys of `HudPart` and `Overlay`).
1903
+ * `textStyles`, `textFormats` (the format names of `bind`, next to the four built-in ones, with
1904
+ * `defineTextFormats` answering the game's styles), `emitters` and `hud` (the HUD part keys of
1905
+ * `HudPart` and `Overlay`).
1885
1906
  * @example
1886
1907
  * ```ts
1887
1908
  * // kit.ts of a game: bound once, imported by every node, flow and view file.
@@ -1912,6 +1933,8 @@ declare function defineGame<Types extends GameTypes>(): {
1912
1933
  label: (options: Omit<LabelOptions, "style"> & {
1913
1934
  style: TextStylesOf<Types>;
1914
1935
  }) => ReturnType<typeof label>;
1936
+ bind: <Value extends object>(component: ComponentHandle<Value>, field: BindField<Value>, options?: BindOptions<TextFormatsOf<Types>> | undefined) => TextBind;
1937
+ defineTextFormats: (map: Readonly<Record<string, TextFormatFunction<TextStylesOf<Types>>>>) => TextFormats;
1915
1938
  defineTextStyles: (map: Record<string, Omit<TextStyleInput, "bold" | "font" | "italic"> & {
1916
1939
  font: Types["assets"];
1917
1940
  } & {
@@ -2033,4 +2056,4 @@ declare const screen: readonly [import("@moku-labs/core").PluginInstance<"world"
2033
2056
  };
2034
2057
  }> & Record<never, never>, import("@moku-labs/core").PluginInstance<"text", Config$17, State$16, TextApi, {}> & Record<never, never>, import("@moku-labs/core").PluginInstance<"ui", Config$14, State$13, UiApi, {}> & Record<never, never>];
2035
2058
  //#endregion
2036
- export { system as $, Draggable as A, Text as At, Touchable as B, AnimPlayer as C, debugPlugin as Ct, defineBundles as D, animPlugin as Dt, defineScene as E, assetsPlugin as Et, PointerOver as F, Exiting as G, Traced as H, Pressable as I, Order as J, Layer as K, Pressed as L, Held as M, defineTextStyles as Mt, Hovered as N, label as Nt, load as O, projection as Ot, Pointer as P, resource as Q, Swipeable as R, defineMotion as S, effectsPlugin as St, Frames as T, audioPlugin as Tt, PASS_KINDS as U, Traceable as V, frameAt as W, component as X, Tree as Y, mut as Z, defineStyle as _, modelPlugin as _t, defineEmitter as a, defineFeature as at, messageDuration as b, i18nPlugin as bt, Alpha as c, uiPlugin as ct, Displacement as d, scenesPlugin as dt, tag as et, Glow as f, rendererPlugin as ft, resolve as g, types_d_exports as gt, music as h, PlatformProvider as ht, screen as i, schedule as it, DropTarget as j, bind as jt, ready as k, Countdown as kt, Blur as l, timePlugin as lt, Outline as m, BackResult as mt, createPlugin as n, guide as nt, Emitter as o, flattenFeatures as ot, Noise as p, platformPlugin as pt, Now as q, defineGame as r, hint as rt, defineFilter as s, worldPlugin as st, createApp as t, defineEffect as tt, ColorMatrix as u, textPlugin as ut, tr as v, lifecyclePlugin as vt, Animation as w, clockPlugin as wt, cubicBezier as x, flowPlugin as xt, messageArgument as y, inputPlugin as yt, Tappable as z };
2059
+ export { system as $, Draggable as A, Text as At, Touchable as B, AnimPlayer as C, debugPlugin as Ct, defineBundles as D, animPlugin as Dt, defineScene as E, assetsPlugin as Et, PointerOver as F, Exiting as G, Traced as H, Pressable as I, Order as J, Layer as K, Pressed as L, Held as M, defineTextFormats as Mt, Hovered as N, defineTextStyles as Nt, load as O, projection as Ot, Pointer as P, label as Pt, resource as Q, Swipeable as R, defineMotion as S, effectsPlugin as St, Frames as T, audioPlugin as Tt, PASS_KINDS as U, Traceable as V, frameAt as W, component as X, Tree as Y, mut as Z, defineStyle as _, modelPlugin as _t, defineEmitter as a, defineFeature as at, messageDuration as b, i18nPlugin as bt, Alpha as c, uiPlugin as ct, Displacement as d, scenesPlugin as dt, tag as et, Glow as f, rendererPlugin as ft, resolve as g, types_d_exports as gt, music as h, PlatformProvider as ht, screen as i, schedule as it, DropTarget as j, bind as jt, ready as k, Countdown as kt, Blur as l, timePlugin as lt, Outline as m, BackResult as mt, createPlugin as n, guide as nt, Emitter as o, flattenFeatures as ot, Noise as p, platformPlugin as pt, Now as q, defineGame as r, hint as rt, defineFilter as s, worldPlugin as st, createApp as t, defineEffect as tt, ColorMatrix as u, textPlugin as ut, tr as v, lifecyclePlugin as vt, Animation as w, clockPlugin as wt, cubicBezier as x, flowPlugin as xt, messageArgument as y, inputPlugin as yt, Tappable as z };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { $ as MonitorConfig, $t as PerfThermalLine, At as PERF_GAP_BUCKETS, B as Parent, Bt as PerfDisplay, Cn as slot, Ct as FrameRing, Dt as OverlayEventDetail, E as types_d_exports$13, Et as MonitorSections, F as HudPartValue, Ft as PerfCause, Gt as PerfLogLine, Ht as PerfEventName, I as NineSlice, It as PerfChange, Jn as DescriptionNode, Jt as PerfMeasured, Kn as AnchorTarget, Kr as SaveUnreadableError, Kt as PerfLongFrameLine, Lt as PerfChangeEntry, M as WhyEntry, Mt as PROBLEM_RULES, N as Display, Nt as PassKind, Or as types_d_exports$17, Ot as OverlayWhat, P as HudPart, Pr as types_d_exports$3, Pt as PassRecord, Qt as PerfTelemetryLine, R as Overlay, Rt as PerfCollectorLine, Sn as exit, St as FrameRecord, Tn as type, Tt as MONITOR_SECTIONS, U as Sprite, Ut as PerfGapLine, V as Shape, Vr as types_d_exports$10, Vt as PerfEventLine, W as SpriteBlend, Wt as PerfHeaderLine, X as AdaptiveScale, Xt as PerfSpikeLine, Y as sprite, Yt as PerfSampleLine, Zt as PerfStartupLine, _t as RetakeWhy, an as ShaderWhat, bn as contribution, bt as FrameReadResult, cn as CanvasRestart, di as types_d_exports$15, dt as MonitorCounts, en as PoolTrimDetail, g as types_d_exports$1, in as ShaderEventDetail, jt as PERF_LOG_VERSION, kt as PERF_CAUSES, ln as DEMAND_REASONS, lt as types_d_exports$12, nn as ProblemRule, on as WarmDetail, ot as PoolTrim, q as Transform, qt as PerfMarkLine, ri as types_d_exports$9, rn as SHADER_WHATS, rr as SceneSwitch, sn as CANVAS_RESTARTS, tn as ProblemEventDetail, vt as WhyLive, wn as to, wt as LongFrameEntry, xt as FrameReadout, yn as types_d_exports$6, yt as FrameColumns, z as OverlayValue, zt as PerfCounts } from "./types-CbVXXqPs.mjs";
2
- import { $ as sequence, E as FilterArea, G as HAPTIC_KINDS, H as HapticKind, J as frames, K as defineAnimation, Q as play, V as types_d_exports, X as mark, Y as haptic, Z as parallel, at as stopSfx, ct as wait, et as set, i as types_d_exports$16, it as stagger, nt as spawn, ot as tween, p as types_d_exports$2, q as external, rt as spawned, st as use, tt as sfx, ut as types_d_exports$4, v as types_d_exports$5 } from "./types-C5gLBKbm.mjs";
3
- import { A as types_d_exports$14, E as TextFormat, F as types_d_exports$8, K as types_d_exports$7, d as DebugTrigger, f as LocalWrite, h as defineTokens, j as defineComponent, m as popup, p as ScrollState, u as Box, x as CountdownValue, y as BindOptions } from "./types-OBpR0u05.mjs";
4
- import { $ as system, A as Draggable, At as Text, B as Touchable, C as AnimPlayer, Ct as debugPlugin, D as defineBundles, Dt as animPlugin, E as defineScene, Et as assetsPlugin, F as PointerOver, G as Exiting, H as Traced, I as Pressable, J as Order, K as Layer, L as Pressed, M as Held, Mt as defineTextStyles, N as Hovered, Nt as label, O as load, Ot as projection, P as Pointer, Q as resource, R as Swipeable, S as defineMotion, St as effectsPlugin, T as Frames, Tt as audioPlugin, U as PASS_KINDS, V as Traceable, W as frameAt, X as component, Y as Tree, Z as mut, _ as defineStyle, _t as modelPlugin, a as defineEmitter, at as defineFeature, b as messageDuration, bt as i18nPlugin, c as Alpha, ct as uiPlugin, d as Displacement, dt as scenesPlugin, et as tag, f as Glow, ft as rendererPlugin, g as resolve, gt as types_d_exports$11, h as music, ht as PlatformProvider, i as screen, it as schedule, j as DropTarget, jt as bind, k as ready, kt as Countdown, l as Blur, lt as timePlugin, m as Outline, mt as BackResult, n as createPlugin, nt as guide, o as Emitter, ot as flattenFeatures, p as Noise, pt as platformPlugin, q as Now, r as defineGame, rt as hint, s as defineFilter, st as worldPlugin, t as createApp, tt as defineEffect, u as ColorMatrix, ut as textPlugin, v as tr, vt as lifecyclePlugin, w as Animation, wt as clockPlugin, x as cubicBezier, xt as flowPlugin, y as messageArgument, yt as inputPlugin, z as Tappable } from "./index-Bn0pFiae.mjs";
5
- export { type AdaptiveScale, Alpha, type AnchorTarget, types_d_exports as Anim, AnimPlayer, Animation, types_d_exports$1 as Assets, types_d_exports$2 as Audio, type BackResult, type BindOptions, Blur, Box, CANVAS_RESTARTS, type CanvasRestart, types_d_exports$3 as Clock, ColorMatrix, Countdown, type CountdownValue, DEMAND_REASONS, types_d_exports$4 as Debug, DebugTrigger, type DescriptionNode, Displacement, Display, Draggable, DropTarget, types_d_exports$5 as Effects, Emitter, Exiting, type FilterArea, types_d_exports$6 as Flow, type FrameColumns, type FrameReadResult, type FrameReadout, type FrameRecord, type FrameRing, Frames, Glow, HAPTIC_KINDS, type HapticKind, Held, Hovered, HudPart, type HudPartValue, types_d_exports$7 as I18n, types_d_exports$8 as Input, Layer, types_d_exports$9 as Lifecycle, LocalWrite, type LongFrameEntry, MONITOR_SECTIONS, types_d_exports$10 as Model, type MonitorConfig, type MonitorCounts, type MonitorSections, NineSlice, Noise, Now, Order, Outline, Overlay, type OverlayEventDetail, type OverlayValue, type OverlayWhat, PASS_KINDS, PERF_CAUSES, PERF_GAP_BUCKETS, PERF_LOG_VERSION, PROBLEM_RULES, Parent, type PassKind, type PassRecord, type PerfCause, type PerfChange, type PerfChangeEntry, type PerfCollectorLine, type PerfCounts, type PerfDisplay, type PerfEventLine, type PerfEventName, type PerfGapLine, type PerfHeaderLine, type PerfLogLine, type PerfLongFrameLine, type PerfMarkLine, type PerfMeasured, type PerfSampleLine, type PerfSpikeLine, type PerfStartupLine, type PerfTelemetryLine, type PerfThermalLine, types_d_exports$11 as Platform, type PlatformProvider, Pointer, PointerOver, type PoolTrim, type PoolTrimDetail, Pressable, Pressed, type ProblemEventDetail, type ProblemRule, types_d_exports$12 as Renderer, type RetakeWhy, SHADER_WHATS, SaveUnreadableError, type SceneSwitch, types_d_exports$13 as Scenes, ScrollState, type ShaderEventDetail, type ShaderWhat, Shape, Sprite, type SpriteBlend, Swipeable, Tappable, Text, type TextFormat, types_d_exports$14 as TextTypes, types_d_exports$15 as Time, Touchable, Traceable, Traced, Transform, Tree, types_d_exports$16 as Ui, type WarmDetail, type WhyEntry, type WhyLive, types_d_exports$17 as World, animPlugin, assetsPlugin, audioPlugin, bind, clockPlugin, component, contribution, createApp, createPlugin, cubicBezier, debugPlugin, defineAnimation, defineBundles, defineComponent, defineEffect, defineEmitter, defineFeature, defineFilter, defineGame, defineMotion, defineScene, defineStyle, defineTextStyles, defineTokens, effectsPlugin, exit, external, flattenFeatures, flowPlugin, frameAt, frames, guide, haptic, hint, i18nPlugin, inputPlugin, label, lifecyclePlugin, load, mark, messageArgument, messageDuration, modelPlugin, music, mut, parallel, platformPlugin, play, popup, projection, ready, rendererPlugin, resolve, resource, scenesPlugin, schedule, screen, sequence, set, sfx, slot, spawn, spawned, sprite, stagger, stopSfx, system, tag, textPlugin, timePlugin, to, tr, tween, type, uiPlugin, use, wait, worldPlugin };
1
+ import { $ as MonitorConfig, $t as PerfThermalLine, At as PERF_GAP_BUCKETS, B as Parent, Bt as PerfDisplay, Cn as exit, Ct as FrameRing, Dt as OverlayEventDetail, E as types_d_exports$13, En as type, Et as MonitorSections, F as HudPartValue, Fr as types_d_exports$3, Ft as PerfCause, Gt as PerfLogLine, Hr as types_d_exports$10, Ht as PerfEventName, I as NineSlice, It as PerfChange, Jt as PerfMeasured, Kt as PerfLongFrameLine, Lt as PerfChangeEntry, M as WhyEntry, Mt as PROBLEM_RULES, N as Display, Nt as PassKind, Ot as OverlayWhat, P as HudPart, Pt as PassRecord, Qt as PerfTelemetryLine, R as Overlay, Rt as PerfCollectorLine, St as FrameRecord, Tn as to, Tt as MONITOR_SECTIONS, U as Sprite, Ut as PerfGapLine, V as Shape, Vt as PerfEventLine, W as SpriteBlend, Wt as PerfHeaderLine, X as AdaptiveScale, Xt as PerfSpikeLine, Y as sprite, Yn as DescriptionNode, Yt as PerfSampleLine, Zt as PerfStartupLine, _t as RetakeWhy, an as ShaderWhat, bn as types_d_exports$6, bt as FrameReadResult, cn as CanvasRestart, dt as MonitorCounts, en as PoolTrimDetail, fi as types_d_exports$15, g as types_d_exports$1, ii as types_d_exports$9, in as ShaderEventDetail, ir as SceneSwitch, jt as PERF_LOG_VERSION, kr as types_d_exports$17, kt as PERF_CAUSES, ln as DEMAND_REASONS, lt as types_d_exports$12, nn as ProblemRule, on as WarmDetail, ot as PoolTrim, q as Transform, qn as AnchorTarget, qr as SaveUnreadableError, qt as PerfMarkLine, rn as SHADER_WHATS, sn as CANVAS_RESTARTS, tn as ProblemEventDetail, vt as WhyLive, wn as slot, wt as LongFrameEntry, xn as contribution, xt as FrameReadout, yt as FrameColumns, z as OverlayValue, zt as PerfCounts } from "./types-w5_A5TPL.mjs";
2
+ import { $ as sequence, E as FilterArea, G as HAPTIC_KINDS, H as HapticKind, J as frames, K as defineAnimation, Q as play, V as types_d_exports, X as mark, Y as haptic, Z as parallel, at as stopSfx, ct as wait, et as set, i as types_d_exports$16, it as stagger, nt as spawn, ot as tween, p as types_d_exports$2, q as external, rt as spawned, st as use, tt as sfx, ut as types_d_exports$4, v as types_d_exports$5 } from "./types-CJYudpme.mjs";
3
+ import { A as TextFormats, D as TextFormat, F as defineComponent, O as TextFormatAnswer, P as types_d_exports$14, S as FormattedNumber, X as types_d_exports$7, d as DebugTrigger, f as LocalWrite, h as defineTokens, k as TextFormatFunction, m as popup, p as ScrollState, u as Box, x as CountdownValue, y as BindOptions, z as types_d_exports$8 } from "./types-BbLjYfGR.mjs";
4
+ import { $ as system, A as Draggable, At as Text, B as Touchable, C as AnimPlayer, Ct as debugPlugin, D as defineBundles, Dt as animPlugin, E as defineScene, Et as assetsPlugin, F as PointerOver, G as Exiting, H as Traced, I as Pressable, J as Order, K as Layer, L as Pressed, M as Held, Mt as defineTextFormats, N as Hovered, Nt as defineTextStyles, O as load, Ot as projection, P as Pointer, Pt as label, Q as resource, R as Swipeable, S as defineMotion, St as effectsPlugin, T as Frames, Tt as audioPlugin, U as PASS_KINDS, V as Traceable, W as frameAt, X as component, Y as Tree, Z as mut, _ as defineStyle, _t as modelPlugin, a as defineEmitter, at as defineFeature, b as messageDuration, bt as i18nPlugin, c as Alpha, ct as uiPlugin, d as Displacement, dt as scenesPlugin, et as tag, f as Glow, ft as rendererPlugin, g as resolve, gt as types_d_exports$11, h as music, ht as PlatformProvider, i as screen, it as schedule, j as DropTarget, jt as bind, k as ready, kt as Countdown, l as Blur, lt as timePlugin, m as Outline, mt as BackResult, n as createPlugin, nt as guide, o as Emitter, ot as flattenFeatures, p as Noise, pt as platformPlugin, q as Now, r as defineGame, rt as hint, s as defineFilter, st as worldPlugin, t as createApp, tt as defineEffect, u as ColorMatrix, ut as textPlugin, v as tr, vt as lifecyclePlugin, w as Animation, wt as clockPlugin, x as cubicBezier, xt as flowPlugin, y as messageArgument, yt as inputPlugin, z as Tappable } from "./index-nK7iVsWx.mjs";
5
+ export { type AdaptiveScale, Alpha, type AnchorTarget, types_d_exports as Anim, AnimPlayer, Animation, types_d_exports$1 as Assets, types_d_exports$2 as Audio, type BackResult, type BindOptions, Blur, Box, CANVAS_RESTARTS, type CanvasRestart, types_d_exports$3 as Clock, ColorMatrix, Countdown, type CountdownValue, DEMAND_REASONS, types_d_exports$4 as Debug, DebugTrigger, type DescriptionNode, Displacement, Display, Draggable, DropTarget, types_d_exports$5 as Effects, Emitter, Exiting, type FilterArea, types_d_exports$6 as Flow, type FormattedNumber, type FrameColumns, type FrameReadResult, type FrameReadout, type FrameRecord, type FrameRing, Frames, Glow, HAPTIC_KINDS, type HapticKind, Held, Hovered, HudPart, type HudPartValue, types_d_exports$7 as I18n, types_d_exports$8 as Input, Layer, types_d_exports$9 as Lifecycle, LocalWrite, type LongFrameEntry, MONITOR_SECTIONS, types_d_exports$10 as Model, type MonitorConfig, type MonitorCounts, type MonitorSections, NineSlice, Noise, Now, Order, Outline, Overlay, type OverlayEventDetail, type OverlayValue, type OverlayWhat, PASS_KINDS, PERF_CAUSES, PERF_GAP_BUCKETS, PERF_LOG_VERSION, PROBLEM_RULES, Parent, type PassKind, type PassRecord, type PerfCause, type PerfChange, type PerfChangeEntry, type PerfCollectorLine, type PerfCounts, type PerfDisplay, type PerfEventLine, type PerfEventName, type PerfGapLine, type PerfHeaderLine, type PerfLogLine, type PerfLongFrameLine, type PerfMarkLine, type PerfMeasured, type PerfSampleLine, type PerfSpikeLine, type PerfStartupLine, type PerfTelemetryLine, type PerfThermalLine, types_d_exports$11 as Platform, type PlatformProvider, Pointer, PointerOver, type PoolTrim, type PoolTrimDetail, Pressable, Pressed, type ProblemEventDetail, type ProblemRule, types_d_exports$12 as Renderer, type RetakeWhy, SHADER_WHATS, SaveUnreadableError, type SceneSwitch, types_d_exports$13 as Scenes, ScrollState, type ShaderEventDetail, type ShaderWhat, Shape, Sprite, type SpriteBlend, Swipeable, Tappable, Text, type TextFormat, type TextFormatAnswer, type TextFormatFunction, type TextFormats, types_d_exports$14 as TextTypes, types_d_exports$15 as Time, Touchable, Traceable, Traced, Transform, Tree, types_d_exports$16 as Ui, type WarmDetail, type WhyEntry, type WhyLive, types_d_exports$17 as World, animPlugin, assetsPlugin, audioPlugin, bind, clockPlugin, component, contribution, createApp, createPlugin, cubicBezier, debugPlugin, defineAnimation, defineBundles, defineComponent, defineEffect, defineEmitter, defineFeature, defineFilter, defineGame, defineMotion, defineScene, defineStyle, defineTextFormats, defineTextStyles, defineTokens, effectsPlugin, exit, external, flattenFeatures, flowPlugin, frameAt, frames, guide, haptic, hint, i18nPlugin, inputPlugin, label, lifecyclePlugin, load, mark, messageArgument, messageDuration, modelPlugin, music, mut, parallel, platformPlugin, play, popup, projection, ready, rendererPlugin, resolve, resource, scenesPlugin, schedule, screen, sequence, set, sfx, slot, spawn, spawned, sprite, stagger, stopSfx, system, tag, textPlugin, timePlugin, to, tr, tween, type, uiPlugin, use, wait, worldPlugin };
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as sfx, $t as worldPlugin, A as types_exports$7, At as Glow, B as defineMotion, Bt as Animation, C as types_exports$14, Ct as messageDuration, D as types_exports$10, Dt as Blur, E as types_exports$11, Et as Alpha, F as types_exports$2, Ft as audioPlugin, G as external, Gt as MONITOR_SECTIONS, H as platformPlugin, Ht as rendererPlugin, I as types_exports$1, It as scenesPlugin, J as mark, Jt as PERF_LOG_VERSION, K as frames, Kt as PERF_CAUSES, L as types_exports, Lt as assetsPlugin, M as types_exports$5, Mt as Outline, N as types_exports$4, Nt as defineFilter, O as types_exports$9, Ot as ColorMatrix, P as types_exports$3, Pt as debugPlugin, Q as set, Qt as DEMAND_REASONS, R as uiPlugin, Rt as animPlugin, S as types_exports$15, St as messageArgument, T as types_exports$12, Tt as Emitter, U as HAPTIC_KINDS, Ut as PASS_KINDS, V as textPlugin, Vt as Frames, W as defineAnimation, Wt as frameAt, X as play, Xt as SHADER_WHATS, Y as parallel, Yt as PROBLEM_RULES, Z as sequence, Zt as CANVAS_RESTARTS, _ as defineBundles, _t as Tappable, a as cubicBezier, an as to, at as use, b as types_exports$17, bt as Traced, c as hint, cn as SaveUnreadableError, ct as Draggable, d as defineScene, dn as clockPlugin, dt as Hovered, en as flowPlugin, et as spawn, f as tr, ft as Pointer, g as music, gt as Swipeable, h as defineEmitter, ht as Pressed, i as screen, in as slot, it as tween, j as types_exports$6, jt as Noise, k as types_exports$8, kt as Displacement, l as schedule, ln as lifecyclePlugin, lt as DropTarget, m as flattenFeatures, mt as Pressable, n as createPlugin, nn as contribution, nt as stagger, o as defineEffect, on as type, ot as wait, p as defineFeature, pt as PointerOver, q as haptic, qt as PERF_GAP_BUCKETS, r as defineGame, rn as exit, rt as stopSfx, s as guide, sn as modelPlugin, st as inputPlugin, t as createApp, tt as spawned, u as projection, un as timePlugin, ut as Held, v as load, vt as Touchable, w as types_exports$13, wt as effectsPlugin, x as types_exports$16, xt as i18nPlugin, y as ready, yt as Traceable, z as resolve, zt as AnimPlayer } from "./src-BFa-zMmW.mjs";
2
- import { $ as Layer, B as Display, C as defineStyle, E as bind, G as Parent, H as NineSlice, J as Transform, K as Shape, O as defineTextStyles, Q as Exiting, S as defineTokens, T as Text, U as Overlay, V as HudPart, Z as sprite, _ as ScrollState, at as resource, b as popup, ct as tag, d as Box, et as Now, h as LocalWrite, it as mut, k as label, nt as Tree, ot as system, p as DebugTrigger, q as Sprite, rt as component, tt as Order, w as Countdown } from "./visual-B7TxMv1J.mjs";
1
+ import { $ as sfx, $t as worldPlugin, A as types_exports$7, At as Glow, B as defineMotion, Bt as Animation, C as types_exports$14, Ct as messageDuration, D as types_exports$10, Dt as Blur, E as types_exports$11, Et as Alpha, F as types_exports$2, Ft as audioPlugin, G as external, Gt as MONITOR_SECTIONS, H as platformPlugin, Ht as rendererPlugin, I as types_exports$1, It as scenesPlugin, J as mark, Jt as PERF_LOG_VERSION, K as frames, Kt as PERF_CAUSES, L as types_exports, Lt as assetsPlugin, M as types_exports$5, Mt as Outline, N as types_exports$4, Nt as defineFilter, O as types_exports$9, Ot as ColorMatrix, P as types_exports$3, Pt as debugPlugin, Q as set, Qt as DEMAND_REASONS, R as uiPlugin, Rt as animPlugin, S as types_exports$15, St as messageArgument, T as types_exports$12, Tt as Emitter, U as HAPTIC_KINDS, Ut as PASS_KINDS, V as textPlugin, Vt as Frames, W as defineAnimation, Wt as frameAt, X as play, Xt as SHADER_WHATS, Y as parallel, Yt as PROBLEM_RULES, Z as sequence, Zt as CANVAS_RESTARTS, _ as defineBundles, _t as Tappable, a as cubicBezier, an as to, at as use, b as types_exports$17, bt as Traced, c as hint, cn as SaveUnreadableError, ct as Draggable, d as defineScene, dn as clockPlugin, dt as Hovered, en as flowPlugin, et as spawn, f as tr, ft as Pointer, g as music, gt as Swipeable, h as defineEmitter, ht as Pressed, i as screen, in as slot, it as tween, j as types_exports$6, jt as Noise, k as types_exports$8, kt as Displacement, l as schedule, ln as lifecyclePlugin, lt as DropTarget, m as flattenFeatures, mt as Pressable, n as createPlugin, nn as contribution, nt as stagger, o as defineEffect, on as type, ot as wait, p as defineFeature, pt as PointerOver, q as haptic, qt as PERF_GAP_BUCKETS, r as defineGame, rn as exit, rt as stopSfx, s as guide, sn as modelPlugin, st as inputPlugin, t as createApp, tt as spawned, u as projection, un as timePlugin, ut as Held, v as load, vt as Touchable, w as types_exports$13, wt as effectsPlugin, x as types_exports$16, xt as i18nPlugin, y as ready, yt as Traceable, z as resolve, zt as AnimPlayer } from "./src-BTPWdbHH.mjs";
2
+ import { $ as Shape, A as Countdown, F as defineTextStyles, I as label, J as HudPart, M as bind, P as defineTextFormats, Q as Parent, S as popup, T as defineStyle, X as Overlay, Y as NineSlice, _ as LocalWrite, at as Exiting, ct as Order, dt as mut, et as Sprite, ft as resource, h as DebugTrigger, ht as tag, it as sprite, j as Text, lt as Tree, ot as Layer, p as Box, pt as system, q as Display, st as Now, tt as Transform, ut as component, w as defineTokens, y as ScrollState } from "./visual-CULAJg6b.mjs";
3
3
  import { t as defineComponent } from "./component-DGg5DqKK.mjs";
4
- export { Alpha, types_exports as Anim, AnimPlayer, Animation, types_exports$1 as Assets, types_exports$2 as Audio, Blur, Box, CANVAS_RESTARTS, types_exports$3 as Clock, ColorMatrix, Countdown, DEMAND_REASONS, types_exports$4 as Debug, DebugTrigger, Displacement, Display, Draggable, DropTarget, types_exports$5 as Effects, Emitter, Exiting, types_exports$6 as Flow, Frames, Glow, HAPTIC_KINDS, Held, Hovered, HudPart, types_exports$7 as I18n, types_exports$8 as Input, Layer, types_exports$9 as Lifecycle, LocalWrite, MONITOR_SECTIONS, types_exports$10 as Model, NineSlice, Noise, Now, Order, Outline, Overlay, PASS_KINDS, PERF_CAUSES, PERF_GAP_BUCKETS, PERF_LOG_VERSION, PROBLEM_RULES, Parent, types_exports$11 as Platform, Pointer, PointerOver, Pressable, Pressed, types_exports$12 as Renderer, SHADER_WHATS, SaveUnreadableError, types_exports$13 as Scenes, ScrollState, Shape, Sprite, Swipeable, Tappable, Text, types_exports$14 as TextTypes, types_exports$15 as Time, Touchable, Traceable, Traced, Transform, Tree, types_exports$16 as Ui, types_exports$17 as World, animPlugin, assetsPlugin, audioPlugin, bind, clockPlugin, component, contribution, createApp, createPlugin, cubicBezier, debugPlugin, defineAnimation, defineBundles, defineComponent, defineEffect, defineEmitter, defineFeature, defineFilter, defineGame, defineMotion, defineScene, defineStyle, defineTextStyles, defineTokens, effectsPlugin, exit, external, flattenFeatures, flowPlugin, frameAt, frames, guide, haptic, hint, i18nPlugin, inputPlugin, label, lifecyclePlugin, load, mark, messageArgument, messageDuration, modelPlugin, music, mut, parallel, platformPlugin, play, popup, projection, ready, rendererPlugin, resolve, resource, scenesPlugin, schedule, screen, sequence, set, sfx, slot, spawn, spawned, sprite, stagger, stopSfx, system, tag, textPlugin, timePlugin, to, tr, tween, type, uiPlugin, use, wait, worldPlugin };
4
+ export { Alpha, types_exports as Anim, AnimPlayer, Animation, types_exports$1 as Assets, types_exports$2 as Audio, Blur, Box, CANVAS_RESTARTS, types_exports$3 as Clock, ColorMatrix, Countdown, DEMAND_REASONS, types_exports$4 as Debug, DebugTrigger, Displacement, Display, Draggable, DropTarget, types_exports$5 as Effects, Emitter, Exiting, types_exports$6 as Flow, Frames, Glow, HAPTIC_KINDS, Held, Hovered, HudPart, types_exports$7 as I18n, types_exports$8 as Input, Layer, types_exports$9 as Lifecycle, LocalWrite, MONITOR_SECTIONS, types_exports$10 as Model, NineSlice, Noise, Now, Order, Outline, Overlay, PASS_KINDS, PERF_CAUSES, PERF_GAP_BUCKETS, PERF_LOG_VERSION, PROBLEM_RULES, Parent, types_exports$11 as Platform, Pointer, PointerOver, Pressable, Pressed, types_exports$12 as Renderer, SHADER_WHATS, SaveUnreadableError, types_exports$13 as Scenes, ScrollState, Shape, Sprite, Swipeable, Tappable, Text, types_exports$14 as TextTypes, types_exports$15 as Time, Touchable, Traceable, Traced, Transform, Tree, types_exports$16 as Ui, types_exports$17 as World, animPlugin, assetsPlugin, audioPlugin, bind, clockPlugin, component, contribution, createApp, createPlugin, cubicBezier, debugPlugin, defineAnimation, defineBundles, defineComponent, defineEffect, defineEmitter, defineFeature, defineFilter, defineGame, defineMotion, defineScene, defineStyle, defineTextFormats, defineTextStyles, defineTokens, effectsPlugin, exit, external, flattenFeatures, flowPlugin, frameAt, frames, guide, haptic, hint, i18nPlugin, inputPlugin, label, lifecyclePlugin, load, mark, messageArgument, messageDuration, modelPlugin, music, mut, parallel, platformPlugin, play, popup, projection, ready, rendererPlugin, resolve, resource, scenesPlugin, schedule, screen, sequence, set, sfx, slot, spawn, spawned, sprite, stagger, stopSfx, system, tag, textPlugin, timePlugin, to, tr, tween, type, uiPlugin, use, wait, worldPlugin };
@@ -1,9 +1,9 @@
1
- import { Er as Explained, Fr as Api, Mn as FlowGraph, Pn as JournalEntry, Z as Api$2, ct as Under, dr as ComponentSchema, ft as RenderStats, gn as Position, gr as FrameDiff, h as Usage, hr as EntitySnapshot, qr as Snapshot, t as Api$3, wr as Api$1 } from "./types-CbVXXqPs.mjs";
2
- import { a as AudioApi, g as EffectsStats, h as EffectsApi, r as UiApi, u as SoundEntry } from "./types-C5gLBKbm.mjs";
3
- import { c as UiNode } from "./types-OBpR0u05.mjs";
4
- import { t as HeadlessApp } from "./headless-DtDdn5gg.mjs";
5
- import { a as InputOf, c as Source, i as InputArguments, l as WatchApp, o as InputSchema, t as CheatEntry, u as WatchInput } from "./types-DNWWlVky.mjs";
6
- import { n as defineSource } from "./define-N-2nQNK_.mjs";
1
+ import { Dr as Explained, Fn as JournalEntry, Ir as Api, Jr as Snapshot, Nn as FlowGraph, Tr as Api$1, Z as Api$2, _r as FrameDiff, ct as Under, fr as ComponentSchema, ft as RenderStats, gn as Position, gr as EntitySnapshot, h as Usage, t as Api$3 } from "./types-w5_A5TPL.mjs";
2
+ import { a as AudioApi, g as EffectsStats, h as EffectsApi, r as UiApi, u as SoundEntry } from "./types-CJYudpme.mjs";
3
+ import { c as UiNode } from "./types-BbLjYfGR.mjs";
4
+ import { t as HeadlessApp } from "./headless-CtRq6Uij.mjs";
5
+ import { a as InputArguments, d as WatchApp, f as WatchInput, l as Source, o as InputOf, s as InputSchema, t as CheatEntry } from "./types-ehmvA6yu.mjs";
6
+ import { n as defineSource } from "./define-DE1XcBwC.mjs";
7
7
 
8
8
  //#region src/plugins/flow/doors/read.d.ts
9
9
  /**
package/dist/inspect.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as defineSource } from "./session-DuZfGZWk.mjs";
2
- import { n as read, r as watch, t as sources } from "./sources-Djd8MjP9.mjs";
1
+ import { c as defineSource } from "./session-D0AYRm5T.mjs";
2
+ import { n as read, r as watch, t as sources } from "./sources-kL64Svgl.mjs";
3
3
  import "./inspect-la_KkjCS.mjs";
4
4
  export { defineSource, read, sources, watch };
@@ -1,2 +1,2 @@
1
- import { a as jsxs, i as jsxDEV, n as JSX, r as jsx, t as Fragment } from "./runtime-DOvgFNLH.mjs";
1
+ import { a as jsxs, i as jsxDEV, n as JSX, r as jsx, t as Fragment } from "./runtime-CmRqaHmz.mjs";
2
2
  export { Fragment, type JSX, jsx, jsxDEV, jsxs };
@@ -1,2 +1,2 @@
1
- import { a as jsxs, n as JSX, r as jsx, t as Fragment } from "./runtime-DOvgFNLH.mjs";
1
+ import { a as jsxs, n as JSX, r as jsx, t as Fragment } from "./runtime-CmRqaHmz.mjs";
2
2
  export { Fragment, type JSX, jsx, jsxs };
@@ -1,7 +1,7 @@
1
1
  import { a as sheetAlone, p as graphHash } from "./capture-BtS6_oWr.mjs";
2
2
  import { a as isDev, i as isControl, n as controlRefused, o as notInstalled, r as isAgent, t as controlReadOnly } from "./dev-BNndV-hU.mjs";
3
3
  import { n as reproBookmark } from "./headless-CCiUwvlp.mjs";
4
- import { a as readTarget, i as isProjectionTarget, l as inputSchema, n as isTainted, o as inputOrEmpty, r as recordCheat, s as defineCommand } from "./session-DuZfGZWk.mjs";
4
+ import { a as readTarget, i as isProjectionTarget, l as inputSchema, n as isTainted, o as inputOrEmpty, r as recordCheat, s as defineCommand } from "./session-D0AYRm5T.mjs";
5
5
  //#region src/plugins/anim/control.ts
6
6
  /**
7
7
  * @file anim plugin — the anim command of the `/control` door: switch reduced motion. Dev and
@@ -1,4 +1,4 @@
1
- import { _ as UiIntrinsicElements, a as JsxChild, t as DescriptionNode } from "./types-OBpR0u05.mjs";
1
+ import { _ as UiIntrinsicElements, a as JsxChild, t as DescriptionNode } from "./types-BbLjYfGR.mjs";
2
2
 
3
3
  //#region src/plugins/ui/jsx/runtime.d.ts
4
4
  /** What the compiler passes as props: the children plus whatever the tag declared. */
@@ -13,6 +13,19 @@ function checkId(kind, id) {
13
13
  throw new Error(`[game] The ${kind} id "${id}" is not a dotted name.\n Name it like "game.position": camelCase words joined by dots.`);
14
14
  }
15
15
  /**
16
+ * Refuses a choice listed twice: the overlay would draw two rows of one name, and a tap on the
17
+ * second would run the first's.
18
+ *
19
+ * @param id - The id of the command, for the message.
20
+ * @param choices - The choices of the command, when it has some.
21
+ * @throws {Error} Naming the first choice that comes twice.
22
+ */
23
+ function checkChoices(id, choices) {
24
+ const twice = choices?.find((choice, index) => choices.indexOf(choice) !== index);
25
+ if (twice === void 0) return;
26
+ throw new Error(`[game] The command ${id} lists the choice "${twice}" twice.\n Name each choice once.`);
27
+ }
28
+ /**
16
29
  * Builds the input schema of a door without an object literal (F77). A literal such as
17
30
  * `{ x: "number", y: "number" }` shares V8's hidden shape with the game's points and stores
18
31
  * strings where they store numbers: V8 turns the fields of that shape tagged, and every fractional
@@ -63,12 +76,14 @@ function defineSource(source) {
63
76
  * control form for the others (see docs/doors.md), so a production build drops it. A game's
64
77
  * `.dev` command with only the `__MOKU_GAME_DEV__` guard runs in dev and is refused on a debug
65
78
  * page. `overlay` shows it in the editor's overlay: `"toggle"` with the input `{ on: "boolean" }`
66
- * and a `value(app)` the switch is drawn from, `"button"` with no required input and no value;
67
- * any other combination is a type error.
79
+ * and a `value(app)` the switch is drawn from, or with `choices` and a `choice(app)` too and
80
+ * `choice` in the input, `"button"` with no required input and no value; any other combination is
81
+ * a type error.
68
82
  *
69
83
  * @param command - The descriptor.
70
84
  * @returns The same descriptor, frozen.
71
- * @throws {Error} When the id is not a dotted name such as `"game.answer"`.
85
+ * @throws {Error} When the id is not a dotted name such as `"game.answer"`, or `choices` holds a
86
+ * word twice.
72
87
  * @example
73
88
  * ```ts
74
89
  * // A game's .dev module: open the shop from anywhere, through the graph.
@@ -107,9 +122,30 @@ function defineSource(source) {
107
122
  * });
108
123
  * // The overlay draws a switch "Glow", on; a tap runs it with { on: false } and the next frame draws no glow.
109
124
  * ```
125
+ * @example
126
+ * ```ts
127
+ * // features/purchases/simulate.dev.ts — a tester on a phone picks how a purchase ends.
128
+ * export const simulate = defineCommand({
129
+ * id: "purchases.simulate",
130
+ * title: "Simulated purchases",
131
+ * input: { on: "boolean", choice: "string" },
132
+ * effect: "cheat",
133
+ * overlay: "toggle",
134
+ * choices: ["success", "failure", "delay"],
135
+ * value: (app: { readonly purchases: PurchasesApi }) => app.purchases.overridden(),
136
+ * choice: () => readSetting().mode, // the game's own .dev module remembers the pick
137
+ * run: (app, { on, choice }) => {
138
+ * // The control guard, then:
139
+ * writeSetting({ mode: choice });
140
+ * app.purchases.simulate(on ? choice : undefined);
141
+ * }
142
+ * });
143
+ * // The overlay draws a switch with the row success, failure, delay; a tap on failure runs { on: true, choice: "failure" }.
144
+ * ```
110
145
  */
111
146
  function defineCommand(command) {
112
147
  checkId("command", command.id);
148
+ checkChoices(command.id, command.choices);
113
149
  Object.freeze(command.input);
114
150
  return Object.freeze(command);
115
151
  }
@@ -1,6 +1,6 @@
1
- import { $ as Layer, F as parentOf, H as NineSlice, K as Shape, d as Box, r as drawnRect, z as rootPoseOf } from "./visual-B7TxMv1J.mjs";
1
+ import { $ as Shape, H as parentOf, K as rootPoseOf, Y as NineSlice, i as drawnRect, ot as Layer, p as Box } from "./visual-CULAJg6b.mjs";
2
2
  import { o as notInstalled } from "./dev-BNndV-hU.mjs";
3
- import { a as readTarget, c as defineSource, l as inputSchema, n as isTainted, o as inputOrEmpty, t as cheatsOf } from "./session-DuZfGZWk.mjs";
3
+ import { a as readTarget, c as defineSource, l as inputSchema, n as isTainted, o as inputOrEmpty, t as cheatsOf } from "./session-D0AYRm5T.mjs";
4
4
  //#region src/plugins/flow/doors/read.ts
5
5
  /**
6
6
  * @file flow/doors — `read` and `watch`, the `/inspect` side. Neither changes the game.