@motionscript/core 0.1.0-alpha.7 → 0.1.0-alpha.9
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 +12 -0
- package/LICENSE +201 -201
- package/NOTICE +49 -48
- package/README.md +91 -91
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +7 -5
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/effects/chain.d.ts +73 -0
- package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
- package/dist/attributes/audio/effects/chain.js +67 -0
- package/dist/attributes/audio/effects/chain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
- package/dist/attributes/audio/{filters → effects}/implementations/echo.js +2 -2
- 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/{filters → effects}/implementations/gain.js +2 -2
- 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/{filters → effects}/implementations/highpass.js +2 -2
- 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/{filters → effects}/implementations/lowpass.js +2 -2
- 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/{filters → effects}/implementations/tremolo.js +2 -2
- 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/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.d.ts +2 -2
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/space3d.js +1 -1
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.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/render3d/orbit.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/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.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/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- 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/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.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/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.d.ts +1 -1
- package/dist/attributes/shape/fill/index.d.ts.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.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/fill/union.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/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.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/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.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/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.d.ts +2 -0
- package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/index.js +2 -0
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/language.d.ts +26 -0
- package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/language.js +20 -0
- package/dist/attributes/shape/shaders/language.js.map +1 -0
- package/dist/attributes/shape/shaders/pack.d.ts +25 -11
- package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/pack.js +9 -4
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
- package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js +3 -6
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
- package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/uniforms.js +0 -0
- package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/{chunk-LKUYVFU3.js → chunk-4BDLFEOC.js} +1 -1
- package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
- package/dist/browser/chunks/chunk-7DB6BI27.js +6 -0
- package/dist/browser/chunks/chunk-7DB6BI27.js.map +7 -0
- package/dist/browser/chunks/chunk-IX53IFBD.js +13 -0
- package/dist/browser/chunks/chunk-IX53IFBD.js.map +7 -0
- package/dist/browser/chunks/{chunk-ZRPZPWZU.js → chunk-Q55UPA3E.js} +1 -1
- package/dist/browser/chunks/chunk-Q55UPA3E.js.map +7 -0
- package/dist/browser/component.js +1 -1
- 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/component.js.map +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/geometry/composite.js.map +1 -1
- package/dist/components/builtins/geometry/geometry.js.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
- package/dist/components/builtins/layout/layout.js.map +1 -1
- 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/providers/providers.js.map +1 -1
- package/dist/components/builtins/text/number-format.js.map +1 -1
- package/dist/components/builtins/text/number-pattern.js.map +1 -1
- package/dist/components/builtins/text/text-defaults.js.map +1 -1
- package/dist/components/builtins/text/text-layout.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +9 -9
- 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/builtins/three/canvas3d.js.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
- package/dist/components/builtins/three/three.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/clip-of.js.map +1 -1
- package/dist/components/factory/commands-for.js.map +1 -1
- package/dist/components/factory/component-audio.js.map +1 -1
- package/dist/components/factory/component2d.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/factory/timeline.js.map +1 -1
- package/dist/components/factory/type-def.js.map +1 -1
- package/dist/components/factory/types.js.map +1 -1
- package/dist/components/factory/views.js.map +1 -1
- package/dist/components/modules/aim.js.map +1 -1
- package/dist/components/modules/corners.js.map +1 -1
- package/dist/components/modules/flow.js.map +1 -1
- package/dist/components/modules/material.js.map +1 -1
- package/dist/components/modules/paint.js.map +1 -1
- package/dist/components/modules/shapes.js.map +1 -1
- package/dist/components/modules/text-layout.js.map +1 -1
- package/dist/components/modules/text-style.js.map +1 -1
- package/dist/components/modules/three-entries.js.map +1 -1
- package/dist/components/modules/view3d.js.map +1 -1
- package/dist/components/trees/2d/group-bounds.js.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
- package/dist/components/trees/2d/node-motion.js.map +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/node-space.js.map +1 -1
- package/dist/components/trees/2d/node-transform.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/index.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/components/trees/index.js.map +1 -1
- package/dist/components/trees/node/node-editor-state.js.map +1 -1
- package/dist/components/trees/node/node-reactive.js.map +1 -1
- package/dist/components/trees/node/node-time.js.map +1 -1
- package/dist/components/trees/node/node-walk.js.map +1 -1
- package/dist/components/trees/node/node.js.map +1 -1
- package/dist/components/trees/root/canvas2d-node.js.map +1 -1
- package/dist/components/trees/three/node3d.js.map +1 -1
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.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/deny-globals.js.map +1 -1
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.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-decorator.js.map +1 -1
- 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/index.js.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/audio-sink.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/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +1 -1
- package/dist/renamed-scene-names.d.ts.map +1 -1
- package/dist/renamed-scene-names.js +1 -1
- package/dist/renamed-scene-names.js.map +1 -1
- package/dist/render/canvas-render-context2d.d.ts +9 -0
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +10 -0
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.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/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.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/measure-context.js.map +1 -1
- package/dist/render/null-render-context.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/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.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/render3d/index.js.map +1 -1
- package/dist/render3d/inert.js.map +1 -1
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.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/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.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/frame-time.js.map +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.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/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.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/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.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/command.js.map +1 -1
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.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/ease/type.js.map +1 -1
- 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/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +2 -2
- package/dist/attributes/audio/filters/chain.d.ts +0 -113
- package/dist/attributes/audio/filters/chain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/chain.js +0 -104
- package/dist/attributes/audio/filters/chain.js.map +0 -1
- package/dist/attributes/audio/filters/curve.d.ts +0 -152
- package/dist/attributes/audio/filters/curve.d.ts.map +0 -1
- package/dist/attributes/audio/filters/curve.js +0 -250
- package/dist/attributes/audio/filters/curve.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.d.ts +0 -14
- package/dist/attributes/audio/filters/implementations/echo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.d.ts +0 -10
- package/dist/attributes/audio/filters/implementations/gain.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/highpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/lowpass.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +0 -18
- package/dist/attributes/audio/filters/implementations/speed.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/speed.js +0 -6
- package/dist/attributes/audio/filters/implementations/speed.js.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts +0 -12
- package/dist/attributes/audio/filters/implementations/tremolo.d.ts.map +0 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +0 -1
- package/dist/attributes/audio/filters/index.d.ts +0 -22
- package/dist/attributes/audio/filters/index.d.ts.map +0 -1
- package/dist/attributes/audio/filters/index.js +0 -8
- package/dist/attributes/audio/filters/index.js.map +0 -1
- package/dist/attributes/audio/filters/registry.d.ts +0 -36
- package/dist/attributes/audio/filters/registry.d.ts.map +0 -1
- package/dist/attributes/audio/filters/registry.js +0 -82
- package/dist/attributes/audio/filters/registry.js.map +0 -1
- package/dist/attributes/audio/filters/union.d.ts +0 -18
- package/dist/attributes/audio/filters/union.d.ts.map +0 -1
- package/dist/attributes/audio/filters/union.js +0 -28
- package/dist/attributes/audio/filters/union.js.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.d.ts +0 -146
- package/dist/attributes/shape/sksl-uniforms.d.ts.map +0 -1
- package/dist/attributes/shape/sksl-uniforms.js +0 -0
- package/dist/attributes/shape/sksl-uniforms.js.map +0 -1
- package/dist/browser/chunks/chunk-D4FSTPML.js +0 -14
- package/dist/browser/chunks/chunk-D4FSTPML.js.map +0 -7
- package/dist/browser/chunks/chunk-LKUYVFU3.js.map +0 -7
- package/dist/browser/chunks/chunk-RTNATFWX.js +0 -5
- package/dist/browser/chunks/chunk-RTNATFWX.js.map +0 -7
- package/dist/browser/chunks/chunk-ZRPZPWZU.js.map +0 -7
- package/dist/component/api.d.ts +0 -508
- package/dist/component/api.d.ts.map +0 -1
- package/dist/component/api.js +0 -4
- package/dist/component/api.js.map +0 -1
- package/dist/component/builtins/audio.d.ts +0 -26
- package/dist/component/builtins/audio.d.ts.map +0 -1
- package/dist/component/builtins/audio.js +0 -41
- package/dist/component/builtins/audio.js.map +0 -1
- package/dist/component/builtins/canvas3d.d.ts +0 -98
- package/dist/component/builtins/canvas3d.d.ts.map +0 -1
- package/dist/component/builtins/canvas3d.js +0 -21
- package/dist/component/builtins/canvas3d.js.map +0 -1
- package/dist/component/builtins/composite.d.ts +0 -56
- package/dist/component/builtins/composite.d.ts.map +0 -1
- package/dist/component/builtins/composite.js +0 -25
- package/dist/component/builtins/composite.js.map +0 -1
- package/dist/component/builtins/geometry.d.ts +0 -505
- package/dist/component/builtins/geometry.d.ts.map +0 -1
- package/dist/component/builtins/geometry.js +0 -107
- package/dist/component/builtins/geometry.js.map +0 -1
- package/dist/component/builtins/layout.d.ts +0 -88
- package/dist/component/builtins/layout.d.ts.map +0 -1
- package/dist/component/builtins/layout.js +0 -84
- package/dist/component/builtins/layout.js.map +0 -1
- package/dist/component/builtins/media.d.ts +0 -95
- package/dist/component/builtins/media.d.ts.map +0 -1
- package/dist/component/builtins/media.js +0 -149
- package/dist/component/builtins/media.js.map +0 -1
- package/dist/component/builtins/providers.d.ts +0 -23
- package/dist/component/builtins/providers.d.ts.map +0 -1
- package/dist/component/builtins/providers.js +0 -30
- package/dist/component/builtins/providers.js.map +0 -1
- package/dist/component/builtins/text.d.ts +0 -193
- package/dist/component/builtins/text.d.ts.map +0 -1
- package/dist/component/builtins/text.js +0 -113
- package/dist/component/builtins/text.js.map +0 -1
- package/dist/component/builtins/three.d.ts +0 -1085
- package/dist/component/builtins/three.d.ts.map +0 -1
- package/dist/component/builtins/three.js +0 -265
- package/dist/component/builtins/three.js.map +0 -1
- package/dist/component/clip-of.d.ts +0 -5
- package/dist/component/clip-of.d.ts.map +0 -1
- package/dist/component/clip-of.js +0 -33
- package/dist/component/clip-of.js.map +0 -1
- package/dist/component/commands-for.d.ts +0 -19
- package/dist/component/commands-for.d.ts.map +0 -1
- package/dist/component/commands-for.js +0 -5
- package/dist/component/commands-for.js.map +0 -1
- package/dist/component/component-audio.d.ts +0 -9
- package/dist/component/component-audio.d.ts.map +0 -1
- package/dist/component/component-audio.js +0 -18
- package/dist/component/component-audio.js.map +0 -1
- package/dist/component/component2d.d.ts +0 -9
- package/dist/component/component2d.d.ts.map +0 -1
- package/dist/component/component2d.js +0 -239
- package/dist/component/component2d.js.map +0 -1
- package/dist/component/component3d.d.ts +0 -9
- package/dist/component/component3d.d.ts.map +0 -1
- package/dist/component/component3d.js +0 -99
- package/dist/component/component3d.js.map +0 -1
- package/dist/component/factory.d.ts +0 -63
- package/dist/component/factory.d.ts.map +0 -1
- package/dist/component/factory.js +0 -313
- package/dist/component/factory.js.map +0 -1
- package/dist/component/modules/aim.d.ts +0 -30
- package/dist/component/modules/aim.d.ts.map +0 -1
- package/dist/component/modules/aim.js +0 -39
- package/dist/component/modules/aim.js.map +0 -1
- package/dist/component/modules/corners.d.ts +0 -13
- package/dist/component/modules/corners.d.ts.map +0 -1
- package/dist/component/modules/corners.js +0 -12
- package/dist/component/modules/corners.js.map +0 -1
- package/dist/component/modules/flow.d.ts +0 -26
- package/dist/component/modules/flow.d.ts.map +0 -1
- package/dist/component/modules/flow.js +0 -55
- package/dist/component/modules/flow.js.map +0 -1
- package/dist/component/modules/material.d.ts +0 -40
- package/dist/component/modules/material.d.ts.map +0 -1
- package/dist/component/modules/material.js +0 -75
- package/dist/component/modules/material.js.map +0 -1
- package/dist/component/modules/paint.d.ts +0 -71
- package/dist/component/modules/paint.d.ts.map +0 -1
- package/dist/component/modules/paint.js +0 -106
- package/dist/component/modules/paint.js.map +0 -1
- package/dist/component/modules/shapes.d.ts +0 -31
- package/dist/component/modules/shapes.d.ts.map +0 -1
- package/dist/component/modules/shapes.js +0 -43
- package/dist/component/modules/shapes.js.map +0 -1
- package/dist/component/modules/text-layout.d.ts +0 -26
- package/dist/component/modules/text-layout.d.ts.map +0 -1
- package/dist/component/modules/text-layout.js +0 -57
- package/dist/component/modules/text-layout.js.map +0 -1
- package/dist/component/modules/text-style.d.ts +0 -48
- package/dist/component/modules/text-style.d.ts.map +0 -1
- package/dist/component/modules/text-style.js +0 -63
- package/dist/component/modules/text-style.js.map +0 -1
- package/dist/component/modules/three-entries.d.ts +0 -23
- package/dist/component/modules/three-entries.d.ts.map +0 -1
- package/dist/component/modules/three-entries.js +0 -41
- package/dist/component/modules/three-entries.js.map +0 -1
- package/dist/component/modules/view3d.d.ts +0 -55
- package/dist/component/modules/view3d.d.ts.map +0 -1
- package/dist/component/modules/view3d.js +0 -160
- package/dist/component/modules/view3d.js.map +0 -1
- package/dist/component/timeline.d.ts +0 -22
- package/dist/component/timeline.d.ts.map +0 -1
- package/dist/component/timeline.js +0 -128
- package/dist/component/timeline.js.map +0 -1
- package/dist/component/type-def.d.ts +0 -26
- package/dist/component/type-def.d.ts.map +0 -1
- package/dist/component/type-def.js +0 -16
- package/dist/component/type-def.js.map +0 -1
- package/dist/component/types.d.ts +0 -91
- package/dist/component/types.d.ts.map +0 -1
- package/dist/component/types.js +0 -88
- package/dist/component/types.js.map +0 -1
- package/dist/component/views.d.ts +0 -121
- package/dist/component/views.d.ts.map +0 -1
- package/dist/component/views.js +0 -413
- package/dist/component/views.js.map +0 -1
- package/dist/document/withdraw.d.ts +0 -28
- package/dist/document/withdraw.d.ts.map +0 -1
- package/dist/document/withdraw.js +0 -61
- package/dist/document/withdraw.js.map +0 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -3
- package/dist/jsx/jsx-dev-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-dev-runtime.js +0 -3
- package/dist/jsx/jsx-dev-runtime.js.map +0 -1
- package/dist/jsx/jsx-runtime.d.ts +0 -27
- package/dist/jsx/jsx-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-runtime.js +0 -26
- package/dist/jsx/jsx-runtime.js.map +0 -1
- package/dist/nodes/2d/node-lifecycle.d.ts +0 -46
- package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
- package/dist/nodes/2d/node-lifecycle.js +0 -264
- package/dist/nodes/2d/node-lifecycle.js.map +0 -1
- package/dist/nodes/2d/node-motion.d.ts +0 -56
- package/dist/nodes/2d/node-motion.d.ts.map +0 -1
- package/dist/nodes/2d/node-motion.js +0 -86
- package/dist/nodes/2d/node-motion.js.map +0 -1
- package/dist/nodes/2d/node-render.d.ts +0 -44
- package/dist/nodes/2d/node-render.d.ts.map +0 -1
- package/dist/nodes/2d/node-render.js +0 -80
- package/dist/nodes/2d/node-render.js.map +0 -1
- package/dist/nodes/2d/node-space.d.ts +0 -63
- package/dist/nodes/2d/node-space.d.ts.map +0 -1
- package/dist/nodes/2d/node-space.js +0 -131
- package/dist/nodes/2d/node-space.js.map +0 -1
- package/dist/nodes/2d/node-transform.d.ts +0 -55
- package/dist/nodes/2d/node-transform.d.ts.map +0 -1
- package/dist/nodes/2d/node-transform.js +0 -73
- package/dist/nodes/2d/node-transform.js.map +0 -1
- package/dist/nodes/2d/node2d.d.ts +0 -1111
- package/dist/nodes/2d/node2d.d.ts.map +0 -1
- package/dist/nodes/2d/node2d.js +0 -1665
- package/dist/nodes/2d/node2d.js.map +0 -1
- package/dist/nodes/2d/paint-node.d.ts +0 -142
- package/dist/nodes/2d/paint-node.d.ts.map +0 -1
- package/dist/nodes/2d/paint-node.js +0 -232
- package/dist/nodes/2d/paint-node.js.map +0 -1
- package/dist/nodes/audio/audio-bus.d.ts +0 -28
- package/dist/nodes/audio/audio-bus.d.ts.map +0 -1
- package/dist/nodes/audio/audio-bus.js +0 -33
- package/dist/nodes/audio/audio-bus.js.map +0 -1
- package/dist/nodes/audio/index.d.ts +0 -4
- package/dist/nodes/audio/index.d.ts.map +0 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +0 -1
- package/dist/nodes/audio/node-audio.d.ts +0 -107
- package/dist/nodes/audio/node-audio.d.ts.map +0 -1
- package/dist/nodes/audio/node-audio.js +0 -179
- package/dist/nodes/audio/node-audio.js.map +0 -1
- package/dist/nodes/audio/sound-node.d.ts +0 -41
- package/dist/nodes/audio/sound-node.d.ts.map +0 -1
- package/dist/nodes/audio/sound-node.js +0 -71
- package/dist/nodes/audio/sound-node.js.map +0 -1
- package/dist/nodes/geometry/boolean-node.d.ts +0 -28
- package/dist/nodes/geometry/boolean-node.d.ts.map +0 -1
- package/dist/nodes/geometry/boolean-node.js +0 -81
- package/dist/nodes/geometry/boolean-node.js.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +0 -149
- package/dist/nodes/geometry/bounds-shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/bounds-shape-node.js +0 -181
- package/dist/nodes/geometry/bounds-shape-node.js.map +0 -1
- package/dist/nodes/geometry/box-path-node.d.ts +0 -89
- package/dist/nodes/geometry/box-path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/box-path-node.js +0 -116
- package/dist/nodes/geometry/box-path-node.js.map +0 -1
- package/dist/nodes/geometry/ellipse-node.d.ts +0 -18
- package/dist/nodes/geometry/ellipse-node.d.ts.map +0 -1
- package/dist/nodes/geometry/ellipse-node.js +0 -45
- package/dist/nodes/geometry/ellipse-node.js.map +0 -1
- package/dist/nodes/geometry/group-bounds.d.ts +0 -56
- package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
- package/dist/nodes/geometry/group-bounds.js +0 -87
- package/dist/nodes/geometry/group-bounds.js.map +0 -1
- package/dist/nodes/geometry/mask-node.d.ts +0 -33
- package/dist/nodes/geometry/mask-node.d.ts.map +0 -1
- package/dist/nodes/geometry/mask-node.js +0 -66
- package/dist/nodes/geometry/mask-node.js.map +0 -1
- package/dist/nodes/geometry/path-node.d.ts +0 -26
- package/dist/nodes/geometry/path-node.d.ts.map +0 -1
- package/dist/nodes/geometry/path-node.js +0 -58
- package/dist/nodes/geometry/path-node.js.map +0 -1
- package/dist/nodes/geometry/polygon-node.d.ts +0 -26
- package/dist/nodes/geometry/polygon-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygon-node.js +0 -47
- package/dist/nodes/geometry/polygon-node.js.map +0 -1
- package/dist/nodes/geometry/polygram-node.d.ts +0 -33
- package/dist/nodes/geometry/polygram-node.d.ts.map +0 -1
- package/dist/nodes/geometry/polygram-node.js +0 -52
- package/dist/nodes/geometry/polygram-node.js.map +0 -1
- package/dist/nodes/geometry/rect-node.d.ts +0 -38
- package/dist/nodes/geometry/rect-node.d.ts.map +0 -1
- package/dist/nodes/geometry/rect-node.js +0 -56
- package/dist/nodes/geometry/rect-node.js.map +0 -1
- package/dist/nodes/geometry/shape-node.d.ts +0 -71
- package/dist/nodes/geometry/shape-node.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-node.js +0 -140
- package/dist/nodes/geometry/shape-node.js.map +0 -1
- package/dist/nodes/geometry/shape-outline.d.ts +0 -93
- package/dist/nodes/geometry/shape-outline.d.ts.map +0 -1
- package/dist/nodes/geometry/shape-outline.js +0 -470
- package/dist/nodes/geometry/shape-outline.js.map +0 -1
- package/dist/nodes/index.d.ts +0 -53
- package/dist/nodes/index.d.ts.map +0 -1
- package/dist/nodes/index.js +0 -35
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/layout/camera-node.d.ts +0 -80
- package/dist/nodes/layout/camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/camera-node.js +0 -153
- package/dist/nodes/layout/camera-node.js.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +0 -80
- package/dist/nodes/layout/orbit-camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/orbit-camera-node.js +0 -118
- package/dist/nodes/layout/orbit-camera-node.js.map +0 -1
- package/dist/nodes/layout/rotated-box.d.ts +0 -20
- package/dist/nodes/layout/rotated-box.d.ts.map +0 -1
- package/dist/nodes/layout/rotated-box.js +0 -76
- package/dist/nodes/layout/rotated-box.js.map +0 -1
- package/dist/nodes/media/video-node.d.ts +0 -229
- package/dist/nodes/media/video-node.d.ts.map +0 -1
- package/dist/nodes/media/video-node.js +0 -350
- package/dist/nodes/media/video-node.js.map +0 -1
- package/dist/nodes/node/declare-paints.d.ts +0 -19
- package/dist/nodes/node/declare-paints.d.ts.map +0 -1
- package/dist/nodes/node/declare-paints.js +0 -27
- package/dist/nodes/node/declare-paints.js.map +0 -1
- package/dist/nodes/node/node-editor-state.d.ts +0 -53
- package/dist/nodes/node/node-editor-state.d.ts.map +0 -1
- package/dist/nodes/node/node-editor-state.js +0 -23
- package/dist/nodes/node/node-editor-state.js.map +0 -1
- package/dist/nodes/node/node-reactive.d.ts +0 -89
- package/dist/nodes/node/node-reactive.d.ts.map +0 -1
- package/dist/nodes/node/node-reactive.js +0 -135
- package/dist/nodes/node/node-reactive.js.map +0 -1
- package/dist/nodes/node/node-time.d.ts +0 -39
- package/dist/nodes/node/node-time.d.ts.map +0 -1
- package/dist/nodes/node/node-time.js +0 -14
- package/dist/nodes/node/node-time.js.map +0 -1
- package/dist/nodes/node/node-walk.d.ts +0 -46
- package/dist/nodes/node/node-walk.d.ts.map +0 -1
- package/dist/nodes/node/node-walk.js +0 -74
- package/dist/nodes/node/node-walk.js.map +0 -1
- package/dist/nodes/node/node.d.ts +0 -445
- package/dist/nodes/node/node.d.ts.map +0 -1
- package/dist/nodes/node/node.js +0 -745
- package/dist/nodes/node/node.js.map +0 -1
- package/dist/nodes/node/text-defaults.d.ts +0 -32
- package/dist/nodes/node/text-defaults.d.ts.map +0 -1
- package/dist/nodes/node/text-defaults.js +0 -37
- package/dist/nodes/node/text-defaults.js.map +0 -1
- package/dist/nodes/root/canvas2d-node.d.ts +0 -163
- package/dist/nodes/root/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/root/canvas2d-node.js +0 -264
- package/dist/nodes/root/canvas2d-node.js.map +0 -1
- package/dist/nodes/root/provider-node.d.ts +0 -47
- package/dist/nodes/root/provider-node.d.ts.map +0 -1
- package/dist/nodes/root/provider-node.js +0 -63
- package/dist/nodes/root/provider-node.js.map +0 -1
- package/dist/nodes/root/theme-provider-node.d.ts +0 -29
- package/dist/nodes/root/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/root/theme-provider-node.js +0 -43
- package/dist/nodes/root/theme-provider-node.js.map +0 -1
- package/dist/nodes/text/default-text-style-node.d.ts +0 -103
- package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
- package/dist/nodes/text/default-text-style-node.js +0 -146
- package/dist/nodes/text/default-text-style-node.js.map +0 -1
- package/dist/nodes/text/number-format.d.ts +0 -66
- package/dist/nodes/text/number-format.d.ts.map +0 -1
- package/dist/nodes/text/number-format.js +0 -227
- package/dist/nodes/text/number-format.js.map +0 -1
- package/dist/nodes/text/number-node.d.ts +0 -94
- package/dist/nodes/text/number-node.d.ts.map +0 -1
- package/dist/nodes/text/number-node.js +0 -86
- package/dist/nodes/text/number-node.js.map +0 -1
- package/dist/nodes/text/number-pattern.d.ts +0 -51
- package/dist/nodes/text/number-pattern.d.ts.map +0 -1
- package/dist/nodes/text/number-pattern.js +0 -77
- package/dist/nodes/text/number-pattern.js.map +0 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -68
- package/dist/nodes/text/richtext-node.d.ts.map +0 -1
- package/dist/nodes/text/richtext-node.js +0 -78
- package/dist/nodes/text/richtext-node.js.map +0 -1
- package/dist/nodes/text/text-base.d.ts +0 -118
- package/dist/nodes/text/text-base.d.ts.map +0 -1
- package/dist/nodes/text/text-base.js +0 -153
- package/dist/nodes/text/text-base.js.map +0 -1
- package/dist/nodes/text/text-layout.d.ts +0 -87
- package/dist/nodes/text/text-layout.d.ts.map +0 -1
- package/dist/nodes/text/text-layout.js +0 -368
- package/dist/nodes/text/text-layout.js.map +0 -1
- package/dist/nodes/text/text-node.d.ts +0 -84
- package/dist/nodes/text/text-node.d.ts.map +0 -1
- package/dist/nodes/text/text-node.js +0 -188
- package/dist/nodes/text/text-node.js.map +0 -1
- package/dist/nodes/text/text-selection.d.ts +0 -125
- package/dist/nodes/text/text-selection.d.ts.map +0 -1
- package/dist/nodes/text/text-selection.js +0 -209
- package/dist/nodes/text/text-selection.js.map +0 -1
- package/dist/nodes/three/camera-nodes.d.ts +0 -109
- package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
- package/dist/nodes/three/camera-nodes.js +0 -112
- package/dist/nodes/three/camera-nodes.js.map +0 -1
- package/dist/nodes/three/canvas3d-node.d.ts +0 -295
- package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
- package/dist/nodes/three/canvas3d-node.js +0 -486
- package/dist/nodes/three/canvas3d-node.js.map +0 -1
- package/dist/nodes/three/drawable-nodes.d.ts +0 -173
- package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
- package/dist/nodes/three/drawable-nodes.js +0 -284
- package/dist/nodes/three/drawable-nodes.js.map +0 -1
- package/dist/nodes/three/environment-nodes.d.ts +0 -106
- package/dist/nodes/three/environment-nodes.d.ts.map +0 -1
- package/dist/nodes/three/environment-nodes.js +0 -134
- package/dist/nodes/three/environment-nodes.js.map +0 -1
- package/dist/nodes/three/geometry-nodes.d.ts +0 -197
- package/dist/nodes/three/geometry-nodes.d.ts.map +0 -1
- package/dist/nodes/three/geometry-nodes.js +0 -322
- package/dist/nodes/three/geometry-nodes.js.map +0 -1
- package/dist/nodes/three/grid-geometry3d.d.ts +0 -62
- package/dist/nodes/three/grid-geometry3d.d.ts.map +0 -1
- package/dist/nodes/three/grid-geometry3d.js +0 -114
- package/dist/nodes/three/grid-geometry3d.js.map +0 -1
- package/dist/nodes/three/group3d.d.ts +0 -23
- package/dist/nodes/three/group3d.d.ts.map +0 -1
- package/dist/nodes/three/group3d.js +0 -21
- package/dist/nodes/three/group3d.js.map +0 -1
- package/dist/nodes/three/light-nodes.d.ts +0 -120
- package/dist/nodes/three/light-nodes.d.ts.map +0 -1
- package/dist/nodes/three/light-nodes.js +0 -173
- package/dist/nodes/three/light-nodes.js.map +0 -1
- package/dist/nodes/three/mesh3d.d.ts +0 -117
- package/dist/nodes/three/mesh3d.d.ts.map +0 -1
- package/dist/nodes/three/mesh3d.js +0 -147
- package/dist/nodes/three/mesh3d.js.map +0 -1
- package/dist/nodes/three/node3d.d.ts +0 -230
- package/dist/nodes/three/node3d.d.ts.map +0 -1
- package/dist/nodes/three/node3d.js +0 -337
- package/dist/nodes/three/node3d.js.map +0 -1
- package/dist/render/descriptors/latex.d.ts +0 -6
- package/dist/render/descriptors/latex.d.ts.map +0 -1
- package/dist/render/descriptors/latex.js +0 -2
- package/dist/render/descriptors/latex.js.map +0 -1
- package/dist/tween/seekable.d.ts +0 -81
- package/dist/tween/seekable.d.ts.map +0 -1
- package/dist/tween/seekable.js +0 -137
- package/dist/tween/seekable.js.map +0 -1
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { lerpNumber } from "../../../tween/lerp.js";
|
|
2
|
+
import { lerpVector2 } from "../../../attributes/layout/vector2.js";
|
|
3
|
+
import { lerpColor } from "../../../attributes/shape/fill/lerp.js";
|
|
4
|
+
import { resolveEffectColor, sameEffectAxis, sameEffectColor, scalarOptions, withEffectOptions } from "./effect-data.js";
|
|
5
|
+
/** Declares a built-in effect; see {@link EffectSpec}. */
|
|
6
|
+
export function defineEffect(spec) {
|
|
7
|
+
return spec;
|
|
8
|
+
}
|
|
9
|
+
/** The middle of the layer, every centre option's default. Shared, as it always was. */
|
|
10
|
+
export const CENTER = { x: 0.5, y: 0.5 };
|
|
11
|
+
/** Parameter constructors for {@link defineEffect}. */
|
|
12
|
+
export const param = {
|
|
13
|
+
number(o) {
|
|
14
|
+
return { kind: "number", ...o };
|
|
15
|
+
},
|
|
16
|
+
color(o) {
|
|
17
|
+
return { kind: "color", ...o };
|
|
18
|
+
},
|
|
19
|
+
/** A point or per-axis pair. `fromNumber` lets the builder take a bare number for it. */
|
|
20
|
+
vec2(o) {
|
|
21
|
+
const normalize = o.fromNumber === undefined
|
|
22
|
+
? undefined
|
|
23
|
+
: o.fromNumber === "both"
|
|
24
|
+
? (v) => (typeof v === "number" ? { x: v, y: v } : v)
|
|
25
|
+
: (v) => (typeof v === "number" ? { x: 0, y: v } : v);
|
|
26
|
+
return { kind: "vec2", ...(normalize ? { normalize } : {}), ...o };
|
|
27
|
+
},
|
|
28
|
+
choice(options, o) {
|
|
29
|
+
return { kind: "enum", options, lerp: "step", ...o };
|
|
30
|
+
},
|
|
31
|
+
boolean(o) {
|
|
32
|
+
return { kind: "boolean", lerp: "step", ...o };
|
|
33
|
+
},
|
|
34
|
+
axis(o) {
|
|
35
|
+
return { kind: "axis", lerp: "step", ...o };
|
|
36
|
+
},
|
|
37
|
+
text(o) {
|
|
38
|
+
return { kind: "text", lerp: "step", ...o };
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* A parameter of stored type `T` that no generic kind covers, curried so
|
|
42
|
+
* `T` is given and the options inferred: `param.of<Color[]>()({ kind: "colors", … })`.
|
|
43
|
+
* It steps and compares by `===` unless given `lerp`/`equals`.
|
|
44
|
+
*/
|
|
45
|
+
of() {
|
|
46
|
+
return (o) => ({ lerp: "step", ...o });
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
const step = (a, b, t) => (t < 0.5 ? a : b);
|
|
50
|
+
const same = (a, b) => a === b;
|
|
51
|
+
const sameVector = (a, b) => a.x === b.x && a.y === b.y;
|
|
52
|
+
const KIND_LERP = {
|
|
53
|
+
number: lerpNumber,
|
|
54
|
+
color: (a, b, t) => lerpColor(resolveEffectColor(a), resolveEffectColor(b), t),
|
|
55
|
+
vec2: lerpVector2,
|
|
56
|
+
};
|
|
57
|
+
const KIND_EQUALS = {
|
|
58
|
+
color: sameEffectColor,
|
|
59
|
+
vec2: sameVector,
|
|
60
|
+
axis: sameEffectAxis,
|
|
61
|
+
};
|
|
62
|
+
function paramLerp(def) {
|
|
63
|
+
if (typeof def.lerp === "function")
|
|
64
|
+
return def.lerp;
|
|
65
|
+
const kind = def.lerp === "step" ? undefined : KIND_LERP[def.kind];
|
|
66
|
+
if (!kind)
|
|
67
|
+
return step;
|
|
68
|
+
// An absent optional field tweens from what it means when absent.
|
|
69
|
+
if (def.optional && def.default !== undefined) {
|
|
70
|
+
const fallback = def.default;
|
|
71
|
+
return (a, b, t, from, to) => kind(a ?? fallback, b ?? fallback, t, from, to);
|
|
72
|
+
}
|
|
73
|
+
return kind;
|
|
74
|
+
}
|
|
75
|
+
/** The derived `EffectData` of a spec: generic per-kind `lerp`/`equals` unless the spec gives its own. */
|
|
76
|
+
export function effectDataOf(spec) {
|
|
77
|
+
const entries = Object.entries(spec.params);
|
|
78
|
+
const lerps = entries.map(([name, def]) => [name, paramLerp(def)]);
|
|
79
|
+
const equals = entries.map(([name, def]) => [name, def.equals ?? KIND_EQUALS[def.kind] ?? same]);
|
|
80
|
+
const derived = (from, to, t) => {
|
|
81
|
+
const out = { type: spec.type };
|
|
82
|
+
const f = from;
|
|
83
|
+
const g = to;
|
|
84
|
+
for (const [name, lerp] of lerps)
|
|
85
|
+
out[name] = lerp(f[name], g[name], t, f, g);
|
|
86
|
+
return out;
|
|
87
|
+
};
|
|
88
|
+
const custom = spec.lerp;
|
|
89
|
+
const data = {
|
|
90
|
+
lerp: custom ? (from, to, t) => custom(from, to, t, derived) : derived,
|
|
91
|
+
equals: spec.equals ?? ((a, b) => {
|
|
92
|
+
const x = a;
|
|
93
|
+
const y = b;
|
|
94
|
+
return equals.every(([name, eq]) => eq(x[name], y[name]));
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
97
|
+
if (spec.surface !== undefined)
|
|
98
|
+
data.surface = spec.surface;
|
|
99
|
+
if (spec.resolve)
|
|
100
|
+
data.resolve = spec.resolve;
|
|
101
|
+
if (spec.declare)
|
|
102
|
+
data.declare = spec.declare;
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
// Arrays are copied so editing one effect's list never reaches another's;
|
|
106
|
+
// objects (a centre point) are shared, as they always were.
|
|
107
|
+
const copyDefault = (value) => (Array.isArray(value) ? [...value] : value);
|
|
108
|
+
/**
|
|
109
|
+
* Builds an effect from builder input: the scalar shorthand, then each
|
|
110
|
+
* parameter's option or default (normalised), then `mode`/`clip`.
|
|
111
|
+
*/
|
|
112
|
+
export function buildEffect(spec, arg) {
|
|
113
|
+
const o = (spec.scalar
|
|
114
|
+
? scalarOptions(arg, spec.scalar)
|
|
115
|
+
: (arg ?? {}));
|
|
116
|
+
const out = { type: spec.type };
|
|
117
|
+
for (const [name, def] of Object.entries(spec.params)) {
|
|
118
|
+
const value = o[name] ?? copyDefault(def.default);
|
|
119
|
+
if (value === undefined)
|
|
120
|
+
continue;
|
|
121
|
+
out[name] = def.normalize ? def.normalize(value) : value;
|
|
122
|
+
}
|
|
123
|
+
const options = spec.defaultMode && o.mode === undefined ? { ...o, mode: spec.defaultMode } : o;
|
|
124
|
+
return withEffectOptions(out, options);
|
|
125
|
+
}
|
|
126
|
+
const json = (value) => value === undefined ? undefined : JSON.parse(JSON.stringify(value));
|
|
127
|
+
/** The serialisable {@link EffectDescriptor} of a spec. */
|
|
128
|
+
export function describeSpec(spec) {
|
|
129
|
+
const params = Object.entries(spec.params).map(([name, def], index) => {
|
|
130
|
+
const stored = def.default !== undefined && def.normalize ? def.normalize(def.default) : def.default;
|
|
131
|
+
const out = {
|
|
132
|
+
name,
|
|
133
|
+
kind: def.kind,
|
|
134
|
+
animatable: def.lerp !== "step",
|
|
135
|
+
label: def.label ?? name,
|
|
136
|
+
order: def.order ?? index,
|
|
137
|
+
};
|
|
138
|
+
const optional = {
|
|
139
|
+
default: json(stored),
|
|
140
|
+
required: def.required,
|
|
141
|
+
optional: def.optional,
|
|
142
|
+
min: def.min,
|
|
143
|
+
max: def.max,
|
|
144
|
+
step: def.step,
|
|
145
|
+
unit: def.unit,
|
|
146
|
+
options: def.options ? [...def.options] : undefined,
|
|
147
|
+
control: def.control,
|
|
148
|
+
inline: def.inline,
|
|
149
|
+
zero: def.zero,
|
|
150
|
+
optionsLabel: def.optionsLabel,
|
|
151
|
+
hidden: def.hidden,
|
|
152
|
+
initial: json(def.initial),
|
|
153
|
+
};
|
|
154
|
+
for (const [key, value] of Object.entries(optional)) {
|
|
155
|
+
if (value !== undefined)
|
|
156
|
+
out[key] = value;
|
|
157
|
+
}
|
|
158
|
+
return out;
|
|
159
|
+
});
|
|
160
|
+
const out = {
|
|
161
|
+
type: spec.type,
|
|
162
|
+
group: spec.group,
|
|
163
|
+
surface: typeof spec.surface === "function" ? "dynamic" : (spec.surface ?? "filter"),
|
|
164
|
+
neutral: spec.neutral === null ? null : json(Object.fromEntries(Object.entries(spec.neutral).map(([name, value]) => {
|
|
165
|
+
const normalize = spec.params[name]?.normalize;
|
|
166
|
+
return [name, normalize ? normalize(value) : value];
|
|
167
|
+
}))),
|
|
168
|
+
params,
|
|
169
|
+
};
|
|
170
|
+
if (spec.scalar)
|
|
171
|
+
out.scalar = spec.scalar;
|
|
172
|
+
if (spec.defaultMode)
|
|
173
|
+
out.defaultMode = spec.defaultMode;
|
|
174
|
+
if (spec.onlyOn)
|
|
175
|
+
out.onlyOn = spec.onlyOn;
|
|
176
|
+
return out;
|
|
177
|
+
}
|
|
178
|
+
//# sourceMappingURL=spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.js","sourceRoot":"","sources":["../../../../src/attributes/shape/effects/spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAgB,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAIzD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAoItH,0DAA0D;AAC1D,MAAM,UAAU,YAAY,CACxB,IAAsB;IAEtB,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,MAAM,MAAM,GAAY,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC;AAMlD,uDAAuD;AACvD,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,MAAM,CAAkC,CAAoE;QACxG,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,CAAC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QAAE,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACzD,IAAI,IAAI,CAAC,MAAM;QAAE,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC1C,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["import { lerpNumber } from \"@/tween/lerp\";\nimport { lerpVector2, type Vector2 } from \"@/attributes/layout/vector2\";\nimport { lerpColor } from \"@/attributes/shape/fill/lerp\";\nimport type { Color } from \"@/attributes/shape/fill/color/parser\";\nimport type { AssetScope } from \"@/assets/scope\";\nimport type { EffectAxis, EffectData, EffectMode, EffectOptions, EffectSurface, ModedEffect } from \"./effect-data\";\nimport { resolveEffectColor, sameEffectAxis, sameEffectColor, scalarOptions, withEffectOptions } from \"./effect-data\";\n\n/**\n * How a parameter's value is shaped, which decides its default interpolation,\n * equality and how a renderer encodes it into a uniform.\n */\nexport type EffectParamKind =\n | \"number\"\n | \"color\"\n | \"vec2\"\n | \"enum\"\n | \"boolean\"\n | \"axis\"\n | \"text\"\n | \"colors\"\n | \"numbers\"\n | \"points\"\n | \"table\"\n | \"uniforms\";\n\n/** What a number measures, for a host's units and a renderer's scaling. */\nexport type EffectParamUnit = \"px\" | \"deg\" | \"percent\" | \"factor\" | \"normalized\";\n\n/** The picker family an effect is listed under. */\nexport type EffectGroup = \"blur\" | \"light\" | \"color\" | \"stylize\" | \"distort\" | \"glitch\";\n\n/** The control an inspector should draw for a parameter. */\nexport type EffectParamControl = \"number\" | \"slider\" | \"angle\" | \"hue\" | \"segmented\" | \"select\" | \"text\" | \"color\" | \"point\" | \"toggle\";\n\n/** Per-parameter inspector hints. None of them changes what the effect does. */\nexport interface EffectParamHints {\n /** i18n leaf for the field's label; defaults to the parameter name. */\n readonly label?: string;\n readonly control?: EffectParamControl;\n /** Shown on the effect's row beside its name (one per effect). */\n readonly inline?: boolean;\n /** Inspector position; defaults to the declaration order. */\n readonly order?: number;\n /** For an angle: where 0° points (the bearing turns clockwise). Defaults to `\"right\"`. */\n readonly zero?: \"right\" | \"top\";\n /** i18n group for an enum's option labels. */\n readonly optionsLabel?: string;\n /** Not offered as a field: the value a fresh effect carries is kept as is. */\n readonly hidden?: boolean;\n /** Where a freshly inserted effect starts, when the builder default would show nothing. */\n readonly initial?: unknown;\n}\n\n/** Interpolates one parameter. `from`/`to` are the whole effects, for parameters that depend on a sibling. */\nexport type EffectParamLerp<T> = (a: T, b: T, t: number, from: Record<string, unknown>, to: Record<string, unknown>) => T;\n\n/**\n * One parameter of a built-in effect: a stored field of the effect object.\n *\n * `T` is the stored type, `In` what a builder accepts for it (`normalize` maps\n * one to the other: a bare number for a per-axis count, say). Only the\n * serialisable fields reach {@link EffectDescriptor}.\n */\nexport interface EffectParamDef<T = unknown, In = T> extends EffectParamHints {\n readonly kind: EffectParamKind;\n /** What the builder writes when the option is omitted (an input, before `normalize`). */\n readonly default?: In;\n /** The stored field may be absent (`colorAdjustment`'s fields, `curves.channel`). */\n readonly optional?: boolean;\n /** The builder's options type requires it. */\n readonly required?: boolean;\n readonly min?: number;\n readonly max?: number;\n readonly step?: number;\n readonly unit?: EffectParamUnit;\n /** An enum's values, in the order a renderer indexes them. */\n readonly options?: readonly (string | number)[];\n readonly normalize?: (input: In) => T;\n /** `\"step\"` switches at the midpoint; omitted uses the kind's interpolation. */\n readonly lerp?: \"step\" | EffectParamLerp<T>;\n readonly equals?: (a: T, b: T) => boolean;\n /** Type carrier only; never set. */\n readonly __type?: [T, In];\n}\n\n/** An effect's parameters, by stored field name, in builder (and stored-key) order. */\nexport type EffectParamTable = Readonly<Record<string, EffectParamDef<any, any>>>;\n\n/**\n * The declarative definition of a built-in effect: its parameters (types,\n * defaults, ranges, inspector hints) plus the behaviour that has to stay code.\n * Core's types, builder defaults, `lerp`/`equals` and the host-facing\n * {@link EffectDescriptor} are derived from it, and the renderers bind their\n * shader uniforms to its parameter names.\n */\nexport interface EffectSpec<T extends string = string, P extends EffectParamTable = EffectParamTable> {\n readonly type: T;\n readonly params: P;\n readonly group: EffectGroup;\n /** The option a bare number passed to the builder sets. */\n readonly scalar?: string;\n /** The builder's `mode` when none is given. */\n readonly defaultMode?: EffectMode;\n /** The one layer the effect does anything on. */\n readonly onlyOn?: EffectMode;\n /** Builder options at which the effect draws nothing, or `null` when it has none. */\n readonly neutral: Readonly<Record<string, unknown>> | null;\n readonly surface?: EffectData<any>[\"surface\"];\n readonly resolve?: (effect: any) => any;\n readonly declare?: (effect: any, assets: AssetScope) => void;\n /** Wraps or replaces the derived interpolation, which it is handed as `derived`. */\n readonly lerp?: (from: any, to: any, t: number, derived: (from: any, to: any, t: number) => any) => any;\n readonly equals?: (a: any, b: any) => boolean;\n}\n\ntype ParamValue<D> = D extends { readonly __type?: [infer T, unknown] } ? T : never;\ntype ParamInput<D> = D extends { readonly __type?: [unknown, infer I] } ? I : never;\ntype IsOptional<D> = D extends { readonly optional: true } ? true : false;\ntype IsRequired<D> = D extends { readonly required: true } ? true : false;\n\n/** The stored fields an effect's parameters describe. */\nexport type EffectFields<P extends EffectParamTable> = {\n -readonly [K in keyof P as IsOptional<P[K]> extends true ? never : K]: ParamValue<P[K]>;\n} & {\n -readonly [K in keyof P as IsOptional<P[K]> extends true ? K : never]?: ParamValue<P[K]>;\n};\n\n/** A builder's options for an effect: every parameter as input, plus `mode`/`clip`. */\nexport type EffectOptionsOf<P extends EffectParamTable> = {\n -readonly [K in keyof P as IsRequired<P[K]> extends true ? K : never]: ParamInput<P[K]>;\n} & {\n -readonly [K in keyof P as IsRequired<P[K]> extends true ? never : K]?: ParamInput<P[K]>;\n} & EffectOptions;\n\n/** The effect object a spec describes. */\nexport type EffectOf<S extends EffectSpec> = { type: S[\"type\"] } & ModedEffect & EffectFields<S[\"params\"]>;\n\n/** Declares a built-in effect; see {@link EffectSpec}. */\nexport function defineEffect<const T extends string, const P extends EffectParamTable>(\n spec: EffectSpec<T, P>,\n): EffectSpec<T, P> {\n return spec;\n}\n\n/** The middle of the layer, every centre option's default. Shared, as it always was. */\nexport const CENTER: Vector2 = { x: 0.5, y: 0.5 };\n\ntype Options<T, In = T> = Omit<EffectParamDef<T, In>, \"kind\" | \"__type\" | \"options\" | \"normalize\" | \"lerp\" | \"equals\">;\n// Kept out of the inferred options so a lambda here is typed by its parameter.\ntype Behaviour<T> = Pick<EffectParamDef<T>, \"lerp\" | \"equals\">;\n\n/** Parameter constructors for {@link defineEffect}. */\nexport const param = {\n number<const O extends Options<number>>(o: O & Behaviour<number> & { normalize?: (input: number) => number }): EffectParamDef<number> & NoInfer<O> & { kind: \"number\" } {\n return { kind: \"number\", ...o };\n },\n color<const O extends Options<Color>>(o: O & Behaviour<Color>): EffectParamDef<Color> & NoInfer<O> & { kind: \"color\" } {\n return { kind: \"color\", ...o };\n },\n /** A point or per-axis pair. `fromNumber` lets the builder take a bare number for it. */\n vec2<const O extends Options<Vector2, number | Vector2> & { fromNumber?: \"both\" | \"y\" }>(\n o: O & Behaviour<Vector2>,\n ): EffectParamDef<Vector2, O extends { fromNumber: string } ? number | Vector2 : Vector2> & NoInfer<O> & { kind: \"vec2\" } {\n const normalize = o.fromNumber === undefined\n ? undefined\n : o.fromNumber === \"both\"\n ? (v: number | Vector2) => (typeof v === \"number\" ? { x: v, y: v } : v)\n : (v: number | Vector2) => (typeof v === \"number\" ? { x: 0, y: v } : v);\n return { kind: \"vec2\", ...(normalize ? { normalize } : {}), ...o } as never;\n },\n choice<const V extends string | number, const O extends Options<V>>(\n options: readonly V[],\n o: O & Behaviour<V>,\n ): EffectParamDef<V> & NoInfer<O> & { kind: \"enum\"; options: readonly V[] } {\n return { kind: \"enum\", options, lerp: \"step\", ...o };\n },\n boolean<const O extends Options<boolean>>(o: O & Behaviour<boolean>): EffectParamDef<boolean> & NoInfer<O> & { kind: \"boolean\" } {\n return { kind: \"boolean\", lerp: \"step\", ...o };\n },\n axis<const O extends Options<EffectAxis>>(o: O & Behaviour<EffectAxis>): EffectParamDef<EffectAxis> & NoInfer<O> & { kind: \"axis\" } {\n return { kind: \"axis\", lerp: \"step\", ...o };\n },\n text<V extends string = string, const O extends Options<V> = Options<V>>(o: O & Behaviour<V>): EffectParamDef<V> & NoInfer<O> & { kind: \"text\" } {\n return { kind: \"text\", lerp: \"step\", ...o };\n },\n /**\n * A parameter of stored type `T` that no generic kind covers, curried so\n * `T` is given and the options inferred: `param.of<Color[]>()({ kind: \"colors\", … })`.\n * It steps and compares by `===` unless given `lerp`/`equals`.\n */\n of<T>() {\n return <const O extends Options<T> & { kind: EffectParamKind }>(o: O & Behaviour<T>): EffectParamDef<T> & NoInfer<O> =>\n ({ lerp: \"step\", ...o }) as never;\n },\n};\n\nconst step = <T>(a: T, b: T, t: number): T => (t < 0.5 ? a : b);\nconst same = (a: unknown, b: unknown) => a === b;\nconst sameVector = (a: Vector2, b: Vector2) => a.x === b.x && a.y === b.y;\n\nconst KIND_LERP: Partial<Record<EffectParamKind, EffectParamLerp<any>>> = {\n number: lerpNumber,\n color: (a: Color, b: Color, t) => lerpColor(resolveEffectColor(a), resolveEffectColor(b), t),\n vec2: lerpVector2,\n};\n\nconst KIND_EQUALS: Partial<Record<EffectParamKind, (a: any, b: any) => boolean>> = {\n color: sameEffectColor,\n vec2: sameVector,\n axis: sameEffectAxis,\n};\n\nfunction paramLerp(def: EffectParamDef<any, any>): EffectParamLerp<unknown> {\n if (typeof def.lerp === \"function\") return def.lerp;\n const kind = def.lerp === \"step\" ? undefined : KIND_LERP[def.kind];\n if (!kind) return step;\n // An absent optional field tweens from what it means when absent.\n if (def.optional && def.default !== undefined) {\n const fallback = def.default;\n return (a, b, t, from, to) => kind(a ?? fallback, b ?? fallback, t, from, to);\n }\n return kind;\n}\n\n/** The derived `EffectData` of a spec: generic per-kind `lerp`/`equals` unless the spec gives its own. */\nexport function effectDataOf<S extends EffectSpec>(spec: S): EffectData<EffectOf<S>> {\n const entries = Object.entries(spec.params);\n const lerps = entries.map(([name, def]) => [name, paramLerp(def)] as const);\n const equals = entries.map(([name, def]) => [name, def.equals ?? KIND_EQUALS[def.kind] ?? same] as const);\n const derived = (from: EffectOf<S>, to: EffectOf<S>, t: number): EffectOf<S> => {\n const out: Record<string, unknown> = { type: spec.type };\n const f = from as unknown as Record<string, unknown>;\n const g = to as unknown as Record<string, unknown>;\n for (const [name, lerp] of lerps) out[name] = lerp(f[name], g[name], t, f, g);\n return out as EffectOf<S>;\n };\n const custom = spec.lerp;\n const data: EffectData<EffectOf<S>> = {\n lerp: custom ? (from, to, t) => custom(from, to, t, derived) : derived,\n equals: spec.equals ?? ((a, b) => {\n const x = a as unknown as Record<string, unknown>;\n const y = b as unknown as Record<string, unknown>;\n return equals.every(([name, eq]) => eq(x[name], y[name]));\n }),\n };\n if (spec.surface !== undefined) data.surface = spec.surface;\n if (spec.resolve) data.resolve = spec.resolve;\n if (spec.declare) data.declare = spec.declare;\n return data;\n}\n\n// Arrays are copied so editing one effect's list never reaches another's;\n// objects (a centre point) are shared, as they always were.\nconst copyDefault = (value: unknown) => (Array.isArray(value) ? [...value] : value);\n\n/**\n * Builds an effect from builder input: the scalar shorthand, then each\n * parameter's option or default (normalised), then `mode`/`clip`.\n */\nexport function buildEffect<S extends EffectSpec>(\n spec: S,\n arg: number | EffectOptionsOf<S[\"params\"]> | undefined,\n): EffectOf<S> {\n const o = (spec.scalar\n ? scalarOptions(arg as number | Record<string, unknown> | undefined, spec.scalar as never)\n : (arg ?? {})) as Record<string, unknown> & EffectOptions;\n const out: Record<string, unknown> = { type: spec.type };\n for (const [name, def] of Object.entries(spec.params)) {\n const value = o[name] ?? copyDefault(def.default);\n if (value === undefined) continue;\n out[name] = def.normalize ? def.normalize(value) : value;\n }\n const options = spec.defaultMode && o.mode === undefined ? { ...o, mode: spec.defaultMode } : o;\n return withEffectOptions(out, options) as unknown as EffectOf<S>;\n}\n\n/** A JSON value — what every field of an {@link EffectDescriptor} is made of. */\nexport type EffectJson = string | number | boolean | null | EffectJson[] | { [key: string]: EffectJson };\n\n/** One parameter of an {@link EffectDescriptor}. */\nexport interface EffectParamDescriptor {\n /** The stored field it writes. */\n name: string;\n kind: EffectParamKind;\n /** What the builder writes when it is omitted, as stored (colours as authored). */\n default?: EffectJson;\n /** The builder's options require it. */\n required?: boolean;\n /** The stored field may be absent. */\n optional?: boolean;\n min?: number;\n max?: number;\n step?: number;\n unit?: EffectParamUnit;\n options?: (string | number)[];\n /** Tweens continuously (false: switches at the midpoint). */\n animatable: boolean;\n /** i18n leaf for the label; the name unless the spec says otherwise. */\n label: string;\n control?: EffectParamControl;\n inline?: boolean;\n /** Inspector position. */\n order: number;\n zero?: \"right\" | \"top\";\n optionsLabel?: string;\n hidden?: boolean;\n initial?: EffectJson;\n}\n\n/**\n * A built-in effect, described for a host: what its fields are, their kinds,\n * defaults and ranges, and how an inspector should lay them out. Plain JSON, so\n * it can be shipped to a UI as is.\n */\nexport interface EffectDescriptor {\n type: string;\n group: EffectGroup;\n /** `\"dynamic\"`: depends on the effect's `mode` (the user shader). */\n surface: EffectSurface | \"dynamic\";\n scalar?: string;\n defaultMode?: EffectMode;\n onlyOn?: EffectMode;\n /** Stored fields at which it draws nothing (the rest at their defaults); `null` when it has none. */\n neutral: { [key: string]: EffectJson } | null;\n /** In stored-key order; sort by `order` for the inspector's. */\n params: EffectParamDescriptor[];\n}\n\nconst json = (value: unknown): EffectJson | undefined =>\n value === undefined ? undefined : (JSON.parse(JSON.stringify(value)) as EffectJson);\n\n/** The serialisable {@link EffectDescriptor} of a spec. */\nexport function describeSpec(spec: EffectSpec): EffectDescriptor {\n const params = Object.entries(spec.params).map(([name, def], index): EffectParamDescriptor => {\n const stored = def.default !== undefined && def.normalize ? def.normalize(def.default) : def.default;\n const out: EffectParamDescriptor = {\n name,\n kind: def.kind,\n animatable: def.lerp !== \"step\",\n label: def.label ?? name,\n order: def.order ?? index,\n };\n const optional = {\n default: json(stored),\n required: def.required,\n optional: def.optional,\n min: def.min,\n max: def.max,\n step: def.step,\n unit: def.unit,\n options: def.options ? [...def.options] : undefined,\n control: def.control,\n inline: def.inline,\n zero: def.zero,\n optionsLabel: def.optionsLabel,\n hidden: def.hidden,\n initial: json(def.initial),\n };\n for (const [key, value] of Object.entries(optional)) {\n if (value !== undefined) (out as unknown as Record<string, unknown>)[key] = value;\n }\n return out;\n });\n const out: EffectDescriptor = {\n type: spec.type,\n group: spec.group,\n surface: typeof spec.surface === \"function\" ? \"dynamic\" : (spec.surface ?? \"filter\"),\n neutral: spec.neutral === null ? null : (json(Object.fromEntries(Object.entries(spec.neutral).map(([name, value]) => {\n const normalize = spec.params[name]?.normalize;\n return [name, normalize ? normalize(value) : value];\n }))) as { [key: string]: EffectJson }),\n params,\n };\n if (spec.scalar) out.scalar = spec.scalar;\n if (spec.defaultMode) out.defaultMode = spec.defaultMode;\n if (spec.onlyOn) out.onlyOn = spec.onlyOn;\n return out;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../../src/attributes/shape/effects/union.ts"],"names":[],"mappings":"","sourcesContent":["import type { BlurEffect } from \"./implementations/blur\";\
|
|
1
|
+
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../../src/attributes/shape/effects/union.ts"],"names":[],"mappings":"","sourcesContent":["import type { BlurEffect } from \"./implementations/blur\";\nimport type { DirectionalBlurEffect } from \"./implementations/directional-blur\";\nimport type { GrayscaleEffect } from \"./implementations/grayscale\";\nimport type { PixelateEffect } from \"./implementations/pixelate\";\nimport type { BulgeEffect } from \"./implementations/bulge\";\nimport type { MagnifyEffect } from \"./implementations/magnify\";\nimport type { BloomEffect } from \"./implementations/bloom\";\nimport type { VintageEffect } from \"./implementations/vintage\";\nimport type { ChromaticAberrationEffect } from \"./implementations/chromatic-aberration\";\nimport type { InvertEffect } from \"./implementations/invert\";\nimport type { ScatterEffect } from \"./implementations/scatter\";\nimport type { PosterizeEffect } from \"./implementations/posterize\";\nimport type { MotionBlurEffect } from \"./implementations/motion-blur\";\nimport type { ShaderEffect } from \"./implementations/shader\";\nimport type { OutlineEffect } from \"./implementations/outline\";\nimport type { DropShadowEffect } from \"./implementations/drop-shadow\";\nimport type { VignetteEffect } from \"./implementations/vignette\";\nimport type { GrainEffect } from \"./implementations/grain\";\nimport type { SharpenEffect } from \"./implementations/sharpen\";\nimport type { EdgesEffect } from \"./implementations/edges\";\nimport type { ThresholdEffect } from \"./implementations/threshold\";\nimport type { RadialBlurEffect } from \"./implementations/radial-blur\";\nimport type { HalftoneEffect } from \"./implementations/halftone\";\nimport type { DitherEffect } from \"./implementations/dither\";\nimport type { DuotoneEffect } from \"./implementations/duotone\";\nimport type { CurvesEffect } from \"./implementations/curves\";\nimport type { ColorAdjustmentEffect } from \"./implementations/color-adjustment\";\nimport type { RgbShiftEffect } from \"./implementations/rgb-shift\";\nimport type { ScanlinesEffect } from \"./implementations/scanlines\";\nimport type { BlockDisplaceEffect } from \"./implementations/block-displace\";\nimport type { BitCrushEffect } from \"./implementations/bit-crush\";\nimport type { AsciiEffect } from \"./implementations/ascii\";\nimport type { StreakEffect } from \"./implementations/streak\";\nimport type { GlowEffect } from \"./implementations/glow\";\nimport type { OilPaintEffect } from \"./implementations/oil-paint\";\nimport type { WaveEffect } from \"./implementations/wave\";\nimport type { TwirlEffect } from \"./implementations/twirl\";\nimport type { ProgressiveBlurEffect } from \"./implementations/progressive-blur\";\nimport type { KaleidoscopeEffect } from \"./implementations/kaleidoscope\";\nimport type { GlassEffect } from \"./implementations/glass\";\nimport type { LutEffect } from \"./implementations/lut\";\n\n/** Discriminated union of every effect type a node can carry. */\nexport type NodeEffect =\n | BlurEffect\n | DirectionalBlurEffect\n | GrayscaleEffect\n | PixelateEffect\n | BulgeEffect\n | MagnifyEffect\n | BloomEffect\n | VintageEffect\n | ChromaticAberrationEffect\n | InvertEffect\n | ScatterEffect\n | PosterizeEffect\n | MotionBlurEffect\n | ShaderEffect\n | OutlineEffect\n | DropShadowEffect\n | VignetteEffect\n | GrainEffect\n | SharpenEffect\n | EdgesEffect\n | ThresholdEffect\n | RadialBlurEffect\n | HalftoneEffect\n | DitherEffect\n | DuotoneEffect\n | CurvesEffect\n | ColorAdjustmentEffect\n | RgbShiftEffect\n | ScanlinesEffect\n | BlockDisplaceEffect\n | BitCrushEffect\n | AsciiEffect\n | StreakEffect\n | GlowEffect\n | OilPaintEffect\n | WaveEffect\n | TwirlEffect\n | ProgressiveBlurEffect\n | KaleidoscopeEffect\n | GlassEffect\n | LutEffect;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blend.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/blend.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,KAAK;IACL,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,QAAQ;CACF,CAAC;AAKX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,UAAU,EAAE,cAAc,CAAU,CAAC;AAKvE,wDAAwD;AACxD,MAAM,eAAe,GACjB,MAAM,CAAC,WAAW,CACd,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CACZ,CAAC;AAEnC,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,KAAgB;IAC7C,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/**\
|
|
1
|
+
{"version":3,"file":"blend.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/blend.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,SAAS;IACT,aAAa;IACb,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,KAAK;IACL,YAAY;IACZ,OAAO;IACP,YAAY;IACZ,QAAQ;CACF,CAAC;AAKX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAG,UAAU,EAAE,cAAc,CAAU,CAAC;AAKvE,wDAAwD;AACxD,MAAM,eAAe,GACjB,MAAM,CAAC,WAAW,CACd,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CACZ,CAAC;AAEnC,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,KAAgB;IAC7C,OAAO,eAAe,CAAC,KAAK,CAAC,CAAC;AAClC,CAAC","sourcesContent":["/**\n * Blend mode definitions.\n *\n * Mirrors the CSS `mix-blend-mode` keyword set. The renderer maps each string\n * to an integer hash for fast uniform uploads.\n */\n\n/** Every supported blend mode, in hash-index order. */\nexport const BlendModes = [\n \"multiply\",\n \"screen\",\n \"overlay\",\n \"darken\",\n \"lighten\",\n \"color-dodge\",\n \"color-burn\",\n \"hard-light\",\n \"soft-light\",\n \"difference\",\n \"exclusion\",\n \"hue\",\n \"saturation\",\n \"color\",\n \"luminosity\",\n \"normal\"\n] as const;\n\n/** CSS `mix-blend-mode` keyword — derived from {@link BlendModes}. */\nexport type BlendMode = typeof BlendModes[number];\n\n/**\n * Blend modes a node/layer can carry. Adds Figma's `pass-through` to the fill\n * {@link BlendMode} set. `pass-through` (the node default) means the layer is\n * *not* isolated: its opacity scales each child/fill's contribution while those\n * children still blend directly against the backdrop. Any other value isolates\n * the node — its children flatten into a group that then blends against the\n * backdrop with the chosen mode. Fills never accept `pass-through`.\n */\nexport const NodeBlendModes = [...BlendModes, \"pass-through\"] as const;\n\n/** Layer blend mode — {@link BlendMode} plus `pass-through`. Node2D-only. */\nexport type NodeBlendMode = typeof NodeBlendModes[number];\n\n// Pre-built reverse lookup so getBlendModeHash is O(1).\nconst BLEND_MODE_HASH: Record<BlendMode, number> =\n Object.fromEntries(\n BlendModes.map((mode, i) => [mode, i])\n ) as Record<BlendMode, number>;\n\n/** Returns the integer hash for a blend mode, used as a shader uniform. */\nexport function getBlendModeHash(blend: BlendMode): number {\n return BLEND_MODE_HASH[blend];\n}\n"]}
|
|
@@ -128,25 +128,23 @@ export declare class FillChain {
|
|
|
128
128
|
*/
|
|
129
129
|
fractalNoise(options?: FillOptions & Omit<FractalNoiseFillProp, 'type' | 'opacity' | 'blend'>): FillChain;
|
|
130
130
|
/**
|
|
131
|
-
* Append a custom
|
|
131
|
+
* Append a custom shader fill — the escape hatch past {@link noise} and
|
|
132
132
|
* {@link fractalNoise}, where the author writes the fragment function.
|
|
133
133
|
*
|
|
134
|
-
* `source`
|
|
134
|
+
* The WGSL `source` defines `fn fill(in: FillIn) -> vec4f` and declares its
|
|
135
|
+
* uniforms as `struct Params`, read as `u.<name>`. It returns
|
|
135
136
|
* **premultiplied** rgba, without folding `opacity` in (the layer's opacity is
|
|
136
|
-
* already
|
|
137
|
-
*
|
|
138
|
-
* order is irrelevant; the renderer supplies `u_size`, `u_origin`,
|
|
139
|
-
* `u_resolution`, `u_aspect`, `u_time` and `u_scale` to whichever of them the
|
|
140
|
-
* source declares.
|
|
137
|
+
* already applied, so applying it twice squares it). Uniforms are keyed by
|
|
138
|
+
* their declared name, so order is irrelevant.
|
|
141
139
|
*
|
|
142
140
|
* Keep `source` constant — it is the compile-cache key, so it snaps at a
|
|
143
141
|
* tween's midpoint and rebuilding it per frame compiles a program per frame.
|
|
144
142
|
* Everything that changes belongs in a uniform, which is an in-place write.
|
|
145
143
|
*
|
|
146
144
|
* @example
|
|
147
|
-
* Fills.shader(GLOW, { uniforms: {
|
|
145
|
+
* Fills.shader(GLOW, { uniforms: { amount: 0.6 } })
|
|
148
146
|
*/
|
|
149
|
-
shader(source: string | FillShader, options?: FillOptions & Omit<ShaderFillProp, 'type' | 'source' | 'opacity' | 'blend' | 'shaderId'> & {
|
|
147
|
+
shader(source: string | FillShader, options?: FillOptions & Omit<ShaderFillProp, 'type' | 'source' | 'language' | 'opacity' | 'blend' | 'shaderId'> & {
|
|
150
148
|
values?: ShaderPropertyValues;
|
|
151
149
|
}): FillChain;
|
|
152
150
|
/** Append a stripe (hatch) fill. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/chain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEjE,OAAO,EAA2B,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AACxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CA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
|
|
1
|
+
import { normalizeUniforms } from "../shaders/uniforms.js";
|
|
2
2
|
import { resolveShaderProperties } from "../shaders/resolve.js";
|
|
3
3
|
/** Strip `undefined` option keys so the produced props stay minimal/comparable. */
|
|
4
4
|
function withOptions(base, options = {}) {
|
|
@@ -104,23 +104,21 @@ export class FillChain {
|
|
|
104
104
|
}, common)]);
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Append a custom
|
|
107
|
+
* Append a custom shader fill — the escape hatch past {@link noise} and
|
|
108
108
|
* {@link fractalNoise}, where the author writes the fragment function.
|
|
109
109
|
*
|
|
110
|
-
* `source`
|
|
110
|
+
* The WGSL `source` defines `fn fill(in: FillIn) -> vec4f` and declares its
|
|
111
|
+
* uniforms as `struct Params`, read as `u.<name>`. It returns
|
|
111
112
|
* **premultiplied** rgba, without folding `opacity` in (the layer's opacity is
|
|
112
|
-
* already
|
|
113
|
-
*
|
|
114
|
-
* order is irrelevant; the renderer supplies `u_size`, `u_origin`,
|
|
115
|
-
* `u_resolution`, `u_aspect`, `u_time` and `u_scale` to whichever of them the
|
|
116
|
-
* source declares.
|
|
113
|
+
* already applied, so applying it twice squares it). Uniforms are keyed by
|
|
114
|
+
* their declared name, so order is irrelevant.
|
|
117
115
|
*
|
|
118
116
|
* Keep `source` constant — it is the compile-cache key, so it snaps at a
|
|
119
117
|
* tween's midpoint and rebuilding it per frame compiles a program per frame.
|
|
120
118
|
* Everything that changes belongs in a uniform, which is an in-place write.
|
|
121
119
|
*
|
|
122
120
|
* @example
|
|
123
|
-
* Fills.shader(GLOW, { uniforms: {
|
|
121
|
+
* Fills.shader(GLOW, { uniforms: { amount: 0.6 } })
|
|
124
122
|
*/
|
|
125
123
|
shader(source, options) {
|
|
126
124
|
const pack = typeof source === 'string' ? undefined : source;
|
|
@@ -129,7 +127,7 @@ export class FillChain {
|
|
|
129
127
|
`("${pack.name}"). An effect shader samples a backdrop a fill does not have; ` +
|
|
130
128
|
`use Effects.shader.`);
|
|
131
129
|
}
|
|
132
|
-
const { uniforms,
|
|
130
|
+
const { uniforms, textures, values, ...common } = options ?? {};
|
|
133
131
|
// A pack resolves to plain uniforms here; anything passed as `uniforms`
|
|
134
132
|
// still wins, matching how an author value overrides a built-in.
|
|
135
133
|
const resolved = pack
|
|
@@ -138,8 +136,8 @@ export class FillChain {
|
|
|
138
136
|
return new FillChain([...this.list, withOptions({
|
|
139
137
|
type: 'shader',
|
|
140
138
|
source: typeof source === 'string' ? source : source.source,
|
|
139
|
+
language: 'wgsl',
|
|
141
140
|
uniforms: resolved,
|
|
142
|
-
coords: coords ?? pack?.coords,
|
|
143
141
|
textures,
|
|
144
142
|
...(pack?.id !== undefined ? { shaderId: pack.id } : {}),
|
|
145
143
|
}, common)]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/chain.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAA6B,MAAM,oBAAoB,CAAC;AA0DxF,mFAAmF;AACnF,SAAS,WAAW,CAAmB,IAAO,EAAE,UAAuB,EAAE;IACrE,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,EAAqB,CAAC;IAC3C,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjE,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC3D,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC3D,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,SAAS;IACC;IAAnB,YAAmB,OAAmB,EAAE;QAArB,SAAI,GAAJ,IAA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QAAQ,CAAC;QACd,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,2FAA2F;IAC3F,MAAM;QACF,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AAqBD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAsB;IACnD,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,EAAE,CAAC;IAC5B,IAAI,IAAI,YAAY,SAAS;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,oEAAoE;QACpE,wEAAwE;QACxE,yEAAyE;QACzE,qBAAqB;QACrB,MAAM,GAAG,GAAe,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,IAAI,YAAY,SAAS;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;iBACjD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,IAAY,CAAC,CAAC,CAAC;;gBACrE,GAAG,CAAC,IAAI,CAAC,IAAgB,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,CAAC,IAAgB,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { Color } from \"./color/parser\";\r\nimport type { BlendMode } from \"./blend\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { ImageAdjustment, VideoAdjustment } from \"../filters/chain\";\r\nimport type { MediaPresetProp, VideoPresetProp } from \"./media-preset\";\r\nimport type { FillProp, FillResolved, FillSpace } from \"./union\";\r\nimport { normalizeUniforms } from \"../sksl-uniforms\";\r\nimport { resolveShaderProperties, type ShaderPropertyValues } from \"../shaders/resolve\";\r\nimport type { FillShader } from \"../shaders/pack\";\r\nimport type { ImageCrop, ImageFit, ImageMatrix } from \"./implementations/image\";\r\nimport type { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { FractalNoiseFillProp } from \"./implementations/fractal-noise\";\r\nimport type { DotGridFillProp } from \"./implementations/dot-grid\";\r\nimport type { GridFillProp } from \"./implementations/grid\";\r\nimport type { ShaderFillProp } from \"./implementations/shader\";\r\nimport type { Scene3D } from \"@/render3d/scene3d\";\r\n\r\n/** Placement options shared by the image and video fill builders. */\r\nexport interface MediaPlacementOptions {\r\n /** How the (cropped) source is scaled into the node's bounds. Default `'fill'`. */\r\n fit?: ImageFit;\r\n /** Window onto the source, in fractions of its own size, applied before `fit`. */\r\n crop?: ImageCrop;\r\n /** Magnification on top of the fitted scale. `1` is the fitted size. */\r\n zoom?: number;\r\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\r\n anchor?: Alignment;\r\n /** Raw source→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\r\n matrix?: ImageMatrix;\r\n}\r\n\r\n/** Author-facing options for a {@link FillChain.video} layer. */\r\nexport interface VideoFillOptions extends FillOptions, MediaPlacementOptions {\r\n /** The grade laid over the footage — an adjustment chain plus a 0–1 mix. */\r\n preset?: VideoPresetProp;\r\n /** @deprecated Moved to `preset.adjustments`. Removed in the next major. */\r\n filters?: VideoAdjustment;\r\n /**\r\n * Explicit source time to paint, in seconds. Omit it and the clip plays by\r\n * itself, timed from the moment the node painting it appeared — set it only\r\n * to drive the playhead yourself (`null` hands the playhead back).\r\n */\r\n timestamp?: number | null;\r\n /** Whether playback advances with the node's clock. Defaults to `true`. */\r\n playing?: boolean;\r\n trimStart?: number;\r\n trimEnd?: number;\r\n /** Seconds after the painting node appears before playback begins. Default `0`. */\r\n playStart?: number;\r\n speed?: number;\r\n loop?: 'forward' | 'reverse' | 'none';\r\n duration?: number;\r\n}\r\n\r\n/**\r\n * Cross-cutting options shared by every fill layer. These map onto the\r\n * `opacity` / `blend` fields each fill prop already accepts, plus the\r\n * `space` directive carried generically by the registry.\r\n */\r\nexport interface FillOptions {\r\n opacity?: number;\r\n blend?: BlendMode;\r\n space?: FillSpace;\r\n}\r\n\r\n/** Strip `undefined` option keys so the produced props stay minimal/comparable. */\r\nfunction withOptions<T extends object>(base: T, options: FillOptions = {}): T & FillOptions {\r\n const out = { ...base } as T & FillOptions;\r\n if (options.opacity !== undefined) out.opacity = options.opacity;\r\n if (options.blend !== undefined) out.blend = options.blend;\r\n if (options.space !== undefined) out.space = options.space;\r\n return out;\r\n}\r\n\r\n/**\r\n * Immutable, chainable list of fill layers.\r\n *\r\n * Each builder method returns a new `FillChain` with the layer appended, so\r\n * chains are safe to share and branch — mirroring {@link EffectChain}.\r\n *\r\n * @example\r\n * const bg = Fills.image('./background.jpg', { blend: 'overlay', opacity: 0.2 })\r\n * .color('red', { opacity: 0.3 });\r\n * node.fill = bg; // assign directly\r\n * node.fill = [...bg, 'white']; // spread into an array\r\n */\r\nexport class FillChain {\r\n constructor(public list: FillProp[] = []) { }\r\n\r\n /** Append a solid color fill. A CSS string or normalized `[r,g,b,a]`. */\r\n color(color: Color, options?: FillOptions) {\r\n return new FillChain([...this.list, withOptions({ type: 'solid' as const, color }, options)]);\r\n }\r\n\r\n /**\r\n * Append an image fill from `src`.\r\n *\r\n * @example\r\n * Fills.image('./city.jpg', { zoom: 1.4, anchor: 'topCenter', crop: { bottom: 0.2 } })\r\n */\r\n image(\r\n src: string,\r\n options?: FillOptions & MediaPlacementOptions & {\r\n /** The grade laid over the picture — an adjustment chain plus a 0–1 mix. */\r\n preset?: MediaPresetProp;\r\n /** @deprecated Moved to `preset.adjustments`. Removed in the next major. */\r\n filters?: ImageAdjustment;\r\n },\r\n ) {\r\n const { fit, crop, zoom, anchor, matrix, preset, filters, ...common } = options ?? {};\r\n // Both are forwarded unresolved: `imageFill.resolve` is the one place\r\n // that flattens a chain and folds the deprecated prop into the preset,\r\n // so a fill built here and a fill written as a literal cannot disagree\r\n // about what a grade means.\r\n return new FillChain([...this.list, withOptions({\r\n type: 'image' as const,\r\n src,\r\n fit, crop, zoom, anchor, matrix,\r\n preset, filters,\r\n }, common)]);\r\n }\r\n\r\n /**\r\n * Append a video fill from `src`. Plays by default: its source timestamp is\r\n * derived as it paints, from how long the node carrying the fill has\r\n * existed — so the clip runs wherever the fill is used (fill, overlay,\r\n * stroke, shadow, a custom node's `Graphics2D`) with nothing to advance.\r\n */\r\n video(src: string, options?: VideoFillOptions) {\r\n const { fit, crop, zoom, anchor, matrix, preset, filters, timestamp, playing, trimStart, trimEnd, playStart, speed, loop, duration, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions({\r\n type: 'video' as const,\r\n src,\r\n fit, crop, zoom, anchor, matrix, preset, filters,\r\n timestamp,\r\n playing: playing ?? true,\r\n trimStart, trimEnd, playStart, speed, loop, duration,\r\n }, common)]);\r\n }\r\n\r\n\r\n /** Append a linear gradient between `colors`. */\r\n linearGradient(colors: Color[], options?: FillOptions & { stops?: number[]; start?: Vector2; end?: Vector2 }) {\r\n const { stops, start, end, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions({ type: 'linear-gradient' as const, colors, stops, start, end }, common)]);\r\n }\r\n\r\n /** Append a radial gradient between `colors`. */\r\n radialGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; radius?: number }) {\r\n const { stops, center, radius, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions({ type: 'radial-gradient' as const, colors, stops, center, radius }, common)]);\r\n }\r\n\r\n /** Append a conic gradient between `colors`. */\r\n conicGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; startAngle?: number }) {\r\n const { stops, center, startAngle, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions({ type: 'conic-gradient' as const, colors, stops, center, startAngle }, common)]);\r\n }\r\n\r\n /** Append a noise (speckle) fill. Tween `seed` to make the static crawl. */\r\n noise(options?: FillOptions & { size?: Vector2; density?: number; color?: Color; seed?: number }) {\r\n const { size, density, color, seed, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions({ type: 'noise' as const, size, density, color, seed }, common)]);\r\n }\r\n\r\n /**\r\n * Append a fractal (fBm) noise fill — a continuous field rather than the\r\n * speckle {@link noise} paints. Cloud, marble, smoke, terrain, plasma.\r\n *\r\n * Tween `offset` to travel through the field (it flows); tween `seed` to\r\n * shift to a different field entirely (it churns).\r\n */\r\n fractalNoise(options?: FillOptions & Omit<FractalNoiseFillProp, 'type' | 'opacity' | 'blend'>) {\r\n const {\r\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\r\n colors, stops, contrast, ...common\r\n } = options ?? {};\r\n return new FillChain([...this.list, withOptions(\r\n {\r\n type: 'fractalNoise' as const,\r\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\r\n colors, stops, contrast,\r\n },\r\n common,\r\n )]);\r\n }\r\n\r\n /**\r\n * Append a custom SkSL shader fill — the escape hatch past {@link noise} and\r\n * {@link fractalNoise}, where the author writes the fragment function.\r\n *\r\n * `source` must declare `vec4 main(vec2 fragCoord)` and return\r\n * **premultiplied** rgba, without folding `opacity` in (the layer's opacity is\r\n * already on the paint, so applying it twice squares it). Uniforms are keyed\r\n * by their declared name and bound by reflecting the compiled program, so\r\n * order is irrelevant; the renderer supplies `u_size`, `u_origin`,\r\n * `u_resolution`, `u_aspect`, `u_time` and `u_scale` to whichever of them the\r\n * source declares.\r\n *\r\n * Keep `source` constant — it is the compile-cache key, so it snaps at a\r\n * tween's midpoint and rebuilding it per frame compiles a program per frame.\r\n * Everything that changes belongs in a uniform, which is an in-place write.\r\n *\r\n * @example\r\n * Fills.shader(GLOW, { uniforms: { u_amount: 0.6 }, coords: 'centered' })\r\n */\r\n shader(\r\n source: string | FillShader,\r\n options?: FillOptions\r\n & Omit<ShaderFillProp, 'type' | 'source' | 'opacity' | 'blend' | 'shaderId'>\r\n & { values?: ShaderPropertyValues },\r\n ) {\r\n const pack = typeof source === 'string' ? undefined : source;\r\n if (pack && pack.scope !== 'fill') {\r\n throw new Error(\r\n `Fills.shader was given a \"${(pack as { scope: string }).scope}\" shader ` +\r\n `(\"${pack.name}\"). An effect shader samples a backdrop a fill does not have; ` +\r\n `use Effects.shader.`,\r\n );\r\n }\r\n const { uniforms, coords, textures, values, ...common } = options ?? {};\r\n // A pack resolves to plain uniforms here; anything passed as `uniforms`\r\n // still wins, matching how an author value overrides a built-in.\r\n const resolved = pack\r\n ? { ...resolveShaderProperties(pack, values), ...normalizeUniforms(uniforms ?? {}) }\r\n : uniforms;\r\n return new FillChain([...this.list, withOptions(\r\n {\r\n type: 'shader' as const,\r\n source: typeof source === 'string' ? source : source.source,\r\n uniforms: resolved,\r\n coords: coords ?? pack?.coords,\r\n textures,\r\n ...(pack?.id !== undefined ? { shaderId: pack.id } : {}),\r\n },\r\n common,\r\n )]);\r\n }\r\n\r\n /** Append a stripe (hatch) fill. */\r\n stripe(options?: FillOptions & { gap?: number; strokeWidth?: number; angle?: number; color?: Color }) {\r\n const { gap, strokeWidth, angle, color, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions({ type: 'stripe' as const, gap, strokeWidth, angle, color }, common)]);\r\n }\r\n\r\n /**\r\n * Append a dot-grid fill — a lattice of dots at a pixel pitch.\r\n *\r\n * Tween `offset` to drift the field under a shape that isn't moving; tween\r\n * `spacing` or `radius` to breathe it.\r\n *\r\n * @example\r\n * Fills.dotGrid({ radius: 1.5, spacing: 24, color: 'muted' })\r\n */\r\n dotGrid(options?: FillOptions & Omit<DotGridFillProp, 'type' | 'opacity' | 'blend'>) {\r\n const { radius, spacing, offset, color, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions(\r\n { type: 'dotGrid' as const, radius, spacing, offset, color },\r\n common,\r\n )]);\r\n }\r\n\r\n /**\r\n * Append a grid fill — ruled lines dividing the shape into cells, with an\r\n * optional finer ruling nested inside each one.\r\n *\r\n * Sized in divisions of the shape rather than in px (unlike {@link dotGrid}),\r\n * so it holds its structure as the shape resizes.\r\n *\r\n * @example\r\n * Fills.grid({ divisions: 8, subdivisions: 4, color: 'border' })\r\n */\r\n grid(options?: FillOptions & Omit<GridFillProp, 'type' | 'opacity' | 'blend'>) {\r\n const {\r\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color, ...common\r\n } = options ?? {};\r\n return new FillChain([...this.list, withOptions(\r\n {\r\n type: 'grid' as const,\r\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color,\r\n },\r\n common,\r\n )]);\r\n }\r\n\r\n /**\r\n * Append a 3D scene, painted through the shape's own path.\r\n *\r\n * Takes a **built** {@link Scene3D}, never a builder — per-frame freshness\r\n * comes from where the value is produced (a `renderSelf`, or a `() => …`\r\n * reactive binding), like every other fill.\r\n *\r\n * Note two same-type 3D layers hard-cut rather than cross-fading, because a\r\n * command list has no meaningful in-between. To dissolve between two scenes,\r\n * stack them and tween their opacities in opposite directions.\r\n */\r\n canvas3D(scene: Scene3D, options?: FillOptions & { maxPixelRatio?: number; antialias?: boolean }) {\r\n const { maxPixelRatio, antialias, ...common } = options ?? {};\r\n return new FillChain([...this.list, withOptions({ type: 'canvas3D' as const, scene, maxPixelRatio, antialias }, common)]);\r\n }\r\n\r\n /** Allows spreading the chain into an array: `[...Fills.color('red')]`. */\r\n *[Symbol.iterator]() {\r\n yield* this.list;\r\n }\r\n\r\n /** Serializes to the raw fill 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 * Accepted shapes for a node's `fill` prop.\r\n *\r\n * Can be a single fill, a `FillChain` builder result, an already-resolved\r\n * {@link FillResolved}, or an array mixing any of these (each chain contributes\r\n * all its layers in place):\r\n *\r\n * 'red' // plain CSS color\r\n * Fills.image('bg.jpg') // chain\r\n * ['#e8c584', Fills.image('bg.jpg')]\r\n * ['#e8c584', ...Fills.image('bg.jpg')]\r\n * resolvedFills // FillResolved[] passes through\r\n */\r\nexport type Fill =\r\n | FillProp\r\n | FillResolved\r\n | FillChain\r\n | (FillProp | FillResolved | FillChain)[];\r\n\r\n/**\r\n * Entry point for building fill chains fluently.\r\n *\r\n * An empty {@link FillChain}, so `Fills.image(src)` *is* `new FillChain().image(src)`\r\n * — every builder's signature and documentation has one definition, on the\r\n * class, which is what an editor shows when you hover `Fills.image`. The chain\r\n * is immutable (each builder returns a new one), so sharing one empty instance\r\n * as the entry point is safe.\r\n *\r\n * @example\r\n * node.fill = Fills.image('./bg.jpg', { opacity: 0.2 }).color('red', { opacity: 0.3 });\r\n */\r\nexport const Fills = new FillChain();\r\n\r\n/**\r\n * Normalises any {@link Fill} value to a plain `FillProp[]`.\r\n * Used by `resolveFillArray` before resolving to the renderer shape.\r\n *\r\n * Already-resolved fills (`FillResolved`) structurally satisfy `FillProp`, so\r\n * they pass straight through and `resolveFill` re-normalises them idempotently.\r\n */\r\nexport function resolveChainFill(fill: Fill | undefined): FillProp[] {\r\n if (fill == null) return [];\r\n if (fill instanceof FillChain) return fill.list;\r\n if (Array.isArray(fill)) {\r\n // Flatten any chains used as array elements so each contributes its\r\n // layers in place: `['#e8c584', Fills.image('bg.jpg')]` — and the plain\r\n // array a chain serializes to, which is how that value reads back out of\r\n // a stored document.\r\n const out: FillProp[] = [];\r\n for (const item of fill) {\r\n if (item instanceof FillChain) out.push(...item.list);\r\n else if (Array.isArray(item)) out.push(...resolveChainFill(item as Fill));\r\n else out.push(item as FillProp);\r\n }\r\n return out;\r\n }\r\n return [fill as FillProp];\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/chain.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAA6B,MAAM,oBAAoB,CAAC;AA0DxF,mFAAmF;AACnF,SAAS,WAAW,CAA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CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,IAAY,CAAC,CAAC,CAAC;;gBACrE,GAAG,CAAC,IAAI,CAAC,IAAgB,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,CAAC,IAAgB,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { Color } from \"./color/parser\";\nimport type { BlendMode } from \"./blend\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { ImageAdjustment, VideoAdjustment } from \"../filters/chain\";\nimport type { MediaPresetProp, VideoPresetProp } from \"./media-preset\";\nimport type { FillProp, FillResolved, FillSpace } from \"./union\";\nimport { normalizeUniforms } from \"../shaders/uniforms\";\nimport { resolveShaderProperties, type ShaderPropertyValues } from \"../shaders/resolve\";\nimport type { FillShader } from \"../shaders/pack\";\nimport type { ImageCrop, ImageFit, ImageMatrix } from \"./implementations/image\";\nimport type { Alignment } from \"@/attributes/layout/alignment\";\nimport type { FractalNoiseFillProp } from \"./implementations/fractal-noise\";\nimport type { DotGridFillProp } from \"./implementations/dot-grid\";\nimport type { GridFillProp } from \"./implementations/grid\";\nimport type { ShaderFillProp } from \"./implementations/shader\";\nimport type { Scene3D } from \"@/render3d/scene3d\";\n\n/** Placement options shared by the image and video fill builders. */\nexport interface MediaPlacementOptions {\n /** How the (cropped) source is scaled into the node's bounds. Default `'fill'`. */\n fit?: ImageFit;\n /** Window onto the source, in fractions of its own size, applied before `fit`. */\n crop?: ImageCrop;\n /** Magnification on top of the fitted scale. `1` is the fitted size. */\n zoom?: number;\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\n anchor?: Alignment;\n /** Raw source→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\n matrix?: ImageMatrix;\n}\n\n/** Author-facing options for a {@link FillChain.video} layer. */\nexport interface VideoFillOptions extends FillOptions, MediaPlacementOptions {\n /** The grade laid over the footage — an adjustment chain plus a 0–1 mix. */\n preset?: VideoPresetProp;\n /** @deprecated Moved to `preset.adjustments`. Removed in the next major. */\n filters?: VideoAdjustment;\n /**\n * Explicit source time to paint, in seconds. Omit it and the clip plays by\n * itself, timed from the moment the node painting it appeared — set it only\n * to drive the playhead yourself (`null` hands the playhead back).\n */\n timestamp?: number | null;\n /** Whether playback advances with the node's clock. Defaults to `true`. */\n playing?: boolean;\n trimStart?: number;\n trimEnd?: number;\n /** Seconds after the painting node appears before playback begins. Default `0`. */\n playStart?: number;\n speed?: number;\n loop?: 'forward' | 'reverse' | 'none';\n duration?: number;\n}\n\n/**\n * Cross-cutting options shared by every fill layer. These map onto the\n * `opacity` / `blend` fields each fill prop already accepts, plus the\n * `space` directive carried generically by the registry.\n */\nexport interface FillOptions {\n opacity?: number;\n blend?: BlendMode;\n space?: FillSpace;\n}\n\n/** Strip `undefined` option keys so the produced props stay minimal/comparable. */\nfunction withOptions<T extends object>(base: T, options: FillOptions = {}): T & FillOptions {\n const out = { ...base } as T & FillOptions;\n if (options.opacity !== undefined) out.opacity = options.opacity;\n if (options.blend !== undefined) out.blend = options.blend;\n if (options.space !== undefined) out.space = options.space;\n return out;\n}\n\n/**\n * Immutable, chainable list of fill layers.\n *\n * Each builder method returns a new `FillChain` with the layer appended, so\n * chains are safe to share and branch — mirroring {@link EffectChain}.\n *\n * @example\n * const bg = Fills.image('./background.jpg', { blend: 'overlay', opacity: 0.2 })\n * .color('red', { opacity: 0.3 });\n * node.fill = bg; // assign directly\n * node.fill = [...bg, 'white']; // spread into an array\n */\nexport class FillChain {\n constructor(public list: FillProp[] = []) { }\n\n /** Append a solid color fill. A CSS string or normalized `[r,g,b,a]`. */\n color(color: Color, options?: FillOptions) {\n return new FillChain([...this.list, withOptions({ type: 'solid' as const, color }, options)]);\n }\n\n /**\n * Append an image fill from `src`.\n *\n * @example\n * Fills.image('./city.jpg', { zoom: 1.4, anchor: 'topCenter', crop: { bottom: 0.2 } })\n */\n image(\n src: string,\n options?: FillOptions & MediaPlacementOptions & {\n /** The grade laid over the picture — an adjustment chain plus a 0–1 mix. */\n preset?: MediaPresetProp;\n /** @deprecated Moved to `preset.adjustments`. Removed in the next major. */\n filters?: ImageAdjustment;\n },\n ) {\n const { fit, crop, zoom, anchor, matrix, preset, filters, ...common } = options ?? {};\n // Both are forwarded unresolved: `imageFill.resolve` is the one place\n // that flattens a chain and folds the deprecated prop into the preset,\n // so a fill built here and a fill written as a literal cannot disagree\n // about what a grade means.\n return new FillChain([...this.list, withOptions({\n type: 'image' as const,\n src,\n fit, crop, zoom, anchor, matrix,\n preset, filters,\n }, common)]);\n }\n\n /**\n * Append a video fill from `src`. Plays by default: its source timestamp is\n * derived as it paints, from how long the node carrying the fill has\n * existed — so the clip runs wherever the fill is used (fill, overlay,\n * stroke, shadow, a custom node's `Graphics2D`) with nothing to advance.\n */\n video(src: string, options?: VideoFillOptions) {\n const { fit, crop, zoom, anchor, matrix, preset, filters, timestamp, playing, trimStart, trimEnd, playStart, speed, loop, duration, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({\n type: 'video' as const,\n src,\n fit, crop, zoom, anchor, matrix, preset, filters,\n timestamp,\n playing: playing ?? true,\n trimStart, trimEnd, playStart, speed, loop, duration,\n }, common)]);\n }\n\n\n /** Append a linear gradient between `colors`. */\n linearGradient(colors: Color[], options?: FillOptions & { stops?: number[]; start?: Vector2; end?: Vector2 }) {\n const { stops, start, end, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'linear-gradient' as const, colors, stops, start, end }, common)]);\n }\n\n /** Append a radial gradient between `colors`. */\n radialGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; radius?: number }) {\n const { stops, center, radius, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'radial-gradient' as const, colors, stops, center, radius }, common)]);\n }\n\n /** Append a conic gradient between `colors`. */\n conicGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; startAngle?: number }) {\n const { stops, center, startAngle, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'conic-gradient' as const, colors, stops, center, startAngle }, common)]);\n }\n\n /** Append a noise (speckle) fill. Tween `seed` to make the static crawl. */\n noise(options?: FillOptions & { size?: Vector2; density?: number; color?: Color; seed?: number }) {\n const { size, density, color, seed, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'noise' as const, size, density, color, seed }, common)]);\n }\n\n /**\n * Append a fractal (fBm) noise fill — a continuous field rather than the\n * speckle {@link noise} paints. Cloud, marble, smoke, terrain, plasma.\n *\n * Tween `offset` to travel through the field (it flows); tween `seed` to\n * shift to a different field entirely (it churns).\n */\n fractalNoise(options?: FillOptions & Omit<FractalNoiseFillProp, 'type' | 'opacity' | 'blend'>) {\n const {\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\n colors, stops, contrast, ...common\n } = options ?? {};\n return new FillChain([...this.list, withOptions(\n {\n type: 'fractalNoise' as const,\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\n colors, stops, contrast,\n },\n common,\n )]);\n }\n\n /**\n * Append a custom shader fill — the escape hatch past {@link noise} and\n * {@link fractalNoise}, where the author writes the fragment function.\n *\n * The WGSL `source` defines `fn fill(in: FillIn) -> vec4f` and declares its\n * uniforms as `struct Params`, read as `u.<name>`. It returns\n * **premultiplied** rgba, without folding `opacity` in (the layer's opacity is\n * already applied, so applying it twice squares it). Uniforms are keyed by\n * their declared name, so order is irrelevant.\n *\n * Keep `source` constant — it is the compile-cache key, so it snaps at a\n * tween's midpoint and rebuilding it per frame compiles a program per frame.\n * Everything that changes belongs in a uniform, which is an in-place write.\n *\n * @example\n * Fills.shader(GLOW, { uniforms: { amount: 0.6 } })\n */\n shader(\n source: string | FillShader,\n options?: FillOptions\n & Omit<ShaderFillProp, 'type' | 'source' | 'language' | 'opacity' | 'blend' | 'shaderId'>\n & { values?: ShaderPropertyValues },\n ) {\n const pack = typeof source === 'string' ? undefined : source;\n if (pack && pack.scope !== 'fill') {\n throw new Error(\n `Fills.shader was given a \"${(pack as { scope: string }).scope}\" shader ` +\n `(\"${pack.name}\"). An effect shader samples a backdrop a fill does not have; ` +\n `use Effects.shader.`,\n );\n }\n const { uniforms, textures, values, ...common } = options ?? {};\n // A pack resolves to plain uniforms here; anything passed as `uniforms`\n // still wins, matching how an author value overrides a built-in.\n const resolved = pack\n ? { ...resolveShaderProperties(pack, values), ...normalizeUniforms(uniforms ?? {}) }\n : uniforms;\n return new FillChain([...this.list, withOptions(\n {\n type: 'shader' as const,\n source: typeof source === 'string' ? source : source.source,\n language: 'wgsl' as const,\n uniforms: resolved,\n textures,\n ...(pack?.id !== undefined ? { shaderId: pack.id } : {}),\n },\n common,\n )]);\n }\n\n /** Append a stripe (hatch) fill. */\n stripe(options?: FillOptions & { gap?: number; strokeWidth?: number; angle?: number; color?: Color }) {\n const { gap, strokeWidth, angle, color, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'stripe' as const, gap, strokeWidth, angle, color }, common)]);\n }\n\n /**\n * Append a dot-grid fill — a lattice of dots at a pixel pitch.\n *\n * Tween `offset` to drift the field under a shape that isn't moving; tween\n * `spacing` or `radius` to breathe it.\n *\n * @example\n * Fills.dotGrid({ radius: 1.5, spacing: 24, color: 'muted' })\n */\n dotGrid(options?: FillOptions & Omit<DotGridFillProp, 'type' | 'opacity' | 'blend'>) {\n const { radius, spacing, offset, color, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions(\n { type: 'dotGrid' as const, radius, spacing, offset, color },\n common,\n )]);\n }\n\n /**\n * Append a grid fill — ruled lines dividing the shape into cells, with an\n * optional finer ruling nested inside each one.\n *\n * Sized in divisions of the shape rather than in px (unlike {@link dotGrid}),\n * so it holds its structure as the shape resizes.\n *\n * @example\n * Fills.grid({ divisions: 8, subdivisions: 4, color: 'border' })\n */\n grid(options?: FillOptions & Omit<GridFillProp, 'type' | 'opacity' | 'blend'>) {\n const {\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color, ...common\n } = options ?? {};\n return new FillChain([...this.list, withOptions(\n {\n type: 'grid' as const,\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color,\n },\n common,\n )]);\n }\n\n /**\n * Append a 3D scene, painted through the shape's own path.\n *\n * Takes a **built** {@link Scene3D}, never a builder — per-frame freshness\n * comes from where the value is produced (a `renderSelf`, or a `() => …`\n * reactive binding), like every other fill.\n *\n * Note two same-type 3D layers hard-cut rather than cross-fading, because a\n * command list has no meaningful in-between. To dissolve between two scenes,\n * stack them and tween their opacities in opposite directions.\n */\n canvas3D(scene: Scene3D, options?: FillOptions & { maxPixelRatio?: number; antialias?: boolean }) {\n const { maxPixelRatio, antialias, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'canvas3D' as const, scene, maxPixelRatio, antialias }, common)]);\n }\n\n /** Allows spreading the chain into an array: `[...Fills.color('red')]`. */\n *[Symbol.iterator]() {\n yield* this.list;\n }\n\n /** Serializes to the raw fill array so frameworks that call `toJSON` get a plain value. */\n toJSON() {\n return this.list;\n }\n}\n\n/**\n * Accepted shapes for a node's `fill` prop.\n *\n * Can be a single fill, a `FillChain` builder result, an already-resolved\n * {@link FillResolved}, or an array mixing any of these (each chain contributes\n * all its layers in place):\n *\n * 'red' // plain CSS color\n * Fills.image('bg.jpg') // chain\n * ['#e8c584', Fills.image('bg.jpg')]\n * ['#e8c584', ...Fills.image('bg.jpg')]\n * resolvedFills // FillResolved[] passes through\n */\nexport type Fill =\n | FillProp\n | FillResolved\n | FillChain\n | (FillProp | FillResolved | FillChain)[];\n\n/**\n * Entry point for building fill chains fluently.\n *\n * An empty {@link FillChain}, so `Fills.image(src)` *is* `new FillChain().image(src)`\n * — every builder's signature and documentation has one definition, on the\n * class, which is what an editor shows when you hover `Fills.image`. The chain\n * is immutable (each builder returns a new one), so sharing one empty instance\n * as the entry point is safe.\n *\n * @example\n * node.fill = Fills.image('./bg.jpg', { opacity: 0.2 }).color('red', { opacity: 0.3 });\n */\nexport const Fills = new FillChain();\n\n/**\n * Normalises any {@link Fill} value to a plain `FillProp[]`.\n * Used by `resolveFillArray` before resolving to the renderer shape.\n *\n * Already-resolved fills (`FillResolved`) structurally satisfy `FillProp`, so\n * they pass straight through and `resolveFill` re-normalises them idempotently.\n */\nexport function resolveChainFill(fill: Fill | undefined): FillProp[] {\n if (fill == null) return [];\n if (fill instanceof FillChain) return fill.list;\n if (Array.isArray(fill)) {\n // Flatten any chains used as array elements so each contributes its\n // layers in place: `['#e8c584', Fills.image('bg.jpg')]` — and the plain\n // array a chain serializes to, which is how that value reads back out of\n // a stored document.\n const out: FillProp[] = [];\n for (const item of fill) {\n if (item instanceof FillChain) out.push(...item.list);\n else if (Array.isArray(item)) out.push(...resolveChainFill(item as Fill));\n else out.push(item as FillProp);\n }\n return out;\n }\n return [fill as FillProp];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/coerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAqBH,6EAA6E;AAC7E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAuB;IACjD,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;CACnB,CAAC,CAAC;AAEH,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAAC,IAA0B;IACrD,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,CAAe,EAAE,CAAe;IACtD,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/D,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CA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ill coercion for tweening.\r\n *\r\n * The renderer dispatches by `fill.type`, so an in-between frame of a tween must\r\n * be a fully-formed fill of a single concrete type. When the two endpoints of a\r\n * tween have different types (e.g. a solid `color` animating into a\r\n * `linear-gradient`, or one gradient kind into another) we first promote both\r\n * endpoints to a common target type, then run that type's normal `lerp`.\r\n *\r\n * The rules, in order:\r\n *\r\n * - `color` is treated as a degenerate gradient — a single solid color. It is\r\n * the least \"rich\" fill, so when one side is a color and the other a\r\n * gradient, the gradient type wins and the color is expanded into a uniform\r\n * gradient (every stop set to that color). A uniform gradient renders\r\n * identically to the flat color, so frame 0 of a color→gradient tween looks\r\n * exactly like the color, then morphs into the gradient.\r\n *\r\n * - Two *different* gradient types share no geometry (a linear gradient's\r\n * start/end has no radial-gradient counterpart). There is no meaningful\r\n * in-between for that geometry, so we coerce toward the destination (`to`)\r\n * type: colors/stops/opacity interpolate while the geometry adopts the\r\n * destination's, snapped at frame 0.\r\n *\r\n * Coercion never mutates its input; it returns a fresh resolved fill.\r\n */\r\n\r\nimport type { NormalizedColor } from \"./color/parser\";\r\nimport type { FillResolved, FillCommon, FillSpace } from \"./union\";\r\nimport type { BlendMode } from \"./blend\";\r\nimport type { SolidFillResolved } from \"./implementations/color\";\r\nimport type { LinearGradientFillResolved } from \"./implementations/linear-gradient\";\r\nimport type { RadialGradientFillResolved } from \"./implementations/radial-gradient\";\r\nimport type { ConicGradientFillResolved } from \"./implementations/conic-gradient\";\r\n\r\n/**\r\n * Resolved fills that carry a `colors` array (every gradient variant), with the\r\n * cross-cutting {@link FillCommon} fields (`space`) mixed in — mirroring how the\r\n * registry's `FillResolved` union wraps each implementation in `WithCommon`.\r\n */\r\ntype GradientResolved = FillCommon & (\r\n | LinearGradientFillResolved\r\n | RadialGradientFillResolved\r\n | ConicGradientFillResolved\r\n);\r\n\r\n/** Fill types that can participate in cross-type color/gradient tweening. */\r\nconst GRADIENT_TYPES = new Set<FillResolved[\"type\"]>([\r\n \"linear-gradient\",\r\n \"radial-gradient\",\r\n \"conic-gradient\",\r\n]);\r\n\r\n/** True if `type` is a gradient (linear/radial/conic). */\r\nexport function isGradientType(type: FillResolved[\"type\"]): boolean {\r\n return GRADIENT_TYPES.has(type);\r\n}\r\n\r\n/**\r\n * True if `a` and `b` can be tweened across their differing types — i.e. each is\r\n * either a solid color or a gradient, and at least one is a gradient. (Same-type\r\n * pairs are handled by the registry directly and never reach coercion.)\r\n */\r\nexport function canCoerce(a: FillResolved, b: FillResolved): boolean {\r\n const aColorish = a.type === \"solid\" || isGradientType(a.type);\r\n const bColorish = b.type === \"solid\" || isGradientType(b.type);\r\n if (!aColorish || !bColorish) return false;\r\n // At least one gradient — color↔color is same-type and never reaches here.\r\n return isGradientType(a.type) || isGradientType(b.type);\r\n}\r\n\r\n/** Builds a stop list of `count` evenly spaced positions in [0, 1]. */\r\nfunction evenStops(count: number): number[] {\r\n return Array.from({ length: count }, (_, i) => i / Math.max(1, count - 1));\r\n}\r\n\r\n/**\r\n * Expands a solid color into a gradient of `targetType` whose every stop is that\r\n * color, matching `stopCount` colors so the resulting gradient lerps cleanly\r\n * against the real gradient on the other side. The geometry defaults match each\r\n * gradient's `resolve()` so a uniform gradient renders as a flat color.\r\n */\r\nfunction colorToGradient(\r\n color: NormalizedColor,\r\n opacity: number | undefined,\r\n blend: BlendMode | undefined,\r\n space: FillSpace | undefined,\r\n targetType: GradientResolved[\"type\"],\r\n stopCount: number,\r\n): GradientResolved {\r\n const n = Math.max(2, stopCount);\r\n const colors: NormalizedColor[] = Array.from({ length: n }, () => [...color] as NormalizedColor);\r\n const stops = evenStops(n);\r\n const common = { colors, stops, opacity, blend, space };\r\n\r\n switch (targetType) {\r\n case \"linear-gradient\":\r\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\r\n case \"radial-gradient\":\r\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\r\n case \"conic-gradient\":\r\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\r\n }\r\n}\r\n\r\n/**\r\n * Re-types a gradient as `targetType`, carrying its colors/stops/opacity and\r\n * adopting the target type's default geometry. Used when tweening between two\r\n * different gradient kinds, whose geometries are not interpolatable.\r\n */\r\nfunction retypeGradient(\r\n g: GradientResolved,\r\n targetType: GradientResolved[\"type\"],\r\n): GradientResolved {\r\n if (g.type === targetType) return g;\r\n const common = { colors: g.colors, stops: g.stops, opacity: g.opacity, blend: g.blend, space: g.space };\r\n switch (targetType) {\r\n case \"linear-gradient\":\r\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\r\n case \"radial-gradient\":\r\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\r\n case \"conic-gradient\":\r\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\r\n }\r\n}\r\n\r\n/**\r\n * Promotes two differing-type fills (color and/or gradient) to a single common\r\n * type so the registry can lerp them with that type's `lerp`. Returns the\r\n * coerced `[a, b]` pair, both guaranteed to share `result[0].type`.\r\n *\r\n * Caller must have checked {@link canCoerce} first.\r\n */\r\nexport function coercePair(a: FillResolved, b: FillResolved): [FillResolved, FillResolved] {\r\n const aIsColor = a.type === \"solid\";\r\n const bIsColor = b.type === \"solid\";\r\n\r\n // color → gradient: expand the color to match the gradient's type.\r\n if (aIsColor && !bIsColor) {\r\n const grad = b as GradientResolved;\r\n const expanded = colorToGradient(\r\n (a as SolidFillResolved).color, a.opacity, a.blend, a.space, grad.type, grad.colors.length,\r\n );\r\n return [expanded, grad];\r\n }\r\n // gradient → color: expand the color (b) to match the gradient's (a) type.\r\n if (bIsColor && !aIsColor) {\r\n const grad = a as GradientResolved;\r\n const expanded = colorToGradient(\r\n (b as SolidFillResolved).color, b.opacity, b.blend, b.space, grad.type, grad.colors.length,\r\n );\r\n return [grad, expanded];\r\n }\r\n\r\n // Two different gradient types: coerce toward the destination (b) type.\r\n const ga = a as GradientResolved;\r\n const gb = b as GradientResolved;\r\n return [retypeGradient(ga, gb.type), gb];\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"coerce.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/coerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAqBH,6EAA6E;AAC7E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAuB;IACjD,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;CACnB,CAAC,CAAC;AAEH,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAAC,IAA0B;IACrD,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,CAAe,EAAE,CAAe;IACtD,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC/D,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAC3C,2EAA2E;IAC3E,OAAO,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC;AAED,uEAAuE;AACvE,SAAS,SAAS,CAAC,KAAa;IAC5B,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CACpB,KAAsB,EACtB,OAA2B,EAC3B,KA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AAC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAC7F,CAAC;QACF,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC5B,CAAC;IACD,2EAA2E;IAC3E,IAAI,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;QACxB,MAAM,IAAI,GAAG,CAAqB,CAAC;QACnC,MAAM,QAAQ,GAAG,eAAe,CAC3B,CAAuB,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAC7F,CAAC;QACF,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,wEAAwE;IACxE,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * Cross-type fill coercion for tweening.\n *\n * The renderer dispatches by `fill.type`, so an in-between frame of a tween must\n * be a fully-formed fill of a single concrete type. When the two endpoints of a\n * tween have different types (e.g. a solid `color` animating into a\n * `linear-gradient`, or one gradient kind into another) we first promote both\n * endpoints to a common target type, then run that type's normal `lerp`.\n *\n * The rules, in order:\n *\n * - `color` is treated as a degenerate gradient — a single solid color. It is\n * the least \"rich\" fill, so when one side is a color and the other a\n * gradient, the gradient type wins and the color is expanded into a uniform\n * gradient (every stop set to that color). A uniform gradient renders\n * identically to the flat color, so frame 0 of a color→gradient tween looks\n * exactly like the color, then morphs into the gradient.\n *\n * - Two *different* gradient types share no geometry (a linear gradient's\n * start/end has no radial-gradient counterpart). There is no meaningful\n * in-between for that geometry, so we coerce toward the destination (`to`)\n * type: colors/stops/opacity interpolate while the geometry adopts the\n * destination's, snapped at frame 0.\n *\n * Coercion never mutates its input; it returns a fresh resolved fill.\n */\n\nimport type { NormalizedColor } from \"./color/parser\";\nimport type { FillResolved, FillCommon, FillSpace } from \"./union\";\nimport type { BlendMode } from \"./blend\";\nimport type { SolidFillResolved } from \"./implementations/color\";\nimport type { LinearGradientFillResolved } from \"./implementations/linear-gradient\";\nimport type { RadialGradientFillResolved } from \"./implementations/radial-gradient\";\nimport type { ConicGradientFillResolved } from \"./implementations/conic-gradient\";\n\n/**\n * Resolved fills that carry a `colors` array (every gradient variant), with the\n * cross-cutting {@link FillCommon} fields (`space`) mixed in — mirroring how the\n * registry's `FillResolved` union wraps each implementation in `WithCommon`.\n */\ntype GradientResolved = FillCommon & (\n | LinearGradientFillResolved\n | RadialGradientFillResolved\n | ConicGradientFillResolved\n);\n\n/** Fill types that can participate in cross-type color/gradient tweening. */\nconst GRADIENT_TYPES = new Set<FillResolved[\"type\"]>([\n \"linear-gradient\",\n \"radial-gradient\",\n \"conic-gradient\",\n]);\n\n/** True if `type` is a gradient (linear/radial/conic). */\nexport function isGradientType(type: FillResolved[\"type\"]): boolean {\n return GRADIENT_TYPES.has(type);\n}\n\n/**\n * True if `a` and `b` can be tweened across their differing types — i.e. each is\n * either a solid color or a gradient, and at least one is a gradient. (Same-type\n * pairs are handled by the registry directly and never reach coercion.)\n */\nexport function canCoerce(a: FillResolved, b: FillResolved): boolean {\n const aColorish = a.type === \"solid\" || isGradientType(a.type);\n const bColorish = b.type === \"solid\" || isGradientType(b.type);\n if (!aColorish || !bColorish) return false;\n // At least one gradient — color↔color is same-type and never reaches here.\n return isGradientType(a.type) || isGradientType(b.type);\n}\n\n/** Builds a stop list of `count` evenly spaced positions in [0, 1]. */\nfunction evenStops(count: number): number[] {\n return Array.from({ length: count }, (_, i) => i / Math.max(1, count - 1));\n}\n\n/**\n * Expands a solid color into a gradient of `targetType` whose every stop is that\n * color, matching `stopCount` colors so the resulting gradient lerps cleanly\n * against the real gradient on the other side. The geometry defaults match each\n * gradient's `resolve()` so a uniform gradient renders as a flat color.\n */\nfunction colorToGradient(\n color: NormalizedColor,\n opacity: number | undefined,\n blend: BlendMode | undefined,\n space: FillSpace | undefined,\n targetType: GradientResolved[\"type\"],\n stopCount: number,\n): GradientResolved {\n const n = Math.max(2, stopCount);\n const colors: NormalizedColor[] = Array.from({ length: n }, () => [...color] as NormalizedColor);\n const stops = evenStops(n);\n const common = { colors, stops, opacity, blend, space };\n\n switch (targetType) {\n case \"linear-gradient\":\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\n case \"radial-gradient\":\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\n case \"conic-gradient\":\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\n }\n}\n\n/**\n * Re-types a gradient as `targetType`, carrying its colors/stops/opacity and\n * adopting the target type's default geometry. Used when tweening between two\n * different gradient kinds, whose geometries are not interpolatable.\n */\nfunction retypeGradient(\n g: GradientResolved,\n targetType: GradientResolved[\"type\"],\n): GradientResolved {\n if (g.type === targetType) return g;\n const common = { colors: g.colors, stops: g.stops, opacity: g.opacity, blend: g.blend, space: g.space };\n switch (targetType) {\n case \"linear-gradient\":\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\n case \"radial-gradient\":\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\n case \"conic-gradient\":\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\n }\n}\n\n/**\n * Promotes two differing-type fills (color and/or gradient) to a single common\n * type so the registry can lerp them with that type's `lerp`. Returns the\n * coerced `[a, b]` pair, both guaranteed to share `result[0].type`.\n *\n * Caller must have checked {@link canCoerce} first.\n */\nexport function coercePair(a: FillResolved, b: FillResolved): [FillResolved, FillResolved] {\n const aIsColor = a.type === \"solid\";\n const bIsColor = b.type === \"solid\";\n\n // color → gradient: expand the color to match the gradient's type.\n if (aIsColor && !bIsColor) {\n const grad = b as GradientResolved;\n const expanded = colorToGradient(\n (a as SolidFillResolved).color, a.opacity, a.blend, a.space, grad.type, grad.colors.length,\n );\n return [expanded, grad];\n }\n // gradient → color: expand the color (b) to match the gradient's (a) type.\n if (bIsColor && !aIsColor) {\n const grad = a as GradientResolved;\n const expanded = colorToGradient(\n (b as SolidFillResolved).color, b.opacity, b.blend, b.space, grad.type, grad.colors.length,\n );\n return [grad, expanded];\n }\n\n // Two different gradient types: coerce toward the destination (b) type.\n const ga = a as GradientResolved;\n const gb = b as GradientResolved;\n return [retypeGradient(ga, gb.type), gb];\n}\n"]}
|