@motionscript/core 0.1.0-alpha.7 → 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 +6 -0
- package/NOTICE +15 -14
- package/README.md +4 -4
- 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/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 +21 -13
- 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 +4 -3
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +4 -7
- package/dist/attributes/index.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/space3d.js +1 -1
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +7 -7
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +6 -6
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +1 -2
- package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js +1 -2
- 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 +46 -14
- 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/implementations/shader.d.ts +27 -26
- 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/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/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 +2 -6
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -5
- 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 +2 -3
- 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/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/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/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 +2 -2
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/components/builtins/audio/audio.d.ts +14 -5
- package/dist/components/builtins/audio/audio.d.ts.map +1 -1
- package/dist/components/builtins/audio/audio.js +10 -13
- package/dist/components/builtins/audio/audio.js.map +1 -1
- package/dist/components/builtins/geometry/composite.d.ts +3 -3
- package/dist/components/builtins/media/media.d.ts +7 -7
- package/dist/components/builtins/media/media.d.ts.map +1 -1
- package/dist/components/builtins/media/media.js +4 -10
- package/dist/components/builtins/media/media.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +12 -12
- package/dist/components/builtins/text/text.d.ts.map +1 -1
- package/dist/components/builtins/text/text.js +3 -0
- package/dist/components/builtins/text/text.js.map +1 -1
- package/dist/components/factory/api.d.ts +38 -11
- package/dist/components/factory/api.d.ts.map +1 -1
- package/dist/components/factory/api.js.map +1 -1
- package/dist/components/factory/component3d.d.ts.map +1 -1
- package/dist/components/factory/component3d.js +11 -3
- package/dist/components/factory/component3d.js.map +1 -1
- package/dist/components/factory/factory.d.ts +3 -0
- package/dist/components/factory/factory.d.ts.map +1 -1
- package/dist/components/factory/factory.js +39 -5
- package/dist/components/factory/factory.js.map +1 -1
- package/dist/components/modules/text-style.d.ts +1 -1
- package/dist/components/trees/2d/node-render.d.ts +1 -1
- package/dist/components/trees/2d/node-render.js +1 -1
- package/dist/components/trees/2d/node-render.js.map +1 -1
- package/dist/components/trees/2d/node2d.d.ts +1 -1
- package/dist/components/trees/2d/node2d.js +1 -1
- package/dist/components/trees/2d/node2d.js.map +1 -1
- package/dist/components/trees/audio/node-audio.d.ts +16 -9
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
- package/dist/components/trees/audio/node-audio.js +15 -11
- package/dist/components/trees/audio/node-audio.js.map +1 -1
- package/dist/document/command-traits.d.ts +12 -2
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +34 -6
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/index.d.ts +8 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +4 -0
- 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-descriptor.d.ts +4 -0
- 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 +16 -0
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +30 -4
- 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 +45 -1
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +172 -42
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +14 -28
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +17 -5
- 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 +68 -8
- package/dist/experimental.d.ts.map +1 -1
- package/dist/experimental.js +22 -8
- package/dist/experimental.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/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/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- 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 +1 -1
- 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/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +54 -5
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/runtime/asset-refine.js +2 -1
- 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 +7 -0
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +3 -1
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +4 -0
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +17 -2
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -3
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -1
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +14 -4
- 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/text-geometry.d.ts +1 -1
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +8 -6
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +10 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +7 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +1 -0
- package/dist/tween/command-decorator.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 +1 -0
- package/dist/tween/index.d.ts.map +1 -1
- package/dist/tween/index.js +1 -0
- package/dist/tween/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
- package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
- package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
- package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { lerpUniformRecord, normalizeUniforms, uniformRecordsEqual, } from '../../
|
|
1
|
+
import { lerpUniformRecord, normalizeUniforms, uniformRecordsEqual, } from '../../shaders/uniforms.js';
|
|
2
|
+
import { shaderContractOf } from '../../shaders/language.js';
|
|
2
3
|
/**
|
|
3
|
-
* Ceiling on bound
|
|
4
|
-
*
|
|
5
|
-
* generated list from exhausting texture units.
|
|
4
|
+
* Ceiling on bound textures: a fill wanting more than a handful is really a 3D
|
|
5
|
+
* scene, and the cap keeps a typo in a generated list from exhausting texture units.
|
|
6
6
|
*/
|
|
7
7
|
const MAX_TEXTURES = 4;
|
|
8
8
|
/** Copy the texture list, dropping malformed entries and capping the length. */
|
|
@@ -14,13 +14,17 @@ function resolveTextures(textures) {
|
|
|
14
14
|
if (!texture?.name || !texture?.src)
|
|
15
15
|
continue;
|
|
16
16
|
if (out.length >= MAX_TEXTURES) {
|
|
17
|
-
console.warn(`[
|
|
17
|
+
console.warn(`[shader] A shader fill declares more than ${MAX_TEXTURES} textures; the rest are ignored.`);
|
|
18
18
|
break;
|
|
19
19
|
}
|
|
20
20
|
out.push({ name: texture.name, src: texture.src });
|
|
21
21
|
}
|
|
22
22
|
return out.length ? out : undefined;
|
|
23
23
|
}
|
|
24
|
+
function withContract(shader) {
|
|
25
|
+
const contract = shaderContractOf(shader);
|
|
26
|
+
return contract === undefined ? {} : { contract };
|
|
27
|
+
}
|
|
24
28
|
function texturesEqual(a, b) {
|
|
25
29
|
if (a === b)
|
|
26
30
|
return true;
|
|
@@ -32,23 +36,24 @@ export const shaderFill = {
|
|
|
32
36
|
resolve: (prop) => ({
|
|
33
37
|
type: 'shader',
|
|
34
38
|
source: prop.source ?? '',
|
|
39
|
+
// A stored document may still say "sksl"; carried so the renderer can report it.
|
|
40
|
+
language: prop.language ?? 'wgsl',
|
|
41
|
+
...withContract(prop),
|
|
35
42
|
// Carried, never read: see `ShaderFillProp.shaderId`. Omitted when absent
|
|
36
43
|
// so `equals` compares like with like for a fill that never had one.
|
|
37
44
|
...(prop.shaderId !== undefined ? { shaderId: prop.shaderId } : {}),
|
|
38
45
|
// Normalised (and key-sorted) here rather than at paint time so `equals`
|
|
39
46
|
// and any structural diff see the same canonical record the renderer
|
|
40
|
-
//
|
|
47
|
+
// binds, whichever authoring shape it came in as.
|
|
41
48
|
uniforms: normalizeUniforms(prop.uniforms),
|
|
42
|
-
coords: prop.coords ?? 'normalized',
|
|
43
49
|
textures: resolveTextures(prop.textures),
|
|
44
50
|
opacity: prop.opacity,
|
|
45
51
|
blend: prop.blend,
|
|
46
52
|
}),
|
|
47
|
-
// `source
|
|
48
|
-
//
|
|
49
|
-
//
|
|
50
|
-
//
|
|
51
|
-
// matrix and a texture list is a discrete set of bindings.
|
|
53
|
+
// `source` and `textures` snap; only the uniform values and `opacity`
|
|
54
|
+
// interpolate. The source is the compile-cache key, so there is nothing
|
|
55
|
+
// halfway between two programs to cross to — the same reason an image
|
|
56
|
+
// fill's `src` and a 3D fill's scene snap.
|
|
52
57
|
//
|
|
53
58
|
// Deliberately returns neither `type` nor `blend`: `FillResult` omits both and
|
|
54
59
|
// `lerpFill` reassembles via `{ ...a, ...lerp(...) }`, which is also what makes
|
|
@@ -56,13 +61,14 @@ export const shaderFill = {
|
|
|
56
61
|
// fill arrays differ in length) work.
|
|
57
62
|
lerp: (a, b, t) => ({
|
|
58
63
|
source: t < 0.5 ? a.source : b.source,
|
|
64
|
+
language: t < 0.5 ? a.language : b.language,
|
|
65
|
+
...withContract(t < 0.5 ? a : b),
|
|
59
66
|
uniforms: lerpUniformRecord(a.uniforms, b.uniforms, t),
|
|
60
|
-
coords: t < 0.5 ? a.coords : b.coords,
|
|
61
67
|
textures: t < 0.5 ? a.textures : b.textures,
|
|
62
68
|
opacity: (a.opacity ?? 1) + ((b.opacity ?? 1) - (a.opacity ?? 1)) * t,
|
|
63
69
|
}),
|
|
64
70
|
equals: (a, b) => a.source === b.source &&
|
|
65
|
-
a.
|
|
71
|
+
a.contract === b.contract &&
|
|
66
72
|
uniformRecordsEqual(a.uniforms, b.uniforms) &&
|
|
67
73
|
texturesEqual(a.textures, b.textures),
|
|
68
74
|
// Runs off the same descriptors the renderer binds, so what gets loaded can't
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/fill/implementations/shader.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GAItB,MAAM,qBAAqB,CAAC;AAI7B;;;;GAIG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC;AAuFvB,gFAAgF;AAChF,SAAS,eAAe,CAAC,QAA8C;IACnE,IAAI,CAAC,QAAQ,EAAE,MAAM;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,GAAG,GAAoB,EAAE,CAAC;IAChC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,GAAG;YAAE,SAAS;QAC9C,IAAI,GAAG,CAAC,MAAM,IAAI,YAAY,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,2CAA2C,YAAY,kCAAkC,CAAC,CAAC;YACxG,MAAM;QACV,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACxC,CAAC;AAED,SAAS,aAAa,CAAC,CAA8B,EAAE,CAA8B;IACjF,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACpD,OAAO,CAAC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,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtD,MAAM,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM;QACrC,QAAQ,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;QAC3C,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC;KACxE,CAAC;IAEF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,mBAAmB,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC;QAC3C,aAAa,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC;IAEzC,8EAA8E;IAC9E,gCAAgC;IAChC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QACtB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE;YAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzE,CAAC;CACJ,CAAC","sourcesContent":["import type { BlendMode } from '../blend';\r\nimport type { FillData } from '../registry';\r\nimport {\r\n lerpUniformRecord,\r\n normalizeUniforms,\r\n uniformRecordsEqual,\r\n type ShaderFillCoords,\r\n type SkSLUniform,\r\n type SkSLUniformRecord,\r\n} from '../../sksl-uniforms';\r\n\r\nexport type { ShaderFillCoords };\r\n\r\n/**\r\n * Ceiling on bound samplers. Skia has no hard limit here, but a fill wanting more\r\n * than a handful of textures is really a 3D scene, and the cap keeps a typo in a\r\n * generated list from exhausting texture units.\r\n */\r\nconst MAX_TEXTURES = 4;\r\n\r\n/** An image bound to one of the shader's `uniform shader` declarations. */\r\nexport interface ShaderTexture {\r\n /** The `uniform shader` name in the source this image binds to. */\r\n name: string;\r\n /** Asset path, resolved like any other image fill's `src`. */\r\n src: string;\r\n}\r\n\r\n/**\r\n * A custom SkSL shader, painted as a fill.\r\n *\r\n * The escape hatch at the end of the procedural spectrum: where\r\n * {@link NoiseFillProp} and {@link FractalNoiseFillProp} expose a fixed set of\r\n * knobs over a fixed field, this hands the whole fragment function to the author.\r\n * It is still a fill, so it paints inside the shape's own path — an `Ellipse`, a\r\n * `Path`, a run of `Text` — stacks as one layer in the fill array, and inherits\r\n * the layer's `opacity`/`blend`/`space` like every other kind.\r\n *\r\n * Rect({ fill: Fills.shader(src, { uniforms: { u_amount: 0.4 } }) })\r\n * Text({ text: \"DEPTH\", fontSize: 320, fill: Fills.shader(src) })\r\n *\r\n * The contract on the source is `vec4 main(vec2 fragCoord)` returning\r\n * **premultiplied** rgba. It must *not* fold `opacity` in: the fill layer's\r\n * opacity is already on the paint as an alpha the shader's output is modulated\r\n * by, so a shader applying it again renders at the square of what was asked for.\r\n * That is also why no `u_alpha` built-in is offered.\r\n *\r\n * Uniforms are supplied **by name**, not by position, and marshalled by\r\n * reflecting the compiled program. So declaration order doesn't matter, a\r\n * declared-but-unsupplied uniform reads as zero with a warning instead of\r\n * silently refusing to paint, and the renderer can fill in built-ins\r\n * (`u_size`, `u_origin`, `u_resolution`, `u_aspect`, `u_time`, `u_scale`) for\r\n * whichever of them the source happens to declare.\r\n *\r\n * `source` is the compile-cache key, so it **snaps** at a tween's midpoint rather\r\n * than interpolating — tweening it would compile a program per frame. Keep the\r\n * source constant (hoist it to module scope) and put everything that changes in a\r\n * uniform, which costs nothing: uniform values are an in-place write.\r\n */\r\nexport interface ShaderFillProp {\r\n type: 'shader';\r\n /** SkSL source declaring `vec4 main(vec2 fragCoord)`. Hoist it; don't rebuild it per frame. */\r\n source: string;\r\n /**\r\n * The shader pack this was built from, when it was built from one.\r\n *\r\n * **Reserved, and carried rather than read.** A pack resolves to a plain\r\n * uniform record before it reaches here, so nothing in the render path needs\r\n * it — the frame is identical with or without it. What it exists for is the\r\n * trip back: a document stores resolved uniforms, and without a reference to\r\n * the pack a host reopening a saved scene has a set of numbers and no way to\r\n * know which of them were `twist` and `ink`, so the property panel it drew\r\n * when the shader was applied cannot be drawn again.\r\n *\r\n * An id naming a pack that is not registered is **not** an error: the shader\r\n * still renders, because the uniforms it needs are already in the document.\r\n * The host simply cannot offer the panel.\r\n */\r\n shaderId?: string;\r\n /**\r\n * Uniform values keyed by their declared name. The `sksl` effect's positional\r\n * `[{name, value}]` array is accepted too, so a shader can move between an\r\n * effect and a fill unchanged.\r\n */\r\n uniforms?: SkSLUniformRecord | readonly SkSLUniform[];\r\n /** What `fragCoord` means. Default `'normalized'`. See {@link ShaderFillCoords}. */\r\n coords?: ShaderFillCoords;\r\n /** Images bound to the source's `uniform shader` declarations, matched by name. */\r\n textures?: readonly ShaderTexture[];\r\n opacity?: number;\r\n blend?: BlendMode;\r\n}\r\n\r\nexport interface ShaderFillResolved {\r\n type: 'shader';\r\n source: string;\r\n /** See {@link ShaderFillProp.shaderId}. */\r\n shaderId?: string;\r\n uniforms: SkSLUniformRecord;\r\n coords: ShaderFillCoords;\r\n textures?: ShaderTexture[];\r\n opacity?: number;\r\n blend?: BlendMode;\r\n}\r\n\r\n/** Copy the texture list, dropping malformed entries and capping the length. */\r\nfunction resolveTextures(textures: readonly ShaderTexture[] | undefined): ShaderTexture[] | undefined {\r\n if (!textures?.length) return undefined;\r\n const out: ShaderTexture[] = [];\r\n for (const texture of textures) {\r\n if (!texture?.name || !texture?.src) continue;\r\n if (out.length >= MAX_TEXTURES) {\r\n console.warn(`[SkSL] A shader fill declares more than ${MAX_TEXTURES} textures; the rest are ignored.`);\r\n break;\r\n }\r\n out.push({ name: texture.name, src: texture.src });\r\n }\r\n return out.length ? out : undefined;\r\n}\r\n\r\nfunction texturesEqual(a: ShaderTexture[] | undefined, b: ShaderTexture[] | undefined): boolean {\r\n if (a === b) return true;\r\n if (!a || !b || a.length !== b.length) return false;\r\n return a.every((t, i) => t.name === b[i].name && t.src === b[i].src);\r\n}\r\n\r\nexport const shaderFill: FillData<ShaderFillResolved> = {\r\n resolve: (prop: ShaderFillProp) => ({\r\n type: 'shader',\r\n source: prop.source ?? '',\r\n // Carried, never read: see `ShaderFillProp.shaderId`. Omitted when absent\r\n // so `equals` compares like with like for a fill that never had one.\r\n ...(prop.shaderId !== undefined ? { shaderId: prop.shaderId } : {}),\r\n // Normalised (and key-sorted) here rather than at paint time so `equals`\r\n // and any structural diff see the same canonical record the renderer\r\n // marshals, whichever authoring shape it came in as.\r\n uniforms: normalizeUniforms(prop.uniforms),\r\n coords: prop.coords ?? 'normalized',\r\n textures: resolveTextures(prop.textures),\r\n opacity: prop.opacity,\r\n blend: prop.blend,\r\n }),\r\n\r\n // `source`, `coords` and `textures` snap; only the uniform values and\r\n // `opacity` interpolate. The source is `getOrCompileSkSL`'s cache key, so\r\n // there is nothing halfway between two programs to cross to — the same reason\r\n // an image fill's `src` and a 3D fill's scene snap. `coords` is a discrete\r\n // matrix and a texture list is a discrete set of bindings.\r\n //\r\n // Deliberately returns neither `type` nor `blend`: `FillResult` omits both and\r\n // `lerpFill` reassembles via `{ ...a, ...lerp(...) }`, which is also what makes\r\n // the ragged-array self-pair (a fill fading against a copy of itself, when two\r\n // fill arrays differ in length) work.\r\n lerp: (a, b, t) => ({\r\n source: t < 0.5 ? a.source : b.source,\r\n uniforms: lerpUniformRecord(a.uniforms, b.uniforms, t),\r\n coords: t < 0.5 ? a.coords : b.coords,\r\n textures: t < 0.5 ? a.textures : b.textures,\r\n opacity: (a.opacity ?? 1) + ((b.opacity ?? 1) - (a.opacity ?? 1)) * t,\r\n }),\r\n\r\n equals: (a, b) =>\r\n a.source === b.source &&\r\n a.coords === b.coords &&\r\n uniformRecordsEqual(a.uniforms, b.uniforms) &&\r\n texturesEqual(a.textures, b.textures),\r\n\r\n // Runs off the same descriptors the renderer binds, so what gets loaded can't\r\n // drift from what gets sampled.\r\n declare: (fill, assets) => {\r\n for (const texture of fill.textures ?? []) assets.image(texture.src);\r\n },\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"shader.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/fill/implementations/shader.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,GAGtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAE/E;;;GAGG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC;AAwFvB,gFAAgF;AAChF,SAAS,eAAe,CAAC,QAA8C;IACnE,IAAI,CAAC,QAAQ,EAAE,MAAM;QAAE,OAAO,SAAS,CAAC;IACxC,MAAM,GAAG,GAAoB,EAAE,CAAC;IAChC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC7B,IAAI,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,OAAO,EAAE,GAAG;YAAE,SAAS;QAC9C,IAAI,GAAG,CAAC,MAAM,IAAI,YAAY,EAAE,CAAC;YAC7B,OAAO,CAAC,IAAI,CAAC,6CAA6C,YAAY,kCAAkC,CAAC,CAAC;YAC1G,MAAM;QACV,CAAC;QACD,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AACxC,CAAC;AAED,SAAS,YAAY,CAAC,MAAgD;IAClE,MAAM,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CA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AEzC,8EAA8E;IAC9E,gCAAgC;IAChC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;QACtB,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,QAAQ,IAAI,EAAE;YAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACzE,CAAC;CACJ,CAAC","sourcesContent":["import type { BlendMode } from '../blend';\r\nimport type { FillData } from '../registry';\r\nimport {\r\n lerpUniformRecord,\r\n normalizeUniforms,\r\n uniformRecordsEqual,\r\n type ShaderUniform,\r\n type ShaderUniformRecord,\r\n} from '../../shaders/uniforms';\r\nimport { shaderContractOf, type ShaderLanguage } from '../../shaders/language';\r\n\r\n/**\r\n * Ceiling on bound textures: a fill wanting more than a handful is really a 3D\r\n * scene, and the cap keeps a typo in a generated list from exhausting texture units.\r\n */\r\nconst MAX_TEXTURES = 4;\r\n\r\n/** An image the shader samples. */\r\nexport interface ShaderTexture {\r\n /** The name the shader pack gives this texture. */\r\n name: string;\r\n /** Asset path, resolved like any other image fill's `src`. */\r\n src: string;\r\n}\r\n\r\n/**\r\n * A custom WGSL shader, painted as a fill.\r\n *\r\n * The source defines `fn fill(in: FillIn) -> vec4f`, returning **premultiplied**\r\n * rgba; `in` carries `uv` (0–1 across the box), `local` (px from the box's\r\n * top-left), `size`, `time` and `scale` (device px per px), and the uniforms are\r\n * `u`, a `struct Params` the source declares. The first of `textures` is what\r\n * `sample_texture(uv)` reads.\r\n *\r\n * The escape hatch at the end of the procedural spectrum: where\r\n * {@link NoiseFillProp} and {@link FractalNoiseFillProp} expose a fixed set of\r\n * knobs over a fixed field, this hands the whole fragment function to the author.\r\n * It is still a fill, so it paints inside the shape's own path — an `Ellipse`, a\r\n * `Path`, a run of `Text` — stacks as one layer in the fill array, and inherits\r\n * the layer's `opacity`/`blend`/`space` like every other kind.\r\n *\r\n * Rect({ fill: Fills.shader(src, { uniforms: { amount: 0.4 } }) })\r\n * Text({ text: \"DEPTH\", fontSize: 320, fill: Fills.shader(src) })\r\n *\r\n * It must *not* fold `opacity` in: the fill layer's opacity is already applied\r\n * to the output, so a shader applying it again renders at the square of what\r\n * was asked for.\r\n *\r\n * `source` is the compile-cache key, so it **snaps** at a tween's midpoint rather\r\n * than interpolating — tweening it would compile a program per frame. Keep the\r\n * source constant (hoist it to module scope) and put everything that changes in a\r\n * uniform, which costs nothing: uniform values are an in-place write.\r\n */\r\nexport interface ShaderFillProp {\r\n type: 'shader';\r\n /** The program. Hoist it; don't rebuild it per frame. */\r\n source: string;\r\n /** The language `source` is written in; WGSL when absent. */\r\n language?: ShaderLanguage;\r\n /** WGSL only: the contract version it is written against (`WGSL_CONTRACT` when absent). */\r\n contract?: number;\r\n /**\r\n * The shader pack this was built from, when it was built from one.\r\n *\r\n * **Reserved, and carried rather than read.** A pack resolves to a plain\r\n * uniform record before it reaches here, so nothing in the render path needs\r\n * it — the frame is identical with or without it. What it exists for is the\r\n * trip back: a document stores resolved uniforms, and without a reference to\r\n * the pack a host reopening a saved scene has a set of numbers and no way to\r\n * know which of them were `twist` and `ink`, so the property panel it drew\r\n * when the shader was applied cannot be drawn again.\r\n *\r\n * An id naming a pack that is not registered is **not** an error: the shader\r\n * still renders, because the uniforms it needs are already in the document.\r\n * The host simply cannot offer the panel.\r\n */\r\n shaderId?: string;\r\n /**\r\n * Uniform values keyed by their declared name. The positional\r\n * `[{name, value}]` array is accepted too, so a shader can move between an\r\n * effect and a fill unchanged.\r\n */\r\n uniforms?: ShaderUniformRecord | readonly ShaderUniform[];\r\n /** Images the shader samples. */\r\n textures?: readonly ShaderTexture[];\r\n opacity?: number;\r\n blend?: BlendMode;\r\n}\r\n\r\nexport interface ShaderFillResolved {\r\n type: 'shader';\r\n source: string;\r\n language: ShaderLanguage;\r\n /** WGSL only. See {@link ShaderFillProp.contract}. */\r\n contract?: number;\r\n /** See {@link ShaderFillProp.shaderId}. */\r\n shaderId?: string;\r\n uniforms: ShaderUniformRecord;\r\n textures?: ShaderTexture[];\r\n opacity?: number;\r\n blend?: BlendMode;\r\n}\r\n\r\n/** Copy the texture list, dropping malformed entries and capping the length. */\r\nfunction resolveTextures(textures: readonly ShaderTexture[] | undefined): ShaderTexture[] | undefined {\r\n if (!textures?.length) return undefined;\r\n const out: ShaderTexture[] = [];\r\n for (const texture of textures) {\r\n if (!texture?.name || !texture?.src) continue;\r\n if (out.length >= MAX_TEXTURES) {\r\n console.warn(`[shader] A shader fill declares more than ${MAX_TEXTURES} textures; the rest are ignored.`);\r\n break;\r\n }\r\n out.push({ name: texture.name, src: texture.src });\r\n }\r\n return out.length ? out : undefined;\r\n}\r\n\r\nfunction withContract(shader: { language?: string; contract?: number }): { contract?: number } {\r\n const contract = shaderContractOf(shader);\r\n return contract === undefined ? {} : { contract };\r\n}\r\n\r\nfunction texturesEqual(a: ShaderTexture[] | undefined, b: ShaderTexture[] | undefined): boolean {\r\n if (a === b) return true;\r\n if (!a || !b || a.length !== b.length) return false;\r\n return a.every((t, i) => t.name === b[i].name && t.src === b[i].src);\r\n}\r\n\r\nexport const shaderFill: FillData<ShaderFillResolved> = {\r\n resolve: (prop: ShaderFillProp) => ({\r\n type: 'shader',\r\n source: prop.source ?? '',\r\n // A stored document may still say \"sksl\"; carried so the renderer can report it.\r\n language: prop.language ?? 'wgsl',\r\n ...withContract(prop),\r\n // Carried, never read: see `ShaderFillProp.shaderId`. Omitted when absent\r\n // so `equals` compares like with like for a fill that never had one.\r\n ...(prop.shaderId !== undefined ? { shaderId: prop.shaderId } : {}),\r\n // Normalised (and key-sorted) here rather than at paint time so `equals`\r\n // and any structural diff see the same canonical record the renderer\r\n // binds, whichever authoring shape it came in as.\r\n uniforms: normalizeUniforms(prop.uniforms),\r\n textures: resolveTextures(prop.textures),\r\n opacity: prop.opacity,\r\n blend: prop.blend,\r\n }),\r\n\r\n // `source` and `textures` snap; only the uniform values and `opacity`\r\n // interpolate. The source is the compile-cache key, so there is nothing\r\n // halfway between two programs to cross to — the same reason an image\r\n // fill's `src` and a 3D fill's scene snap.\r\n //\r\n // Deliberately returns neither `type` nor `blend`: `FillResult` omits both and\r\n // `lerpFill` reassembles via `{ ...a, ...lerp(...) }`, which is also what makes\r\n // the ragged-array self-pair (a fill fading against a copy of itself, when two\r\n // fill arrays differ in length) work.\r\n lerp: (a, b, t) => ({\r\n source: t < 0.5 ? a.source : b.source,\r\n language: t < 0.5 ? a.language : b.language,\r\n ...withContract(t < 0.5 ? a : b),\r\n uniforms: lerpUniformRecord(a.uniforms, b.uniforms, t),\r\n textures: t < 0.5 ? a.textures : b.textures,\r\n opacity: (a.opacity ?? 1) + ((b.opacity ?? 1) - (a.opacity ?? 1)) * t,\r\n }),\r\n\r\n equals: (a, b) =>\r\n a.source === b.source &&\r\n a.contract === b.contract &&\r\n uniformRecordsEqual(a.uniforms, b.uniforms) &&\r\n texturesEqual(a.textures, b.textures),\r\n\r\n // Runs off the same descriptors the renderer binds, so what gets loaded can't\r\n // drift from what gets sampled.\r\n declare: (fill, assets) => {\r\n for (const texture of fill.textures ?? []) assets.image(texture.src);\r\n },\r\n};\r\n"]}
|
|
@@ -15,7 +15,7 @@ export type { LinearGradientFillProp, LinearGradientFillResolved } from './imple
|
|
|
15
15
|
export type { NoiseFillProp, NoiseFillResolved } from './implementations/noise.js';
|
|
16
16
|
export type { FractalNoiseFillProp, FractalNoiseFillResolved, FractalNoiseBasis } from './implementations/fractal-noise.js';
|
|
17
17
|
export type { RadialGradientFillProp, RadialGradientFillResolved } from './implementations/radial-gradient.js';
|
|
18
|
-
export type { ShaderFillProp, ShaderFillResolved,
|
|
18
|
+
export type { ShaderFillProp, ShaderFillResolved, ShaderTexture } from './implementations/shader.js';
|
|
19
19
|
export type { StripeFillProp, StripeFillResolved } from './implementations/stripe.js';
|
|
20
20
|
export type { DotGridFillProp, DotGridFillResolved } from './implementations/dot-grid.js';
|
|
21
21
|
export type { GridFillProp, GridFillResolved } from './implementations/grid.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,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AQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAazE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { BlendModes as BLEND_MODES_LIST, NodeBlendModes, getBlendModeHash } from './blend';\r\nexport type { BlendMode, NodeBlendMode } from './blend';\r\n\r\nexport { setTheme, parseColor, getTypographyPreset } from './color/parser';\r\nexport type { NormalizedColor, Color } from './color/parser';\r\nexport { lerpColor, colorOps } from './lerp';\r\n\r\nexport type { FillProp, FillResolved, FillSpace, FillCommon } from './union';\r\n\r\nexport { Fills, FillChain, resolveChainFill } from './chain';\r\nexport type { Fill, FillOptions, VideoFillOptions, MediaPlacementOptions } from './chain';\r\n\r\nexport type { FillData } from './registry';\r\nexport { resolveFill, lerpFill, canLerpFill, fillOps } from './registry';\r\n\r\nexport type { SolidFillProp, SolidFillResolved } from './implementations/color';\r\nexport type { ConicGradientFillProp, ConicGradientFillResolved } from './implementations/conic-gradient';\r\nexport type { ImageFit, ImageCrop, ImageMatrix, ImageFillProp, ImageFillResolved } from './implementations/image';\r\nexport type { LinearGradientFillProp, LinearGradientFillResolved } from './implementations/linear-gradient';\r\nexport type { NoiseFillProp, NoiseFillResolved } from './implementations/noise';\r\nexport type { FractalNoiseFillProp, FractalNoiseFillResolved, FractalNoiseBasis } from './implementations/fractal-noise';\r\nexport type { RadialGradientFillProp, RadialGradientFillResolved } from './implementations/radial-gradient';\r\nexport type { ShaderFillProp, ShaderFillResolved,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,gBAAgB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAG3F,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE3E,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAI7C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAI7D,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAazE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export { BlendModes as BLEND_MODES_LIST, NodeBlendModes, getBlendModeHash } from './blend';\r\nexport type { BlendMode, NodeBlendMode } from './blend';\r\n\r\nexport { setTheme, parseColor, getTypographyPreset } from './color/parser';\r\nexport type { NormalizedColor, Color } from './color/parser';\r\nexport { lerpColor, colorOps } from './lerp';\r\n\r\nexport type { FillProp, FillResolved, FillSpace, FillCommon } from './union';\r\n\r\nexport { Fills, FillChain, resolveChainFill } from './chain';\r\nexport type { Fill, FillOptions, VideoFillOptions, MediaPlacementOptions } from './chain';\r\n\r\nexport type { FillData } from './registry';\r\nexport { resolveFill, lerpFill, canLerpFill, fillOps } from './registry';\r\n\r\nexport type { SolidFillProp, SolidFillResolved } from './implementations/color';\r\nexport type { ConicGradientFillProp, ConicGradientFillResolved } from './implementations/conic-gradient';\r\nexport type { ImageFit, ImageCrop, ImageMatrix, ImageFillProp, ImageFillResolved } from './implementations/image';\r\nexport type { LinearGradientFillProp, LinearGradientFillResolved } from './implementations/linear-gradient';\r\nexport type { NoiseFillProp, NoiseFillResolved } from './implementations/noise';\r\nexport type { FractalNoiseFillProp, FractalNoiseFillResolved, FractalNoiseBasis } from './implementations/fractal-noise';\r\nexport type { RadialGradientFillProp, RadialGradientFillResolved } from './implementations/radial-gradient';\r\nexport type { ShaderFillProp, ShaderFillResolved, ShaderTexture } from './implementations/shader';\r\nexport type { StripeFillProp, StripeFillResolved } from './implementations/stripe';\r\nexport type { DotGridFillProp, DotGridFillResolved } from './implementations/dot-grid';\r\nexport type { GridFillProp, GridFillResolved } from './implementations/grid';\r\nexport { MINOR_WIDTH_RATIO } from './implementations/grid';\r\nexport type { VideoFillProp, VideoFillResolved } from './implementations/video';\r\nexport { resolveVideoTimestamp } from './implementations/video';\r\nexport type { Canvas3DFillProp, Canvas3DFillResolved } from './implementations/canvas3d';\r\n"]}
|
|
@@ -14,8 +14,7 @@ export declare function resolveFill(prop: FillProp): FillResolved;
|
|
|
14
14
|
* What an empty media slot paints: an image fill naming no source.
|
|
15
15
|
*
|
|
16
16
|
* The renderer turns an empty `src` into the transparency checkerboard rather
|
|
17
|
-
* than into nothing
|
|
18
|
-
* the whole of why. Both media nodes reach for this when their own source is
|
|
17
|
+
* than into nothing. Both media nodes reach for this when their own source is
|
|
19
18
|
* unset, so the two cannot end up drawing different placeholders.
|
|
20
19
|
*
|
|
21
20
|
* Resolved once and shared: it has no props to vary, and the two places that key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAa,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAoB,MAAM,SAAS,CAAC;AAEjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAoBlE,KAAK,UAAU,CAAC,CAAC,SAAS,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;AAEzE,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,YAAY;IAC5C,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC;IACtB,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CA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AE,QAAQ,GAAG,YAAY,CAUxD;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB,EAAE,YAGjB,CAAC;AAEf;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAGrE;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,GAAG,YAAY,CAmBlF;AAOD,wBAAgB,WAAW,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAExE;AAED,+EAA+E;AAC/E,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,EAAE,CAgCtD,CAAC"}
|
|
@@ -55,8 +55,7 @@ export function resolveFill(prop) {
|
|
|
55
55
|
* What an empty media slot paints: an image fill naming no source.
|
|
56
56
|
*
|
|
57
57
|
* The renderer turns an empty `src` into the transparency checkerboard rather
|
|
58
|
-
* than into nothing
|
|
59
|
-
* the whole of why. Both media nodes reach for this when their own source is
|
|
58
|
+
* than into nothing. Both media nodes reach for this when their own source is
|
|
60
59
|
* unset, so the two cannot end up drawing different placeholders.
|
|
61
60
|
*
|
|
62
61
|
* Resolved once and shared: it has no props to vary, and the two places that key
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAA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AAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC1C,CAAC;qBAAM,CAAC;oBACJ,IAAI,OAAO,GAAG,CAAC;wBAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;oBAC3D,IAAI,OAAO,GAAG,CAAC;wBAAE,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,CAAC;YACL,CAAC;iBAAM,IAAI,CAAC,EAAE,CAAC;gBACX,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;YAC5D,CAAC;iBAAM,IAAI,EAAE,EAAE,CAAC;gBACZ,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;YAC9D,CAAC;QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAC","sourcesContent":["import type { AssetScope } from \"@/assets/scope\";\r\nimport { FillProp, FillResolved, FillSpace } from \"./union\";\r\nimport { Fill, resolveChainFill } from \"./chain\";\r\nimport { canCoerce, coercePair } from \"./coerce\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\nimport { colorFill } from \"./implementations/color\";\r\nimport { linearGradientFill } from \"./implementations/linear-gradient\";\r\nimport { radialGradientFill } from \"./implementations/radial-gradient\";\r\nimport { conicGradientFill } from \"./implementations/conic-gradient\";\r\nimport { noiseFill } from \"./implementations/noise\";\r\nimport { fractalNoiseFill } from \"./implementations/fractal-noise\";\r\nimport { stripeFill } from \"./implementations/stripe\";\r\nimport { dotGridFill } from \"./implementations/dot-grid\";\r\nimport { gridFill } from \"./implementations/grid\";\r\nimport { shaderFill } from \"./implementations/shader\";\r\nimport { imageFill } from \"./implementations/image\";\r\nimport { videoFill } from \"./implementations/video\";\r\nimport { canvas3DFill } from \"./implementations/canvas3d\";\r\n// The one value import from `render3d` into the fill layer, for the bare-scene\r\n// coercion in `resolveFill`. Acyclic: `render3d` only imports `Color` back from\r\n// here, and does so type-only.\r\nimport { Scene3D } from \"@/render3d/scene3d\";\r\n\r\ntype FillResult<T extends FillResolved> = Omit<Omit<T, \"type\">, \"blend\">;\r\n\r\nexport interface FillData<T extends FillResolved> {\r\n resolve(prop: any): T;\r\n equals(a: T, b: T): boolean;\r\n lerp(from: FillResult<T>, to: FillResult<T>, t: number): FillResult<T>;\r\n declare?(fill: T, assets: AssetScope): void;\r\n}\r\n\r\nconst FILLS = new Map<string, FillData<FillResolved>>([\r\n [\"solid\", colorFill as FillData<FillResolved>],\r\n [\"linear-gradient\", linearGradientFill as FillData<FillResolved>],\r\n [\"radial-gradient\", radialGradientFill as FillData<FillResolved>],\r\n [\"conic-gradient\", conicGradientFill as FillData<FillResolved>],\r\n [\"noise\", noiseFill as FillData<FillResolved>],\r\n [\"fractalNoise\", fractalNoiseFill as FillData<FillResolved>],\r\n [\"stripe\", stripeFill as FillData<FillResolved>],\r\n [\"dotGrid\", dotGridFill as FillData<FillResolved>],\r\n [\"grid\", gridFill as FillData<FillResolved>],\r\n [\"shader\", shaderFill as FillData<FillResolved>],\r\n [\"image\", imageFill as FillData<FillResolved>],\r\n [\"video\", videoFill as FillData<FillResolved>],\r\n [\"canvas3D\", canvas3DFill as FillData<FillResolved>],\r\n]);\r\n\r\nfunction get(name: string): FillData<FillResolved> {\r\n const data = FILLS.get(name);\r\n if (!data) throw new Error(`Fill \"${name}\" is not registered`);\r\n return data;\r\n}\r\n\r\nexport function resolveFill(prop: FillProp): FillResolved {\r\n if (typeof prop === \"string\") return resolveFill({ type: \"solid\", color: prop });\r\n // A bare built scene is shorthand for a 3D fill, the same way a bare CSS\r\n // string is shorthand for a solid one.\r\n if (prop instanceof Scene3D) return resolveFill({ type: \"canvas3D\", scene: prop });\r\n const resolved = get(prop.type).resolve(prop);\r\n // `space` is a cross-cutting rendering directive (like `blend`); carry it\r\n // through generically so each fill `resolve()` doesn't have to know about it.\r\n const space = (prop as { space?: FillSpace }).space;\r\n return space !== undefined ? { ...resolved, space } : resolved;\r\n}\r\n\r\n/**\r\n * What an empty media slot paints: an image fill naming no source.\r\n *\r\n * The renderer turns an empty `src` into the transparency checkerboard rather\r\n * than into nothing — see `applyUnsetMediaPaint` in `skia-render`, which holds\r\n * the whole of why. Both media nodes reach for this when their own source is\r\n * unset, so the two cannot end up drawing different placeholders.\r\n *\r\n * Resolved once and shared: it has no props to vary, and the two places that key\r\n * per-fill state by object identity (`paintSlot`, `preflighted`) are both scoped\r\n * to one node's single `applyFills` call, where this can appear only once.\r\n *\r\n * Declared here rather than beside the image fill's own implementation because\r\n * resolving one needs {@link resolveFill}, and that lives on this side of the\r\n * dependency — the implementations are what the registry imports, not the other\r\n * way round.\r\n */\r\nexport const UNSET_MEDIA_FILL: FillResolved = resolveFill({\r\n type: \"image\",\r\n src: \"\",\r\n} as FillProp);\r\n\r\n/**\r\n * True when `a` and `b` can be interpolated into a single fill by {@link\r\n * lerpFill} without throwing — i.e. they share a type with the same `blend`, or\r\n * they're a color/gradient pair {@link canCoerce} can promote to one type.\r\n *\r\n * Pairs that fail this (e.g. color↔image, image↔video, or same-type fills with\r\n * differing blend modes) have no meaningful single-type in-between; {@link\r\n * fillOps}'s `lerp` cross-fades them as two stacked layers instead.\r\n */\r\nexport function canLerpFill(a: FillResolved, b: FillResolved): boolean {\r\n if (a.type === b.type) return a.blend === b.blend;\r\n return canCoerce(a, b);\r\n}\r\n\r\nexport function lerpFill(a: FillResolved, b: FillResolved, t: number): FillResolved {\r\n const clamped = Math.min(1, Math.max(0, t));\r\n\r\n // Cross-type tween (color↔gradient, or gradient↔gradient of different\r\n // kinds): promote both endpoints to a common type, then lerp with that\r\n // type's lerp. blend cannot interpolate, so it snaps with the rest of the\r\n // coerced shape.\r\n if (a.type !== b.type) {\r\n if (!canCoerce(a, b)) {\r\n throw new Error(`No registered lerp for fills of type \"${a.type}\" and \"${b.type}\"`);\r\n }\r\n const [ca, cb] = coercePair(a, b);\r\n return { ...ca, ...get(ca.type).lerp(ca, cb, clamped) };\r\n }\r\n\r\n if (a.blend !== b.blend) {\r\n throw new Error(`No registered lerp for fills of type \"${a.type}\" and \"${b.type}\"`);\r\n }\r\n return { ...a, ...get(a.type).lerp(a, b, clamped) };\r\n}\r\n\r\n/** Returns `fill` with its effective opacity scaled by `factor` (clamped to ≥0). */\r\nfunction scaleOpacity(fill: FillResolved, factor: number): FillResolved {\r\n return { ...fill, opacity: (fill.opacity ?? 1) * Math.max(0, factor) };\r\n}\r\n\r\nexport function declareFill(fill: FillResolved, assets: AssetScope): void {\r\n FILLS.get(fill.type)?.declare?.(fill, assets);\r\n}\r\n\r\n/** The fill-layer attribute's op set — the `fill` prop's resolve/lerp pair. */\r\nexport const fillOps: AttributeOps<Fill, FillResolved[]> = {\r\n resolve: (prop) => resolveChainFill(prop).map(resolveFill),\r\n lerp: (from, to, t) => {\r\n if (from === to) return from;\r\n if (!from.length && !to.length) return [];\r\n const clamped = Math.min(1, Math.max(0, t));\r\n const maxLength = Math.max(from.length, to.length);\r\n const result: FillResolved[] = [];\r\n for (let i = 0; i < maxLength; i++) {\r\n const f = from[i];\r\n const tf = to[i];\r\n if (f && tf) {\r\n // Interpolate in place when the two fills share an interpolatable\r\n // shape (same type, or a coercible color/gradient pair). When they\r\n // don't (e.g. color↔image, image↔video) there is no single-type\r\n // in-between, so cross-fade instead: paint the outgoing fill fading\r\n // out beneath the incoming fill fading in. The dropped-out endpoints\r\n // are omitted so a static array of one fill stays a single layer.\r\n if (canLerpFill(f, tf)) {\r\n result.push(lerpFill(f, tf, clamped));\r\n } else {\r\n if (clamped < 1) result.push(scaleOpacity(f, 1 - clamped));\r\n if (clamped > 0) result.push(scaleOpacity(tf, clamped));\r\n }\r\n } else if (f) {\r\n result.push(lerpFill(f, { ...f, opacity: 0 }, clamped));\r\n } else if (tf) {\r\n result.push(lerpFill({ ...tf, opacity: 0 }, tf, clamped));\r\n }\r\n }\r\n return result;\r\n },\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/registry.ts"],"names":[],"mappings":"AAEA,OAAO,EAAQ,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,+EAA+E;AAC/E,gFAAgF;AAChF,+BAA+B;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAW7C,MAAM,KAAK,GAAG,IAAI,GAAG,CAAiC;IAClD,CAAC,OAAO,EAAE,SAAmC,CAAC;IAC9C,CAAC,i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QACL,CAAC;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ,CAAC","sourcesContent":["import type { AssetScope } from \"@/assets/scope\";\r\nimport { FillProp, FillResolved, FillSpace } from \"./union\";\r\nimport { Fill, resolveChainFill } from \"./chain\";\r\nimport { canCoerce, coercePair } from \"./coerce\";\r\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\r\n\r\nimport { colorFill } from \"./implementations/color\";\r\nimport { linearGradientFill } from \"./implementations/linear-gradient\";\r\nimport { radialGradientFill } from \"./implementations/radial-gradient\";\r\nimport { conicGradientFill } from \"./implementations/conic-gradient\";\r\nimport { noiseFill } from \"./implementations/noise\";\r\nimport { fractalNoiseFill } from \"./implementations/fractal-noise\";\r\nimport { stripeFill } from \"./implementations/stripe\";\r\nimport { dotGridFill } from \"./implementations/dot-grid\";\r\nimport { gridFill } from \"./implementations/grid\";\r\nimport { shaderFill } from \"./implementations/shader\";\r\nimport { imageFill } from \"./implementations/image\";\r\nimport { videoFill } from \"./implementations/video\";\r\nimport { canvas3DFill } from \"./implementations/canvas3d\";\r\n// The one value import from `render3d` into the fill layer, for the bare-scene\r\n// coercion in `resolveFill`. Acyclic: `render3d` only imports `Color` back from\r\n// here, and does so type-only.\r\nimport { Scene3D } from \"@/render3d/scene3d\";\r\n\r\ntype FillResult<T extends FillResolved> = Omit<Omit<T, \"type\">, \"blend\">;\r\n\r\nexport interface FillData<T extends FillResolved> {\r\n resolve(prop: any): T;\r\n equals(a: T, b: T): boolean;\r\n lerp(from: FillResult<T>, to: FillResult<T>, t: number): FillResult<T>;\r\n declare?(fill: T, assets: AssetScope): void;\r\n}\r\n\r\nconst FILLS = new Map<string, FillData<FillResolved>>([\r\n [\"solid\", colorFill as FillData<FillResolved>],\r\n [\"linear-gradient\", linearGradientFill as FillData<FillResolved>],\r\n [\"radial-gradient\", radialGradientFill as FillData<FillResolved>],\r\n [\"conic-gradient\", conicGradientFill as FillData<FillResolved>],\r\n [\"noise\", noiseFill as FillData<FillResolved>],\r\n [\"fractalNoise\", fractalNoiseFill as FillData<FillResolved>],\r\n [\"stripe\", stripeFill as FillData<FillResolved>],\r\n [\"dotGrid\", dotGridFill as FillData<FillResolved>],\r\n [\"grid\", gridFill as FillData<FillResolved>],\r\n [\"shader\", shaderFill as FillData<FillResolved>],\r\n [\"image\", imageFill as FillData<FillResolved>],\r\n [\"video\", videoFill as FillData<FillResolved>],\r\n [\"canvas3D\", canvas3DFill as FillData<FillResolved>],\r\n]);\r\n\r\nfunction get(name: string): FillData<FillResolved> {\r\n const data = FILLS.get(name);\r\n if (!data) throw new Error(`Fill \"${name}\" is not registered`);\r\n return data;\r\n}\r\n\r\nexport function resolveFill(prop: FillProp): FillResolved {\r\n if (typeof prop === \"string\") return resolveFill({ type: \"solid\", color: prop });\r\n // A bare built scene is shorthand for a 3D fill, the same way a bare CSS\r\n // string is shorthand for a solid one.\r\n if (prop instanceof Scene3D) return resolveFill({ type: \"canvas3D\", scene: prop });\r\n const resolved = get(prop.type).resolve(prop);\r\n // `space` is a cross-cutting rendering directive (like `blend`); carry it\r\n // through generically so each fill `resolve()` doesn't have to know about it.\r\n const space = (prop as { space?: FillSpace }).space;\r\n return space !== undefined ? { ...resolved, space } : resolved;\r\n}\r\n\r\n/**\r\n * What an empty media slot paints: an image fill naming no source.\r\n *\r\n * The renderer turns an empty `src` into the transparency checkerboard rather\r\n * than into nothing. Both media nodes reach for this when their own source is\r\n * unset, so the two cannot end up drawing different placeholders.\r\n *\r\n * Resolved once and shared: it has no props to vary, and the two places that key\r\n * per-fill state by object identity (`paintSlot`, `preflighted`) are both scoped\r\n * to one node's single `applyFills` call, where this can appear only once.\r\n *\r\n * Declared here rather than beside the image fill's own implementation because\r\n * resolving one needs {@link resolveFill}, and that lives on this side of the\r\n * dependency — the implementations are what the registry imports, not the other\r\n * way round.\r\n */\r\nexport const UNSET_MEDIA_FILL: FillResolved = resolveFill({\r\n type: \"image\",\r\n src: \"\",\r\n} as FillProp);\r\n\r\n/**\r\n * True when `a` and `b` can be interpolated into a single fill by {@link\r\n * lerpFill} without throwing — i.e. they share a type with the same `blend`, or\r\n * they're a color/gradient pair {@link canCoerce} can promote to one type.\r\n *\r\n * Pairs that fail this (e.g. color↔image, image↔video, or same-type fills with\r\n * differing blend modes) have no meaningful single-type in-between; {@link\r\n * fillOps}'s `lerp` cross-fades them as two stacked layers instead.\r\n */\r\nexport function canLerpFill(a: FillResolved, b: FillResolved): boolean {\r\n if (a.type === b.type) return a.blend === b.blend;\r\n return canCoerce(a, b);\r\n}\r\n\r\nexport function lerpFill(a: FillResolved, b: FillResolved, t: number): FillResolved {\r\n const clamped = Math.min(1, Math.max(0, t));\r\n\r\n // Cross-type tween (color↔gradient, or gradient↔gradient of different\r\n // kinds): promote both endpoints to a common type, then lerp with that\r\n // type's lerp. blend cannot interpolate, so it snaps with the rest of the\r\n // coerced shape.\r\n if (a.type !== b.type) {\r\n if (!canCoerce(a, b)) {\r\n throw new Error(`No registered lerp for fills of type \"${a.type}\" and \"${b.type}\"`);\r\n }\r\n const [ca, cb] = coercePair(a, b);\r\n return { ...ca, ...get(ca.type).lerp(ca, cb, clamped) };\r\n }\r\n\r\n if (a.blend !== b.blend) {\r\n throw new Error(`No registered lerp for fills of type \"${a.type}\" and \"${b.type}\"`);\r\n }\r\n return { ...a, ...get(a.type).lerp(a, b, clamped) };\r\n}\r\n\r\n/** Returns `fill` with its effective opacity scaled by `factor` (clamped to ≥0). */\r\nfunction scaleOpacity(fill: FillResolved, factor: number): FillResolved {\r\n return { ...fill, opacity: (fill.opacity ?? 1) * Math.max(0, factor) };\r\n}\r\n\r\nexport function declareFill(fill: FillResolved, assets: AssetScope): void {\r\n FILLS.get(fill.type)?.declare?.(fill, assets);\r\n}\r\n\r\n/** The fill-layer attribute's op set — the `fill` prop's resolve/lerp pair. */\r\nexport const fillOps: AttributeOps<Fill, FillResolved[]> = {\r\n resolve: (prop) => resolveChainFill(prop).map(resolveFill),\r\n lerp: (from, to, t) => {\r\n if (from === to) return from;\r\n if (!from.length && !to.length) return [];\r\n const clamped = Math.min(1, Math.max(0, t));\r\n const maxLength = Math.max(from.length, to.length);\r\n const result: FillResolved[] = [];\r\n for (let i = 0; i < maxLength; i++) {\r\n const f = from[i];\r\n const tf = to[i];\r\n if (f && tf) {\r\n // Interpolate in place when the two fills share an interpolatable\r\n // shape (same type, or a coercible color/gradient pair). When they\r\n // don't (e.g. color↔image, image↔video) there is no single-type\r\n // in-between, so cross-fade instead: paint the outgoing fill fading\r\n // out beneath the incoming fill fading in. The dropped-out endpoints\r\n // are omitted so a static array of one fill stays a single layer.\r\n if (canLerpFill(f, tf)) {\r\n result.push(lerpFill(f, tf, clamped));\r\n } else {\r\n if (clamped < 1) result.push(scaleOpacity(f, 1 - clamped));\r\n if (clamped > 0) result.push(scaleOpacity(tf, clamped));\r\n }\r\n } else if (f) {\r\n result.push(lerpFill(f, { ...f, opacity: 0 }, clamped));\r\n } else if (tf) {\r\n result.push(lerpFill({ ...tf, opacity: 0 }, tf, clamped));\r\n }\r\n }\r\n return result;\r\n },\r\n};\r\n"]}
|
|
@@ -62,7 +62,7 @@ export interface ExposureFilterOptions {
|
|
|
62
62
|
}
|
|
63
63
|
/** Raw 4×5 row-major colour matrix. Array shorthand sets `matrix`. */
|
|
64
64
|
export interface ColorMatrixFilterOptions {
|
|
65
|
-
/** 4×5 row-major colour matrix
|
|
65
|
+
/** 4×5 row-major colour matrix: rows R, G, B, A of `[r, g, b, a, bias]`. */
|
|
66
66
|
matrix: number[];
|
|
67
67
|
}
|
|
68
68
|
/** Tone curve through control points. */
|
|
@@ -131,7 +131,7 @@ export declare class AdjustmentChain {
|
|
|
131
131
|
exposure(options: number | ExposureFilterOptions): this;
|
|
132
132
|
/** Append a color-adjustment filter from the given partial settings. */
|
|
133
133
|
colorAdjustment(options: ColorAdjustmentFilterOptions): this;
|
|
134
|
-
/** Append a raw 4×5 row-major color matrix
|
|
134
|
+
/** Append a raw 4×5 row-major color matrix. */
|
|
135
135
|
colorMatrix(options: number[] | ColorMatrixFilterOptions): this;
|
|
136
136
|
/** Append a curves filter from control `points` ([input, output] pairs). */
|
|
137
137
|
curves(options: CurvesFilterOptions): this;
|
|
@@ -208,10 +208,6 @@ export declare class AdjustmentChain {
|
|
|
208
208
|
kaleidoscope(options?: AsFilterOptions<number | KaleidoscopeOptions>): this;
|
|
209
209
|
/** Append a custom shader pass over the fill. */
|
|
210
210
|
shader(options: AsFilterOptions<ShaderEffectOptions>): this;
|
|
211
|
-
/** @deprecated Use {@link AdjustmentChain.shader}. */
|
|
212
|
-
sksl(options: AsFilterOptions<Omit<ShaderEffectOptions, "source"> & {
|
|
213
|
-
shader: string;
|
|
214
|
-
}>): this;
|
|
215
211
|
/** Allows spreading the chain into an array: `[...Adjustments.blur(5)]`. */
|
|
216
212
|
[Symbol.iterator](): Generator<AnyFilter, void, unknown>;
|
|
217
213
|
/** Serializes to the raw filter array so frameworks that call `toJSON` get a plain value. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EACR,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,cAAc,EACd,WAAW,EACd,MAAM,kBAAkB,CAAC;AAE1B,kEAAkE;AAClE,KAAK,SAAS,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,qDAAqD;AACrD,MAAM,WAAW,iBAAiB;IAC9B,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,oDAAoD;AACpD,MAAM,WAAW,sBAAsB;IACnC,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,gEAAgE;AAChE,MAAM,WAAW,kBAAkB;IAC/B,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,uDAAuD;AACvD,MAAM,WAAW,qBAAqB;IAClC,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,sEAAsE;AACtE,MAAM,WAAW,wBAAwB;IACrC,
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EACR,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,YAAY,EACZ,0BAA0B,EAC1B,sBAAsB,EACtB,aAAa,EACb,cAAc,EAC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mB,CAAC;IAIpD,4EAA4E;IAC3E,CAAC,MAAM,CAAC,QAAQ,CAAC;IAIlB,6FAA6F;IAC7F,MAAM;CAGT;AAED;;;;;;GAMG;AACH,qBAAa,oBAAqB,SAAQ,eAAe;IACrD,yEAAyE;IACzE,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,0BAA0B;IAK1D,wEAAwE;IACxE,IAAI,CAAC,OAAO,EAAE,iBAAiB;CAGlC;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,eAAe,EAAE,GAAG,eAAe,CAAC;AAEpF;;;GAGG;AACH,MAAM,MAAM,eAAe,GACrB,CAAC,eAAe,GAAG,mBAAmB,CAAC,GACvC,CAAC,eAAe,GAAG,mBAAmB,CAAC,EAAE,GACzC,eAAe,CAAC;AAEtB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,iBAAwB,CAAC;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,sBAA6B,CAAC;AAE3D;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,iBAAc,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,YAAY,sBAAmB,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,GAAG,SAAS,GAAG,SAAS,EAAE,CAK3G"}
|
|
@@ -65,7 +65,7 @@ export class AdjustmentChain {
|
|
|
65
65
|
colorAdjustment(options) {
|
|
66
66
|
return this.append({ type: 'colorAdjustment', ...options });
|
|
67
67
|
}
|
|
68
|
-
/** Append a raw 4×5 row-major color matrix
|
|
68
|
+
/** Append a raw 4×5 row-major color matrix. */
|
|
69
69
|
colorMatrix(options) {
|
|
70
70
|
const matrix = Array.isArray(options) ? options : options.matrix;
|
|
71
71
|
return this.append({ type: 'colorMatrix', matrix });
|
|
@@ -213,10 +213,6 @@ export class AdjustmentChain {
|
|
|
213
213
|
shader(options) {
|
|
214
214
|
return this.append(fromEffect(new EffectChain().shader(options)));
|
|
215
215
|
}
|
|
216
|
-
/** @deprecated Use {@link AdjustmentChain.shader}. */
|
|
217
|
-
sksl(options) {
|
|
218
|
-
return this.append(fromEffect(new EffectChain().sksl(options)));
|
|
219
|
-
}
|
|
220
216
|
/** Allows spreading the chain into an array: `[...Adjustments.blur(5)]`. */
|
|
221
217
|
*[Symbol.iterator]() {
|
|
222
218
|
yield* this.list;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/chain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAkJ/C,8EAA8E;AAC9E,SAAS,YAAY,CAAmB,GAAe,EAAE,GAAY;IACjE,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAE,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;AACjE,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,KAAkB;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAc,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,eAAe;IACL;IAAnB,YAAmB,OAAoB,EAAE;QAAtB,SAAI,GAAJ,IAAI,CAAkB;IAAI,CAAC;IAE9C;;;OAGG;IACO,MAAM,CAAC,MAAiB;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,WAA8C,CAAC;QACjE,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED,uEAAuE;IAEvE,8BAA8B;IAC9B,IAAI,CAAC,OAAmC;QACpC,MAAM,EAAE,MAAM,EAAE,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACnD,OAAO,IAAI,CAAC,MAAM,CAAC,EA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AC,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAsD;IAC1F,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrC,IAAI,OAAO,YAAY,eAAe;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC","sourcesContent":["import { MediaAdjustment, VideoOnlyAdjustment } from \"./union\";\r\nimport { EffectChain } from \"../effects/chain\";\r\nimport type { BlendMode } from \"../fill/blend\";\r\nimport type { ColorAdjustmentFilter } from \"./implementations/color-adjustment\";\r\nimport type { CurvesChannel } from \"./implementations/curves\";\r\nimport type { EffectOptions } from \"../effects/effect-data\";\r\nimport type {\r\n AsciiOptions,\r\n BitCrushOptions,\r\n BlockDisplaceOptions,\r\n BloomOptions,\r\n BulgeOptions,\r\n ChromaticAberrationOptions,\r\n DirectionalBlurOptions,\r\n DitherOptions,\r\n DuotoneOptions,\r\n EdgesOptions,\r\n GrainOptions,\r\n HalftoneOptions,\r\n InvertOptions,\r\n LutOptions,\r\n KaleidoscopeOptions,\r\n OilPaintOptions,\r\n PixelateOptions,\r\n PosterizeOptions,\r\n ProgressiveBlurOptions,\r\n RadialBlurOptions,\r\n RgbShiftOptions,\r\n ScanlinesOptions,\r\n ScatterOptions,\r\n SharpenOptions,\r\n ShaderEffectOptions,\r\n StreakOptions,\r\n ThresholdOptions,\r\n TwirlOptions,\r\n VignetteOptions,\r\n VintageOptions,\r\n WaveOptions,\r\n} from \"../effects/chain\";\r\n\r\n/** Any concrete filter a chain may hold — pixel or video-only. */\r\ntype AnyFilter = MediaAdjustment | VideoOnlyAdjustment;\r\n\r\n/**\r\n * ## Adjustments and filters are two layers, not two names for one thing\r\n *\r\n * An **adjustment** is the unit an author writes: `Adjustments.blur(8)`, one\r\n * entry in the ordered chain a media fill's `preset` carries. A **filter** is\r\n * the primitive the renderer realises it as — `BlurFilter`, `CurvesFilter`, and\r\n * the `FilterData` handlers in `registry.ts`.\r\n *\r\n * Most of the time the two are one-to-one, which is what makes the distinction\r\n * look like pedantry. It isn't: an editor above this layer composes adjustments\r\n * that have no primitive of their own (a lift/gamma/gain grade is three\r\n * per-channel `CurvesFilter`s), and one primitive — the LUT's texture lookup —\r\n * is reached through no chain builder at all. Naming the two layers apart is\r\n * what lets that mapping be written down instead of assumed.\r\n *\r\n * It also settles a collision with no good answer otherwise: the options for\r\n * `Adjustments.colorAdjustment(…)` are named after the primitive they omit from\r\n * (`ColorAdjustmentFilterOptions`), because `ColorAdjustmentAdjustmentOptions`\r\n * is not a name anyone should have to type.\r\n *\r\n * ## The builders\r\n *\r\n * Media adjustments follow the same one-argument rule as node effects: every\r\n * builder takes a single options object, and those with one dominant scalar\r\n * also accept that scalar directly. Field names are the shared vocabulary —\r\n * `radius` for a pixel distance, `amount` for a 0–1 intensity — so\r\n * `Adjustments.blur(8)` and `Effects.blur(8)` describe the same quantity.\r\n *\r\n * Most of the roster *is* the node-effect roster: an adjustment is an effect\r\n * applied to one fill layer's own pixels instead of to a node and everything\r\n * beneath it, so `Adjustments.oilPaint(4)` and `Effects.oilPaint(4)` are the\r\n * same implementation reached two ways. See {@link EffectAdjustment} for the\r\n * short list of effects that cannot be adjustments.\r\n */\r\n\r\n/** Gaussian blur. Scalar shorthand sets `radius`. */\r\nexport interface BlurFilterOptions {\r\n /** Blur radius in pixels. */\r\n radius: number;\r\n}\r\n\r\n/** Desaturation. Scalar shorthand sets `amount`. */\r\nexport interface GrayscaleFilterOptions {\r\n /** 0 = original, 1 = fully grayscale. */\r\n amount: number;\r\n}\r\n\r\n/** Alpha (opacity) multiply. Scalar shorthand sets `amount`. */\r\nexport interface AlphaFilterOptions {\r\n /** 0 = fully transparent, 1 = unchanged. */\r\n amount: number;\r\n}\r\n\r\n/** Luminance scale. Scalar shorthand sets `amount`. */\r\nexport interface ExposureFilterOptions {\r\n /** Exposure multiplier. 1 = unchanged, >1 brighter, <1 darker. */\r\n amount: number;\r\n}\r\n\r\n/** Raw 4×5 row-major colour matrix. Array shorthand sets `matrix`. */\r\nexport interface ColorMatrixFilterOptions {\r\n /** 4×5 row-major colour matrix in Skia format. */\r\n matrix: number[];\r\n}\r\n\r\n/** Tone curve through control points. */\r\nexport interface CurvesFilterOptions {\r\n /** Curve control points as [input, output] pairs in [0, 1]. */\r\n points: [number, number][];\r\n /** Channel(s) to apply the curve to (default `'rgb'`). */\r\n channel?: CurvesChannel;\r\n}\r\n\r\n/** Photographic tonal/colour adjustments. All fields optional. */\r\nexport type ColorAdjustmentFilterOptions = Omit<ColorAdjustmentFilter, 'type'>;\r\n\r\n/** Stop-motion frame-rate resample (video only). Scalar shorthand sets `fps`. */\r\nexport interface PosterizeTimeFilterOptions {\r\n /** Target frame rate the source playhead snaps to. */\r\n fps: number;\r\n}\r\n\r\n/** Motion-trail echo of past frames (video only). */\r\nexport interface EchoFilterOptions {\r\n /** Number of past-frame taps drawn behind the current frame. */\r\n echoes: number;\r\n /** Delay between successive taps, in source seconds. */\r\n delay: number;\r\n /** Per-tap alpha multiplier; tap `n` is drawn at `decay ** n` (default 0.5). */\r\n decay?: number;\r\n /** Blend mode used to composite the echo taps (default `'screen'`). */\r\n blend?: BlendMode;\r\n}\r\n\r\n/**\r\n * A node effect's builder options as a **filter** accepts them: the same\r\n * fields minus the cross-cutting {@link EffectOptions} (today `mode`).\r\n *\r\n * A filter is on the fill's own pixels by definition, so there is no backdrop\r\n * to point it at — dropping the knob is clearer than accepting it and silently\r\n * ignoring it. Scalar shorthands survive untouched.\r\n */\r\ntype AsFilterOptions<T> = T extends number ? number : Omit<T, keyof EffectOptions>;\r\n\r\n/** Normalise a `number | Options` filter argument onto its dominant field. */\r\nfunction scalarFilter<O extends object>(arg: number | O, key: keyof O): O {\r\n return typeof arg === \"number\" ? ({ [key]: arg } as O) : arg;\r\n}\r\n\r\n/**\r\n * The single effect a one-builder {@link EffectChain} produced.\r\n *\r\n * Every effect-backed filter routes through here rather than re-declaring the\r\n * effect literal, so defaults, scalar shorthands and field normalisation have\r\n * exactly one definition — the one scenes already use.\r\n */\r\nfunction fromEffect(chain: EffectChain): AnyFilter {\r\n return chain.list[0] as AnyFilter;\r\n}\r\n\r\n/**\r\n * Immutable, chainable list of media filters — the filters valid on an **image**\r\n * fill.\r\n *\r\n * Each builder method returns a new chain with the filter appended, so chains\r\n * are safe to share and branch. {@link VideoAdjustmentChain} extends this with the\r\n * video-only temporal filters; the split is what keeps `posterizeTime` off an\r\n * image fill, mirroring how `Fill` is structured.\r\n *\r\n * @example\r\n * const chain = Adjustments.blur(4).grayscale(0.5);\r\n * node.filters = chain; // assign directly\r\n * node.filters = [...chain, { type: 'alpha', amount: 0.5 }]; // spread into array\r\n */\r\nexport class AdjustmentChain {\r\n constructor(public list: AnyFilter[] = []) { }\r\n\r\n /**\r\n * Append `filter`, returning a chain of the same class — so the video\r\n * subclass keeps its extra builders reachable after an inherited one.\r\n */\r\n protected append(filter: AnyFilter): this {\r\n const Ctor = this.constructor as new (list: AnyFilter[]) => this;\r\n return new Ctor([...this.list, filter]);\r\n }\r\n\r\n // -- Filters with no node-effect counterpart -------------------------\r\n\r\n /** Append a Gaussian blur. */\r\n blur(options: number | BlurFilterOptions) {\r\n const { radius } = scalarFilter(options, \"radius\");\r\n return this.append({ type: 'blur', radius });\r\n }\r\n\r\n /** Append a grayscale filter. */\r\n grayscale(options: number | GrayscaleFilterOptions) {\r\n const { amount } = scalarFilter(options, \"amount\");\r\n return this.append({ type: 'grayscale', amount });\r\n }\r\n\r\n /** Append an alpha (opacity) filter. */\r\n alpha(options: number | AlphaFilterOptions) {\r\n const { amount } = scalarFilter(options, \"amount\");\r\n return this.append({ type: 'alpha', amount });\r\n }\r\n\r\n /** Append an exposure filter. */\r\n exposure(options: number | ExposureFilterOptions) {\r\n const { amount } = scalarFilter(options, \"amount\");\r\n return this.append({ type: 'exposure', amount });\r\n }\r\n\r\n /** Append a color-adjustment filter from the given partial settings. */\r\n colorAdjustment(options: ColorAdjustmentFilterOptions) {\r\n return this.append({ type: 'colorAdjustment', ...options });\r\n }\r\n\r\n /** Append a raw 4×5 row-major color matrix (Skia format). */\r\n colorMatrix(options: number[] | ColorMatrixFilterOptions) {\r\n const matrix = Array.isArray(options) ? options : options.matrix;\r\n return this.append({ type: 'colorMatrix', matrix });\r\n }\r\n\r\n /** Append a curves filter from control `points` ([input, output] pairs). */\r\n curves(options: CurvesFilterOptions) {\r\n return this.append({ type: 'curves', points: options.points, channel: options.channel });\r\n }\r\n\r\n // -- Blur family ------------------------------------------------------\r\n\r\n /** Append a directional (linear) blur, smearing the fill along one axis. */\r\n directionalBlur(options: AsFilterOptions<number | DirectionalBlurOptions>) {\r\n return this.append(fromEffect(new EffectChain().directionalBlur(options)));\r\n }\r\n\r\n /** Append a radial blur — zoom or spin streaks about a centre point. */\r\n radialBlur(options?: AsFilterOptions<number | RadialBlurOptions>) {\r\n return this.append(fromEffect(new EffectChain().radialBlur(options)));\r\n }\r\n\r\n /**\r\n * Append a progressive blur — a blur that ramps across the fill, for the\r\n * frosted-toward-one-edge look.\r\n */\r\n progressiveBlur(options?: AsFilterOptions<number | ProgressiveBlurOptions>) {\r\n return this.append(fromEffect(new EffectChain().progressiveBlur(options)));\r\n }\r\n\r\n /** Append a bloom (glow): bright areas bleed soft light outward. */\r\n bloom(options?: AsFilterOptions<number | BloomOptions>) {\r\n return this.append(fromEffect(new EffectChain().bloom(options)));\r\n }\r\n\r\n /** Append anamorphic streaks off the fill's highlights. */\r\n streak(options?: AsFilterOptions<number | StreakOptions>) {\r\n return this.append(fromEffect(new EffectChain().streak(options)));\r\n }\r\n\r\n /** Append an unsharp-mask sharpen. */\r\n sharpen(options?: AsFilterOptions<number | SharpenOptions>) {\r\n return this.append(fromEffect(new EffectChain().sharpen(options)));\r\n }\r\n\r\n // -- Colour -----------------------------------------------------------\r\n\r\n /** Append a colour invert (negative). */\r\n invert(options?: AsFilterOptions<number | InvertOptions>) {\r\n return this.append(fromEffect(new EffectChain().invert(options)));\r\n }\r\n\r\n /** Append a vintage / film-look grade (sepia + desaturate + warmth). */\r\n vintage(options?: AsFilterOptions<number | VintageOptions>) {\r\n return this.append(fromEffect(new EffectChain().vintage(options)));\r\n }\r\n\r\n /** Append a duotone map — remap luminance between two colours. */\r\n duotone(options?: AsFilterOptions<number | DuotoneOptions>) {\r\n return this.append(fromEffect(new EffectChain().duotone(options)));\r\n }\r\n\r\n /** Append colour banding: quantize to `levels` tones per channel. */\r\n posterize(options?: AsFilterOptions<number | PosterizeOptions>) {\r\n return this.append(fromEffect(new EffectChain().posterize(options)));\r\n }\r\n\r\n /** Append a hard luminance threshold (1-bit black/white). */\r\n threshold(options?: AsFilterOptions<number | ThresholdOptions>) {\r\n return this.append(fromEffect(new EffectChain().threshold(options)));\r\n }\r\n\r\n /** Append a bit-depth crush, optionally snapping to a hardware palette. */\r\n bitCrush(options?: AsFilterOptions<number | BitCrushOptions>) {\r\n return this.append(fromEffect(new EffectChain().bitCrush(options)));\r\n }\r\n\r\n // -- Texture / pattern ------------------------------------------------\r\n\r\n /**\r\n * Append ordered (Bayer) dithering — quantize to `levels` tones, hiding the\r\n * banding in a repeating threshold pattern.\r\n */\r\n dither(options?: AsFilterOptions<number | DitherOptions>) {\r\n return this.append(fromEffect(new EffectChain().dither(options)));\r\n }\r\n\r\n /** Append a halftone screen — print-style dots (or lines) sized by tone. */\r\n halftone(options?: AsFilterOptions<number | HalftoneOptions>) {\r\n return this.append(fromEffect(new EffectChain().halftone(options)));\r\n }\r\n\r\n /** Append film grain. Animate it by tweening `seed`. */\r\n grain(options?: AsFilterOptions<number | GrainOptions>) {\r\n return this.append(fromEffect(new EffectChain().grain(options)));\r\n }\r\n\r\n /** Append a 3D colour lookup table — see {@link EffectChain.lut}. */\r\n lut(options: AsFilterOptions<LutOptions>) {\r\n return this.append(fromEffect(new EffectChain().lut(options as LutOptions)));\r\n }\r\n\r\n /** Append CRT-style scanlines. */\r\n scanlines(options?: AsFilterOptions<number | ScanlinesOptions>) {\r\n return this.append(fromEffect(new EffectChain().scanlines(options)));\r\n }\r\n\r\n /** Append an After Effects-style Mosaic — `blocks` across the fill. */\r\n pixelate(options: AsFilterOptions<number | PixelateOptions>) {\r\n return this.append(fromEffect(new EffectChain().pixelate(options)));\r\n }\r\n\r\n /**\r\n * Append Kuwahara \"oil paint\" brushwork: average within a region, never\r\n * across an edge, so flat areas smooth into strokes while edges stay crisp.\r\n *\r\n * Cost grows with `radius²` — the most expensive filter in the set.\r\n */\r\n oilPaint(options?: AsFilterOptions<number | OilPaintOptions>) {\r\n return this.append(fromEffect(new EffectChain().oilPaint(options)));\r\n }\r\n\r\n /** Append an ASCII-art remap of the fill through a glyph ramp. */\r\n ascii(options?: AsFilterOptions<number | AsciiOptions>) {\r\n return this.append(fromEffect(new EffectChain().ascii(options)));\r\n }\r\n\r\n /** Append an edge-detect pass (Sobel / Prewitt / Laplacian). */\r\n edges(options?: AsFilterOptions<number | EdgesOptions>) {\r\n return this.append(fromEffect(new EffectChain().edges(options)));\r\n }\r\n\r\n /** Append a darkened border falling off toward the fill's corners. */\r\n vignette(options?: AsFilterOptions<number | VignetteOptions>) {\r\n return this.append(fromEffect(new EffectChain().vignette(options)));\r\n }\r\n\r\n // -- Displacement / lens ----------------------------------------------\r\n\r\n /** Append lens-dispersion colour fringing. */\r\n chromaticAberration(options?: AsFilterOptions<number | ChromaticAberrationOptions>) {\r\n return this.append(fromEffect(new EffectChain().chromaticAberration(options)));\r\n }\r\n\r\n /** Append a hard per-channel RGB offset (the glitchy cousin of the above). */\r\n rgbShift(options?: AsFilterOptions<number | RgbShiftOptions>) {\r\n return this.append(fromEffect(new EffectChain().rgbShift(options)));\r\n }\r\n\r\n /** Append per-pixel random jitter. */\r\n scatter(options?: AsFilterOptions<number | ScatterOptions>) {\r\n return this.append(fromEffect(new EffectChain().scatter(options)));\r\n }\r\n\r\n /** Append horizontal band tearing — the datamosh / bad-signal look. */\r\n blockDisplace(options?: AsFilterOptions<number | BlockDisplaceOptions>) {\r\n return this.append(fromEffect(new EffectChain().blockDisplace(options)));\r\n }\r\n\r\n /** Append a bulge (barrel) or, with a negative strength, a pinch. */\r\n bulge(options: AsFilterOptions<number | BulgeOptions>) {\r\n return this.append(fromEffect(new EffectChain().bulge(options)));\r\n }\r\n\r\n /** Append a twirl (swirl about a centre point). */\r\n twirl(options?: AsFilterOptions<number | TwirlOptions>) {\r\n return this.append(fromEffect(new EffectChain().twirl(options)));\r\n }\r\n\r\n /** Append a sine/triangle/square wave warp. */\r\n wave(options?: AsFilterOptions<number | WaveOptions>) {\r\n return this.append(fromEffect(new EffectChain().wave(options)));\r\n }\r\n\r\n /** Append a kaleidoscope mirror of the fill about a centre point. */\r\n kaleidoscope(options?: AsFilterOptions<number | KaleidoscopeOptions>) {\r\n return this.append(fromEffect(new EffectChain().kaleidoscope(options)));\r\n }\r\n\r\n /** Append a custom shader pass over the fill. */\r\n shader(options: AsFilterOptions<ShaderEffectOptions>) {\r\n return this.append(fromEffect(new EffectChain().shader(options)));\r\n }\r\n\r\n /** @deprecated Use {@link AdjustmentChain.shader}. */\r\n sksl(options: AsFilterOptions<Omit<ShaderEffectOptions, \"source\"> & { shader: string }>) {\r\n return this.append(fromEffect(new EffectChain().sksl(options)));\r\n }\r\n\r\n /** Allows spreading the chain into an array: `[...Adjustments.blur(5)]`. */\r\n *[Symbol.iterator]() {\r\n yield* this.list;\r\n }\r\n\r\n /** Serializes to the raw filter array so frameworks that call `toJSON` get a plain value. */\r\n toJSON() {\r\n return this.list;\r\n }\r\n}\r\n\r\n/**\r\n * An {@link AdjustmentChain} plus the video-only temporal filters — the\r\n * filters valid on a **video** fill.\r\n *\r\n * @example\r\n * node.filters = VideoAdjustments.posterizeTime(6).grayscale(1);\r\n */\r\nexport class VideoAdjustmentChain extends AdjustmentChain {\r\n /** Append a posterize-time filter; snaps the video playhead to `fps`. */\r\n posterizeTime(options: number | PosterizeTimeFilterOptions) {\r\n const { fps } = scalarFilter(options, \"fps\");\r\n return this.append({ type: 'posterizeTime', fps });\r\n }\r\n\r\n /** Append an echo (motion-trail) filter over the clip's past frames. */\r\n echo(options: EchoFilterOptions) {\r\n return this.append({ type: 'echo', ...options });\r\n }\r\n}\r\n\r\n/**\r\n * Accepted shapes for an **image** fill's `filters` prop — a single pixel\r\n * filter, a plain array of them, or a filter chain. Mirrors how `Fill` is the\r\n * loose author-facing union for a fill. Video-only filters are excluded here.\r\n */\r\nexport type ImageAdjustment = MediaAdjustment | MediaAdjustment[] | AdjustmentChain;\r\n\r\n/**\r\n * Accepted shapes for a **video** fill's `filters` prop — the pixel filters\r\n * plus the video-only temporal filters (`posterizeTime`, `echo`).\r\n */\r\nexport type VideoAdjustment =\r\n | (MediaAdjustment | VideoOnlyAdjustment)\r\n | (MediaAdjustment | VideoOnlyAdjustment)[]\r\n | AdjustmentChain;\r\n\r\n/**\r\n * Entry point for building **image** filter chains fluently.\r\n *\r\n * An empty chain, so `Adjustments.blur(8)` is `new AdjustmentChain().blur(8)`\r\n * — and every builder's signature and documentation has one definition, on\r\n * {@link AdjustmentChain}, which is what an editor shows on hover.\r\n *\r\n * Contains only pixel filters; video-only filters (`posterizeTime`, `echo`)\r\n * live on {@link VideoAdjustments} because image fills cannot use them.\r\n *\r\n * @example\r\n * node.filters = Adjustments.blur(8).grayscale(1);\r\n * Rect({ fill: Fills.image('bg.jpg', { filters: Adjustments.oilPaint(4) }) })\r\n */\r\nexport const Adjustments = new AdjustmentChain();\r\n\r\n/**\r\n * Entry point for building **video** filter chains fluently — every\r\n * {@link Adjustments} builder plus the video-only temporal ones.\r\n *\r\n * @example\r\n * node.filters = VideoAdjustments.posterizeTime(6);\r\n * node.filters = VideoAdjustments.grayscale(1).blur(6);\r\n */\r\nexport const VideoAdjustments = new VideoAdjustmentChain();\r\n\r\n/**\r\n * The previous name for {@link Adjustments}.\r\n *\r\n * Kept because a scene is *source code in someone else's project*: a rename that\r\n * only shows up as a compile error in a file we can't edit is still a rename that\r\n * broke their build. The alias costs one line and buys a release in which both\r\n * spellings work.\r\n *\r\n * @deprecated Use {@link Adjustments}. Removed in the next major.\r\n */\r\nexport const ImageFilters = Adjustments;\r\n\r\n/**\r\n * The previous name for {@link VideoAdjustments}.\r\n *\r\n * @deprecated Use {@link VideoAdjustments}. Removed in the next major.\r\n */\r\nexport const VideoFilters = VideoAdjustments;\r\n\r\n/**\r\n * Normalises any `ImageAdjustment`/`VideoAdjustment` value to a plain filter array.\r\n * Used internally when reading props before rendering or interpolation.\r\n */\r\nexport function resolveChainAdjustments(filters: ImageAdjustment | VideoAdjustment | undefined): AnyFilter[] {\r\n if (filters === undefined) return [];\r\n if (filters instanceof AdjustmentChain) return filters.list;\r\n if (Array.isArray(filters)) return filters;\r\n return [filters];\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/chain.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAkJ/C,8EAA8E;AAC9E,SAAS,YAAY,CAAmB,GAAe,EAAE,GAAY;IACjE,OAAO,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAE,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,EAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;AACjE,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAAC,KAAkB;IAClC,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAc,CAA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G,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;IACvD,CAAC;IAED,wEAAwE;IACxE,IAAI,CAAC,OAA0B;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC;CACJ;AAkBD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAE7C;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAsD;IAC1F,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IACrC,IAAI,OAAO,YAAY,eAAe;QAAE,OAAO,OAAO,CAAC,IAAI,CAAC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAC3C,OAAO,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC","sourcesContent":["import { MediaAdjustment, VideoOnlyAdjustment } from \"./union\";\r\nimport { EffectChain } from \"../effects/chain\";\r\nimport type { BlendMode } from \"../fill/blend\";\r\nimport type { ColorAdjustmentFilter } from \"./implementations/color-adjustment\";\r\nimport type { CurvesChannel } from \"./implementations/curves\";\r\nimport type { EffectOptions } from \"../effects/effect-data\";\r\nimport type {\r\n AsciiOptions,\r\n BitCrushOptions,\r\n BlockDisplaceOptions,\r\n BloomOptions,\r\n BulgeOptions,\r\n ChromaticAberrationOptions,\r\n DirectionalBlurOptions,\r\n DitherOptions,\r\n DuotoneOptions,\r\n EdgesOptions,\r\n GrainOptions,\r\n HalftoneOptions,\r\n InvertOptions,\r\n LutOptions,\r\n KaleidoscopeOptions,\r\n OilPaintOptions,\r\n PixelateOptions,\r\n PosterizeOptions,\r\n ProgressiveBlurOptions,\r\n RadialBlurOptions,\r\n RgbShiftOptions,\r\n ScanlinesOptions,\r\n ScatterOptions,\r\n SharpenOptions,\r\n ShaderEffectOptions,\r\n StreakOptions,\r\n ThresholdOptions,\r\n TwirlOptions,\r\n VignetteOptions,\r\n VintageOptions,\r\n WaveOptions,\r\n} from \"../effects/chain\";\r\n\r\n/** Any concrete filter a chain may hold — pixel or video-only. */\r\ntype AnyFilter = MediaAdjustment | VideoOnlyAdjustment;\r\n\r\n/**\r\n * ## Adjustments and filters are two layers, not two names for one thing\r\n *\r\n * An **adjustment** is the unit an author writes: `Adjustments.blur(8)`, one\r\n * entry in the ordered chain a media fill's `preset` carries. A **filter** is\r\n * the primitive the renderer realises it as — `BlurFilter`, `CurvesFilter`, and\r\n * the `FilterData` handlers in `registry.ts`.\r\n *\r\n * Most of the time the two are one-to-one, which is what makes the distinction\r\n * look like pedantry. It isn't: an editor above this layer composes adjustments\r\n * that have no primitive of their own (a lift/gamma/gain grade is three\r\n * per-channel `CurvesFilter`s), and one primitive — the LUT's texture lookup —\r\n * is reached through no chain builder at all. Naming the two layers apart is\r\n * what lets that mapping be written down instead of assumed.\r\n *\r\n * It also settles a collision with no good answer otherwise: the options for\r\n * `Adjustments.colorAdjustment(…)` are named after the primitive they omit from\r\n * (`ColorAdjustmentFilterOptions`), because `ColorAdjustmentAdjustmentOptions`\r\n * is not a name anyone should have to type.\r\n *\r\n * ## The builders\r\n *\r\n * Media adjustments follow the same one-argument rule as node effects: every\r\n * builder takes a single options object, and those with one dominant scalar\r\n * also accept that scalar directly. Field names are the shared vocabulary —\r\n * `radius` for a pixel distance, `amount` for a 0–1 intensity — so\r\n * `Adjustments.blur(8)` and `Effects.blur(8)` describe the same quantity.\r\n *\r\n * Most of the roster *is* the node-effect roster: an adjustment is an effect\r\n * applied to one fill layer's own pixels instead of to a node and everything\r\n * beneath it, so `Adjustments.oilPaint(4)` and `Effects.oilPaint(4)` are the\r\n * same implementation reached two ways. See {@link EffectAdjustment} for the\r\n * short list of effects that cannot be adjustments.\r\n */\r\n\r\n/** Gaussian blur. Scalar shorthand sets `radius`. */\r\nexport interface BlurFilterOptions {\r\n /** Blur radius in pixels. */\r\n radius: number;\r\n}\r\n\r\n/** Desaturation. Scalar shorthand sets `amount`. */\r\nexport interface GrayscaleFilterOptions {\r\n /** 0 = original, 1 = fully grayscale. */\r\n amount: number;\r\n}\r\n\r\n/** Alpha (opacity) multiply. Scalar shorthand sets `amount`. */\r\nexport interface AlphaFilterOptions {\r\n /** 0 = fully transparent, 1 = unchanged. */\r\n amount: number;\r\n}\r\n\r\n/** Luminance scale. Scalar shorthand sets `amount`. */\r\nexport interface ExposureFilterOptions {\r\n /** Exposure multiplier. 1 = unchanged, >1 brighter, <1 darker. */\r\n amount: number;\r\n}\r\n\r\n/** Raw 4×5 row-major colour matrix. Array shorthand sets `matrix`. */\r\nexport interface ColorMatrixFilterOptions {\r\n /** 4×5 row-major colour matrix: rows R, G, B, A of `[r, g, b, a, bias]`. */\r\n matrix: number[];\r\n}\r\n\r\n/** Tone curve through control points. */\r\nexport interface CurvesFilterOptions {\r\n /** Curve control points as [input, output] pairs in [0, 1]. */\r\n points: [number, number][];\r\n /** Channel(s) to apply the curve to (default `'rgb'`). */\r\n channel?: CurvesChannel;\r\n}\r\n\r\n/** Photographic tonal/colour adjustments. All fields optional. */\r\nexport type ColorAdjustmentFilterOptions = Omit<ColorAdjustmentFilter, 'type'>;\r\n\r\n/** Stop-motion frame-rate resample (video only). Scalar shorthand sets `fps`. */\r\nexport interface PosterizeTimeFilterOptions {\r\n /** Target frame rate the source playhead snaps to. */\r\n fps: number;\r\n}\r\n\r\n/** Motion-trail echo of past frames (video only). */\r\nexport interface EchoFilterOptions {\r\n /** Number of past-frame taps drawn behind the current frame. */\r\n echoes: number;\r\n /** Delay between successive taps, in source seconds. */\r\n delay: number;\r\n /** Per-tap alpha multiplier; tap `n` is drawn at `decay ** n` (default 0.5). */\r\n decay?: number;\r\n /** Blend mode used to composite the echo taps (default `'screen'`). */\r\n blend?: BlendMode;\r\n}\r\n\r\n/**\r\n * A node effect's builder options as a **filter** accepts them: the same\r\n * fields minus the cross-cutting {@link EffectOptions} (today `mode`).\r\n *\r\n * A filter is on the fill's own pixels by definition, so there is no backdrop\r\n * to point it at — dropping the knob is clearer than accepting it and silently\r\n * ignoring it. Scalar shorthands survive untouched.\r\n */\r\ntype AsFilterOptions<T> = T extends number ? number : Omit<T, keyof EffectOptions>;\r\n\r\n/** Normalise a `number | Options` filter argument onto its dominant field. */\r\nfunction scalarFilter<O extends object>(arg: number | O, key: keyof O): O {\r\n return typeof arg === \"number\" ? ({ [key]: arg } as O) : arg;\r\n}\r\n\r\n/**\r\n * The single effect a one-builder {@link EffectChain} produced.\r\n *\r\n * Every effect-backed filter routes through here rather than re-declaring the\r\n * effect literal, so defaults, scalar shorthands and field normalisation have\r\n * exactly one definition — the one scenes already use.\r\n */\r\nfunction fromEffect(chain: EffectChain): AnyFilter {\r\n return chain.list[0] as AnyFilter;\r\n}\r\n\r\n/**\r\n * Immutable, chainable list of media filters — the filters valid on an **image**\r\n * fill.\r\n *\r\n * Each builder method returns a new chain with the filter appended, so chains\r\n * are safe to share and branch. {@link VideoAdjustmentChain} extends this with the\r\n * video-only temporal filters; the split is what keeps `posterizeTime` off an\r\n * image fill, mirroring how `Fill` is structured.\r\n *\r\n * @example\r\n * const chain = Adjustments.blur(4).grayscale(0.5);\r\n * node.filters = chain; // assign directly\r\n * node.filters = [...chain, { type: 'alpha', amount: 0.5 }]; // spread into array\r\n */\r\nexport class AdjustmentChain {\r\n constructor(public list: AnyFilter[] = []) { }\r\n\r\n /**\r\n * Append `filter`, returning a chain of the same class — so the video\r\n * subclass keeps its extra builders reachable after an inherited one.\r\n */\r\n protected append(filter: AnyFilter): this {\r\n const Ctor = this.constructor as new (list: AnyFilter[]) => this;\r\n return new Ctor([...this.list, filter]);\r\n }\r\n\r\n // -- Filters with no node-effect counterpart -------------------------\r\n\r\n /** Append a Gaussian blur. */\r\n blur(options: number | BlurFilterOptions) {\r\n const { radius } = scalarFilter(options, \"radius\");\r\n return this.append({ type: 'blur', radius });\r\n }\r\n\r\n /** Append a grayscale filter. */\r\n grayscale(options: number | GrayscaleFilterOptions) {\r\n const { amount } = scalarFilter(options, \"amount\");\r\n return this.append({ type: 'grayscale', amount });\r\n }\r\n\r\n /** Append an alpha (opacity) filter. */\r\n alpha(options: number | AlphaFilterOptions) {\r\n const { amount } = scalarFilter(options, \"amount\");\r\n return this.append({ type: 'alpha', amount });\r\n }\r\n\r\n /** Append an exposure filter. */\r\n exposure(options: number | ExposureFilterOptions) {\r\n const { amount } = scalarFilter(options, \"amount\");\r\n return this.append({ type: 'exposure', amount });\r\n }\r\n\r\n /** Append a color-adjustment filter from the given partial settings. */\r\n colorAdjustment(options: ColorAdjustmentFilterOptions) {\r\n return this.append({ type: 'colorAdjustment', ...options });\r\n }\r\n\r\n /** Append a raw 4×5 row-major color matrix. */\r\n colorMatrix(options: number[] | ColorMatrixFilterOptions) {\r\n const matrix = Array.isArray(options) ? options : options.matrix;\r\n return this.append({ type: 'colorMatrix', matrix });\r\n }\r\n\r\n /** Append a curves filter from control `points` ([input, output] pairs). */\r\n curves(options: CurvesFilterOptions) {\r\n return this.append({ type: 'curves', points: options.points, channel: options.channel });\r\n }\r\n\r\n // -- Blur family ------------------------------------------------------\r\n\r\n /** Append a directional (linear) blur, smearing the fill along one axis. */\r\n directionalBlur(options: AsFilterOptions<number | DirectionalBlurOptions>) {\r\n return this.append(fromEffect(new EffectChain().directionalBlur(options)));\r\n }\r\n\r\n /** Append a radial blur — zoom or spin streaks about a centre point. */\r\n radialBlur(options?: AsFilterOptions<number | RadialBlurOptions>) {\r\n return this.append(fromEffect(new EffectChain().radialBlur(options)));\r\n }\r\n\r\n /**\r\n * Append a progressive blur — a blur that ramps across the fill, for the\r\n * frosted-toward-one-edge look.\r\n */\r\n progressiveBlur(options?: AsFilterOptions<number | ProgressiveBlurOptions>) {\r\n return this.append(fromEffect(new EffectChain().progressiveBlur(options)));\r\n }\r\n\r\n /** Append a bloom (glow): bright areas bleed soft light outward. */\r\n bloom(options?: AsFilterOptions<number | BloomOptions>) {\r\n return this.append(fromEffect(new EffectChain().bloom(options)));\r\n }\r\n\r\n /** Append anamorphic streaks off the fill's highlights. */\r\n streak(options?: AsFilterOptions<number | StreakOptions>) {\r\n return this.append(fromEffect(new EffectChain().streak(options)));\r\n }\r\n\r\n /** Append an unsharp-mask sharpen. */\r\n sharpen(options?: AsFilterOptions<number | SharpenOptions>) {\r\n return this.append(fromEffect(new EffectChain().sharpen(options)));\r\n }\r\n\r\n // -- Colour -----------------------------------------------------------\r\n\r\n /** Append a colour invert (negative). */\r\n invert(options?: AsFilterOptions<number | InvertOptions>) {\r\n return this.append(fromEffect(new EffectChain().invert(options)));\r\n }\r\n\r\n /** Append a vintage / film-look grade (sepia + desaturate + warmth). */\r\n vintage(options?: AsFilterOptions<number | VintageOptions>) {\r\n return this.append(fromEffect(new EffectChain().vintage(options)));\r\n }\r\n\r\n /** Append a duotone map — remap luminance between two colours. */\r\n duotone(options?: AsFilterOptions<number | DuotoneOptions>) {\r\n return this.append(fromEffect(new EffectChain().duotone(options)));\r\n }\r\n\r\n /** Append colour banding: quantize to `levels` tones per channel. */\r\n posterize(options?: AsFilterOptions<number | PosterizeOptions>) {\r\n return this.append(fromEffect(new EffectChain().posterize(options)));\r\n }\r\n\r\n /** Append a hard luminance threshold (1-bit black/white). */\r\n threshold(options?: AsFilterOptions<number | ThresholdOptions>) {\r\n return this.append(fromEffect(new EffectChain().threshold(options)));\r\n }\r\n\r\n /** Append a bit-depth crush, optionally snapping to a hardware palette. */\r\n bitCrush(options?: AsFilterOptions<number | BitCrushOptions>) {\r\n return this.append(fromEffect(new EffectChain().bitCrush(options)));\r\n }\r\n\r\n // -- Texture / pattern ------------------------------------------------\r\n\r\n /**\r\n * Append ordered (Bayer) dithering — quantize to `levels` tones, hiding the\r\n * banding in a repeating threshold pattern.\r\n */\r\n dither(options?: AsFilterOptions<number | DitherOptions>) {\r\n return this.append(fromEffect(new EffectChain().dither(options)));\r\n }\r\n\r\n /** Append a halftone screen — print-style dots (or lines) sized by tone. */\r\n halftone(options?: AsFilterOptions<number | HalftoneOptions>) {\r\n return this.append(fromEffect(new EffectChain().halftone(options)));\r\n }\r\n\r\n /** Append film grain. Animate it by tweening `seed`. */\r\n grain(options?: AsFilterOptions<number | GrainOptions>) {\r\n return this.append(fromEffect(new EffectChain().grain(options)));\r\n }\r\n\r\n /** Append a 3D colour lookup table — see {@link EffectChain.lut}. */\r\n lut(options: AsFilterOptions<LutOptions>) {\r\n return this.append(fromEffect(new EffectChain().lut(options as LutOptions)));\r\n }\r\n\r\n /** Append CRT-style scanlines. */\r\n scanlines(options?: AsFilterOptions<number | ScanlinesOptions>) {\r\n return this.append(fromEffect(new EffectChain().scanlines(options)));\r\n }\r\n\r\n /** Append an After Effects-style Mosaic — `blocks` across the fill. */\r\n pixelate(options: AsFilterOptions<number | PixelateOptions>) {\r\n return this.append(fromEffect(new EffectChain().pixelate(options)));\r\n }\r\n\r\n /**\r\n * Append Kuwahara \"oil paint\" brushwork: average within a region, never\r\n * across an edge, so flat areas smooth into strokes while edges stay crisp.\r\n *\r\n * Cost grows with `radius²` — the most expensive filter in the set.\r\n */\r\n oilPaint(options?: AsFilterOptions<number | OilPaintOptions>) {\r\n return this.append(fromEffect(new EffectChain().oilPaint(options)));\r\n }\r\n\r\n /** Append an ASCII-art remap of the fill through a glyph ramp. */\r\n ascii(options?: AsFilterOptions<number | AsciiOptions>) {\r\n return this.append(fromEffect(new EffectChain().ascii(options)));\r\n }\r\n\r\n /** Append an edge-detect pass (Sobel / Prewitt / Laplacian). */\r\n edges(options?: AsFilterOptions<number | EdgesOptions>) {\r\n return this.append(fromEffect(new EffectChain().edges(options)));\r\n }\r\n\r\n /** Append a darkened border falling off toward the fill's corners. */\r\n vignette(options?: AsFilterOptions<number | VignetteOptions>) {\r\n return this.append(fromEffect(new EffectChain().vignette(options)));\r\n }\r\n\r\n // -- Displacement / lens ----------------------------------------------\r\n\r\n /** Append lens-dispersion colour fringing. */\r\n chromaticAberration(options?: AsFilterOptions<number | ChromaticAberrationOptions>) {\r\n return this.append(fromEffect(new EffectChain().chromaticAberration(options)));\r\n }\r\n\r\n /** Append a hard per-channel RGB offset (the glitchy cousin of the above). */\r\n rgbShift(options?: AsFilterOptions<number | RgbShiftOptions>) {\r\n return this.append(fromEffect(new EffectChain().rgbShift(options)));\r\n }\r\n\r\n /** Append per-pixel random jitter. */\r\n scatter(options?: AsFilterOptions<number | ScatterOptions>) {\r\n return this.append(fromEffect(new EffectChain().scatter(options)));\r\n }\r\n\r\n /** Append horizontal band tearing — the datamosh / bad-signal look. */\r\n blockDisplace(options?: AsFilterOptions<number | BlockDisplaceOptions>) {\r\n return this.append(fromEffect(new EffectChain().blockDisplace(options)));\r\n }\r\n\r\n /** Append a bulge (barrel) or, with a negative strength, a pinch. */\r\n bulge(options: AsFilterOptions<number | BulgeOptions>) {\r\n return this.append(fromEffect(new EffectChain().bulge(options)));\r\n }\r\n\r\n /** Append a twirl (swirl about a centre point). */\r\n twirl(options?: AsFilterOptions<number | TwirlOptions>) {\r\n return this.append(fromEffect(new EffectChain().twirl(options)));\r\n }\r\n\r\n /** Append a sine/triangle/square wave warp. */\r\n wave(options?: AsFilterOptions<number | WaveOptions>) {\r\n return this.append(fromEffect(new EffectChain().wave(options)));\r\n }\r\n\r\n /** Append a kaleidoscope mirror of the fill about a centre point. */\r\n kaleidoscope(options?: AsFilterOptions<number | KaleidoscopeOptions>) {\r\n return this.append(fromEffect(new EffectChain().kaleidoscope(options)));\r\n }\r\n\r\n /** Append a custom shader pass over the fill. */\r\n shader(options: AsFilterOptions<ShaderEffectOptions>) {\r\n return this.append(fromEffect(new EffectChain().shader(options)));\r\n }\r\n\r\n /** Allows spreading the chain into an array: `[...Adjustments.blur(5)]`. */\r\n *[Symbol.iterator]() {\r\n yield* this.list;\r\n }\r\n\r\n /** Serializes to the raw filter array so frameworks that call `toJSON` get a plain value. */\r\n toJSON() {\r\n return this.list;\r\n }\r\n}\r\n\r\n/**\r\n * An {@link AdjustmentChain} plus the video-only temporal filters — the\r\n * filters valid on a **video** fill.\r\n *\r\n * @example\r\n * node.filters = VideoAdjustments.posterizeTime(6).grayscale(1);\r\n */\r\nexport class VideoAdjustmentChain extends AdjustmentChain {\r\n /** Append a posterize-time filter; snaps the video playhead to `fps`. */\r\n posterizeTime(options: number | PosterizeTimeFilterOptions) {\r\n const { fps } = scalarFilter(options, \"fps\");\r\n return this.append({ type: 'posterizeTime', fps });\r\n }\r\n\r\n /** Append an echo (motion-trail) filter over the clip's past frames. */\r\n echo(options: EchoFilterOptions) {\r\n return this.append({ type: 'echo', ...options });\r\n }\r\n}\r\n\r\n/**\r\n * Accepted shapes for an **image** fill's `filters` prop — a single pixel\r\n * filter, a plain array of them, or a filter chain. Mirrors how `Fill` is the\r\n * loose author-facing union for a fill. Video-only filters are excluded here.\r\n */\r\nexport type ImageAdjustment = MediaAdjustment | MediaAdjustment[] | AdjustmentChain;\r\n\r\n/**\r\n * Accepted shapes for a **video** fill's `filters` prop — the pixel filters\r\n * plus the video-only temporal filters (`posterizeTime`, `echo`).\r\n */\r\nexport type VideoAdjustment =\r\n | (MediaAdjustment | VideoOnlyAdjustment)\r\n | (MediaAdjustment | VideoOnlyAdjustment)[]\r\n | AdjustmentChain;\r\n\r\n/**\r\n * Entry point for building **image** filter chains fluently.\r\n *\r\n * An empty chain, so `Adjustments.blur(8)` is `new AdjustmentChain().blur(8)`\r\n * — and every builder's signature and documentation has one definition, on\r\n * {@link AdjustmentChain}, which is what an editor shows on hover.\r\n *\r\n * Contains only pixel filters; video-only filters (`posterizeTime`, `echo`)\r\n * live on {@link VideoAdjustments} because image fills cannot use them.\r\n *\r\n * @example\r\n * node.filters = Adjustments.blur(8).grayscale(1);\r\n * Rect({ fill: Fills.image('bg.jpg', { filters: Adjustments.oilPaint(4) }) })\r\n */\r\nexport const Adjustments = new AdjustmentChain();\r\n\r\n/**\r\n * Entry point for building **video** filter chains fluently — every\r\n * {@link Adjustments} builder plus the video-only temporal ones.\r\n *\r\n * @example\r\n * node.filters = VideoAdjustments.posterizeTime(6);\r\n * node.filters = VideoAdjustments.grayscale(1).blur(6);\r\n */\r\nexport const VideoAdjustments = new VideoAdjustmentChain();\r\n\r\n/**\r\n * The previous name for {@link Adjustments}.\r\n *\r\n * Kept because a scene is *source code in someone else's project*: a rename that\r\n * only shows up as a compile error in a file we can't edit is still a rename that\r\n * broke their build. The alias costs one line and buys a release in which both\r\n * spellings work.\r\n *\r\n * @deprecated Use {@link Adjustments}. Removed in the next major.\r\n */\r\nexport const ImageFilters = Adjustments;\r\n\r\n/**\r\n * The previous name for {@link VideoAdjustments}.\r\n *\r\n * @deprecated Use {@link VideoAdjustments}. Removed in the next major.\r\n */\r\nexport const VideoFilters = VideoAdjustments;\r\n\r\n/**\r\n * Normalises any `ImageAdjustment`/`VideoAdjustment` value to a plain filter array.\r\n * Used internally when reading props before rendering or interpolation.\r\n */\r\nexport function resolveChainAdjustments(filters: ImageAdjustment | VideoAdjustment | undefined): AnyFilter[] {\r\n if (filters === undefined) return [];\r\n if (filters instanceof AdjustmentChain) return filters.list;\r\n if (Array.isArray(filters)) return filters;\r\n return [filters];\r\n}\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FilterData } from "../registry.js";
|
|
2
2
|
/**
|
|
3
|
-
* Applies an arbitrary 4×5 color transform
|
|
3
|
+
* Applies an arbitrary 4×5 color transform.
|
|
4
4
|
*
|
|
5
5
|
* The matrix is row-major with rows [R, G, B, A], each row being
|
|
6
6
|
* [rScale, gScale, bScale, aScale, bias]. Useful for tinting,
|
|
@@ -8,7 +8,7 @@ import type { FilterData } from "../registry.js";
|
|
|
8
8
|
*/
|
|
9
9
|
export interface ColorMatrixFilter {
|
|
10
10
|
type: 'colorMatrix';
|
|
11
|
-
/** 4×5 row-major color matrix
|
|
11
|
+
/** 4×5 row-major color matrix. */
|
|
12
12
|
matrix: number[];
|
|
13
13
|
}
|
|
14
14
|
export declare const colorMatrixFilter: FilterData<ColorMatrixFilter>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-matrix.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/color-matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,
|
|
1
|
+
{"version":3,"file":"color-matrix.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/color-matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAG9C;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,aAAa,CAAC;IACpB,kCAAkC;IAClC,MAAM,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC,iBAAiB,CAQ3D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-matrix.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/color-matrix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,MAAM,CAAC,MAAM,iBAAiB,GAAkC;IAC5D,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;KACzE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CACvG,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/**\r\n * Applies an arbitrary 4×5 color transform
|
|
1
|
+
{"version":3,"file":"color-matrix.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/color-matrix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,MAAM,CAAC,MAAM,iBAAiB,GAAkC;IAC5D,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;KACzE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CACvG,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/**\r\n * Applies an arbitrary 4×5 color transform.\r\n *\r\n * The matrix is row-major with rows [R, G, B, A], each row being\r\n * [rScale, gScale, bScale, aScale, bias]. Useful for tinting,\r\n * channel swaps, or any effect not covered by the named filters.\r\n */\r\nexport interface ColorMatrixFilter {\r\n type: 'colorMatrix';\r\n /** 4×5 row-major color matrix. */\r\n matrix: number[];\r\n}\r\n\r\nexport const colorMatrixFilter: FilterData<ColorMatrixFilter> = {\r\n // Lerps each matrix coefficient independently; missing target coefficients\r\n // hold their source value so partial matrices still animate gracefully.\r\n lerp: (from, to, t) => ({\r\n type: \"colorMatrix\",\r\n matrix: from.matrix.map((v, i) => lerpNumber(v, to.matrix[i] ?? v, t)),\r\n }),\r\n equals: (a, b) => a.matrix.length === b.matrix.length && a.matrix.every((v, i) => v === b.matrix[i]),\r\n};\r\n"]}
|
|
@@ -9,7 +9,7 @@ export interface FilterData<T extends AnyFilter> {
|
|
|
9
9
|
/** Return true when both filters are visually identical (used to skip redundant redraws). */
|
|
10
10
|
equals(a: T, b: T): boolean;
|
|
11
11
|
}
|
|
12
|
-
/** True when `type` is a pixel filter that composes into a
|
|
12
|
+
/** True when `type` is a pixel filter that composes into a media fill's filter chain. */
|
|
13
13
|
export declare function isPixelFilter(type: string): boolean;
|
|
14
14
|
/** True when `type` has a registered `FilterData` handler, here or in the effects registry. */
|
|
15
15
|
export declare function hasFilter(type: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/registry.ts"],"names":[],"mappings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H,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAK/E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAGzE;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAKpE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EACnD,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,EACrB,EAAE,EAAE,CAAC,EAAE,GAAG,SAAS,EACnB,CAAC,EAAE,MAAM,GACV,CAAC,EAAE,GAAG,SAAS,CAGjB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,CAe1F"}
|
|
@@ -33,11 +33,11 @@ const FILTERS = new Map([
|
|
|
33
33
|
/**
|
|
34
34
|
* Video-only filter types. These are consumed by the video fill's per-frame
|
|
35
35
|
* `update()` (`posterizeTime`) or a dedicated multi-pass renderer (`echo`),
|
|
36
|
-
*
|
|
37
|
-
*
|
|
36
|
+
* not the pixel filter chain. `isPixelFilter` lets a renderer skip them when
|
|
37
|
+
* composing that chain.
|
|
38
38
|
*/
|
|
39
39
|
const VIDEO_ONLY = new Set(["posterizeTime", "echo"]);
|
|
40
|
-
/** True when `type` is a pixel filter that composes into a
|
|
40
|
+
/** True when `type` is a pixel filter that composes into a media fill's filter chain. */
|
|
41
41
|
export function isPixelFilter(type) {
|
|
42
42
|
return !VIDEO_ONLY.has(type);
|
|
43
43
|
}
|