@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
package/src/input/schema.ts
CHANGED
|
@@ -3,22 +3,36 @@
|
|
|
3
3
|
// Was TS-types-only (`input-types.ts`) until T4.6 authored this Zod schema —
|
|
4
4
|
// see docs/BACKBONE-TASKS.md T4.6. `InputManager.loadMap` (input-manager.ts)
|
|
5
5
|
// is this schema's runtime reader: it parses via this schema, then copies
|
|
6
|
-
// each action's `bindings` array
|
|
6
|
+
// each action's `bindings` array (and its declared `valueType`, F1) straight
|
|
7
|
+
// into `this.actions`/`this.actionValueTypes`.
|
|
7
8
|
//
|
|
8
9
|
// Every field has a `.describe()` (repo policy — powers
|
|
9
10
|
// `scripts/generate-schema.ts` and the T4.1/T4.6 schema-walk coverage test).
|
|
10
11
|
// No runtime dependency beyond `zod`, matching the `scene/schema/` and
|
|
11
12
|
// `manifest/schema.ts` precedent.
|
|
12
13
|
//
|
|
13
|
-
// T4.1
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
14
|
+
// T4.1 history (now closed by F2): `mouse_move` and `gamepad_axis_pair` were
|
|
15
|
+
// authored-but-unhandled binding kinds — REJECTED at parse via a `.superRefine`
|
|
16
|
+
// that threw naming the field, mirroring the `scene/schema/ui.ts` dead-field
|
|
17
|
+
// mechanism. F2 (spec §12 "Complete Device Backends") un-rejects both: real
|
|
18
|
+
// `InputManager` readers now exist for them (`collectPointerDeltaContributions`/
|
|
19
|
+
// `collectVector2Contributions` — `mouse_move` feeds pointerDelta/vector2 from
|
|
20
|
+
// the existing mouseDelta accumulator; `gamepad_axis_pair` feeds vector2 from
|
|
21
|
+
// the coupled `xAxis`/`yAxis` gamepad reading). F2 also adds two new LIVE
|
|
22
|
+
// binding kinds, `touch_button`/`touch_stick` (the touch/virtual-control
|
|
23
|
+
// backend — see `InputManager.setTouchButton`/`setTouchStick`).
|
|
24
|
+
//
|
|
25
|
+
// F1 (spec §12 "Define Typed Action Values") adds:
|
|
26
|
+
// - `InputAction.valueType` — an action now DECLARES its value shape
|
|
27
|
+
// (`digital`/`scalar`/`vector2`/`pointerDelta`/`pointerPosition`),
|
|
28
|
+
// defaulted to `digital` so every pre-F1 action stays valid unchanged.
|
|
29
|
+
// - four new, LIVE (not dead-rejected) binding kinds — `test_axis`,
|
|
30
|
+
// `test_vector2`, `test_pointer_delta`, `test_pointer_position` — the
|
|
31
|
+
// "injected test input" backend F2's acceptance criteria names as a
|
|
32
|
+
// peer of keyboard/mouse/gamepad/touch. They read back a caller-injected
|
|
33
|
+
// raw value (InputManager.injectAxis/injectVector2/injectPointerDelta/
|
|
34
|
+
// injectPointerPosition) through the SAME deadzone/normalize/combine path
|
|
35
|
+
// real device bindings use.
|
|
22
36
|
|
|
23
37
|
import { z } from 'zod';
|
|
24
38
|
import type { InputAction, InputBinding, InputMapFile } from './input-types';
|
|
@@ -37,8 +51,18 @@ const MouseMoveBindingSchema = z.object({
|
|
|
37
51
|
type: z
|
|
38
52
|
.literal('mouse_move')
|
|
39
53
|
.describe(
|
|
40
|
-
'Binding kind: raw mouse movement
|
|
41
|
-
'
|
|
54
|
+
'Binding kind: raw mouse movement (F2, spec §12 "Complete Device Backends"). Feeds a ' +
|
|
55
|
+
"'pointerDelta'-valueType action with the raw accumulated mouse delta (no deadzone), and " +
|
|
56
|
+
"can also feed a 'vector2'-valueType action (the same delta, radial-deadzoned + unit-" +
|
|
57
|
+
'circle-clamped via `deadzone`).',
|
|
58
|
+
),
|
|
59
|
+
deadzone: z
|
|
60
|
+
.number()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe(
|
|
63
|
+
"Radial deadzone magnitude applied only when this binding feeds a 'vector2'-valueType " +
|
|
64
|
+
"action (default 0 — no deadzone; ignored for 'pointerDelta' reads, which are never " +
|
|
65
|
+
'deadzoned).',
|
|
42
66
|
),
|
|
43
67
|
});
|
|
44
68
|
|
|
@@ -61,57 +85,187 @@ const GamepadAxisPairBindingSchema = z.object({
|
|
|
61
85
|
.literal('gamepad_axis_pair')
|
|
62
86
|
.describe(
|
|
63
87
|
'Binding kind: a coupled (x, y) gamepad axis pair, e.g. a stick used as a 2D vector ' +
|
|
64
|
-
'(look/aim)
|
|
65
|
-
'
|
|
66
|
-
'
|
|
88
|
+
'(look/aim/movement) (F2, spec §12 "Complete Device Backends"). Feeds a ' +
|
|
89
|
+
"'vector2'-valueType action: (xAxis, yAxis) read together, radial-deadzoned + unit-" +
|
|
90
|
+
'circle-clamped the same way a real analog stick is.',
|
|
67
91
|
),
|
|
68
92
|
xAxis: z.number().describe('Standard Gamepad API axis index for the X component'),
|
|
69
93
|
yAxis: z.number().describe('Standard Gamepad API axis index for the Y component'),
|
|
70
94
|
deadzone: z.number().optional().describe('Deadzone magnitude (default 0.15 if omitted)'),
|
|
71
95
|
});
|
|
72
96
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// F1 (spec §12) — injected test input bindings. LIVE (real runtime readers in
|
|
99
|
+
// InputManager's getScalar/getVector2/getPointerDelta/getPointerPosition),
|
|
100
|
+
// unlike the two dead stubs above. Foreshadows F2's "injected test input"
|
|
101
|
+
// backend: real device kinds F2 adds later feed the same typed-value
|
|
102
|
+
// aggregation path these exercise today.
|
|
103
|
+
// ---------------------------------------------------------------------------
|
|
104
|
+
|
|
105
|
+
const TestAxisBindingSchema = z.object({
|
|
106
|
+
type: z
|
|
107
|
+
.literal('test_axis')
|
|
108
|
+
.describe(
|
|
109
|
+
"Binding kind: an injected synthetic scalar value for a 'scalar'-valueType action " +
|
|
110
|
+
'(InputManager.injectAxis/getScalar) — the "injected test input" backend named in F2, ' +
|
|
111
|
+
"built in F1 as the typed scalar value model's testable source.",
|
|
112
|
+
),
|
|
113
|
+
sourceId: z
|
|
114
|
+
.string()
|
|
115
|
+
.describe('Names the injected test source this binding reads (InputManager.injectAxis).'),
|
|
116
|
+
deadzone: z
|
|
117
|
+
.number()
|
|
118
|
+
.optional()
|
|
119
|
+
.describe(
|
|
120
|
+
'1D deadzone magnitude applied to the injected raw value before combine (default 0 — no ' +
|
|
121
|
+
'deadzone). Values below it read as 0; values at/above it rescale from 0 (at the ' +
|
|
122
|
+
'deadzone edge) to ±1 (at |raw| = 1), sign preserved.',
|
|
123
|
+
),
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const TestVector2BindingSchema = z.object({
|
|
127
|
+
type: z
|
|
128
|
+
.literal('test_vector2')
|
|
129
|
+
.describe(
|
|
130
|
+
"Binding kind: an injected synthetic {x,y} value for a 'vector2'-valueType action " +
|
|
131
|
+
'(InputManager.injectVector2/getVector2) — the "injected test input" backend named in ' +
|
|
132
|
+
"F2, built in F1 as the typed Vector2 value model's testable source.",
|
|
133
|
+
),
|
|
134
|
+
sourceId: z
|
|
135
|
+
.string()
|
|
136
|
+
.describe('Names the injected test source this binding reads (InputManager.injectVector2).'),
|
|
137
|
+
deadzone: z
|
|
138
|
+
.number()
|
|
139
|
+
.optional()
|
|
140
|
+
.describe(
|
|
141
|
+
'Radial deadzone magnitude applied to the injected raw {x,y} before combine (default 0 ' +
|
|
142
|
+
'— no deadzone). Vectors whose magnitude is below it read as {0,0}; at/above it, ' +
|
|
143
|
+
'direction is preserved and magnitude rescales the same way the scalar deadzone does, ' +
|
|
144
|
+
'then the result is clamped to the unit circle (magnitude <= 1).',
|
|
145
|
+
),
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
const TestPointerDeltaBindingSchema = z.object({
|
|
149
|
+
type: z
|
|
150
|
+
.literal('test_pointer_delta')
|
|
151
|
+
.describe(
|
|
152
|
+
"Binding kind: an injected synthetic per-frame {x,y} delta for a 'pointerDelta'-" +
|
|
153
|
+
'valueType action (InputManager.injectPointerDelta/getPointerDelta) — the "injected ' +
|
|
154
|
+
'test input" backend named in F2. No deadzone (deltas are not deadzoned).',
|
|
155
|
+
),
|
|
156
|
+
sourceId: z
|
|
157
|
+
.string()
|
|
158
|
+
.describe(
|
|
159
|
+
'Names the injected test source this binding reads (InputManager.injectPointerDelta).',
|
|
160
|
+
),
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const TestPointerPositionBindingSchema = z.object({
|
|
164
|
+
type: z
|
|
165
|
+
.literal('test_pointer_position')
|
|
166
|
+
.describe(
|
|
167
|
+
"Binding kind: an injected synthetic absolute {x,y} position for a 'pointerPosition'-" +
|
|
168
|
+
'valueType action (InputManager.injectPointerPosition/getPointerPosition) — the ' +
|
|
169
|
+
'"injected test input" backend named in F2.',
|
|
170
|
+
),
|
|
171
|
+
sourceId: z
|
|
172
|
+
.string()
|
|
173
|
+
.describe(
|
|
174
|
+
'Names the injected test source this binding reads (InputManager.injectPointerPosition).',
|
|
175
|
+
),
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// ---------------------------------------------------------------------------
|
|
179
|
+
// F2 (spec §12 "Complete Device Backends") — touch/virtual-control bindings.
|
|
180
|
+
// LIVE (real runtime readers in InputManager's isPressed/isJustPressed/
|
|
181
|
+
// isJustReleased/getDigitalSource and getVector2), driven by
|
|
182
|
+
// InputManager.setTouchButton/setTouchStick — the headless-testable
|
|
183
|
+
// injectable entry points a real on-screen touch-control UI's own
|
|
184
|
+
// touchstart/touchmove/touchend handlers would call (that DOM wiring is a
|
|
185
|
+
// thin adapter at the edge, out of scope here — see input-manager.ts).
|
|
186
|
+
// ---------------------------------------------------------------------------
|
|
187
|
+
|
|
188
|
+
const TouchButtonBindingSchema = z.object({
|
|
189
|
+
type: z
|
|
190
|
+
.literal('touch_button')
|
|
191
|
+
.describe(
|
|
192
|
+
"Binding kind: a virtual on-screen button for a 'digital' action " +
|
|
193
|
+
'(InputManager.setTouchButton/isPressed) — edge-tracked (isJustPressed/isJustReleased) ' +
|
|
194
|
+
'the same way a real mouse/keyboard button is.',
|
|
195
|
+
),
|
|
196
|
+
sourceId: z
|
|
197
|
+
.string()
|
|
198
|
+
.describe(
|
|
199
|
+
'Names the virtual control zone this binding reads (InputManager.setTouchButton) — a ' +
|
|
200
|
+
'touch-UI-chosen id, not a real device index.',
|
|
201
|
+
),
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const TouchStickBindingSchema = z.object({
|
|
205
|
+
type: z
|
|
206
|
+
.literal('touch_stick')
|
|
207
|
+
.describe(
|
|
208
|
+
"Binding kind: a virtual on-screen analog stick for a 'vector2' action " +
|
|
209
|
+
'(InputManager.setTouchStick/getVector2) — radial-deadzoned + unit-circle-clamped the ' +
|
|
210
|
+
'same way a real gamepad stick is.',
|
|
211
|
+
),
|
|
212
|
+
sourceId: z
|
|
213
|
+
.string()
|
|
214
|
+
.describe(
|
|
215
|
+
'Names the virtual control zone this binding reads (InputManager.setTouchStick) — a ' +
|
|
216
|
+
'touch-UI-chosen id, not a real device index.',
|
|
217
|
+
),
|
|
218
|
+
deadzone: z
|
|
219
|
+
.number()
|
|
220
|
+
.optional()
|
|
221
|
+
.describe(
|
|
222
|
+
'Radial deadzone magnitude applied to the raw {x,y} before combine (default 0 — no ' +
|
|
223
|
+
'deadzone).',
|
|
224
|
+
),
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
/** A single input binding. Every kind listed here is LIVE — F2 (spec §12) closed the last two
|
|
228
|
+
* dead stubs (`mouse_move`/`gamepad_axis_pair`) by giving both real `InputManager` readers. */
|
|
229
|
+
export const InputBindingSchema: z.ZodType<InputBinding> = z.discriminatedUnion('type', [
|
|
230
|
+
KeyBindingSchema,
|
|
231
|
+
MouseButtonBindingSchema,
|
|
232
|
+
MouseMoveBindingSchema,
|
|
233
|
+
GamepadButtonBindingSchema,
|
|
234
|
+
GamepadAxisBindingSchema,
|
|
235
|
+
GamepadAxisPairBindingSchema,
|
|
236
|
+
TestAxisBindingSchema,
|
|
237
|
+
TestVector2BindingSchema,
|
|
238
|
+
TestPointerDeltaBindingSchema,
|
|
239
|
+
TestPointerPositionBindingSchema,
|
|
240
|
+
TouchButtonBindingSchema,
|
|
241
|
+
TouchStickBindingSchema,
|
|
242
|
+
]) as z.ZodType<InputBinding>;
|
|
109
243
|
|
|
110
244
|
/** An action has a name (the record key) and one or more bindings. */
|
|
111
245
|
export const InputActionSchema: z.ZodType<InputAction> = z.object({
|
|
246
|
+
valueType: z
|
|
247
|
+
.enum(['digital', 'scalar', 'vector2', 'pointerDelta', 'pointerPosition'])
|
|
248
|
+
.default('digital')
|
|
249
|
+
.describe(
|
|
250
|
+
"This action's declared value shape (F1, spec §12). 'digital' (boolean, with " +
|
|
251
|
+
'pressed/justPressed/justReleased edges) is the default when omitted, matching every ' +
|
|
252
|
+
"action authored before F1. 'scalar' is a single deadzone-rescaled float axis. " +
|
|
253
|
+
"'vector2' is a radial-deadzoned, unit-circle-normalized {x,y}. 'pointerDelta' is a " +
|
|
254
|
+
"per-frame {x,y} movement delta, summed across sources. 'pointerPosition' is an " +
|
|
255
|
+
'absolute {x,y}, last-write-wins across sources. InputManager enforces this at read ' +
|
|
256
|
+
'time: reading an action through the wrong typed getter (e.g. getScalar on a ' +
|
|
257
|
+
"'digital' action) throws.",
|
|
258
|
+
),
|
|
112
259
|
bindings: z
|
|
113
260
|
.array(InputBindingSchema)
|
|
114
|
-
.describe(
|
|
261
|
+
.describe(
|
|
262
|
+
'Bindings that all trigger/feed this action. Digital actions combine via OR (any one ' +
|
|
263
|
+
'binding satisfied is enough). Scalar actions combine via max-magnitude across ' +
|
|
264
|
+
'contributing bindings (ties keep the first-listed binding). Vector2 actions combine ' +
|
|
265
|
+
'by summing contributing {x,y} values then clamping to the unit circle. PointerDelta ' +
|
|
266
|
+
'actions sum contributing deltas. PointerPosition actions use the most-recently-' +
|
|
267
|
+
'written contributing source (last-write-wins).',
|
|
268
|
+
),
|
|
115
269
|
});
|
|
116
270
|
|
|
117
271
|
/**
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React hooks for data assets — the tool-hooks half of
|
|
3
|
+
* `docs/DATA-TOOLS-DESIGN.md` §3.3, shipped with W4 (dock tools).
|
|
4
|
+
*
|
|
5
|
+
* Lives under `packages/engine/src/react/` deliberately: this is the ONE
|
|
6
|
+
* directory of the engine allowed to value-import react (colocated with
|
|
7
|
+
* `game-state.tsx` per the react-free-core rule proved by
|
|
8
|
+
* `test/react-core-import-ban.test.ts`). Game worlds that aren't react keep
|
|
9
|
+
* using `DataHandle.get()`/`subscribe()` directly (§2.3).
|
|
10
|
+
*
|
|
11
|
+
* - {@link useData} — subscribe a component to any W1 `DataHandle`; works in
|
|
12
|
+
* project tools, react worlds, and HUD overlays alike.
|
|
13
|
+
* - {@link writeData} — EDITOR-TOOL plumbing: write a whole `.data.json`
|
|
14
|
+
* back through the editor dev server, closing the live-tuning loop
|
|
15
|
+
* (widget → file write → Vite HMR → `hotSwap` → {@link useData} re-render
|
|
16
|
+
* → the running game reads the new value). Not for game code.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { useSyncExternalStore } from 'react';
|
|
20
|
+
import type { DataHandle } from '../data/data-asset';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Read a data asset's current values and re-render whenever a hot edit lands
|
|
24
|
+
* (§3.3). A thin `useSyncExternalStore` over the handle's
|
|
25
|
+
* `subscribe`/`get` — any `defineData` handle works, no provider needed:
|
|
26
|
+
*
|
|
27
|
+
* ```tsx
|
|
28
|
+
* import { tuning } from '../data/tuning';
|
|
29
|
+
* const values = useData(tuning); // fresh parsed object after every hotSwap
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* `get()` returns the same reference between successful hot swaps, so this
|
|
33
|
+
* re-renders exactly once per accepted edit and never in between.
|
|
34
|
+
*/
|
|
35
|
+
export function useData<T>(handle: DataHandle<T>): T {
|
|
36
|
+
return useSyncExternalStore(
|
|
37
|
+
(onStoreChange) => handle.subscribe(() => onStoreChange()),
|
|
38
|
+
() => handle.get(),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Write a data asset's ENTIRE new value back to its `.data.json` — the write
|
|
44
|
+
* half of a project tool's live-tuning loop (§3.3, D1: writes are file
|
|
45
|
+
* writes, always). POSTs to the editor dev server's `/__editor/data-file`
|
|
46
|
+
* route (see its doc comment in `packages/editor/server/editor-server.ts`),
|
|
47
|
+
* which accepts only `src/data/**\/*.data.json` and writes immediately; the
|
|
48
|
+
* running game then receives the change through the normal `.data.json` HMR
|
|
49
|
+
* path, exactly as if VS Code had saved the file.
|
|
50
|
+
*
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // inside a tool's onChange — spread the live values, replace one field:
|
|
53
|
+
* void writeData('src/data/tuning.data.json', { ...tuning.get(), gravity: v });
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* FOR TOOLS, NOT GAME CODE: data assets are immutable at runtime (§2.1) —
|
|
57
|
+
* runtime state belongs in your game's own store, never written back into
|
|
58
|
+
* data files. Outside a running editor there is no `/__editor` server, so
|
|
59
|
+
* this rejects with a teaching error (a shipped game could never reach the
|
|
60
|
+
* route anyway — builds strip `src/tools/` entirely, §4).
|
|
61
|
+
*
|
|
62
|
+
* Serialization matches the editor Data panel's diff-minimal contract:
|
|
63
|
+
* `"$schema"` first, 2-space indent, trailing newline. When `value` carries
|
|
64
|
+
* no `"$schema"` key (the common case — `DataHandle.get()` strips it), the
|
|
65
|
+
* conventional sibling reference (`./<name>.schema.json`, §2.1) is restored
|
|
66
|
+
* so a tool write never silently drops VS Code validation from the file.
|
|
67
|
+
*/
|
|
68
|
+
export async function writeData(
|
|
69
|
+
projectRelativePath: string,
|
|
70
|
+
value: Record<string, unknown>,
|
|
71
|
+
): Promise<void> {
|
|
72
|
+
if (!projectRelativePath.startsWith('src/data/') || !projectRelativePath.endsWith('.data.json')) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
`writeData: invalid path ${JSON.stringify(projectRelativePath)} — data assets live at ` +
|
|
75
|
+
'src/data/**/*.data.json, addressed project-relative (docs/DATA-TOOLS-DESIGN.md §2.1), ' +
|
|
76
|
+
"e.g. writeData('src/data/tuning.data.json', next).",
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// "$schema" first for minimal diffs; restore the conventional sibling
|
|
81
|
+
// reference when the caller's object (typically `{ ...handle.get() }`,
|
|
82
|
+
// which never carries it) omits the line.
|
|
83
|
+
const { $schema, ...rest } = value;
|
|
84
|
+
const schemaRef =
|
|
85
|
+
$schema ??
|
|
86
|
+
`./${projectRelativePath
|
|
87
|
+
.split('/')
|
|
88
|
+
.pop()
|
|
89
|
+
?.replace(/\.data\.json$/, '')}.schema.json`;
|
|
90
|
+
const content = `${JSON.stringify({ $schema: schemaRef, ...rest }, null, 2)}\n`;
|
|
91
|
+
|
|
92
|
+
let res: Response;
|
|
93
|
+
try {
|
|
94
|
+
res = await fetch('/__editor/data-file', {
|
|
95
|
+
method: 'POST',
|
|
96
|
+
headers: { 'Content-Type': 'application/json' },
|
|
97
|
+
body: JSON.stringify({ path: projectRelativePath, content }),
|
|
98
|
+
});
|
|
99
|
+
} catch (err) {
|
|
100
|
+
throw new Error(
|
|
101
|
+
'writeData: could not reach the editor dev server (/__editor/data-file) — this helper is ' +
|
|
102
|
+
'editor-tool plumbing (docs/DATA-TOOLS-DESIGN.md §3.3) and only works inside the running ' +
|
|
103
|
+
'editor. Game code must not write data assets: they are immutable at runtime (§2.1) — ' +
|
|
104
|
+
`keep runtime state in your game's own store. (${String(err)})`,
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
if (!res.ok) {
|
|
108
|
+
const detail = await res.text().catch(() => '');
|
|
109
|
+
throw new Error(
|
|
110
|
+
`writeData: the editor rejected the write to "${projectRelativePath}" ` +
|
|
111
|
+
`(HTTP ${res.status}${detail ? `: ${detail}` : ''}).`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W3.1 of docs/DATA-TOOLS-DESIGN.md §3.3 — `useSelection()`, the third
|
|
3
|
+
* tool-hooks contract member (alongside `useData`/`writeData` from
|
|
4
|
+
* `use-data.ts`). Where those two hooks are about DATA ASSETS, this one is
|
|
5
|
+
* about the currently-selected ENTITY and the components authored on it —
|
|
6
|
+
* the gap a real consumer (`critter-types-w3b`'s `critter-type.tool.tsx`,
|
|
7
|
+
* §9.4) hit hard: with no way to read a component's own authored config, it
|
|
8
|
+
* had to recover species from `node.label` (a display string, not data).
|
|
9
|
+
*
|
|
10
|
+
* Scope, v1:
|
|
11
|
+
* - INSPECTOR-placement tools only (`placement: 'inspector'`,
|
|
12
|
+
* `define-tool.ts`). `EditorSelectionProvider` is host plumbing —
|
|
13
|
+
* `InspectorToolSection` wraps every tool render in it; dock tools
|
|
14
|
+
* (`ToolHost`/`BottomPanel`) have no adapter/selection in scope and never
|
|
15
|
+
* get a provider. Calling `useSelection()` there throws a teaching error,
|
|
16
|
+
* contained by the tool's `ToolErrorBoundary` (the editor survives).
|
|
17
|
+
* - READ-only. `config` is a shallow copy of the authored record; write
|
|
18
|
+
* through `InspectorProvider.set('components.<Type>.<field>', v)` /
|
|
19
|
+
* `writeData` (the existing paths), never by mutating what this hook
|
|
20
|
+
* returns. Per-entity WRITE-from-tool is deferred with `useTunable` (§10).
|
|
21
|
+
* - Honest degrades, not errors, when the adapter is thinner than the vgai
|
|
22
|
+
* first-party one: no `components` provider at all ⇒ `components: []`;
|
|
23
|
+
* a `components` provider present but with no optional `config()`
|
|
24
|
+
* accessor ⇒ each entry still appears (from `list()`) but with
|
|
25
|
+
* `config: null`. Both mirror the `AuthoringAdapter` optional-provider
|
|
26
|
+
* doctrine (§4) — an ingest/UI adapter that never implements `components`
|
|
27
|
+
* was already legal, and stays legal.
|
|
28
|
+
*
|
|
29
|
+
* Liveness — two existing paths reused, no new mechanism (§4's "reuse that
|
|
30
|
+
* path" rule):
|
|
31
|
+
* 1. Selection changes: `Inspector.tsx`'s own
|
|
32
|
+
* `useSyncExternalStore(store.subscribe, store.getSnapshot)` re-renders
|
|
33
|
+
* the panel, each matched `Section` gets the new `nodeId` prop, and
|
|
34
|
+
* `InspectorToolSection` re-creates this provider's context value.
|
|
35
|
+
* 2. Config edits while the SAME node stays selected: `adapter.subscribe`
|
|
36
|
+
* fires (the vgai adapter's store notifies on every `updateEntity`,
|
|
37
|
+
* which is what `InspectorProvider.set` goes through) — this hook keeps
|
|
38
|
+
* a local version counter bumped per notification (exactly
|
|
39
|
+
* `game-state.tsx`'s `useWorldObservation` pattern: the adapter has no
|
|
40
|
+
* snapshot/version of its own, `subscribe` is fire-only) and recomputes.
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
import {
|
|
44
|
+
createContext,
|
|
45
|
+
type ReactNode,
|
|
46
|
+
useContext,
|
|
47
|
+
useMemo,
|
|
48
|
+
useRef,
|
|
49
|
+
useSyncExternalStore,
|
|
50
|
+
} from 'react';
|
|
51
|
+
import type { AuthoringAdapter, EditorNode } from '../adapter';
|
|
52
|
+
|
|
53
|
+
interface SelectionContextValue {
|
|
54
|
+
adapter: AuthoringAdapter;
|
|
55
|
+
nodeId: string | null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const SelectionContext = createContext<SelectionContextValue | null>(null);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* EDITOR-side host plumbing: `InspectorToolSection` wraps a tool's rendered
|
|
62
|
+
* `<Component/>` in this, passing the adapter + nodeId it already holds.
|
|
63
|
+
* Project tools never render this themselves — it exists so `useSelection()`
|
|
64
|
+
* has something to read.
|
|
65
|
+
*/
|
|
66
|
+
export function EditorSelectionProvider({
|
|
67
|
+
adapter,
|
|
68
|
+
nodeId,
|
|
69
|
+
children,
|
|
70
|
+
}: {
|
|
71
|
+
adapter: AuthoringAdapter;
|
|
72
|
+
nodeId: string | null;
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
}) {
|
|
75
|
+
const value = useMemo(() => ({ adapter, nodeId }), [adapter, nodeId]);
|
|
76
|
+
return <SelectionContext.Provider value={value}>{children}</SelectionContext.Provider>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** One component attached to the selected entity, with its authored config
|
|
80
|
+
* if the adapter can produce one (see the module doc's degrade rules). */
|
|
81
|
+
export interface SelectedComponent {
|
|
82
|
+
type: string;
|
|
83
|
+
config: Record<string, unknown> | null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface EditorSelection {
|
|
87
|
+
nodeId: string | null;
|
|
88
|
+
node: EditorNode | null;
|
|
89
|
+
components: SelectedComponent[];
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The selected entity, live: its node, and every component attached to it
|
|
94
|
+
* with that component's own authored config (read-only — see module doc).
|
|
95
|
+
*
|
|
96
|
+
* Throws outside an `EditorSelectionProvider` — inspector tools always render
|
|
97
|
+
* inside one; a dock tool or game-code caller does not, and the error names
|
|
98
|
+
* the fix rather than failing silently.
|
|
99
|
+
*/
|
|
100
|
+
export function useSelection(): EditorSelection {
|
|
101
|
+
const ctx = useContext(SelectionContext);
|
|
102
|
+
if (!ctx) {
|
|
103
|
+
throw new Error(
|
|
104
|
+
'useSelection: no editor selection in context — this hook only works inside an editor-hosted ' +
|
|
105
|
+
"INSPECTOR tool (placement: 'inspector', docs/DATA-TOOLS-DESIGN.md §3.3/§3.2). Dock tools and " +
|
|
106
|
+
'game code have no selection to read.',
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
const { adapter, nodeId } = ctx;
|
|
110
|
+
|
|
111
|
+
// Local version counter bumped per adapter notification — the adapter has
|
|
112
|
+
// no snapshot/version of its own, `subscribe` is fire-only (same pattern
|
|
113
|
+
// as `useWorldObservation`'s `versionRef`, game-state.tsx).
|
|
114
|
+
const versionRef = useRef(0);
|
|
115
|
+
const version = useSyncExternalStore(
|
|
116
|
+
(onStoreChange) =>
|
|
117
|
+
adapter.subscribe?.(() => {
|
|
118
|
+
versionRef.current++;
|
|
119
|
+
onStoreChange();
|
|
120
|
+
}) ?? (() => {}),
|
|
121
|
+
() => versionRef.current,
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
return useMemo(() => {
|
|
125
|
+
const node = nodeId ? adapter.hierarchy.node(nodeId) : null;
|
|
126
|
+
const types = nodeId ? (adapter.components?.list(nodeId) ?? []) : [];
|
|
127
|
+
const components: SelectedComponent[] = types.map(({ type }) => ({
|
|
128
|
+
type,
|
|
129
|
+
config: nodeId ? (adapter.components?.config?.(nodeId, type) ?? null) : null,
|
|
130
|
+
}));
|
|
131
|
+
return { nodeId, node, components };
|
|
132
|
+
// `version` has no value of its own — only its CHANGE matters, as the
|
|
133
|
+
// liveness signal described above.
|
|
134
|
+
}, [adapter, nodeId, version]);
|
|
135
|
+
}
|
|
@@ -474,8 +474,8 @@ export async function createGameRuntime(config: RuntimeConfig): Promise<GameSess
|
|
|
474
474
|
return createWorldsGameRuntime(config);
|
|
475
475
|
}
|
|
476
476
|
const { canvas, width, height, adapter, ...sceneConfig } = config;
|
|
477
|
-
const w = width ?? canvas.width;
|
|
478
|
-
const h = height ?? canvas.height;
|
|
477
|
+
const w = Math.max(1, width ?? canvas.width);
|
|
478
|
+
const h = Math.max(1, height ?? canvas.height);
|
|
479
479
|
|
|
480
480
|
// --- Host primitives (neutral — no first-party assumptions) ---
|
|
481
481
|
const renderer = createHostRenderer(canvas, w, h);
|
|
@@ -593,8 +593,10 @@ export async function createGameRuntime(config: RuntimeConfig): Promise<GameSess
|
|
|
593
593
|
game.play.step();
|
|
594
594
|
},
|
|
595
595
|
resize(rw: number, rh: number) {
|
|
596
|
-
|
|
597
|
-
|
|
596
|
+
const safeWidth = Math.max(1, rw);
|
|
597
|
+
const safeHeight = Math.max(1, rh);
|
|
598
|
+
renderer.setSize(safeWidth, safeHeight);
|
|
599
|
+
mounted.resize?.(safeWidth, safeHeight);
|
|
598
600
|
},
|
|
599
601
|
get scene() {
|
|
600
602
|
return mounted.scene as THREE.Scene;
|
|
@@ -983,8 +985,14 @@ async function createWorldsGameRuntime(config: WorldsRuntimeConfig): Promise<Gam
|
|
|
983
985
|
}
|
|
984
986
|
const mountSpecs = specs as (ThreeWorldMountSpec | PixiWorldMountSpec | ReactWorldMountSpec)[];
|
|
985
987
|
|
|
986
|
-
const w =
|
|
987
|
-
|
|
988
|
+
const w = Math.max(
|
|
989
|
+
1,
|
|
990
|
+
width ?? (container as HTMLElement & { clientWidth?: number }).clientWidth ?? 0,
|
|
991
|
+
);
|
|
992
|
+
const h = Math.max(
|
|
993
|
+
1,
|
|
994
|
+
height ?? (container as HTMLElement & { clientHeight?: number }).clientHeight ?? 0,
|
|
995
|
+
);
|
|
988
996
|
const dpr = headless
|
|
989
997
|
? 1
|
|
990
998
|
: Math.min(typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1, 2);
|
|
@@ -1031,8 +1039,19 @@ async function createWorldsGameRuntime(config: WorldsRuntimeConfig): Promise<Gam
|
|
|
1031
1039
|
surfacesById.set(entry.id, surface);
|
|
1032
1040
|
});
|
|
1033
1041
|
|
|
1034
|
-
// One shared UI overlay, above every canvas.
|
|
1042
|
+
// One shared UI overlay, above every canvas. I8 render-integration seam
|
|
1043
|
+
// (docs/AI-NATIVE-AUTHORING-IMPLEMENTATION-SPEC.md §15 I8, C1 review note):
|
|
1044
|
+
// the legacy single-world path (above) reuses/stamps a stable `#example-ui`
|
|
1045
|
+
// id so a capture host has a reliable selector for "the HUD/letterbox
|
|
1046
|
+
// overlay" — this worlds path had no such id at all, so a render-mode page
|
|
1047
|
+
// built on `createWorldsGameRuntime` (multi-world manifests, including a
|
|
1048
|
+
// react-HUD-over-threejs cinematic) had no stable selector to composite-
|
|
1049
|
+
// screenshot. `vgai-ui-overlay` is deliberately a DIFFERENT id than the
|
|
1050
|
+
// legacy path's `example-ui` (not reused/aliased) — the two runtime paths
|
|
1051
|
+
// mount genuinely different DOM subtrees, and collapsing them onto one id
|
|
1052
|
+
// would make a caller's selector ambiguous about which mount produced it.
|
|
1035
1053
|
const uiContainer = document.createElement('div');
|
|
1054
|
+
uiContainer.id = 'vgai-ui-overlay';
|
|
1036
1055
|
uiContainer.style.cssText =
|
|
1037
1056
|
`position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;` +
|
|
1038
1057
|
`z-index:${stacked.length + 1};`;
|
|
@@ -1124,9 +1143,11 @@ async function createWorldsGameRuntime(config: WorldsRuntimeConfig): Promise<Gam
|
|
|
1124
1143
|
game.play.step();
|
|
1125
1144
|
},
|
|
1126
1145
|
resize(rw: number, rh: number) {
|
|
1146
|
+
const safeWidth = Math.max(1, rw);
|
|
1147
|
+
const safeHeight = Math.max(1, rh);
|
|
1127
1148
|
for (const entry of mountedEntries) {
|
|
1128
|
-
entry.renderer?.setSize(
|
|
1129
|
-
entry.mounted.resize?.(
|
|
1149
|
+
entry.renderer?.setSize(safeWidth, safeHeight, false);
|
|
1150
|
+
entry.mounted.resize?.(safeWidth, safeHeight);
|
|
1130
1151
|
}
|
|
1131
1152
|
},
|
|
1132
1153
|
// `GameSession.scene`/`.camera`/`.mounted` alias `Game.defaultWorld` (T6.1
|