@vgai/engine 0.5.42 → 0.5.45
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 +28 -29
- package/dist/adapter/adapter-module.d.ts.map +1 -1
- package/dist/adapter/adapter-module.js +11 -34
- package/dist/adapter/authoring-seam-contract.d.ts +5 -0
- package/dist/adapter/authoring-seam-contract.d.ts.map +1 -1
- package/dist/adapter/authoring-seam-contract.js +1 -0
- package/dist/adapter/authoring.d.ts +16 -0
- package/dist/adapter/authoring.d.ts.map +1 -1
- package/dist/adapter/finders/finder-result.d.ts +2 -2
- package/dist/adapter/finders/finder-result.d.ts.map +1 -1
- package/dist/adapter/finders/index.d.ts +15 -2
- package/dist/adapter/finders/index.d.ts.map +1 -1
- package/dist/adapter/finders/index.js +38 -10
- package/dist/adapter/finders/prefabs-from-stories.d.ts.map +1 -1
- package/dist/adapter/finders/registry.d.ts +45 -0
- package/dist/adapter/finders/registry.d.ts.map +1 -0
- package/dist/adapter/finders/registry.js +56 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -1
- package/dist/adapter/ingest/scene-capture.js +50 -20
- package/dist/adapter/system-adapter.d.ts +3 -1
- package/dist/adapter/system-adapter.d.ts.map +1 -1
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -1
- package/dist/canvas-react/pixi-react-root-factory.js +21 -11
- package/dist/data/vite-plugin-data.d.ts +1 -1
- package/dist/data/vite-plugin-data.d.ts.map +1 -1
- package/dist/data/vite-plugin-data.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/input/host-pointer.d.ts +18 -0
- package/dist/input/host-pointer.d.ts.map +1 -1
- package/dist/input/host-pointer.js +54 -5
- package/dist/input/input-manager.d.ts +83 -1
- package/dist/input/input-manager.d.ts.map +1 -1
- package/dist/input/input-manager.js +357 -8
- package/dist/manifest/configuration-kinds.d.ts +97 -0
- package/dist/manifest/configuration-kinds.d.ts.map +1 -0
- package/dist/manifest/configuration-kinds.js +148 -0
- package/dist/manifest/index.d.ts +2 -1
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/index.js +4 -3
- package/dist/manifest/kind-modules.d.ts +18 -0
- package/dist/manifest/kind-modules.d.ts.map +1 -0
- package/dist/manifest/kind-modules.js +58 -0
- package/dist/manifest/load-file.d.ts +3 -3
- package/dist/manifest/load-file.d.ts.map +1 -1
- package/dist/manifest/load-file.js +4 -4
- package/dist/manifest/load.d.ts +17 -12
- package/dist/manifest/load.d.ts.map +1 -1
- package/dist/manifest/load.js +29 -19
- package/dist/manifest/runtime-environment.d.ts +11 -0
- package/dist/manifest/runtime-environment.d.ts.map +1 -0
- package/dist/manifest/runtime-environment.js +44 -0
- package/dist/manifest/schema.d.ts +10 -9
- package/dist/manifest/schema.d.ts.map +1 -1
- package/dist/manifest/schema.js +32 -27
- package/dist/react/use-data.d.ts +1 -1
- package/dist/react/use-data.js +1 -1
- package/dist/render/matcap-texture.d.ts +5 -0
- package/dist/render/matcap-texture.d.ts.map +1 -0
- package/dist/render/matcap-texture.js +82 -0
- package/dist/render/soft-particle-depth.d.ts +14 -8
- package/dist/render/soft-particle-depth.d.ts.map +1 -1
- package/dist/render/soft-particle-depth.js +37 -14
- package/dist/render/viewport-shading.d.ts +11 -1
- package/dist/render/viewport-shading.d.ts.map +1 -1
- package/dist/render/viewport-shading.js +25 -0
- package/dist/runtime/create-runtime.js +6 -5
- package/dist/runtime/mount-manifest.d.ts.map +1 -1
- package/dist/runtime/mount-manifest.js +11 -2
- package/dist/settings/schema.d.ts +99 -0
- package/dist/settings/schema.d.ts.map +1 -0
- package/dist/settings/schema.js +110 -0
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -1
- package/dist/world3d-react/r3f-root-factory.js +34 -36
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -1
- package/dist/world3d-react/rapier-physics-bridge.js +21 -6
- package/dist-config/config.js +1 -1
- package/dist-config/config.js.map +2 -2
- package/package.json +2 -1
- package/schemas/engine-capabilities.json +4 -4
- package/schemas/vgai-project.schema.json +41 -36
- package/schemas/vgai-settings.schema.json +112 -0
- package/src/adapter/adapter-module.ts +33 -51
- package/src/adapter/authoring-seam-contract.ts +1 -0
- package/src/adapter/authoring.ts +16 -0
- package/src/adapter/finders/finder-result.ts +2 -2
- package/src/adapter/finders/index.ts +68 -12
- package/src/adapter/finders/prefabs-from-stories.ts +2 -2
- package/src/adapter/finders/registry.ts +95 -0
- package/src/adapter/finders/scenes-from-entrypoint-selection.ts +4 -4
- package/src/adapter/ingest/scene-capture.ts +48 -19
- package/src/adapter/system-adapter.ts +3 -1
- package/src/canvas-react/pixi-react-root-factory.tsx +21 -11
- package/src/data/vite-plugin-data.ts +4 -2
- package/src/index.ts +1 -1
- package/src/input/host-pointer.ts +84 -5
- package/src/input/input-manager.ts +404 -7
- package/src/manifest/configuration-kinds.ts +241 -0
- package/src/manifest/index.ts +4 -3
- package/src/manifest/kind-modules.ts +58 -0
- package/src/manifest/load-file.ts +11 -5
- package/src/manifest/load.ts +53 -22
- package/src/manifest/runtime-environment.ts +48 -0
- package/src/manifest/schema.ts +39 -33
- package/src/react/use-data.ts +1 -1
- package/src/render/matcap-texture.ts +92 -0
- package/src/render/soft-particle-depth.ts +43 -14
- package/src/render/viewport-shading.ts +33 -1
- package/src/runtime/create-runtime.ts +6 -5
- package/src/runtime/mount-manifest.ts +13 -2
- package/src/settings/schema.ts +127 -0
- package/src/world3d-react/r3f-root-factory.tsx +45 -39
- package/src/world3d-react/rapier-physics-bridge.tsx +22 -8
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE SETTINGS DOCUMENT — the Zod truth for the two shared settings layers
|
|
3
|
+
* (ARCHITECTURE-CORE §Editor chrome, "Settings have four layers with named
|
|
4
|
+
* homes"):
|
|
5
|
+
*
|
|
6
|
+
* ~/.vgai/settings.json the USER layer — one person, every project
|
|
7
|
+
* <project>/.vgai/settings.json the PROJECT layer — one project, committed,
|
|
8
|
+
* every person who opens it
|
|
9
|
+
*
|
|
10
|
+
* Both files carry the same shape; the project layer overrides the user layer
|
|
11
|
+
* key by key (`mergeEditorSettings`). Neither layer holds authored content —
|
|
12
|
+
* an unreadable file is reported by name and falls back to defaults, never
|
|
13
|
+
* migrated. The generated JSON Schema (`npm run generate-schema` →
|
|
14
|
+
* `packages/engine/schemas/vgai-settings.schema.json`) is what an editor
|
|
15
|
+
* autocompletes against when a person edits either file by hand.
|
|
16
|
+
*
|
|
17
|
+
* Every field here has a runtime reader in the editor's settings store
|
|
18
|
+
* consumers (`theme-preference.ts`, `workspace-regions.ts`,
|
|
19
|
+
* `keymap-presets.ts`, `workspace-presets.ts`, `device-preview.ts`); a field
|
|
20
|
+
* with no reader does not get declared (CLAUDE.md, "Do not author schema
|
|
21
|
+
* fields that have no runtime reader").
|
|
22
|
+
*/
|
|
23
|
+
import { z } from 'zod';
|
|
24
|
+
const RegionVisibility = z.enum(['shown', 'hidden']);
|
|
25
|
+
export const ChromeRegionsSettingsSchema = z
|
|
26
|
+
.object({
|
|
27
|
+
tabs: RegionVisibility.optional().describe('The document tab strip.'),
|
|
28
|
+
header: RegionVisibility.optional().describe('The top header bar.'),
|
|
29
|
+
shelf: RegionVisibility.optional().describe('The utility shelf.'),
|
|
30
|
+
inspector: z
|
|
31
|
+
.enum(['column', 'properties'])
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Inspector presentation: the narrow docked column or a properties panel.'),
|
|
34
|
+
drawer: RegionVisibility.optional().describe('The bottom drawer.'),
|
|
35
|
+
})
|
|
36
|
+
.strict()
|
|
37
|
+
.describe('Which chrome regions a style bundle shows or hides.');
|
|
38
|
+
export const EditorSettingsSchema = z
|
|
39
|
+
.object({
|
|
40
|
+
$schema: z
|
|
41
|
+
.string()
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('JSON Schema pointer for editor autocomplete; ignored by the editor.'),
|
|
44
|
+
appearance: z
|
|
45
|
+
.object({
|
|
46
|
+
palette: z
|
|
47
|
+
.string()
|
|
48
|
+
.optional()
|
|
49
|
+
.describe('Editor palette id — a built-in or a custom theme document.'),
|
|
50
|
+
material: z.string().optional().describe('Editor material id (`classic` or `glass`).'),
|
|
51
|
+
regions: ChromeRegionsSettingsSchema.optional(),
|
|
52
|
+
})
|
|
53
|
+
.strict()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe('How the editor chrome looks.'),
|
|
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
|
+
devicePreview: z
|
|
68
|
+
.object({
|
|
69
|
+
preset: z.string().optional().describe('Device preview frame preset id.'),
|
|
70
|
+
touch: z
|
|
71
|
+
.boolean()
|
|
72
|
+
.nullable()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe('Touch emulation override; null follows the preset.'),
|
|
75
|
+
})
|
|
76
|
+
.strict()
|
|
77
|
+
.optional()
|
|
78
|
+
.describe('The device frame the Game document previews in.'),
|
|
79
|
+
})
|
|
80
|
+
.strict()
|
|
81
|
+
.describe('Editor settings — the user layer and the project layer share this shape.');
|
|
82
|
+
function isPlainObject(value) {
|
|
83
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
84
|
+
}
|
|
85
|
+
/** Deep-merge plain objects; anything else (primitives, arrays, null)
|
|
86
|
+
* replaces. `merge(user, project)` is the effective document. */
|
|
87
|
+
export function mergeEditorSettings(base, over) {
|
|
88
|
+
const out = { ...base };
|
|
89
|
+
const patch = over;
|
|
90
|
+
for (const key of Object.keys(patch)) {
|
|
91
|
+
const value = patch[key];
|
|
92
|
+
const current = out[key];
|
|
93
|
+
out[key] =
|
|
94
|
+
isPlainObject(current) && isPlainObject(value)
|
|
95
|
+
? mergeEditorSettings(current, value)
|
|
96
|
+
: value;
|
|
97
|
+
}
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
/** Validate a raw document. The result carries the parsed settings or the
|
|
101
|
+
* issues, spelled for a person who has the file open. */
|
|
102
|
+
export function parseEditorSettings(raw) {
|
|
103
|
+
const result = EditorSettingsSchema.safeParse(raw);
|
|
104
|
+
if (result.success)
|
|
105
|
+
return { settings: result.data, issues: [] };
|
|
106
|
+
return {
|
|
107
|
+
settings: null,
|
|
108
|
+
issues: result.error.issues.map((issue) => issue.path.length ? `${issue.path.join('.')}: ${issue.message}` : issue.message),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;
|
|
1
|
+
{"version":3,"file":"r3f-root-factory.d.ts","sourceRoot":"","sources":["../../src/world3d-react/r3f-root-factory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAkBH,OAAO,KAAK,EAAoB,WAAW,EAAoB,MAAM,YAAY,CAAC;AAelF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAkanE;;;;;;;;;;;GAWG;AACH,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAI/F;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,qBAO5B,CAAC"}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
* `resolve.dedupe: ['three', 'react', 'react-dom']`.
|
|
36
36
|
*/
|
|
37
37
|
import { advance, createRoot, extend, flushSync, events as pointerEvents, } from '@react-three/fiber';
|
|
38
|
-
import { createElement, Fragment, useEffect } from 'react';
|
|
38
|
+
import { Component, createElement, Fragment, useEffect, } from 'react';
|
|
39
39
|
import { registerRenderVitals } from '../dev/register-render-vitals';
|
|
40
40
|
import { createRenderDebugAdapter, frameCaptureContextFor, } from '../dev/render-debug-adapter';
|
|
41
41
|
import { collectRenderMemory } from '../dev/render-memory';
|
|
@@ -46,6 +46,20 @@ import { getDebugRegistry } from '../runtime/debug-registry';
|
|
|
46
46
|
import { devBuildEnabled } from '../runtime/dev-build';
|
|
47
47
|
import { DEFAULT_INPUT_MAP_PATH, wireGameInputSeams } from '../runtime/game-input-seams';
|
|
48
48
|
import { clearHostFrameDelta, setHostFrameDelta } from './frame-delta';
|
|
49
|
+
/** React errors must reject a mount in Node too, where there is no window
|
|
50
|
+
* error event. This boundary changes no authored content on successful mounts. */
|
|
51
|
+
class MountErrorBoundary extends Component {
|
|
52
|
+
state = { failed: false };
|
|
53
|
+
static getDerivedStateFromError() {
|
|
54
|
+
return { failed: true };
|
|
55
|
+
}
|
|
56
|
+
componentDidCatch(error) {
|
|
57
|
+
this.props.onError(error);
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
return this.state.failed ? null : this.props.children;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
49
63
|
/**
|
|
50
64
|
* Build the `RootAdapter` for one default-exported R3F world. Mounts through
|
|
51
65
|
* react-three-fiber, gated entirely by the host's own loop and rendering
|
|
@@ -57,28 +71,9 @@ function threeWorldAdapter(id, component) {
|
|
|
57
71
|
return {
|
|
58
72
|
id,
|
|
59
73
|
async mount(host) {
|
|
60
|
-
// Headless
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
// return a bare, real scene + camera instead (still `instanceof
|
|
64
|
-
// host.three.Scene` / `.Camera` — the identity rule holds even here,
|
|
65
|
-
// since this uses the host's own `three` instance, not a fresh import).
|
|
66
|
-
// Residual: the hierarchy is empty under headless conformance —
|
|
67
|
-
// recorded as design O2, not hidden; a react-nil-style headless
|
|
68
|
-
// reconciler mount is the known fix, out of scope.
|
|
69
|
-
if (host.headless) {
|
|
70
|
-
const scene = new host.three.Scene();
|
|
71
|
-
const camera = new host.three.PerspectiveCamera();
|
|
72
|
-
return {
|
|
73
|
-
kind: 'three',
|
|
74
|
-
scene,
|
|
75
|
-
camera,
|
|
76
|
-
drivesOwnLoop: false,
|
|
77
|
-
dispose() {
|
|
78
|
-
/* nothing was ever mounted */
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
74
|
+
// Headless mounts use this same Fiber reconciler and authored tree.
|
|
75
|
+
// Their host supplies an inert draw command; absence of a GPU is not
|
|
76
|
+
// permission to return a successful but empty scene.
|
|
82
77
|
// Fiber v9 made the THREE catalogue tree-shakeable: `<Canvas>` calls
|
|
83
78
|
// `extend(THREE)` for you, a bare `createRoot` does NOT — without this,
|
|
84
79
|
// the FIRST three intrinsic in the tree (`<color>`, `<ambientLight>`,
|
|
@@ -171,7 +166,7 @@ function threeWorldAdapter(id, component) {
|
|
|
171
166
|
// bound to the canvas, no error — and every mesh-level pointer prop
|
|
172
167
|
// (`onClick`, `onPointerOver`, `onPointerMissed`) is dead. Proven by a
|
|
173
168
|
// control experiment differing ONLY in this property.
|
|
174
|
-
events: pointerEvents,
|
|
169
|
+
...(host.headless ? {} : { events: pointerEvents }),
|
|
175
170
|
onCreated: (state) => resolveState(state),
|
|
176
171
|
});
|
|
177
172
|
// No `<StrictMode>` — the host mounts once; StrictMode's deliberate
|
|
@@ -188,19 +183,20 @@ function threeWorldAdapter(id, component) {
|
|
|
188
183
|
const game = host.game;
|
|
189
184
|
const world = createElement(Fragment, null, content, createElement(MountEffectsReady, { key: 'vgai-mount-effects-ready' }));
|
|
190
185
|
const provided = game ? createElement(WorldProvider, { game }, world) : world;
|
|
191
|
-
root.render(provided);
|
|
192
186
|
// A reconcile-time crash (e.g. a missing `extend` catalogue entry)
|
|
193
187
|
// surfaces as an uncaught window error and `onCreated` never fires —
|
|
194
188
|
// without this guard, `mount()` would await `statePromise` FOREVER and
|
|
195
189
|
// silently wedge every world declared after this one (roots mount
|
|
196
190
|
// sequentially). Convert that class of failure into a loud mount error.
|
|
197
191
|
const state = await new Promise((resolve, reject) => {
|
|
198
|
-
const
|
|
192
|
+
const fail = (message) => {
|
|
199
193
|
cleanup();
|
|
200
194
|
root.unmount();
|
|
201
195
|
gameDebugRegistry?.strip(id);
|
|
202
|
-
reject(new Error(`three world "${id}": fiber crashed before its first commit — ${
|
|
203
|
-
|
|
196
|
+
reject(new Error(`three world "${id}": fiber crashed before its first commit — ${message}`));
|
|
197
|
+
};
|
|
198
|
+
const onError = (event) => {
|
|
199
|
+
fail(event.message);
|
|
204
200
|
};
|
|
205
201
|
const timer = setTimeout(() => {
|
|
206
202
|
cleanup();
|
|
@@ -211,9 +207,12 @@ function threeWorldAdapter(id, component) {
|
|
|
211
207
|
}, 10_000);
|
|
212
208
|
const cleanup = () => {
|
|
213
209
|
clearTimeout(timer);
|
|
214
|
-
window
|
|
210
|
+
if (typeof window !== 'undefined')
|
|
211
|
+
window.removeEventListener('error', onError);
|
|
215
212
|
};
|
|
216
|
-
window
|
|
213
|
+
if (typeof window !== 'undefined')
|
|
214
|
+
window.addEventListener('error', onError);
|
|
215
|
+
root.render(createElement(MountErrorBoundary, { onError: (error) => fail(error.message) }, provided));
|
|
217
216
|
void Promise.all([statePromise, effectsReady]).then(([s]) => {
|
|
218
217
|
cleanup();
|
|
219
218
|
resolve(s);
|
|
@@ -247,10 +246,9 @@ function threeWorldAdapter(id, component) {
|
|
|
247
246
|
// to write. Gate: `devBuildEnabled()` (the ONE owner of "is this a dev
|
|
248
247
|
// context" — a ship build registers nothing and pays nothing) and a
|
|
249
248
|
// `Game` shell (the readings are folded out of that game's profiler
|
|
250
|
-
// frames).
|
|
251
|
-
// above, before fiber was ever configured.
|
|
249
|
+
// frames). A headless host cannot supply GPU readings.
|
|
252
250
|
let renderVitals = null;
|
|
253
|
-
if (host.game && devBuildEnabled()) {
|
|
251
|
+
if (!host.headless && host.game && devBuildEnabled()) {
|
|
254
252
|
// The readings are folded out of profiler frames, and the profiler is
|
|
255
253
|
// a flag the editor already sets on play — under the dev gate this is
|
|
256
254
|
// the same cost arriving a little earlier, not a new one.
|
|
@@ -267,10 +265,10 @@ function threeWorldAdapter(id, component) {
|
|
|
267
265
|
});
|
|
268
266
|
}
|
|
269
267
|
// Engine-owned render introspection, built over the SAME renderer and
|
|
270
|
-
// scene Fiber uses. A design-time stand-in has no context
|
|
271
|
-
//
|
|
268
|
+
// scene Fiber uses. A design-time stand-in has no context; a headless
|
|
269
|
+
// mount also honestly omits the GPU capture capability.
|
|
272
270
|
const rendererContext = typeof host.renderer.getContext === 'function' ? host.renderer.getContext() : undefined;
|
|
273
|
-
const frameCaptureContext = frameCaptureContextFor(false, rendererContext);
|
|
271
|
+
const frameCaptureContext = frameCaptureContextFor(host.headless ?? false, rendererContext);
|
|
274
272
|
const frameCapture = frameCaptureContext
|
|
275
273
|
? createWebGLFrameCapture(frameCaptureContext)
|
|
276
274
|
: null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rapier-physics-bridge.d.ts","sourceRoot":"","sources":["../../src/world3d-react/rapier-physics-bridge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAUH,OAAO,KAAK,EACV,cAAc,EAKf,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AAkCD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,aAAa,EAAE,EAAE,wBAAwB,GAAG,IAAI,CA0QrF;
|
|
1
|
+
{"version":3,"file":"rapier-physics-bridge.d.ts","sourceRoot":"","sources":["../../src/world3d-react/rapier-physics-bridge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AAUH,OAAO,KAAK,EACV,cAAc,EAKf,MAAM,2BAA2B,CAAC;AAGnC,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,QAAQ,CAAC,aAAa,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAClD;AAkCD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,aAAa,EAAE,EAAE,wBAAwB,GAAG,IAAI,CA0QrF;AAgFD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAEpD"}
|
|
@@ -355,16 +355,31 @@ let liveBridgeCount = 0;
|
|
|
355
355
|
* silent degrade): a second concurrent bridge mount — a scene that mounted
|
|
356
356
|
* two, or a second Play instance of a rapier world — is reported the moment
|
|
357
357
|
* it happens, naming what breaks and until when. */
|
|
358
|
+
/** A contention that resolves within this window is a hand-over, not a state:
|
|
359
|
+
* the editor's design session mounts the NEXT world before it disposes the
|
|
360
|
+
* one on screen (the swap waits for the hand), so every source edit put two
|
|
361
|
+
* bridges on the page for a fraction of a second and printed this warning —
|
|
362
|
+
* which every tester read as instability ("wrap your physics system…",
|
|
363
|
+
* runhuman pass 139). Only a contention that OUTLIVES the hand-over is one. */
|
|
364
|
+
const CONTENTION_GRACE_MS = 2_000;
|
|
365
|
+
let contentionTimer = null;
|
|
358
366
|
function warnOnContendedMount() {
|
|
359
367
|
liveBridgeCount += 1;
|
|
360
368
|
if (liveBridgeCount <= 1)
|
|
361
369
|
return;
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
370
|
+
if (contentionTimer !== null)
|
|
371
|
+
return;
|
|
372
|
+
contentionTimer = setTimeout(() => {
|
|
373
|
+
contentionTimer = null;
|
|
374
|
+
if (liveBridgeCount <= 1)
|
|
375
|
+
return;
|
|
376
|
+
// biome-ignore lint/suspicious/noConsole: the standing-warning channel for a capability the adapter cannot reach — the editor console surfaces it during play
|
|
377
|
+
console.warn(`[rapierPhysicsSystem] ${liveBridgeCount} <RapierPhysicsBridge> mounts are live on this ` +
|
|
378
|
+
'page, but the declared physics slot is one per page (engine modules are shared across ' +
|
|
379
|
+
"Play instances). Every instance's `systems.physics` now forwards to the LAST bridge " +
|
|
380
|
+
'mounted, so physics gizmo edits and instruments address that world — not necessarily ' +
|
|
381
|
+
'the one selected — until the extra mounts unmount.');
|
|
382
|
+
}, CONTENTION_GRACE_MS);
|
|
368
383
|
}
|
|
369
384
|
const physicsSlot = createSystemSlot({
|
|
370
385
|
name: 'rapierPhysicsSystem',
|
package/dist-config/config.js
CHANGED
|
@@ -380,7 +380,7 @@ async function collectDataCheckProblems(options) {
|
|
|
380
380
|
}
|
|
381
381
|
function isToolModuleId(id) {
|
|
382
382
|
const normalized = id.split("\\").join("/");
|
|
383
|
-
return /\/src\/tools\//.test(normalized) || /\.tool\.[tj]sx?(\?|$)/.test(normalized);
|
|
383
|
+
return /\/src\/(?:tools|contributions)\//.test(normalized) || /\.tool\.[tj]sx?(\?|$)/.test(normalized);
|
|
384
384
|
}
|
|
385
385
|
function vgaiDataCheck(options) {
|
|
386
386
|
return {
|