@vgai/engine 0.5.52 → 0.5.56
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/adapter/adapter-module.d.ts +32 -1
- package/dist/adapter/adapter-module.d.ts.map +1 -1
- package/dist/adapter/adapter-module.js +24 -1
- package/dist/adapter/audio-meter.d.ts +14 -0
- package/dist/adapter/audio-meter.d.ts.map +1 -0
- package/dist/adapter/audio-meter.js +20 -0
- package/dist/runtime/game.d.ts.map +1 -1
- package/dist/runtime/game.js +10 -1
- package/dist/settings/schema.d.ts +2 -3
- package/dist/settings/schema.d.ts.map +1 -1
- package/dist/settings/schema.js +1 -11
- package/package.json +1 -1
- package/schemas/vgai-settings.schema.json +2 -12
- package/src/adapter/adapter-module.ts +49 -1
- package/src/adapter/audio-meter.ts +21 -0
- package/src/runtime/game.ts +10 -2
- package/src/settings/schema.ts +1 -13
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
* "Unknown input must REJECT LOUDLY").
|
|
20
20
|
* - individual FIELDS may be closures, evaluated lazily against the mounted
|
|
21
21
|
* game (`ObservationDeclaration.answer`). A closure is never required to
|
|
22
|
-
* read the table.
|
|
22
|
+
* read the table. `editor.Layout` is an imported React component: the
|
|
23
|
+
* editor invokes it to compose surfaces and edit/play behavior. It is a
|
|
24
|
+
* runtime value, never a serialized manifest setting or a registry key.
|
|
23
25
|
*
|
|
24
26
|
* **Zero inference.** A binding is a DECLARATION or a finder SELECTION the
|
|
25
27
|
* adapter makes — never something the host sniffs out. Finder algorithms
|
|
@@ -40,6 +42,7 @@
|
|
|
40
42
|
* — identity, roots, boot mode, `server.room`. Everything that binds behavior
|
|
41
43
|
* is the adapter's. This wave adds NO manifest field.
|
|
42
44
|
*/
|
|
45
|
+
import type { ComponentType } from 'react';
|
|
43
46
|
import { z } from 'zod';
|
|
44
47
|
import type { ResolvedAdapterRoot } from '../manifest/load';
|
|
45
48
|
import type { AdapterSurface } from './adapter-surface';
|
|
@@ -473,8 +476,25 @@ export interface AdapterInputBinding {
|
|
|
473
476
|
/** Release every app-owned virtual action. */
|
|
474
477
|
readonly clear: (game: unknown) => void;
|
|
475
478
|
}
|
|
479
|
+
/** Project-owned editor defaults. User layout choices remain session state. */
|
|
480
|
+
export interface AdapterEditorLayoutProps {
|
|
481
|
+
readonly playing: boolean;
|
|
482
|
+
readonly paused: boolean;
|
|
483
|
+
readonly onReturnToProjectScreen?: (() => void) | undefined;
|
|
484
|
+
}
|
|
485
|
+
export interface AdapterEditorConfiguration {
|
|
486
|
+
/** Imported React implementation; owns both composition and edit/play presentation. */
|
|
487
|
+
readonly Layout?: ComponentType<AdapterEditorLayoutProps>;
|
|
488
|
+
/** Registered workspace to open when this checkout has no saved workspace. */
|
|
489
|
+
readonly workspace?: string;
|
|
490
|
+
/** Inspector layout beneath the active workspace and the user's override. */
|
|
491
|
+
readonly inspector?: 'column' | 'properties' | 'card';
|
|
492
|
+
/** Utility registry ids to reveal when Play settles; omitted means none. */
|
|
493
|
+
readonly playUtilities?: readonly string[];
|
|
494
|
+
}
|
|
476
495
|
/** The adapter module's default export, after {@link defineAdapter}. */
|
|
477
496
|
export interface AdapterDefinition {
|
|
497
|
+
readonly editor?: AdapterEditorConfiguration;
|
|
478
498
|
readonly regions: RegionBinding;
|
|
479
499
|
/**
|
|
480
500
|
* Per-region parameters for the `'manifest-roots'` RULE, keyed by manifest
|
|
@@ -491,6 +511,7 @@ export interface AdapterDefinition {
|
|
|
491
511
|
* first-party case, and an adapter's SIZE measures the game's distance from
|
|
492
512
|
* native. */
|
|
493
513
|
export interface AdapterDefinitionInput {
|
|
514
|
+
readonly editor?: AdapterEditorConfiguration;
|
|
494
515
|
readonly regions?: RegionBinding;
|
|
495
516
|
readonly regionIncludes?: Readonly<Record<string, AdapterRegionOverlay>>;
|
|
496
517
|
readonly documents?: AdapterDocumentTable;
|
|
@@ -498,6 +519,16 @@ export interface AdapterDefinitionInput {
|
|
|
498
519
|
readonly input?: AdapterInputBinding | undefined;
|
|
499
520
|
}
|
|
500
521
|
export declare const AdapterDefinitionSchema: z.ZodObject<{
|
|
522
|
+
editor: z.ZodOptional<z.ZodObject<{
|
|
523
|
+
Layout: z.ZodOptional<z.ZodCustom<ComponentType<AdapterEditorLayoutProps>, ComponentType<AdapterEditorLayoutProps>>>;
|
|
524
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
525
|
+
inspector: z.ZodOptional<z.ZodEnum<{
|
|
526
|
+
properties: "properties";
|
|
527
|
+
column: "column";
|
|
528
|
+
card: "card";
|
|
529
|
+
}>>;
|
|
530
|
+
playUtilities: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
531
|
+
}, z.core.$strict>>;
|
|
501
532
|
regions: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"manifest-roots">, z.ZodArray<z.ZodObject<{
|
|
502
533
|
id: z.ZodString;
|
|
503
534
|
surface: z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter-module.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter-module.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"adapter-module.d.ts","sourceRoot":"","sources":["../../src/adapter/adapter-module.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAsB,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAMvE;;;;GAIG;AACH,eAAO,MAAM,eAAe,wDAAyD,CAAC;AACtF,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAA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BAA2B,GAAG,iBAAiB,CA0BnF;AAED,gFAAgF;AAChF,MAAM,WAAW,oBAAoB;IACnC,mFAAmF;IACnF,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC3C;oDACgD;IAChD,QAAQ,CAAC,cAAc,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC;CAC1E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,iBAAiB,CAYnF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAQxE"}
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
* "Unknown input must REJECT LOUDLY").
|
|
20
20
|
* - individual FIELDS may be closures, evaluated lazily against the mounted
|
|
21
21
|
* game (`ObservationDeclaration.answer`). A closure is never required to
|
|
22
|
-
* read the table.
|
|
22
|
+
* read the table. `editor.Layout` is an imported React component: the
|
|
23
|
+
* editor invokes it to compose surfaces and edit/play behavior. It is a
|
|
24
|
+
* runtime value, never a serialized manifest setting or a registry key.
|
|
23
25
|
*
|
|
24
26
|
* **Zero inference.** A binding is a DECLARATION or a finder SELECTION the
|
|
25
27
|
* adapter makes — never something the host sniffs out. Finder algorithms
|
|
@@ -370,6 +372,16 @@ const AdapterInputBindingSchema = z
|
|
|
370
372
|
}),
|
|
371
373
|
})
|
|
372
374
|
.strict();
|
|
375
|
+
const AdapterEditorConfigurationSchema = z
|
|
376
|
+
.object({
|
|
377
|
+
Layout: z
|
|
378
|
+
.custom((value) => typeof value === 'function', 'Layout must be an imported React component')
|
|
379
|
+
.optional(),
|
|
380
|
+
workspace: z.string().min(1).optional(),
|
|
381
|
+
inspector: z.enum(['column', 'properties', 'card']).optional(),
|
|
382
|
+
playUtilities: z.array(z.string().min(1)).optional(),
|
|
383
|
+
})
|
|
384
|
+
.strict();
|
|
373
385
|
/**
|
|
374
386
|
* Why the two forms may not be combined, said in the error a game's author
|
|
375
387
|
* reads. An explicit region list REPLACES the derivation and its entries carry
|
|
@@ -382,6 +394,7 @@ const REGION_INCLUDES_WITH_LIST_REFUSAL = '`regionIncludes` states parameters fo
|
|
|
382
394
|
'list and let the derivation run.';
|
|
383
395
|
export const AdapterDefinitionSchema = z
|
|
384
396
|
.object({
|
|
397
|
+
editor: AdapterEditorConfigurationSchema.optional(),
|
|
385
398
|
regions: RegionBindingSchema.optional(),
|
|
386
399
|
regionIncludes: RegionIncludesSchema.optional(),
|
|
387
400
|
documents: AdapterDocumentTableSchema.optional(),
|
|
@@ -413,6 +426,16 @@ export function defineAdapter(input = {}) {
|
|
|
413
426
|
.join('; ')}`);
|
|
414
427
|
}
|
|
415
428
|
return Object.freeze({
|
|
429
|
+
...(input.editor
|
|
430
|
+
? {
|
|
431
|
+
editor: Object.freeze({
|
|
432
|
+
...input.editor,
|
|
433
|
+
...(input.editor.playUtilities
|
|
434
|
+
? { playUtilities: Object.freeze([...input.editor.playUtilities]) }
|
|
435
|
+
: {}),
|
|
436
|
+
}),
|
|
437
|
+
}
|
|
438
|
+
: {}),
|
|
416
439
|
regions: input.regions ?? 'manifest-roots',
|
|
417
440
|
regionIncludes: Object.freeze({ ...(input.regionIncludes ?? {}) }),
|
|
418
441
|
documents: Object.freeze({ ...(input.documents ?? {}) }),
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meter arithmetic over an `AudioAdapter`'s `AudioMeterFrame.level` — the one
|
|
3
|
+
* place a linear RMS level becomes dBFS and a bar fill. Lives beside the
|
|
4
|
+
* adapter because both readers of a level (the editor's header meter and the
|
|
5
|
+
* `@vgai/game` audio debugger) are consumers of the adapter, and neither may
|
|
6
|
+
* import the other.
|
|
7
|
+
*/
|
|
8
|
+
/** Linear RMS level → dBFS. Silence clamps to `floorDb` (log of 0 is -∞). */
|
|
9
|
+
export declare function levelToDb(level: number, floorDb?: number): number;
|
|
10
|
+
/** Meter-bar fill percentage: dB-scaled from a -60 dBFS floor (a linear
|
|
11
|
+
* scale would pin every real-world level into the bottom pixels). 0 for
|
|
12
|
+
* silence, 100 at/above full scale. */
|
|
13
|
+
export declare function meterPercent(level: number, floorDb?: number): number;
|
|
14
|
+
//# sourceMappingURL=audio-meter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-meter.d.ts","sourceRoot":"","sources":["../../src/adapter/audio-meter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,6EAA6E;AAC7E,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAM,GAAG,MAAM,CAG9D;AAED;;wCAEwC;AACxC,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,SAAM,GAAG,MAAM,CAGjE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meter arithmetic over an `AudioAdapter`'s `AudioMeterFrame.level` — the one
|
|
3
|
+
* place a linear RMS level becomes dBFS and a bar fill. Lives beside the
|
|
4
|
+
* adapter because both readers of a level (the editor's header meter and the
|
|
5
|
+
* `@vgai/game` audio debugger) are consumers of the adapter, and neither may
|
|
6
|
+
* import the other.
|
|
7
|
+
*/
|
|
8
|
+
/** Linear RMS level → dBFS. Silence clamps to `floorDb` (log of 0 is -∞). */
|
|
9
|
+
export function levelToDb(level, floorDb = -60) {
|
|
10
|
+
if (!(level > 0))
|
|
11
|
+
return floorDb;
|
|
12
|
+
return Math.max(floorDb, 20 * Math.log10(level));
|
|
13
|
+
}
|
|
14
|
+
/** Meter-bar fill percentage: dB-scaled from a -60 dBFS floor (a linear
|
|
15
|
+
* scale would pin every real-world level into the bottom pixels). 0 for
|
|
16
|
+
* silence, 100 at/above full scale. */
|
|
17
|
+
export function meterPercent(level, floorDb = -60) {
|
|
18
|
+
const db = levelToDb(level, floorDb);
|
|
19
|
+
return Math.round(((db - floorDb) / -floorDb) * 100);
|
|
20
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../src/runtime/game.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../src/runtime/game.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAgB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAA4B,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,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package/dist/runtime/game.js
CHANGED
|
@@ -411,6 +411,7 @@ export function createGame(opts) {
|
|
|
411
411
|
// biome-ignore lint/suspicious/noConsole: see comment above
|
|
412
412
|
console.warn(message);
|
|
413
413
|
}
|
|
414
|
+
const audioMuteBeforePause = new WeakMap();
|
|
414
415
|
/** Fan out a loop-gate (self-driven roots) + audio-gate call over every
|
|
415
416
|
* `pausable` world, reporting honestly (once) wherever the capability is
|
|
416
417
|
* absent — shared by `pause()`/`resume()` below (same fan-out, opposite
|
|
@@ -443,7 +444,15 @@ export function createGame(opts) {
|
|
|
443
444
|
// the editor yet paradoxically reported as ungateable here.
|
|
444
445
|
const audio = declaredSystemAdapters.get(world.id)?.audio ?? world.mounted.systems?.audio;
|
|
445
446
|
if (audio) {
|
|
446
|
-
|
|
447
|
+
if (next) {
|
|
448
|
+
if (!audioMuteBeforePause.has(audio))
|
|
449
|
+
audioMuteBeforePause.set(audio, audio.isMuted());
|
|
450
|
+
audio.setMuted(true);
|
|
451
|
+
}
|
|
452
|
+
else if (audioMuteBeforePause.has(audio)) {
|
|
453
|
+
audio.setMuted(audioMuteBeforePause.get(audio));
|
|
454
|
+
audioMuteBeforePause.delete(audio);
|
|
455
|
+
}
|
|
447
456
|
}
|
|
448
457
|
else if (next &&
|
|
449
458
|
!declaredAbsences.get(world.id)?.some((absence) => absence.slot === 'audio')) {
|
|
@@ -37,6 +37,7 @@ export declare const ChromeRegionsSettingsSchema: z.ZodObject<{
|
|
|
37
37
|
inspector: z.ZodOptional<z.ZodEnum<{
|
|
38
38
|
properties: "properties";
|
|
39
39
|
column: "column";
|
|
40
|
+
card: "card";
|
|
40
41
|
}>>;
|
|
41
42
|
drawer: z.ZodOptional<z.ZodEnum<{
|
|
42
43
|
hidden: "hidden";
|
|
@@ -64,6 +65,7 @@ export declare const EditorSettingsSchema: z.ZodObject<{
|
|
|
64
65
|
inspector: z.ZodOptional<z.ZodEnum<{
|
|
65
66
|
properties: "properties";
|
|
66
67
|
column: "column";
|
|
68
|
+
card: "card";
|
|
67
69
|
}>>;
|
|
68
70
|
drawer: z.ZodOptional<z.ZodEnum<{
|
|
69
71
|
hidden: "hidden";
|
|
@@ -72,9 +74,6 @@ export declare const EditorSettingsSchema: z.ZodObject<{
|
|
|
72
74
|
}, z.core.$strict>>;
|
|
73
75
|
}, z.core.$strict>>;
|
|
74
76
|
keymap: z.ZodOptional<z.ZodString>;
|
|
75
|
-
workspace: z.ZodOptional<z.ZodObject<{
|
|
76
|
-
default: z.ZodOptional<z.ZodString>;
|
|
77
|
-
}, z.core.$strict>>;
|
|
78
77
|
devicePreview: z.ZodOptional<z.ZodObject<{
|
|
79
78
|
preset: z.ZodOptional<z.ZodString>;
|
|
80
79
|
touch: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/settings/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,2BAA2B
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/settings/schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;kBAY0B,CAAC;AAEnE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiCsD,CAAC;AAExF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,8DAA8D;AAC9D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAM/C;kEACkE;AAClE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,GAAG,cAAc,CAY9F;AAED;0DAC0D;AAC1D,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,GACX;IAAE,QAAQ,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAE,CASjF"}
|
package/dist/settings/schema.js
CHANGED
|
@@ -28,7 +28,7 @@ export const ChromeRegionsSettingsSchema = z
|
|
|
28
28
|
header: RegionVisibility.optional().describe('The top header bar.'),
|
|
29
29
|
shelf: RegionVisibility.optional().describe('The utility shelf.'),
|
|
30
30
|
inspector: z
|
|
31
|
-
.enum(['column', 'properties'])
|
|
31
|
+
.enum(['column', 'properties', 'card'])
|
|
32
32
|
.optional()
|
|
33
33
|
.describe('Inspector presentation: the narrow docked column or a properties panel.'),
|
|
34
34
|
drawer: RegionVisibility.optional().describe('The bottom drawer.'),
|
|
@@ -54,16 +54,6 @@ export const EditorSettingsSchema = z
|
|
|
54
54
|
.optional()
|
|
55
55
|
.describe('How the editor chrome looks.'),
|
|
56
56
|
keymap: z.string().optional().describe('Active keymap preset id (`vgai`, `blender`, …).'),
|
|
57
|
-
workspace: z
|
|
58
|
-
.object({
|
|
59
|
-
default: z
|
|
60
|
-
.string()
|
|
61
|
-
.optional()
|
|
62
|
-
.describe('The workspace a fresh checkout opens in, when it applies to the project shape.'),
|
|
63
|
-
})
|
|
64
|
-
.strict()
|
|
65
|
-
.optional()
|
|
66
|
-
.describe('Workspace defaults.'),
|
|
67
57
|
devicePreview: z
|
|
68
58
|
.object({
|
|
69
59
|
preset: z.string().optional().describe('Device preview frame preset id.'),
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@vgai/engine",
|
|
3
3
|
"author": "Volter AI, Inc.",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
-
"version": "0.5.
|
|
5
|
+
"version": "0.5.56",
|
|
6
6
|
"description": "Readable TypeScript game engine and universal host for Three.js, PixiJS, and React games.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"game-engine",
|
|
@@ -51,7 +51,8 @@
|
|
|
51
51
|
"type": "string",
|
|
52
52
|
"enum": [
|
|
53
53
|
"column",
|
|
54
|
-
"properties"
|
|
54
|
+
"properties",
|
|
55
|
+
"card"
|
|
55
56
|
]
|
|
56
57
|
},
|
|
57
58
|
"drawer": {
|
|
@@ -73,17 +74,6 @@
|
|
|
73
74
|
"description": "Active keymap preset id (`vgai`, `blender`, …).",
|
|
74
75
|
"type": "string"
|
|
75
76
|
},
|
|
76
|
-
"workspace": {
|
|
77
|
-
"description": "Workspace defaults.",
|
|
78
|
-
"type": "object",
|
|
79
|
-
"properties": {
|
|
80
|
-
"default": {
|
|
81
|
-
"description": "The workspace a fresh checkout opens in, when it applies to the project shape.",
|
|
82
|
-
"type": "string"
|
|
83
|
-
}
|
|
84
|
-
},
|
|
85
|
-
"additionalProperties": false
|
|
86
|
-
},
|
|
87
77
|
"devicePreview": {
|
|
88
78
|
"description": "The device frame the Game document previews in.",
|
|
89
79
|
"type": "object",
|
|
@@ -19,7 +19,9 @@
|
|
|
19
19
|
* "Unknown input must REJECT LOUDLY").
|
|
20
20
|
* - individual FIELDS may be closures, evaluated lazily against the mounted
|
|
21
21
|
* game (`ObservationDeclaration.answer`). A closure is never required to
|
|
22
|
-
* read the table.
|
|
22
|
+
* read the table. `editor.Layout` is an imported React component: the
|
|
23
|
+
* editor invokes it to compose surfaces and edit/play behavior. It is a
|
|
24
|
+
* runtime value, never a serialized manifest setting or a registry key.
|
|
23
25
|
*
|
|
24
26
|
* **Zero inference.** A binding is a DECLARATION or a finder SELECTION the
|
|
25
27
|
* adapter makes — never something the host sniffs out. Finder algorithms
|
|
@@ -41,6 +43,7 @@
|
|
|
41
43
|
* is the adapter's. This wave adds NO manifest field.
|
|
42
44
|
*/
|
|
43
45
|
|
|
46
|
+
import type { ComponentType } from 'react';
|
|
44
47
|
import { z } from 'zod';
|
|
45
48
|
import type { ResolvedAdapterRoot } from '../manifest/load';
|
|
46
49
|
import type { AdapterSurface } from './adapter-surface';
|
|
@@ -787,8 +790,41 @@ const AdapterInputBindingSchema = z
|
|
|
787
790
|
// The definition
|
|
788
791
|
// ---------------------------------------------------------------------------
|
|
789
792
|
|
|
793
|
+
/** Project-owned editor defaults. User layout choices remain session state. */
|
|
794
|
+
export interface AdapterEditorLayoutProps {
|
|
795
|
+
readonly playing: boolean;
|
|
796
|
+
readonly paused: boolean;
|
|
797
|
+
readonly onReturnToProjectScreen?: (() => void) | undefined;
|
|
798
|
+
}
|
|
799
|
+
export interface AdapterEditorConfiguration {
|
|
800
|
+
/** Imported React implementation; owns both composition and edit/play presentation. */
|
|
801
|
+
readonly Layout?: ComponentType<AdapterEditorLayoutProps>;
|
|
802
|
+
|
|
803
|
+
/** Registered workspace to open when this checkout has no saved workspace. */
|
|
804
|
+
readonly workspace?: string;
|
|
805
|
+
/** Inspector layout beneath the active workspace and the user's override. */
|
|
806
|
+
readonly inspector?: 'column' | 'properties' | 'card';
|
|
807
|
+
/** Utility registry ids to reveal when Play settles; omitted means none. */
|
|
808
|
+
readonly playUtilities?: readonly string[];
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
const AdapterEditorConfigurationSchema = z
|
|
812
|
+
.object({
|
|
813
|
+
Layout: z
|
|
814
|
+
.custom<ComponentType<AdapterEditorLayoutProps>>(
|
|
815
|
+
(value) => typeof value === 'function',
|
|
816
|
+
'Layout must be an imported React component',
|
|
817
|
+
)
|
|
818
|
+
.optional(),
|
|
819
|
+
workspace: z.string().min(1).optional(),
|
|
820
|
+
inspector: z.enum(['column', 'properties', 'card']).optional(),
|
|
821
|
+
playUtilities: z.array(z.string().min(1)).optional(),
|
|
822
|
+
})
|
|
823
|
+
.strict();
|
|
824
|
+
|
|
790
825
|
/** The adapter module's default export, after {@link defineAdapter}. */
|
|
791
826
|
export interface AdapterDefinition {
|
|
827
|
+
readonly editor?: AdapterEditorConfiguration;
|
|
792
828
|
readonly regions: RegionBinding;
|
|
793
829
|
/**
|
|
794
830
|
* Per-region parameters for the `'manifest-roots'` RULE, keyed by manifest
|
|
@@ -806,6 +842,7 @@ export interface AdapterDefinition {
|
|
|
806
842
|
* first-party case, and an adapter's SIZE measures the game's distance from
|
|
807
843
|
* native. */
|
|
808
844
|
export interface AdapterDefinitionInput {
|
|
845
|
+
readonly editor?: AdapterEditorConfiguration;
|
|
809
846
|
readonly regions?: RegionBinding;
|
|
810
847
|
readonly regionIncludes?: Readonly<Record<string, AdapterRegionOverlay>>;
|
|
811
848
|
readonly documents?: AdapterDocumentTable;
|
|
@@ -827,6 +864,7 @@ const REGION_INCLUDES_WITH_LIST_REFUSAL =
|
|
|
827
864
|
|
|
828
865
|
export const AdapterDefinitionSchema = z
|
|
829
866
|
.object({
|
|
867
|
+
editor: AdapterEditorConfigurationSchema.optional(),
|
|
830
868
|
regions: RegionBindingSchema.optional(),
|
|
831
869
|
regionIncludes: RegionIncludesSchema.optional(),
|
|
832
870
|
documents: AdapterDocumentTableSchema.optional(),
|
|
@@ -865,6 +903,16 @@ export function defineAdapter(input: AdapterDefinitionInput = {}): AdapterDefini
|
|
|
865
903
|
);
|
|
866
904
|
}
|
|
867
905
|
return Object.freeze({
|
|
906
|
+
...(input.editor
|
|
907
|
+
? {
|
|
908
|
+
editor: Object.freeze({
|
|
909
|
+
...input.editor,
|
|
910
|
+
...(input.editor.playUtilities
|
|
911
|
+
? { playUtilities: Object.freeze([...input.editor.playUtilities]) }
|
|
912
|
+
: {}),
|
|
913
|
+
}),
|
|
914
|
+
}
|
|
915
|
+
: {}),
|
|
868
916
|
regions: input.regions ?? 'manifest-roots',
|
|
869
917
|
regionIncludes: Object.freeze({ ...(input.regionIncludes ?? {}) }),
|
|
870
918
|
documents: Object.freeze({ ...(input.documents ?? {}) }),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meter arithmetic over an `AudioAdapter`'s `AudioMeterFrame.level` — the one
|
|
3
|
+
* place a linear RMS level becomes dBFS and a bar fill. Lives beside the
|
|
4
|
+
* adapter because both readers of a level (the editor's header meter and the
|
|
5
|
+
* `@vgai/game` audio debugger) are consumers of the adapter, and neither may
|
|
6
|
+
* import the other.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** Linear RMS level → dBFS. Silence clamps to `floorDb` (log of 0 is -∞). */
|
|
10
|
+
export function levelToDb(level: number, floorDb = -60): number {
|
|
11
|
+
if (!(level > 0)) return floorDb;
|
|
12
|
+
return Math.max(floorDb, 20 * Math.log10(level));
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Meter-bar fill percentage: dB-scaled from a -60 dBFS floor (a linear
|
|
16
|
+
* scale would pin every real-world level into the bottom pixels). 0 for
|
|
17
|
+
* silence, 100 at/above full scale. */
|
|
18
|
+
export function meterPercent(level: number, floorDb = -60): number {
|
|
19
|
+
const db = levelToDb(level, floorDb);
|
|
20
|
+
return Math.round(((db - floorDb) / -floorDb) * 100);
|
|
21
|
+
}
|
package/src/runtime/game.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { AdapterSurface as AdapterSurfaceLeaf } from '../adapter/adapter-su
|
|
|
10
10
|
import type { RootBinding } from '../adapter/binding';
|
|
11
11
|
import { formatAudioGateMessage, formatLoopGateMessage } from '../adapter/loop-gate-report';
|
|
12
12
|
import type { MountedRoot } from '../adapter/root-adapter';
|
|
13
|
-
import type { SystemAdapters } from '../adapter/system-adapter';
|
|
13
|
+
import type { AudioAdapter, SystemAdapters } from '../adapter/system-adapter';
|
|
14
14
|
import type { AssetCache } from '../assets';
|
|
15
15
|
import type { createGameLoop } from '../core/game-loop';
|
|
16
16
|
import {
|
|
@@ -1062,6 +1062,8 @@ export function createGame(opts: {
|
|
|
1062
1062
|
console.warn(message);
|
|
1063
1063
|
}
|
|
1064
1064
|
|
|
1065
|
+
const audioMuteBeforePause = new WeakMap<AudioAdapter, boolean>();
|
|
1066
|
+
|
|
1065
1067
|
/** Fan out a loop-gate (self-driven roots) + audio-gate call over every
|
|
1066
1068
|
* `pausable` world, reporting honestly (once) wherever the capability is
|
|
1067
1069
|
* absent — shared by `pause()`/`resume()` below (same fan-out, opposite
|
|
@@ -1095,7 +1097,13 @@ export function createGame(opts: {
|
|
|
1095
1097
|
// the editor yet paradoxically reported as ungateable here.
|
|
1096
1098
|
const audio = declaredSystemAdapters.get(world.id)?.audio ?? world.mounted.systems?.audio;
|
|
1097
1099
|
if (audio) {
|
|
1098
|
-
|
|
1100
|
+
if (next) {
|
|
1101
|
+
if (!audioMuteBeforePause.has(audio)) audioMuteBeforePause.set(audio, audio.isMuted());
|
|
1102
|
+
audio.setMuted(true);
|
|
1103
|
+
} else if (audioMuteBeforePause.has(audio)) {
|
|
1104
|
+
audio.setMuted(audioMuteBeforePause.get(audio)!);
|
|
1105
|
+
audioMuteBeforePause.delete(audio);
|
|
1106
|
+
}
|
|
1099
1107
|
} else if (
|
|
1100
1108
|
next &&
|
|
1101
1109
|
!declaredAbsences.get(world.id)?.some((absence) => absence.slot === 'audio')
|
package/src/settings/schema.ts
CHANGED
|
@@ -30,7 +30,7 @@ export const ChromeRegionsSettingsSchema = z
|
|
|
30
30
|
header: RegionVisibility.optional().describe('The top header bar.'),
|
|
31
31
|
shelf: RegionVisibility.optional().describe('The utility shelf.'),
|
|
32
32
|
inspector: z
|
|
33
|
-
.enum(['column', 'properties'])
|
|
33
|
+
.enum(['column', 'properties', 'card'])
|
|
34
34
|
.optional()
|
|
35
35
|
.describe('Inspector presentation: the narrow docked column or a properties panel.'),
|
|
36
36
|
drawer: RegionVisibility.optional().describe('The bottom drawer.'),
|
|
@@ -57,18 +57,6 @@ export const EditorSettingsSchema = z
|
|
|
57
57
|
.optional()
|
|
58
58
|
.describe('How the editor chrome looks.'),
|
|
59
59
|
keymap: z.string().optional().describe('Active keymap preset id (`vgai`, `blender`, …).'),
|
|
60
|
-
workspace: z
|
|
61
|
-
.object({
|
|
62
|
-
default: z
|
|
63
|
-
.string()
|
|
64
|
-
.optional()
|
|
65
|
-
.describe(
|
|
66
|
-
'The workspace a fresh checkout opens in, when it applies to the project shape.',
|
|
67
|
-
),
|
|
68
|
-
})
|
|
69
|
-
.strict()
|
|
70
|
-
.optional()
|
|
71
|
-
.describe('Workspace defaults.'),
|
|
72
60
|
devicePreview: z
|
|
73
61
|
.object({
|
|
74
62
|
preset: z.string().optional().describe('Device preview frame preset id.'),
|