@motionscript/core 0.1.0-alpha.6 → 0.1.0-alpha.8
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/CHANGELOG.md +34 -0
- package/NOTICE +15 -14
- package/README.md +5 -7
- package/dist/assets/errors.js +4 -5
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +7 -5
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/scope.d.ts +1 -1
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/effects/chain.d.ts +73 -0
- package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
- package/dist/attributes/audio/effects/chain.js +67 -0
- package/dist/attributes/audio/effects/chain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/echo.js +11 -0
- package/dist/attributes/audio/effects/implementations/echo.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/gain.d.ts +10 -0
- package/dist/attributes/audio/effects/implementations/gain.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/gain.js +6 -0
- package/dist/attributes/audio/effects/implementations/gain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/highpass.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/highpass.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/highpass.js +10 -0
- package/dist/attributes/audio/effects/implementations/highpass.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/lowpass.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/lowpass.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/lowpass.js +10 -0
- package/dist/attributes/audio/effects/implementations/lowpass.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/tremolo.d.ts +12 -0
- package/dist/attributes/audio/effects/implementations/tremolo.d.ts.map +1 -0
- package/dist/attributes/audio/effects/implementations/tremolo.js +10 -0
- package/dist/attributes/audio/effects/implementations/tremolo.js.map +1 -0
- package/dist/attributes/audio/effects/index.d.ts +12 -0
- package/dist/attributes/audio/effects/index.d.ts.map +1 -0
- package/dist/attributes/audio/effects/index.js +4 -0
- package/dist/attributes/audio/effects/index.js.map +1 -0
- package/dist/attributes/audio/effects/registry.d.ts +36 -0
- package/dist/attributes/audio/effects/registry.d.ts.map +1 -0
- package/dist/attributes/audio/effects/registry.js +80 -0
- package/dist/attributes/audio/effects/registry.js.map +1 -0
- package/dist/attributes/audio/effects/union.d.ts +14 -0
- package/dist/attributes/audio/effects/union.d.ts.map +1 -0
- package/dist/attributes/audio/effects/union.js +24 -0
- package/dist/attributes/audio/effects/union.js.map +1 -0
- package/dist/attributes/audio/ramp.d.ts +103 -0
- package/dist/attributes/audio/ramp.d.ts.map +1 -0
- package/dist/attributes/audio/ramp.js +246 -0
- package/dist/attributes/audio/ramp.js.map +1 -0
- package/dist/attributes/audio/request.d.ts +24 -13
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +4 -3
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +24 -31
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +42 -28
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +15 -12
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -10
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/audio/transition.d.ts +33 -0
- package/dist/attributes/audio/transition.d.ts.map +1 -0
- package/dist/attributes/audio/transition.js +48 -0
- package/dist/attributes/audio/transition.js.map +1 -0
- package/dist/attributes/index.d.ts +7 -8
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +6 -9
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/insets.d.ts +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.d.ts +2 -2
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.d.ts +1 -1
- package/dist/attributes/layout/size.js +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/space3d.js +1 -1
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +44 -11
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +37 -9
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.d.ts +1 -1
- package/dist/attributes/properties/inputs.js +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +24 -145
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +16 -112
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +2 -3
- package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js +2 -3
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +96 -409
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +93 -283
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.d.ts +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.d.ts +45 -13
- package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js +29 -23
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +32 -7
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js +17 -15
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts +46 -10
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js +21 -19
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.d.ts +32 -7
- package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js +17 -11
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.d.ts +16 -3
- package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js +13 -5
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.d.ts +28 -9
- package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js +15 -14
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +21 -5
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +15 -10
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +96 -26
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js +29 -26
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +20 -6
- package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js +26 -23
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
- package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js +26 -20
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +47 -15
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
- package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
- package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js +17 -14
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +76 -19
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js +28 -22
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.d.ts +149 -42
- package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js +74 -72
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.d.ts +43 -11
- package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js +21 -18
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts +17 -3
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js +13 -5
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.d.ts +40 -9
- package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js +20 -16
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.d.ts +23 -5
- package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js +15 -10
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +57 -18
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js +25 -22
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +34 -7
- package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js +20 -16
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.d.ts +27 -9
- package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js +17 -14
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +54 -19
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js +42 -20
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +17 -3
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js +13 -9
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.d.ts +28 -8
- package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js +18 -17
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts +25 -6
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js +16 -14
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.d.ts +14 -3
- package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js +13 -9
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +91 -26
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js +27 -28
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +49 -10
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js +19 -20
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +36 -6
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js +16 -15
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts +52 -11
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js +21 -18
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.d.ts +23 -9
- package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js +15 -12
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts +90 -34
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +42 -26
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts +23 -5
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js +16 -11
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.d.ts +40 -9
- package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js +19 -16
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.d.ts +24 -5
- package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js +17 -11
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.d.ts +35 -8
- package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js +17 -16
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.d.ts +37 -7
- package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js +19 -18
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.d.ts +24 -5
- package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js +15 -10
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.d.ts +61 -14
- package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js +26 -23
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +4 -2
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +11 -0
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +113 -102
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/spec.d.ts +229 -0
- package/dist/attributes/shape/effects/spec.d.ts.map +1 -0
- package/dist/attributes/shape/effects/spec.js +178 -0
- package/dist/attributes/shape/effects/spec.js.map +1 -0
- package/dist/attributes/shape/fill/chain.d.ts +7 -9
- package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
- package/dist/attributes/shape/fill/chain.js +9 -11
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts +1 -1
- package/dist/attributes/shape/fill/color/parser.js +1 -1
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +28 -27
- package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js +20 -14
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.d.ts +1 -1
- package/dist/attributes/shape/fill/index.d.ts.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.d.ts +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/registry.d.ts +1 -2
- package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
- package/dist/attributes/shape/fill/registry.js +1 -2
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +3 -7
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +2 -6
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +1 -1
- package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +6 -6
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/ops.d.ts +1 -2
- package/dist/attributes/shape/path/ops.d.ts.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/shaders/index.d.ts +2 -0
- package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/index.js +2 -0
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/language.d.ts +26 -0
- package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/language.js +20 -0
- package/dist/attributes/shape/shaders/language.js.map +1 -0
- package/dist/attributes/shape/shaders/pack.d.ts +25 -11
- package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/pack.js +9 -4
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
- package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js +3 -6
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
- package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/uniforms.js +0 -0
- package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
- package/dist/attributes/shared/operators.d.ts +2 -2
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/types.d.ts +2 -3
- package/dist/attributes/text/types.d.ts.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-AOT33LMS.js +13 -0
- package/dist/browser/chunks/chunk-AOT33LMS.js.map +7 -0
- package/dist/browser/chunks/chunk-GKM6UZJR.js +6 -0
- package/dist/browser/chunks/chunk-GKM6UZJR.js.map +7 -0
- package/dist/browser/chunks/chunk-LKUYVFU3.js +2 -0
- package/dist/browser/chunks/{chunk-DHB4COFY.js.map → chunk-LKUYVFU3.js.map} +4 -4
- package/dist/browser/chunks/chunk-ZRPZPWZU.js +3 -0
- package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/experimental.js.map +4 -4
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/manifest.json +2 -4
- package/dist/browser/sdk.js +1 -1
- package/dist/component.d.ts +10 -18
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +10 -17
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/audio/audio.d.ts +62 -0
- package/dist/components/builtins/audio/audio.d.ts.map +1 -0
- package/dist/components/builtins/audio/audio.js +38 -0
- package/dist/components/builtins/audio/audio.js.map +1 -0
- package/dist/components/builtins/geometry/composite.d.ts +93 -0
- package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
- package/dist/components/builtins/geometry/composite.js +25 -0
- package/dist/components/builtins/geometry/composite.js.map +1 -0
- package/dist/components/builtins/geometry/geometry.d.ts +921 -0
- package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
- package/dist/components/builtins/geometry/geometry.js +107 -0
- package/dist/components/builtins/geometry/geometry.js.map +1 -0
- package/dist/components/builtins/geometry/shape-outline.d.ts +93 -0
- package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
- package/dist/components/builtins/geometry/shape-outline.js +470 -0
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
- package/dist/components/builtins/layout/layout.d.ts +186 -0
- package/dist/components/builtins/layout/layout.d.ts.map +1 -0
- package/dist/components/builtins/layout/layout.js +84 -0
- package/dist/components/builtins/layout/layout.js.map +1 -0
- package/dist/components/builtins/media/media.d.ts +240 -0
- package/dist/components/builtins/media/media.d.ts.map +1 -0
- package/dist/components/builtins/media/media.js +143 -0
- package/dist/components/builtins/media/media.js.map +1 -0
- package/dist/components/builtins/providers/providers.d.ts +47 -0
- package/dist/components/builtins/providers/providers.d.ts.map +1 -0
- package/dist/components/builtins/providers/providers.js +30 -0
- package/dist/components/builtins/providers/providers.js.map +1 -0
- package/dist/components/builtins/text/number-format.d.ts +66 -0
- package/dist/components/builtins/text/number-format.d.ts.map +1 -0
- package/dist/components/builtins/text/number-format.js +227 -0
- package/dist/components/builtins/text/number-format.js.map +1 -0
- package/dist/components/builtins/text/number-pattern.d.ts +51 -0
- package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
- package/dist/components/builtins/text/number-pattern.js +77 -0
- package/dist/components/builtins/text/number-pattern.js.map +1 -0
- package/dist/components/builtins/text/text-defaults.d.ts +32 -0
- package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
- package/dist/components/builtins/text/text-defaults.js +37 -0
- package/dist/components/builtins/text/text-defaults.js.map +1 -0
- package/dist/components/builtins/text/text-layout.d.ts +82 -0
- package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
- package/dist/components/builtins/text/text-layout.js +331 -0
- package/dist/components/builtins/text/text-layout.js.map +1 -0
- package/dist/components/builtins/text/text.d.ts +409 -0
- package/dist/components/builtins/text/text.d.ts.map +1 -0
- package/dist/components/builtins/text/text.js +116 -0
- package/dist/components/builtins/text/text.js.map +1 -0
- package/dist/components/builtins/three/canvas3d.d.ts +245 -0
- package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
- package/dist/components/builtins/three/canvas3d.js +21 -0
- package/dist/components/builtins/three/canvas3d.js.map +1 -0
- package/dist/components/builtins/three/grid-geometry3d.d.ts +62 -0
- package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
- package/dist/components/builtins/three/grid-geometry3d.js +114 -0
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
- package/dist/components/builtins/three/three.d.ts +1889 -0
- package/dist/components/builtins/three/three.d.ts.map +1 -0
- package/dist/components/builtins/three/three.js +305 -0
- package/dist/components/builtins/three/three.js.map +1 -0
- package/dist/components/factory/api.d.ts +543 -0
- package/dist/components/factory/api.d.ts.map +1 -0
- package/dist/components/factory/api.js +4 -0
- package/dist/components/factory/api.js.map +1 -0
- package/dist/components/factory/clip-of.d.ts +5 -0
- package/dist/components/factory/clip-of.d.ts.map +1 -0
- package/dist/components/factory/clip-of.js +33 -0
- package/dist/components/factory/clip-of.js.map +1 -0
- package/dist/components/factory/commands-for.d.ts +19 -0
- package/dist/components/factory/commands-for.d.ts.map +1 -0
- package/dist/components/factory/commands-for.js +5 -0
- package/dist/components/factory/commands-for.js.map +1 -0
- package/dist/components/factory/component-audio.d.ts +9 -0
- package/dist/components/factory/component-audio.d.ts.map +1 -0
- package/dist/components/factory/component-audio.js +18 -0
- package/dist/components/factory/component-audio.js.map +1 -0
- package/dist/components/factory/component2d.d.ts +8 -0
- package/dist/components/factory/component2d.d.ts.map +1 -0
- package/dist/components/factory/component2d.js +240 -0
- package/dist/components/factory/component2d.js.map +1 -0
- package/dist/components/factory/component3d.d.ts +9 -0
- package/dist/components/factory/component3d.d.ts.map +1 -0
- package/dist/components/factory/component3d.js +107 -0
- package/dist/components/factory/component3d.js.map +1 -0
- package/dist/components/factory/factory.d.ts +66 -0
- package/dist/components/factory/factory.d.ts.map +1 -0
- package/dist/components/factory/factory.js +347 -0
- package/dist/components/factory/factory.js.map +1 -0
- package/dist/components/factory/timeline.d.ts +22 -0
- package/dist/components/factory/timeline.d.ts.map +1 -0
- package/dist/components/factory/timeline.js +128 -0
- package/dist/components/factory/timeline.js.map +1 -0
- package/dist/components/factory/type-def.d.ts +26 -0
- package/dist/components/factory/type-def.d.ts.map +1 -0
- package/dist/components/factory/type-def.js +16 -0
- package/dist/components/factory/type-def.js.map +1 -0
- package/dist/components/factory/types.d.ts +91 -0
- package/dist/components/factory/types.d.ts.map +1 -0
- package/dist/components/factory/types.js +88 -0
- package/dist/components/factory/types.js.map +1 -0
- package/dist/components/factory/views.d.ts +121 -0
- package/dist/components/factory/views.d.ts.map +1 -0
- package/dist/components/factory/views.js +413 -0
- package/dist/components/factory/views.js.map +1 -0
- package/dist/components/modules/aim.d.ts +30 -0
- package/dist/components/modules/aim.d.ts.map +1 -0
- package/dist/components/modules/aim.js +39 -0
- package/dist/components/modules/aim.js.map +1 -0
- package/dist/components/modules/corners.d.ts +13 -0
- package/dist/components/modules/corners.d.ts.map +1 -0
- package/dist/components/modules/corners.js +12 -0
- package/dist/components/modules/corners.js.map +1 -0
- package/dist/components/modules/flow.d.ts +26 -0
- package/dist/components/modules/flow.d.ts.map +1 -0
- package/dist/components/modules/flow.js +57 -0
- package/dist/components/modules/flow.js.map +1 -0
- package/dist/components/modules/material.d.ts +40 -0
- package/dist/components/modules/material.d.ts.map +1 -0
- package/dist/components/modules/material.js +75 -0
- package/dist/components/modules/material.js.map +1 -0
- package/dist/components/modules/paint.d.ts +71 -0
- package/dist/components/modules/paint.d.ts.map +1 -0
- package/dist/components/modules/paint.js +106 -0
- package/dist/components/modules/paint.js.map +1 -0
- package/dist/components/modules/shapes.d.ts +31 -0
- package/dist/components/modules/shapes.d.ts.map +1 -0
- package/dist/components/modules/shapes.js +43 -0
- package/dist/components/modules/shapes.js.map +1 -0
- package/dist/components/modules/text-layout.d.ts +26 -0
- package/dist/components/modules/text-layout.d.ts.map +1 -0
- package/dist/components/modules/text-layout.js +57 -0
- package/dist/components/modules/text-layout.js.map +1 -0
- package/dist/components/modules/text-style.d.ts +48 -0
- package/dist/components/modules/text-style.d.ts.map +1 -0
- package/dist/components/modules/text-style.js +63 -0
- package/dist/components/modules/text-style.js.map +1 -0
- package/dist/components/modules/three-entries.d.ts +23 -0
- package/dist/components/modules/three-entries.d.ts.map +1 -0
- package/dist/components/modules/three-entries.js +41 -0
- package/dist/components/modules/three-entries.js.map +1 -0
- package/dist/components/modules/view3d.d.ts +59 -0
- package/dist/components/modules/view3d.d.ts.map +1 -0
- package/dist/components/modules/view3d.js +171 -0
- package/dist/components/modules/view3d.js.map +1 -0
- package/dist/components/trees/2d/group-bounds.d.ts +56 -0
- package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
- package/dist/components/trees/2d/group-bounds.js +87 -0
- package/dist/components/trees/2d/group-bounds.js.map +1 -0
- package/dist/components/trees/2d/node-lifecycle.d.ts +46 -0
- package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
- package/dist/components/trees/2d/node-lifecycle.js +264 -0
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
- package/dist/components/trees/2d/node-motion.d.ts +56 -0
- package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
- package/dist/components/trees/2d/node-motion.js +86 -0
- package/dist/components/trees/2d/node-motion.js.map +1 -0
- package/dist/components/trees/2d/node-render.d.ts +36 -0
- package/dist/components/trees/2d/node-render.d.ts.map +1 -0
- package/dist/components/trees/2d/node-render.js +67 -0
- package/dist/components/trees/2d/node-render.js.map +1 -0
- package/dist/components/trees/2d/node-space.d.ts +63 -0
- package/dist/components/trees/2d/node-space.d.ts.map +1 -0
- package/dist/components/trees/2d/node-space.js +131 -0
- package/dist/components/trees/2d/node-space.js.map +1 -0
- package/dist/components/trees/2d/node-transform.d.ts +55 -0
- package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
- package/dist/components/trees/2d/node-transform.js +73 -0
- package/dist/components/trees/2d/node-transform.js.map +1 -0
- package/dist/components/trees/2d/node2d.d.ts +1020 -0
- package/dist/components/trees/2d/node2d.d.ts.map +1 -0
- package/dist/components/trees/2d/node2d.js +1481 -0
- package/dist/components/trees/2d/node2d.js.map +1 -0
- package/dist/components/trees/audio/index.d.ts +2 -0
- package/dist/components/trees/audio/index.d.ts.map +1 -0
- package/dist/components/trees/audio/index.js +2 -0
- package/dist/components/trees/audio/index.js.map +1 -0
- package/dist/components/trees/audio/node-audio.d.ts +116 -0
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
- package/dist/components/trees/audio/node-audio.js +171 -0
- package/dist/components/trees/audio/node-audio.js.map +1 -0
- package/dist/components/trees/index.d.ts +10 -0
- package/dist/components/trees/index.d.ts.map +1 -0
- package/dist/components/trees/index.js +14 -0
- package/dist/components/trees/index.js.map +1 -0
- package/dist/components/trees/node/node-editor-state.d.ts +53 -0
- package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
- package/dist/components/trees/node/node-editor-state.js +23 -0
- package/dist/components/trees/node/node-editor-state.js.map +1 -0
- package/dist/components/trees/node/node-reactive.d.ts +89 -0
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
- package/dist/components/trees/node/node-reactive.js +135 -0
- package/dist/components/trees/node/node-reactive.js.map +1 -0
- package/dist/components/trees/node/node-time.d.ts +39 -0
- package/dist/components/trees/node/node-time.d.ts.map +1 -0
- package/dist/components/trees/node/node-time.js +14 -0
- package/dist/components/trees/node/node-time.js.map +1 -0
- package/dist/components/trees/node/node-walk.d.ts +46 -0
- package/dist/components/trees/node/node-walk.d.ts.map +1 -0
- package/dist/components/trees/node/node-walk.js +74 -0
- package/dist/components/trees/node/node-walk.js.map +1 -0
- package/dist/components/trees/node/node.d.ts +401 -0
- package/dist/components/trees/node/node.d.ts.map +1 -0
- package/dist/components/trees/node/node.js +680 -0
- package/dist/components/trees/node/node.js.map +1 -0
- package/dist/components/trees/root/canvas2d-node.d.ts +163 -0
- package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
- package/dist/components/trees/root/canvas2d-node.js +216 -0
- package/dist/components/trees/root/canvas2d-node.js.map +1 -0
- package/dist/components/trees/three/node3d.d.ts +222 -0
- package/dist/components/trees/three/node3d.d.ts.map +1 -0
- package/dist/components/trees/three/node3d.js +289 -0
- package/dist/components/trees/three/node3d.js.map +1 -0
- package/dist/document/builtins.js +13 -13
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +14 -4
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +35 -7
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.d.ts +2 -2
- package/dist/document/deny-globals.js +2 -2
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/expression/index.d.ts +1 -1
- package/dist/document/expression/index.js +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/index.d.ts +9 -2
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +5 -2
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.d.ts +70 -0
- package/dist/document/migrate.d.ts.map +1 -0
- package/dist/document/migrate.js +202 -0
- package/dist/document/migrate.js.map +1 -0
- package/dist/document/missing-node.d.ts +27 -0
- package/dist/document/missing-node.d.ts.map +1 -0
- package/dist/document/missing-node.js +48 -0
- package/dist/document/missing-node.js.map +1 -0
- package/dist/document/node-decorator.d.ts +14 -10
- package/dist/document/node-decorator.d.ts.map +1 -1
- package/dist/document/node-decorator.js +14 -10
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +7 -3
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +2 -1
- package/dist/document/placement.d.ts.map +1 -1
- package/dist/document/placement.js.map +1 -1
- package/dist/document/project.d.ts +2 -0
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js +1 -0
- package/dist/document/project.js.map +1 -1
- package/dist/document/prop-evolution.d.ts +51 -0
- package/dist/document/prop-evolution.d.ts.map +1 -0
- package/dist/document/prop-evolution.js +83 -0
- package/dist/document/prop-evolution.js.map +1 -0
- package/dist/document/registry.d.ts +39 -25
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +41 -21
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +2 -0
- package/dist/document/settled-index.d.ts.map +1 -1
- package/dist/document/settled-index.js +5 -5
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline-patch.d.ts +4 -0
- package/dist/document/timeline-patch.d.ts.map +1 -1
- package/dist/document/timeline-patch.js +28 -3
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +48 -4
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +174 -44
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +18 -32
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +18 -6
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +158 -21
- package/dist/document/validate.js.map +1 -1
- package/dist/document/vocabulary.d.ts +28 -0
- package/dist/document/vocabulary.d.ts.map +1 -0
- package/dist/document/vocabulary.js +42 -0
- package/dist/document/vocabulary.js.map +1 -0
- package/dist/experimental.d.ts +79 -19
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +31 -17
- package/dist/experimental.js.map +1 -1
- package/dist/index.d.ts +10 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -11
- package/dist/index.js.map +1 -1
- package/dist/layout/types.d.ts +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -0
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/props/host.d.ts +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/slot.d.ts +1 -1
- package/dist/props/slot.js +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +1 -1
- package/dist/renamed-scene-names.d.ts.map +1 -1
- package/dist/renamed-scene-names.js +1 -1
- package/dist/renamed-scene-names.js.map +1 -1
- package/dist/render/canvas-render-context2d.d.ts +9 -0
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +10 -0
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.d.ts +1 -1
- package/dist/render/clip.js +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +13 -7
- package/dist/render/descriptors/text.d.ts.map +1 -1
- package/dist/render/descriptors/text.js +9 -3
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/index.d.ts +2 -0
- package/dist/render/index.d.ts.map +1 -1
- package/dist/render/index.js +1 -0
- package/dist/render/index.js.map +1 -1
- package/dist/render/render-context2d.d.ts +3 -3
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/render-issue.d.ts +39 -0
- package/dist/render/render-issue.d.ts.map +1 -0
- package/dist/render/render-issue.js +29 -0
- package/dist/render/render-issue.js.map +1 -0
- package/dist/render/surface.d.ts +2 -2
- package/dist/render/surface.js.map +1 -1
- package/dist/render3d/builders.d.ts +1 -1
- package/dist/render3d/builders.js +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +13 -19
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +67 -24
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +1 -1
- package/dist/render3d/scene3d.js +1 -1
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/texture.d.ts +2 -2
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/vector3.d.ts +2 -2
- package/dist/render3d/vector3.js +2 -2
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/runtime/asset-refine.d.ts +1 -1
- package/dist/runtime/asset-refine.d.ts.map +1 -1
- package/dist/runtime/asset-refine.js +3 -2
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.d.ts +10 -0
- package/dist/runtime/asset-timeline.d.ts.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.d.ts.map +1 -1
- package/dist/runtime/asset-update.js +8 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.d.ts +0 -11
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +0 -25
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +6 -4
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +8 -4
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +2 -3
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +34 -37
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +8 -6
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +4 -3
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +2 -2
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +3 -3
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +2 -2
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +1 -1
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +2 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +15 -5
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/session.d.ts +7 -3
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +11 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +2 -2
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +2 -2
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +4 -5
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +50 -44
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +35 -29
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +14 -9
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +3 -2
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +2 -0
- package/dist/tween/ease/describe.d.ts.map +1 -1
- package/dist/tween/ease/describe.js +4 -0
- package/dist/tween/ease/describe.js.map +1 -1
- package/dist/tween/ease/spec.d.ts +31 -0
- package/dist/tween/ease/spec.d.ts.map +1 -0
- package/dist/tween/ease/spec.js +51 -0
- package/dist/tween/ease/spec.js.map +1 -0
- package/dist/tween/index.d.ts +3 -1
- package/dist/tween/index.d.ts.map +1 -1
- package/dist/tween/index.js +2 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/loop.d.ts +1 -1
- package/dist/tween/loop.js +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/util/reference.d.ts +6 -6
- package/dist/util/reference.js.map +1 -1
- package/package.json +3 -11
- package/dist/browser/chunks/chunk-2RIYH36X.js +0 -3
- package/dist/browser/chunks/chunk-2RIYH36X.js.map +0 -7
- package/dist/browser/chunks/chunk-DDJN3QII.js +0 -15
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +0 -7
- package/dist/browser/chunks/chunk-DHB4COFY.js +0 -2
- package/dist/browser/chunks/chunk-EJDPYDQI.js +0 -5
- package/dist/browser/chunks/chunk-EJDPYDQI.js.map +0 -7
- package/dist/browser/chunks/chunk-SFNJRPBV.js +0 -2
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +0 -7
- package/dist/browser/chunks/chunk-XAWE4EAK.js +0 -2
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +0 -7
- package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
- package/dist/browser/jsx-jsx-dev-runtime.js.map +0 -7
- package/dist/browser/jsx-jsx-runtime.js +0 -2
- package/dist/browser/jsx-jsx-runtime.js.map +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene3d.js","sourceRoot":"","sources":["../../src/render3d/scene3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,eAAe,EAA0B,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EACH,gBAAgB,GAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAqBtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,OAAQ,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AG,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,aAAa,CAAC;YAClE,MAAM,IAAI,KAAK,CACX,eAAe,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,CAClD,CAAC;QACN,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { DRAWABLE_KINDS, Graphics3D, type Graphics3DOp } from \"./graphics3d\";\r\nimport { RenderContext3D, type Node3DRenderState } from \"./render-context3d\";\r\nimport type { CameraData3D, OrthographicCameraData3D, PerspectiveCameraData3D } from \"./camera\";\r\nimport type { LightData3D } from \"./light\";\r\nimport {\r\n resolveShadows3D,\r\n type EnvironmentData3D, type FogData3D, type PostEffect3D,\r\n type ShadowSettings3D, type Shadows3D, type ToneSettings3D,\r\n} from \"./scene-settings\";\r\nimport { warnInert3D } from \"./inert\";\r\nimport type { Shadow3D, Transform3D } from \"./transform\";\r\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\r\n\r\n/** Options accepted by every `Camera3D` node and by {@link Scene3D.perspective}. */\r\ntype ParamsOf<T extends { type: string }> = Omit<T, \"type\">;\r\n\r\n/**\r\n * One recorded operation in a {@link Scene3D}.\r\n *\r\n * A superset of {@link Graphics3DOp}: everything a node draws, plus the four\r\n * things that describe the scene around it — the `push`/`pop` nesting the node\r\n * tree produces, the lights in it, and where it is viewed from.\r\n */\r\nexport type Scene3DOp =\r\n | { kind: \"push\"; transform?: Transform3D }\r\n | { kind: \"pop\" }\r\n | { kind: \"light\"; light: LightData3D; transform?: Transform3D }\r\n | { kind: \"camera\"; camera: CameraData3D }\r\n | Graphics3DOp;\r\n\r\n/**\r\n * A recorded 3D scene — and the {@link RenderContext3D} that records it.\r\n *\r\n * One value plays both parts, exactly as `Graphics2D` is both the builder and the\r\n * thing handed to a backend. A `Node3D` tree draws into it, and the result is a\r\n * flat op list plus a handful of scene-wide settings that a renderer replays.\r\n *\r\n * Almost always produced for you: a `Canvas3D` opens one per frame, walks its\r\n * `Node3D` children through it and paints the result through its own path. The\r\n * builder surface below is the escape hatch — it is what lets a scene be shaded\r\n * through *any* 2D shape rather than only a rect:\r\n *\r\n * const scene = new Scene3D()\r\n * .perspective({ orbit: 30, elevation: 20, distance: 6 })\r\n * .light({ type: \"ambient\", intensity: 0.4 })\r\n * .draw(new Graphics3D().box({ width: 2, fill: \"tomato\" }));\r\n *\r\n * <Text text=\"DEPTH\" fontSize={320} fill={scene} />\r\n *\r\n * A bare `Scene3D` coerces to a `canvas3D` fill the way a bare CSS string coerces\r\n * to a solid one, so `fill={scene}` and `fill={[\"#0b0d12\", scene]}` both work.\r\n */\r\nexport class Scene3D extends RenderContext3D {\r\n private _ops: Scene3DOp[] = [];\r\n private _camera: CameraData3D | null = null;\r\n private _fog: FogData3D | null = null;\r\n private _environment: EnvironmentData3D | null = null;\r\n private _shadows: ShadowSettings3D | null = null;\r\n private _tone: ToneSettings3D | null = null;\r\n private _post: PostEffect3D[] = [];\r\n /** Open `push` count, so {@link assertBalanced} can report a leak. */\r\n private _depth = 0;\r\n /**\r\n * The `shadow` of each open node scope, innermost last (`undefined` for a\r\n * scope that states none). What a drawable that states none of its own takes.\r\n */\r\n private _shadowScopes: (Shadow3D | undefined)[] = [];\r\n\r\n // ─── Node scopes ─────────────────────────────────────────────────────────\r\n\r\n override begin(state: Node3DRenderState): void {\r\n // The node's id rides on the transform's `key`, which is the renderer's\r\n // identity slot — so a group is cached against the node that opened it\r\n // rather than against its index among its siblings.\r\n this._ops.push({ kind: \"push\", transform: { ...state.transform, key: state.id } });\r\n this._shadowScopes.push(state.transform?.shadow);\r\n this._depth++;\r\n }\r\n\r\n override end(): void {\r\n this._ops.push({ kind: \"pop\" });\r\n this._shadowScopes.pop();\r\n this._depth--;\r\n }\r\n\r\n // ─── Drawables ───────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Splice what a node draws into the scene at the current scope.\r\n *\r\n * The ops are copied rather than referenced: a `Graphics3D` is rebuilt every\r\n * frame, so there is nothing to share, and a flat list is what the renderer\r\n * walks.\r\n *\r\n * A drawable that states no `shadow` of its own takes the one of the node\r\n * scope it is drawn in. That is what carries a node's `shadow` to its mesh: the\r\n * node's scope becomes a group, and a renderer reads casting and receiving off\r\n * the mesh, never off a group, so the scope's value would otherwise never be\r\n * seen. A `shadow` on the op itself wins.\r\n */\r\n override draw(graphics: Graphics3D): this {\r\n const ops = graphics.ops();\r\n const scope = this._shadowScopes[this._shadowScopes.length - 1];\r\n for (let i = 0; i < ops.length; i++) {\r\n const op = ops[i];\r\n if (scope === undefined || op.transform?.shadow !== undefined) {\r\n this._ops.push(op);\r\n } else {\r\n this._ops.push({ ...op, transform: { ...op.transform, shadow: scope } });\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n // ─── Lights ──────────────────────────────────────────────────────────────\r\n\r\n override light(light: LightData3D, transform?: Transform3D): this {\r\n this._ops.push({ kind: \"light\", light, transform });\r\n return this;\r\n }\r\n\r\n // ─── Camera ──────────────────────────────────────────────────────────────\r\n\r\n override camera(camera: CameraData3D): this {\r\n this._camera = camera;\r\n this._ops.push({ kind: \"camera\", camera });\r\n return this;\r\n }\r\n\r\n /** Set a perspective camera. The usual choice. */\r\n perspective(options?: ParamsOf<PerspectiveCameraData3D>): this {\r\n return this.camera({ type: \"perspective\", ...options } as PerspectiveCameraData3D);\r\n }\r\n\r\n /** Set an orthographic camera — parallel projection, for isometric looks. */\r\n orthographic(options?: ParamsOf<OrthographicCameraData3D>): this {\r\n return this.camera({ type: \"orthographic\", ...options } as OrthographicCameraData3D);\r\n }\r\n\r\n // ─── Scene settings ──────────────────────────────────────────────────────\r\n //\r\n // Fields rather than ops: a scene has exactly one fog and one environment.\r\n // Recording them positionally would imply an ordering that doesn't exist.\r\n // Last writer wins.\r\n\r\n override fog(fog: FogData3D | Color | null): this {\r\n if (fog === null) {\r\n this._fog = null;\r\n } else if (typeof fog === \"object\" && !Array.isArray(fog)) {\r\n this._fog = fog as FogData3D;\r\n } else {\r\n this._fog = { color: fog as Color };\r\n }\r\n return this;\r\n }\r\n\r\n override environment(environment: EnvironmentData3D | null): this {\r\n if (environment) {\r\n if (environment.src !== undefined || (environment.faces?.length ?? 0) > 0) {\r\n warnInert3D(\r\n \"environment-src\",\r\n \"An environment's `src` and `faces` (HDR, EXR, cubemap) are recorded, and no backend loads them. Only `preset: \\\"studio\\\"` is rendered: \"\r\n + \"without a preset the scene gets no image-based light and its `background` is not drawn.\",\r\n );\r\n }\r\n if (environment.params && Object.keys(environment.params).length > 0) {\r\n warnInert3D(\r\n \"environment-params\",\r\n \"`params` on an environment is not applied: nothing assigns it onto the generated environment.\",\r\n );\r\n }\r\n }\r\n this._environment = environment;\r\n return this;\r\n }\r\n\r\n override shadows(settings?: Shadows3D): this {\r\n this._shadows = resolveShadows3D(settings ?? true);\r\n return this;\r\n }\r\n\r\n override tone(settings: ToneSettings3D): this {\r\n this._tone = settings;\r\n return this;\r\n }\r\n\r\n override post(effects: PostEffect3D | readonly PostEffect3D[]): this {\r\n const added = Array.isArray(effects) ? (effects as PostEffect3D[]) : [effects as PostEffect3D];\r\n if (added.length > 0) {\r\n warnInert3D(\r\n \"post\",\r\n `Post-processing (${added.map((effect) => `\"${effect.type}\"`).join(\", \")}) is recorded, and no backend applies a pass: the scene renders exactly as it would without \\`post\\`. `\r\n + \"Use the Canvas3D's 2D `effects` over the composited result instead.\",\r\n );\r\n }\r\n this._post.push(...added);\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Replayed by the renderer. */\r\n ops(): readonly Scene3DOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** The camera, or `null` to let the renderer supply a default framing. */\r\n cameraDescriptor(): CameraData3D | null {\r\n return this._camera;\r\n }\r\n fogDescriptor(): FogData3D | null {\r\n return this._fog;\r\n }\r\n environmentDescriptor(): EnvironmentData3D | null {\r\n return this._environment;\r\n }\r\n shadowSettings(): ShadowSettings3D | null {\r\n return this._shadows;\r\n }\r\n toneSettings(): ToneSettings3D | null {\r\n return this._tone;\r\n }\r\n postEffects(): readonly PostEffect3D[] {\r\n return this._post;\r\n }\r\n\r\n /**\r\n * True when nothing would be drawn — no mesh, light or other drawable. The\r\n * node skips the whole 3D pass (and the WebGL context entirely) in that case.\r\n */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => DRAWABLE_KINDS.has(op.kind));\r\n }\r\n\r\n /**\r\n * Throw if `push` and `pop` are unbalanced. Called once by the consumer before\r\n * replay, so a mismatched scope fails loudly rather than silently reparenting\r\n * everything after it.\r\n *\r\n * A `Node3D` tree cannot get this wrong — `begin`/`end` are bracketed by the\r\n * walk — so in practice this catches a hand-built scene.\r\n */\r\n assertBalanced(): void {\r\n if (this._depth !== 0) {\r\n const verb = this._depth > 0 ? \"unclosed begin()\" : \"extra end()\";\r\n throw new Error(\r\n `Scene3D has ${Math.abs(this._depth)} ${verb}.`,\r\n );\r\n }\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"scene3d.js","sourceRoot":"","sources":["../../src/render3d/scene3d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAiC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,eAAe,EAA0B,MAAM,oBAAoB,CAAC;AAG7E,OAAO,EACH,gBAAgB,GAGnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAqBtC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,OAAO,OAAQ,SAAQ,eAAe;IAChC,IAAI,GAAgB,EAAE,CAAC;IACvB,OAAO,GAAwB,IAAI,CAAC;IACpC,IAAI,GAAqB,IAAI,CAAC;IAC9B,YAAY,GAA6B,IAAI,CAAC;IAC9C,QAAQ,GAA4B,IAAI,CAAC;IACzC,KAAK,GAA0B,IAAI,CAAC;IACpC,KAAK,GAAmB,EAAE,CAAC;IACnC,sEAAsE;IAC9D,MAAM,GAAG,CAAC,C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RenderContext3D, type Node3DRenderState } from \"./render-context3d\";\r\nimport type { CameraData3D, OrthographicCameraData3D, PerspectiveCameraData3D } from \"./camera\";\r\nimport type { LightData3D } from \"./light\";\r\nimport {\r\n resolveShadows3D,\r\n type EnvironmentData3D, type FogData3D, type PostEffect3D,\r\n type ShadowSettings3D, type Shadows3D, type ToneSettings3D,\r\n} from \"./scene-settings\";\r\nimport { warnInert3D } from \"./inert\";\r\nimport type { Shadow3D, Transform3D } from \"./transform\";\r\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\r\n\r\n/** Options accepted by every `Camera3D` node and by {@link Scene3D.perspective}. */\r\ntype ParamsOf<T extends { type: string }> = Omit<T, \"type\">;\r\n\r\n/**\r\n * One recorded operation in a {@link Scene3D}.\r\n *\r\n * A superset of {@link Graphics3DOp}: everything a node draws, plus the four\r\n * things that describe the scene around it — the `push`/`pop` nesting the node\r\n * tree produces, the lights in it, and where it is viewed from.\r\n */\r\nexport type Scene3DOp =\r\n | { kind: \"push\"; transform?: Transform3D }\r\n | { kind: \"pop\" }\r\n | { kind: \"light\"; light: LightData3D; transform?: Transform3D }\r\n | { kind: \"camera\"; camera: CameraData3D }\r\n | Graphics3DOp;\r\n\r\n/**\r\n * A recorded 3D scene — and the {@link RenderContext3D} that records it.\r\n *\r\n * One value plays both parts, exactly as `Graphics2D` is both the builder and the\r\n * thing handed to a backend. A `Node3D` tree draws into it, and the result is a\r\n * flat op list plus a handful of scene-wide settings that a renderer replays.\r\n *\r\n * Almost always produced for you: a `Canvas3D` opens one per frame, walks its\r\n * `Node3D` children through it and paints the result through its own path. The\r\n * builder surface below is the escape hatch — it is what lets a scene be shaded\r\n * through *any* 2D shape rather than only a rect:\r\n *\r\n * const scene = new Scene3D()\r\n * .perspective({ orbit: 30, elevation: 20, distance: 6 })\r\n * .light({ type: \"ambient\", intensity: 0.4 })\r\n * .draw(new Graphics3D().box({ width: 2, fill: \"tomato\" }));\r\n *\r\n * Text({ text: \"DEPTH\", fontSize: 320, fill: scene })\r\n *\r\n * A bare `Scene3D` coerces to a `canvas3D` fill the way a bare CSS string coerces\r\n * to a solid one, so `fill={scene}` and `fill={[\"#0b0d12\", scene]}` both work.\r\n */\r\nexport class Scene3D extends RenderContext3D {\r\n private _ops: Scene3DOp[] = [];\r\n private _camera: CameraData3D | null = null;\r\n private _fog: FogData3D | null = null;\r\n private _environment: EnvironmentData3D | null = null;\r\n private _shadows: ShadowSettings3D | null = null;\r\n private _tone: ToneSettings3D | null = null;\r\n private _post: PostEffect3D[] = [];\r\n /** Open `push` count, so {@link assertBalanced} can report a leak. */\r\n private _depth = 0;\r\n /**\r\n * The `shadow` of each open node scope, innermost last (`undefined` for a\r\n * scope that states none). What a drawable that states none of its own takes.\r\n */\r\n private _shadowScopes: (Shadow3D | undefined)[] = [];\r\n\r\n // ─── Node scopes ─────────────────────────────────────────────────────────\r\n\r\n override begin(state: Node3DRenderState): void {\r\n // The node's id rides on the transform's `key`, which is the renderer's\r\n // identity slot — so a group is cached against the node that opened it\r\n // rather than against its index among its siblings.\r\n this._ops.push({ kind: \"push\", transform: { ...state.transform, key: state.id } });\r\n this._shadowScopes.push(state.transform?.shadow);\r\n this._depth++;\r\n }\r\n\r\n override end(): void {\r\n this._ops.push({ kind: \"pop\" });\r\n this._shadowScopes.pop();\r\n this._depth--;\r\n }\r\n\r\n // ─── Drawables ───────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Splice what a node draws into the scene at the current scope.\r\n *\r\n * The ops are copied rather than referenced: a `Graphics3D` is rebuilt every\r\n * frame, so there is nothing to share, and a flat list is what the renderer\r\n * walks.\r\n *\r\n * A drawable that states no `shadow` of its own takes the one of the node\r\n * scope it is drawn in. That is what carries a node's `shadow` to its mesh: the\r\n * node's scope becomes a group, and a renderer reads casting and receiving off\r\n * the mesh, never off a group, so the scope's value would otherwise never be\r\n * seen. A `shadow` on the op itself wins.\r\n */\r\n override draw(graphics: Graphics3D): this {\r\n const ops = graphics.ops();\r\n const scope = this._shadowScopes[this._shadowScopes.length - 1];\r\n for (let i = 0; i < ops.length; i++) {\r\n const op = ops[i];\r\n if (scope === undefined || op.transform?.shadow !== undefined) {\r\n this._ops.push(op);\r\n } else {\r\n this._ops.push({ ...op, transform: { ...op.transform, shadow: scope } });\r\n }\r\n }\r\n return this;\r\n }\r\n\r\n // ─── Lights ──────────────────────────────────────────────────────────────\r\n\r\n override light(light: LightData3D, transform?: Transform3D): this {\r\n this._ops.push({ kind: \"light\", light, transform });\r\n return this;\r\n }\r\n\r\n // ─── Camera ──────────────────────────────────────────────────────────────\r\n\r\n override camera(camera: CameraData3D): this {\r\n this._camera = camera;\r\n this._ops.push({ kind: \"camera\", camera });\r\n return this;\r\n }\r\n\r\n /** Set a perspective camera. The usual choice. */\r\n perspective(options?: ParamsOf<PerspectiveCameraData3D>): this {\r\n return this.camera({ type: \"perspective\", ...options } as PerspectiveCameraData3D);\r\n }\r\n\r\n /** Set an orthographic camera — parallel projection, for isometric looks. */\r\n orthographic(options?: ParamsOf<OrthographicCameraData3D>): this {\r\n return this.camera({ type: \"orthographic\", ...options } as OrthographicCameraData3D);\r\n }\r\n\r\n // ─── Scene settings ──────────────────────────────────────────────────────\r\n //\r\n // Fields rather than ops: a scene has exactly one fog and one environment.\r\n // Recording them positionally would imply an ordering that doesn't exist.\r\n // Last writer wins.\r\n\r\n override fog(fog: FogData3D | Color | null): this {\r\n if (fog === null) {\r\n this._fog = null;\r\n } else if (typeof fog === \"object\" && !Array.isArray(fog)) {\r\n this._fog = fog as FogData3D;\r\n } else {\r\n this._fog = { color: fog as Color };\r\n }\r\n return this;\r\n }\r\n\r\n override environment(environment: EnvironmentData3D | null): this {\r\n if (environment) {\r\n if (environment.src !== undefined || (environment.faces?.length ?? 0) > 0) {\r\n warnInert3D(\r\n \"environment-src\",\r\n \"An environment's `src` and `faces` (HDR, EXR, cubemap) are recorded, and no backend loads them. Only `preset: \\\"studio\\\"` is rendered: \"\r\n + \"without a preset the scene gets no image-based light and its `background` is not drawn.\",\r\n );\r\n }\r\n if (environment.params && Object.keys(environment.params).length > 0) {\r\n warnInert3D(\r\n \"environment-params\",\r\n \"`params` on an environment is not applied: nothing assigns it onto the generated environment.\",\r\n );\r\n }\r\n }\r\n this._environment = environment;\r\n return this;\r\n }\r\n\r\n override shadows(settings?: Shadows3D): this {\r\n this._shadows = resolveShadows3D(settings ?? true);\r\n return this;\r\n }\r\n\r\n override tone(settings: ToneSettings3D): this {\r\n this._tone = settings;\r\n return this;\r\n }\r\n\r\n override post(effects: PostEffect3D | readonly PostEffect3D[]): this {\r\n const added = Array.isArray(effects) ? (effects as PostEffect3D[]) : [effects as PostEffect3D];\r\n if (added.length > 0) {\r\n warnInert3D(\r\n \"post\",\r\n `Post-processing (${added.map((effect) => `\"${effect.type}\"`).join(\", \")}) is recorded, and no backend applies a pass: the scene renders exactly as it would without \\`post\\`. `\r\n + \"Use the Canvas3D's 2D `effects` over the composited result instead.\",\r\n );\r\n }\r\n this._post.push(...added);\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Replayed by the renderer. */\r\n ops(): readonly Scene3DOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** The camera, or `null` to let the renderer supply a default framing. */\r\n cameraDescriptor(): CameraData3D | null {\r\n return this._camera;\r\n }\r\n fogDescriptor(): FogData3D | null {\r\n return this._fog;\r\n }\r\n environmentDescriptor(): EnvironmentData3D | null {\r\n return this._environment;\r\n }\r\n shadowSettings(): ShadowSettings3D | null {\r\n return this._shadows;\r\n }\r\n toneSettings(): ToneSettings3D | null {\r\n return this._tone;\r\n }\r\n postEffects(): readonly PostEffect3D[] {\r\n return this._post;\r\n }\r\n\r\n /**\r\n * True when nothing would be drawn — no mesh, light or other drawable. The\r\n * node skips the whole 3D pass (and the WebGL context entirely) in that case.\r\n */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => DRAWABLE_KINDS.has(op.kind));\r\n }\r\n\r\n /**\r\n * Throw if `push` and `pop` are unbalanced. Called once by the consumer before\r\n * replay, so a mismatched scope fails loudly rather than silently reparenting\r\n * everything after it.\r\n *\r\n * A `Node3D` tree cannot get this wrong — `begin`/`end` are bracketed by the\r\n * walk — so in practice this catches a hand-built scene.\r\n */\r\n assertBalanced(): void {\r\n if (this._depth !== 0) {\r\n const verb = this._depth > 0 ? \"unclosed begin()\" : \"extra end()\";\r\n throw new Error(\r\n `Scene3D has ${Math.abs(this._depth)} ${verb}.`,\r\n );\r\n }\r\n }\r\n}\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Vector2 } from "../attributes/layout/vector2.js";
|
|
2
2
|
import type { Graphics2D } from "../render/graphics2d.js";
|
|
3
|
-
import type { Node } from "../
|
|
4
|
-
import type { Node2D } from "../
|
|
3
|
+
import type { Node } from "../components/trees/node/node.js";
|
|
4
|
+
import type { Node2D } from "../components/trees/2d/node2d.js";
|
|
5
5
|
/** How sampling behaves outside the 0–1 UV range. */
|
|
6
6
|
export type TextureWrap3D = "clamp" | "repeat" | "mirror";
|
|
7
7
|
/** How texels are blended when the texture is scaled. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../src/render3d/texture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"texture.d.ts","sourceRoot":"","sources":["../../src/render3d/texture.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAG3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,KAAK,EAAE,MAAM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AAK,CAAC,UAAU,CAAC,GAAG,CAAC;WACrB,0DAA0D,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import type { Vector2 } from \"@/attributes/layout/vector2\";\r\n// Type-only, like `Color` above: `render3d` is pure data and never reaches into\r\n// the render or node layers at runtime. See SurfaceSource3D.\r\nimport type { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport type { Node2D } from \"@/nodes/2d/node2d\";\r\n\r\n/** How sampling behaves outside the 0–1 UV range. */\r\nexport type TextureWrap3D = \"clamp\" | \"repeat\" | \"mirror\";\r\n\r\n/** How texels are blended when the texture is scaled. */\r\nexport type TextureFilter3D = \"nearest\" | \"linear\";\r\n\r\n/**\r\n * Which colour space the texture's data is in.\r\n *\r\n * `\"srgb\"` for anything representing a *colour* an eye would see (albedo/`map`,\r\n * `emissiveMap`), so the renderer linearizes it before lighting maths.\r\n * `\"linear\"` for *data* maps whose channels are numbers rather than colours\r\n * (`normalMap`, `roughnessMap`, `metalnessMap`, `aoMap`, `displacementMap`) —\r\n * linearizing those would corrupt them. Each map slot defaults correctly, so\r\n * this only needs setting for unusual pipelines.\r\n */\r\nexport type TextureColorSpace3D = \"srgb\" | \"linear\";\r\n\r\n/** Sampler state shared by every texture source. */\r\nexport interface TextureOptions3D {\r\n wrapS?: TextureWrap3D;\r\n wrapT?: TextureWrap3D;\r\n /** UV scale. `[2, 2]` tiles twice on each axis (needs a `repeat` wrap). */\r\n repeat?: Vector2 | readonly [number, number];\r\n offset?: Vector2 | readonly [number, number];\r\n /** UV rotation in **degrees**, about {@link center}. */\r\n rotation?: number;\r\n center?: Vector2 | readonly [number, number];\r\n magFilter?: TextureFilter3D;\r\n minFilter?: TextureFilter3D;\r\n /** Sharpness at grazing angles. Clamped to the GPU's maximum. */\r\n anisotropy?: number;\r\n flipY?: boolean;\r\n colorSpace?: TextureColorSpace3D;\r\n}\r\n\r\n/**\r\n * A texture loaded from the project's asset manifest.\r\n *\r\n * `src` is discovered by the asset-tracking render pass and requested through\r\n * core's ordinary image pipeline — the very same path a 2D image fill uses — so\r\n * the pixels are decoded and resident *before* the frame that needs them draws.\r\n */\r\nexport interface ImageTexture3D extends TextureOptions3D {\r\n src: string;\r\n}\r\n\r\n/**\r\n * A texture built from raw RGBA8888 bytes — the escape hatch for procedurally\r\n * generated pixels (gradient ramps, noise, LUTs, data encoded as colour).\r\n */\r\nexport interface DataTexture3D extends TextureOptions3D {\r\n data: ArrayLike<number>;\r\n width: number;\r\n height: number;\r\n /**\r\n * Bump to force a re-upload after mutating `data` in place. Mutation is\r\n * invisible to identity comparison, so without this the renderer cannot\r\n * tell the bytes changed. See {@link BufferGeometry3D.revision}.\r\n */\r\n revision?: number;\r\n}\r\n\r\n/**\r\n * A texture whose pixels are Motion Script's own 2D output, rasterized offscreen\r\n * — the way to put a chart, a readout or a whole laid-out UI onto 3D geometry.\r\n *\r\n * `source` is a value, not a name and not a mounted node: either a built\r\n * {@link Graphics2D} command list, or a `Node2D` subtree. Both are supplied directly,\r\n * so there is no matching indirection and nothing has to live in a particular\r\n * place in the scene tree.\r\n *\r\n * g3.plane({ map: Tex.surface(scopeGraphics, 1024, 640) })\r\n * g3.plane({ map: Tex.surface(statsSubtree, 1024, 640) })\r\n *\r\n * A `Node2D` source is *adopted for binding* by whatever paints the scene — it gets\r\n * that node's asset catalog, inherited context and clock, which is what makes a\r\n * webfont shape and an `<Image>` load. It is never laid out or painted by the\r\n * scene tree; it is measured against `width`×`height` and drawn into the buffer.\r\n *\r\n * **Hoist the source.** Building it fresh inside the scene builder allocates a new\r\n * subtree every frame — re-binding, re-laying-out, defeating the texture cache and\r\n * leaking. Declare it once and pass the same instance.\r\n *\r\n * That hoisting rule is also what removed this descriptor's old `key`: a hoisted\r\n * source *is* a stable identity, so the renderer keys the GPU texture off the\r\n * source object itself (in a `WeakMap`) rather than off its ordinal in the scene\r\n * walk. A conditionally-emitted surface therefore needs nothing written by hand,\r\n * and a source that goes out of scope becomes collectable instead of orphaning\r\n * its texture — which the ordinal scheme could not do.\r\n */\r\nexport interface SurfaceTexture3D extends TextureOptions3D {\r\n /** A built `Graphics2D`, or a `Node2D` subtree. Typed structurally — see below. */\r\n source: SurfaceSource3D;\r\n /** Buffer width in pixels. This *is* the texture's resolution. */\r\n width: number;\r\n /** Buffer height in pixels. */\r\n height: number;\r\n /**\r\n * Declare the source's pixels unchanging, so the buffer is rasterized once\r\n * and reused rather than redrawn every frame.\r\n *\r\n * Set by `resolveFill3D` for a fill chain, whose layers describe the same\r\n * image on every frame; an author's own source is live by default, which is\r\n * what makes an animated `Graphics2D` or a prop-driven subtree work with no\r\n * bookkeeping. Needs {@link identity} to be cacheable.\r\n *\r\n * @internal\r\n */\r\n static?: boolean;\r\n /**\r\n * Cache identity for a synthesized source.\r\n *\r\n * An author's source is identified by the source object itself (see the note\r\n * above), which is exactly right for something hoisted. A source built *for*\r\n * a fill is a fresh object every frame and has no such identity, so the value\r\n * it was derived from supplies one.\r\n *\r\n * @internal\r\n */\r\n identity?: string;\r\n /**\r\n * Ceiling on the buffer's device-pixel ratio. Default 1, i.e. the buffer is\r\n * exactly `width` × `height`.\r\n *\r\n * Unlike a 2D node — which wants to match the display — a surface is sampled by\r\n * a 3D material at whatever size the geometry occupies on screen, so the honest\r\n * control is `width`/`height`. Raise this only when a surface is viewed close\r\n * up and reads soft.\r\n */\r\n maxPixelRatio?: number;\r\n}\r\n\r\n/**\r\n * What a {@link SurfaceTexture3D} can be painted from: a built {@link Graphics2D}\r\n * command list, or a {@link Node2D} subtree.\r\n *\r\n * Both imports are **type-only**, exactly as `Color` is — `render3d` describes\r\n * scenes as data and never reaches into the render or node layers at runtime, and\r\n * a value import of `Node2D` here would close a real module cycle. Consumers narrow\r\n * with {@link resolveSurfaceSource}.\r\n */\r\nexport type SurfaceSource3D = Graphics2D | Node;\r\n\r\n// Declared against the dimension-agnostic base because that is what JSX produces\r\n// (`JSX.Element` is `Node`), so `Tex.surface(<Rect/>, …)` type-checks without a\r\n// cast. It has to be a 2D subtree in fact — the renderer lays it out and draws it\r\n// into a 2D buffer — and `resolveSurfaceSource` narrows to that; handing it a\r\n// `Node3D` fails at render time rather than here.\r\n\r\n/** A {@link SurfaceSource3D} narrowed to the arm its renderer should take. */\r\nexport type ResolvedSurfaceSource =\r\n | { kind: \"graphics\"; graphics: Graphics2D }\r\n | { kind: \"node\"; node: Node2D };\r\n\r\n/**\r\n * Narrow a surface source to the arm that knows how to draw it: a `Graphics2D` is\r\n * replayed into a render context, a `Node2D` is laid out against the buffer and\r\n * rendered.\r\n *\r\n * Structural rather than `instanceof`, because that would need value imports of\r\n * both classes and close the cycle the type-only imports above avoid. `Graphics2D`\r\n * is a command recorder and exposes `ops()`; a `Node2D` has no such method. The\r\n * union makes any *other* value a type error, so this only has to separate two\r\n * known shapes rather than validate an unknown one.\r\n */\r\nexport function resolveSurfaceSource(source: SurfaceSource3D): ResolvedSurfaceSource {\r\n return typeof (source as Graphics2D).ops === \"function\"\r\n ? { kind: \"graphics\", graphics: source as Graphics2D }\r\n : { kind: \"node\", node: source as Node2D };\r\n}\r\n\r\n/**\r\n * A texture reference. A bare string is sugar for `{ src }`, so the common case\r\n * is `map: \"/wood.png\"`.\r\n */\r\nexport type Texture3D = string | ImageTexture3D | DataTexture3D | SurfaceTexture3D;\r\n\r\n/** True for the raw-bytes form (vs. an asset-backed {@link ImageTexture3D}). */\r\nexport function isDataTexture3D(texture: Texture3D): texture is DataTexture3D {\r\n return typeof texture !== \"string\" && \"data\" in texture;\r\n}\r\n\r\n/** True for the {@link SurfaceTexture3D} form — pixels are rasterized from 2D. */\r\nexport function isSurfaceTexture3D(texture: Texture3D): texture is SurfaceTexture3D {\r\n return typeof texture !== \"string\" && \"source\" in texture;\r\n}\r\n\r\n/** Normalize the string shorthand to an {@link ImageTexture3D}. */\r\nexport function resolveTexture3D(texture: Texture3D): ImageTexture3D | DataTexture3D | SurfaceTexture3D {\r\n return typeof texture === \"string\" ? { src: texture } : texture;\r\n}\r\n\r\n/**\r\n * The asset `src` a texture reads from, or `null` when it has none (a data or\r\n * surface texture). Used by the asset-tracking pass to enumerate what a 3D scene\r\n * needs loaded — a `null` here means \"nothing to request\", not \"not a texture\".\r\n */\r\nexport function texture3DSource(texture: Texture3D): string | null {\r\n if (typeof texture === \"string\") return texture;\r\n if (isDataTexture3D(texture) || isSurfaceTexture3D(texture)) return null;\r\n return texture.src;\r\n}\r\n\r\n/**\r\n * True for a string that names an asset rather than a colour.\r\n *\r\n * Leading `/` or `.` is a path by construction; otherwise the extension decides.\r\n * A colour never matches either, and a bare name like `\"wood\"` is a colour —\r\n * which is right, since an asset reference without a path or extension is not\r\n * something the manifest could resolve either.\r\n */\r\nexport function looksLikeAssetPath(value: string): boolean {\r\n return value.startsWith(\"/\")\r\n || value.startsWith(\".\")\r\n || /\\.(png|jpe?g|webp|avif|svg|ktx2?|hdr|exr|mp4|webm|mov)$/i.test(value);\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"texture.js","sourceRoot":"","sources":["../../src/render3d/texture.ts"],"names":[],"mappings":"AAkKA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAuB;IACxD,OAAO,OAAQ,MAAqB,CAAC,GAAG,KAAK,UAAU;QACnD,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAoB,EAAE;QACtD,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAgB,EAAE,CAAC;AACnD,CAAC;AAQD,gFAAgF;AAChF,MAAM,UAAU,eAAe,CAAC,OAAkB;IAC9C,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,MAAM,IAAI,OAAO,CAAC;AAC5D,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,kBAAkB,CAAC,OAAkB;IACjD,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,QAAQ,IAAI,OAAO,CAAC;AAC9D,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,gBAAgB,CAAC,OAAkB;IAC/C,OAAO,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAkB;IAC9C,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OAAO,CAAC;IAChD,IAAI,eAAe,CAAC,OAAO,CAAC,IAAI,kBAAkB,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACzE,OAAO,OAAO,CAAC,GAAG,CAAC;AACvB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC5C,OAAO,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;WACrB,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;WACrB,0DAA0D,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import type { Vector2 } from \"@/attributes/layout/vector2\";\r\n// Type-only, like `Color` above: `render3d` is pure data and never reaches into\r\n// the render or node layers at runtime. See SurfaceSource3D.\r\nimport type { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport type { Node2D } from \"@/components/trees/2d/node2d\";\r\n\r\n/** How sampling behaves outside the 0–1 UV range. */\r\nexport type TextureWrap3D = \"clamp\" | \"repeat\" | \"mirror\";\r\n\r\n/** How texels are blended when the texture is scaled. */\r\nexport type TextureFilter3D = \"nearest\" | \"linear\";\r\n\r\n/**\r\n * Which colour space the texture's data is in.\r\n *\r\n * `\"srgb\"` for anything representing a *colour* an eye would see (albedo/`map`,\r\n * `emissiveMap`), so the renderer linearizes it before lighting maths.\r\n * `\"linear\"` for *data* maps whose channels are numbers rather than colours\r\n * (`normalMap`, `roughnessMap`, `metalnessMap`, `aoMap`, `displacementMap`) —\r\n * linearizing those would corrupt them. Each map slot defaults correctly, so\r\n * this only needs setting for unusual pipelines.\r\n */\r\nexport type TextureColorSpace3D = \"srgb\" | \"linear\";\r\n\r\n/** Sampler state shared by every texture source. */\r\nexport interface TextureOptions3D {\r\n wrapS?: TextureWrap3D;\r\n wrapT?: TextureWrap3D;\r\n /** UV scale. `[2, 2]` tiles twice on each axis (needs a `repeat` wrap). */\r\n repeat?: Vector2 | readonly [number, number];\r\n offset?: Vector2 | readonly [number, number];\r\n /** UV rotation in **degrees**, about {@link center}. */\r\n rotation?: number;\r\n center?: Vector2 | readonly [number, number];\r\n magFilter?: TextureFilter3D;\r\n minFilter?: TextureFilter3D;\r\n /** Sharpness at grazing angles. Clamped to the GPU's maximum. */\r\n anisotropy?: number;\r\n flipY?: boolean;\r\n colorSpace?: TextureColorSpace3D;\r\n}\r\n\r\n/**\r\n * A texture loaded from the project's asset manifest.\r\n *\r\n * `src` is discovered by the asset-tracking render pass and requested through\r\n * core's ordinary image pipeline — the very same path a 2D image fill uses — so\r\n * the pixels are decoded and resident *before* the frame that needs them draws.\r\n */\r\nexport interface ImageTexture3D extends TextureOptions3D {\r\n src: string;\r\n}\r\n\r\n/**\r\n * A texture built from raw RGBA8888 bytes — the escape hatch for procedurally\r\n * generated pixels (gradient ramps, noise, LUTs, data encoded as colour).\r\n */\r\nexport interface DataTexture3D extends TextureOptions3D {\r\n data: ArrayLike<number>;\r\n width: number;\r\n height: number;\r\n /**\r\n * Bump to force a re-upload after mutating `data` in place. Mutation is\r\n * invisible to identity comparison, so without this the renderer cannot\r\n * tell the bytes changed. See {@link BufferGeometry3D.revision}.\r\n */\r\n revision?: number;\r\n}\r\n\r\n/**\r\n * A texture whose pixels are Motion Script's own 2D output, rasterized offscreen\r\n * — the way to put a chart, a readout or a whole laid-out UI onto 3D geometry.\r\n *\r\n * `source` is a value, not a name and not a mounted node: either a built\r\n * {@link Graphics2D} command list, or a `Node2D` subtree. Both are supplied directly,\r\n * so there is no matching indirection and nothing has to live in a particular\r\n * place in the scene tree.\r\n *\r\n * g3.plane({ map: Tex.surface(scopeGraphics, 1024, 640) })\r\n * g3.plane({ map: Tex.surface(statsSubtree, 1024, 640) })\r\n *\r\n * A `Node2D` source is *adopted for binding* by whatever paints the scene — it gets\r\n * that node's asset catalog, inherited context and clock, which is what makes a\r\n * webfont shape and an `<Image>` load. It is never laid out or painted by the\r\n * scene tree; it is measured against `width`×`height` and drawn into the buffer.\r\n *\r\n * **Hoist the source.** Building it fresh inside the scene builder allocates a new\r\n * subtree every frame — re-binding, re-laying-out, defeating the texture cache and\r\n * leaking. Declare it once and pass the same instance.\r\n *\r\n * That hoisting rule is also what removed this descriptor's old `key`: a hoisted\r\n * source *is* a stable identity, so the renderer keys the GPU texture off the\r\n * source object itself (in a `WeakMap`) rather than off its ordinal in the scene\r\n * walk. A conditionally-emitted surface therefore needs nothing written by hand,\r\n * and a source that goes out of scope becomes collectable instead of orphaning\r\n * its texture — which the ordinal scheme could not do.\r\n */\r\nexport interface SurfaceTexture3D extends TextureOptions3D {\r\n /** A built `Graphics2D`, or a `Node2D` subtree. Typed structurally — see below. */\r\n source: SurfaceSource3D;\r\n /** Buffer width in pixels. This *is* the texture's resolution. */\r\n width: number;\r\n /** Buffer height in pixels. */\r\n height: number;\r\n /**\r\n * Declare the source's pixels unchanging, so the buffer is rasterized once\r\n * and reused rather than redrawn every frame.\r\n *\r\n * Set by `resolveFill3D` for a fill chain, whose layers describe the same\r\n * image on every frame; an author's own source is live by default, which is\r\n * what makes an animated `Graphics2D` or a prop-driven subtree work with no\r\n * bookkeeping. Needs {@link identity} to be cacheable.\r\n *\r\n * @internal\r\n */\r\n static?: boolean;\r\n /**\r\n * Cache identity for a synthesized source.\r\n *\r\n * An author's source is identified by the source object itself (see the note\r\n * above), which is exactly right for something hoisted. A source built *for*\r\n * a fill is a fresh object every frame and has no such identity, so the value\r\n * it was derived from supplies one.\r\n *\r\n * @internal\r\n */\r\n identity?: string;\r\n /**\r\n * Ceiling on the buffer's device-pixel ratio. Default 1, i.e. the buffer is\r\n * exactly `width` × `height`.\r\n *\r\n * Unlike a 2D node — which wants to match the display — a surface is sampled by\r\n * a 3D material at whatever size the geometry occupies on screen, so the honest\r\n * control is `width`/`height`. Raise this only when a surface is viewed close\r\n * up and reads soft.\r\n */\r\n maxPixelRatio?: number;\r\n}\r\n\r\n/**\r\n * What a {@link SurfaceTexture3D} can be painted from: a built {@link Graphics2D}\r\n * command list, or a {@link Node2D} subtree.\r\n *\r\n * Both imports are **type-only**, exactly as `Color` is — `render3d` describes\r\n * scenes as data and never reaches into the render or node layers at runtime, and\r\n * a value import of `Node2D` here would close a real module cycle. Consumers narrow\r\n * with {@link resolveSurfaceSource}.\r\n */\r\nexport type SurfaceSource3D = Graphics2D | Node;\r\n\r\n// Declared against the dimension-agnostic base because that is what a built\r\n// node is typed as, so `Tex.surface(new Rect({ … }), …)` type-checks without a\r\n// cast. It has to be a 2D subtree in fact — the renderer lays it out and draws it\r\n// into a 2D buffer — and `resolveSurfaceSource` narrows to that; handing it a\r\n// `Node3D` fails at render time rather than here.\r\n\r\n/** A {@link SurfaceSource3D} narrowed to the arm its renderer should take. */\r\nexport type ResolvedSurfaceSource =\r\n | { kind: \"graphics\"; graphics: Graphics2D }\r\n | { kind: \"node\"; node: Node2D };\r\n\r\n/**\r\n * Narrow a surface source to the arm that knows how to draw it: a `Graphics2D` is\r\n * replayed into a render context, a `Node2D` is laid out against the buffer and\r\n * rendered.\r\n *\r\n * Structural rather than `instanceof`, because that would need value imports of\r\n * both classes and close the cycle the type-only imports above avoid. `Graphics2D`\r\n * is a command recorder and exposes `ops()`; a `Node2D` has no such method. The\r\n * union makes any *other* value a type error, so this only has to separate two\r\n * known shapes rather than validate an unknown one.\r\n */\r\nexport function resolveSurfaceSource(source: SurfaceSource3D): ResolvedSurfaceSource {\r\n return typeof (source as Graphics2D).ops === \"function\"\r\n ? { kind: \"graphics\", graphics: source as Graphics2D }\r\n : { kind: \"node\", node: source as Node2D };\r\n}\r\n\r\n/**\r\n * A texture reference. A bare string is sugar for `{ src }`, so the common case\r\n * is `map: \"/wood.png\"`.\r\n */\r\nexport type Texture3D = string | ImageTexture3D | DataTexture3D | SurfaceTexture3D;\r\n\r\n/** True for the raw-bytes form (vs. an asset-backed {@link ImageTexture3D}). */\r\nexport function isDataTexture3D(texture: Texture3D): texture is DataTexture3D {\r\n return typeof texture !== \"string\" && \"data\" in texture;\r\n}\r\n\r\n/** True for the {@link SurfaceTexture3D} form — pixels are rasterized from 2D. */\r\nexport function isSurfaceTexture3D(texture: Texture3D): texture is SurfaceTexture3D {\r\n return typeof texture !== \"string\" && \"source\" in texture;\r\n}\r\n\r\n/** Normalize the string shorthand to an {@link ImageTexture3D}. */\r\nexport function resolveTexture3D(texture: Texture3D): ImageTexture3D | DataTexture3D | SurfaceTexture3D {\r\n return typeof texture === \"string\" ? { src: texture } : texture;\r\n}\r\n\r\n/**\r\n * The asset `src` a texture reads from, or `null` when it has none (a data or\r\n * surface texture). Used by the asset-tracking pass to enumerate what a 3D scene\r\n * needs loaded — a `null` here means \"nothing to request\", not \"not a texture\".\r\n */\r\nexport function texture3DSource(texture: Texture3D): string | null {\r\n if (typeof texture === \"string\") return texture;\r\n if (isDataTexture3D(texture) || isSurfaceTexture3D(texture)) return null;\r\n return texture.src;\r\n}\r\n\r\n/**\r\n * True for a string that names an asset rather than a colour.\r\n *\r\n * Leading `/` or `.` is a path by construction; otherwise the extension decides.\r\n * A colour never matches either, and a bare name like `\"wood\"` is a colour —\r\n * which is right, since an asset reference without a path or extension is not\r\n * something the manifest could resolve either.\r\n */\r\nexport function looksLikeAssetPath(value: string): boolean {\r\n return value.startsWith(\"/\")\r\n || value.startsWith(\".\")\r\n || /\\.(png|jpe?g|webp|avif|svg|ktx2?|hdr|exr|mp4|webm|mov)$/i.test(value);\r\n}\r\n"]}
|
|
@@ -25,8 +25,8 @@ export declare function resolveVector3(input: Vector3Input | undefined): Vector3
|
|
|
25
25
|
* returns `to`.
|
|
26
26
|
*
|
|
27
27
|
* Pass this as a prop's `tween` so 3D vectors actually animate:
|
|
28
|
-
*
|
|
29
|
-
* carries it already. Without one `to()` **leaves the prop alone**, having
|
|
28
|
+
* `property({ default: …, tween: lerpVector3 })` — or a `Types.vector3` entry,
|
|
29
|
+
* which carries it already. Without one `to()` **leaves the prop alone**, having
|
|
30
30
|
* nothing to interpolate two vectors with.
|
|
31
31
|
*/
|
|
32
32
|
export declare function lerpVector3(from: Vector3, to: Vector3, t: number): Vector3;
|
package/dist/render3d/vector3.js
CHANGED
|
@@ -16,8 +16,8 @@ export function resolveVector3(input) {
|
|
|
16
16
|
* returns `to`.
|
|
17
17
|
*
|
|
18
18
|
* Pass this as a prop's `tween` so 3D vectors actually animate:
|
|
19
|
-
*
|
|
20
|
-
* carries it already. Without one `to()` **leaves the prop alone**, having
|
|
19
|
+
* `property({ default: …, tween: lerpVector3 })` — or a `Types.vector3` entry,
|
|
20
|
+
* which carries it already. Without one `to()` **leaves the prop alone**, having
|
|
21
21
|
* nothing to interpolate two vectors with.
|
|
22
22
|
*/
|
|
23
23
|
export function lerpVector3(from, to, t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector3.js","sourceRoot":"","sources":["../../src/render3d/vector3.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAwB1C,MAAM,IAAI,GAAY,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAE3C,wEAAwE;AACxE,MAAM,UAAU,cAAc,CAAC,KAA+B;IAC1D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,GAAG,IAAI,EAAE,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;IACvE,IAA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,GAAG,EAAE;aACjC,CAAC;QACN,KAAK,KAAK,CAAC;QACX;YACI,OAAO;gBACH,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;aACjC,CAAC;IACV,CAAC;AACL,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,aAAa,GAAyC;IAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI,EAAE,eAAe;CACxB,CAAC","sourcesContent":["import { lerpNumber } from \"@/tween/lerp\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\n/**\r\n * A 3D point or offset. The 3D counterpart to core's {@link Vector2}\r\n * (`attributes/layout/vector2.ts`), kept structurally identical so the same\r\n * plain-object idiom works in both dimensions.\r\n */\r\nexport interface Vector3 {\r\n x: number;\r\n y: number;\r\n z: number;\r\n}\r\n\r\n/**\r\n * Loose forms accepted anywhere a {@link Vector3} is expected:\r\n *\r\n * - an object — `{ x: 1, y: 2, z: 3 }`\r\n * - a 3-tuple — `[1, 2, 3]`\r\n * - a scalar, broadcast to all three axes — `0` means the origin, `2` means\r\n * `{ x: 2, y: 2, z: 2 }` (handy for uniform scale and `lookAt: 0`)\r\n */\r\nexport type Vector3Input = Vector3 | readonly [number, number, number] | number;\r\n\r\nconst ZERO: Vector3 = { x: 0, y: 0, z: 0 };\r\n\r\n/** Normalize any {@link Vector3Input} to a concrete {@link Vector3}. */\r\nexport function resolveVector3(input: Vector3Input | undefined): Vector3 {\r\n if (input === undefined) return { ...ZERO };\r\n if (typeof input === \"number\") return { x: input, y: input, z: input };\r\n if (Array.isArray(input)) return { x: input[0] ?? 0, y: input[1] ?? 0, z: input[2] ?? 0 };\r\n const v = input as Vector3;\r\n return { x: v.x ?? 0, y: v.y ?? 0, z: v.z ?? 0 };\r\n}\r\n\r\n/**\r\n * Component-wise lerp between two positions. `t=0` returns `from`, `t=1`\r\n * returns `to`.\r\n *\r\n * Pass this as a prop's `tween` so 3D vectors actually animate:\r\n * `@property({ default: …, tween: lerpVector3 })` — or `@vector3Property`, which\r\n * carries it already. Without one `to()` **leaves the prop alone**, having\r\n * nothing to interpolate two vectors with.\r\n */\r\nexport function lerpVector3(from: Vector3, to: Vector3, t: number): Vector3 {\r\n return {\r\n x: lerpNumber(from.x, to.x, t),\r\n y: lerpNumber(from.y, to.y, t),\r\n z: lerpNumber(from.z, to.z, t),\r\n };\r\n}\r\n\r\n/** The `Vector3` attribute's op set — a 3D position or scale. */\r\nexport const vector3Ops: AttributeOps<Vector3Input, Vector3> = {\r\n resolve: (value) => resolveVector3(value),\r\n lerp: lerpVector3,\r\n};\r\n\r\n/**\r\n * Map an optional {@link Vector3Input}: an unset prop stays unset (a thunk that\r\n * returns `undefined` included) instead of resolving to the origin, which would\r\n * turn \"no aim\" into \"aim at the origin\".\r\n */\r\nexport function resolveOptionalVector3(input: Vector3Input | undefined): Vector3 | undefined {\r\n return input === undefined ? undefined : resolveVector3(input);\r\n}\r\n\r\n/**\r\n * Lerp for a vector prop that may be unset — a node's `lookAt`, a camera's or\r\n * light's `target`.\r\n *\r\n * With no start value there is nothing to blend from. `unset: \"origin\"` treats it\r\n * as the origin, which is what the renderer uses for `target`; `unset: \"snap\"`\r\n * holds it unset and swaps at the end, which is the only honest reading for\r\n * `lookAt` (an unset `lookAt` is \"do not aim\", not \"aim at the origin\"). A `to`\r\n * that ends unset leaves the start value in place, as every other prop does.\r\n */\r\nexport function lerpOptionalVector3(\r\n from: Vector3 | undefined,\r\n to: Vector3 | undefined,\r\n t: number,\r\n unset: \"origin\" | \"snap\",\r\n): Vector3 | undefined {\r\n if (to === undefined) return from;\r\n if (from !== undefined) return lerpVector3(from, to, t);\r\n if (unset === \"origin\") return lerpVector3(ZERO, to, t);\r\n return t >= 1 ? to : from;\r\n}\r\n\r\n/** The order Euler angles are applied in. Matches three's own naming. */\r\nexport type EulerOrder = \"XYZ\" | \"YXZ\" | \"ZXY\" | \"ZYX\" | \"YZX\" | \"XZY\";\r\n\r\n/**\r\n * An Euler rotation in **degrees**, to match the engine's 2D `rotation`.\r\n * The renderer converts to radians — authors never write `Math.PI`.\r\n */\r\nexport interface Euler3 extends Vector3 {\r\n order?: EulerOrder;\r\n}\r\n\r\n/**\r\n * Component-wise lerp of two Euler rotations, in degrees. `order` is discrete,\r\n * so it snaps at the halfway point rather than blending.\r\n *\r\n * Euler interpolation gimbals near the poles and takes the \"wrong\" path for\r\n * rotations past 180°. For a tumble, hold a {@link Quaternion} prop and use\r\n * {@link slerpQuaternion} instead.\r\n */\r\nexport function lerpEuler3(from: Euler3, to: Euler3, t: number): Euler3 {\r\n return {\r\n x: lerpNumber(from.x, to.x, t),\r\n y: lerpNumber(from.y, to.y, t),\r\n z: lerpNumber(from.z, to.z, t),\r\n order: t < 0.5 ? from.order : to.order,\r\n };\r\n}\r\n\r\n/** The `Euler3` attribute's op set — a rotation in degrees, per axis. */\r\nexport const euler3Ops: AttributeOps<Vector3Input | Euler3, Euler3> = {\r\n resolve: (input) => {\r\n const v = resolveVector3(input as Vector3Input);\r\n const order = (input as Euler3)?.order;\r\n return order ? { ...v, order } : v;\r\n },\r\n lerp: lerpEuler3,\r\n};\r\n\r\n/** A rotation as a unit quaternion. */\r\nexport interface Quaternion {\r\n x: number;\r\n y: number;\r\n z: number;\r\n w: number;\r\n}\r\n\r\n/** The identity rotation. */\r\nexport const IDENTITY_QUATERNION: Quaternion = { x: 0, y: 0, z: 0, w: 1 };\r\n\r\n/**\r\n * Shortest-arc spherical linear interpolation — the correct tween for a\r\n * quaternion. A component-wise lerp is *not* correct: it leaves the unit\r\n * hypersphere, so the rotation speed varies and the result needs renormalizing.\r\n *\r\n * Negates `to` when the pair points away from each other (`dot < 0`) so the\r\n * rotation always takes the short way round; falls back to a normalized linear\r\n * blend when the two are nearly parallel and `sin(theta)` would underflow.\r\n */\r\nexport function slerpQuaternion(from: Quaternion, to: Quaternion, t: number): Quaternion {\r\n let { x, y, z, w } = to;\r\n let dot = from.x * x + from.y * y + from.z * z + from.w * w;\r\n\r\n // Both q and -q describe the same rotation; pick the nearer representative.\r\n if (dot < 0) {\r\n x = -x; y = -y; z = -z; w = -w;\r\n dot = -dot;\r\n }\r\n\r\n // Nearly parallel — slerp's sin(theta) denominator underflows, and a linear\r\n // blend is indistinguishable at this angle anyway.\r\n if (dot > 0.9995) {\r\n return normalizeQuaternion({\r\n x: lerpNumber(from.x, x, t),\r\n y: lerpNumber(from.y, y, t),\r\n z: lerpNumber(from.z, z, t),\r\n w: lerpNumber(from.w, w, t),\r\n });\r\n }\r\n\r\n const theta = Math.acos(dot);\r\n const sinTheta = Math.sin(theta);\r\n const a = Math.sin((1 - t) * theta) / sinTheta;\r\n const b = Math.sin(t * theta) / sinTheta;\r\n\r\n return {\r\n x: from.x * a + x * b,\r\n y: from.y * a + y * b,\r\n z: from.z * a + z * b,\r\n w: from.w * a + w * b,\r\n };\r\n}\r\n\r\n/** Scale a quaternion back to unit length. Returns identity for a zero quat. */\r\nexport function normalizeQuaternion(q: Quaternion): Quaternion {\r\n const length = Math.hypot(q.x, q.y, q.z, q.w);\r\n if (length === 0) return { ...IDENTITY_QUATERNION };\r\n return { x: q.x / length, y: q.y / length, z: q.z / length, w: q.w / length };\r\n}\r\n\r\n/** Convert an {@link Euler3} (degrees) to a {@link Quaternion}. */\r\nexport function quaternionFromEuler(euler: Euler3): Quaternion {\r\n const half = Math.PI / 360; // deg → rad, then halved for the half-angle form\r\n const cx = Math.cos(euler.x * half), sx = Math.sin(euler.x * half);\r\n const cy = Math.cos(euler.y * half), sy = Math.sin(euler.y * half);\r\n const cz = Math.cos(euler.z * half), sz = Math.sin(euler.z * half);\r\n\r\n switch (euler.order ?? \"XYZ\") {\r\n case \"YXZ\":\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"ZXY\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n case \"ZYX\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"YZX\":\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n case \"XZY\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"XYZ\":\r\n default:\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n }\r\n}\r\n\r\n/** The `Quaternion` attribute's op set: resolve is the identity, lerp shortest-arc slerps. */\r\nexport const quaternionOps: AttributeOps<Quaternion, Quaternion> = {\r\n resolve: (value) => value,\r\n lerp: slerpQuaternion,\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"vector3.js","sourceRoot":"","sources":["../../src/render3d/vector3.ts"],"names":[],"mappings":"AAAA,O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AE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;aACjC,CAAC;QACN,KAAK,KAAK;YACN,OAAO;gBACH,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;aACjC,CAAC;QACN,KAAK,KAAK,CAAC;QACX;YACI,OAAO;gBACH,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;gBAC9B,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;aACjC,CAAC;IACV,CAAC;AACL,CAAC;AAED,8FAA8F;AAC9F,MAAM,CAAC,MAAM,aAAa,GAAyC;IAC/D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI,EAAE,eAAe;CACxB,CAAC","sourcesContent":["import { lerpNumber } from \"@/tween/lerp\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\n/**\r\n * A 3D point or offset. The 3D counterpart to core's {@link Vector2}\r\n * (`attributes/layout/vector2.ts`), kept structurally identical so the same\r\n * plain-object idiom works in both dimensions.\r\n */\r\nexport interface Vector3 {\r\n x: number;\r\n y: number;\r\n z: number;\r\n}\r\n\r\n/**\r\n * Loose forms accepted anywhere a {@link Vector3} is expected:\r\n *\r\n * - an object — `{ x: 1, y: 2, z: 3 }`\r\n * - a 3-tuple — `[1, 2, 3]`\r\n * - a scalar, broadcast to all three axes — `0` means the origin, `2` means\r\n * `{ x: 2, y: 2, z: 2 }` (handy for uniform scale and `lookAt: 0`)\r\n */\r\nexport type Vector3Input = Vector3 | readonly [number, number, number] | number;\r\n\r\nconst ZERO: Vector3 = { x: 0, y: 0, z: 0 };\r\n\r\n/** Normalize any {@link Vector3Input} to a concrete {@link Vector3}. */\r\nexport function resolveVector3(input: Vector3Input | undefined): Vector3 {\r\n if (input === undefined) return { ...ZERO };\r\n if (typeof input === \"number\") return { x: input, y: input, z: input };\r\n if (Array.isArray(input)) return { x: input[0] ?? 0, y: input[1] ?? 0, z: input[2] ?? 0 };\r\n const v = input as Vector3;\r\n return { x: v.x ?? 0, y: v.y ?? 0, z: v.z ?? 0 };\r\n}\r\n\r\n/**\r\n * Component-wise lerp between two positions. `t=0` returns `from`, `t=1`\r\n * returns `to`.\r\n *\r\n * Pass this as a prop's `tween` so 3D vectors actually animate:\r\n * `property({ default: …, tween: lerpVector3 })` — or a `Types.vector3` entry,\r\n * which carries it already. Without one `to()` **leaves the prop alone**, having\r\n * nothing to interpolate two vectors with.\r\n */\r\nexport function lerpVector3(from: Vector3, to: Vector3, t: number): Vector3 {\r\n return {\r\n x: lerpNumber(from.x, to.x, t),\r\n y: lerpNumber(from.y, to.y, t),\r\n z: lerpNumber(from.z, to.z, t),\r\n };\r\n}\r\n\r\n/** The `Vector3` attribute's op set — a 3D position or scale. */\r\nexport const vector3Ops: AttributeOps<Vector3Input, Vector3> = {\r\n resolve: (value) => resolveVector3(value),\r\n lerp: lerpVector3,\r\n};\r\n\r\n/**\r\n * Map an optional {@link Vector3Input}: an unset prop stays unset (a thunk that\r\n * returns `undefined` included) instead of resolving to the origin, which would\r\n * turn \"no aim\" into \"aim at the origin\".\r\n */\r\nexport function resolveOptionalVector3(input: Vector3Input | undefined): Vector3 | undefined {\r\n return input === undefined ? undefined : resolveVector3(input);\r\n}\r\n\r\n/**\r\n * Lerp for a vector prop that may be unset — a node's `lookAt`, a camera's or\r\n * light's `target`.\r\n *\r\n * With no start value there is nothing to blend from. `unset: \"origin\"` treats it\r\n * as the origin, which is what the renderer uses for `target`; `unset: \"snap\"`\r\n * holds it unset and swaps at the end, which is the only honest reading for\r\n * `lookAt` (an unset `lookAt` is \"do not aim\", not \"aim at the origin\"). A `to`\r\n * that ends unset leaves the start value in place, as every other prop does.\r\n */\r\nexport function lerpOptionalVector3(\r\n from: Vector3 | undefined,\r\n to: Vector3 | undefined,\r\n t: number,\r\n unset: \"origin\" | \"snap\",\r\n): Vector3 | undefined {\r\n if (to === undefined) return from;\r\n if (from !== undefined) return lerpVector3(from, to, t);\r\n if (unset === \"origin\") return lerpVector3(ZERO, to, t);\r\n return t >= 1 ? to : from;\r\n}\r\n\r\n/** The order Euler angles are applied in. Matches three's own naming. */\r\nexport type EulerOrder = \"XYZ\" | \"YXZ\" | \"ZXY\" | \"ZYX\" | \"YZX\" | \"XZY\";\r\n\r\n/**\r\n * An Euler rotation in **degrees**, to match the engine's 2D `rotation`.\r\n * The renderer converts to radians — authors never write `Math.PI`.\r\n */\r\nexport interface Euler3 extends Vector3 {\r\n order?: EulerOrder;\r\n}\r\n\r\n/**\r\n * Component-wise lerp of two Euler rotations, in degrees. `order` is discrete,\r\n * so it snaps at the halfway point rather than blending.\r\n *\r\n * Euler interpolation gimbals near the poles and takes the \"wrong\" path for\r\n * rotations past 180°. For a tumble, hold a {@link Quaternion} prop and use\r\n * {@link slerpQuaternion} instead.\r\n */\r\nexport function lerpEuler3(from: Euler3, to: Euler3, t: number): Euler3 {\r\n return {\r\n x: lerpNumber(from.x, to.x, t),\r\n y: lerpNumber(from.y, to.y, t),\r\n z: lerpNumber(from.z, to.z, t),\r\n order: t < 0.5 ? from.order : to.order,\r\n };\r\n}\r\n\r\n/** The `Euler3` attribute's op set — a rotation in degrees, per axis. */\r\nexport const euler3Ops: AttributeOps<Vector3Input | Euler3, Euler3> = {\r\n resolve: (input) => {\r\n const v = resolveVector3(input as Vector3Input);\r\n const order = (input as Euler3)?.order;\r\n return order ? { ...v, order } : v;\r\n },\r\n lerp: lerpEuler3,\r\n};\r\n\r\n/** A rotation as a unit quaternion. */\r\nexport interface Quaternion {\r\n x: number;\r\n y: number;\r\n z: number;\r\n w: number;\r\n}\r\n\r\n/** The identity rotation. */\r\nexport const IDENTITY_QUATERNION: Quaternion = { x: 0, y: 0, z: 0, w: 1 };\r\n\r\n/**\r\n * Shortest-arc spherical linear interpolation — the correct tween for a\r\n * quaternion. A component-wise lerp is *not* correct: it leaves the unit\r\n * hypersphere, so the rotation speed varies and the result needs renormalizing.\r\n *\r\n * Negates `to` when the pair points away from each other (`dot < 0`) so the\r\n * rotation always takes the short way round; falls back to a normalized linear\r\n * blend when the two are nearly parallel and `sin(theta)` would underflow.\r\n */\r\nexport function slerpQuaternion(from: Quaternion, to: Quaternion, t: number): Quaternion {\r\n let { x, y, z, w } = to;\r\n let dot = from.x * x + from.y * y + from.z * z + from.w * w;\r\n\r\n // Both q and -q describe the same rotation; pick the nearer representative.\r\n if (dot < 0) {\r\n x = -x; y = -y; z = -z; w = -w;\r\n dot = -dot;\r\n }\r\n\r\n // Nearly parallel — slerp's sin(theta) denominator underflows, and a linear\r\n // blend is indistinguishable at this angle anyway.\r\n if (dot > 0.9995) {\r\n return normalizeQuaternion({\r\n x: lerpNumber(from.x, x, t),\r\n y: lerpNumber(from.y, y, t),\r\n z: lerpNumber(from.z, z, t),\r\n w: lerpNumber(from.w, w, t),\r\n });\r\n }\r\n\r\n const theta = Math.acos(dot);\r\n const sinTheta = Math.sin(theta);\r\n const a = Math.sin((1 - t) * theta) / sinTheta;\r\n const b = Math.sin(t * theta) / sinTheta;\r\n\r\n return {\r\n x: from.x * a + x * b,\r\n y: from.y * a + y * b,\r\n z: from.z * a + z * b,\r\n w: from.w * a + w * b,\r\n };\r\n}\r\n\r\n/** Scale a quaternion back to unit length. Returns identity for a zero quat. */\r\nexport function normalizeQuaternion(q: Quaternion): Quaternion {\r\n const length = Math.hypot(q.x, q.y, q.z, q.w);\r\n if (length === 0) return { ...IDENTITY_QUATERNION };\r\n return { x: q.x / length, y: q.y / length, z: q.z / length, w: q.w / length };\r\n}\r\n\r\n/** Convert an {@link Euler3} (degrees) to a {@link Quaternion}. */\r\nexport function quaternionFromEuler(euler: Euler3): Quaternion {\r\n const half = Math.PI / 360; // deg → rad, then halved for the half-angle form\r\n const cx = Math.cos(euler.x * half), sx = Math.sin(euler.x * half);\r\n const cy = Math.cos(euler.y * half), sy = Math.sin(euler.y * half);\r\n const cz = Math.cos(euler.z * half), sz = Math.sin(euler.z * half);\r\n\r\n switch (euler.order ?? \"XYZ\") {\r\n case \"YXZ\":\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"ZXY\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n case \"ZYX\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"YZX\":\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz + sx * cy * sz,\r\n z: cx * cy * sz - sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n case \"XZY\":\r\n return {\r\n x: sx * cy * cz - cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz + sx * sy * sz,\r\n };\r\n case \"XYZ\":\r\n default:\r\n return {\r\n x: sx * cy * cz + cx * sy * sz,\r\n y: cx * sy * cz - sx * cy * sz,\r\n z: cx * cy * sz + sx * sy * cz,\r\n w: cx * cy * cz - sx * sy * sz,\r\n };\r\n }\r\n}\r\n\r\n/** The `Quaternion` attribute's op set: resolve is the identity, lerp shortest-arc slerps. */\r\nexport const quaternionOps: AttributeOps<Quaternion, Quaternion> = {\r\n resolve: (value) => value,\r\n lerp: slerpQuaternion,\r\n};\r\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AssetSegment } from "../assets/asset-index.js";
|
|
2
2
|
import type { AssetCatalog } from "../assets/catalog.js";
|
|
3
3
|
import type { NodeSpan } from "../document/types.js";
|
|
4
|
-
import type { Node } from "../
|
|
4
|
+
import type { Node } from "../components/trees/node/node.js";
|
|
5
5
|
import type { PropSlot } from "../props/slot.js";
|
|
6
6
|
import type { ClipInstance } from "./clip-instance.js";
|
|
7
7
|
export interface RefineOptions {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-refine.d.ts","sourceRoot":"","sources":["../../src/runtime/asset-refine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"asset-refine.d.ts","sourceRoot":"","sources":["../../src/runtime/asset-refine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,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E,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACjC,iDAAiD;IACjD,OAAO,EAAE,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CAChD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAiB,YAAY,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAIjH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssetDeclaration } from "../assets/scope.js";
|
|
2
|
-
import { bindDetached, declareNode } from "../
|
|
2
|
+
import { bindDetached, declareNode } from "../components/trees/node/node-walk.js";
|
|
3
3
|
import { LAYOUT_SLOT, observeSlots, PRESENCE_PREFIX, slotLabel, STRUCTURE_SLOT, unobserved, } from "../props/observer.js";
|
|
4
4
|
import { frameTime, spanFrames } from "./placement.js";
|
|
5
5
|
/**
|
|
@@ -45,7 +45,8 @@ class Sweep {
|
|
|
45
45
|
this._walked = this._start - 1;
|
|
46
46
|
this._placed = _instance.placedCommands().map((p) => ({
|
|
47
47
|
id: p.spec.id,
|
|
48
|
-
|
|
48
|
+
// An entrance writes its first frame from `holdFrom`, ahead of its start.
|
|
49
|
+
...this._activeFrames(p.holdFrom, p.start - p.holdFrom + p.duration),
|
|
49
50
|
writes: new Set(p.writes),
|
|
50
51
|
}));
|
|
51
52
|
for (let i = 0; i < this._placed.length; i++) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asset-refine.js","sourceRoot":"","sources":["../../src/runtime/asset-refine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,gBAAgB,CAAC;AAGlE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EACH,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,cAAc,EACd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CAAC,CAAC;QACvB,MAAM,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7E,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI;YAAE,MAAM;QAC/B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,GAAG,KAAK,CAAC;IACd,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACf,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { AssetSegment } from \"@/assets/asset-index\";\r\nimport type { AssetCatalog } from \"@/assets/catalog\";\r\nimport { AssetDeclaration, type AssetDecl } from \"@/assets/scope\";\r\nimport type { NodeSpan } from \"@/document/types\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport { bindDetached, declareNode } from \"@/nodes/node/node-walk\";\r\nimport {\r\n LAYOUT_SLOT,\r\n observeSlots,\r\n PRESENCE_PREFIX,\r\n slotLabel,\r\n STRUCTURE_SLOT,\r\n unobserved,\r\n type SlotObserver,\r\n} from \"@/props/observer\";\r\nimport type { PropSlot } from \"@/props/slot\";\r\nimport type { ClipInstance } from \"./clip-instance\";\r\nimport { frameTime, spanFrames } from \"./placement\";\r\n\r\nexport interface RefineOptions {\r\n fps: number;\r\n frameCount: number;\r\n catalog: AssetCatalog;\r\n /**\r\n * Limit the sweep to these owners, each from its frame on. A limited owner's\r\n * segments start no earlier than its frame: the caller keeps what it had before.\r\n */\r\n owners?: ReadonlyMap<string, number>;\r\n /** Like {@link owners}, for every owner a composite built below each row — keys a caller cannot know ahead. */\r\n below?: ReadonlyMap<string, number>;\r\n /** False only watches owners arrive, declaring nothing — for a caller that wants `onArrive` alone. */\r\n declare?: boolean;\r\n /** Binds a `Tex.surface` source before it declares. Defaults to the declaring node's scope. */\r\n bindSubtree?: (node: Node) => void;\r\n /** Once per owner, with the tree in the state the owner arrives in. */\r\n onArrive?: (node: Node, ownerKey: string, span: NodeSpan, frame: number) => void;\r\n onPhase?: (phase: \"evaluate\" | \"declare\") => void;\r\n}\r\n\r\nexport interface OwnerResult {\r\n ownerKey: string;\r\n nodeId: string | undefined;\r\n segments: AssetSegment[];\r\n /** Every slot any of its declarations read. */\r\n deps: ReadonlySet<PropSlot<unknown>>;\r\n /** A throwing declaration: the owner keeps no segments, and `prop` names the last slot it read. */\r\n error?: { message: string; stack?: string; prop?: string };\r\n}\r\n\r\nexport interface RefineResult {\r\n owners: Map<string, OwnerResult>;\r\n /** Dependency slot → the owners that read it. */\r\n readers: Map<PropSlot<unknown>, Set<string>>;\r\n}\r\n\r\n/**\r\n * Find each owner's asset segments, frame-exactly, without declaring every frame.\r\n *\r\n * A declaration is a pure function of the slots it reads, so an owner is declared\r\n * at arrival and again only on frames where something could have changed one of\r\n * those slots: every frame a command that writes one is active (which is what\r\n * catches a swap part-way through a command, and overlapping writers, since the\r\n * evaluation applies all of them), the first frame after it ends, and any frame\r\n * the tree's presence or structure changed under a read. A redeclaration whose\r\n * dependencies all hold the values they held last time reuses its result.\r\n *\r\n * Yields after each frame it evaluates. The instance must be built; the sweep\r\n * leaves it at an arbitrary time.\r\n */\r\nexport function* refineAssets(instance: ClipInstance, options: RefineOptions): Generator<void, RefineResult, void> {\r\n const sweep = new Sweep(instance, options);\r\n while (sweep.step()) yield;\r\n return sweep.result();\r\n}\r\n\r\n// ─── Sweep ────────────────────────────────────────────────────────────────────\r\n\r\ninterface Placed {\r\n id: string;\r\n /** The first frame the command is active on, and the last (`to < from` when it lands between frames). */\r\n from: number;\r\n to: number;\r\n writes: Set<PropSlot<unknown>>;\r\n}\r\n\r\ninterface Declared {\r\n frame: number;\r\n decls: ReadonlyMap<string, AssetDecl>;\r\n}\r\n\r\ninterface OwnerState {\r\n key: string;\r\n node: Node;\r\n span: NodeSpan;\r\n /** The first frame this sweep may declare the owner on. */\r\n from: number;\r\n present: boolean;\r\n arrivedAt: number;\r\n arrived: boolean;\r\n /** Closed presence intervals, inclusive. */\r\n intervals: [number, number][];\r\n history: Declared[];\r\n deps: PropSlot<unknown>[] | null;\r\n values: unknown[];\r\n /** A presence or structure slot it read was written: the values cannot tell. */\r\n stale: boolean;\r\n allDeps: Set<PropSlot<unknown>>;\r\n /** Indices of the placed commands whose frames are already queued for it. */\r\n scheduled: Set<number>;\r\n rounds: number;\r\n error?: OwnerResult[\"error\"];\r\n}\r\n\r\nconst MAX_REQUEUES = 3;\r\n\r\nclass Sweep {\r\n constructor(private readonly _instance: ClipInstance, private readonly _options: RefineOptions) {\r\n this._last = _options.frameCount - 1;\r\n\r\n const { owners, below } = _options;\r\n const limited = owners !== undefined || below !== undefined;\r\n if (this._last < 0 || (limited && (owners?.size ?? 0) + (below?.size ?? 0) === 0)) return;\r\n if (limited) {\r\n this._start = Infinity;\r\n for (const from of [...owners?.values() ?? [], ...below?.values() ?? []]) {\r\n this._start = Math.min(this._start, Math.max(0, from));\r\n }\r\n }\r\n if (this._start > this._last) return;\r\n this._walked = this._start - 1;\r\n\r\n this._placed = _instance.placedCommands().map((p) => ({\r\n id: p.spec.id,\r\n ...this._activeFrames(p.start, p.duration),\r\n writes: new Set(p.writes),\r\n }));\r\n for (let i = 0; i < this._placed.length; i++) {\r\n for (const slot of this._placed[i].writes) this._addWriter(slot, i);\r\n }\r\n\r\n this._enqueue(this._start);\r\n for (const span of this._structureSpans()) {\r\n const frames = spanFrames(span, _options.fps, _options.frameCount);\r\n if (!frames) continue;\r\n this._structureFrame(frames.startFrame);\r\n this._structureFrame(frames.endFrame + 1);\r\n }\r\n for (const placed of this._placed) {\r\n if (![...placed.writes].some(isPseudo)) continue;\r\n this._forEachDueFrame(placed, this._start, (frame) => this._structureFrame(frame));\r\n }\r\n }\r\n\r\n /** Evaluate and declare the next due frame. False once nothing is left. */\r\n step(): boolean {\r\n const frame = heapPop(this._heap);\r\n if (frame === undefined) return false;\r\n this._queued.delete(frame);\r\n this._frame = frame;\r\n this._dueTaken = false;\r\n this._evaluate(frame);\r\n this._declareDue(frame);\r\n return this._heap.length > 0;\r\n }\r\n\r\n result(): RefineResult {\r\n const owners = new Map<string, OwnerResult>();\r\n const readers = new Map<PropSlot<unknown>, Set<string>>();\r\n for (const owner of this._owners.values()) {\r\n const intervals = owner.present\r\n ? [...owner.intervals, [owner.arrivedAt, Infinity] as [number, number]]\r\n : owner.intervals;\r\n owners.set(owner.key, {\r\n ownerKey: owner.key,\r\n nodeId: owner.node.id,\r\n segments: owner.error ? [] : segmentsOf(owner.history, intervals),\r\n deps: owner.allDeps,\r\n ...(owner.error && { error: owner.error }),\r\n });\r\n for (const slot of owner.allDeps) {\r\n let keys = readers.get(slot);\r\n if (!keys) readers.set(slot, (keys = new Set()));\r\n keys.add(owner.key);\r\n }\r\n }\r\n for (const key of this._options.owners?.keys() ?? []) {\r\n if (!owners.has(key)) owners.set(key, { ownerKey: key, nodeId: undefined, segments: [], deps: new Set() });\r\n }\r\n return { owners, readers };\r\n }\r\n\r\n private readonly _last: number;\r\n private _start = 0;\r\n /** Frames up to here have had their presence and structure reconciled. */\r\n private _walked = -1;\r\n private _placed: Placed[] = [];\r\n private readonly _writers = new Map<PropSlot<unknown>, number[]>();\r\n private readonly _heap: number[] = [];\r\n private readonly _queued = new Set<number>();\r\n private readonly _due = new Map<number, Set<OwnerState>>();\r\n private readonly _structureFrames = new Set<number>();\r\n private readonly _owners = new Map<string, OwnerState>();\r\n private readonly _readers = new Map<PropSlot<unknown>, Set<OwnerState>>();\r\n private readonly _pseudo = new Set<PropSlot<unknown>>();\r\n /** Owners re-queued from before the frame being processed. */\r\n private readonly _rewound = new Set<OwnerState>();\r\n private _frame = -1;\r\n /** Whether the frame being processed has handed out its due owners yet. */\r\n private _dueTaken = false;\r\n /** Read once: in Node, `process.env` is a lookup per access, and it sat on every declaration. */\r\n private readonly _dev = isDev();\r\n\r\n private readonly _presenceObserver: SlotObserver = {\r\n read: () => { },\r\n write: (slot) => { if (isPseudo(slot)) this._pseudo.add(slot); },\r\n };\r\n\r\n /**\r\n * The spans whose edges can move an owner in or out. Limited to named owners,\r\n * only their rows' — an effective span already folds in every ancestor's, and\r\n * visiting every row's edges would make one edited node cost a walk of the clip.\r\n */\r\n private _structureSpans(): NodeSpan[] {\r\n const { owners, below } = this._options;\r\n if (owners === undefined && below === undefined) return this._instance.rowSpans();\r\n const rows = new Set<string>(below?.keys());\r\n for (const key of owners?.keys() ?? []) {\r\n const slash = key.indexOf(\"/\");\r\n rows.add(slash < 0 ? key : key.slice(0, slash));\r\n }\r\n const spans: NodeSpan[] = [];\r\n for (const row of rows) {\r\n const span = this._instance.rowSpan(row);\r\n if (span) spans.push(span);\r\n }\r\n return spans;\r\n }\r\n\r\n private _activeFrames(start: number, duration: number): { from: number; to: number } {\r\n const { fps } = this._options;\r\n const end = start + Math.max(0, duration);\r\n let from = Math.max(0, Math.ceil(start * fps));\r\n while (from > 0 && frameTime(from - 1, fps, Infinity) >= start) from--;\r\n while (frameTime(from, fps, Infinity) < start) from++;\r\n let to = Math.max(-1, Math.floor(end * fps));\r\n while (frameTime(to + 1, fps, Infinity) <= end) to++;\r\n while (to >= 0 && frameTime(to, fps, Infinity) > end) to--;\r\n return { from, to };\r\n }\r\n\r\n private _evaluate(frame: number): void {\r\n this._options.onPhase?.(\"evaluate\");\r\n const seconds = frameTime(frame, this._options.fps, this._instance.duration);\r\n // Clocks move only where the tree can change, and before it does, so a node\r\n // is attached in the state it arrives in. Declarations must not read them.\r\n if (frame > this._walked && (frame === this._start || this._structureFrames.has(frame))) {\r\n this._instance.attach(seconds);\r\n }\r\n this._pseudo.clear();\r\n // Presence moves before the commands run, outside the observer `onWrite` reports through.\r\n observeSlots(this._presenceObserver, () => this._instance.evaluateAt(seconds, (index, slot) => {\r\n if (isPseudo(slot)) this._pseudo.add(slot);\r\n this._commandWrote(index, slot);\r\n }));\r\n\r\n // Presence only moves forward: a frame revisited for a re-queued owner reads\r\n // what it recorded the first time through.\r\n if (frame <= this._walked) return;\r\n if (frame === this._start || this._pseudo.size > 0) this._reconcile(frame);\r\n for (const slot of this._pseudo) {\r\n for (const owner of this._readers.get(slot) ?? []) {\r\n owner.stale = true;\r\n this._queueOwner(owner, frame);\r\n }\r\n }\r\n this._walked = frame;\r\n }\r\n\r\n /** Seed owners that are now mounted, and close the ones that are not. */\r\n private _reconcile(frame: number): void {\r\n const seen = new Set<OwnerState>();\r\n this._instance.forEachOwner((node, key, span) => {\r\n const from = this._limitOf(key);\r\n if (from === undefined) return;\r\n let owner = this._owners.get(key);\r\n if (!owner) {\r\n owner = {\r\n key, node, span, from,\r\n present: false, arrivedAt: -1, arrived: false,\r\n intervals: [], history: [], deps: null, values: [], stale: true,\r\n allDeps: new Set(), scheduled: new Set(), rounds: 0,\r\n };\r\n this._owners.set(key, owner);\r\n }\r\n seen.add(owner);\r\n if (owner.node !== node) {\r\n owner.node = node;\r\n owner.stale = true;\r\n if (owner.present) this._queueOwner(owner, Math.max(frame, owner.from));\r\n }\r\n if (owner.present) return;\r\n owner.present = true;\r\n owner.arrivedAt = Math.max(frame, owner.from);\r\n owner.stale = true;\r\n this._queueOwner(owner, owner.arrivedAt);\r\n if (!owner.arrived) {\r\n owner.arrived = true;\r\n this._options.onArrive?.(node, key, span, frame);\r\n }\r\n });\r\n for (const owner of this._owners.values()) {\r\n if (!owner.present || seen.has(owner)) continue;\r\n if (frame - 1 >= owner.arrivedAt) owner.intervals.push([owner.arrivedAt, frame - 1]);\r\n owner.present = false;\r\n }\r\n }\r\n\r\n /** The first frame `key` may be declared on, or `undefined` when the sweep is limited to others. */\r\n private _limitOf(key: string): number | undefined {\r\n const { owners, below } = this._options;\r\n if (owners === undefined && below === undefined) return this._start;\r\n let from = owners?.get(key);\r\n if (below) {\r\n for (let slash = key.indexOf(\"/\"); slash >= 0; slash = key.indexOf(\"/\", slash + 1)) {\r\n const row = below.get(key.slice(0, slash));\r\n if (row !== undefined && (from === undefined || row < from)) from = row;\r\n }\r\n }\r\n return from;\r\n }\r\n\r\n private _declareDue(frame: number): void {\r\n this._dueTaken = true;\r\n const owners = this._due.get(frame);\r\n this._due.delete(frame);\r\n if (this._options.declare === false) return;\r\n for (const owner of owners ?? []) {\r\n if (owner.error || this._rewound.has(owner) || !presentAt(owner, frame)) continue;\r\n if (!owner.stale && unchanged(owner)) continue;\r\n this._declare(owner, frame);\r\n }\r\n // A rewound owner comes back to this frame after the ones it missed, so its history stays in frame order.\r\n for (const owner of this._rewound) this._queueOwner(owner, frame);\r\n this._rewound.clear();\r\n }\r\n\r\n private _declare(owner: OwnerState, frame: number): void {\r\n this._options.onPhase?.(\"declare\");\r\n const node = owner.node;\r\n const reads = new Set<PropSlot<unknown>>();\r\n const writes: PropSlot<unknown>[] = [];\r\n let lastRead: PropSlot<unknown> | undefined;\r\n let readLayout = false;\r\n let readClock = false;\r\n const bind = this._options.bindSubtree ?? ((sub: Node) => bindDetached(node, sub));\r\n const declaration = new AssetDeclaration(this._options.catalog, {\r\n bindSubtree: (sub) => unobserved(() => bind(sub)),\r\n });\r\n\r\n try {\r\n observeSlots({\r\n read: (slot) => {\r\n reads.add(slot);\r\n lastRead = slot;\r\n if (slot._name === LAYOUT_SLOT) readLayout = true;\r\n },\r\n write: (slot) => { writes.push(slot); },\r\n clock: () => { readClock = true; },\r\n }, () => declareNode(node, declaration));\r\n } catch (err) {\r\n const e = err instanceof Error ? err : new Error(String(err));\r\n owner.error = { message: e.message, stack: e.stack, ...(lastRead && { prop: slotLabel(lastRead) }) };\r\n return;\r\n }\r\n\r\n if (this._dev) {\r\n const type = node.constructor.name;\r\n if (writes.length > 0) {\r\n const labels = [...new Set(writes.map(slotLabel))].join(\", \");\r\n warnOnce(`${type}:write:${labels}`,\r\n `[assets] ${type} wrote ${labels} while declaring its assets. A declaration is re-run only ` +\r\n `when something it read changes, so a write there is a frame-order dependency.`);\r\n }\r\n if (readLayout) {\r\n warnOnce(`${type}:layout`,\r\n `[assets] ${type}.declareAssets read layoutBounds. Declarations run without layout; ` +\r\n `decode size follows the draw, so declare the asset without a size.`);\r\n }\r\n if (readClock) {\r\n warnOnce(`${type}:clock`,\r\n `[assets] ${type}.declareAssets read time. Declarations are re-run only when a prop ` +\r\n `they read changes, so anything following the clock is missed between those frames.`);\r\n }\r\n }\r\n\r\n owner.stale = false;\r\n owner.deps = [...reads];\r\n owner.values = owner.deps.map((slot) => slot.get());\r\n for (const slot of reads) {\r\n if (owner.allDeps.has(slot)) continue;\r\n owner.allDeps.add(slot);\r\n let set = this._readers.get(slot);\r\n if (!set) this._readers.set(slot, (set = new Set()));\r\n set.add(owner);\r\n }\r\n\r\n const decls = declaration.declarations;\r\n const previous = owner.history[owner.history.length - 1];\r\n if (!previous || previous.frame < owner.arrivedAt || !sameDecls(previous.decls, decls)) {\r\n owner.history.push({ frame, decls });\r\n }\r\n this._scheduleWriters(owner, frame + 1);\r\n }\r\n\r\n private _scheduleWriters(owner: OwnerState, from: number): void {\r\n for (const slot of owner.deps ?? []) {\r\n const writers = this._writers.get(slot);\r\n if (!writers) continue;\r\n for (const index of writers) {\r\n if (owner.scheduled.has(index)) continue;\r\n owner.scheduled.add(index);\r\n this._forEachDueFrame(this._placed[index], from, (frame) => this._queueOwner(owner, frame));\r\n }\r\n }\r\n }\r\n\r\n /** Every frame a command is active on from `from`, and the first after it ends. */\r\n private _forEachDueFrame(placed: Placed, from: number, visit: (frame: number) => void): void {\r\n const first = Math.max(from, placed.from);\r\n const last = Math.min(this._last, placed.to);\r\n for (let frame = first; frame <= last; frame++) visit(frame);\r\n const after = Math.max(placed.to + 1, placed.from);\r\n if (after >= from && after <= this._last) visit(after);\r\n }\r\n\r\n /**\r\n * A command wrote a slot compile did not see it write. Its readers may have\r\n * missed every frame of it, so each is re-queued from where the command starts.\r\n */\r\n private _commandWrote(index: number, slot: PropSlot<unknown>): void {\r\n const placed = this._placed[index];\r\n if (!placed || placed.writes.has(slot)) return;\r\n placed.writes.add(slot);\r\n this._addWriter(slot, index);\r\n\r\n if (this._dev) {\r\n warnOnce(`command:${placed.id}:${slotLabel(slot)}`,\r\n `[assets] Command ${placed.id} wrote ${slotLabel(slot)} at frame ${this._frame}, which compile did not ` +\r\n `record it writing. Owners reading it are re-declared over the command's span.`);\r\n }\r\n for (const owner of this._readers.get(slot) ?? []) this._requeue(owner, Math.max(placed.from, owner.from), placed.id);\r\n }\r\n\r\n private _requeue(owner: OwnerState, from: number, commandId: string): void {\r\n if (owner.error) return;\r\n if (from > this._frame) {\r\n this._scheduleWriters(owner, from);\r\n return;\r\n }\r\n if (from === this._frame) {\r\n this._queueOwner(owner, from);\r\n return;\r\n }\r\n if (owner.rounds >= MAX_REQUEUES) {\r\n if (this._dev) {\r\n warnOnce(`requeue:${owner.key}`,\r\n `[assets] ${owner.key} was re-queued ${MAX_REQUEUES} times (last by command ${commandId}); ` +\r\n `its asset windows may be incomplete.`);\r\n }\r\n return;\r\n }\r\n owner.rounds++;\r\n owner.history = owner.history.filter((entry) => entry.frame < from);\r\n owner.stale = true;\r\n owner.scheduled.clear();\r\n // Every presence interval that starts in reach lost its arrival declaration too.\r\n this._queueOwner(owner, from);\r\n for (const [start] of owner.intervals) if (start > from) this._queueOwner(owner, start);\r\n if (owner.present && owner.arrivedAt > from) this._queueOwner(owner, owner.arrivedAt);\r\n // Presence and structure were only watched going forward; revisit their frames in reach.\r\n if (owner.deps?.some(isPseudo)) {\r\n for (const frame of this._structureFrames) {\r\n if (frame >= from && frame <= this._walked) this._queueOwner(owner, frame);\r\n }\r\n }\r\n this._rewound.add(owner);\r\n }\r\n\r\n private _addWriter(slot: PropSlot<unknown>, index: number): void {\r\n const list = this._writers.get(slot);\r\n if (list) list.push(index);\r\n else this._writers.set(slot, [index]);\r\n }\r\n\r\n private _structureFrame(frame: number): void {\r\n if (frame <= this._start || frame > this._last) return;\r\n this._structureFrames.add(frame);\r\n this._enqueue(frame);\r\n }\r\n\r\n private _queueOwner(owner: OwnerState, frame: number): void {\r\n if (frame > this._last) return;\r\n let set = this._due.get(frame);\r\n if (!set) this._due.set(frame, (set = new Set()));\r\n set.add(owner);\r\n this._enqueue(frame);\r\n }\r\n\r\n private _enqueue(frame: number): void {\r\n if (this._queued.has(frame) || (frame === this._frame && !this._dueTaken)) return;\r\n this._queued.add(frame);\r\n heapPush(this._heap, frame);\r\n }\r\n}\r\n\r\n// ─── Helpers ──────────────────────────────────────────────────────────────────\r\n\r\nfunction isPseudo(slot: PropSlot<unknown>): boolean {\r\n return slot._name === STRUCTURE_SLOT || slot._name.startsWith(PRESENCE_PREFIX);\r\n}\r\n\r\nfunction presentAt(owner: OwnerState, frame: number): boolean {\r\n if (owner.present && frame >= owner.arrivedAt) return true;\r\n for (const [start, end] of owner.intervals) if (frame >= start && frame <= end) return true;\r\n return false;\r\n}\r\n\r\nfunction unchanged(owner: OwnerState): boolean {\r\n const deps = owner.deps;\r\n if (deps === null) return false;\r\n for (let i = 0; i < deps.length; i++) {\r\n if (!Object.is(deps[i].get(), owner.values[i])) return false;\r\n }\r\n return true;\r\n}\r\n\r\nfunction sameDecls(a: ReadonlyMap<string, AssetDecl>, b: ReadonlyMap<string, AssetDecl>): boolean {\r\n if (a.size !== b.size) return false;\r\n for (const [key, decl] of a) {\r\n const other = b.get(key);\r\n if (!other || !sameDecl(decl, other)) return false;\r\n }\r\n return true;\r\n}\r\n\r\n/** A font is its family: the record keeps the first weight, so a weight tween is one segment. */\r\nfunction sameDecl(a: AssetDecl, b: AssetDecl): boolean {\r\n switch (a.type) {\r\n case \"image\": return b.type === \"image\" && a.src === b.src;\r\n case \"video\": return b.type === \"video\" && a.src === b.src && a.trimStart === b.trimStart && a.trimEnd === b.trimEnd;\r\n case \"font\": return b.type === \"font\" && a.family === b.family;\r\n case \"loader\": return b.type === \"loader\" && a.key === b.key && a.load === b.load && a.gate === b.gate;\r\n }\r\n}\r\n\r\n/** An owner's declarations laid over its presence: each key open from the entry that declares it to the one that drops it. */\r\nfunction segmentsOf(history: readonly Declared[], intervals: readonly [number, number][]): AssetSegment[] {\r\n const out: AssetSegment[] = [];\r\n for (const [start, end] of intervals) {\r\n const open = new Map<string, AssetSegment>();\r\n for (const entry of history) {\r\n if (entry.frame < start || entry.frame > end) continue;\r\n for (const [key, segment] of open) {\r\n const next = entry.decls.get(key);\r\n if (next && sameDecl(segment.decl, next)) continue;\r\n out.push({ ...segment, endFrame: entry.frame - 1 });\r\n open.delete(key);\r\n }\r\n for (const [key, decl] of entry.decls) {\r\n if (!open.has(key)) open.set(key, { key, decl, startFrame: entry.frame, endFrame: end });\r\n }\r\n }\r\n for (const segment of open.values()) out.push({ ...segment, endFrame: end });\r\n }\r\n return out;\r\n}\r\n\r\nfunction isDev(): boolean {\r\n return process.env.NODE_ENV !== \"production\";\r\n}\r\n\r\nconst warned = new Set<string>();\r\n\r\nfunction warnOnce(key: string, message: string): void {\r\n if (warned.has(key)) return;\r\n warned.add(key);\r\n console.warn(message);\r\n}\r\n\r\nfunction heapPush(heap: number[], value: number): void {\r\n let i = heap.length;\r\n heap.push(value);\r\n while (i > 0) {\r\n const parent = (i - 1) >> 1;\r\n if (heap[parent] <= value) break;\r\n heap[i] = heap[parent];\r\n i = parent;\r\n }\r\n heap[i] = value;\r\n}\r\n\r\nfunction heapPop(heap: number[]): number | undefined {\r\n if (heap.length === 0) return undefined;\r\n const top = heap[0];\r\n const tail = heap.pop()!;\r\n if (heap.length === 0) return top;\r\n let i = 0;\r\n for (;;) {\r\n const left = 2 * i + 1;\r\n if (left >= heap.length) break;\r\n const right = left + 1;\r\n const child = right < heap.length && heap[right] < heap[left] ? right : left;\r\n if (heap[child] >= tail) break;\r\n heap[i] = heap[child];\r\n i = child;\r\n }\r\n heap[i] = tail;\r\n return top;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"asset-refine.js","sourceRoot":"","sources":["../../src/runtime/asset-refine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAkB,MAAM,gBAA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,CAAC;IAClC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,SAAS,CAAC;QACN,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM;YAAE,MAAM;QAC/B,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,CAAC;QACvB,MAAM,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAC7E,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI;YAAE,MAAM;QAC/B,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,GAAG,KAAK,CAAC;IACd,CAAC;IACD,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACf,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import type { AssetSegment } from \"@/assets/asset-index\";\r\nimport type { AssetCatalog } from \"@/assets/catalog\";\r\nimport { AssetDeclaration, type AssetDecl } from \"@/assets/scope\";\r\nimport type { NodeSpan } from \"@/document/types\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport { bindDetached, declareNode } from \"@/components/trees/node/node-walk\";\r\nimport {\r\n LAYOUT_SLOT,\r\n observeSlots,\r\n PRESENCE_PREFIX,\r\n slotLabel,\r\n STRUCTURE_SLOT,\r\n unobserved,\r\n type SlotObserver,\r\n} from \"@/props/observer\";\r\nimport type { PropSlot } from \"@/props/slot\";\r\nimport type { ClipInstance } from \"./clip-instance\";\r\nimport { frameTime, spanFrames } from \"./placement\";\r\n\r\nexport interface RefineOptions {\r\n fps: number;\r\n frameCount: number;\r\n catalog: AssetCatalog;\r\n /**\r\n * Limit the sweep to these owners, each from its frame on. A limited owner's\r\n * segments start no earlier than its frame: the caller keeps what it had before.\r\n */\r\n owners?: ReadonlyMap<string, number>;\r\n /** Like {@link owners}, for every owner a composite built below each row — keys a caller cannot know ahead. */\r\n below?: ReadonlyMap<string, number>;\r\n /** False only watches owners arrive, declaring nothing — for a caller that wants `onArrive` alone. */\r\n declare?: boolean;\r\n /** Binds a `Tex.surface` source before it declares. Defaults to the declaring node's scope. */\r\n bindSubtree?: (node: Node) => void;\r\n /** Once per owner, with the tree in the state the owner arrives in. */\r\n onArrive?: (node: Node, ownerKey: string, span: NodeSpan, frame: number) => void;\r\n onPhase?: (phase: \"evaluate\" | \"declare\") => void;\r\n}\r\n\r\nexport interface OwnerResult {\r\n ownerKey: string;\r\n nodeId: string | undefined;\r\n segments: AssetSegment[];\r\n /** Every slot any of its declarations read. */\r\n deps: ReadonlySet<PropSlot<unknown>>;\r\n /** A throwing declaration: the owner keeps no segments, and `prop` names the last slot it read. */\r\n error?: { message: string; stack?: string; prop?: string };\r\n}\r\n\r\nexport interface RefineResult {\r\n owners: Map<string, OwnerResult>;\r\n /** Dependency slot → the owners that read it. */\r\n readers: Map<PropSlot<unknown>, Set<string>>;\r\n}\r\n\r\n/**\r\n * Find each owner's asset segments, frame-exactly, without declaring every frame.\r\n *\r\n * A declaration is a pure function of the slots it reads, so an owner is declared\r\n * at arrival and again only on frames where something could have changed one of\r\n * those slots: every frame a command that writes one is active (which is what\r\n * catches a swap part-way through a command, and overlapping writers, since the\r\n * evaluation applies all of them), the first frame after it ends, and any frame\r\n * the tree's presence or structure changed under a read. A redeclaration whose\r\n * dependencies all hold the values they held last time reuses its result.\r\n *\r\n * Yields after each frame it evaluates. The instance must be built; the sweep\r\n * leaves it at an arbitrary time.\r\n */\r\nexport function* refineAssets(instance: ClipInstance, options: RefineOptions): Generator<void, RefineResult, void> {\r\n const sweep = new Sweep(instance, options);\r\n while (sweep.step()) yield;\r\n return sweep.result();\r\n}\r\n\r\n// ─── Sweep ────────────────────────────────────────────────────────────────────\r\n\r\ninterface Placed {\r\n id: string;\r\n /** The first frame the command is active on, and the last (`to < from` when it lands between frames). */\r\n from: number;\r\n to: number;\r\n writes: Set<PropSlot<unknown>>;\r\n}\r\n\r\ninterface Declared {\r\n frame: number;\r\n decls: ReadonlyMap<string, AssetDecl>;\r\n}\r\n\r\ninterface OwnerState {\r\n key: string;\r\n node: Node;\r\n span: NodeSpan;\r\n /** The first frame this sweep may declare the owner on. */\r\n from: number;\r\n present: boolean;\r\n arrivedAt: number;\r\n arrived: boolean;\r\n /** Closed presence intervals, inclusive. */\r\n intervals: [number, number][];\r\n history: Declared[];\r\n deps: PropSlot<unknown>[] | null;\r\n values: unknown[];\r\n /** A presence or structure slot it read was written: the values cannot tell. */\r\n stale: boolean;\r\n allDeps: Set<PropSlot<unknown>>;\r\n /** Indices of the placed commands whose frames are already queued for it. */\r\n scheduled: Set<number>;\r\n rounds: number;\r\n error?: OwnerResult[\"error\"];\r\n}\r\n\r\nconst MAX_REQUEUES = 3;\r\n\r\nclass Sweep {\r\n constructor(private readonly _instance: ClipInstance, private readonly _options: RefineOptions) {\r\n this._last = _options.frameCount - 1;\r\n\r\n const { owners, below } = _options;\r\n const limited = owners !== undefined || below !== undefined;\r\n if (this._last < 0 || (limited && (owners?.size ?? 0) + (below?.size ?? 0) === 0)) return;\r\n if (limited) {\r\n this._start = Infinity;\r\n for (const from of [...owners?.values() ?? [], ...below?.values() ?? []]) {\r\n this._start = Math.min(this._start, Math.max(0, from));\r\n }\r\n }\r\n if (this._start > this._last) return;\r\n this._walked = this._start - 1;\r\n\r\n this._placed = _instance.placedCommands().map((p) => ({\r\n id: p.spec.id,\r\n // An entrance writes its first frame from `holdFrom`, ahead of its start.\r\n ...this._activeFrames(p.holdFrom, p.start - p.holdFrom + p.duration),\r\n writes: new Set(p.writes),\r\n }));\r\n for (let i = 0; i < this._placed.length; i++) {\r\n for (const slot of this._placed[i].writes) this._addWriter(slot, i);\r\n }\r\n\r\n this._enqueue(this._start);\r\n for (const span of this._structureSpans()) {\r\n const frames = spanFrames(span, _options.fps, _options.frameCount);\r\n if (!frames) continue;\r\n this._structureFrame(frames.startFrame);\r\n this._structureFrame(frames.endFrame + 1);\r\n }\r\n for (const placed of this._placed) {\r\n if (![...placed.writes].some(isPseudo)) continue;\r\n this._forEachDueFrame(placed, this._start, (frame) => this._structureFrame(frame));\r\n }\r\n }\r\n\r\n /** Evaluate and declare the next due frame. False once nothing is left. */\r\n step(): boolean {\r\n const frame = heapPop(this._heap);\r\n if (frame === undefined) return false;\r\n this._queued.delete(frame);\r\n this._frame = frame;\r\n this._dueTaken = false;\r\n this._evaluate(frame);\r\n this._declareDue(frame);\r\n return this._heap.length > 0;\r\n }\r\n\r\n result(): RefineResult {\r\n const owners = new Map<string, OwnerResult>();\r\n const readers = new Map<PropSlot<unknown>, Set<string>>();\r\n for (const owner of this._owners.values()) {\r\n const intervals = owner.present\r\n ? [...owner.intervals, [owner.arrivedAt, Infinity] as [number, number]]\r\n : owner.intervals;\r\n owners.set(owner.key, {\r\n ownerKey: owner.key,\r\n nodeId: owner.node.id,\r\n segments: owner.error ? [] : segmentsOf(owner.history, intervals),\r\n deps: owner.allDeps,\r\n ...(owner.error && { error: owner.error }),\r\n });\r\n for (const slot of owner.allDeps) {\r\n let keys = readers.get(slot);\r\n if (!keys) readers.set(slot, (keys = new Set()));\r\n keys.add(owner.key);\r\n }\r\n }\r\n for (const key of this._options.owners?.keys() ?? []) {\r\n if (!owners.has(key)) owners.set(key, { ownerKey: key, nodeId: undefined, segments: [], deps: new Set() });\r\n }\r\n return { owners, readers };\r\n }\r\n\r\n private readonly _last: number;\r\n private _start = 0;\r\n /** Frames up to here have had their presence and structure reconciled. */\r\n private _walked = -1;\r\n private _placed: Placed[] = [];\r\n private readonly _writers = new Map<PropSlot<unknown>, number[]>();\r\n private readonly _heap: number[] = [];\r\n private readonly _queued = new Set<number>();\r\n private readonly _due = new Map<number, Set<OwnerState>>();\r\n private readonly _structureFrames = new Set<number>();\r\n private readonly _owners = new Map<string, OwnerState>();\r\n private readonly _readers = new Map<PropSlot<unknown>, Set<OwnerState>>();\r\n private readonly _pseudo = new Set<PropSlot<unknown>>();\r\n /** Owners re-queued from before the frame being processed. */\r\n private readonly _rewound = new Set<OwnerState>();\r\n private _frame = -1;\r\n /** Whether the frame being processed has handed out its due owners yet. */\r\n private _dueTaken = false;\r\n /** Read once: in Node, `process.env` is a lookup per access, and it sat on every declaration. */\r\n private readonly _dev = isDev();\r\n\r\n private readonly _presenceObserver: SlotObserver = {\r\n read: () => { },\r\n write: (slot) => { if (isPseudo(slot)) this._pseudo.add(slot); },\r\n };\r\n\r\n /**\r\n * The spans whose edges can move an owner in or out. Limited to named owners,\r\n * only their rows' — an effective span already folds in every ancestor's, and\r\n * visiting every row's edges would make one edited node cost a walk of the clip.\r\n */\r\n private _structureSpans(): NodeSpan[] {\r\n const { owners, below } = this._options;\r\n if (owners === undefined && below === undefined) return this._instance.rowSpans();\r\n const rows = new Set<string>(below?.keys());\r\n for (const key of owners?.keys() ?? []) {\r\n const slash = key.indexOf(\"/\");\r\n rows.add(slash < 0 ? key : key.slice(0, slash));\r\n }\r\n const spans: NodeSpan[] = [];\r\n for (const row of rows) {\r\n const span = this._instance.rowSpan(row);\r\n if (span) spans.push(span);\r\n }\r\n return spans;\r\n }\r\n\r\n private _activeFrames(start: number, duration: number): { from: number; to: number } {\r\n const { fps } = this._options;\r\n const end = start + Math.max(0, duration);\r\n let from = Math.max(0, Math.ceil(start * fps));\r\n while (from > 0 && frameTime(from - 1, fps, Infinity) >= start) from--;\r\n while (frameTime(from, fps, Infinity) < start) from++;\r\n let to = Math.max(-1, Math.floor(end * fps));\r\n while (frameTime(to + 1, fps, Infinity) <= end) to++;\r\n while (to >= 0 && frameTime(to, fps, Infinity) > end) to--;\r\n return { from, to };\r\n }\r\n\r\n private _evaluate(frame: number): void {\r\n this._options.onPhase?.(\"evaluate\");\r\n const seconds = frameTime(frame, this._options.fps, this._instance.duration);\r\n // Clocks move only where the tree can change, and before it does, so a node\r\n // is attached in the state it arrives in. Declarations must not read them.\r\n if (frame > this._walked && (frame === this._start || this._structureFrames.has(frame))) {\r\n this._instance.attach(seconds);\r\n }\r\n this._pseudo.clear();\r\n // Presence moves before the commands run, outside the observer `onWrite` reports through.\r\n observeSlots(this._presenceObserver, () => this._instance.evaluateAt(seconds, (index, slot) => {\r\n if (isPseudo(slot)) this._pseudo.add(slot);\r\n this._commandWrote(index, slot);\r\n }));\r\n\r\n // Presence only moves forward: a frame revisited for a re-queued owner reads\r\n // what it recorded the first time through.\r\n if (frame <= this._walked) return;\r\n if (frame === this._start || this._pseudo.size > 0) this._reconcile(frame);\r\n for (const slot of this._pseudo) {\r\n for (const owner of this._readers.get(slot) ?? []) {\r\n owner.stale = true;\r\n this._queueOwner(owner, frame);\r\n }\r\n }\r\n this._walked = frame;\r\n }\r\n\r\n /** Seed owners that are now mounted, and close the ones that are not. */\r\n private _reconcile(frame: number): void {\r\n const seen = new Set<OwnerState>();\r\n this._instance.forEachOwner((node, key, span) => {\r\n const from = this._limitOf(key);\r\n if (from === undefined) return;\r\n let owner = this._owners.get(key);\r\n if (!owner) {\r\n owner = {\r\n key, node, span, from,\r\n present: false, arrivedAt: -1, arrived: false,\r\n intervals: [], history: [], deps: null, values: [], stale: true,\r\n allDeps: new Set(), scheduled: new Set(), rounds: 0,\r\n };\r\n this._owners.set(key, owner);\r\n }\r\n seen.add(owner);\r\n if (owner.node !== node) {\r\n owner.node = node;\r\n owner.stale = true;\r\n if (owner.present) this._queueOwner(owner, Math.max(frame, owner.from));\r\n }\r\n if (owner.present) return;\r\n owner.present = true;\r\n owner.arrivedAt = Math.max(frame, owner.from);\r\n owner.stale = true;\r\n this._queueOwner(owner, owner.arrivedAt);\r\n if (!owner.arrived) {\r\n owner.arrived = true;\r\n this._options.onArrive?.(node, key, span, frame);\r\n }\r\n });\r\n for (const owner of this._owners.values()) {\r\n if (!owner.present || seen.has(owner)) continue;\r\n if (frame - 1 >= owner.arrivedAt) owner.intervals.push([owner.arrivedAt, frame - 1]);\r\n owner.present = false;\r\n }\r\n }\r\n\r\n /** The first frame `key` may be declared on, or `undefined` when the sweep is limited to others. */\r\n private _limitOf(key: string): number | undefined {\r\n const { owners, below } = this._options;\r\n if (owners === undefined && below === undefined) return this._start;\r\n let from = owners?.get(key);\r\n if (below) {\r\n for (let slash = key.indexOf(\"/\"); slash >= 0; slash = key.indexOf(\"/\", slash + 1)) {\r\n const row = below.get(key.slice(0, slash));\r\n if (row !== undefined && (from === undefined || row < from)) from = row;\r\n }\r\n }\r\n return from;\r\n }\r\n\r\n private _declareDue(frame: number): void {\r\n this._dueTaken = true;\r\n const owners = this._due.get(frame);\r\n this._due.delete(frame);\r\n if (this._options.declare === false) return;\r\n for (const owner of owners ?? []) {\r\n if (owner.error || this._rewound.has(owner) || !presentAt(owner, frame)) continue;\r\n if (!owner.stale && unchanged(owner)) continue;\r\n this._declare(owner, frame);\r\n }\r\n // A rewound owner comes back to this frame after the ones it missed, so its history stays in frame order.\r\n for (const owner of this._rewound) this._queueOwner(owner, frame);\r\n this._rewound.clear();\r\n }\r\n\r\n private _declare(owner: OwnerState, frame: number): void {\r\n this._options.onPhase?.(\"declare\");\r\n const node = owner.node;\r\n const reads = new Set<PropSlot<unknown>>();\r\n const writes: PropSlot<unknown>[] = [];\r\n let lastRead: PropSlot<unknown> | undefined;\r\n let readLayout = false;\r\n let readClock = false;\r\n const bind = this._options.bindSubtree ?? ((sub: Node) => bindDetached(node, sub));\r\n const declaration = new AssetDeclaration(this._options.catalog, {\r\n bindSubtree: (sub) => unobserved(() => bind(sub)),\r\n });\r\n\r\n try {\r\n observeSlots({\r\n read: (slot) => {\r\n reads.add(slot);\r\n lastRead = slot;\r\n if (slot._name === LAYOUT_SLOT) readLayout = true;\r\n },\r\n write: (slot) => { writes.push(slot); },\r\n clock: () => { readClock = true; },\r\n }, () => declareNode(node, declaration));\r\n } catch (err) {\r\n const e = err instanceof Error ? err : new Error(String(err));\r\n owner.error = { message: e.message, stack: e.stack, ...(lastRead && { prop: slotLabel(lastRead) }) };\r\n return;\r\n }\r\n\r\n if (this._dev) {\r\n const type = node.constructor.name;\r\n if (writes.length > 0) {\r\n const labels = [...new Set(writes.map(slotLabel))].join(\", \");\r\n warnOnce(`${type}:write:${labels}`,\r\n `[assets] ${type} wrote ${labels} while declaring its assets. A declaration is re-run only ` +\r\n `when something it read changes, so a write there is a frame-order dependency.`);\r\n }\r\n if (readLayout) {\r\n warnOnce(`${type}:layout`,\r\n `[assets] ${type}.declareAssets read layoutBounds. Declarations run without layout; ` +\r\n `decode size follows the draw, so declare the asset without a size.`);\r\n }\r\n if (readClock) {\r\n warnOnce(`${type}:clock`,\r\n `[assets] ${type}.declareAssets read time. Declarations are re-run only when a prop ` +\r\n `they read changes, so anything following the clock is missed between those frames.`);\r\n }\r\n }\r\n\r\n owner.stale = false;\r\n owner.deps = [...reads];\r\n owner.values = owner.deps.map((slot) => slot.get());\r\n for (const slot of reads) {\r\n if (owner.allDeps.has(slot)) continue;\r\n owner.allDeps.add(slot);\r\n let set = this._readers.get(slot);\r\n if (!set) this._readers.set(slot, (set = new Set()));\r\n set.add(owner);\r\n }\r\n\r\n const decls = declaration.declarations;\r\n const previous = owner.history[owner.history.length - 1];\r\n if (!previous || previous.frame < owner.arrivedAt || !sameDecls(previous.decls, decls)) {\r\n owner.history.push({ frame, decls });\r\n }\r\n this._scheduleWriters(owner, frame + 1);\r\n }\r\n\r\n private _scheduleWriters(owner: OwnerState, from: number): void {\r\n for (const slot of owner.deps ?? []) {\r\n const writers = this._writers.get(slot);\r\n if (!writers) continue;\r\n for (const index of writers) {\r\n if (owner.scheduled.has(index)) continue;\r\n owner.scheduled.add(index);\r\n this._forEachDueFrame(this._placed[index], from, (frame) => this._queueOwner(owner, frame));\r\n }\r\n }\r\n }\r\n\r\n /** Every frame a command is active on from `from`, and the first after it ends. */\r\n private _forEachDueFrame(placed: Placed, from: number, visit: (frame: number) => void): void {\r\n const first = Math.max(from, placed.from);\r\n const last = Math.min(this._last, placed.to);\r\n for (let frame = first; frame <= last; frame++) visit(frame);\r\n const after = Math.max(placed.to + 1, placed.from);\r\n if (after >= from && after <= this._last) visit(after);\r\n }\r\n\r\n /**\r\n * A command wrote a slot compile did not see it write. Its readers may have\r\n * missed every frame of it, so each is re-queued from where the command starts.\r\n */\r\n private _commandWrote(index: number, slot: PropSlot<unknown>): void {\r\n const placed = this._placed[index];\r\n if (!placed || placed.writes.has(slot)) return;\r\n placed.writes.add(slot);\r\n this._addWriter(slot, index);\r\n\r\n if (this._dev) {\r\n warnOnce(`command:${placed.id}:${slotLabel(slot)}`,\r\n `[assets] Command ${placed.id} wrote ${slotLabel(slot)} at frame ${this._frame}, which compile did not ` +\r\n `record it writing. Owners reading it are re-declared over the command's span.`);\r\n }\r\n for (const owner of this._readers.get(slot) ?? []) this._requeue(owner, Math.max(placed.from, owner.from), placed.id);\r\n }\r\n\r\n private _requeue(owner: OwnerState, from: number, commandId: string): void {\r\n if (owner.error) return;\r\n if (from > this._frame) {\r\n this._scheduleWriters(owner, from);\r\n return;\r\n }\r\n if (from === this._frame) {\r\n this._queueOwner(owner, from);\r\n return;\r\n }\r\n if (owner.rounds >= MAX_REQUEUES) {\r\n if (this._dev) {\r\n warnOnce(`requeue:${owner.key}`,\r\n `[assets] ${owner.key} was re-queued ${MAX_REQUEUES} times (last by command ${commandId}); ` +\r\n `its asset windows may be incomplete.`);\r\n }\r\n return;\r\n }\r\n owner.rounds++;\r\n owner.history = owner.history.filter((entry) => entry.frame < from);\r\n owner.stale = true;\r\n owner.scheduled.clear();\r\n // Every presence interval that starts in reach lost its arrival declaration too.\r\n this._queueOwner(owner, from);\r\n for (const [start] of owner.intervals) if (start > from) this._queueOwner(owner, start);\r\n if (owner.present && owner.arrivedAt > from) this._queueOwner(owner, owner.arrivedAt);\r\n // Presence and structure were only watched going forward; revisit their frames in reach.\r\n if (owner.deps?.some(isPseudo)) {\r\n for (const frame of this._structureFrames) {\r\n if (frame >= from && frame <= this._walked) this._queueOwner(owner, frame);\r\n }\r\n }\r\n this._rewound.add(owner);\r\n }\r\n\r\n private _addWriter(slot: PropSlot<unknown>, index: number): void {\r\n const list = this._writers.get(slot);\r\n if (list) list.push(index);\r\n else this._writers.set(slot, [index]);\r\n }\r\n\r\n private _structureFrame(frame: number): void {\r\n if (frame <= this._start || frame > this._last) return;\r\n this._structureFrames.add(frame);\r\n this._enqueue(frame);\r\n }\r\n\r\n private _queueOwner(owner: OwnerState, frame: number): void {\r\n if (frame > this._last) return;\r\n let set = this._due.get(frame);\r\n if (!set) this._due.set(frame, (set = new Set()));\r\n set.add(owner);\r\n this._enqueue(frame);\r\n }\r\n\r\n private _enqueue(frame: number): void {\r\n if (this._queued.has(frame) || (frame === this._frame && !this._dueTaken)) return;\r\n this._queued.add(frame);\r\n heapPush(this._heap, frame);\r\n }\r\n}\r\n\r\n// ─── Helpers ──────────────────────────────────────────────────────────────────\r\n\r\nfunction isPseudo(slot: PropSlot<unknown>): boolean {\r\n return slot._name === STRUCTURE_SLOT || slot._name.startsWith(PRESENCE_PREFIX);\r\n}\r\n\r\nfunction presentAt(owner: OwnerState, frame: number): boolean {\r\n if (owner.present && frame >= owner.arrivedAt) return true;\r\n for (const [start, end] of owner.intervals) if (frame >= start && frame <= end) return true;\r\n return false;\r\n}\r\n\r\nfunction unchanged(owner: OwnerState): boolean {\r\n const deps = owner.deps;\r\n if (deps === null) return false;\r\n for (let i = 0; i < deps.length; i++) {\r\n if (!Object.is(deps[i].get(), owner.values[i])) return false;\r\n }\r\n return true;\r\n}\r\n\r\nfunction sameDecls(a: ReadonlyMap<string, AssetDecl>, b: ReadonlyMap<string, AssetDecl>): boolean {\r\n if (a.size !== b.size) return false;\r\n for (const [key, decl] of a) {\r\n const other = b.get(key);\r\n if (!other || !sameDecl(decl, other)) return false;\r\n }\r\n return true;\r\n}\r\n\r\n/** A font is its family: the record keeps the first weight, so a weight tween is one segment. */\r\nfunction sameDecl(a: AssetDecl, b: AssetDecl): boolean {\r\n switch (a.type) {\r\n case \"image\": return b.type === \"image\" && a.src === b.src;\r\n case \"video\": return b.type === \"video\" && a.src === b.src && a.trimStart === b.trimStart && a.trimEnd === b.trimEnd;\r\n case \"font\": return b.type === \"font\" && a.family === b.family;\r\n case \"loader\": return b.type === \"loader\" && a.key === b.key && a.load === b.load && a.gate === b.gate;\r\n }\r\n}\r\n\r\n/** An owner's declarations laid over its presence: each key open from the entry that declares it to the one that drops it. */\r\nfunction segmentsOf(history: readonly Declared[], intervals: readonly [number, number][]): AssetSegment[] {\r\n const out: AssetSegment[] = [];\r\n for (const [start, end] of intervals) {\r\n const open = new Map<string, AssetSegment>();\r\n for (const entry of history) {\r\n if (entry.frame < start || entry.frame > end) continue;\r\n for (const [key, segment] of open) {\r\n const next = entry.decls.get(key);\r\n if (next && sameDecl(segment.decl, next)) continue;\r\n out.push({ ...segment, endFrame: entry.frame - 1 });\r\n open.delete(key);\r\n }\r\n for (const [key, decl] of entry.decls) {\r\n if (!open.has(key)) open.set(key, { key, decl, startFrame: entry.frame, endFrame: end });\r\n }\r\n }\r\n for (const segment of open.values()) out.push({ ...segment, endFrame: end });\r\n }\r\n return out;\r\n}\r\n\r\nfunction isDev(): boolean {\r\n return process.env.NODE_ENV !== \"production\";\r\n}\r\n\r\nconst warned = new Set<string>();\r\n\r\nfunction warnOnce(key: string, message: string): void {\r\n if (warned.has(key)) return;\r\n warned.add(key);\r\n console.warn(message);\r\n}\r\n\r\nfunction heapPush(heap: number[], value: number): void {\r\n let i = heap.length;\r\n heap.push(value);\r\n while (i > 0) {\r\n const parent = (i - 1) >> 1;\r\n if (heap[parent] <= value) break;\r\n heap[i] = heap[parent];\r\n i = parent;\r\n }\r\n heap[i] = value;\r\n}\r\n\r\nfunction heapPop(heap: number[]): number | undefined {\r\n if (heap.length === 0) return undefined;\r\n const top = heap[0];\r\n const tail = heap.pop()!;\r\n if (heap.length === 0) return top;\r\n let i = 0;\r\n for (;;) {\r\n const left = 2 * i + 1;\r\n if (left >= heap.length) break;\r\n const right = left + 1;\r\n const child = right < heap.length && heap[right] < heap[left] ? right : left;\r\n if (heap[child] >= tail) break;\r\n heap[i] = heap[child];\r\n i = child;\r\n }\r\n heap[i] = tail;\r\n return top;\r\n}\r\n"]}
|
|
@@ -2,6 +2,7 @@ import { AudioRequest } from "../attributes/audio/request.js";
|
|
|
2
2
|
import { AssetRecord } from "../assets/record.js";
|
|
3
3
|
import type { AssetDecl } from "../assets/scope.js";
|
|
4
4
|
import type { ProjectDocument } from "../document/project.js";
|
|
5
|
+
import type { RenderIssue } from "../render/render-issue.js";
|
|
5
6
|
import type { RuntimeScope } from "./clip-instance.js";
|
|
6
7
|
import { ClipStore } from "./clip-store.js";
|
|
7
8
|
import { type AssetTrack } from "./project-assets.js";
|
|
@@ -15,6 +16,15 @@ export interface BuildError {
|
|
|
15
16
|
nodeId?: string;
|
|
16
17
|
/** The last prop that declaration read, as `slotLabel` spells it. */
|
|
17
18
|
prop?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Present when the build stepped around the problem rather than failing: a
|
|
21
|
+
* row of an unregistered type built as an empty placeholder (`nodeId`), or a
|
|
22
|
+
* command no node publishes, skipped (`commandId`). The rest of the clip draws.
|
|
23
|
+
*/
|
|
24
|
+
code?: "unknown-node-type" | "unknown-command";
|
|
25
|
+
commandId?: string;
|
|
26
|
+
/** Set when the error is a renderer's issue rather than something that threw. */
|
|
27
|
+
issue?: RenderIssue;
|
|
18
28
|
}
|
|
19
29
|
/**
|
|
20
30
|
* What discovering one track's clip learned, in **clip-local** frames — so a pass
|