@vgai/engine 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/adapter/authoring.d.ts +404 -0
- package/dist/adapter/authoring.d.ts.map +1 -0
- package/dist/adapter/authoring.js +22 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts +43 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
- package/dist/adapter/colyseus-networking-adapter.js +38 -0
- package/dist/adapter/first-party-systems.d.ts +38 -0
- package/dist/adapter/first-party-systems.d.ts.map +1 -0
- package/dist/adapter/first-party-systems.js +77 -0
- package/dist/adapter/game-adapter.d.ts +133 -0
- package/dist/adapter/game-adapter.d.ts.map +1 -0
- package/dist/adapter/game-adapter.js +10 -0
- package/dist/adapter/host-context.d.ts +73 -0
- package/dist/adapter/host-context.d.ts.map +1 -0
- package/dist/adapter/host-context.js +16 -0
- package/dist/adapter/index.d.ts +22 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +15 -0
- package/dist/adapter/ingest/game-contract.d.ts +53 -0
- package/dist/adapter/ingest/game-contract.d.ts.map +1 -0
- package/dist/adapter/ingest/game-contract.js +30 -0
- package/dist/adapter/ingest/overlay-applier.d.ts +118 -0
- package/dist/adapter/ingest/overlay-applier.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-applier.js +132 -0
- package/dist/adapter/ingest/overlay-apply.d.ts +60 -0
- package/dist/adapter/ingest/overlay-apply.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-apply.js +101 -0
- package/dist/adapter/ingest/overlay-file.d.ts +79 -0
- package/dist/adapter/ingest/overlay-file.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-file.js +66 -0
- package/dist/adapter/ingest/overlay-report.d.ts +113 -0
- package/dist/adapter/ingest/overlay-report.d.ts.map +1 -0
- package/dist/adapter/ingest/overlay-report.js +103 -0
- package/dist/adapter/ingest/scene-capture.d.ts +97 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
- package/dist/adapter/ingest/scene-capture.js +248 -0
- package/dist/adapter/ingest/upstream-pin.d.ts +47 -0
- package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
- package/dist/adapter/ingest/upstream-pin.js +50 -0
- package/dist/adapter/loop-gate-report.d.ts +34 -0
- package/dist/adapter/loop-gate-report.d.ts.map +1 -0
- package/dist/adapter/loop-gate-report.js +37 -0
- package/dist/adapter/rapier-physics-adapter.d.ts +12 -0
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
- package/dist/adapter/rapier-physics-adapter.js +46 -0
- package/dist/adapter/system-adapter.d.ts +133 -0
- package/dist/adapter/system-adapter.d.ts.map +1 -0
- package/dist/adapter/system-adapter.js +13 -0
- package/dist/adapter/transform.d.ts +18 -0
- package/dist/adapter/transform.d.ts.map +1 -0
- package/dist/adapter/transform.js +1 -0
- package/dist/adapter/vgai-scene-game-adapter.d.ts +116 -0
- package/dist/adapter/vgai-scene-game-adapter.d.ts.map +1 -0
- package/dist/adapter/vgai-scene-game-adapter.js +714 -0
- package/dist/adapter/world-kind.d.ts +30 -0
- package/dist/adapter/world-kind.d.ts.map +1 -0
- package/dist/adapter/world-kind.js +18 -0
- package/dist/ai/navigation.d.ts +64 -0
- package/dist/ai/navigation.d.ts.map +1 -0
- package/dist/ai/navigation.js +133 -0
- package/dist/animation/anim-graph-types.d.ts +25 -0
- package/dist/animation/anim-graph-types.d.ts.map +1 -0
- package/dist/animation/anim-graph-types.js +1 -0
- package/dist/animation/animation-clock.d.ts +213 -0
- package/dist/animation/animation-clock.d.ts.map +1 -0
- package/dist/animation/animation-clock.js +301 -0
- package/dist/animation/blend-node.d.ts +22 -0
- package/dist/animation/blend-node.d.ts.map +1 -0
- package/dist/animation/blend-node.js +97 -0
- package/dist/animation/camera-ownership.d.ts +250 -0
- package/dist/animation/camera-ownership.d.ts.map +1 -0
- package/dist/animation/camera-ownership.js +169 -0
- package/dist/animation/cinematic-cues.d.ts +200 -0
- package/dist/animation/cinematic-cues.d.ts.map +1 -0
- package/dist/animation/cinematic-cues.js +213 -0
- package/dist/animation/clip-map.d.ts +12 -0
- package/dist/animation/clip-map.d.ts.map +1 -0
- package/dist/animation/clip-map.js +37 -0
- package/dist/animation/gsap-registration.d.ts +119 -0
- package/dist/animation/gsap-registration.d.ts.map +1 -0
- package/dist/animation/gsap-registration.js +92 -0
- package/dist/animation/theatre-clock-binding.d.ts +89 -0
- package/dist/animation/theatre-clock-binding.d.ts.map +1 -0
- package/dist/animation/theatre-clock-binding.js +29 -0
- package/dist/animation/theatre-director.d.ts +242 -0
- package/dist/animation/theatre-director.d.ts.map +1 -0
- package/dist/animation/theatre-director.js +235 -0
- package/dist/animation/theatre-object-binding.d.ts +305 -0
- package/dist/animation/theatre-object-binding.d.ts.map +1 -0
- package/dist/animation/theatre-object-binding.js +351 -0
- package/dist/animation/xstate-animation-binding.d.ts +111 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
- package/dist/animation/xstate-animation-binding.js +307 -0
- package/dist/animation/xstate-animation-meta.d.ts +228 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
- package/dist/animation/xstate-animation-meta.js +221 -0
- package/dist/assets.d.ts +26 -0
- package/dist/assets.d.ts.map +1 -0
- package/dist/assets.js +55 -0
- package/dist/audio/index.d.ts +4 -0
- package/dist/audio/index.d.ts.map +1 -0
- package/dist/audio/index.js +24 -0
- package/dist/audio/tone-clock-binding.d.ts +75 -0
- package/dist/audio/tone-clock-binding.d.ts.map +1 -0
- package/dist/audio/tone-clock-binding.js +29 -0
- package/dist/audio/tone-context.d.ts +114 -0
- package/dist/audio/tone-context.d.ts.map +1 -0
- package/dist/audio/tone-context.js +39 -0
- package/dist/audio/tone-offline-render.d.ts +90 -0
- package/dist/audio/tone-offline-render.d.ts.map +1 -0
- package/dist/audio/tone-offline-render.js +56 -0
- package/dist/audio/wav-encode.d.ts +38 -0
- package/dist/audio/wav-encode.d.ts.map +1 -0
- package/dist/audio/wav-encode.js +97 -0
- package/dist/core/game-loop.d.ts +21 -0
- package/dist/core/game-loop.d.ts.map +1 -0
- package/dist/core/game-loop.js +130 -0
- package/dist/core/system-runner.d.ts +120 -0
- package/dist/core/system-runner.d.ts.map +1 -0
- package/dist/core/system-runner.js +286 -0
- package/dist/core/types.d.ts +58 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +25 -0
- package/dist/data/data-asset.d.ts +101 -0
- package/dist/data/data-asset.d.ts.map +1 -0
- package/dist/data/data-asset.js +122 -0
- package/dist/data/data-check-core.d.ts +110 -0
- package/dist/data/data-check-core.d.ts.map +1 -0
- package/dist/data/data-check-core.js +178 -0
- package/dist/data/data-ref.d.ts +79 -0
- package/dist/data/data-ref.d.ts.map +1 -0
- package/dist/data/data-ref.js +130 -0
- package/dist/data/vite-plugin-data.d.ts +79 -0
- package/dist/data/vite-plugin-data.d.ts.map +1 -0
- package/dist/data/vite-plugin-data.js +217 -0
- package/dist/dev/console-bridge.d.ts +22 -0
- package/dist/dev/console-bridge.d.ts.map +1 -0
- package/dist/dev/console-bridge.js +71 -0
- package/dist/dev/debug-draw.d.ts +24 -0
- package/dist/dev/debug-draw.d.ts.map +1 -0
- package/dist/dev/debug-draw.js +73 -0
- package/dist/dev/logger.d.ts +30 -0
- package/dist/dev/logger.d.ts.map +1 -0
- package/dist/dev/logger.js +90 -0
- package/dist/ecs/component-manager.d.ts +189 -0
- package/dist/ecs/component-manager.d.ts.map +1 -0
- package/dist/ecs/component-manager.js +676 -0
- package/dist/ecs/game-component.d.ts +97 -0
- package/dist/ecs/game-component.d.ts.map +1 -0
- package/dist/ecs/game-component.js +80 -0
- package/dist/ecs/hmr-swap-report.d.ts +53 -0
- package/dist/ecs/hmr-swap-report.d.ts.map +1 -0
- package/dist/ecs/hmr-swap-report.js +55 -0
- package/dist/index.d.ts +37 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/input/input-manager.d.ts +596 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +1564 -0
- package/dist/input/input-types.d.ts +171 -0
- package/dist/input/input-types.d.ts.map +1 -0
- package/dist/input/input-types.js +1 -0
- package/dist/input/prompt-labels.d.ts +21 -0
- package/dist/input/prompt-labels.d.ts.map +1 -0
- package/dist/input/prompt-labels.js +121 -0
- package/dist/input/rebind-controller.d.ts +59 -0
- package/dist/input/rebind-controller.d.ts.map +1 -0
- package/dist/input/rebind-controller.js +85 -0
- package/dist/input/schema.d.ts +16 -0
- package/dist/input/schema.d.ts.map +1 -0
- package/dist/input/schema.js +228 -0
- package/dist/loader.d.ts +43 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +59 -0
- package/dist/manifest/index.d.ts +5 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +8 -0
- package/dist/manifest/load-file.d.ts +4 -0
- package/dist/manifest/load-file.d.ts.map +1 -0
- package/dist/manifest/load-file.js +14 -0
- package/dist/manifest/load.d.ts +117 -0
- package/dist/manifest/load.d.ts.map +1 -0
- package/dist/manifest/load.js +255 -0
- package/dist/manifest/schema.d.ts +173 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +302 -0
- package/dist/physics/collision-system.d.ts +41 -0
- package/dist/physics/collision-system.d.ts.map +1 -0
- package/dist/physics/collision-system.js +64 -0
- package/dist/physics/physics-registry.d.ts +45 -0
- package/dist/physics/physics-registry.d.ts.map +1 -0
- package/dist/physics/physics-registry.js +65 -0
- package/dist/physics/transform-writer.d.ts +16 -0
- package/dist/physics/transform-writer.d.ts.map +1 -0
- package/dist/physics/transform-writer.js +38 -0
- package/dist/physics/trigger-dispatch.d.ts +24 -0
- package/dist/physics/trigger-dispatch.d.ts.map +1 -0
- package/dist/physics/trigger-dispatch.js +80 -0
- package/dist/react/game-state.d.ts +105 -0
- package/dist/react/game-state.d.ts.map +1 -0
- package/dist/react/game-state.js +144 -0
- package/dist/react/use-data.d.ts +60 -0
- package/dist/react/use-data.d.ts.map +1 -0
- package/dist/react/use-data.js +96 -0
- package/dist/react/use-selection.d.ts +75 -0
- package/dist/react/use-selection.d.ts.map +1 -0
- package/dist/react/use-selection.js +90 -0
- package/dist/render/auto-batcher.d.ts +34 -0
- package/dist/render/auto-batcher.d.ts.map +1 -0
- package/dist/render/auto-batcher.js +140 -0
- package/dist/render/render-batch-system.d.ts +33 -0
- package/dist/render/render-batch-system.d.ts.map +1 -0
- package/dist/render/render-batch-system.js +230 -0
- package/dist/render/render-features.d.ts +47 -0
- package/dist/render/render-features.d.ts.map +1 -0
- package/dist/render/render-features.js +105 -0
- package/dist/render/render-settings.d.ts +36 -0
- package/dist/render/render-settings.d.ts.map +1 -0
- package/dist/render/render-settings.js +51 -0
- package/dist/runtime/create-runtime.d.ts +280 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -0
- package/dist/runtime/create-runtime.js +795 -0
- package/dist/runtime/frame-selector-cache.d.ts +41 -0
- package/dist/runtime/frame-selector-cache.d.ts.map +1 -0
- package/dist/runtime/frame-selector-cache.js +65 -0
- package/dist/runtime/game.d.ts +433 -0
- package/dist/runtime/game.d.ts.map +1 -0
- package/dist/runtime/game.js +569 -0
- package/dist/runtime/input-router.d.ts +78 -0
- package/dist/runtime/input-router.d.ts.map +1 -0
- package/dist/runtime/input-router.js +171 -0
- package/dist/runtime/mount-game.d.ts +129 -0
- package/dist/runtime/mount-game.d.ts.map +1 -0
- package/dist/runtime/mount-game.js +152 -0
- package/dist/runtime/mount-manifest.d.ts +119 -0
- package/dist/runtime/mount-manifest.d.ts.map +1 -0
- package/dist/runtime/mount-manifest.js +204 -0
- package/dist/runtime/render-audio-control.d.ts +110 -0
- package/dist/runtime/render-audio-control.d.ts.map +1 -0
- package/dist/runtime/render-audio-control.js +111 -0
- package/dist/runtime/render-control.d.ts +291 -0
- package/dist/runtime/render-control.d.ts.map +1 -0
- package/dist/runtime/render-control.js +264 -0
- package/dist/runtime/render-seed.d.ts +57 -0
- package/dist/runtime/render-seed.d.ts.map +1 -0
- package/dist/runtime/render-seed.js +74 -0
- package/dist/runtime/scene-ui-bridge.d.ts +69 -0
- package/dist/runtime/scene-ui-bridge.d.ts.map +1 -0
- package/dist/runtime/scene-ui-bridge.js +23 -0
- package/dist/runtime/scene-ui-data.d.ts +13 -0
- package/dist/runtime/scene-ui-data.d.ts.map +1 -0
- package/dist/runtime/scene-ui-data.js +92 -0
- package/dist/runtime/state-bridge.d.ts +47 -0
- package/dist/runtime/state-bridge.d.ts.map +1 -0
- package/dist/runtime/state-bridge.js +53 -0
- package/dist/runtime/types.d.ts +179 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +1 -0
- package/dist/scene/asset-loaders.d.ts +79 -0
- package/dist/scene/asset-loaders.d.ts.map +1 -0
- package/dist/scene/asset-loaders.js +141 -0
- package/dist/scene/asset-paths.d.ts +11 -0
- package/dist/scene/asset-paths.d.ts.map +1 -0
- package/dist/scene/asset-paths.js +108 -0
- package/dist/scene/asset-ref-check.d.ts +88 -0
- package/dist/scene/asset-ref-check.d.ts.map +1 -0
- package/dist/scene/asset-ref-check.js +214 -0
- package/dist/scene/asset-registry.d.ts +30 -0
- package/dist/scene/asset-registry.d.ts.map +1 -0
- package/dist/scene/asset-registry.js +50 -0
- package/dist/scene/collider-dimensions.d.ts +63 -0
- package/dist/scene/collider-dimensions.d.ts.map +1 -0
- package/dist/scene/collider-dimensions.js +98 -0
- package/dist/scene/component-registry.d.ts +17 -0
- package/dist/scene/component-registry.d.ts.map +1 -0
- package/dist/scene/component-registry.js +28 -0
- package/dist/scene/defaults.d.ts +252 -0
- package/dist/scene/defaults.d.ts.map +1 -0
- package/dist/scene/defaults.js +151 -0
- package/dist/scene/geometries/index.d.ts +8 -0
- package/dist/scene/geometries/index.d.ts.map +1 -0
- package/dist/scene/geometries/index.js +7 -0
- package/dist/scene/geometries/terrain.d.ts +2 -0
- package/dist/scene/geometries/terrain.d.ts.map +1 -0
- package/dist/scene/geometries/terrain.js +37 -0
- package/dist/scene/geometry-registry.d.ts +24 -0
- package/dist/scene/geometry-registry.d.ts.map +1 -0
- package/dist/scene/geometry-registry.js +20 -0
- package/dist/scene/instance-registry.d.ts +36 -0
- package/dist/scene/instance-registry.d.ts.map +1 -0
- package/dist/scene/instance-registry.js +55 -0
- package/dist/scene/instancers/grid.d.ts +2 -0
- package/dist/scene/instancers/grid.d.ts.map +1 -0
- package/dist/scene/instancers/grid.js +36 -0
- package/dist/scene/instancers/index.d.ts +8 -0
- package/dist/scene/instancers/index.d.ts.map +1 -0
- package/dist/scene/instancers/index.js +7 -0
- package/dist/scene/light-camera-factory.d.ts +23 -0
- package/dist/scene/light-camera-factory.d.ts.map +1 -0
- package/dist/scene/light-camera-factory.js +68 -0
- package/dist/scene/material-factory.d.ts +17 -0
- package/dist/scene/material-factory.d.ts.map +1 -0
- package/dist/scene/material-factory.js +197 -0
- package/dist/scene/material-registry.d.ts +40 -0
- package/dist/scene/material-registry.d.ts.map +1 -0
- package/dist/scene/material-registry.js +44 -0
- package/dist/scene/materials/index.d.ts +8 -0
- package/dist/scene/materials/index.d.ts.map +1 -0
- package/dist/scene/materials/index.js +7 -0
- package/dist/scene/materials/water.d.ts +2 -0
- package/dist/scene/materials/water.d.ts.map +1 -0
- package/dist/scene/materials/water.js +54 -0
- package/dist/scene/parse.d.ts +23 -0
- package/dist/scene/parse.d.ts.map +1 -0
- package/dist/scene/parse.js +179 -0
- package/dist/scene/particles-factory.d.ts +33 -0
- package/dist/scene/particles-factory.d.ts.map +1 -0
- package/dist/scene/particles-factory.js +282 -0
- package/dist/scene/scene-apply.d.ts +109 -0
- package/dist/scene/scene-apply.d.ts.map +1 -0
- package/dist/scene/scene-apply.js +326 -0
- package/dist/scene/scene-diff-schema.d.ts +285 -0
- package/dist/scene/scene-diff-schema.d.ts.map +1 -0
- package/dist/scene/scene-diff-schema.js +92 -0
- package/dist/scene/scene-diff-types.d.ts +40 -0
- package/dist/scene/scene-diff-types.d.ts.map +1 -0
- package/dist/scene/scene-diff-types.js +14 -0
- package/dist/scene/scene-loader.d.ts +177 -0
- package/dist/scene/scene-loader.d.ts.map +1 -0
- package/dist/scene/scene-loader.js +1213 -0
- package/dist/scene/scene-query.d.ts +11 -0
- package/dist/scene/scene-query.d.ts.map +1 -0
- package/dist/scene/scene-query.js +63 -0
- package/dist/scene/scene-types.d.ts +10 -0
- package/dist/scene/scene-types.d.ts.map +1 -0
- package/dist/scene/scene-types.js +8 -0
- package/dist/scene/scene-version.d.ts +26 -0
- package/dist/scene/scene-version.d.ts.map +1 -0
- package/dist/scene/scene-version.js +34 -0
- package/dist/scene/schema/animation.d.ts +8 -0
- package/dist/scene/schema/animation.d.ts.map +1 -0
- package/dist/scene/schema/animation.js +42 -0
- package/dist/scene/schema/audio.d.ts +13 -0
- package/dist/scene/schema/audio.d.ts.map +1 -0
- package/dist/scene/schema/audio.js +22 -0
- package/dist/scene/schema/camera.d.ts +28 -0
- package/dist/scene/schema/camera.d.ts.map +1 -0
- package/dist/scene/schema/camera.js +17 -0
- package/dist/scene/schema/collider.d.ts +40 -0
- package/dist/scene/schema/collider.d.ts.map +1 -0
- package/dist/scene/schema/collider.js +55 -0
- package/dist/scene/schema/entity-ref.d.ts +31 -0
- package/dist/scene/schema/entity-ref.d.ts.map +1 -0
- package/dist/scene/schema/entity-ref.js +61 -0
- package/dist/scene/schema/entity.d.ts +1036 -0
- package/dist/scene/schema/entity.d.ts.map +1 -0
- package/dist/scene/schema/entity.js +153 -0
- package/dist/scene/schema/environment.d.ts +425 -0
- package/dist/scene/schema/environment.d.ts.map +1 -0
- package/dist/scene/schema/environment.js +357 -0
- package/dist/scene/schema/index.d.ts +39 -0
- package/dist/scene/schema/index.d.ts.map +1 -0
- package/dist/scene/schema/index.js +20 -0
- package/dist/scene/schema/instances.d.ts +14 -0
- package/dist/scene/schema/instances.d.ts.map +1 -0
- package/dist/scene/schema/instances.js +28 -0
- package/dist/scene/schema/joint.d.ts +23 -0
- package/dist/scene/schema/joint.d.ts.map +1 -0
- package/dist/scene/schema/joint.js +23 -0
- package/dist/scene/schema/light.d.ts +38 -0
- package/dist/scene/schema/light.d.ts.map +1 -0
- package/dist/scene/schema/light.js +26 -0
- package/dist/scene/schema/material.d.ts +199 -0
- package/dist/scene/schema/material.d.ts.map +1 -0
- package/dist/scene/schema/material.js +99 -0
- package/dist/scene/schema/mesh.d.ts +48 -0
- package/dist/scene/schema/mesh.d.ts.map +1 -0
- package/dist/scene/schema/mesh.js +82 -0
- package/dist/scene/schema/particles.d.ts +2178 -0
- package/dist/scene/schema/particles.d.ts.map +1 -0
- package/dist/scene/schema/particles.js +321 -0
- package/dist/scene/schema/physics.d.ts +56 -0
- package/dist/scene/schema/physics.d.ts.map +1 -0
- package/dist/scene/schema/physics.js +37 -0
- package/dist/scene/schema/scene-file.d.ts +304 -0
- package/dist/scene/schema/scene-file.d.ts.map +1 -0
- package/dist/scene/schema/scene-file.js +262 -0
- package/dist/scene/schema/shadow.d.ts +28 -0
- package/dist/scene/schema/shadow.d.ts.map +1 -0
- package/dist/scene/schema/shadow.js +20 -0
- package/dist/scene/schema/spline.d.ts +25 -0
- package/dist/scene/schema/spline.d.ts.map +1 -0
- package/dist/scene/schema/spline.js +15 -0
- package/dist/scene/schema/tuples.d.ts +12 -0
- package/dist/scene/schema/tuples.d.ts.map +1 -0
- package/dist/scene/schema/tuples.js +14 -0
- package/dist/scene/schema/ui.d.ts +880 -0
- package/dist/scene/schema/ui.d.ts.map +1 -0
- package/dist/scene/schema/ui.js +506 -0
- package/dist/scene/user-data.d.ts +171 -0
- package/dist/scene/user-data.d.ts.map +1 -0
- package/dist/scene/user-data.js +137 -0
- package/dist/setup/setup-audio.d.ts +20 -0
- package/dist/setup/setup-audio.d.ts.map +1 -0
- package/dist/setup/setup-audio.js +41 -0
- package/dist/setup/setup-particles.d.ts +17 -0
- package/dist/setup/setup-particles.d.ts.map +1 -0
- package/dist/setup/setup-particles.js +16 -0
- package/dist/setup/setup-physics.d.ts +25 -0
- package/dist/setup/setup-physics.d.ts.map +1 -0
- package/dist/setup/setup-physics.js +51 -0
- package/dist/setup/setup-renderer.d.ts +69 -0
- package/dist/setup/setup-renderer.d.ts.map +1 -0
- package/dist/setup/setup-renderer.js +363 -0
- package/dist/tools/define-tool.d.ts +105 -0
- package/dist/tools/define-tool.d.ts.map +1 -0
- package/dist/tools/define-tool.js +82 -0
- package/dist/world2d/authoring-2d.d.ts +76 -0
- package/dist/world2d/authoring-2d.d.ts.map +1 -0
- package/dist/world2d/authoring-2d.js +176 -0
- package/dist/world2d/capture-to-scene2d.d.ts +5 -0
- package/dist/world2d/capture-to-scene2d.d.ts.map +1 -0
- package/dist/world2d/capture-to-scene2d.js +49 -0
- package/dist/world2d/collision-2d.d.ts +52 -0
- package/dist/world2d/collision-2d.d.ts.map +1 -0
- package/dist/world2d/collision-2d.js +70 -0
- package/dist/world2d/components-2d.d.ts +47 -0
- package/dist/world2d/components-2d.d.ts.map +1 -0
- package/dist/world2d/components-2d.js +77 -0
- package/dist/world2d/index.d.ts +34 -0
- package/dist/world2d/index.d.ts.map +1 -0
- package/dist/world2d/index.js +32 -0
- package/dist/world2d/ingest-iframe-2d.d.ts +82 -0
- package/dist/world2d/ingest-iframe-2d.d.ts.map +1 -0
- package/dist/world2d/ingest-iframe-2d.js +166 -0
- package/dist/world2d/ingest2d.d.ts +97 -0
- package/dist/world2d/ingest2d.d.ts.map +1 -0
- package/dist/world2d/ingest2d.js +40 -0
- package/dist/world2d/physics2d-registry.d.ts +24 -0
- package/dist/world2d/physics2d-registry.d.ts.map +1 -0
- package/dist/world2d/physics2d-registry.js +38 -0
- package/dist/world2d/pixi-game-adapter.d.ts +107 -0
- package/dist/world2d/pixi-game-adapter.d.ts.map +1 -0
- package/dist/world2d/pixi-game-adapter.js +211 -0
- package/dist/world2d/pixi-surface.d.ts +39 -0
- package/dist/world2d/pixi-surface.d.ts.map +1 -0
- package/dist/world2d/pixi-surface.js +47 -0
- package/dist/world2d/scene-capture-2d.d.ts +43 -0
- package/dist/world2d/scene-capture-2d.d.ts.map +1 -0
- package/dist/world2d/scene-capture-2d.js +92 -0
- package/dist/world2d/scene2d-loader.d.ts +27 -0
- package/dist/world2d/scene2d-loader.d.ts.map +1 -0
- package/dist/world2d/scene2d-loader.js +274 -0
- package/dist/world2d/schema/entity2d.d.ts +102 -0
- package/dist/world2d/schema/entity2d.d.ts.map +1 -0
- package/dist/world2d/schema/entity2d.js +119 -0
- package/dist/world2d/schema/physics2d.d.ts +46 -0
- package/dist/world2d/schema/physics2d.d.ts.map +1 -0
- package/dist/world2d/schema/physics2d.js +45 -0
- package/dist/world2d/schema/sprite.d.ts +42 -0
- package/dist/world2d/schema/sprite.d.ts.map +1 -0
- package/dist/world2d/schema/sprite.js +63 -0
- package/dist/world2d/schema/tilemap.d.ts +15 -0
- package/dist/world2d/schema/tilemap.d.ts.map +1 -0
- package/dist/world2d/schema/tilemap.js +19 -0
- package/dist/world2d/schema/tuples2d.d.ts +20 -0
- package/dist/world2d/schema/tuples2d.d.ts.map +1 -0
- package/dist/world2d/schema/tuples2d.js +19 -0
- package/dist/world2d/system-adapters-2d.d.ts +16 -0
- package/dist/world2d/system-adapters-2d.d.ts.map +1 -0
- package/dist/world2d/system-adapters-2d.js +37 -0
- package/dist/world2d/transform-writer-2d.d.ts +16 -0
- package/dist/world2d/transform-writer-2d.d.ts.map +1 -0
- package/dist/world2d/transform-writer-2d.js +22 -0
- package/dist/world2d/types.d.ts +53 -0
- package/dist/world2d/types.d.ts.map +1 -0
- package/dist/world2d/types.js +1 -0
- package/package.json +18 -4
- package/src/adapter/authoring.ts +10 -0
- package/src/adapter/first-party-systems.ts +23 -34
- package/src/adapter/index.ts +1 -3
- package/src/adapter/system-adapter.ts +15 -22
- package/src/adapter/vgai-scene-game-adapter.ts +5 -14
- package/src/animation/anim-graph-types.ts +12 -43
- package/src/animation/animation-clock.ts +479 -0
- package/src/animation/camera-ownership.ts +467 -0
- package/src/animation/cinematic-cues.ts +451 -0
- package/src/animation/clip-map.ts +41 -0
- package/src/animation/gsap-registration.ts +184 -0
- package/src/animation/theatre-clock-binding.ts +111 -0
- package/src/animation/theatre-director.ts +347 -0
- package/src/animation/theatre-object-binding.ts +661 -0
- package/src/animation/xstate-animation-binding.ts +398 -0
- package/src/animation/xstate-animation-meta.ts +282 -0
- package/src/audio/index.ts +39 -7
- package/src/audio/tone-clock-binding.ts +98 -0
- package/src/audio/tone-context.ts +129 -0
- package/src/audio/tone-offline-render.ts +167 -0
- package/src/audio/wav-encode.ts +119 -0
- package/src/core/game-loop.ts +17 -0
- package/src/core/types.ts +13 -0
- package/src/data/data-asset.ts +167 -0
- package/src/data/data-check-core.ts +242 -0
- package/src/data/data-ref.ts +145 -0
- package/src/data/vite-plugin-data.ts +290 -0
- package/src/index.ts +48 -0
- package/src/input/input-manager.ts +1206 -32
- package/src/input/input-types.ts +155 -3
- package/src/input/prompt-labels.ts +122 -0
- package/src/input/rebind-controller.ts +105 -0
- package/src/input/schema.ts +206 -52
- package/src/react/use-data.ts +114 -0
- package/src/react/use-selection.tsx +135 -0
- package/src/runtime/create-runtime.ts +30 -9
- package/src/runtime/render-audio-control.ts +168 -0
- package/src/runtime/render-control.ts +522 -0
- package/src/runtime/render-seed.ts +79 -0
- package/src/runtime/types.ts +0 -5
- package/src/scene/asset-loaders.ts +10 -36
- package/src/scene/asset-paths.ts +0 -2
- package/src/scene/asset-ref-check.ts +248 -0
- package/src/scene/parse.ts +133 -0
- package/src/scene/scene-loader.ts +81 -96
- package/src/scene/schema/animation.ts +30 -79
- package/src/scene/schema/entity.ts +20 -0
- package/src/scene/schema/index.ts +2 -12
- package/src/scene/user-data.ts +8 -9
- package/src/setup/setup-renderer.ts +9 -2
- package/src/tools/define-tool.ts +152 -0
- package/src/animation/anim-graph.ts +0 -406
- package/src/animation/anim-system.ts +0 -28
- package/src/animation/property-track.ts +0 -178
- package/src/animation/schema.ts +0 -204
- package/src/audio/ambient.ts +0 -300
- package/src/audio/impacts.ts +0 -212
- package/src/audio/movement.ts +0 -140
- package/src/audio/musical.ts +0 -200
- package/src/audio/ui-sounds.ts +0 -171
- package/src/audio/vehicle.ts +0 -235
- package/src/audio/weapons.ts +0 -152
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The delegating input router (COMPOSITION-DESIGN.md D5 §2a) —
|
|
3
|
+
* `createGameRuntime`'s worlds path (T6.1 slice 1,
|
|
4
|
+
* docs/MULTI-WORLD-DESIGN.md §1.C) uses this to route pointer input across
|
|
5
|
+
* N stacked world canvases with exactly ONE root listener.
|
|
6
|
+
*
|
|
7
|
+
* Split into two layers so the decision logic is unit-testable with plain
|
|
8
|
+
* fake worlds — no real DOM/canvas needed:
|
|
9
|
+
*
|
|
10
|
+
* - `stackOrder` / `resolveClaimingWorld`: pure functions over
|
|
11
|
+
* `{id, zOrder, hitTest?}` — "who claims this point".
|
|
12
|
+
* - `applyPointerEventsStacking` / `createInputRouter`: the DOM wiring —
|
|
13
|
+
* sets `pointer-events` CSS per D5 §2a and forwards a claimed event to
|
|
14
|
+
* the claiming world's own canvas.
|
|
15
|
+
*
|
|
16
|
+
* Per-event fall-through (D5 §2b — the sanctioned mechanism for an
|
|
17
|
+
* authoring surface's own interior drag affordances, e.g. the world2d
|
|
18
|
+
* editor's gizmos) is explicitly NOT this file's job (MULTI-WORLD-DESIGN.md
|
|
19
|
+
* task 4) — it stays inside whatever authoring surface needs it.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Bottom-to-top paint order: ascending `zOrder`, ties -> original array
|
|
23
|
+
* order — the SAME rule `manifest/load.ts`'s `loadGameManifest` sorts
|
|
24
|
+
* worlds by, so a world's DOM stacking position always matches its
|
|
25
|
+
* manifest-resolved zOrder. The last element is the topmost (visually on
|
|
26
|
+
* top / highest z-index).
|
|
27
|
+
*/
|
|
28
|
+
export function stackOrder(entries) {
|
|
29
|
+
return entries
|
|
30
|
+
.map((entry, index) => ({ entry, index }))
|
|
31
|
+
.sort((a, b) => a.entry.zOrder - b.entry.zOrder || a.index - b.index)
|
|
32
|
+
.map(({ entry }) => entry);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Resolve which world's id claims a container-relative point `(x, y)` — D5
|
|
36
|
+
* §2a: walk top-down (topmost first); the first world whose `hitTest`
|
|
37
|
+
* returns true wins ("topmost-claim wins"). A world with no `hitTest` never
|
|
38
|
+
* claims UNLESS it is the bottom-most world, which claims unconditionally
|
|
39
|
+
* (or via its own `hitTest`, if it declares one) — "no-claim falls to
|
|
40
|
+
* bottom". Returns `null` only when `entries` is empty.
|
|
41
|
+
*/
|
|
42
|
+
export function resolveClaimingWorld(entries, x, y) {
|
|
43
|
+
if (entries.length === 0)
|
|
44
|
+
return null;
|
|
45
|
+
const order = stackOrder(entries); // bottom -> top
|
|
46
|
+
for (let i = order.length - 1; i >= 1; i--) {
|
|
47
|
+
const entry = order[i];
|
|
48
|
+
if (entry.hitTest?.(x, y))
|
|
49
|
+
return entry.id;
|
|
50
|
+
}
|
|
51
|
+
// No upper world claimed (or there is only one world) -> the bottom world
|
|
52
|
+
// claims — honoring its own hitTest if it declares one (rare: the bottom
|
|
53
|
+
// world usually claims everything unconditionally per D5 §2a's default).
|
|
54
|
+
return order[0].id;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Sets `canvas.style.pointerEvents` per D5 §1/§2a: the bottom (lowest
|
|
58
|
+
* zOrder) world's canvas is `'auto'` (real user input DOM-hit-tests it by
|
|
59
|
+
* default); every canvas above it is `'none'` (real user input never
|
|
60
|
+
* DOM-hit-tests it — the router's JS-level `hitTest` is what still lets it
|
|
61
|
+
* claim a point via `createInputRouter`'s forwarding).
|
|
62
|
+
*/
|
|
63
|
+
export function applyPointerEventsStacking(entries) {
|
|
64
|
+
const order = stackOrder(entries);
|
|
65
|
+
order.forEach((entry, i) => {
|
|
66
|
+
entry.canvas.style.pointerEvents = i === 0 ? 'auto' : 'none';
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const ROUTED_EVENT_TYPES = ['pointerdown', 'pointerup', 'pointermove', 'click', 'wheel'];
|
|
70
|
+
/** Common pointer/mouse/wheel event fields this router knows how to carry
|
|
71
|
+
* over when forwarding a claimed event to a different canvas (see
|
|
72
|
+
* `forwardEvent` below) — not an exhaustive Event surface, just the fields
|
|
73
|
+
* games/libraries actually read for hit-testing and input state. */
|
|
74
|
+
function pickEventInit(original) {
|
|
75
|
+
const src = original;
|
|
76
|
+
const keys = [
|
|
77
|
+
'clientX',
|
|
78
|
+
'clientY',
|
|
79
|
+
'screenX',
|
|
80
|
+
'screenY',
|
|
81
|
+
'offsetX',
|
|
82
|
+
'offsetY',
|
|
83
|
+
'button',
|
|
84
|
+
'buttons',
|
|
85
|
+
'ctrlKey',
|
|
86
|
+
'altKey',
|
|
87
|
+
'shiftKey',
|
|
88
|
+
'metaKey',
|
|
89
|
+
'pointerId',
|
|
90
|
+
'pointerType',
|
|
91
|
+
'pressure',
|
|
92
|
+
'isPrimary',
|
|
93
|
+
'deltaX',
|
|
94
|
+
'deltaY',
|
|
95
|
+
'deltaZ',
|
|
96
|
+
'deltaMode',
|
|
97
|
+
];
|
|
98
|
+
const init = { bubbles: false, cancelable: true, composed: true };
|
|
99
|
+
for (const key of keys)
|
|
100
|
+
if (key in src)
|
|
101
|
+
init[key] = src[key];
|
|
102
|
+
return init;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Forward `original` onto `canvas` as a NEW, non-bubbling event of the same
|
|
106
|
+
* event-type family — so a canvas with `pointer-events:none` (never a
|
|
107
|
+
* native DOM hit-test target) still receives the interaction its own event
|
|
108
|
+
* pipeline (Pixi's `EventSystem`, a raycast-driven three controller, …)
|
|
109
|
+
* listens for on ITS canvas. `bubbles:false` is deliberate: it stops the
|
|
110
|
+
* clone from re-triggering the container's own capture listener (an
|
|
111
|
+
* infinite loop) — re-dispatching the SAME event object is not an option
|
|
112
|
+
* either (the DOM forbids re-dispatching an event still being dispatched).
|
|
113
|
+
*
|
|
114
|
+
* Best-effort: environments with no `PointerEvent`/`MouseEvent`/
|
|
115
|
+
* `WheelEvent` global (Node unit tests) skip forwarding silently — those
|
|
116
|
+
* tests exercise the pure claim-resolution logic above instead, which needs
|
|
117
|
+
* no real `Event` objects at all.
|
|
118
|
+
*/
|
|
119
|
+
function forwardEvent(canvas, original) {
|
|
120
|
+
const g = globalThis;
|
|
121
|
+
const Ctor = original.type === 'wheel'
|
|
122
|
+
? g.WheelEvent
|
|
123
|
+
: original.type.startsWith('pointer')
|
|
124
|
+
? g.PointerEvent
|
|
125
|
+
: (g.MouseEvent ?? g.PointerEvent);
|
|
126
|
+
if (!Ctor || typeof canvas.dispatchEvent !== 'function')
|
|
127
|
+
return;
|
|
128
|
+
try {
|
|
129
|
+
canvas.dispatchEvent(new Ctor(original.type, pickEventInit(original)));
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// Best-effort forwarding — a construction failure here must never break
|
|
133
|
+
// the (already-delivered) original event's own handling.
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Wire the delegating router onto `container` for `entries` (D5 §2a): apply
|
|
138
|
+
* the pointer-events stacking, then attach ONE capture-phase listener per
|
|
139
|
+
* routed event type that resolves the claiming world and forwards the event
|
|
140
|
+
* to ITS canvas when that world isn't already the natural DOM target (the
|
|
141
|
+
* bottom world, whose canvas is the only one with `pointer-events:auto`).
|
|
142
|
+
*/
|
|
143
|
+
export function createInputRouter(container, entries) {
|
|
144
|
+
applyPointerEventsStacking(entries);
|
|
145
|
+
const byId = new Map(entries.map((e) => [e.id, e]));
|
|
146
|
+
const bottomId = stackOrder(entries)[0]?.id;
|
|
147
|
+
const handler = (evt) => {
|
|
148
|
+
const rect = container.getBoundingClientRect?.() ?? { left: 0, top: 0 };
|
|
149
|
+
const clientX = evt.clientX ?? 0;
|
|
150
|
+
const clientY = evt.clientY ?? 0;
|
|
151
|
+
const x = clientX - rect.left;
|
|
152
|
+
const y = clientY - rect.top;
|
|
153
|
+
const claimant = resolveClaimingWorld(entries, x, y);
|
|
154
|
+
if (claimant && claimant !== bottomId) {
|
|
155
|
+
const entry = byId.get(claimant);
|
|
156
|
+
if (entry)
|
|
157
|
+
forwardEvent(entry.canvas, evt);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
for (const type of ROUTED_EVENT_TYPES) {
|
|
161
|
+
container.addEventListener?.(type, handler, true);
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
resolveClaim: (x, y) => resolveClaimingWorld(entries, x, y),
|
|
165
|
+
dispose() {
|
|
166
|
+
for (const type of ROUTED_EVENT_TYPES) {
|
|
167
|
+
container.removeEventListener?.(type, handler, true);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { ResolvedWorldEntry } from '../manifest/load';
|
|
2
|
+
import type { GameSession } from './create-runtime';
|
|
3
|
+
import { type MountEntry } from './mount-manifest';
|
|
4
|
+
/**
|
|
5
|
+
* What a caller of `mountGameFromManifest` provides. Deliberately minimal —
|
|
6
|
+
* this file never fetches/reads the manifest itself (same rule
|
|
7
|
+
* `mount-manifest.ts` follows: the caller already has a parsed manifest or a
|
|
8
|
+
* raw JSON value in hand).
|
|
9
|
+
*/
|
|
10
|
+
export interface ManifestHost {
|
|
11
|
+
/** The host creates one absolutely-positioned surface per world inside
|
|
12
|
+
* this element — see `WorldsRuntimeConfig.container`. */
|
|
13
|
+
readonly container: HTMLElement;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a manifest-declared `entry` (a project-relative module path,
|
|
16
|
+
* e.g. `"src/scripts/main.ts"`) to the ALREADY-IMPORTED module namespace a
|
|
17
|
+
* registered {@link WorldKindFactory} needs to build a `MountEntry` from.
|
|
18
|
+
*
|
|
19
|
+
* Deliberately NOT "import this arbitrary string path" — a static bundler
|
|
20
|
+
* (Vite/rollup building a `dist/`) cannot resolve a runtime-computed import
|
|
21
|
+
* specifier, so the recommended shape is a small caller-owned lookup table
|
|
22
|
+
* of STATIC imports keyed by the manifest's own `entry` strings (see
|
|
23
|
+
* `packages/editor/template/src/main.ts` for the worked pattern) rather
|
|
24
|
+
* than a literal `import(path)`. Optional — a manifest whose every world
|
|
25
|
+
* either declares no `entry` or is fully satisfied by an explicit
|
|
26
|
+
* `opts.entries` needs none at all.
|
|
27
|
+
*/
|
|
28
|
+
loadEntryModule?(path: string): Promise<unknown>;
|
|
29
|
+
/** Resolve asset/scene URLs relative to the project — forwarded to a
|
|
30
|
+
* registered {@link WorldKindFactory} via {@link WorldKindFactoryContext},
|
|
31
|
+
* never called by this module itself (a factory only needs it for a
|
|
32
|
+
* non-default resolution scheme, e.g. a hosted-editor iframe). */
|
|
33
|
+
resolveUrl?(path: string): string;
|
|
34
|
+
readonly width?: number | undefined;
|
|
35
|
+
readonly height?: number | undefined;
|
|
36
|
+
/** Forwarded to `createGameRuntime` — Node/headless test harnesses only,
|
|
37
|
+
* never a real host. See `WorldsRuntimeConfig.headless`. */
|
|
38
|
+
readonly headless?: boolean | undefined;
|
|
39
|
+
}
|
|
40
|
+
/** What a registered {@link WorldKindFactory} is handed for one world. */
|
|
41
|
+
export interface WorldKindFactoryContext {
|
|
42
|
+
readonly host: ManifestHost;
|
|
43
|
+
/**
|
|
44
|
+
* The result of `host.loadEntryModule(world.entry)`, if the world declares
|
|
45
|
+
* an `entry` AND the host supports loading it — `undefined` for a
|
|
46
|
+
* scene-only world, or when the host has no `loadEntryModule`.
|
|
47
|
+
*/
|
|
48
|
+
readonly entryModule?: unknown;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A caller-registered per-kind mount strategy: given the world's resolved
|
|
52
|
+
* manifest entry and the loaded entry module (if any), produce the
|
|
53
|
+
* `MountEntry` `mountManifestWorlds` needs to mount it (exactly what a
|
|
54
|
+
* project used to hand-build inline as its own `entries[id]` — see
|
|
55
|
+
* `examples/tri-world/src/main.ts`'s pre-E4 shape). May be async (loading an
|
|
56
|
+
* asset, fetching a scene file, etc.).
|
|
57
|
+
*/
|
|
58
|
+
export type WorldKindFactory = (world: ResolvedWorldEntry, ctx: WorldKindFactoryContext) => MountEntry | Promise<MountEntry>;
|
|
59
|
+
/**
|
|
60
|
+
* Register a `WorldKindFactory` for a manifest world `kind` (`'threejs'` /
|
|
61
|
+
* `'pixijs'` / `'react'`, or any future kind the manifest schema grows).
|
|
62
|
+
* Call once, at module load — mirrors `registerSceneUIRenderer()`'s existing
|
|
63
|
+
* "call before mounting" convention (`packages/editor/template/src/main.ts`).
|
|
64
|
+
*
|
|
65
|
+
* Throws on double-registration of the SAME kind: an accidental duplicate
|
|
66
|
+
* (two side-effect imports of the same registration module, or a copy-paste)
|
|
67
|
+
* is far more likely than an intentional runtime swap — a caller that really
|
|
68
|
+
* wants to replace a registration must `unregisterWorldKind` first, making
|
|
69
|
+
* the intent explicit.
|
|
70
|
+
*/
|
|
71
|
+
export declare function registerWorldKind(kind: string, factory: WorldKindFactory): void;
|
|
72
|
+
/** Remove a kind's registration (e.g. before re-registering a replacement). */
|
|
73
|
+
export declare function unregisterWorldKind(kind: string): void;
|
|
74
|
+
/** Whether a factory is currently registered for `kind`. */
|
|
75
|
+
export declare function isWorldKindRegistered(kind: string): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Test-only escape hatch: clears every registration. Registrations are
|
|
78
|
+
* meant to be one-time, process-lifetime — production code should never
|
|
79
|
+
* call this; it exists so unit tests can start each case from a clean
|
|
80
|
+
* registry without cross-test leakage.
|
|
81
|
+
*/
|
|
82
|
+
export declare function __clearWorldKindRegistryForTests(): void;
|
|
83
|
+
/**
|
|
84
|
+
* A ready-to-register {@link WorldKindFactory} for `kind: 'threejs'` worlds
|
|
85
|
+
* that follow the first-party entry-module convention (`export const
|
|
86
|
+
* adapter` and/or `export async function setup`) or are plain scene files
|
|
87
|
+
* with an optional named `componentRegistry` export. Threejs is safe to
|
|
88
|
+
* ship as an exported convenience (unlike pixijs/react) because `three`/
|
|
89
|
+
* `VgaiSceneGameAdapter` are already unconditional engine dependencies —
|
|
90
|
+
* see `mount-manifest.ts`'s header comment. Still never auto-registered:
|
|
91
|
+
* the registry itself stays zero-policy (see this file's header comment) —
|
|
92
|
+
* a caller opts in with `registerWorldKind('threejs', defaultThreeKindFactory)`.
|
|
93
|
+
*
|
|
94
|
+
* Resolution mirrors `mount-manifest.ts`'s own `resolveThreeAdapter` branch
|
|
95
|
+
* order: an entry module's `adapter` export wins outright; else its `setup`
|
|
96
|
+
* export (wrapping via `fromSetup` happens inside `mountManifestWorlds`
|
|
97
|
+
* itself — this factory just returns the `MountEntry` shape); else (no
|
|
98
|
+
* `entry` at all) a scene-driven world, forwarding `componentRegistry` if
|
|
99
|
+
* the entry module supplied one.
|
|
100
|
+
*/
|
|
101
|
+
export declare const defaultThreeKindFactory: WorldKindFactory;
|
|
102
|
+
export interface MountGameOptions {
|
|
103
|
+
/** Explicit per-world entries, same shape `mountManifestWorlds` accepts —
|
|
104
|
+
* ALWAYS wins over a registered kind factory for that world id (backward
|
|
105
|
+
* compat: a caller mid-migration, or one that just prefers building one
|
|
106
|
+
* entry by hand, never has to touch the registry at all). */
|
|
107
|
+
readonly entries?: Readonly<Record<string, MountEntry>> | undefined;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Mount every world declared by a `vgai.game.json` manifest onto `host
|
|
111
|
+
* .container`, resolving each world's kind through the `registerWorldKind`
|
|
112
|
+
* registry — falling back to an explicit `opts.entries[id]` where supplied,
|
|
113
|
+
* exactly like `mountManifestWorlds` (so a caller can migrate one world at a
|
|
114
|
+
* time, or never touch the registry if it prefers hand-building entries).
|
|
115
|
+
*
|
|
116
|
+
* This is the "one call" scaffold/example projects mount through (E4
|
|
117
|
+
* acceptance): register whatever kinds you need once, then
|
|
118
|
+
* `await mountGameFromManifest(manifest, host)` — see
|
|
119
|
+
* `packages/editor/template/src/main.ts` for the worked single-world
|
|
120
|
+
* example and `examples/tri-world/src/main.ts` for a multi-kind one.
|
|
121
|
+
*
|
|
122
|
+
* Degrades loudly (`docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md` D-Z2, carried
|
|
123
|
+
* into E4): a world whose kind has no registered factory AND no explicit
|
|
124
|
+
* entry, and which cannot self-mount from the manifest alone, throws a named
|
|
125
|
+
* `Error` identifying the world id + kind and BOTH ways to fix it
|
|
126
|
+
* (`registerWorldKind` or `opts.entries`) — never a silent skip.
|
|
127
|
+
*/
|
|
128
|
+
export declare function mountGameFromManifest(manifestInput: unknown, host: ManifestHost, opts?: MountGameOptions): Promise<GameSession>;
|
|
129
|
+
//# sourceMappingURL=mount-game.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-game.d.ts","sourceRoot":"","sources":["../../src/runtime/mount-game.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAE3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,KAAK,UAAU,EAAwC,MAAM,kBAAkB,CAAC;AAOzF;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;8DAC0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD;;;uEAGmE;IACnE,UAAU,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAClC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;iEAC6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC;AAED,0EAA0E;AAC1E,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,KAAK,EAAE,kBAAkB,EACzB,GAAG,EAAE,uBAAuB,KACzB,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAQtC;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAU/E;AAED,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEtD;AAED,4DAA4D;AAC5D,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;;;GAKG;AACH,wBAAgB,gCAAgC,IAAI,IAAI,CAEvD;AAeD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,uBAAuB,EAAE,gBAYrC,CAAC;AAMF,MAAM,WAAW,gBAAgB;IAC/B;;;kEAG8D;IAC9D,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;CACrE;AAYD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,qBAAqB,CACzC,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,YAAY,EAClB,IAAI,GAAE,gBAAqB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAoCtB"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// E4 — the S-D composer (docs/unified-world-editor/27-visual-react-editing.md
|
|
2
|
+
// §7 E4; design lineage docs/unified-world-editor/26-unified-editor-spec.md
|
|
3
|
+
// §5 Stage S-D). Builds ON `mount-manifest.ts`'s `mountManifestWorlds` (never
|
|
4
|
+
// duplicates its per-kind dispatch/validation) to add the one thing that
|
|
5
|
+
// module deliberately does NOT have: a KIND REGISTRY, so a project doesn't
|
|
6
|
+
// have to hand-build an `entries` map inline in its own `main.ts` every time
|
|
7
|
+
// — it registers a `WorldKindFactory` per kind it uses (once, at module load)
|
|
8
|
+
// and then mounts with a single `mountGameFromManifest(manifest, host)` call.
|
|
9
|
+
//
|
|
10
|
+
// Engine-core react/pixi-free discipline (mirrors `mount-manifest.ts`'s own
|
|
11
|
+
// header comment, and the HARD INVARIANT this file was built under): this
|
|
12
|
+
// registry is pure mechanism — it holds whatever `WorldKindFactory` functions
|
|
13
|
+
// callers register, but it registers NONE itself. In particular there is no
|
|
14
|
+
// built-in 'pixijs'/'react' registration here (that would require this file
|
|
15
|
+
// to value-import `pixi.js`/`react`/`react-dom`, exactly what `mount-manifest
|
|
16
|
+
// .ts` forbids); a project that has a pixijs or react world MUST register a
|
|
17
|
+
// factory for that kind itself — see `defaultThreeKindFactory` below for why
|
|
18
|
+
// even the 'threejs' convenience export is a plain function the CALLER
|
|
19
|
+
// registers, not something this module wires up automatically.
|
|
20
|
+
import { mountManifestWorlds, resolveManifest } from './mount-manifest';
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// The registry
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const registry = new Map();
|
|
25
|
+
/**
|
|
26
|
+
* Register a `WorldKindFactory` for a manifest world `kind` (`'threejs'` /
|
|
27
|
+
* `'pixijs'` / `'react'`, or any future kind the manifest schema grows).
|
|
28
|
+
* Call once, at module load — mirrors `registerSceneUIRenderer()`'s existing
|
|
29
|
+
* "call before mounting" convention (`packages/editor/template/src/main.ts`).
|
|
30
|
+
*
|
|
31
|
+
* Throws on double-registration of the SAME kind: an accidental duplicate
|
|
32
|
+
* (two side-effect imports of the same registration module, or a copy-paste)
|
|
33
|
+
* is far more likely than an intentional runtime swap — a caller that really
|
|
34
|
+
* wants to replace a registration must `unregisterWorldKind` first, making
|
|
35
|
+
* the intent explicit.
|
|
36
|
+
*/
|
|
37
|
+
export function registerWorldKind(kind, factory) {
|
|
38
|
+
if (registry.has(kind)) {
|
|
39
|
+
throw new Error(`registerWorldKind: a factory is already registered for kind "${kind}" — ` +
|
|
40
|
+
'call unregisterWorldKind(kind) first if you intend to replace it (an accidental ' +
|
|
41
|
+
'double-registration, e.g. two side-effect imports of the same registration module, ' +
|
|
42
|
+
'is far more common than an intentional swap).');
|
|
43
|
+
}
|
|
44
|
+
registry.set(kind, factory);
|
|
45
|
+
}
|
|
46
|
+
/** Remove a kind's registration (e.g. before re-registering a replacement). */
|
|
47
|
+
export function unregisterWorldKind(kind) {
|
|
48
|
+
registry.delete(kind);
|
|
49
|
+
}
|
|
50
|
+
/** Whether a factory is currently registered for `kind`. */
|
|
51
|
+
export function isWorldKindRegistered(kind) {
|
|
52
|
+
return registry.has(kind);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Test-only escape hatch: clears every registration. Registrations are
|
|
56
|
+
* meant to be one-time, process-lifetime — production code should never
|
|
57
|
+
* call this; it exists so unit tests can start each case from a clean
|
|
58
|
+
* registry without cross-test leakage.
|
|
59
|
+
*/
|
|
60
|
+
export function __clearWorldKindRegistryForTests() {
|
|
61
|
+
registry.clear();
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A ready-to-register {@link WorldKindFactory} for `kind: 'threejs'` worlds
|
|
65
|
+
* that follow the first-party entry-module convention (`export const
|
|
66
|
+
* adapter` and/or `export async function setup`) or are plain scene files
|
|
67
|
+
* with an optional named `componentRegistry` export. Threejs is safe to
|
|
68
|
+
* ship as an exported convenience (unlike pixijs/react) because `three`/
|
|
69
|
+
* `VgaiSceneGameAdapter` are already unconditional engine dependencies —
|
|
70
|
+
* see `mount-manifest.ts`'s header comment. Still never auto-registered:
|
|
71
|
+
* the registry itself stays zero-policy (see this file's header comment) —
|
|
72
|
+
* a caller opts in with `registerWorldKind('threejs', defaultThreeKindFactory)`.
|
|
73
|
+
*
|
|
74
|
+
* Resolution mirrors `mount-manifest.ts`'s own `resolveThreeAdapter` branch
|
|
75
|
+
* order: an entry module's `adapter` export wins outright; else its `setup`
|
|
76
|
+
* export (wrapping via `fromSetup` happens inside `mountManifestWorlds`
|
|
77
|
+
* itself — this factory just returns the `MountEntry` shape); else (no
|
|
78
|
+
* `entry` at all) a scene-driven world, forwarding `componentRegistry` if
|
|
79
|
+
* the entry module supplied one.
|
|
80
|
+
*/
|
|
81
|
+
export const defaultThreeKindFactory = (world, ctx) => {
|
|
82
|
+
const mod = ctx.entryModule;
|
|
83
|
+
if (mod?.adapter)
|
|
84
|
+
return { kind: 'threejs', adapter: mod.adapter };
|
|
85
|
+
if (mod?.setup)
|
|
86
|
+
return { kind: 'threejs', setup: mod.setup };
|
|
87
|
+
if (world.entry !== undefined) {
|
|
88
|
+
throw new Error(`defaultThreeKindFactory: entry module "${world.entry}" for world "${world.id}" exports ` +
|
|
89
|
+
'neither `adapter` nor `setup` — every first-party entry module exports at least one ' +
|
|
90
|
+
'(see packages/editor/template/src/scripts/main.ts).');
|
|
91
|
+
}
|
|
92
|
+
return { kind: 'threejs', componentRegistry: mod?.componentRegistry };
|
|
93
|
+
};
|
|
94
|
+
/** True for the one shape `mountManifestWorlds` can ALREADY mount with zero
|
|
95
|
+
* `entries[id]` at all (a plain `default`-adapter, scene-driven, no-`entry`
|
|
96
|
+
* threejs world — `resolveThreeAdapter`'s own scene branch, which needs
|
|
97
|
+
* nothing beyond the manifest itself). Every other shape (pixijs, react, an
|
|
98
|
+
* entry-declaring or module/ingest-adapter threejs world) needs SOMETHING
|
|
99
|
+
* in `entries[id]` to succeed. */
|
|
100
|
+
function worldIsSelfSufficient(world) {
|
|
101
|
+
return world.kind === 'threejs' && world.adapter.type === 'default' && world.entry === undefined;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Mount every world declared by a `vgai.game.json` manifest onto `host
|
|
105
|
+
* .container`, resolving each world's kind through the `registerWorldKind`
|
|
106
|
+
* registry — falling back to an explicit `opts.entries[id]` where supplied,
|
|
107
|
+
* exactly like `mountManifestWorlds` (so a caller can migrate one world at a
|
|
108
|
+
* time, or never touch the registry if it prefers hand-building entries).
|
|
109
|
+
*
|
|
110
|
+
* This is the "one call" scaffold/example projects mount through (E4
|
|
111
|
+
* acceptance): register whatever kinds you need once, then
|
|
112
|
+
* `await mountGameFromManifest(manifest, host)` — see
|
|
113
|
+
* `packages/editor/template/src/main.ts` for the worked single-world
|
|
114
|
+
* example and `examples/tri-world/src/main.ts` for a multi-kind one.
|
|
115
|
+
*
|
|
116
|
+
* Degrades loudly (`docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md` D-Z2, carried
|
|
117
|
+
* into E4): a world whose kind has no registered factory AND no explicit
|
|
118
|
+
* entry, and which cannot self-mount from the manifest alone, throws a named
|
|
119
|
+
* `Error` identifying the world id + kind and BOTH ways to fix it
|
|
120
|
+
* (`registerWorldKind` or `opts.entries`) — never a silent skip.
|
|
121
|
+
*/
|
|
122
|
+
export async function mountGameFromManifest(manifestInput, host, opts = {}) {
|
|
123
|
+
const manifest = resolveManifest(manifestInput);
|
|
124
|
+
const entries = { ...opts.entries };
|
|
125
|
+
for (const world of manifest.worlds) {
|
|
126
|
+
if (entries[world.id] !== undefined)
|
|
127
|
+
continue; // explicit entry always wins
|
|
128
|
+
const factory = registry.get(world.kind);
|
|
129
|
+
if (factory) {
|
|
130
|
+
const entryModule = world.entry !== undefined && host.loadEntryModule
|
|
131
|
+
? await host.loadEntryModule(world.entry)
|
|
132
|
+
: undefined;
|
|
133
|
+
entries[world.id] = await factory(world, { host, entryModule });
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (worldIsSelfSufficient(world))
|
|
137
|
+
continue; // mountManifestWorlds needs nothing further
|
|
138
|
+
throw new Error(`mountGameFromManifest: world "${world.id}" (kind "${world.kind}") has no registered ` +
|
|
139
|
+
`world-kind factory and no explicit entries["${world.id}"] — call ` +
|
|
140
|
+
`registerWorldKind("${world.kind}", factory) before mounting (see ` +
|
|
141
|
+
'`defaultThreeKindFactory` for a worked threejs example), or pass ' +
|
|
142
|
+
`opts.entries["${world.id}"] directly (see mount-manifest.ts's \`MountEntry\`).`);
|
|
143
|
+
}
|
|
144
|
+
return mountManifestWorlds({
|
|
145
|
+
manifest,
|
|
146
|
+
container: host.container,
|
|
147
|
+
entries,
|
|
148
|
+
width: host.width,
|
|
149
|
+
height: host.height,
|
|
150
|
+
headless: host.headless,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { GameAdapter } from '../adapter/game-adapter';
|
|
2
|
+
import { type ResolvedGameManifest } from '../manifest/load';
|
|
3
|
+
import type { ComponentRegistry } from '../scene/component-registry';
|
|
4
|
+
import { type GameSession, type Pixi2DGameAdapter, type ReactWorldAdapter } from './create-runtime';
|
|
5
|
+
import type { GameSetupFn } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* A caller-supplied entry for a `kind: 'threejs'` world — three ways to
|
|
8
|
+
* satisfy it, matching exactly what `tri-world`'s manifest actually declares
|
|
9
|
+
* (a scene-driven world with a project component registry) plus the two
|
|
10
|
+
* other shapes `resolveDefaultThreeAdapter` supports (an `entry`-module
|
|
11
|
+
* `setup`, or full caller control via a pre-built adapter):
|
|
12
|
+
*
|
|
13
|
+
* - `{ adapter }` — a fully-constructed {@link GameAdapter} (first-party or
|
|
14
|
+
* not). Always wins if present, regardless of the world's `scene`/`entry`
|
|
15
|
+
* fields — full caller control, including for a `{ module }`-adapter world
|
|
16
|
+
* (mountManifestWorlds cannot import an arbitrary module path itself).
|
|
17
|
+
* - `{ setup }` — for an `entry`-declaring world: the project's own
|
|
18
|
+
* `entry` module's exported `setup` function (the same `GameSetupFn`
|
|
19
|
+
* shape `loadProjectScripts` extracts editor-side). Wrapped in a
|
|
20
|
+
* `VgaiSceneGameAdapter` here, mirroring `resolveDefaultThreeAdapter`'s
|
|
21
|
+
* entry branch exactly.
|
|
22
|
+
* - `{ componentRegistry }` (or nothing at all) — for a `scene`-declaring
|
|
23
|
+
* world: mirrors `resolveDefaultThreeAdapter`'s scene branch, fetching
|
|
24
|
+
* `world.scene` itself via `VgaiSceneGameAdapter`'s own `scenePath`
|
|
25
|
+
* support. `componentRegistry` is optional — omit it if the scene
|
|
26
|
+
* authors no named `components:` entries.
|
|
27
|
+
*/
|
|
28
|
+
export interface ThreeMountEntry {
|
|
29
|
+
readonly kind: 'threejs';
|
|
30
|
+
readonly adapter?: GameAdapter | undefined;
|
|
31
|
+
readonly setup?: GameSetupFn | undefined;
|
|
32
|
+
readonly componentRegistry?: ComponentRegistry | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A caller-supplied entry for a `kind: 'pixijs'` world — ALWAYS a
|
|
36
|
+
* fully-constructed {@link Pixi2DGameAdapter} (e.g. `new
|
|
37
|
+
* PixiSceneGameAdapter({ id, sceneData })`, built exactly like `tri-world`'s
|
|
38
|
+
* original hand-mount built it — fetch+parse the `.scn2d.json` yourself,
|
|
39
|
+
* mirroring `resolveDefaultPixiAdapter`'s `fetchScene2DFile` helper, if the
|
|
40
|
+
* world declares `scene`). There is no "mountManifestWorlds builds it for
|
|
41
|
+
* you" branch here — doing so would require this file to value-import
|
|
42
|
+
* `pixi.js`, which it deliberately never does (see this file's header
|
|
43
|
+
* comment).
|
|
44
|
+
*/
|
|
45
|
+
export interface PixiMountEntry {
|
|
46
|
+
readonly kind: 'pixijs';
|
|
47
|
+
readonly adapter: Pixi2DGameAdapter;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* A caller-supplied entry for a `kind: 'react'` world — ALWAYS a
|
|
51
|
+
* fully-constructed {@link ReactWorldAdapter} (the caller's own module graph
|
|
52
|
+
* calls `createRoot(host.container).render(<GameProvider game={host.game}>
|
|
53
|
+
* <Entry/></GameProvider>)` itself, exactly like `tri-world`'s original
|
|
54
|
+
* hand-mount did). A standalone build has ONE module graph, so there is no
|
|
55
|
+
* context-identity hazard the editor's per-project `GameProvider`
|
|
56
|
+
* indirection exists to solve (`docs/REACT-STATE-BRIDGE.md` §2) — the
|
|
57
|
+
* caller's own `<GameProvider>` import is already the single canonical
|
|
58
|
+
* instance its `Entry` component's own hooks resolve against. This file
|
|
59
|
+
* never value-imports `react`/`react-dom` itself (see this file's header
|
|
60
|
+
* comment) — building the adapter is entirely the caller's job.
|
|
61
|
+
*/
|
|
62
|
+
export interface ReactMountEntry {
|
|
63
|
+
readonly kind: 'react';
|
|
64
|
+
readonly adapter: ReactWorldAdapter;
|
|
65
|
+
}
|
|
66
|
+
export type MountEntry = ThreeMountEntry | PixiMountEntry | ReactMountEntry;
|
|
67
|
+
export interface MountManifestOptions {
|
|
68
|
+
/**
|
|
69
|
+
* A raw (unparsed) manifest value OR an already-`loadGameManifest`d
|
|
70
|
+
* {@link ResolvedGameManifest}. `mountManifestWorlds` NEVER fetches or
|
|
71
|
+
* fs-reads the manifest itself (stays environment-neutral — Node CLI,
|
|
72
|
+
* browser, or headless test alike): the caller owns getting the JSON off
|
|
73
|
+
* disk/network (`loadGameManifestFile` for Node, a plain `fetch()` for a
|
|
74
|
+
* browser build) and may pass either the raw parsed JSON (run through the
|
|
75
|
+
* pure `loadGameManifest` here) or its own already-resolved manifest.
|
|
76
|
+
*/
|
|
77
|
+
readonly manifest: unknown;
|
|
78
|
+
/** The host creates one absolutely-positioned surface per world inside
|
|
79
|
+
* this element — see `WorldsRuntimeConfig.container`. */
|
|
80
|
+
readonly container: HTMLElement;
|
|
81
|
+
/** Caller-supplied, already-imported entries keyed by manifest world id.
|
|
82
|
+
* Optional overall — a manifest whose every world is scene-driven
|
|
83
|
+
* threejs with no custom component registry needs none at all. */
|
|
84
|
+
readonly entries?: Readonly<Record<string, MountEntry>> | undefined;
|
|
85
|
+
/** Defaults to the manifest's own `resolution` field if declared, else
|
|
86
|
+
* the container's own size (`WorldsRuntimeConfig`'s existing default). */
|
|
87
|
+
readonly width?: number | undefined;
|
|
88
|
+
readonly height?: number | undefined;
|
|
89
|
+
/** Forwarded to `createGameRuntime` — Node/headless test harnesses only,
|
|
90
|
+
* never a real host. See `WorldsRuntimeConfig.headless`. */
|
|
91
|
+
readonly headless?: boolean | undefined;
|
|
92
|
+
}
|
|
93
|
+
export type MountedManifestSession = GameSession;
|
|
94
|
+
/**
|
|
95
|
+
* Exported (E4, docs/unified-world-editor/27-visual-react-editing.md §7) so
|
|
96
|
+
* `mount-game.ts`'s `mountGameFromManifest` composer can share this exact
|
|
97
|
+
* raw-vs-resolved detection instead of re-implementing it — the two modules
|
|
98
|
+
* must always agree on what "already resolved" means.
|
|
99
|
+
*/
|
|
100
|
+
export declare function resolveManifest(raw: unknown): ResolvedGameManifest;
|
|
101
|
+
/**
|
|
102
|
+
* Mount every world declared by a `vgai.game.json` manifest onto `container`,
|
|
103
|
+
* standalone — no editor, no dev server. The generalization of
|
|
104
|
+
* `examples/tri-world/src/main.ts`'s hand-built `WorldMountSpec[]` (D-Z2,
|
|
105
|
+
* docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md). Reuses the pure `loadGameManifest`
|
|
106
|
+
* + `createGameRuntime({ worlds })` and mirrors `resolveAllWorlds`'s per-kind
|
|
107
|
+
* dispatch — but every entry the manifest needs beyond what a `default`-
|
|
108
|
+
* adapter scene/entry can express on its own comes from the caller's OWN
|
|
109
|
+
* already-imported module graph (`opts.entries`), never a dynamic import
|
|
110
|
+
* this file performs itself.
|
|
111
|
+
*
|
|
112
|
+
* Degrades loudly (docs/WAVE3-ADAPTER-PLUMBING-DESIGN.md D-Z2): a missing
|
|
113
|
+
* entry, a kind/shape mismatch, a `{ module }`/`{ ingest }` adapter with no
|
|
114
|
+
* caller-supplied adapter, or an empty manifest all throw a named `Error`
|
|
115
|
+
* identifying the world id, its kind, and what was expected — never a silent
|
|
116
|
+
* skip or a partially-mounted session.
|
|
117
|
+
*/
|
|
118
|
+
export declare function mountManifestWorlds(opts: MountManifestOptions): Promise<GameSession>;
|
|
119
|
+
//# sourceMappingURL=mount-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-manifest.d.ts","sourceRoot":"","sources":["../../src/runtime/mount-manifest.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAEL,KAAK,oBAAoB,EAE1B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EAEvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAM3C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IAC3C,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;CAC5D;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,iBAAiB,CAAC;CACrC;AAED,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,CAAC;AAM5E,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;8DAC0D;IAC1D,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC;IAChC;;uEAEmE;IACnE,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,GAAG,SAAS,CAAC;IACpE;+EAC2E;IAC3E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;iEAC6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CACzC;AAOD,MAAM,MAAM,sBAAsB,GAAG,WAAW,CAAC;AA8BjD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAGlE;AAsID;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC,CAkB1F"}
|