@vgai/engine 0.5.4 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapter/adapter-surface.d.ts +30 -0
- package/dist/adapter/adapter-surface.d.ts.map +1 -0
- package/dist/adapter/adapter-surface.js +18 -0
- package/dist/adapter/authoring.d.ts +597 -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 +77 -0
- package/dist/adapter/colyseus-networking-adapter.d.ts.map +1 -0
- package/dist/adapter/colyseus-networking-adapter.js +76 -0
- package/dist/adapter/first-party-systems.d.ts +23 -0
- package/dist/adapter/first-party-systems.d.ts.map +1 -0
- package/dist/adapter/first-party-systems.js +196 -0
- package/dist/adapter/host-context.d.ts +194 -0
- package/dist/adapter/host-context.d.ts.map +1 -0
- package/dist/adapter/host-context.js +80 -0
- package/dist/adapter/index.d.ts +33 -0
- package/dist/adapter/index.d.ts.map +1 -0
- package/dist/adapter/index.js +25 -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/scene-capture.d.ts +121 -0
- package/dist/adapter/ingest/scene-capture.d.ts.map +1 -0
- package/dist/adapter/ingest/scene-capture.js +270 -0
- package/dist/adapter/ingest/structural-ids.d.ts +64 -0
- package/dist/adapter/ingest/structural-ids.d.ts.map +1 -0
- package/dist/adapter/ingest/structural-ids.js +110 -0
- package/dist/adapter/ingest/upstream-pin.d.ts +44 -0
- package/dist/adapter/ingest/upstream-pin.d.ts.map +1 -0
- package/dist/adapter/ingest/upstream-pin.js +47 -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 +69 -0
- package/dist/adapter/rapier-physics-adapter.d.ts.map +1 -0
- package/dist/adapter/rapier-physics-adapter.js +135 -0
- package/dist/adapter/root-adapter.d.ts +195 -0
- package/dist/adapter/root-adapter.d.ts.map +1 -0
- package/dist/adapter/root-adapter.js +25 -0
- package/dist/adapter/setup-three-root-adapter.d.ts +87 -0
- package/dist/adapter/setup-three-root-adapter.d.ts.map +1 -0
- package/dist/adapter/setup-three-root-adapter.js +791 -0
- package/dist/adapter/system-adapter.d.ts +453 -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/ai/navigation.d.ts +78 -0
- package/dist/ai/navigation.d.ts.map +1 -0
- package/dist/ai/navigation.js +152 -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 +249 -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 +31 -0
- package/dist/animation/cubic-spline-interpolant.d.ts +54 -0
- package/dist/animation/cubic-spline-interpolant.d.ts.map +1 -0
- package/dist/animation/cubic-spline-interpolant.js +111 -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 +277 -0
- package/dist/animation/theatre-director.d.ts.map +1 -0
- package/dist/animation/theatre-director.js +248 -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 +119 -0
- package/dist/animation/xstate-animation-binding.d.ts.map +1 -0
- package/dist/animation/xstate-animation-binding.js +349 -0
- package/dist/animation/xstate-animation-meta.d.ts +266 -0
- package/dist/animation/xstate-animation-meta.d.ts.map +1 -0
- package/dist/animation/xstate-animation-meta.js +252 -0
- package/dist/asset-formats/camera.d.ts +15 -0
- package/dist/asset-formats/camera.d.ts.map +1 -0
- package/dist/asset-formats/camera.js +15 -0
- package/dist/asset-formats/collider.d.ts +21 -0
- package/dist/asset-formats/collider.d.ts.map +1 -0
- package/dist/asset-formats/collider.js +53 -0
- package/dist/asset-formats/index.d.ts +46 -0
- package/dist/asset-formats/index.d.ts.map +1 -0
- package/dist/asset-formats/index.js +36 -0
- package/dist/asset-formats/instances.d.ts +17 -0
- package/dist/asset-formats/instances.d.ts.map +1 -0
- package/dist/asset-formats/instances.js +31 -0
- package/dist/asset-formats/light.d.ts +21 -0
- package/dist/asset-formats/light.d.ts.map +1 -0
- package/dist/asset-formats/light.js +35 -0
- package/dist/asset-formats/material.d.ts +129 -0
- package/dist/asset-formats/material.d.ts.map +1 -0
- package/dist/asset-formats/material.js +88 -0
- package/dist/asset-formats/mesh.d.ts +22 -0
- package/dist/asset-formats/mesh.d.ts.map +1 -0
- package/dist/asset-formats/mesh.js +64 -0
- package/dist/asset-formats/parse.d.ts +20 -0
- package/dist/asset-formats/parse.d.ts.map +1 -0
- package/dist/asset-formats/parse.js +34 -0
- package/dist/asset-formats/particles.d.ts +1390 -0
- package/dist/asset-formats/particles.d.ts.map +1 -0
- package/dist/asset-formats/particles.js +319 -0
- package/dist/asset-formats/render-env.d.ts +387 -0
- package/dist/asset-formats/render-env.d.ts.map +1 -0
- package/dist/asset-formats/render-env.js +300 -0
- package/dist/asset-formats/tuples.d.ts +12 -0
- package/dist/asset-formats/tuples.d.ts.map +1 -0
- package/dist/asset-formats/tuples.js +14 -0
- package/dist/asset-loaders.d.ts +97 -0
- package/dist/asset-loaders.d.ts.map +1 -0
- package/dist/asset-loaders.js +209 -0
- package/dist/asset-parse-error.d.ts +24 -0
- package/dist/asset-parse-error.d.ts.map +1 -0
- package/dist/asset-parse-error.js +29 -0
- package/dist/asset-registry.d.ts +38 -0
- package/dist/asset-registry.d.ts.map +1 -0
- package/dist/asset-registry.js +66 -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/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/canvas-react/engine-bridge.d.ts +45 -0
- package/dist/canvas-react/engine-bridge.d.ts.map +1 -0
- package/dist/canvas-react/engine-bridge.js +45 -0
- package/dist/canvas-react/index.d.ts +42 -0
- package/dist/canvas-react/index.d.ts.map +1 -0
- package/dist/canvas-react/index.js +41 -0
- package/dist/canvas-react/pixi-primitive.d.ts +85 -0
- package/dist/canvas-react/pixi-primitive.d.ts.map +1 -0
- package/dist/canvas-react/pixi-primitive.js +181 -0
- package/dist/canvas-react/pixi-react-adapter.d.ts +71 -0
- package/dist/canvas-react/pixi-react-adapter.d.ts.map +1 -0
- package/dist/canvas-react/pixi-react-adapter.js +229 -0
- package/dist/canvas-react/pixi-react-root-factory.d.ts +56 -0
- package/dist/canvas-react/pixi-react-root-factory.d.ts.map +1 -0
- package/dist/canvas-react/pixi-react-root-factory.js +73 -0
- package/dist/canvas-react/world-context.d.ts +88 -0
- package/dist/canvas-react/world-context.d.ts.map +1 -0
- package/dist/canvas-react/world-context.js +212 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +8 -0
- package/dist/core/frame-pacing.d.ts +90 -0
- package/dist/core/frame-pacing.d.ts.map +1 -0
- package/dist/core/frame-pacing.js +89 -0
- package/dist/core/game-loop.d.ts +62 -0
- package/dist/core/game-loop.d.ts.map +1 -0
- package/dist/core/game-loop.js +189 -0
- package/dist/core/seeded-random.d.ts +69 -0
- package/dist/core/seeded-random.d.ts.map +1 -0
- package/dist/core/seeded-random.js +121 -0
- package/dist/core/sim-clock.d.ts +199 -0
- package/dist/core/sim-clock.d.ts.map +1 -0
- package/dist/core/sim-clock.js +291 -0
- package/dist/core/system-runner.d.ts +96 -0
- package/dist/core/system-runner.d.ts.map +1 -0
- package/dist/core/system-runner.js +253 -0
- package/dist/core/types.d.ts +111 -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 +109 -0
- package/dist/data/data-check-core.d.ts.map +1 -0
- package/dist/data/data-check-core.js +177 -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/defaults.d.ts +233 -0
- package/dist/defaults.d.ts.map +1 -0
- package/dist/defaults.js +137 -0
- package/dist/dev/chrome-trace.d.ts +45 -0
- package/dist/dev/chrome-trace.d.ts.map +1 -0
- package/dist/dev/chrome-trace.js +114 -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/instruments.d.ts +133 -0
- package/dist/dev/instruments.d.ts.map +1 -0
- package/dist/dev/instruments.js +231 -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/dev/performance-profiler.d.ts +111 -0
- package/dist/dev/performance-profiler.d.ts.map +1 -0
- package/dist/dev/performance-profiler.js +215 -0
- package/dist/dev/render-debug-adapter.d.ts +57 -0
- package/dist/dev/render-debug-adapter.d.ts.map +1 -0
- package/dist/dev/render-debug-adapter.js +141 -0
- package/dist/dev/render-memory.d.ts +53 -0
- package/dist/dev/render-memory.d.ts.map +1 -0
- package/dist/dev/render-memory.js +190 -0
- package/dist/dev/webgl-frame-capture.d.ts +134 -0
- package/dist/dev/webgl-frame-capture.d.ts.map +1 -0
- package/dist/dev/webgl-frame-capture.js +270 -0
- package/dist/dev/webgl-gpu-timer.d.ts +8 -0
- package/dist/dev/webgl-gpu-timer.d.ts.map +1 -0
- package/dist/dev/webgl-gpu-timer.js +52 -0
- package/dist/ecs/scene-index.d.ts +179 -0
- package/dist/ecs/scene-index.d.ts.map +1 -0
- package/dist/ecs/scene-index.js +331 -0
- package/dist/ecs/scene-query.d.ts +6 -0
- package/dist/ecs/scene-query.d.ts.map +1 -0
- package/dist/ecs/scene-query.js +40 -0
- package/dist/ecs/user-data.d.ts +193 -0
- package/dist/ecs/user-data.d.ts.map +1 -0
- package/dist/ecs/user-data.js +145 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/input/input-manager.d.ts +944 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +2209 -0
- package/dist/input/input-types.d.ts +174 -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 +76 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +114 -0
- package/dist/manifest/editor-port.d.ts +53 -0
- package/dist/manifest/editor-port.d.ts.map +1 -0
- package/dist/manifest/editor-port.js +67 -0
- package/dist/manifest/filename.d.ts +14 -0
- package/dist/manifest/filename.d.ts.map +1 -0
- package/dist/manifest/filename.js +43 -0
- package/dist/manifest/index.d.ts +6 -0
- package/dist/manifest/index.d.ts.map +1 -0
- package/dist/manifest/index.js +9 -0
- package/dist/manifest/load-file.d.ts +7 -0
- package/dist/manifest/load-file.d.ts.map +1 -0
- package/dist/manifest/load-file.js +23 -0
- package/dist/manifest/load.d.ts +161 -0
- package/dist/manifest/load.d.ts.map +1 -0
- package/dist/manifest/load.js +269 -0
- package/dist/manifest/locate.d.ts +24 -0
- package/dist/manifest/locate.d.ts.map +1 -0
- package/dist/manifest/locate.js +48 -0
- package/dist/manifest/schema.d.ts +293 -0
- package/dist/manifest/schema.d.ts.map +1 -0
- package/dist/manifest/schema.js +633 -0
- package/dist/physics/collider-dimensions.d.ts +63 -0
- package/dist/physics/collider-dimensions.d.ts.map +1 -0
- package/dist/physics/collider-dimensions.js +98 -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/pixi/authoring.d.ts +93 -0
- package/dist/pixi/authoring.d.ts.map +1 -0
- package/dist/pixi/authoring.js +207 -0
- package/dist/pixi/index.d.ts +16 -0
- package/dist/pixi/index.d.ts.map +1 -0
- package/dist/pixi/index.js +15 -0
- package/dist/pixi/ingest-iframe.d.ts +82 -0
- package/dist/pixi/ingest-iframe.d.ts.map +1 -0
- package/dist/pixi/ingest-iframe.js +166 -0
- package/dist/pixi/ingest.d.ts +97 -0
- package/dist/pixi/ingest.d.ts.map +1 -0
- package/dist/pixi/ingest.js +40 -0
- package/dist/pixi/physics-registry.d.ts +24 -0
- package/dist/pixi/physics-registry.d.ts.map +1 -0
- package/dist/pixi/physics-registry.js +38 -0
- package/dist/pixi/scene-capture.d.ts +43 -0
- package/dist/pixi/scene-capture.d.ts.map +1 -0
- package/dist/pixi/scene-capture.js +92 -0
- package/dist/pixi/system-adapters.d.ts +16 -0
- package/dist/pixi/system-adapters.d.ts.map +1 -0
- package/dist/pixi/system-adapters.js +37 -0
- package/dist/react/unmanaged-root-detector.d.ts +18 -0
- package/dist/react/unmanaged-root-detector.d.ts.map +1 -0
- package/dist/react/unmanaged-root-detector.js +70 -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 +101 -0
- package/dist/react/use-selection.d.ts +54 -0
- package/dist/react/use-selection.d.ts.map +1 -0
- package/dist/react/use-selection.js +71 -0
- package/dist/react/world-state.d.ts +154 -0
- package/dist/react/world-state.d.ts.map +1 -0
- package/dist/react/world-state.js +220 -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/instance-mesh.d.ts +5 -0
- package/dist/render/instance-mesh.d.ts.map +1 -0
- package/dist/render/instance-mesh.js +19 -0
- package/dist/render/light-camera-factory.d.ts +24 -0
- package/dist/render/light-camera-factory.d.ts.map +1 -0
- package/dist/render/light-camera-factory.js +71 -0
- package/dist/render/lod.d.ts +13 -0
- package/dist/render/lod.d.ts.map +1 -0
- package/dist/render/lod.js +16 -0
- package/dist/render/material-factory.d.ts +15 -0
- package/dist/render/material-factory.d.ts.map +1 -0
- package/dist/render/material-factory.js +186 -0
- package/dist/render/mesh-shadow.d.ts +11 -0
- package/dist/render/mesh-shadow.d.ts.map +1 -0
- package/dist/render/mesh-shadow.js +19 -0
- package/dist/render/particles-factory.d.ts +99 -0
- package/dist/render/particles-factory.d.ts.map +1 -0
- package/dist/render/particles-factory.js +361 -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 +223 -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 +35 -0
- package/dist/render/render-settings.d.ts.map +1 -0
- package/dist/render/render-settings.js +51 -0
- package/dist/render/spark-renderer-lifecycle.d.ts +18 -0
- package/dist/render/spark-renderer-lifecycle.d.ts.map +1 -0
- package/dist/render/spark-renderer-lifecycle.js +57 -0
- package/dist/render/viewport-shading.d.ts +17 -0
- package/dist/render/viewport-shading.d.ts.map +1 -0
- package/dist/render/viewport-shading.js +87 -0
- package/dist/runtime/create-runtime.d.ts +259 -0
- package/dist/runtime/create-runtime.d.ts.map +1 -0
- package/dist/runtime/create-runtime.js +666 -0
- package/dist/runtime/debug-bridge.d.ts +288 -0
- package/dist/runtime/debug-bridge.d.ts.map +1 -0
- package/dist/runtime/debug-bridge.js +277 -0
- package/dist/runtime/debug-registry.d.ts +287 -0
- package/dist/runtime/debug-registry.d.ts.map +1 -0
- package/dist/runtime/debug-registry.js +528 -0
- package/dist/runtime/dev-layers.d.ts +34 -0
- package/dist/runtime/dev-layers.d.ts.map +1 -0
- package/dist/runtime/dev-layers.js +40 -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 +576 -0
- package/dist/runtime/game.d.ts.map +1 -0
- package/dist/runtime/game.js +1003 -0
- package/dist/runtime/gameplay-rng-trap.d.ts +47 -0
- package/dist/runtime/gameplay-rng-trap.d.ts.map +1 -0
- package/dist/runtime/gameplay-rng-trap.js +95 -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 +126 -0
- package/dist/runtime/mount-game.d.ts.map +1 -0
- package/dist/runtime/mount-game.js +159 -0
- package/dist/runtime/mount-manifest.d.ts +174 -0
- package/dist/runtime/mount-manifest.d.ts.map +1 -0
- package/dist/runtime/mount-manifest.js +304 -0
- package/dist/runtime/presentation.d.ts +85 -0
- package/dist/runtime/presentation.d.ts.map +1 -0
- package/dist/runtime/presentation.js +92 -0
- package/dist/runtime/render-audio-control.d.ts +126 -0
- package/dist/runtime/render-audio-control.d.ts.map +1 -0
- package/dist/runtime/render-audio-control.js +116 -0
- package/dist/runtime/render-control.d.ts +347 -0
- package/dist/runtime/render-control.d.ts.map +1 -0
- package/dist/runtime/render-control.js +317 -0
- package/dist/runtime/render-seed.d.ts +56 -0
- package/dist/runtime/render-seed.d.ts.map +1 -0
- package/dist/runtime/render-seed.js +73 -0
- package/dist/runtime/state-bridge.d.ts +60 -0
- package/dist/runtime/state-bridge.d.ts.map +1 -0
- package/dist/runtime/state-bridge.js +62 -0
- package/dist/runtime/types.d.ts +285 -0
- package/dist/runtime/types.d.ts.map +1 -0
- package/dist/runtime/types.js +1 -0
- package/dist/runtime/unexported-game-trap.d.ts +36 -0
- package/dist/runtime/unexported-game-trap.d.ts.map +1 -0
- package/dist/runtime/unexported-game-trap.js +80 -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 +82 -0
- package/dist/setup/setup-renderer.d.ts.map +1 -0
- package/dist/setup/setup-renderer.js +381 -0
- package/dist/world3d-react/engine-bridge.d.ts +47 -0
- package/dist/world3d-react/engine-bridge.d.ts.map +1 -0
- package/dist/world3d-react/engine-bridge.js +48 -0
- package/dist/world3d-react/index.d.ts +47 -0
- package/dist/world3d-react/index.d.ts.map +1 -0
- package/dist/world3d-react/index.js +46 -0
- package/dist/world3d-react/r3f-adapter.d.ts +51 -0
- package/dist/world3d-react/r3f-adapter.d.ts.map +1 -0
- package/dist/world3d-react/r3f-adapter.js +368 -0
- package/dist/world3d-react/r3f-root-factory.d.ts +62 -0
- package/dist/world3d-react/r3f-root-factory.d.ts.map +1 -0
- package/dist/world3d-react/r3f-root-factory.js +79 -0
- package/dist/world3d-react/rapier-physics-bridge.d.ts +76 -0
- package/dist/world3d-react/rapier-physics-bridge.d.ts.map +1 -0
- package/dist/world3d-react/rapier-physics-bridge.js +120 -0
- package/dist/world3d-react/renderer-config.d.ts +58 -0
- package/dist/world3d-react/renderer-config.d.ts.map +1 -0
- package/dist/world3d-react/renderer-config.js +96 -0
- package/dist/world3d-react/world-context.d.ts +123 -0
- package/dist/world3d-react/world-context.d.ts.map +1 -0
- package/dist/world3d-react/world-context.js +204 -0
- package/dist-config/config.js +303 -0
- package/dist-config/config.js.map +7 -0
- package/package.json +14 -3
- package/src/adapter/rapier-physics-adapter.ts +77 -34
- package/src/config.ts +8 -0
- package/src/core/frame-pacing.ts +26 -0
- package/src/core/game-loop.ts +4 -3
- package/src/dev/instruments.ts +302 -0
- package/src/runtime/mount-game.ts +6 -0
- package/src/runtime/unexported-game-trap.ts +82 -0
- package/src/setup/setup-renderer.ts +2 -0
- package/src/world3d-react/index.ts +9 -0
- package/src/world3d-react/rapier-physics-bridge.tsx +137 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { deleteUserData, getUserData, setUserData } from '../ecs/user-data';
|
|
3
|
+
import { evaluateBlendTree } from './blend-node';
|
|
4
|
+
import { clipNamesOf, collectMachineAnimationMeta, isBlendTreeAnimationMeta, } from './xstate-animation-meta';
|
|
5
|
+
/** A binding-time problem such as a missing clip, bone, or ambiguous layer. */
|
|
6
|
+
export class AnimationBindingError extends Error {
|
|
7
|
+
stateId;
|
|
8
|
+
constructor(message, stateId) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.stateId = stateId;
|
|
11
|
+
this.name = 'AnimationBindingError';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** The state machine behind a bound actor, from whichever half of the actor
|
|
15
|
+
* shape carries it. Throws rather than silently binding nothing when the
|
|
16
|
+
* actor is not a state-machine actor (a promise/callback actor has no
|
|
17
|
+
* `meta.animation` to collect). */
|
|
18
|
+
export function machineOfXStateActor(actor) {
|
|
19
|
+
const logic = actor.logic;
|
|
20
|
+
if (logic?.root)
|
|
21
|
+
return logic;
|
|
22
|
+
const snapshot = actor.getSnapshot();
|
|
23
|
+
if (snapshot?.machine?.root)
|
|
24
|
+
return snapshot.machine;
|
|
25
|
+
throw new AnimationBindingError('[bindXStateAnimation] the actor exposes no state machine — only a state-machine ' +
|
|
26
|
+
'actor carries the `meta.animation` this binder reads');
|
|
27
|
+
}
|
|
28
|
+
let inspectionVersion = 0;
|
|
29
|
+
const inspectionListeners = new Set();
|
|
30
|
+
/** React/useSyncExternalStore-compatible lifecycle signal for live editor inspection. */
|
|
31
|
+
export function subscribeXStateAnimationBindings(listener) {
|
|
32
|
+
inspectionListeners.add(listener);
|
|
33
|
+
return () => inspectionListeners.delete(listener);
|
|
34
|
+
}
|
|
35
|
+
/** Monotonic snapshot changed whenever a binding is attached or disposed. */
|
|
36
|
+
export function getXStateAnimationBindingsVersion() {
|
|
37
|
+
return inspectionVersion;
|
|
38
|
+
}
|
|
39
|
+
function notifyInspectionLifecycle() {
|
|
40
|
+
inspectionVersion++;
|
|
41
|
+
for (const listener of inspectionListeners)
|
|
42
|
+
listener();
|
|
43
|
+
}
|
|
44
|
+
const layerOf = (meta) => meta.layer ?? 'base';
|
|
45
|
+
const layerWeightOf = (meta) => meta.weight ?? 1;
|
|
46
|
+
const blendModeOf = (meta) => meta.blendMode ?? 'override';
|
|
47
|
+
function targetNameOf(track) {
|
|
48
|
+
try {
|
|
49
|
+
return THREE.PropertyBinding.parseTrackName(track.name).nodeName ?? '';
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
const dot = track.name.indexOf('.');
|
|
53
|
+
return dot < 0 ? track.name : track.name.slice(0, dot);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function subtreeNames(root, requested, trackNames) {
|
|
57
|
+
const names = new Set();
|
|
58
|
+
const missing = [];
|
|
59
|
+
for (const requestedName of requested) {
|
|
60
|
+
let found = false;
|
|
61
|
+
root.traverse((object) => {
|
|
62
|
+
if (object.name !== requestedName)
|
|
63
|
+
return;
|
|
64
|
+
found = true;
|
|
65
|
+
object.traverse((descendant) => {
|
|
66
|
+
if (descendant.name)
|
|
67
|
+
names.add(descendant.name);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
// Some exporters target a named node not retained as a discoverable Bone.
|
|
71
|
+
// Exact track-target matches remain useful, but cannot imply descendants.
|
|
72
|
+
if (trackNames.has(requestedName)) {
|
|
73
|
+
found = true;
|
|
74
|
+
names.add(requestedName);
|
|
75
|
+
}
|
|
76
|
+
if (!found)
|
|
77
|
+
missing.push(requestedName);
|
|
78
|
+
}
|
|
79
|
+
return { names, missing };
|
|
80
|
+
}
|
|
81
|
+
function maskedClip(source, mask, root, stateId) {
|
|
82
|
+
const trackNames = new Set(source.tracks.map(targetNameOf));
|
|
83
|
+
const included = mask.include ? subtreeNames(root, mask.include, trackNames) : undefined;
|
|
84
|
+
const excluded = mask.exclude ? subtreeNames(root, mask.exclude, trackNames) : undefined;
|
|
85
|
+
const missing = [...(included?.missing ?? []), ...(excluded?.missing ?? [])];
|
|
86
|
+
if (missing.length) {
|
|
87
|
+
throw new AnimationBindingError(`[bindXStateAnimation] state "${stateId}" boneMask names unknown bones/objects: ${missing.join(', ')}`, stateId);
|
|
88
|
+
}
|
|
89
|
+
const tracks = source.tracks.filter((track) => {
|
|
90
|
+
const name = targetNameOf(track);
|
|
91
|
+
return (!included || included.names.has(name)) && !excluded?.names.has(name);
|
|
92
|
+
});
|
|
93
|
+
if (tracks.length === 0) {
|
|
94
|
+
throw new AnimationBindingError(`[bindXStateAnimation] state "${stateId}" boneMask removes every track from clip "${source.name}"`, stateId);
|
|
95
|
+
}
|
|
96
|
+
return new THREE.AnimationClip(source.name, source.duration, tracks.map((track) => track.clone()));
|
|
97
|
+
}
|
|
98
|
+
function dominantOf(weights) {
|
|
99
|
+
return weights.reduce((a, b) => (b.weight > a.weight ? b : a), weights[0]);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Bind a native XState actor to native Three actions.
|
|
103
|
+
*
|
|
104
|
+
* One active animated state is allowed per named layer. Parallel XState
|
|
105
|
+
* regions therefore compose lower-body locomotion, upper-body weapon states,
|
|
106
|
+
* facial animation, and other independent layers without introducing a
|
|
107
|
+
* second transition language. Bone masks clone/filter native clip tracks;
|
|
108
|
+
* additive layers use `AnimationUtils.makeClipAdditive` and Three's additive
|
|
109
|
+
* blend mode. Single unlayered machines retain the original clip/action path.
|
|
110
|
+
*/
|
|
111
|
+
export function bindXStateAnimation(actor, mixer, clips, options = {}) {
|
|
112
|
+
const mixerRoot = mixer.getRoot();
|
|
113
|
+
const root = options.root ?? (mixerRoot instanceof THREE.Object3D ? mixerRoot : undefined);
|
|
114
|
+
if (!root) {
|
|
115
|
+
throw new AnimationBindingError('[bindXStateAnimation] a THREE.Object3D `root` option is required when the mixer uses AnimationObjectGroup');
|
|
116
|
+
}
|
|
117
|
+
const owner = options.owner ?? root;
|
|
118
|
+
const machineRoot = machineOfXStateActor(actor).root;
|
|
119
|
+
const entries = collectMachineAnimationMeta(machineRoot);
|
|
120
|
+
const metaByStateId = new Map(entries.map((entry) => [entry.stateId, entry.meta]));
|
|
121
|
+
for (const entry of entries) {
|
|
122
|
+
for (const clipName of clipNamesOf(entry.meta)) {
|
|
123
|
+
if (!clips.has(clipName)) {
|
|
124
|
+
throw new AnimationBindingError(`[bindXStateAnimation] state "${entry.stateId}" references clip "${clipName}", which is ` +
|
|
125
|
+
`not present in the supplied clips map. Known clips: ${[...clips.keys()].join(', ') || '(none)'}`, entry.stateId);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Different layers need distinct AnimationActions even when they use the
|
|
130
|
+
// same source clip. A plain base state keeps the original clip identity for
|
|
131
|
+
// backwards-compatible mixer.existingAction(sourceClip) behavior.
|
|
132
|
+
const preparedClips = new Map();
|
|
133
|
+
function actionKey(stateId, meta, clipName) {
|
|
134
|
+
const transformed = layerOf(meta) !== 'base' || Boolean(meta.boneMask) || blendModeOf(meta) === 'additive';
|
|
135
|
+
return transformed ? `${stateId}\u0000${clipName}` : clipName;
|
|
136
|
+
}
|
|
137
|
+
for (const { stateId, meta } of entries) {
|
|
138
|
+
for (const clipName of clipNamesOf(meta)) {
|
|
139
|
+
const key = actionKey(stateId, meta, clipName);
|
|
140
|
+
if (preparedClips.has(key))
|
|
141
|
+
continue;
|
|
142
|
+
const source = clips.get(clipName);
|
|
143
|
+
let prepared = meta.boneMask ? maskedClip(source, meta.boneMask, root, stateId) : source;
|
|
144
|
+
if (prepared !== source || key !== clipName) {
|
|
145
|
+
if (prepared === source)
|
|
146
|
+
prepared = source.clone();
|
|
147
|
+
prepared.name = `${source.name}@${layerOf(meta)}:${stateId}`;
|
|
148
|
+
}
|
|
149
|
+
if (blendModeOf(meta) === 'additive') {
|
|
150
|
+
THREE.AnimationUtils.makeClipAdditive(prepared);
|
|
151
|
+
prepared.blendMode = THREE.AdditiveAnimationBlendMode;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
prepared.blendMode = THREE.NormalAnimationBlendMode;
|
|
155
|
+
}
|
|
156
|
+
preparedClips.set(key, prepared);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const actionCache = new Map();
|
|
160
|
+
function ensureAction(key, loop, speed, weight) {
|
|
161
|
+
let cached = actionCache.get(key);
|
|
162
|
+
if (!cached) {
|
|
163
|
+
const clip = preparedClips.get(key);
|
|
164
|
+
if (!clip)
|
|
165
|
+
throw new AnimationBindingError(`[bindXStateAnimation] prepared clip "${key}" not found`);
|
|
166
|
+
const action = mixer.clipAction(clip);
|
|
167
|
+
action.setEffectiveWeight(0);
|
|
168
|
+
action.play();
|
|
169
|
+
cached = { action, clip };
|
|
170
|
+
actionCache.set(key, cached);
|
|
171
|
+
}
|
|
172
|
+
cached.action.setLoop(loop ? THREE.LoopRepeat : THREE.LoopOnce, Infinity);
|
|
173
|
+
cached.action.clampWhenFinished = !loop;
|
|
174
|
+
cached.action.timeScale = speed;
|
|
175
|
+
cached.action.weight = weight;
|
|
176
|
+
return cached.action;
|
|
177
|
+
}
|
|
178
|
+
function readParameters(context) {
|
|
179
|
+
const raw = options.selectParameters
|
|
180
|
+
? options.selectParameters(context)
|
|
181
|
+
: context;
|
|
182
|
+
return new Map(Object.entries(raw ?? {}));
|
|
183
|
+
}
|
|
184
|
+
function weightsOf(stateId, meta, context) {
|
|
185
|
+
const weights = isBlendTreeAnimationMeta(meta)
|
|
186
|
+
? evaluateBlendTree(meta.blendTree, readParameters(context))
|
|
187
|
+
: [{ clip: meta.clip, weight: 1 }];
|
|
188
|
+
return weights.map(({ clip, weight }) => ({
|
|
189
|
+
clip,
|
|
190
|
+
weight,
|
|
191
|
+
actionKey: actionKey(stateId, meta, clip),
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
const activeLayers = new Map();
|
|
195
|
+
let disposed = false;
|
|
196
|
+
function silence(weights, except, duration) {
|
|
197
|
+
for (const weighted of weights) {
|
|
198
|
+
if (weighted.actionKey === except)
|
|
199
|
+
continue;
|
|
200
|
+
const action = actionCache.get(weighted.actionKey)?.action;
|
|
201
|
+
if (!action)
|
|
202
|
+
continue;
|
|
203
|
+
if (duration > 0)
|
|
204
|
+
action.fadeOut(duration);
|
|
205
|
+
else
|
|
206
|
+
action.setEffectiveWeight(0);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
function applyLiveBlendWeights(state, context) {
|
|
210
|
+
if (!isBlendTreeAnimationMeta(state.meta))
|
|
211
|
+
return;
|
|
212
|
+
state.natural = weightsOf(state.stateId, state.meta, context);
|
|
213
|
+
const layerWeight = layerWeightOf(state.meta);
|
|
214
|
+
for (const weighted of state.natural) {
|
|
215
|
+
actionCache.get(weighted.actionKey)?.action.setEffectiveWeight(weighted.weight * layerWeight);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
function enterState(stateId, meta, context) {
|
|
219
|
+
const layer = layerOf(meta);
|
|
220
|
+
const outgoing = activeLayers.get(layer) ?? null;
|
|
221
|
+
const weights = weightsOf(stateId, meta, context);
|
|
222
|
+
const dominant = dominantOf(weights);
|
|
223
|
+
const loop = isBlendTreeAnimationMeta(meta) ? true : meta.loop;
|
|
224
|
+
const speed = isBlendTreeAnimationMeta(meta) ? 1 : meta.speed;
|
|
225
|
+
const layerWeight = layerWeightOf(meta);
|
|
226
|
+
for (const weighted of weights)
|
|
227
|
+
ensureAction(weighted.actionKey, loop, speed, layerWeight);
|
|
228
|
+
const dominantAction = actionCache.get(dominant.actionKey).action;
|
|
229
|
+
dominantAction.reset().setEffectiveWeight(layerWeight);
|
|
230
|
+
for (const weighted of weights) {
|
|
231
|
+
if (weighted.actionKey === dominant.actionKey)
|
|
232
|
+
continue;
|
|
233
|
+
actionCache.get(weighted.actionKey).action.reset().setEffectiveWeight(0);
|
|
234
|
+
}
|
|
235
|
+
const duration = meta.crossfade?.duration ?? 0;
|
|
236
|
+
const warp = meta.crossfade?.warp ?? false;
|
|
237
|
+
if (!outgoing) {
|
|
238
|
+
if (duration > 0)
|
|
239
|
+
dominantAction.fadeIn(duration);
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
silence(outgoing.natural, outgoing.dominantActionKey, duration);
|
|
243
|
+
const previous = actionCache.get(outgoing.dominantActionKey)?.action;
|
|
244
|
+
if (previous && duration > 0)
|
|
245
|
+
previous.crossFadeTo(dominantAction, duration, warp);
|
|
246
|
+
else {
|
|
247
|
+
previous?.setEffectiveWeight(0);
|
|
248
|
+
dominantAction.setEffectiveWeight(layerWeight);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
const active = {
|
|
252
|
+
layer,
|
|
253
|
+
stateId,
|
|
254
|
+
meta,
|
|
255
|
+
natural: weights,
|
|
256
|
+
dominantActionKey: dominant.actionKey,
|
|
257
|
+
crossfadeRemaining: duration,
|
|
258
|
+
};
|
|
259
|
+
activeLayers.set(layer, active);
|
|
260
|
+
if (isBlendTreeAnimationMeta(meta) && duration <= 0)
|
|
261
|
+
applyLiveBlendWeights(active, context);
|
|
262
|
+
}
|
|
263
|
+
function activeStateIds(snapshot) {
|
|
264
|
+
return Object.keys(snapshot.getMeta()).filter((id) => metaByStateId.has(id));
|
|
265
|
+
}
|
|
266
|
+
function reconcile(snapshot) {
|
|
267
|
+
const nextByLayer = new Map();
|
|
268
|
+
for (const stateId of activeStateIds(snapshot)) {
|
|
269
|
+
const meta = metaByStateId.get(stateId);
|
|
270
|
+
const layer = layerOf(meta);
|
|
271
|
+
const previous = nextByLayer.get(layer);
|
|
272
|
+
if (previous) {
|
|
273
|
+
throw new AnimationBindingError(`[bindXStateAnimation] animated states "${previous}" and "${stateId}" are both active ` +
|
|
274
|
+
`on layer "${layer}". Give parallel regions distinct meta.animation.layer names.`, stateId);
|
|
275
|
+
}
|
|
276
|
+
nextByLayer.set(layer, stateId);
|
|
277
|
+
}
|
|
278
|
+
for (const [layer, active] of activeLayers) {
|
|
279
|
+
if (nextByLayer.has(layer))
|
|
280
|
+
continue;
|
|
281
|
+
silence(active.natural, undefined, 0);
|
|
282
|
+
activeLayers.delete(layer);
|
|
283
|
+
}
|
|
284
|
+
for (const [layer, stateId] of nextByLayer) {
|
|
285
|
+
if (activeLayers.get(layer)?.stateId === stateId)
|
|
286
|
+
continue;
|
|
287
|
+
enterState(stateId, metaByStateId.get(stateId), snapshot.context);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const initialSnapshot = actor.getSnapshot();
|
|
291
|
+
reconcile(initialSnapshot);
|
|
292
|
+
const subscription = actor.subscribe((snapshot) => {
|
|
293
|
+
if (!disposed)
|
|
294
|
+
reconcile(snapshot);
|
|
295
|
+
});
|
|
296
|
+
function tick(dt) {
|
|
297
|
+
if (disposed)
|
|
298
|
+
return;
|
|
299
|
+
const context = actor.getSnapshot().context;
|
|
300
|
+
for (const active of activeLayers.values()) {
|
|
301
|
+
if (active.crossfadeRemaining > 0) {
|
|
302
|
+
active.crossfadeRemaining = Math.max(0, active.crossfadeRemaining - dt);
|
|
303
|
+
if (active.crossfadeRemaining <= 0)
|
|
304
|
+
applyLiveBlendWeights(active, context);
|
|
305
|
+
}
|
|
306
|
+
else {
|
|
307
|
+
applyLiveBlendWeights(active, context);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
mixer.update(dt);
|
|
311
|
+
}
|
|
312
|
+
const binding = {
|
|
313
|
+
tick,
|
|
314
|
+
actor,
|
|
315
|
+
getActiveLayers: () => [...activeLayers.values()].map((active) => ({
|
|
316
|
+
layer: active.layer,
|
|
317
|
+
stateId: active.stateId,
|
|
318
|
+
clips: active.natural.map((weighted) => weighted.clip),
|
|
319
|
+
clipWeights: active.natural.map((weighted) => ({
|
|
320
|
+
clip: weighted.clip,
|
|
321
|
+
weight: actionCache.get(weighted.actionKey)?.action.getEffectiveWeight() ?? 0,
|
|
322
|
+
})),
|
|
323
|
+
weight: layerWeightOf(active.meta),
|
|
324
|
+
blendMode: blendModeOf(active.meta),
|
|
325
|
+
...(active.meta.boneMask ? { boneMask: active.meta.boneMask } : {}),
|
|
326
|
+
})),
|
|
327
|
+
dispose() {
|
|
328
|
+
if (disposed)
|
|
329
|
+
return;
|
|
330
|
+
disposed = true;
|
|
331
|
+
options.systems?.remove('animation', tick);
|
|
332
|
+
subscription.unsubscribe();
|
|
333
|
+
for (const { action, clip } of actionCache.values()) {
|
|
334
|
+
action.stop();
|
|
335
|
+
mixer.uncacheAction(clip, action.getRoot());
|
|
336
|
+
}
|
|
337
|
+
actionCache.clear();
|
|
338
|
+
activeLayers.clear();
|
|
339
|
+
if (getUserData(owner, '_xstateAnimation') === binding) {
|
|
340
|
+
deleteUserData(owner, '_xstateAnimation');
|
|
341
|
+
notifyInspectionLifecycle();
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
setUserData(owner, '_xstateAnimation', binding);
|
|
346
|
+
notifyInspectionLifecycle();
|
|
347
|
+
options.systems?.add('animation', tick);
|
|
348
|
+
return binding;
|
|
349
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* E1 — Zod/TypeScript metadata attached to XState state `meta.animation`
|
|
4
|
+
* (spec §11 E1, §5.6, §3.3).
|
|
5
|
+
*
|
|
6
|
+
* This module defines ONLY animation data: which clip(s) a state plays, how
|
|
7
|
+
* they loop/blend/crossfade, and (for locomotion-style states) how a 1D/2D/
|
|
8
|
+
* direct blend tree distributes weight across several clips from a live
|
|
9
|
+
* parameter. It intentionally contains **no transition vocabulary** — no
|
|
10
|
+
* `on`/`target`/`guard`/`always`/`after`/`entry`/`exit`. XState alone owns
|
|
11
|
+
* states, transitions, events, and guards (§3.3); this metadata is read-only
|
|
12
|
+
* data a binding (`xstate-animation-binding.ts`, E2) consumes to drive a
|
|
13
|
+
* `THREE.AnimationMixer` when XState enters/exits a state. Every schema below
|
|
14
|
+
* is `.strict()` specifically so that smuggling a transition-shaped key into
|
|
15
|
+
* `meta.animation` is a loud Zod "unrecognized key" error, not a silently
|
|
16
|
+
* ignored field (E1 AC: "Metadata contains no transition language").
|
|
17
|
+
*
|
|
18
|
+
* ## Native layered composition
|
|
19
|
+
*
|
|
20
|
+
* Parallel XState regions may drive independent named layers. Each layer can
|
|
21
|
+
* filter a clip to selected bone subtrees, scale its weight, and use normal
|
|
22
|
+
* override or Three's native additive blend mode. XState still owns all
|
|
23
|
+
* state/transition semantics; these fields only describe how the active
|
|
24
|
+
* state's native `AnimationAction`s are composed by the binding.
|
|
25
|
+
*
|
|
26
|
+
* ## Blend tree shape
|
|
27
|
+
*
|
|
28
|
+
* Deliberately structurally IDENTICAL to `anim-graph-types.ts`'s
|
|
29
|
+
* `BlendTreeDef` (same `type`/`parameter`/`parameterY`/`children[].clip`/
|
|
30
|
+
* `.threshold`/`.thresholdY`/`.weight` fields) so the binding can hand a
|
|
31
|
+
* parsed `AnimationBlendTree` straight to the existing, already-tested
|
|
32
|
+
* `evaluateBlendTree` (`blend-node.ts`) with zero conversion — E2 reuses that
|
|
33
|
+
* function verbatim rather than re-implementing 1D/2D/direct blend math.
|
|
34
|
+
*/
|
|
35
|
+
declare const AnimationBlendChildSchema: z.ZodObject<{
|
|
36
|
+
clip: z.ZodString;
|
|
37
|
+
threshold: z.ZodNumber;
|
|
38
|
+
thresholdY: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
}, z.core.$strict>;
|
|
41
|
+
export type AnimationBlendChild = z.infer<typeof AnimationBlendChildSchema>;
|
|
42
|
+
export declare const AnimationBlendTreeSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
|
+
type: z.ZodLiteral<"1D">;
|
|
44
|
+
parameter: z.ZodString;
|
|
45
|
+
children: z.ZodArray<z.ZodObject<{
|
|
46
|
+
clip: z.ZodString;
|
|
47
|
+
threshold: z.ZodNumber;
|
|
48
|
+
thresholdY: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
}, z.core.$strict>>;
|
|
51
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
52
|
+
type: z.ZodLiteral<"2D">;
|
|
53
|
+
parameter: z.ZodString;
|
|
54
|
+
parameterY: z.ZodString;
|
|
55
|
+
children: z.ZodArray<z.ZodObject<{
|
|
56
|
+
clip: z.ZodString;
|
|
57
|
+
threshold: z.ZodNumber;
|
|
58
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
thresholdY: z.ZodNumber;
|
|
60
|
+
}, z.core.$strict>>;
|
|
61
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
62
|
+
type: z.ZodLiteral<"direct">;
|
|
63
|
+
parameter: z.ZodDefault<z.ZodString>;
|
|
64
|
+
children: z.ZodArray<z.ZodObject<{
|
|
65
|
+
clip: z.ZodString;
|
|
66
|
+
threshold: z.ZodNumber;
|
|
67
|
+
thresholdY: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
weight: z.ZodNumber;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
}, z.core.$strict>], "type">;
|
|
71
|
+
export type AnimationBlendTree = z.infer<typeof AnimationBlendTreeSchema>;
|
|
72
|
+
declare const AnimationCrossfadeMetaSchema: z.ZodObject<{
|
|
73
|
+
duration: z.ZodDefault<z.ZodNumber>;
|
|
74
|
+
warp: z.ZodDefault<z.ZodBoolean>;
|
|
75
|
+
}, z.core.$strict>;
|
|
76
|
+
export type AnimationCrossfadeMeta = z.infer<typeof AnimationCrossfadeMetaSchema>;
|
|
77
|
+
declare const AnimationBoneMaskSchema: z.ZodObject<{
|
|
78
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
79
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
80
|
+
}, z.core.$strict>;
|
|
81
|
+
export type AnimationBoneMask = z.infer<typeof AnimationBoneMaskSchema>;
|
|
82
|
+
declare const ClipAnimationMetaSchema: z.ZodObject<{
|
|
83
|
+
layer: z.ZodOptional<z.ZodString>;
|
|
84
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
85
|
+
blendMode: z.ZodOptional<z.ZodEnum<{
|
|
86
|
+
override: "override";
|
|
87
|
+
additive: "additive";
|
|
88
|
+
}>>;
|
|
89
|
+
boneMask: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
91
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
92
|
+
}, z.core.$strict>>;
|
|
93
|
+
clip: z.ZodString;
|
|
94
|
+
loop: z.ZodDefault<z.ZodBoolean>;
|
|
95
|
+
speed: z.ZodDefault<z.ZodNumber>;
|
|
96
|
+
crossfade: z.ZodOptional<z.ZodObject<{
|
|
97
|
+
duration: z.ZodDefault<z.ZodNumber>;
|
|
98
|
+
warp: z.ZodDefault<z.ZodBoolean>;
|
|
99
|
+
}, z.core.$strict>>;
|
|
100
|
+
}, z.core.$strict>;
|
|
101
|
+
export type ClipAnimationMeta = z.infer<typeof ClipAnimationMetaSchema>;
|
|
102
|
+
declare const BlendTreeAnimationMetaSchema: z.ZodObject<{
|
|
103
|
+
layer: z.ZodOptional<z.ZodString>;
|
|
104
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
blendMode: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
override: "override";
|
|
107
|
+
additive: "additive";
|
|
108
|
+
}>>;
|
|
109
|
+
boneMask: z.ZodOptional<z.ZodObject<{
|
|
110
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
111
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
112
|
+
}, z.core.$strict>>;
|
|
113
|
+
blendTree: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
114
|
+
type: z.ZodLiteral<"1D">;
|
|
115
|
+
parameter: z.ZodString;
|
|
116
|
+
children: z.ZodArray<z.ZodObject<{
|
|
117
|
+
clip: z.ZodString;
|
|
118
|
+
threshold: z.ZodNumber;
|
|
119
|
+
thresholdY: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
121
|
+
}, z.core.$strict>>;
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"2D">;
|
|
124
|
+
parameter: z.ZodString;
|
|
125
|
+
parameterY: z.ZodString;
|
|
126
|
+
children: z.ZodArray<z.ZodObject<{
|
|
127
|
+
clip: z.ZodString;
|
|
128
|
+
threshold: z.ZodNumber;
|
|
129
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
130
|
+
thresholdY: z.ZodNumber;
|
|
131
|
+
}, z.core.$strict>>;
|
|
132
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
133
|
+
type: z.ZodLiteral<"direct">;
|
|
134
|
+
parameter: z.ZodDefault<z.ZodString>;
|
|
135
|
+
children: z.ZodArray<z.ZodObject<{
|
|
136
|
+
clip: z.ZodString;
|
|
137
|
+
threshold: z.ZodNumber;
|
|
138
|
+
thresholdY: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
weight: z.ZodNumber;
|
|
140
|
+
}, z.core.$strict>>;
|
|
141
|
+
}, z.core.$strict>], "type">;
|
|
142
|
+
crossfade: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
duration: z.ZodDefault<z.ZodNumber>;
|
|
144
|
+
warp: z.ZodDefault<z.ZodBoolean>;
|
|
145
|
+
}, z.core.$strict>>;
|
|
146
|
+
}, z.core.$strict>;
|
|
147
|
+
export type BlendTreeAnimationMeta = z.infer<typeof BlendTreeAnimationMetaSchema>;
|
|
148
|
+
/**
|
|
149
|
+
* The full shape of `state.meta.animation` for one XState state (spec §5.6):
|
|
150
|
+
* exactly one of a single clip or a blend tree, plus optional crossfade
|
|
151
|
+
* timing. `.strict()` on both branches is what makes authoring a transition
|
|
152
|
+
* keyword (`on`, `target`, `guard`, …) inside `meta.animation` a validation
|
|
153
|
+
* error instead of a silently-accepted second transition dialect.
|
|
154
|
+
*/
|
|
155
|
+
export declare const StateAnimationMetaSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
156
|
+
layer: z.ZodOptional<z.ZodString>;
|
|
157
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
158
|
+
blendMode: z.ZodOptional<z.ZodEnum<{
|
|
159
|
+
override: "override";
|
|
160
|
+
additive: "additive";
|
|
161
|
+
}>>;
|
|
162
|
+
boneMask: z.ZodOptional<z.ZodObject<{
|
|
163
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
164
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
165
|
+
}, z.core.$strict>>;
|
|
166
|
+
clip: z.ZodString;
|
|
167
|
+
loop: z.ZodDefault<z.ZodBoolean>;
|
|
168
|
+
speed: z.ZodDefault<z.ZodNumber>;
|
|
169
|
+
crossfade: z.ZodOptional<z.ZodObject<{
|
|
170
|
+
duration: z.ZodDefault<z.ZodNumber>;
|
|
171
|
+
warp: z.ZodDefault<z.ZodBoolean>;
|
|
172
|
+
}, z.core.$strict>>;
|
|
173
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
174
|
+
layer: z.ZodOptional<z.ZodString>;
|
|
175
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
blendMode: z.ZodOptional<z.ZodEnum<{
|
|
177
|
+
override: "override";
|
|
178
|
+
additive: "additive";
|
|
179
|
+
}>>;
|
|
180
|
+
boneMask: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
include: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
182
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
183
|
+
}, z.core.$strict>>;
|
|
184
|
+
blendTree: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
185
|
+
type: z.ZodLiteral<"1D">;
|
|
186
|
+
parameter: z.ZodString;
|
|
187
|
+
children: z.ZodArray<z.ZodObject<{
|
|
188
|
+
clip: z.ZodString;
|
|
189
|
+
threshold: z.ZodNumber;
|
|
190
|
+
thresholdY: z.ZodOptional<z.ZodNumber>;
|
|
191
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
}, z.core.$strict>>;
|
|
193
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
194
|
+
type: z.ZodLiteral<"2D">;
|
|
195
|
+
parameter: z.ZodString;
|
|
196
|
+
parameterY: z.ZodString;
|
|
197
|
+
children: z.ZodArray<z.ZodObject<{
|
|
198
|
+
clip: z.ZodString;
|
|
199
|
+
threshold: z.ZodNumber;
|
|
200
|
+
weight: z.ZodOptional<z.ZodNumber>;
|
|
201
|
+
thresholdY: z.ZodNumber;
|
|
202
|
+
}, z.core.$strict>>;
|
|
203
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
204
|
+
type: z.ZodLiteral<"direct">;
|
|
205
|
+
parameter: z.ZodDefault<z.ZodString>;
|
|
206
|
+
children: z.ZodArray<z.ZodObject<{
|
|
207
|
+
clip: z.ZodString;
|
|
208
|
+
threshold: z.ZodNumber;
|
|
209
|
+
thresholdY: z.ZodOptional<z.ZodNumber>;
|
|
210
|
+
weight: z.ZodNumber;
|
|
211
|
+
}, z.core.$strict>>;
|
|
212
|
+
}, z.core.$strict>], "type">;
|
|
213
|
+
crossfade: z.ZodOptional<z.ZodObject<{
|
|
214
|
+
duration: z.ZodDefault<z.ZodNumber>;
|
|
215
|
+
warp: z.ZodDefault<z.ZodBoolean>;
|
|
216
|
+
}, z.core.$strict>>;
|
|
217
|
+
}, z.core.$strict>]>;
|
|
218
|
+
export type StateAnimationMeta = z.infer<typeof StateAnimationMetaSchema>;
|
|
219
|
+
/** True iff a validated meta declares a single clip rather than a blend tree. */
|
|
220
|
+
export declare function isClipAnimationMeta(meta: StateAnimationMeta): meta is ClipAnimationMeta;
|
|
221
|
+
/** True iff a validated meta declares a blend tree rather than a single clip. */
|
|
222
|
+
export declare function isBlendTreeAnimationMeta(meta: StateAnimationMeta): meta is BlendTreeAnimationMeta;
|
|
223
|
+
/** Thrown by `parseStateAnimationMeta` — always names the offending state id. */
|
|
224
|
+
export declare class AnimationMetaValidationError extends Error {
|
|
225
|
+
readonly stateId: string;
|
|
226
|
+
readonly issues: z.ZodIssue[];
|
|
227
|
+
constructor(message: string, stateId: string, issues: z.ZodIssue[]);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Validate one state's `meta.animation` value. Called by the E2 binding for
|
|
231
|
+
* every state a machine declares (both at bind time, up front, and — for
|
|
232
|
+
* belt-and-suspenders — again whenever a state is entered).
|
|
233
|
+
*
|
|
234
|
+
* @throws {AnimationMetaValidationError} naming the state id and every Zod
|
|
235
|
+
* issue (path + message) — e.g. an unrecognized `on`/`target` key, a
|
|
236
|
+
* missing `clip`, or a 1D blend tree with only one child.
|
|
237
|
+
*/
|
|
238
|
+
export declare function parseStateAnimationMeta(stateId: string, raw: unknown): StateAnimationMeta;
|
|
239
|
+
/** The minimal shape of an XState `StateNode` this module needs to walk. */
|
|
240
|
+
export interface AnimationMetaStateNodeLike {
|
|
241
|
+
id: string;
|
|
242
|
+
meta?: {
|
|
243
|
+
animation?: unknown;
|
|
244
|
+
} & Record<string, unknown>;
|
|
245
|
+
states?: Record<string, AnimationMetaStateNodeLike>;
|
|
246
|
+
}
|
|
247
|
+
export interface MachineAnimationMetaEntry {
|
|
248
|
+
stateId: string;
|
|
249
|
+
meta: StateAnimationMeta;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Walk every state node in a machine (from its root `StateNode`, e.g.
|
|
253
|
+
* `actor.logic.root`) and validate every `meta.animation` value found.
|
|
254
|
+
* States with no `meta.animation` are skipped (not every XState state needs
|
|
255
|
+
* to drive animation). Returns one entry per animated state, in document
|
|
256
|
+
* order.
|
|
257
|
+
*
|
|
258
|
+
* @throws {AnimationMetaValidationError} on the FIRST invalid meta found —
|
|
259
|
+
* naming the specific state id, so an agent authoring a machine gets an
|
|
260
|
+
* actionable pointer straight to the bad state instead of a generic error.
|
|
261
|
+
*/
|
|
262
|
+
export declare function collectMachineAnimationMeta(root: AnimationMetaStateNodeLike): MachineAnimationMetaEntry[];
|
|
263
|
+
/** Every clip name referenced anywhere in a validated meta (1 for clip states, N for blend trees). */
|
|
264
|
+
export declare function clipNamesOf(meta: StateAnimationMeta): string[];
|
|
265
|
+
export {};
|
|
266
|
+
//# sourceMappingURL=xstate-animation-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xstate-animation-meta.d.ts","sourceRoot":"","sources":["../../src/animation/xstate-animation-meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,QAAA,MAAM,yBAAyB;;;;;kBAcpB,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAwC5E,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAInC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAM1E,QAAA,MAAM,4BAA4B;;;kBAmBkC,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF,QAAA,MAAM,uBAAuB;;;kBAiB0C,CAAC;AAExE,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AA2BxE,QAAA,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;kBAiBlB,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE,QAAA,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAQvB,CAAC;AAEZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAElF;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAGnC,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,iFAAiF;AACjF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,IAAI,iBAAiB,CAEvF;AAED,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,kBAAkB,GAAG,IAAI,IAAI,sBAAsB,CAEjG;AAMD,iFAAiF;AACjF,qBAAa,4BAA6B,SAAQ,KAAK;IAGnD,QAAQ,CAAC,OAAO,EAAE,MAAM;IACxB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;gBAF7B,OAAO,EAAE,MAAM,EACN,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAKhC;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,kBAAkB,CAazF;AAMD,4EAA4E;AAC5E,MAAM,WAAW,0BAA0B;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;CACrD;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,0BAA0B,GAC/B,yBAAyB,EAAE,CAU7B;AAED,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAE9D"}
|