@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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @motionscript/core
|
|
2
2
|
|
|
3
|
+
## 0.1.0-alpha.8
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ba03011: WebGPU renderer replaces Skia, @motionscript/renderer is new, skia-render/canvaskit are gone, and it’s breaking
|
|
8
|
+
|
|
9
|
+
## 0.1.0-alpha.7
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 5941d52: The class versions of the built-in node types are gone. Every built-in has been a component for a while; core kept the old classes only to compare against. Removed from `@motionscript/core`: `PaintNode`, `ShapeNode`, `BoundsShape`, `TextBase`, `applyTextDefaults`, and the transitional `RectBase`, `EllipseBase`, `PathBase`, `PathShapeBase`, `PolygonBase`, `PolygramBase`, `VideoBase`, `Mesh3DBase` and `Canvas3DBase`. Build on the components (`Rect`, `Text`, `Mesh3D`, `Canvas3D`, ...) and the modules (`Paint`, `Flow`, `Shapes`, `Typeface`, `TextLayout`, `Material`, `View3D`) instead. `Canvas2D` and the `Node`, `Node2D`, `Node3D` and `NodeAudio` bases stay.
|
|
14
|
+
|
|
15
|
+
No `@motionscript/sdk` export is removed: the props types (`RectProps`, `TextProps`, `Mesh3DProps`, ...) are unchanged and now live beside their components. `ModelView3D` is a component rather than a `Model3D` subclass, so `instanceof Model3D` no longer holds for it. `TextSelection` now takes any `TextSelectionHost` rather than the removed `Text` class.
|
|
16
|
+
|
|
17
|
+
- 737f7d0: What was left of the class authoring system is gone. Each piece existed to write or extend a node class, and a node type is a component now; no built-in, kit or host used them.
|
|
18
|
+
|
|
19
|
+
Removed from `@motionscript/core`:
|
|
20
|
+
|
|
21
|
+
- the registration functions `property`, `node`, `command` and `withdraw`, and the thirteen typed property helpers (`fillProperty`, `strokeProperty`, `shadowProperty`, `effectsProperty`, `colorProperty`, `cornerRadiusProperty`, `cornerStyleProperty`, `pathProperty`, `insetsProperty`, `alignmentProperty`, `vector2Property`, `sizeProperty`, `textProperty`) with their `AttributePropOptions` type. A component declares its entries with `Types`. `getPropertyMeta`, `getNodeDescriptor`, `getCommandMeta` and the metadata types stay;
|
|
22
|
+
- `TextSelection`, `TextSelectionHost`, `TextSelectionProps`, `TextRange`, `SelectionOverrides` and `normalizeRanges`: the component `Text` has no selection API, so nothing could make one. Style a range with `runs`;
|
|
23
|
+
- `AudioScope` and the `declareAudio` hook on `Node`: sound plays from commands (`timeline.sound`). `busPathOf` and `busPathTo` take a function answering a node's span instead of an `AudioScope`;
|
|
24
|
+
- the `Node.tick` hook and the `Node2D` hooks `beforeRender`, `afterRender`, `renderStroke`, `clipPathSelf`, `resolveSizeInput` and `constraints`, which only a subclass could reach;
|
|
25
|
+
- `NodeTypeRecord.withdrawn` and `CommandMeta.withdrawn`. `PropertyMeta.withdrawn` stays, deprecated: nothing sets it.
|
|
26
|
+
|
|
27
|
+
Removed from `@motionscript/core/component`, and so from `@motionscript/sdk/component` and `@motionscript/charts/kit`, which re-export it: the seekable composition `at`, `hold`, `sequence` and `together`, with the `Seekable` and `Placed` types. A component command returns timeline pieces.
|
|
28
|
+
|
|
29
|
+
Removed from `@motionscript/sdk`: `TextSelection`, `TextSelectionProps`, `TextRange`, `SelectionOverrides`, `AudioScope` and `AudioClip`.
|
|
30
|
+
|
|
31
|
+
- 17f9883: Core no longer ships its JSX runtime: its `./jsx/jsx-runtime` and `./jsx/jsx-dev-runtime` subpaths are gone, and so are the `jsx`, `jsxs`, `Fragment` and `JSX` the root barrel re-exported. Build a tree with calls (`Rect({ children: [Text({ text: "hi" })] })`), as a component does. Nothing in the engine uses decorator syntax any more either, so no consumer needs `experimentalDecorators` on core's account.
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- 17f9883: Three fixes for components. A component frame (a `Rect`, or any component laid out by `Flow`) answers where a dropped node lands, so `reparentPlacementAt` into one gives a placement instead of `null`. `View3D.load(loader, extend)` takes the `extend` a viewport's render draws with and declares what it draws, so its textures and models load before the frame; math's `axes3d` passes its axes. `ref` is typed on component calls as the node the call builds, accepting a ref of any supertype.
|
|
36
|
+
|
|
3
37
|
## 0.1.0-alpha.6
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/NOTICE
CHANGED
|
@@ -4,24 +4,25 @@ Copyright 2026 Motionscript LLC
|
|
|
4
4
|
This product includes the third-party code below, each part under the MIT
|
|
5
5
|
License reproduced at the end of this file.
|
|
6
6
|
|
|
7
|
-
- packages/
|
|
8
|
-
Sine" by David Hoskins (https://www.shadertoy.com/view/4djSRW).
|
|
7
|
+
- packages/renderer/crates/renderer/src/shaders/prim.wgsl (`fn_hash2`):
|
|
8
|
+
"Hash without Sine" by David Hoskins (https://www.shadertoy.com/view/4djSRW).
|
|
9
9
|
Copyright (c) 2014 David Hoskins.
|
|
10
10
|
|
|
11
|
-
- packages/
|
|
12
|
-
|
|
13
|
-
Copyright (c) 2013 Inigo Quilez.
|
|
11
|
+
- packages/renderer/crates/renderer/src/shaders/prim.wgsl (`simplex_noise`): "Noise - simplex - 2D" by Inigo Quilez
|
|
12
|
+
(https://www.shadertoy.com/view/Msf3WH). Copyright (c) 2013 Inigo Quilez.
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
(https://github.com/ashima/webgl-noise). Copyright (C) 2011 by Ashima Arts.
|
|
14
|
+
- packages/renderer/crates/render3d (in @motionscript/renderer's WebAssembly):
|
|
15
|
+
its shaders (src/shaders/mesh.wgsl) port three.js r185's mesh programs and
|
|
16
|
+
src/geometry.rs its primitive generators (https://threejs.org).
|
|
17
|
+
Copyright (c) 2010-2026 three.js authors.
|
|
20
18
|
|
|
21
|
-
@motionscript/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
packages/
|
|
19
|
+
@motionscript/renderer's WebAssembly (dist/ms_renderer_bg.wasm) compiles in
|
|
20
|
+
Rust crates under MIT, Apache-2.0, Zlib and Unicode-3.0 terms (wgpu, naga,
|
|
21
|
+
harfrust, read-fonts, kurbo, wasm-bindgen and others); their notices are in
|
|
22
|
+
packages/renderer/THIRD_PARTY_NOTICES.txt.
|
|
23
|
+
|
|
24
|
+
MP3 export loads @mediabunny/mp3-encoder (MPL-2.0), a WebAssembly build of
|
|
25
|
+
the LAME MP3 encoder (LGPL, https://lame.sourceforge.io), on first use.
|
|
25
26
|
|
|
26
27
|
The browser builds under dist/browser/ bundle each package's npm dependencies;
|
|
27
28
|
dist/browser/THIRD_PARTY_LICENSES.txt in each package lists them with their
|
package/README.md
CHANGED
|
@@ -37,21 +37,19 @@ function of its time, so a seek costs the same in either direction.
|
|
|
37
37
|
play, seek and export it.
|
|
38
38
|
- **Nodes**: the scene graph (`Rect`, `Ellipse`, `Text`, `RichText`, `Video`,
|
|
39
39
|
paths, 3D, audio, and more) with attributes for fills, gradients, filters, and
|
|
40
|
-
|
|
41
|
-
any document it opens can name it.
|
|
40
|
+
WGSL shader effects. A custom node is a component registered with the engine,
|
|
41
|
+
and any document it opens can name it.
|
|
42
42
|
- **Tweens**: interpolation and easing for animating attributes over time.
|
|
43
43
|
- **Layout**: `flowOps`, the flow layout every 2D node runs on its children:
|
|
44
44
|
freeform, runs (wrapped or not) and grid.
|
|
45
|
-
- **JSX runtime**: lets a composite node build its children as TSX
|
|
46
|
-
(`./jsx/jsx-runtime`, `./jsx/jsx-dev-runtime`).
|
|
47
45
|
- **Project / render / platform / assets**: the abstractions a renderer and a
|
|
48
46
|
platform implement to turn a scene graph into pixels, audio, and exported
|
|
49
|
-
video: `RenderContext2D`/`RenderContext3D` (implemented by
|
|
50
|
-
[`@motionscript/
|
|
47
|
+
video: `RenderContext2D`/`RenderContext3D` (implemented by the WebGPU renderer
|
|
48
|
+
[`@motionscript/renderer`](https://github.com/motionscript-dev/motionscript/tree/main/packages/renderer)) and the `platform` seams (filled
|
|
51
49
|
in by [`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser)).
|
|
52
50
|
|
|
53
51
|
This package has no rendering backend of its own. Pair it with
|
|
54
|
-
[`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser) (
|
|
52
|
+
[`@motionscript/browser`](https://github.com/motionscript-dev/motionscript/tree/main/packages/browser) (WebGPU) or build your own backend
|
|
55
53
|
against the `platform`/`render` abstractions.
|
|
56
54
|
|
|
57
55
|
## Docs
|
package/dist/assets/errors.js
CHANGED
|
@@ -33,11 +33,10 @@ export class AssetNotLoadedError extends Error {
|
|
|
33
33
|
this.src = src;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
/** How to declare an asset of `assetType`: the scope method, or
|
|
36
|
+
/** How to declare an asset of `assetType`: the scope method, or a command's sound. */
|
|
37
37
|
function declareHint(assetType) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return `Declare it from the node's ${how}, so the asset timeline loads it before this frame draws.`;
|
|
38
|
+
if (assetType === "audio")
|
|
39
|
+
return "Play it from a command (`timeline.sound(...)`), so the asset timeline loads it before this frame draws.";
|
|
40
|
+
return `Declare it from the node's declareAssets() (e.g. assets.${assetType}(...)), so the asset timeline loads it before this frame draws.`;
|
|
42
41
|
}
|
|
43
42
|
//# sourceMappingURL=errors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/assets/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACjC,SAAS,CAAY;IACrB,GAAG,CAAS;IACrB,6EAA6E;IAC7E,MAAM,CAAU;IAEhB,YAAY,SAAoB,EAAE,GAAW,EAAE,IAAa;QACxD,KAAK,CAAC,GAAG,SAAS,WAAW,GAAG,mBAAmB,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/assets/errors.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IACjC,SAAS,CAAY;IACrB,GAAG,CAAS;IACrB,6EAA6E;IAC7E,MAAM,CAAU;IAEhB,YAAY,SAAoB,EAAE,GAAW,EAAE,IAAa;QACxD,KAAK,CAAC,GAAG,SAAS,WAAW,GAAG,mBAAmB,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxF,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;QAClC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACnB,CAAC;CACJ;AAED,sFAAsF;AACtF,SAAS,WAAW,CAAC,SAAoB;IACrC,IAAI,SAAS,KAAK,OAAO;QAAE,OAAO,yGAAyG,CAAC;IAC5I,OAAO,2DAA2D,SAAS,iEAAiE,CAAC;AACjJ,CAAC","sourcesContent":["import type { AssetType } from \"./record\";\r\n\r\n/**\r\n * A frame reached for an asset that was never loaded.\r\n *\r\n * This is the counterweight to declared asset tracking. A node states what it\r\n * needs from `Node.declareAssets`; if it\r\n * misses something, the renderer finds nothing when it goes to paint. The old\r\n * inference pass could not really get this wrong — it discovered assets *from*\r\n * the draw calls, so anything drawn was by construction requested — and the\r\n * fills were written to match: a missing decode returned `false` and the layer\r\n * was quietly skipped.\r\n *\r\n * Under declarations that leniency is the wrong default. A skipped layer is a\r\n * frame that renders *almost* right, with a photo missing or a heading in the\r\n * fallback face, on a node that may only appear seconds in and only on a cold\r\n * load. Throwing turns a silent visual gap into a located failure: during precomp\r\n * it is caught per scene and surfaces as a `BuildError` in the errors panel, and\r\n * at playback it stops the frame rather than shipping a wrong one.\r\n *\r\n * It means \"declared but not loaded, or never declared\". It deliberately does\r\n * **not** cover a *time-varying* miss — a video frame the decode window has not\r\n * reached yet is an asset that loaded fine, and `warmPendingVideo` already exists\r\n * to settle those; those paths still paint the nearest decoded frame.\r\n */\r\nexport class AssetNotLoadedError extends Error {\r\n readonly assetType: AssetType;\r\n readonly src: string;\r\n /** The innermost drawing node, stamped by `Node2D.render` on the way out. */\r\n nodeId?: string;\r\n\r\n constructor(assetType: AssetType, src: string, hint?: string) {\r\n super(`${assetType} asset \"${src}\" is not loaded. ` + (hint ?? declareHint(assetType)));\r\n this.name = \"AssetNotLoadedError\";\r\n this.assetType = assetType;\r\n this.src = src;\r\n }\r\n}\r\n\r\n/** How to declare an asset of `assetType`: the scope method, or a command's sound. */\r\nfunction declareHint(assetType: AssetType): string {\r\n if (assetType === \"audio\") return \"Play it from a command (`timeline.sound(...)`), so the asset timeline loads it before this frame draws.\";\r\n return `Declare it from the node's declareAssets() (e.g. assets.${assetType}(...)), so the asset timeline loads it before this frame draws.`;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAc,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE3E;;;GAGG;AACH,qBAAa,YAAY;IAuCjB,OAAO,CAAC,QAAQ,CAAC,OAAO;IAtC5B,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAY;IAExC,sFAAsF;IACtF,OAAO,CAAC,mBAAmB,CAAqB;IAChD,OAAO,CAAC,aAAa,CAAyC;IAC9D,OAAO,CAAC,aAAa,CAAoC;IACzD;;;;;;;OAOG;IACH,OAAO,CAAC,WAAW,CAA8B;IACjD,8DAA8D;IAC9D,OAAO,CAAC,aAAa,CAAqB;IAC1C,4FAA4F;IAC5F,OAAO,CAAC,aAAa,CAAkC;IACvD,+EAA+E;IAC/E,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAS;IAEzB,0EAA0E;IAC1E,OAAO,CAAC,eAAe,CAA+B;IACtD,8EAA8E;IAC9E,OAAO,CAAC,cAAc,CAAoC;IAE1D;;;OAGG;gBAEC,OAAO,EAAE,mBAAmB,EAC5B,cAAc,EAAE,cAAc,EAC9B,WAAW,EAAE,SAAS,EACL,OAAO,GAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAkE;IAUlH;;;;;;;OAOG;IACH,UAAU,CAAC,OAAO,EAAE,mBAAmB,GAAG,IAAI;IAS9C;;;OAGG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAkB1C,0EAA0E;IAC1E,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI7B;;;OAGG;IACG,WAAW,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjE;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAgB7B;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;IAqBlB,6DAA6D;IAC7D,OAAO,CAAC,SAAS;IAqBjB,oEAAoE;IACpE,OAAO,IAAI,IAAI;IAOf;;;OAGG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAwE9B,0FAA0F;IAC1F,OAAO,CAAC,SAAS;IAMjB,2EAA2E;IAC3E,OAAO,CAAC,WAAW;CAMtB"}
|
package/dist/assets/manager.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { busStopKey } from "../attributes/audio/request.js";
|
|
2
|
-
import {
|
|
2
|
+
import { effectsKey } from "../attributes/audio/effects/union.js";
|
|
3
|
+
import { paramKey } from "../attributes/audio/ramp.js";
|
|
4
|
+
import { transitionKey } from "../attributes/audio/transition.js";
|
|
3
5
|
/**
|
|
4
6
|
* Coordinates asset loading and audio synchronization during playback.
|
|
5
7
|
* Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.
|
|
@@ -275,16 +277,16 @@ function layoutGatesOf(precomp) {
|
|
|
275
277
|
const NO_DISPOSE = () => { };
|
|
276
278
|
/**
|
|
277
279
|
* Produce a deterministic string key that uniquely identifies an audio request's
|
|
278
|
-
* playback identity. Includes the
|
|
279
|
-
*
|
|
280
|
-
* rebuilds the graph
|
|
280
|
+
* playback identity. Includes the effect chain, the ramps and the transitions so
|
|
281
|
+
* editing any of them changes the id — the device then stops the stale source and
|
|
282
|
+
* rebuilds the graph instead of reusing the old one.
|
|
281
283
|
*
|
|
282
284
|
* The bus chain is in for the same reason: re-routing a clip to a different bus,
|
|
283
285
|
* or changing a bus's level or its span, changes what it sounds like without
|
|
284
286
|
* changing anything else here — so leaving it out would keep the stale graph.
|
|
285
287
|
*/
|
|
286
288
|
function stableKey(req, clipOffsetSecs) {
|
|
287
|
-
return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? "_"}|${req.loop ? 1 : 0}|${req.volume}|${
|
|
289
|
+
return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? "_"}|${req.loop ? 1 : 0}|${paramKey(req.volume)}|${paramKey(req.speed)}|${req.sourceLength ?? "_"}|${effectsKey(req.effects)}|${transitionKey(req.transitionIn)}|${transitionKey(req.transitionOut)}|${busKey(req.bus)}`;
|
|
288
290
|
}
|
|
289
291
|
/** The bus chain's contribution to {@link stableKey}. */
|
|
290
292
|
function busKey(bus) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../src/assets/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAM9D;;;GAGG;AACH,MAAM,OAAO,YAAY;IAuCA;IAtCb,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/attributes/audio/request\";\r\nimport { filtersKey } from \"@/attributes/audio/filters/union\";\r\nimport { AssetRecord, Disposer, LoaderFn } from \"@/assets/record\";\r\nimport { AudioSink } from \"@/platform/audio-sink\";\r\nimport { StorageAdapter } from \"@/platform/storage-adapter\";\r\nimport { AssetTrack, AssetTimelineResult } from \"@/runtime/asset-timeline\";\r\n\r\n/**\r\n * Coordinates asset loading and audio synchronization during playback.\r\n * Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.\r\n */\r\nexport class AssetManager {\r\n private precomp: AssetTimelineResult;\r\n private readonly storageAdapter: StorageAdapter;\r\n private readonly audioDevice: AudioSink;\r\n\r\n /** `null` after a swap: whatever the device holds belongs to the previous precomp. */\r\n private lastAudioRequestKey: string | null = \"\";\r\n private lastAudioSrcs: ReadonlySet<string> | null = new Set();\r\n private audioFetching = new Map<string, Promise<void>>();\r\n /**\r\n * Sources whose fetch or decode failed, with why, so they are not fetched\r\n * again every sync. A source leaves when no request in the window names it\r\n * any more — and, once it has been reported, when a new precomp arrives —\r\n * so the next time it is wanted it is tried afresh. One that failed quietly\r\n * (see {@link AudioRequest.optional}) is kept across a precomp: a video with\r\n * no audio track would otherwise be fetched whole on every edit.\r\n */\r\n private audioFailed = new Map<string, unknown>();\r\n /** The failed sources already reported to {@link onError}. */\r\n private audioReported = new Set<string>();\r\n /** Sources a request in the last window asked for by name, not as a picture's own sound. */\r\n private audioRequired: ReadonlySet<string> = new Set();\r\n /** Keys of the loaders a track measures against, which no window may evict. */\r\n private layoutGateKeys: ReadonlySet<string>;\r\n private disposed = false;\r\n\r\n /** Disposers for loaders whose load has resolved, keyed by loader key. */\r\n private loaderDisposers = new Map<string, Disposer>();\r\n /** In-flight loader runs, keyed by loader key, to dedupe concurrent calls. */\r\n private loaderInFlight = new Map<string, Promise<void>>();\r\n\r\n /**\r\n * @param onError Told once per source when audio a request asked for cannot\r\n * be fetched or decoded. Defaults to `console.error`.\r\n */\r\n constructor(\r\n precomp: AssetTimelineResult,\r\n storageAdapter: StorageAdapter,\r\n audioDevice: AudioSink,\r\n private readonly onError: (error: Error) => void = (error) => console.error(`[AssetManager] ${error.message}`),\r\n ) {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n this.storageAdapter = storageAdapter;\r\n this.audioDevice = audioDevice;\r\n }\r\n\r\n // ─── Public surface ───────────────────────────────────────────────────────\r\n\r\n /**\r\n * Swap in a new precomp result (a document swap). The manager keeps its\r\n * warm loader disposers and in-flight audio fetches so a single-track edit\r\n * doesn't re-fetch unchanged assets; the next loadAt/syncAudio picks up the\r\n * new asset windows. Resetting the audio signature forces a reschedule so a\r\n * changed track's audio is re-evaluated against the new timeline — including\r\n * into an empty window, which is how removed audio stops.\r\n */\r\n setPrecomp(precomp: AssetTimelineResult): void {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n for (const src of this.audioReported) this.audioFailed.delete(src);\r\n this.audioReported.clear();\r\n this.lastAudioRequestKey = null;\r\n this.lastAudioSrcs = null;\r\n }\r\n\r\n /**\r\n * Blocking load for seek and initial render. Waits for every asset whose\r\n * cacheAt <= frame and endFrame >= frame to be ready, then schedules audio.\r\n */\r\n async loadAt(frame: number): Promise<void> {\r\n const jobs: Promise<void>[] = [];\r\n\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n const job = this.syncLoader(key, track, frame);\r\n if (job) jobs.push(job);\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n jobs.push(this.storageAdapter.loadAsset(key, track.record));\r\n }\r\n }\r\n\r\n await Promise.all(jobs);\r\n if (this.audioDevice.schedulesAudio) this.syncAudio(frame);\r\n }\r\n\r\n /** Whether `key` — a loader key or a stored asset's — is resident now. */\r\n isReady(key: string): boolean {\r\n return this.loaderDisposers.has(key) || this.storageAdapter.isLoaded(key);\r\n }\r\n\r\n /**\r\n * Load `records` whatever their windows say — for layout gates, which must be\r\n * resident before a track measures regardless of the frame being drawn.\r\n */\r\n async loadRecords(records: readonly AssetRecord[]): Promise<void> {\r\n await Promise.all(records.map((record) => record.type === 'loader'\r\n ? this.runLoader(record.src, record.load)\r\n : this.storageAdapter.loadAsset(record.src, record)));\r\n }\r\n\r\n /**\r\n * Non-blocking incremental prefetch called after each render tick. Fires\r\n * loads for assets whose cacheAt window has been reached without blocking.\r\n */\r\n prefetch(frame: number): void {\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n this.syncLoader(key, track, frame)?.catch(err => {\r\n console.error(`[AssetManager] loader failed for ${key}:`, err);\r\n });\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n this.storageAdapter.loadAsset(key, track.record).catch(err => {\r\n console.error(`[AssetManager] prefetch failed for ${key}:`, err);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Drive a single loader track toward the state `frame` requires. If `frame`\r\n * is inside the loader's `[cacheAt, discardAt]` window, run its callback\r\n * (deduped — at most one in-flight run, skipped once loaded) and return the\r\n * pending job, if any. If `frame` is outside the window and the loader was\r\n * loaded, dispose it. Returns the in-flight load promise so a blocking\r\n * caller can await it; `undefined` when there's nothing to wait for.\r\n */\r\n private syncLoader(key: string, track: AssetTrack, frame: number): Promise<void> | undefined {\r\n if (track.record.type !== 'loader') return undefined;\r\n const discardAt = track.discardAt ?? Infinity;\r\n const inWindow = track.cacheAt <= frame && frame <= discardAt;\r\n\r\n if (!inWindow) {\r\n // A layout gate is loaded by `loadRecords` whatever frame is drawn, so\r\n // its window says nothing about when it may go: disposing it here made\r\n // `isReady` false and the next frame load it again.\r\n if (this.layoutGateKeys.has(key)) return undefined;\r\n const dispose = this.loaderDisposers.get(key);\r\n if (dispose) {\r\n this.loaderDisposers.delete(key);\r\n dispose();\r\n }\r\n return undefined;\r\n }\r\n\r\n return this.runLoader(key, track.record.load);\r\n }\r\n\r\n /** Run a loader unless it is resident or already running. */\r\n private runLoader(key: string, load: LoaderFn): Promise<void> | undefined {\r\n // Already loaded for this window, or a run is already in flight.\r\n if (this.loaderDisposers.has(key)) return undefined;\r\n const existing = this.loaderInFlight.get(key);\r\n if (existing) return existing;\r\n\r\n const job = load()\r\n .then(disposer => {\r\n // A loader that resolves nothing is keeping its result resident on\r\n // purpose (see `LoaderFn`). Recording a no-op disposer rather than\r\n // skipping the entry is what keeps `loaderDisposers.has(key)` the\r\n // single \"already loaded\" test for both kinds.\r\n this.loaderDisposers.set(key, disposer ?? NO_DISPOSE);\r\n })\r\n .finally(() => {\r\n this.loaderInFlight.delete(key);\r\n });\r\n this.loaderInFlight.set(key, job);\r\n return job;\r\n }\r\n\r\n /** Run every outstanding loader disposer and clear loader state. */\r\n dispose(): void {\r\n for (const dispose of this.loaderDisposers.values()) dispose();\r\n this.loaderDisposers.clear();\r\n this.loaderInFlight.clear();\r\n this.disposed = true;\r\n }\r\n\r\n /**\r\n * Push the current audio working set to the AudioSink. Called after each\r\n * render tick so the device stays in sync with the tracks' audio requests.\r\n */\r\n syncAudio(frame: number): void {\r\n const currentTime = frame / this.precomp.fps;\r\n\r\n const inWindow: AudioRequest[] = [];\r\n const srcs = new Set<string>();\r\n const required = new Set<string>();\r\n const seen = new Set<string>();\r\n\r\n /** Admit `req` if it overlaps the scheduling window, shifted by its owner's offset. */\r\n const consider = (req: AudioRequest, offsetSecs: number): void => {\r\n const globalStart = offsetSecs + req.startAt;\r\n const globalEnd = offsetSecs + req.endAt;\r\n\r\n if (globalEnd < currentTime || globalStart > currentTime + 10) return;\r\n // Ahead of the dedupe: the flag is not part of a request's identity.\r\n if (!req.optional) required.add(req.src);\r\n\r\n const stableId = stableKey(req, offsetSecs);\r\n if (seen.has(stableId)) return;\r\n seen.add(stableId);\r\n\r\n inWindow.push({\r\n ...req,\r\n id: stableId,\r\n startAt: globalStart,\r\n endAt: globalEnd,\r\n // A bus's span is in its request's seconds, so it moves with it.\r\n ...(req.bus && {\r\n bus: req.bus.map((s) => ({ ...s, startAt: offsetSecs + s.startAt, endAt: offsetSecs + s.endAt })),\r\n }),\r\n });\r\n srcs.add(req.src);\r\n };\r\n\r\n for (const track of this.precomp.tracks) {\r\n const offsetSecs = track.startFrame / this.precomp.fps;\r\n for (const req of track.audioRequests) consider(req, offsetSecs);\r\n }\r\n\r\n this.audioRequired = required;\r\n for (const src of srcs) {\r\n if (!this.audioDevice.has(src) && !this.audioFetching.has(src) && !this.audioFailed.has(src)) {\r\n const job = this.storageAdapter.fetchAudioData(src)\r\n .then(data => this.audioDevice.append(src, data))\r\n .catch(cause => this.failAudio(src, cause))\r\n .finally(() => this.audioFetching.delete(src));\r\n this.audioFetching.set(src, job);\r\n }\r\n }\r\n // A failed source nothing asks for any more is forgotten, so wanting it\r\n // again later tries it afresh; one that failed quietly is reported when\r\n // a request that asks for its sound arrives.\r\n for (const [src, cause] of this.audioFailed) {\r\n if (!srcs.has(src)) {\r\n this.audioFailed.delete(src);\r\n this.audioReported.delete(src);\r\n } else if (required.has(src)) {\r\n this.reportAudio(src, cause);\r\n }\r\n }\r\n\r\n const requestKey = audioSignature(inWindow);\r\n if (requestKey !== this.lastAudioRequestKey) {\r\n this.audioDevice.schedule(inWindow);\r\n this.lastAudioRequestKey = requestKey;\r\n }\r\n if (this.lastAudioSrcs === null || !setsEqual(this.lastAudioSrcs, srcs)) {\r\n this.audioDevice.retain(srcs);\r\n this.lastAudioSrcs = srcs;\r\n }\r\n }\r\n\r\n /** Record that `src` could not be loaded, and say so if a request asked for its sound. */\r\n private failAudio(src: string, cause: unknown): void {\r\n if (this.disposed) return;\r\n this.audioFailed.set(src, cause);\r\n if (this.audioRequired.has(src)) this.reportAudio(src, cause);\r\n }\r\n\r\n /** Say that `src` could not be loaded, once, until it is wanted afresh. */\r\n private reportAudio(src: string, cause: unknown): void {\r\n if (this.audioReported.has(src)) return;\r\n this.audioReported.add(src);\r\n const message = cause instanceof Error ? cause.message : String(cause);\r\n this.onError(new Error(`audio \"${src}\" could not be loaded: ${message}`, { cause }));\r\n }\r\n}\r\n\r\n// ─── Helpers ──────────────────────────────────────────────────────────────────\r\n\r\n/** Every layout-gate key any track of `precomp` declares. */\r\nfunction layoutGatesOf(precomp: AssetTimelineResult): ReadonlySet<string> {\r\n const keys = new Set<string>();\r\n for (const track of precomp.tracks) for (const key of track.layoutGates ?? []) keys.add(key);\r\n return keys;\r\n}\r\n\r\n/** Stand-in for a loader that resolved nothing — see the note in {@link AssetManager.syncLoader}. */\r\nconst NO_DISPOSE: Disposer = () => { };\r\n\r\n/**\r\n * Produce a deterministic string key that uniquely identifies an audio request's\r\n * playback identity. Includes the filter chain (via {@link filtersKey}) so editing a\r\n * filter/volume curve changes the id — the device then stops the stale source and\r\n * rebuilds the graph with the new filters instead of reusing the old one.\r\n *\r\n * The bus chain is in for the same reason: re-routing a clip to a different bus,\r\n * or changing a bus's level or its span, changes what it sounds like without\r\n * changing anything else here — so leaving it out would keep the stale graph.\r\n */\r\nfunction stableKey(req: AudioRequest, clipOffsetSecs: number): string {\r\n return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? \"_\"}|${req.loop ? 1 : 0}|${req.volume}|${filtersKey(req.filters)}|${busKey(req.bus)}`;\r\n}\r\n\r\n/** The bus chain's contribution to {@link stableKey}. */\r\nfunction busKey(bus: AudioRequest[\"bus\"]): string {\r\n if (!bus || bus.length === 0) return \"\";\r\n return bus.map(busStopKey).join(\">\");\r\n}\r\n\r\n/** Produce a stable hash of the active audio request set to detect scheduling changes. */\r\nfunction audioSignature(reqs: readonly AudioRequest[]): string {\r\n if (reqs.length === 0) return \"\";\r\n return reqs.map(r => r.id).sort().join(\"\\n\");\r\n}\r\n\r\n/** Shallow equality check for two string sets (order-independent). */\r\nfunction setsEqual(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\r\n if (a.size !== b.size) return false;\r\n for (const v of a) if (!b.has(v)) return false;\r\n return true;\r\n}\r\n"]}
|
|
1
|
+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AK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,sEAAsE;AACtE,SAAS,SAAS,CAAC,CAAsB,EAAE,CAAsB;IAC7D,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACpC,KAAK,MAAM,CAAC,IAAI,CAAC;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IAC/C,OAAO,IAAI,CAAC;AAChB,CAAC","sourcesContent":["import { AudioRequest, busStopKey } from \"@/attributes/audio/request\";\r\nimport { effectsKey } from \"@/attributes/audio/effects/union\";\r\nimport { paramKey } from \"@/attributes/audio/ramp\";\r\nimport { transitionKey } from \"@/attributes/audio/transition\";\r\nimport { AssetRecord, Disposer, LoaderFn } from \"@/assets/record\";\r\nimport { AudioSink } from \"@/platform/audio-sink\";\r\nimport { StorageAdapter } from \"@/platform/storage-adapter\";\r\nimport { AssetTrack, AssetTimelineResult } from \"@/runtime/asset-timeline\";\r\n\r\n/**\r\n * Coordinates asset loading and audio synchronization during playback.\r\n * Wraps a {@link AssetTimelineResult} and delegates storage/audio work to platform adapters.\r\n */\r\nexport class AssetManager {\r\n private precomp: AssetTimelineResult;\r\n private readonly storageAdapter: StorageAdapter;\r\n private readonly audioDevice: AudioSink;\r\n\r\n /** `null` after a swap: whatever the device holds belongs to the previous precomp. */\r\n private lastAudioRequestKey: string | null = \"\";\r\n private lastAudioSrcs: ReadonlySet<string> | null = new Set();\r\n private audioFetching = new Map<string, Promise<void>>();\r\n /**\r\n * Sources whose fetch or decode failed, with why, so they are not fetched\r\n * again every sync. A source leaves when no request in the window names it\r\n * any more — and, once it has been reported, when a new precomp arrives —\r\n * so the next time it is wanted it is tried afresh. One that failed quietly\r\n * (see {@link AudioRequest.optional}) is kept across a precomp: a video with\r\n * no audio track would otherwise be fetched whole on every edit.\r\n */\r\n private audioFailed = new Map<string, unknown>();\r\n /** The failed sources already reported to {@link onError}. */\r\n private audioReported = new Set<string>();\r\n /** Sources a request in the last window asked for by name, not as a picture's own sound. */\r\n private audioRequired: ReadonlySet<string> = new Set();\r\n /** Keys of the loaders a track measures against, which no window may evict. */\r\n private layoutGateKeys: ReadonlySet<string>;\r\n private disposed = false;\r\n\r\n /** Disposers for loaders whose load has resolved, keyed by loader key. */\r\n private loaderDisposers = new Map<string, Disposer>();\r\n /** In-flight loader runs, keyed by loader key, to dedupe concurrent calls. */\r\n private loaderInFlight = new Map<string, Promise<void>>();\r\n\r\n /**\r\n * @param onError Told once per source when audio a request asked for cannot\r\n * be fetched or decoded. Defaults to `console.error`.\r\n */\r\n constructor(\r\n precomp: AssetTimelineResult,\r\n storageAdapter: StorageAdapter,\r\n audioDevice: AudioSink,\r\n private readonly onError: (error: Error) => void = (error) => console.error(`[AssetManager] ${error.message}`),\r\n ) {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n this.storageAdapter = storageAdapter;\r\n this.audioDevice = audioDevice;\r\n }\r\n\r\n // ─── Public surface ───────────────────────────────────────────────────────\r\n\r\n /**\r\n * Swap in a new precomp result (a document swap). The manager keeps its\r\n * warm loader disposers and in-flight audio fetches so a single-track edit\r\n * doesn't re-fetch unchanged assets; the next loadAt/syncAudio picks up the\r\n * new asset windows. Resetting the audio signature forces a reschedule so a\r\n * changed track's audio is re-evaluated against the new timeline — including\r\n * into an empty window, which is how removed audio stops.\r\n */\r\n setPrecomp(precomp: AssetTimelineResult): void {\r\n this.precomp = precomp;\r\n this.layoutGateKeys = layoutGatesOf(precomp);\r\n for (const src of this.audioReported) this.audioFailed.delete(src);\r\n this.audioReported.clear();\r\n this.lastAudioRequestKey = null;\r\n this.lastAudioSrcs = null;\r\n }\r\n\r\n /**\r\n * Blocking load for seek and initial render. Waits for every asset whose\r\n * cacheAt <= frame and endFrame >= frame to be ready, then schedules audio.\r\n */\r\n async loadAt(frame: number): Promise<void> {\r\n const jobs: Promise<void>[] = [];\r\n\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n const job = this.syncLoader(key, track, frame);\r\n if (job) jobs.push(job);\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n jobs.push(this.storageAdapter.loadAsset(key, track.record));\r\n }\r\n }\r\n\r\n await Promise.all(jobs);\r\n if (this.audioDevice.schedulesAudio) this.syncAudio(frame);\r\n }\r\n\r\n /** Whether `key` — a loader key or a stored asset's — is resident now. */\r\n isReady(key: string): boolean {\r\n return this.loaderDisposers.has(key) || this.storageAdapter.isLoaded(key);\r\n }\r\n\r\n /**\r\n * Load `records` whatever their windows say — for layout gates, which must be\r\n * resident before a track measures regardless of the frame being drawn.\r\n */\r\n async loadRecords(records: readonly AssetRecord[]): Promise<void> {\r\n await Promise.all(records.map((record) => record.type === 'loader'\r\n ? this.runLoader(record.src, record.load)\r\n : this.storageAdapter.loadAsset(record.src, record)));\r\n }\r\n\r\n /**\r\n * Non-blocking incremental prefetch called after each render tick. Fires\r\n * loads for assets whose cacheAt window has been reached without blocking.\r\n */\r\n prefetch(frame: number): void {\r\n for (const [key, track] of this.precomp.assets) {\r\n if (track.record.type === 'loader') {\r\n this.syncLoader(key, track, frame)?.catch(err => {\r\n console.error(`[AssetManager] loader failed for ${key}:`, err);\r\n });\r\n continue;\r\n }\r\n if (track.cacheAt <= frame && track.record.endFrame >= frame) {\r\n this.storageAdapter.loadAsset(key, track.record).catch(err => {\r\n console.error(`[AssetManager] prefetch failed for ${key}:`, err);\r\n });\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Drive a single loader track toward the state `frame` requires. If `frame`\r\n * is inside the loader's `[cacheAt, discardAt]` window, run its callback\r\n * (deduped — at most one in-flight run, skipped once loaded) and return the\r\n * pending job, if any. If `frame` is outside the window and the loader was\r\n * loaded, dispose it. Returns the in-flight load promise so a blocking\r\n * caller can await it; `undefined` when there's nothing to wait for.\r\n */\r\n private syncLoader(key: string, track: AssetTrack, frame: number): Promise<void> | undefined {\r\n if (track.record.type !== 'loader') return undefined;\r\n const discardAt = track.discardAt ?? Infinity;\r\n const inWindow = track.cacheAt <= frame && frame <= discardAt;\r\n\r\n if (!inWindow) {\r\n // A layout gate is loaded by `loadRecords` whatever frame is drawn, so\r\n // its window says nothing about when it may go: disposing it here made\r\n // `isReady` false and the next frame load it again.\r\n if (this.layoutGateKeys.has(key)) return undefined;\r\n const dispose = this.loaderDisposers.get(key);\r\n if (dispose) {\r\n this.loaderDisposers.delete(key);\r\n dispose();\r\n }\r\n return undefined;\r\n }\r\n\r\n return this.runLoader(key, track.record.load);\r\n }\r\n\r\n /** Run a loader unless it is resident or already running. */\r\n private runLoader(key: string, load: LoaderFn): Promise<void> | undefined {\r\n // Already loaded for this window, or a run is already in flight.\r\n if (this.loaderDisposers.has(key)) return undefined;\r\n const existing = this.loaderInFlight.get(key);\r\n if (existing) return existing;\r\n\r\n const job = load()\r\n .then(disposer => {\r\n // A loader that resolves nothing is keeping its result resident on\r\n // purpose (see `LoaderFn`). Recording a no-op disposer rather than\r\n // skipping the entry is what keeps `loaderDisposers.has(key)` the\r\n // single \"already loaded\" test for both kinds.\r\n this.loaderDisposers.set(key, disposer ?? NO_DISPOSE);\r\n })\r\n .finally(() => {\r\n this.loaderInFlight.delete(key);\r\n });\r\n this.loaderInFlight.set(key, job);\r\n return job;\r\n }\r\n\r\n /** Run every outstanding loader disposer and clear loader state. */\r\n dispose(): void {\r\n for (const dispose of this.loaderDisposers.values()) dispose();\r\n this.loaderDisposers.clear();\r\n this.loaderInFlight.clear();\r\n this.disposed = true;\r\n }\r\n\r\n /**\r\n * Push the current audio working set to the AudioSink. Called after each\r\n * render tick so the device stays in sync with the tracks' audio requests.\r\n */\r\n syncAudio(frame: number): void {\r\n const currentTime = frame / this.precomp.fps;\r\n\r\n const inWindow: AudioRequest[] = [];\r\n const srcs = new Set<string>();\r\n const required = new Set<string>();\r\n const seen = new Set<string>();\r\n\r\n /** Admit `req` if it overlaps the scheduling window, shifted by its owner's offset. */\r\n const consider = (req: AudioRequest, offsetSecs: number): void => {\r\n const globalStart = offsetSecs + req.startAt;\r\n const globalEnd = offsetSecs + req.endAt;\r\n\r\n if (globalEnd < currentTime || globalStart > currentTime + 10) return;\r\n // Ahead of the dedupe: the flag is not part of a request's identity.\r\n if (!req.optional) required.add(req.src);\r\n\r\n const stableId = stableKey(req, offsetSecs);\r\n if (seen.has(stableId)) return;\r\n seen.add(stableId);\r\n\r\n inWindow.push({\r\n ...req,\r\n id: stableId,\r\n startAt: globalStart,\r\n endAt: globalEnd,\r\n // A bus's span is in its request's seconds, so it moves with it.\r\n ...(req.bus && {\r\n bus: req.bus.map((s) => ({ ...s, startAt: offsetSecs + s.startAt, endAt: offsetSecs + s.endAt })),\r\n }),\r\n });\r\n srcs.add(req.src);\r\n };\r\n\r\n for (const track of this.precomp.tracks) {\r\n const offsetSecs = track.startFrame / this.precomp.fps;\r\n for (const req of track.audioRequests) consider(req, offsetSecs);\r\n }\r\n\r\n this.audioRequired = required;\r\n for (const src of srcs) {\r\n if (!this.audioDevice.has(src) && !this.audioFetching.has(src) && !this.audioFailed.has(src)) {\r\n const job = this.storageAdapter.fetchAudioData(src)\r\n .then(data => this.audioDevice.append(src, data))\r\n .catch(cause => this.failAudio(src, cause))\r\n .finally(() => this.audioFetching.delete(src));\r\n this.audioFetching.set(src, job);\r\n }\r\n }\r\n // A failed source nothing asks for any more is forgotten, so wanting it\r\n // again later tries it afresh; one that failed quietly is reported when\r\n // a request that asks for its sound arrives.\r\n for (const [src, cause] of this.audioFailed) {\r\n if (!srcs.has(src)) {\r\n this.audioFailed.delete(src);\r\n this.audioReported.delete(src);\r\n } else if (required.has(src)) {\r\n this.reportAudio(src, cause);\r\n }\r\n }\r\n\r\n const requestKey = audioSignature(inWindow);\r\n if (requestKey !== this.lastAudioRequestKey) {\r\n this.audioDevice.schedule(inWindow);\r\n this.lastAudioRequestKey = requestKey;\r\n }\r\n if (this.lastAudioSrcs === null || !setsEqual(this.lastAudioSrcs, srcs)) {\r\n this.audioDevice.retain(srcs);\r\n this.lastAudioSrcs = srcs;\r\n }\r\n }\r\n\r\n /** Record that `src` could not be loaded, and say so if a request asked for its sound. */\r\n private failAudio(src: string, cause: unknown): void {\r\n if (this.disposed) return;\r\n this.audioFailed.set(src, cause);\r\n if (this.audioRequired.has(src)) this.reportAudio(src, cause);\r\n }\r\n\r\n /** Say that `src` could not be loaded, once, until it is wanted afresh. */\r\n private reportAudio(src: string, cause: unknown): void {\r\n if (this.audioReported.has(src)) return;\r\n this.audioReported.add(src);\r\n const message = cause instanceof Error ? cause.message : String(cause);\r\n this.onError(new Error(`audio \"${src}\" could not be loaded: ${message}`, { cause }));\r\n }\r\n}\r\n\r\n// ─── Helpers ──────────────────────────────────────────────────────────────────\r\n\r\n/** Every layout-gate key any track of `precomp` declares. */\r\nfunction layoutGatesOf(precomp: AssetTimelineResult): ReadonlySet<string> {\r\n const keys = new Set<string>();\r\n for (const track of precomp.tracks) for (const key of track.layoutGates ?? []) keys.add(key);\r\n return keys;\r\n}\r\n\r\n/** Stand-in for a loader that resolved nothing — see the note in {@link AssetManager.syncLoader}. */\r\nconst NO_DISPOSE: Disposer = () => { };\r\n\r\n/**\r\n * Produce a deterministic string key that uniquely identifies an audio request's\r\n * playback identity. Includes the effect chain, the ramps and the transitions so\r\n * editing any of them changes the id — the device then stops the stale source and\r\n * rebuilds the graph instead of reusing the old one.\r\n *\r\n * The bus chain is in for the same reason: re-routing a clip to a different bus,\r\n * or changing a bus's level or its span, changes what it sounds like without\r\n * changing anything else here — so leaving it out would keep the stale graph.\r\n */\r\nfunction stableKey(req: AudioRequest, clipOffsetSecs: number): string {\r\n return `${req.src}|${clipOffsetSecs + req.startAt}|${clipOffsetSecs + req.endAt}|${req.trimStart}|${req.trimEnd ?? \"_\"}|${req.loop ? 1 : 0}|${paramKey(req.volume)}|${paramKey(req.speed)}|${req.sourceLength ?? \"_\"}|${effectsKey(req.effects)}|${transitionKey(req.transitionIn)}|${transitionKey(req.transitionOut)}|${busKey(req.bus)}`;\r\n}\r\n\r\n/** The bus chain's contribution to {@link stableKey}. */\r\nfunction busKey(bus: AudioRequest[\"bus\"]): string {\r\n if (!bus || bus.length === 0) return \"\";\r\n return bus.map(busStopKey).join(\">\");\r\n}\r\n\r\n/** Produce a stable hash of the active audio request set to detect scheduling changes. */\r\nfunction audioSignature(reqs: readonly AudioRequest[]): string {\r\n if (reqs.length === 0) return \"\";\r\n return reqs.map(r => r.id).sort().join(\"\\n\");\r\n}\r\n\r\n/** Shallow equality check for two string sets (order-independent). */\r\nfunction setsEqual(a: ReadonlySet<string>, b: ReadonlySet<string>): boolean {\r\n if (a.size !== b.size) return false;\r\n for (const v of a) if (!b.has(v)) return false;\r\n return true;\r\n}\r\n"]}
|
package/dist/assets/scope.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { AssetCatalog } from "./catalog.js";
|
|
|
2
2
|
import type { LoaderFn } from "./record.js";
|
|
3
3
|
import type { FillResolved } from "../attributes/shape/fill/union.js";
|
|
4
4
|
import type { NodeEffect } from "../attributes/shape/effects/union.js";
|
|
5
|
-
import type { Node } from "../
|
|
5
|
+
import type { Node } from "../components/trees/node/node.js";
|
|
6
6
|
/** Whether an asset has to be resident before layout measures, or only before a frame draws. */
|
|
7
7
|
export type AssetGate = "layout" | "render";
|
|
8
8
|
export type AssetDecl = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAA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C,GAAG,EAAE,MAAM,GAAG,IAAI;IAMxB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAWjE,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAKpD,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,IAAI;IAoBzE,IAAI,CAAC,KAAK,EAAE,YAAY,GAAG,SAAS,YAAY,EAAE,GAAG,IAAI;IASzD,OAAO,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI;IAK7C,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IASzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA0B;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAgC;IACvD,OAAO,CAAC,SAAS,CAAwB;CAC5C"}
|
package/dist/assets/scope.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { declareFill } from "../attributes/shape/fill/registry.js";
|
|
2
2
|
import { declareEffect } from "../attributes/shape/effects/registry.js";
|
|
3
|
-
import { declareTree } from "../
|
|
3
|
+
import { declareTree } from "../components/trees/node/node-walk.js";
|
|
4
4
|
/**
|
|
5
5
|
* Fonts key by family alone: `loadFont` registers every weight of a family at once
|
|
6
6
|
* and a variable weight renders through `fontVariations`, so a weight in the key
|
package/dist/assets/scope.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE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,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC5D,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEgB,QAAQ,CAA0B;IAClC,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC/C,SAAS,CAAwB;CAC5C","sourcesContent":["import type { AssetCatalog } from \"./catalog\";\r\nimport type { LoaderFn } from \"./record\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Node } from \"@/nodes/node/node\";\r\nimport { declareFill } from \"@/attributes/shape/fill/registry\";\r\nimport { declareEffect } from \"@/attributes/shape/effects/registry\";\r\nimport { declareTree } from \"@/nodes/node/node-walk\";\r\n\r\n/** Whether an asset has to be resident before layout measures, or only before a frame draws. */\r\nexport type AssetGate = \"layout\" | \"render\";\r\n\r\nexport type AssetDecl =\r\n | { type: \"image\"; src: string }\r\n | { type: \"video\"; src: string; trimStart: number; trimEnd: number }\r\n | { type: \"font\"; family: string; weight: number }\r\n | { type: \"loader\"; key: string; load: LoaderFn; gate: AssetGate };\r\n\r\n/**\r\n * What a node's `declareAssets` states its needs into.\r\n *\r\n * A declaration must be a pure function of the props and context it reads — never\r\n * `layoutBounds`, never `time`, no writes — because the runtime re-runs it only\r\n * when something it read changes. Declarations dedupe by {@link assetKey}.\r\n */\r\nexport interface AssetScope {\r\n readonly catalog: AssetCatalog;\r\n image(src: string): void;\r\n video(src: string, trim?: { start?: number; end?: number }): void;\r\n /** Gates layout: text is measured against the face. */\r\n font(family: string, weight?: number | string): void;\r\n /** `gate` defaults to `\"render\"`; pass `\"layout\"` for a load measurement depends on. */\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void;\r\n fill(fills: FillResolved | readonly FillResolved[]): void;\r\n effects(effects: readonly NodeEffect[]): void;\r\n /** A detached subtree this node draws (a `Tex.surface` node source), declared as part of this node. */\r\n subtree(node: Node): void;\r\n}\r\n\r\n/**\r\n * Fonts key by family alone: `loadFont` registers every weight of a family at once\r\n * and a variable weight renders through `fontVariations`, so a weight in the key\r\n * would mint an entry per frame of a weight tween.\r\n */\r\nexport function assetKey(decl: AssetDecl): string {\r\n switch (decl.type) {\r\n case \"image\":\r\n case \"video\":\r\n return decl.src;\r\n case \"font\":\r\n return decl.family;\r\n case \"loader\":\r\n return decl.key;\r\n }\r\n}\r\n\r\n/** Anything unparseable lands on 400, which is what an unspecified weight means anyway. */\r\nexport function normalizeWeight(weight: number | string | undefined): number {\r\n if (typeof weight === \"number\") return Number.isFinite(weight) ? weight : 400;\r\n if (typeof weight === \"string\") return parseInt(weight, 10) || 400;\r\n return 400;\r\n}\r\n\r\nexport interface AssetDeclarationOptions {\r\n /** Binds a detached subtree (catalog, context, clock) before it declares. */\r\n bindSubtree?: (node: Node) => void;\r\n /** Replaces the default {@link declareTree} walk over a subtree. */\r\n onSubtree?: (node: Node, scope: AssetScope) => void;\r\n}\r\n\r\n/**\r\n * The {@link AssetScope} that collects: one declaration pass, keyed and validated.\r\n *\r\n * Unknown images and videos throw here, so a typo surfaces against the node that\r\n * declared it rather than as a picture that never paints.\r\n */\r\nexport class AssetDeclaration implements AssetScope {\r\n readonly catalog: AssetCatalog;\r\n\r\n constructor(catalog: AssetCatalog, options: AssetDeclarationOptions = {}) {\r\n this.catalog = catalog;\r\n this._options = options;\r\n }\r\n\r\n get declarations(): ReadonlyMap<string, AssetDecl> {\r\n return this._decls;\r\n }\r\n\r\n // An empty `src` is an unset media slot — it paints the checkerboard, not a\r\n // missing asset — so it declares nothing.\r\n image(src: string): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getImageMeta(src);\r\n this._decls.set(src, { type: \"image\", src });\r\n }\r\n\r\n video(src: string, trim?: { start?: number; end?: number }): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getVideoMeta(src);\r\n this._decls.set(src, {\r\n type: \"video\",\r\n src,\r\n trimStart: trim?.start ?? 0,\r\n trimEnd: trim?.end ?? this.catalog.getVideoDuration(src),\r\n });\r\n }\r\n\r\n font(family: string, weight?: number | string): void {\r\n if (!family || this._decls.has(family)) return;\r\n this._decls.set(family, { type: \"font\", family, weight: normalizeWeight(weight) });\r\n }\r\n\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void {\r\n const gate = options?.gate ?? \"render\";\r\n const existing = this._decls.get(key);\r\n if (existing === undefined) {\r\n this._decls.set(key, { type: \"loader\", key, load, gate });\r\n return;\r\n }\r\n if (existing.type !== \"loader\") return;\r\n if (existing.load !== load && process.env.NODE_ENV !== \"production\") {\r\n console.warn(\r\n `[assets] Loader \"${key}\" was declared with a different load function; the first is kept. ` +\r\n `Hoist the function so every declaration of the key hands over the same one.`,\r\n );\r\n }\r\n // Layout is the stricter gate, so it wins whichever declaration asked first.\r\n if (gate === \"layout\" && existing.gate !== \"layout\") {\r\n this._decls.set(key, { ...existing, gate });\r\n }\r\n }\r\n\r\n fill(fills: FillResolved | readonly FillResolved[]): void {\r\n if (!fills) return;\r\n if (!Array.isArray(fills)) {\r\n declareFill(fills as FillResolved, this);\r\n return;\r\n }\r\n for (const fill of fills as readonly FillResolved[]) declareFill(fill, this);\r\n }\r\n\r\n effects(effects: readonly NodeEffect[]): void {\r\n if (!effects) return;\r\n for (const effect of effects) declareEffect(effect, this);\r\n }\r\n\r\n subtree(node: Node): void {\r\n this._subtrees ??= new Set();\r\n if (this._subtrees.has(node)) return;\r\n this._subtrees.add(node);\r\n this._options.bindSubtree?.(node);\r\n if (this._options.onSubtree) this._options.onSubtree(node, this);\r\n else declareTree(node, this);\r\n }\r\n\r\n private readonly _options: AssetDeclarationOptions;\r\n private readonly _decls = new Map<string, AssetDecl>();\r\n private _subtrees: Set<Node> | undefined;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/assets/scope.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EA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AAI,CAAC,QAAQ,CAAC,SAAS;YAAE,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;;YAC5D,WAAW,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC;IAEgB,QAAQ,CAA0B;IAClC,MAAM,GAAG,IAAI,GAAG,EAAqB,CAAC;IAC/C,SAAS,CAAwB;CAC5C","sourcesContent":["import type { AssetCatalog } from \"./catalog\";\r\nimport type { LoaderFn } from \"./record\";\r\nimport type { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\nimport type { Node } from \"@/components/trees/node/node\";\r\nimport { declareFill } from \"@/attributes/shape/fill/registry\";\r\nimport { declareEffect } from \"@/attributes/shape/effects/registry\";\r\nimport { declareTree } from \"@/components/trees/node/node-walk\";\r\n\r\n/** Whether an asset has to be resident before layout measures, or only before a frame draws. */\r\nexport type AssetGate = \"layout\" | \"render\";\r\n\r\nexport type AssetDecl =\r\n | { type: \"image\"; src: string }\r\n | { type: \"video\"; src: string; trimStart: number; trimEnd: number }\r\n | { type: \"font\"; family: string; weight: number }\r\n | { type: \"loader\"; key: string; load: LoaderFn; gate: AssetGate };\r\n\r\n/**\r\n * What a node's `declareAssets` states its needs into.\r\n *\r\n * A declaration must be a pure function of the props and context it reads — never\r\n * `layoutBounds`, never `time`, no writes — because the runtime re-runs it only\r\n * when something it read changes. Declarations dedupe by {@link assetKey}.\r\n */\r\nexport interface AssetScope {\r\n readonly catalog: AssetCatalog;\r\n image(src: string): void;\r\n video(src: string, trim?: { start?: number; end?: number }): void;\r\n /** Gates layout: text is measured against the face. */\r\n font(family: string, weight?: number | string): void;\r\n /** `gate` defaults to `\"render\"`; pass `\"layout\"` for a load measurement depends on. */\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void;\r\n fill(fills: FillResolved | readonly FillResolved[]): void;\r\n effects(effects: readonly NodeEffect[]): void;\r\n /** A detached subtree this node draws (a `Tex.surface` node source), declared as part of this node. */\r\n subtree(node: Node): void;\r\n}\r\n\r\n/**\r\n * Fonts key by family alone: `loadFont` registers every weight of a family at once\r\n * and a variable weight renders through `fontVariations`, so a weight in the key\r\n * would mint an entry per frame of a weight tween.\r\n */\r\nexport function assetKey(decl: AssetDecl): string {\r\n switch (decl.type) {\r\n case \"image\":\r\n case \"video\":\r\n return decl.src;\r\n case \"font\":\r\n return decl.family;\r\n case \"loader\":\r\n return decl.key;\r\n }\r\n}\r\n\r\n/** Anything unparseable lands on 400, which is what an unspecified weight means anyway. */\r\nexport function normalizeWeight(weight: number | string | undefined): number {\r\n if (typeof weight === \"number\") return Number.isFinite(weight) ? weight : 400;\r\n if (typeof weight === \"string\") return parseInt(weight, 10) || 400;\r\n return 400;\r\n}\r\n\r\nexport interface AssetDeclarationOptions {\r\n /** Binds a detached subtree (catalog, context, clock) before it declares. */\r\n bindSubtree?: (node: Node) => void;\r\n /** Replaces the default {@link declareTree} walk over a subtree. */\r\n onSubtree?: (node: Node, scope: AssetScope) => void;\r\n}\r\n\r\n/**\r\n * The {@link AssetScope} that collects: one declaration pass, keyed and validated.\r\n *\r\n * Unknown images and videos throw here, so a typo surfaces against the node that\r\n * declared it rather than as a picture that never paints.\r\n */\r\nexport class AssetDeclaration implements AssetScope {\r\n readonly catalog: AssetCatalog;\r\n\r\n constructor(catalog: AssetCatalog, options: AssetDeclarationOptions = {}) {\r\n this.catalog = catalog;\r\n this._options = options;\r\n }\r\n\r\n get declarations(): ReadonlyMap<string, AssetDecl> {\r\n return this._decls;\r\n }\r\n\r\n // An empty `src` is an unset media slot — it paints the checkerboard, not a\r\n // missing asset — so it declares nothing.\r\n image(src: string): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getImageMeta(src);\r\n this._decls.set(src, { type: \"image\", src });\r\n }\r\n\r\n video(src: string, trim?: { start?: number; end?: number }): void {\r\n if (!src || this._decls.has(src)) return;\r\n this.catalog.getVideoMeta(src);\r\n this._decls.set(src, {\r\n type: \"video\",\r\n src,\r\n trimStart: trim?.start ?? 0,\r\n trimEnd: trim?.end ?? this.catalog.getVideoDuration(src),\r\n });\r\n }\r\n\r\n font(family: string, weight?: number | string): void {\r\n if (!family || this._decls.has(family)) return;\r\n this._decls.set(family, { type: \"font\", family, weight: normalizeWeight(weight) });\r\n }\r\n\r\n loader(key: string, load: LoaderFn, options?: { gate?: AssetGate }): void {\r\n const gate = options?.gate ?? \"render\";\r\n const existing = this._decls.get(key);\r\n if (existing === undefined) {\r\n this._decls.set(key, { type: \"loader\", key, load, gate });\r\n return;\r\n }\r\n if (existing.type !== \"loader\") return;\r\n if (existing.load !== load && process.env.NODE_ENV !== \"production\") {\r\n console.warn(\r\n `[assets] Loader \"${key}\" was declared with a different load function; the first is kept. ` +\r\n `Hoist the function so every declaration of the key hands over the same one.`,\r\n );\r\n }\r\n // Layout is the stricter gate, so it wins whichever declaration asked first.\r\n if (gate === \"layout\" && existing.gate !== \"layout\") {\r\n this._decls.set(key, { ...existing, gate });\r\n }\r\n }\r\n\r\n fill(fills: FillResolved | readonly FillResolved[]): void {\r\n if (!fills) return;\r\n if (!Array.isArray(fills)) {\r\n declareFill(fills as FillResolved, this);\r\n return;\r\n }\r\n for (const fill of fills as readonly FillResolved[]) declareFill(fill, this);\r\n }\r\n\r\n effects(effects: readonly NodeEffect[]): void {\r\n if (!effects) return;\r\n for (const effect of effects) declareEffect(effect, this);\r\n }\r\n\r\n subtree(node: Node): void {\r\n this._subtrees ??= new Set();\r\n if (this._subtrees.has(node)) return;\r\n this._subtrees.add(node);\r\n this._options.bindSubtree?.(node);\r\n if (this._options.onSubtree) this._options.onSubtree(node, this);\r\n else declareTree(node, this);\r\n }\r\n\r\n private readonly _options: AssetDeclarationOptions;\r\n private readonly _decls = new Map<string, AssetDecl>();\r\n private _subtrees: Set<Node> | undefined;\r\n}\r\n"]}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AudioEffect } from "./union.js";
|
|
2
|
+
import { Param } from "../ramp.js";
|
|
3
|
+
/**
|
|
4
|
+
* Every builder takes one options object, and those with one dominant param
|
|
5
|
+
* also take that param directly — a number or a {@link Ramp}, so
|
|
6
|
+
* `AudioEffects.lowpass(ramp(8000, 400, 2))` works.
|
|
7
|
+
*/
|
|
8
|
+
/** Gain. Param shorthand sets `value`. */
|
|
9
|
+
export interface GainEffectOptions {
|
|
10
|
+
/** 1 = unchanged, 0 = silent, >1 = louder. */
|
|
11
|
+
value: Param;
|
|
12
|
+
}
|
|
13
|
+
/** High-pass filter. Param shorthand sets `frequency`. */
|
|
14
|
+
export interface HighPassEffectOptions {
|
|
15
|
+
/** Rolls off content below this frequency, in Hz. */
|
|
16
|
+
frequency: Param;
|
|
17
|
+
/** Resonance at the cutoff (default 1). */
|
|
18
|
+
q?: Param;
|
|
19
|
+
}
|
|
20
|
+
/** Low-pass filter. Param shorthand sets `frequency`. */
|
|
21
|
+
export interface LowPassEffectOptions {
|
|
22
|
+
/** Rolls off content above this frequency, in Hz. */
|
|
23
|
+
frequency: Param;
|
|
24
|
+
/** Resonance at the cutoff (default 1). */
|
|
25
|
+
q?: Param;
|
|
26
|
+
}
|
|
27
|
+
/** Amplitude wobble. Param shorthand sets `rate`. */
|
|
28
|
+
export interface TremoloEffectOptions {
|
|
29
|
+
/** Wobble rate in Hz. */
|
|
30
|
+
rate: Param;
|
|
31
|
+
/** Modulation depth, 0–1 (default 0.5). */
|
|
32
|
+
depth?: Param;
|
|
33
|
+
}
|
|
34
|
+
/** Delay line with feedback. Param shorthand sets `delay`. */
|
|
35
|
+
export interface EchoEffectOptions {
|
|
36
|
+
/** Delay time in seconds. */
|
|
37
|
+
delay: Param;
|
|
38
|
+
/** Feedback amount, 0–<1 (default 0.4). */
|
|
39
|
+
feedback?: Param;
|
|
40
|
+
/** Wet mix, 0–1 (default 0.5). */
|
|
41
|
+
mix?: Param;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Immutable, chainable list of audio effects, applied in order (index 0
|
|
45
|
+
* closest to the source).
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* const chain = AudioEffects.gain(1.5).lowpass(800).echo(0.3);
|
|
49
|
+
*/
|
|
50
|
+
export declare class AudioEffectChain {
|
|
51
|
+
list: AudioEffect[];
|
|
52
|
+
constructor(list?: AudioEffect[]);
|
|
53
|
+
private append;
|
|
54
|
+
gain(options: Param | GainEffectOptions): AudioEffectChain;
|
|
55
|
+
/** Alias for {@link gain}. */
|
|
56
|
+
volume(options: Param | GainEffectOptions): AudioEffectChain;
|
|
57
|
+
/** Rolls off content below `frequency` Hz. */
|
|
58
|
+
highpass(options: Param | HighPassEffectOptions): AudioEffectChain;
|
|
59
|
+
/** Rolls off content above `frequency` Hz. */
|
|
60
|
+
lowpass(options: Param | LowPassEffectOptions): AudioEffectChain;
|
|
61
|
+
/** A `rate` Hz wobble at `depth` (0–1). */
|
|
62
|
+
tremolo(options: Param | TremoloEffectOptions): AudioEffectChain;
|
|
63
|
+
/** `delay` seconds, `feedback` 0–<1, optional wet `mix` 0–1. */
|
|
64
|
+
echo(options: Param | EchoEffectOptions): AudioEffectChain;
|
|
65
|
+
[Symbol.iterator](): Generator<AudioEffect, void, unknown>;
|
|
66
|
+
toJSON(): AudioEffect[];
|
|
67
|
+
}
|
|
68
|
+
/** What an `effects` prop accepts: one effect, a plain array, or a chain. */
|
|
69
|
+
export type AudioEffectsInput = AudioEffect[] | AudioEffectChain | AudioEffect;
|
|
70
|
+
/** An empty {@link AudioEffectChain}: `AudioEffects.gain(1.5)` is `new AudioEffectChain().gain(1.5)`. */
|
|
71
|
+
export declare const AudioEffects: AudioEffectChain;
|
|
72
|
+
export declare function resolveAudioEffects(effects: AudioEffectsInput | undefined): AudioEffect[];
|
|
73
|
+
//# sourceMappingURL=chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/attributes/audio/effects/chain.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AA2C;IAC3C,OAAO,CAAC,OAAO,EAAE,KAAK,GAAG,oBAAoB;IAK7C,gEAAgE;IAChE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,iBAAiB;IAKtC,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIlB,MAAM;CAGT;AAED,6EAA6E;AAC7E,MAAM,MAAM,iBAAiB,GAAG,WAAW,EAAE,GAAG,gBAAgB,GAAG,WAAW,CAAC;AAE/E,yGAAyG;AACzG,eAAO,MAAM,YAAY,kBAAyB,CAAC;AAEnD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iBAAiB,GAAG,SAAS,GAAG,WAAW,EAAE,CAKzF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { isRamp } from "../ramp.js";
|
|
2
|
+
/** A ramp is an object too, so the shorthand test has to ask {@link isRamp}, or it reads as an options bag. */
|
|
3
|
+
function scalarParam(arg, key) {
|
|
4
|
+
return typeof arg === "number" || isRamp(arg) ? { [key]: arg } : arg;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Immutable, chainable list of audio effects, applied in order (index 0
|
|
8
|
+
* closest to the source).
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const chain = AudioEffects.gain(1.5).lowpass(800).echo(0.3);
|
|
12
|
+
*/
|
|
13
|
+
export class AudioEffectChain {
|
|
14
|
+
list;
|
|
15
|
+
constructor(list = []) {
|
|
16
|
+
this.list = list;
|
|
17
|
+
}
|
|
18
|
+
append(effect) {
|
|
19
|
+
return new AudioEffectChain([...this.list, effect]);
|
|
20
|
+
}
|
|
21
|
+
gain(options) {
|
|
22
|
+
const { value } = scalarParam(options, "value");
|
|
23
|
+
return this.append({ type: 'gain', value });
|
|
24
|
+
}
|
|
25
|
+
/** Alias for {@link gain}. */
|
|
26
|
+
volume(options) {
|
|
27
|
+
return this.gain(options);
|
|
28
|
+
}
|
|
29
|
+
/** Rolls off content below `frequency` Hz. */
|
|
30
|
+
highpass(options) {
|
|
31
|
+
const { frequency, q } = scalarParam(options, "frequency");
|
|
32
|
+
return this.append({ type: 'highpass', frequency, q });
|
|
33
|
+
}
|
|
34
|
+
/** Rolls off content above `frequency` Hz. */
|
|
35
|
+
lowpass(options) {
|
|
36
|
+
const { frequency, q } = scalarParam(options, "frequency");
|
|
37
|
+
return this.append({ type: 'lowpass', frequency, q });
|
|
38
|
+
}
|
|
39
|
+
/** A `rate` Hz wobble at `depth` (0–1). */
|
|
40
|
+
tremolo(options) {
|
|
41
|
+
const { rate, depth } = scalarParam(options, "rate");
|
|
42
|
+
return this.append({ type: 'tremolo', rate, depth: depth ?? 0.5 });
|
|
43
|
+
}
|
|
44
|
+
/** `delay` seconds, `feedback` 0–<1, optional wet `mix` 0–1. */
|
|
45
|
+
echo(options) {
|
|
46
|
+
const { delay, feedback, mix } = scalarParam(options, "delay");
|
|
47
|
+
return this.append({ type: 'echo', delay, feedback: feedback ?? 0.4, mix });
|
|
48
|
+
}
|
|
49
|
+
*[Symbol.iterator]() {
|
|
50
|
+
yield* this.list;
|
|
51
|
+
}
|
|
52
|
+
toJSON() {
|
|
53
|
+
return this.list;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/** An empty {@link AudioEffectChain}: `AudioEffects.gain(1.5)` is `new AudioEffectChain().gain(1.5)`. */
|
|
57
|
+
export const AudioEffects = new AudioEffectChain();
|
|
58
|
+
export function resolveAudioEffects(effects) {
|
|
59
|
+
if (effects === undefined)
|
|
60
|
+
return [];
|
|
61
|
+
if (effects instanceof AudioEffectChain)
|
|
62
|
+
return effects.list;
|
|
63
|
+
if (Array.isArray(effects))
|
|
64
|
+
return effects;
|
|
65
|
+
return [effects];
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/audio/effects/chain.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,MAAM,EAAE,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n\r\n/**\r\n * Every builder takes one options object, and those with one dominant param\r\n * also take that param directly — a number or a {@link Ramp}, so\r\n * `AudioEffects.lowpass(ramp(8000, 400, 2))` works.\r\n */\r\n\r\n/** Gain. Param shorthand sets `value`. */\r\nexport interface GainEffectOptions {\r\n /** 1 = unchanged, 0 = silent, >1 = louder. */\r\n value: Param;\r\n}\r\n\r\n/** High-pass filter. Param shorthand sets `frequency`. */\r\nexport interface HighPassEffectOptions {\r\n /** Rolls off content below this frequency, in Hz. */\r\n frequency: Param;\r\n /** Resonance at the cutoff (default 1). */\r\n q?: Param;\r\n}\r\n\r\n/** Low-pass filter. Param shorthand sets `frequency`. */\r\nexport interface LowPassEffectOptions {\r\n /** Rolls off content above this frequency, in Hz. */\r\n frequency: Param;\r\n /** Resonance at the cutoff (default 1). */\r\n q?: Param;\r\n}\r\n\r\n/** Amplitude wobble. Param shorthand sets `rate`. */\r\nexport interface TremoloEffectOptions {\r\n /** Wobble rate in Hz. */\r\n rate: Param;\r\n /** Modulation depth, 0–1 (default 0.5). */\r\n depth?: Param;\r\n}\r\n\r\n/** Delay line with feedback. Param shorthand sets `delay`. */\r\nexport interface EchoEffectOptions {\r\n /** Delay time in seconds. */\r\n delay: Param;\r\n /** Feedback amount, 0–<1 (default 0.4). */\r\n feedback?: Param;\r\n /** Wet mix, 0–1 (default 0.5). */\r\n mix?: Param;\r\n}\r\n\r\n/** A ramp is an object too, so the shorthand test has to ask {@link isRamp}, or it reads as an options bag. */\r\nfunction scalarParam<O extends object>(arg: Param | O, key: keyof O): O {\r\n return typeof arg === \"number\" || isRamp(arg) ? ({ [key]: arg } as O) : (arg as O);\r\n}\r\n\r\n/**\r\n * Immutable, chainable list of audio effects, applied in order (index 0\r\n * closest to the source).\r\n *\r\n * @example\r\n * const chain = AudioEffects.gain(1.5).lowpass(800).echo(0.3);\r\n */\r\nexport class AudioEffectChain {\r\n constructor(public list: AudioEffect[] = []) { }\r\n\r\n private append(effect: AudioEffect): AudioEffectChain {\r\n return new AudioEffectChain([...this.list, effect]);\r\n }\r\n\r\n gain(options: Param | GainEffectOptions) {\r\n const { value } = scalarParam(options, \"value\");\r\n return this.append({ type: 'gain', value });\r\n }\r\n\r\n /** Alias for {@link gain}. */\r\n volume(options: Param | GainEffectOptions) {\r\n return this.gain(options);\r\n }\r\n\r\n /** Rolls off content below `frequency` Hz. */\r\n highpass(options: Param | HighPassEffectOptions) {\r\n const { frequency, q } = scalarParam(options, \"frequency\");\r\n return this.append({ type: 'highpass', frequency, q });\r\n }\r\n\r\n /** Rolls off content above `frequency` Hz. */\r\n lowpass(options: Param | LowPassEffectOptions) {\r\n const { frequency, q } = scalarParam(options, \"frequency\");\r\n return this.append({ type: 'lowpass', frequency, q });\r\n }\r\n\r\n /** A `rate` Hz wobble at `depth` (0–1). */\r\n tremolo(options: Param | TremoloEffectOptions) {\r\n const { rate, depth } = scalarParam(options, \"rate\");\r\n return this.append({ type: 'tremolo', rate, depth: depth ?? 0.5 });\r\n }\r\n\r\n /** `delay` seconds, `feedback` 0–<1, optional wet `mix` 0–1. */\r\n echo(options: Param | EchoEffectOptions) {\r\n const { delay, feedback, mix } = scalarParam(options, \"delay\");\r\n return this.append({ type: 'echo', delay, feedback: feedback ?? 0.4, mix });\r\n }\r\n\r\n *[Symbol.iterator]() {\r\n yield* this.list;\r\n }\r\n\r\n toJSON() {\r\n return this.list;\r\n }\r\n}\r\n\r\n/** What an `effects` prop accepts: one effect, a plain array, or a chain. */\r\nexport type AudioEffectsInput = AudioEffect[] | AudioEffectChain | AudioEffect;\r\n\r\n/** An empty {@link AudioEffectChain}: `AudioEffects.gain(1.5)` is `new AudioEffectChain().gain(1.5)`. */\r\nexport const AudioEffects = new AudioEffectChain();\r\n\r\nexport function resolveAudioEffects(effects: AudioEffectsInput | undefined): AudioEffect[] {\r\n if (effects === undefined) return [];\r\n if (effects instanceof AudioEffectChain) return effects.list;\r\n if (Array.isArray(effects)) return effects;\r\n return [effects];\r\n}\r\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AudioEffectData } from "../registry.js";
|
|
2
|
+
import { Param } from "../../ramp.js";
|
|
3
|
+
/** Adds a delayed, fading repeat of the signal (a feedback echo / simple delay). */
|
|
4
|
+
export interface EchoEffect {
|
|
5
|
+
type: 'echo';
|
|
6
|
+
/** Delay before the first repeat, in seconds. May be a ramp. */
|
|
7
|
+
delay: Param;
|
|
8
|
+
/** Feedback amount, 0–<1. Each repeat is scaled by this; higher = more repeats. May be a ramp. */
|
|
9
|
+
feedback: Param;
|
|
10
|
+
/** Wet/dry mix, 0–1. 0 = dry only, 1 = full wet. Default 0.5. May be a ramp. */
|
|
11
|
+
mix?: Param;
|
|
12
|
+
}
|
|
13
|
+
export declare const echoEffect: AudioEffectData<EchoEffect>;
|
|
14
|
+
//# sourceMappingURL=echo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"echo.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/audio/effects/implementations/echo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,KAAK,EAA0B,MAAM,YAAY,CAAC;AAE3D,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,KAAK,EAAE,KAAK,CAAC;IACb,kGAAkG;IAClG,QAAQ,EAAE,KAAK,CAAC;IAChB,gFAAgF;IAChF,GAAG,CAAC,EAAE,KAAK,CAAC;CACf;AAED,eAAO,MAAM,UAAU,EAAE,eAAe,CAAC,UAAU,CASlD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { lerpParam, equalsParam } from "../../ramp.js";
|
|
2
|
+
export const echoEffect = {
|
|
3
|
+
lerp: (from, to, t) => ({
|
|
4
|
+
type: "echo",
|
|
5
|
+
delay: lerpParam(from.delay, to.delay, t),
|
|
6
|
+
feedback: lerpParam(from.feedback, to.feedback, t),
|
|
7
|
+
mix: lerpParam(from.mix ?? 0.5, to.mix ?? 0.5, t),
|
|
8
|
+
}),
|
|
9
|
+
equals: (a, b) => equalsParam(a.delay, b.delay) && equalsParam(a.feedback, b.feedback) && equalsParam(a.mix ?? 0.5, b.mix ?? 0.5),
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=echo.js.map
|