@motionscript/core 0.1.0-alpha.0 → 0.1.0-alpha.10
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 +356 -0
- package/NOTICE +49 -0
- package/README.md +29 -10
- package/dist/assets/catalog.d.ts +9 -0
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +11 -0
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +7 -3
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/manager.d.ts +26 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +99 -15
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/scope.d.ts +4 -4
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/effects/chain.d.ts +73 -0
- package/dist/attributes/audio/effects/chain.d.ts.map +1 -0
- package/dist/attributes/audio/effects/chain.js +67 -0
- package/dist/attributes/audio/effects/chain.js.map +1 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts +14 -0
- package/dist/attributes/audio/effects/implementations/echo.d.ts.map +1 -0
- package/dist/attributes/audio/{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 +52 -13
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +10 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +26 -24
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +51 -30
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +18 -13
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +13 -11
- 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 +8 -8
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +7 -9
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/insets.d.ts +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.d.ts +2 -2
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.d.ts +1 -1
- package/dist/attributes/layout/size.js +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/space3d.js +1 -1
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +56 -12
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +59 -19
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.d.ts +1 -1
- package/dist/attributes/properties/inputs.js +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +27 -141
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +24 -106
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +8 -8
- package/dist/attributes/render3d/orbit.js +7 -7
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +2 -3
- package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js +2 -3
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +117 -522
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +102 -364
- 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 +98 -28
- 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 +21 -7
- package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js +26 -23
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +26 -5
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js +15 -10
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.d.ts +58 -11
- package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js +26 -20
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +47 -15
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js +24 -29
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.d.ts +26 -7
- package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js +17 -16
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.d.ts +29 -7
- package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js +17 -14
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +82 -34
- 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 +35 -8
- 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 +57 -34
- 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 +6 -8
- 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 +34 -6
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +157 -112
- 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.d.ts +2 -6
- package/dist/attributes/shape/effects/union.d.ts.map +1 -1
- package/dist/attributes/shape/effects/union.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/color/parser.d.ts +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +102 -50
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
- package/dist/attributes/shape/fill/gradient-stops.js +65 -0
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -2
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +5 -4
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +28 -27
- package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js +20 -14
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.d.ts +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +2 -2
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.d.ts +1 -1
- package/dist/attributes/shape/fill/index.d.ts.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.d.ts +9 -1
- package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
- package/dist/attributes/shape/fill/lerp.js +12 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/registry.d.ts +1 -2
- package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
- package/dist/attributes/shape/fill/registry.js +1 -2
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +7 -17
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +3 -19
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +2 -2
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +3 -3
- package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
- package/dist/attributes/shape/filters/registry.js +6 -6
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +12 -13
- 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.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +12 -5
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +16 -4
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.d.ts +1 -2
- package/dist/attributes/shape/path/ops.d.ts.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/shaders/index.d.ts +2 -0
- package/dist/attributes/shape/shaders/index.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/index.js +2 -0
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/language.d.ts +26 -0
- package/dist/attributes/shape/shaders/language.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/language.js +20 -0
- package/dist/attributes/shape/shaders/language.js.map +1 -0
- package/dist/attributes/shape/shaders/pack.d.ts +25 -11
- package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/pack.js +9 -4
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.d.ts +4 -5
- package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js +3 -6
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.d.ts +41 -0
- package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -0
- package/dist/attributes/shape/shaders/uniforms.js +0 -0
- package/dist/attributes/shape/shaders/uniforms.js.map +1 -0
- package/dist/attributes/shape/stroke/index.d.ts +2 -2
- package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/index.js +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +22 -2
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.d.ts +2 -2
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +6 -0
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +1 -0
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.d.ts +2 -3
- package/dist/attributes/text/types.d.ts.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-4BDLFEOC.js +2 -0
- package/dist/browser/chunks/chunk-4BDLFEOC.js.map +7 -0
- package/dist/browser/chunks/chunk-CCGVIR4F.js +3 -0
- package/dist/browser/chunks/chunk-CCGVIR4F.js.map +7 -0
- package/dist/browser/chunks/chunk-N4WSN5WY.js +13 -0
- package/dist/browser/chunks/chunk-N4WSN5WY.js.map +7 -0
- package/dist/browser/chunks/chunk-WZSI3GSK.js +6 -0
- package/dist/browser/chunks/chunk-WZSI3GSK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +2 -0
- package/dist/browser/experimental.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/manifest.json +5 -5
- package/dist/browser/sdk.js +1 -1
- package/dist/component.d.ts +10 -19
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +10 -19
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/audio/audio.d.ts +62 -0
- package/dist/components/builtins/audio/audio.d.ts.map +1 -0
- package/dist/components/builtins/audio/audio.js +38 -0
- package/dist/components/builtins/audio/audio.js.map +1 -0
- package/dist/components/builtins/geometry/composite.d.ts +93 -0
- package/dist/components/builtins/geometry/composite.d.ts.map +1 -0
- package/dist/components/builtins/geometry/composite.js +25 -0
- package/dist/components/builtins/geometry/composite.js.map +1 -0
- package/dist/components/builtins/geometry/geometry.d.ts +921 -0
- package/dist/components/builtins/geometry/geometry.d.ts.map +1 -0
- package/dist/components/builtins/geometry/geometry.js +107 -0
- package/dist/components/builtins/geometry/geometry.js.map +1 -0
- package/dist/{nodes → components/builtins}/geometry/shape-outline.d.ts +5 -5
- package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -0
- package/dist/{nodes → components/builtins}/geometry/shape-outline.js +4 -15
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -0
- package/dist/components/builtins/layout/layout.d.ts +186 -0
- package/dist/components/builtins/layout/layout.d.ts.map +1 -0
- package/dist/components/builtins/layout/layout.js +84 -0
- package/dist/components/builtins/layout/layout.js.map +1 -0
- package/dist/components/builtins/media/media.d.ts +240 -0
- package/dist/components/builtins/media/media.d.ts.map +1 -0
- package/dist/components/builtins/media/media.js +143 -0
- package/dist/components/builtins/media/media.js.map +1 -0
- package/dist/components/builtins/providers/providers.d.ts +47 -0
- package/dist/components/builtins/providers/providers.d.ts.map +1 -0
- package/dist/components/builtins/providers/providers.js +30 -0
- package/dist/components/builtins/providers/providers.js.map +1 -0
- package/dist/{nodes → components/builtins}/text/number-format.d.ts +1 -1
- package/dist/components/builtins/text/number-format.d.ts.map +1 -0
- package/dist/{nodes → components/builtins}/text/number-format.js +1 -1
- package/dist/components/builtins/text/number-format.js.map +1 -0
- package/dist/components/builtins/text/number-pattern.d.ts.map +1 -0
- package/dist/components/builtins/text/number-pattern.js.map +1 -0
- package/dist/{nodes/node → components/builtins/text}/text-defaults.d.ts +10 -12
- package/dist/components/builtins/text/text-defaults.d.ts.map +1 -0
- package/dist/{nodes/node → components/builtins/text}/text-defaults.js +10 -12
- package/dist/components/builtins/text/text-defaults.js.map +1 -0
- package/dist/components/builtins/text/text-layout.d.ts +82 -0
- package/dist/components/builtins/text/text-layout.d.ts.map +1 -0
- package/dist/components/builtins/text/text-layout.js +331 -0
- package/dist/components/builtins/text/text-layout.js.map +1 -0
- package/dist/components/builtins/text/text.d.ts +409 -0
- package/dist/components/builtins/text/text.d.ts.map +1 -0
- package/dist/components/builtins/text/text.js +116 -0
- package/dist/components/builtins/text/text.js.map +1 -0
- package/dist/components/builtins/three/canvas3d.d.ts +245 -0
- package/dist/components/builtins/three/canvas3d.d.ts.map +1 -0
- package/dist/components/builtins/three/canvas3d.js +21 -0
- package/dist/components/builtins/three/canvas3d.js.map +1 -0
- package/dist/{nodes → components/builtins}/three/grid-geometry3d.d.ts +2 -2
- package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -0
- package/dist/{nodes → components/builtins}/three/grid-geometry3d.js +1 -1
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -0
- package/dist/components/builtins/three/three.d.ts +1889 -0
- package/dist/components/builtins/three/three.d.ts.map +1 -0
- package/dist/components/builtins/three/three.js +305 -0
- package/dist/components/builtins/three/three.js.map +1 -0
- package/dist/components/factory/api.d.ts +543 -0
- package/dist/components/factory/api.d.ts.map +1 -0
- package/dist/components/factory/api.js +4 -0
- package/dist/components/factory/api.js.map +1 -0
- package/dist/components/factory/clip-of.d.ts +5 -0
- package/dist/components/factory/clip-of.d.ts.map +1 -0
- package/dist/components/factory/clip-of.js +33 -0
- package/dist/components/factory/clip-of.js.map +1 -0
- package/dist/components/factory/commands-for.d.ts +19 -0
- package/dist/components/factory/commands-for.d.ts.map +1 -0
- package/dist/components/factory/commands-for.js +5 -0
- package/dist/components/factory/commands-for.js.map +1 -0
- package/dist/components/factory/component-audio.d.ts +9 -0
- package/dist/components/factory/component-audio.d.ts.map +1 -0
- package/dist/components/factory/component-audio.js +18 -0
- package/dist/components/factory/component-audio.js.map +1 -0
- package/dist/components/factory/component2d.d.ts +8 -0
- package/dist/components/factory/component2d.d.ts.map +1 -0
- package/dist/components/factory/component2d.js +240 -0
- package/dist/components/factory/component2d.js.map +1 -0
- package/dist/components/factory/component3d.d.ts +9 -0
- package/dist/components/factory/component3d.d.ts.map +1 -0
- package/dist/components/factory/component3d.js +107 -0
- package/dist/components/factory/component3d.js.map +1 -0
- package/dist/components/factory/factory.d.ts +66 -0
- package/dist/components/factory/factory.d.ts.map +1 -0
- package/dist/components/factory/factory.js +347 -0
- package/dist/components/factory/factory.js.map +1 -0
- package/dist/components/factory/timeline.d.ts +22 -0
- package/dist/components/factory/timeline.d.ts.map +1 -0
- package/dist/components/factory/timeline.js +128 -0
- package/dist/components/factory/timeline.js.map +1 -0
- package/dist/components/factory/type-def.d.ts +26 -0
- package/dist/components/factory/type-def.d.ts.map +1 -0
- package/dist/components/factory/type-def.js +16 -0
- package/dist/components/factory/type-def.js.map +1 -0
- package/dist/components/factory/types.d.ts +91 -0
- package/dist/components/factory/types.d.ts.map +1 -0
- package/dist/components/factory/types.js +88 -0
- package/dist/components/factory/types.js.map +1 -0
- package/dist/components/factory/views.d.ts +121 -0
- package/dist/components/factory/views.d.ts.map +1 -0
- package/dist/components/factory/views.js +453 -0
- package/dist/components/factory/views.js.map +1 -0
- package/dist/components/modules/aim.d.ts +30 -0
- package/dist/components/modules/aim.d.ts.map +1 -0
- package/dist/components/modules/aim.js +39 -0
- package/dist/components/modules/aim.js.map +1 -0
- package/dist/components/modules/corners.d.ts +13 -0
- package/dist/components/modules/corners.d.ts.map +1 -0
- package/dist/components/modules/corners.js +12 -0
- package/dist/components/modules/corners.js.map +1 -0
- package/dist/components/modules/flow.d.ts +26 -0
- package/dist/components/modules/flow.d.ts.map +1 -0
- package/dist/components/modules/flow.js +57 -0
- package/dist/components/modules/flow.js.map +1 -0
- package/dist/components/modules/material.d.ts +40 -0
- package/dist/components/modules/material.d.ts.map +1 -0
- package/dist/components/modules/material.js +75 -0
- package/dist/components/modules/material.js.map +1 -0
- package/dist/components/modules/paint.d.ts +71 -0
- package/dist/components/modules/paint.d.ts.map +1 -0
- package/dist/components/modules/paint.js +106 -0
- package/dist/components/modules/paint.js.map +1 -0
- package/dist/components/modules/shapes.d.ts +31 -0
- package/dist/components/modules/shapes.d.ts.map +1 -0
- package/dist/components/modules/shapes.js +43 -0
- package/dist/components/modules/shapes.js.map +1 -0
- package/dist/components/modules/text-layout.d.ts +26 -0
- package/dist/components/modules/text-layout.d.ts.map +1 -0
- package/dist/components/modules/text-layout.js +57 -0
- package/dist/components/modules/text-layout.js.map +1 -0
- package/dist/components/modules/text-style.d.ts +48 -0
- package/dist/components/modules/text-style.d.ts.map +1 -0
- package/dist/components/modules/text-style.js +63 -0
- package/dist/components/modules/text-style.js.map +1 -0
- package/dist/components/modules/three-entries.d.ts +23 -0
- package/dist/components/modules/three-entries.d.ts.map +1 -0
- package/dist/components/modules/three-entries.js +41 -0
- package/dist/components/modules/three-entries.js.map +1 -0
- package/dist/components/modules/view3d.d.ts +59 -0
- package/dist/components/modules/view3d.d.ts.map +1 -0
- package/dist/components/modules/view3d.js +171 -0
- package/dist/components/modules/view3d.js.map +1 -0
- package/dist/{nodes/geometry → components/trees/2d}/group-bounds.d.ts +4 -4
- package/dist/components/trees/2d/group-bounds.d.ts.map +1 -0
- package/dist/{nodes/geometry → components/trees/2d}/group-bounds.js +3 -4
- package/dist/components/trees/2d/group-bounds.js.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-lifecycle.d.ts +2 -2
- package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-lifecycle.js +1 -1
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-motion.d.ts +3 -3
- package/dist/components/trees/2d/node-motion.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-motion.js +1 -1
- package/dist/components/trees/2d/node-motion.js.map +1 -0
- package/dist/components/trees/2d/node-render.d.ts +36 -0
- package/dist/components/trees/2d/node-render.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-render.js +10 -23
- package/dist/components/trees/2d/node-render.js.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-space.d.ts +3 -3
- package/dist/components/trees/2d/node-space.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-space.js +4 -4
- package/dist/components/trees/2d/node-space.js.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-transform.d.ts +2 -2
- package/dist/components/trees/2d/node-transform.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/2d/node-transform.js +1 -1
- package/dist/components/trees/2d/node-transform.js.map +1 -0
- package/dist/{nodes → components/trees}/2d/node2d.d.ts +206 -185
- package/dist/components/trees/2d/node2d.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/2d/node2d.js +296 -324
- package/dist/components/trees/2d/node2d.js.map +1 -0
- package/dist/components/trees/audio/index.d.ts +2 -0
- package/dist/components/trees/audio/index.d.ts.map +1 -0
- package/dist/components/trees/audio/index.js +2 -0
- package/dist/components/trees/audio/index.js.map +1 -0
- package/dist/{nodes → components/trees}/audio/node-audio.d.ts +25 -15
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/audio/node-audio.js +30 -35
- package/dist/components/trees/audio/node-audio.js.map +1 -0
- package/dist/components/trees/index.d.ts +10 -0
- package/dist/components/trees/index.d.ts.map +1 -0
- package/dist/components/trees/index.js +14 -0
- package/dist/components/trees/index.js.map +1 -0
- package/dist/components/trees/node/node-editor-state.d.ts.map +1 -0
- package/dist/components/trees/node/node-editor-state.js.map +1 -0
- package/dist/{nodes → components/trees}/node/node-reactive.d.ts +9 -10
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/node/node-reactive.js +16 -13
- package/dist/components/trees/node/node-reactive.js.map +1 -0
- package/dist/{nodes → components/trees}/node/node-time.d.ts +3 -3
- package/dist/components/trees/node/node-time.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/node/node-time.js +1 -1
- package/dist/components/trees/node/node-time.js.map +1 -0
- package/dist/{nodes → components/trees}/node/node-walk.d.ts +1 -1
- package/dist/components/trees/node/node-walk.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/node/node-walk.js +1 -1
- package/dist/components/trees/node/node-walk.js.map +1 -0
- package/dist/{nodes → components/trees}/node/node.d.ts +46 -82
- package/dist/components/trees/node/node.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/node/node.js +89 -114
- package/dist/components/trees/node/node.js.map +1 -0
- package/dist/{nodes/scene → components/trees/root}/canvas2d-node.d.ts +16 -15
- package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -0
- package/dist/{nodes/scene → components/trees/root}/canvas2d-node.js +40 -85
- package/dist/components/trees/root/canvas2d-node.js.map +1 -0
- package/dist/{nodes → components/trees}/three/node3d.d.ts +65 -25
- package/dist/components/trees/three/node3d.d.ts.map +1 -0
- package/dist/{nodes → components/trees}/three/node3d.js +78 -76
- package/dist/components/trees/three/node3d.js.map +1 -0
- package/dist/document/audio.d.ts +10 -2
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +45 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +18 -42
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +23 -5
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +72 -10
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.d.ts +2 -2
- package/dist/document/deny-globals.js +2 -2
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +3 -3
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +3 -3
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -5
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.d.ts +1 -1
- package/dist/document/expression/index.js +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +2 -2
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +15 -6
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +1 -1
- package/dist/document/expression/refs.js +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +2 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.d.ts +10 -1
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +6 -1
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.d.ts +70 -0
- package/dist/document/migrate.d.ts.map +1 -0
- package/dist/document/migrate.js +202 -0
- package/dist/document/migrate.js.map +1 -0
- package/dist/document/missing-node.d.ts +27 -0
- package/dist/document/missing-node.d.ts.map +1 -0
- package/dist/document/missing-node.js +48 -0
- package/dist/document/missing-node.js.map +1 -0
- package/dist/document/node-decorator.d.ts +14 -10
- package/dist/document/node-decorator.d.ts.map +1 -1
- package/dist/document/node-decorator.js +14 -10
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +32 -3
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +71 -0
- package/dist/document/placement.d.ts.map +1 -0
- package/dist/document/placement.js +83 -0
- package/dist/document/placement.js.map +1 -0
- package/dist/document/project.d.ts +4 -2
- 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 +71 -44
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +94 -35
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +57 -0
- package/dist/document/settled-index.d.ts.map +1 -0
- package/dist/document/settled-index.js +264 -0
- package/dist/document/settled-index.js.map +1 -0
- 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 +145 -20
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +478 -80
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +30 -44
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +2 -2
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +20 -8
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +195 -52
- 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 +82 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +34 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/layout/bounds.d.ts +0 -1
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/flex.d.ts +4 -2
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +27 -11
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/ops.d.ts +6 -0
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +6 -0
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.d.ts +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +2 -2
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +26 -8
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +12 -6
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +4 -0
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +6 -0
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +6 -0
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/tree.d.ts +3 -3
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.d.ts +6 -1
- package/dist/props/host.d.ts.map +1 -1
- package/dist/props/host.js +3 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/layout.d.ts +29 -0
- package/dist/props/layout.d.ts.map +1 -0
- package/dist/props/layout.js +84 -0
- package/dist/props/layout.js.map +1 -0
- package/dist/props/slot.d.ts +1 -1
- package/dist/props/slot.js +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +17 -0
- package/dist/renamed-scene-names.d.ts.map +1 -0
- package/dist/renamed-scene-names.js +9 -0
- package/dist/renamed-scene-names.js.map +1 -0
- package/dist/render/canvas-render-context2d.d.ts +19 -3
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +20 -0
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.d.ts +1 -1
- package/dist/render/clip.js +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +12 -0
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +15 -9
- package/dist/render/descriptors/text.d.ts.map +1 -1
- package/dist/render/descriptors/text.js +11 -5
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +2 -2
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +3 -3
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +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/render-context2d.d.ts +8 -8
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/render-issue.d.ts +39 -0
- package/dist/render/render-issue.d.ts.map +1 -0
- package/dist/render/render-issue.js +29 -0
- package/dist/render/render-issue.js.map +1 -0
- package/dist/render/surface.d.ts +2 -2
- package/dist/render/surface.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +4 -2
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.d.ts +1 -1
- package/dist/render3d/builders.js +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +6 -0
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +5 -3
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +2 -9
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +2 -13
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +8 -1
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +21 -23
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +85 -34
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -1
- package/dist/render3d/index.js +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts +14 -0
- package/dist/render3d/inert.d.ts.map +1 -0
- package/dist/render3d/inert.js +62 -0
- package/dist/render3d/inert.js.map +1 -0
- package/dist/render3d/material.d.ts +10 -5
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/resources.d.ts +2 -2
- package/dist/render3d/resources.js +2 -2
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +23 -4
- package/dist/render3d/scene-settings.d.ts.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +12 -1
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +40 -7
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/texture.d.ts +11 -2
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +13 -0
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/transform.d.ts +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +20 -3
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +29 -2
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +1 -1
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.d.ts +1 -1
- package/dist/runtime/asset-refine.d.ts.map +1 -1
- package/dist/runtime/asset-refine.js +3 -2
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.d.ts +10 -0
- package/dist/runtime/asset-timeline.d.ts.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.d.ts.map +1 -1
- package/dist/runtime/asset-update.js +8 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.d.ts +0 -11
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +0 -19
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +13 -6
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +34 -12
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +20 -3
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +132 -27
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +13 -6
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +6 -3
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +31 -0
- package/dist/runtime/frame-time.d.ts.map +1 -0
- package/dist/runtime/frame-time.js +29 -0
- package/dist/runtime/frame-time.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +45 -4
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +127 -13
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +14 -6
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +10 -2
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +4 -5
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +32 -3
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +78 -11
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/session.d.ts +16 -10
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +23 -8
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +2 -2
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +4 -3
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +2 -2
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +6 -3
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +70 -38
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +71 -46
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +21 -8
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +12 -23
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +13 -1
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +14 -0
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.d.ts.map +1 -1
- package/dist/tween/ease/constants.js +8 -5
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +4 -3
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +17 -0
- package/dist/tween/ease/describe.d.ts.map +1 -0
- package/dist/tween/ease/describe.js +41 -0
- package/dist/tween/ease/describe.js.map +1 -0
- package/dist/tween/ease/spec.d.ts +31 -0
- package/dist/tween/ease/spec.d.ts.map +1 -0
- package/dist/tween/ease/spec.js +51 -0
- package/dist/tween/ease/spec.js.map +1 -0
- package/dist/tween/index.d.ts +3 -1
- package/dist/tween/index.d.ts.map +1 -1
- package/dist/tween/index.js +2 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/loop.d.ts +1 -1
- package/dist/tween/loop.js +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +3 -3
- package/dist/tween/prepare.js +3 -3
- package/dist/tween/prepare.js.map +1 -1
- package/dist/util/metrics.d.ts +1 -1
- package/dist/util/metrics.js +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/reference.d.ts +6 -6
- package/dist/util/reference.js.map +1 -1
- package/package.json +8 -10
- 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 -249
- 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/effects/implementations/displace.d.ts +0 -48
- package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/displace.js +0 -30
- package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
- package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.js +0 -25
- package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
- package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.js +0 -22
- package/dist/attributes/shape/effects/implementations/trails.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-2T3HXSC2.js +0 -2
- package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
- package/dist/browser/chunks/chunk-P3XQCHDW.js +0 -16
- package/dist/browser/chunks/chunk-P3XQCHDW.js.map +0 -7
- package/dist/browser/chunks/chunk-VJQMKHGQ.js +0 -3
- package/dist/browser/chunks/chunk-VJQMKHGQ.js.map +0 -7
- package/dist/browser/jsx-jsx-dev-runtime.js +0 -2
- package/dist/browser/jsx-jsx-dev-runtime.js.map +0 -7
- package/dist/browser/jsx-jsx-runtime.js +0 -2
- package/dist/browser/jsx-jsx-runtime.js.map +0 -7
- package/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 -19
- package/dist/jsx/jsx-runtime.d.ts.map +0 -1
- package/dist/jsx/jsx-runtime.js +0 -16
- package/dist/jsx/jsx-runtime.js.map +0 -1
- package/dist/nodes/2d/node-lifecycle.d.ts.map +0 -1
- package/dist/nodes/2d/node-lifecycle.js.map +0 -1
- package/dist/nodes/2d/node-motion.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/nodes/2d/node-space.d.ts.map +0 -1
- package/dist/nodes/2d/node-space.js.map +0 -1
- package/dist/nodes/2d/node-transform.d.ts.map +0 -1
- package/dist/nodes/2d/node-transform.js.map +0 -1
- package/dist/nodes/2d/node2d.d.ts.map +0 -1
- package/dist/nodes/2d/node2d.js.map +0 -1
- package/dist/nodes/2d/paint-node.d.ts +0 -115
- package/dist/nodes/2d/paint-node.d.ts.map +0 -1
- package/dist/nodes/2d/paint-node.js +0 -190
- 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 -4
- package/dist/nodes/audio/index.js.map +0 -1
- package/dist/nodes/audio/node-audio.d.ts.map +0 -1
- package/dist/nodes/audio/node-audio.js.map +0 -1
- package/dist/nodes/audio/sound-node.d.ts +0 -40
- package/dist/nodes/audio/sound-node.d.ts.map +0 -1
- package/dist/nodes/audio/sound-node.js +0 -68
- 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/dot-grid-node.d.ts +0 -105
- package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/dot-grid-node.js +0 -142
- package/dist/nodes/geometry/dot-grid-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/grid-lines.d.ts +0 -101
- package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-lines.js +0 -128
- package/dist/nodes/geometry/grid-lines.js.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
- package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.js +0 -172
- package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
- package/dist/nodes/geometry/group-bounds.d.ts.map +0 -1
- package/dist/nodes/geometry/group-bounds.js.map +0 -1
- package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
- package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-grid-node.js +0 -127
- package/dist/nodes/geometry/line-grid-node.js.map +0 -1
- package/dist/nodes/geometry/line-node.d.ts +0 -58
- package/dist/nodes/geometry/line-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-node.js +0 -123
- package/dist/nodes/geometry/line-node.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 -52
- 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.map +0 -1
- package/dist/nodes/geometry/shape-outline.js.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
- package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
- package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
- package/dist/nodes/index.d.ts +0 -46
- package/dist/nodes/index.d.ts.map +0 -1
- package/dist/nodes/index.js +0 -54
- package/dist/nodes/index.js.map +0 -1
- package/dist/nodes/layout/camera-node.d.ts +0 -71
- package/dist/nodes/layout/camera-node.d.ts.map +0 -1
- package/dist/nodes/layout/camera-node.js +0 -118
- 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 -348
- 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.map +0 -1
- package/dist/nodes/node/node-editor-state.js.map +0 -1
- package/dist/nodes/node/node-reactive.d.ts.map +0 -1
- package/dist/nodes/node/node-reactive.js.map +0 -1
- package/dist/nodes/node/node-time.d.ts.map +0 -1
- package/dist/nodes/node/node-time.js.map +0 -1
- package/dist/nodes/node/node-walk.d.ts.map +0 -1
- package/dist/nodes/node/node-walk.js.map +0 -1
- package/dist/nodes/node/node.d.ts.map +0 -1
- package/dist/nodes/node/node.js.map +0 -1
- package/dist/nodes/node/text-defaults.d.ts.map +0 -1
- package/dist/nodes/node/text-defaults.js.map +0 -1
- package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/scene/canvas2d-node.js.map +0 -1
- package/dist/nodes/scene/provider-node.d.ts +0 -47
- package/dist/nodes/scene/provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/provider-node.js +0 -63
- package/dist/nodes/scene/provider-node.js.map +0 -1
- package/dist/nodes/scene/theme-provider-node.d.ts +0 -29
- package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/theme-provider-node.js +0 -43
- package/dist/nodes/scene/theme-provider-node.js.map +0 -1
- package/dist/nodes/text/default-text-style-node.d.ts +0 -100
- package/dist/nodes/text/default-text-style-node.d.ts.map +0 -1
- package/dist/nodes/text/default-text-style-node.js +0 -140
- package/dist/nodes/text/default-text-style-node.js.map +0 -1
- package/dist/nodes/text/number-format.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/nodes/text/number-pattern.js.map +0 -1
- package/dist/nodes/text/richtext-node.d.ts +0 -73
- package/dist/nodes/text/richtext-node.d.ts.map +0 -1
- package/dist/nodes/text/richtext-node.js +0 -144
- package/dist/nodes/text/richtext-node.js.map +0 -1
- package/dist/nodes/text/text-base.d.ts +0 -135
- package/dist/nodes/text/text-base.d.ts.map +0 -1
- package/dist/nodes/text/text-base.js +0 -504
- package/dist/nodes/text/text-base.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 -91
- package/dist/nodes/three/camera-nodes.d.ts.map +0 -1
- package/dist/nodes/three/camera-nodes.js +0 -71
- package/dist/nodes/three/camera-nodes.js.map +0 -1
- package/dist/nodes/three/canvas3d-node.d.ts +0 -270
- package/dist/nodes/three/canvas3d-node.d.ts.map +0 -1
- package/dist/nodes/three/canvas3d-node.js +0 -438
- package/dist/nodes/three/canvas3d-node.js.map +0 -1
- package/dist/nodes/three/drawable-nodes.d.ts +0 -159
- package/dist/nodes/three/drawable-nodes.d.ts.map +0 -1
- package/dist/nodes/three/drawable-nodes.js +0 -254
- package/dist/nodes/three/drawable-nodes.js.map +0 -1
- package/dist/nodes/three/environment-nodes.d.ts +0 -100
- 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.map +0 -1
- 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.map +0 -1
- 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 -70
- package/dist/tween/seekable.d.ts.map +0 -1
- package/dist/tween/seekable.js +0 -122
- package/dist/tween/seekable.js.map +0 -1
- /package/dist/{nodes → components/builtins}/text/number-pattern.d.ts +0 -0
- /package/dist/{nodes → components/builtins}/text/number-pattern.js +0 -0
- /package/dist/{nodes → components/trees}/node/node-editor-state.d.ts +0 -0
- /package/dist/{nodes → components/trees}/node/node-editor-state.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchors.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/anchors.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI9C,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,8EAA8E;AAE9E,qEAAqE;AACrE,SAAS,SAAS,CAAC,CAAU,EAAE,CAAU;IACrC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAA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C,KAAK,CAAC,CAAC,CAAC;QACrD,CAAC,EAAE,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;KACxD,CAAC;AACN,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CACjB,IAAgB,EAAE,EAAc,EAAE,CAAS;IAE3C,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,IAAI,EAAE,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO;YACH,IAAI;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;YACxE,EAAE;SACL,CAAC;IACN,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,YAAY,CAChC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,EAC5B,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,KAAK,EACvB,EAAE,CAAC,KAAK,EACR,CAAC,CACJ,CAAC;IACF,OAAO;QACH,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACtC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;QACpE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE;KACrC,CAAC;AACN,CAAC","sourcesContent":["/**\n * The editable vector model — subpaths of anchors, each carrying the two bezier\n * handles that govern the segments either side of it — and the unit box it is\n * quoted against. Figma's vector model, and what a person actually drags.\n *\n * The **second** of the two boundaries where geometry is deliberately flattened\n * to one curve type. An arc has no handles to drag, so it becomes cubics on the\n * way in — a conversion, where it used to be a truncation: `A` was missing from\n * the old parser's letter list, so it stopped dead at the first arc and\n * everything after it disappeared. Real-world icons draw their rounded joins\n * with arcs, so pasting one in lost most of the shape.\n *\n * **The coordinate space is the node's own box**: `x` and `y` run -0.5 to +0.5\n * across its width and height, y pointing *down* the way SVG's does. Resizing is\n * then an ordinary width/height drag, because the geometry is a fraction of the\n * box rather than a pixel count inside it — no gizmo code has to know a path\n * from a rect. Points *may* sit outside it: a point dragged past an edge is\n * honest about where it was dropped, and {@link normalize} pulls the\n * box back around the geometry once, on the way out of an edit.\n */\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { arcSweepToCubics, cubicAxis, cubicExtrema, quadToCubic, splitCubicAt } from \"./bezier\";\nimport { contours, segmentArc } from \"./walk\";\nimport type { Extents } from \"@/layout/bounds\";\nimport type { Cubic, PathAnchor, PathContour, PathNormalization, PathSubpath, VectorPath } from \"./types\";\n\n/** An empty path, as the value an unset `data` field resolves to. */\nexport const EMPTY_PATH_DATA = \"\";\n\n// ── Reading ────────────────────────────────────────────────────────────────\n\n/** Whether two points are the same to within serialization noise. */\nfunction samePoint(a: Vector2, b: Vector2): boolean {\n return Math.abs(a.x - b.x) < 1e-6 && Math.abs(a.y - b.y) < 1e-6;\n}\n\n/**\n * Marks a subpath closed, folding a duplicated last anchor into the first.\n *\n * A `d` string that ends `… L 0 0 Z` — which every serializer that closes\n * explicitly produces, ours included when a closing segment carries handles —\n * names the start point twice: once as the last `L`/`C` target and once\n * implicitly by `Z`. Left alone, the round trip would grow an anchor on every\n * load, which is the kind of drift that only shows up after a file has been\n * opened a hundred times.\n */\nfunction closeSubpath(subpath: PathSubpath): void {\n subpath.closed = true;\n const { anchors } = subpath;\n if (anchors.length < 2) return;\n const first = anchors[0];\n const last = anchors[anchors.length - 1];\n if (!samePoint(first.point, last.point)) return;\n // The closing segment's own curvature belongs to the join, so the duplicate's\n // in-handle becomes the first anchor's.\n first.inHandle = last.inHandle;\n anchors.pop();\n}\n\nfunction contourToSubpath(contour: PathContour): PathSubpath {\n const anchors: PathAnchor[] = [\n { point: contour.start, inHandle: null, outHandle: null },\n ];\n const curve = (cubic: Cubic) => {\n anchors[anchors.length - 1].outHandle = cubic.c1;\n anchors.push({ point: cubic.p1, inHandle: cubic.c2, outHandle: null });\n };\n\n for (const segment of contour.segments) {\n switch (segment.kind) {\n case \"line\":\n // Both handles stay null, which is what draws a straight segment.\n anchors.push({ point: segment.to, inHandle: null, outHandle: null });\n break;\n case \"cubic\":\n curve({ p0: segment.from, c1: segment.c1, c2: segment.c2, p1: segment.to });\n break;\n case \"quad\":\n curve(quadToCubic(segment.from, segment.c, segment.to));\n break;\n case \"arc\": {\n const arc = segmentArc(segment);\n for (const cubic of arcSweepToCubics(arc, arc.theta1, arc.theta1 + arc.dtheta)) {\n curve(cubic);\n }\n break;\n }\n }\n }\n\n const subpath: PathSubpath = { anchors, closed: false };\n if (contour.closed) closeSubpath(subpath);\n return subpath;\n}\n\n/**\n * Any {@link PathData} as the editable model.\n *\n * Takes `PathData`, not a string. The old entry point took only a string and\n * every caller had to guard — `typeof data === \"string\" ? data : \"\"` — which\n * meant a node animating its `data` drew *nothing* for the whole tween, because\n * a morph hands over a `PathCommand[]` at every `t` strictly between 0 and 1.\n */\nexport function anchors(d: PathData | null | undefined): VectorPath {\n return contours(d)\n .map(contourToSubpath)\n .filter((subpath) => subpath.anchors.length > 0);\n}\n\n// ── Writing ────────────────────────────────────────────────────────────────\n\n/**\n * How many decimals a stored coordinate keeps.\n *\n * The space is the unit box, so a coordinate is a fraction of the node's size:\n * five decimals is sub-pixel on a 10,000px node and keeps the string short\n * enough that a path is a sane thing to hold in a JSON column. It also makes the\n * round trip *stable* — a drag that lands where it started re-serializes to the\n * identical string, which is what lets an editor tell \"nothing changed\" from\n * \"changed by a rounding error\".\n */\nconst COORD_PRECISION = 5;\n\nfunction fmt(value: number): string {\n if (!Number.isFinite(value)) return \"0\";\n const rounded = Number(value.toFixed(COORD_PRECISION));\n // `-0` serializes as \"0\": the two are the same point, and a sign that flips\n // with the wind would make the \"did anything change\" comparison lie.\n return String(rounded === 0 ? 0 : rounded);\n}\n\n/**\n * What one segment between two anchors *is* — a line, or a cubic and its\n * controls.\n *\n * The decision lived twice, once per output format: `segmentData` wrote it as a\n * `d` string and `pushSegment` as a `PathCommand`, with the same rule about a\n * missing handle standing in as its own anchor written out both times.\n */\nfunction segmentBetween(from: PathAnchor, to: PathAnchor):\n | { line: true; to: Vector2 }\n | { line: false; c1: Vector2; c2: Vector2; to: Vector2 } {\n if (from.outHandle === null && to.inHandle === null) {\n return { line: true, to: to.point };\n }\n // A missing handle stands in as its own anchor, which is the degenerate cubic\n // that draws as a straight pull towards the other end — the same thing every\n // vector editor means by \"one side of this segment is a curve\".\n return {\n line: false,\n c1: from.outHandle ?? from.point,\n c2: to.inHandle ?? to.point,\n to: to.point,\n };\n}\n\n/**\n * Serializes the model back to a `d` string.\n *\n * Only `M`, `L`, `C` and `Z` are emitted — the four commands the editor can\n * round-trip — so what is stored is always what can be edited.\n */\nexport function fromAnchors(path: VectorPath): string {\n const parts: string[] = [];\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n parts.push(`M ${fmt(anchors[0].point.x)} ${fmt(anchors[0].point.y)}`);\n for (let i = 1; i < anchors.length; i++) {\n const segment = segmentBetween(anchors[i - 1], anchors[i]);\n parts.push(segment.line\n ? `L ${fmt(segment.to.x)} ${fmt(segment.to.y)}`\n : `C ${fmt(segment.c1.x)} ${fmt(segment.c1.y)} ${fmt(segment.c2.x)} ${fmt(segment.c2.y)} ${fmt(segment.to.x)} ${fmt(segment.to.y)}`);\n }\n if (closed) {\n if (anchors.length > 1) {\n const join = segmentBetween(anchors[anchors.length - 1], anchors[0]);\n // A straight closing segment is what `Z` already draws, so emitting\n // it as well would add the duplicate anchor `closeSubpath` undoes.\n if (!join.line) {\n parts.push(`C ${fmt(join.c1.x)} ${fmt(join.c1.y)} ${fmt(join.c2.x)} ${fmt(join.c2.y)} ${fmt(join.to.x)} ${fmt(join.to.y)}`);\n }\n }\n parts.push(\"Z\");\n }\n }\n return parts.join(\" \");\n}\n\nconst identity = (point: Vector2): Vector2 => point;\n\n/**\n * The model as drawable commands, with a transform folded into the same pass.\n *\n * Every caller needs one — unit box → the node's laid-out pixels, and y-down →\n * the renderer's y-up — and doing it here means one allocation per frame instead\n * of two, on a list rebuilt every time the node repaints.\n */\nexport function anchorCommands(\n path: VectorPath,\n transform: (point: Vector2) => Vector2 = identity,\n): PathCommand[] {\n const out: PathCommand[] = [];\n const emit = (from: PathAnchor, to: PathAnchor) => {\n const segment = segmentBetween(from, to);\n const end = transform(segment.to);\n if (segment.line) {\n out.push({ type: \"L\", x: end.x, y: end.y });\n return;\n }\n const c1 = transform(segment.c1);\n const c2 = transform(segment.c2);\n out.push({ type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y });\n };\n\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n const start = transform(anchors[0].point);\n out.push({ type: \"M\", x: start.x, y: start.y });\n for (let i = 1; i < anchors.length; i++) emit(anchors[i - 1], anchors[i]);\n if (closed) {\n if (anchors.length > 1) {\n const from = anchors[anchors.length - 1];\n const to = anchors[0];\n if (from.outHandle !== null || to.inHandle !== null) emit(from, to);\n }\n out.push({ type: \"Z\" });\n }\n }\n return out;\n}\n\n// ── Measuring ──────────────────────────────────────────────────────────────\n\n/**\n * The path's tight bounding box, or `null` when it has no points.\n *\n * Tight, not the handle polygon's hull: a cubic's own extrema are solved for,\n * because the handles can sit a long way outside the curve and a box derived\n * from them would leave a visible gap between a normalized shape and the edge of\n * its node.\n */\nexport function anchorBounds(path: VectorPath): Extents | null {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n let seen = false;\n\n const includeX = (x: number) => { seen = true; if (x < minX) minX = x; if (x > maxX) maxX = x; };\n const includeY = (y: number) => { seen = true; if (y < minY) minY = y; if (y > maxY) maxY = y; };\n\n for (const { anchors, closed } of path) {\n for (const anchor of anchors) {\n includeX(anchor.point.x);\n includeY(anchor.point.y);\n }\n const last = closed ? anchors.length : anchors.length - 1;\n for (let i = 0; i < last; i++) {\n const from = anchors[i];\n const to = anchors[(i + 1) % anchors.length];\n if (from.outHandle === null && to.inHandle === null) continue;\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n for (const t of cubicExtrema(from.point.x, c1.x, c2.x, to.point.x)) {\n includeX(cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x));\n }\n for (const t of cubicExtrema(from.point.y, c1.y, c2.y, to.point.y)) {\n includeY(cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y));\n }\n }\n }\n\n return seen ? { minX, minY, maxX, maxY } : null;\n}\n\n// ── Transforming ───────────────────────────────────────────────────────────\n\n/** Applies `fn` to every point and handle, returning a new path. */\nexport function map(path: VectorPath, fn: (point: Vector2) => Vector2): VectorPath {\n return path.map((subpath) => ({\n closed: subpath.closed,\n anchors: subpath.anchors.map((anchor) => ({\n point: fn(anchor.point),\n inHandle: anchor.inHandle ? fn(anchor.inHandle) : null,\n outHandle: anchor.outHandle ? fn(anchor.outHandle) : null,\n })),\n }));\n}\n\n/**\n * The turn-and-scale about `start` that carries `end` onto `to` — how `moveTo`\n * fits a path aimed at another node. Where `start` and `end` coincide there is\n * no chord to turn, so it translates instead.\n */\nexport function endFit(start: Vector2, end: Vector2, to: Vector2): (point: Vector2) => Vector2 {\n const cx = end.x - start.x;\n const cy = end.y - start.y;\n const chord = cx * cx + cy * cy;\n if (chord < 1e-12) {\n const dx = to.x - end.x;\n const dy = to.y - end.y;\n return (p) => ({ x: p.x + dx, y: p.y + dy });\n }\n // (to - start) / (end - start) as complex numbers: a rotation and a uniform scale.\n const tx = to.x - start.x;\n const ty = to.y - start.y;\n const re = (tx * cx + ty * cy) / chord;\n const im = (ty * cx - tx * cy) / chord;\n return (p) => {\n const ux = p.x - start.x;\n const uy = p.y - start.y;\n return { x: start.x + re * ux - im * uy, y: start.y + im * ux + re * uy };\n };\n}\n\n/** Whether a path would draw anything at all. */\nexport function isEmpty(path: VectorPath): boolean {\n return path.every((subpath) => subpath.anchors.length < 2);\n}\n\n/**\n * The unit box's extent — the node's own layout rect, as a fraction of itself.\n *\n * Exported because two very different callers need the same half: a renderer\n * scales by the extent (1 unit = the node's full width), and an editor projects\n * a screen point into it.\n */\nexport const PATH_UNIT_EXTENT = 1;\n\n/** Half of {@link PATH_UNIT_EXTENT} — the distance from the centre to an edge. */\nexport const PATH_UNIT_HALF = PATH_UNIT_EXTENT / 2;\n\n/**\n * The box a path's coordinates are already quoted against — the node's own\n * frame, as {@link PATH_UNIT_HALF} either side of centre.\n */\nexport const UNIT_PATH_BOX: Extents = {\n minX: -PATH_UNIT_HALF,\n minY: -PATH_UNIT_HALF,\n maxX: PATH_UNIT_HALF,\n maxY: PATH_UNIT_HALF,\n};\n\n/**\n * Pulls the unit box back around the geometry.\n *\n * What an editor runs on the way *out* of a path edit, and the reason a node\n * whose points were dragged all over the canvas still ends up with a selection\n * box that hugs it. The caller pairs it with the node's own size and position:\n * the box grows by `scaleX`/`scaleY` and moves by `centerX`/`centerY` scaled\n * into the node's parent, so the drawing doesn't shift on screen while its frame\n * changes underneath it.\n */\nexport function normalize(path: VectorPath): PathNormalization {\n const bounds = anchorBounds(path);\n if (!bounds) return { path, scaleX: 1, scaleY: 1, centerX: 0, centerY: 0 };\n return fitToBox(path, bounds);\n}\n\n/**\n * Re-quotes a path against `box` — the general form of\n * {@link normalize}, which is this with the geometry's own bounds.\n *\n * The two callers want the same arithmetic for opposite reasons. A canvas editor\n * fits the box to the drawing on the way out, so a node drawn in a corner of its\n * frame ends up with a frame that hugs it. An appearance dialog lets the frame\n * be **stated** instead — dragged wider than the drawing to leave a margin, or\n * slid so the drawing sits off-centre — and then fits to that.\n *\n * A degenerate axis — every point on one line, which is a perfectly reasonable\n * thing to draw — keeps its scale at 1 rather than dividing by zero, so a flat\n * path stays where it is instead of becoming NaN.\n */\nexport function fitToBox(path: VectorPath, box: Extents): PathNormalization {\n const width = box.maxX - box.minX;\n const height = box.maxY - box.minY;\n const centerX = (box.minX + box.maxX) / 2;\n const centerY = (box.minY + box.maxY) / 2;\n const scaleX = width > 1e-9 ? width / PATH_UNIT_EXTENT : 1;\n const scaleY = height > 1e-9 ? height / PATH_UNIT_EXTENT : 1;\n\n return {\n path: map(path, (p) => ({\n x: (p.x - centerX) / scaleX,\n y: (p.y - centerY) / scaleY,\n })),\n scaleX,\n scaleY,\n centerX,\n centerY,\n };\n}\n\n/** Moves every point and handle by the same delta. */\nexport function translate(path: VectorPath, delta: Vector2): VectorPath {\n return map(path, (p) => ({ x: p.x + delta.x, y: p.y + delta.y }));\n}\n\n/**\n * A point on the segment between two anchors, at parameter `t`.\n *\n * An editor needs it twice over: to find where on a segment a click landed (so a\n * double-click can insert an anchor there), and to draw the preview of the\n * anchor that insertion would create.\n */\nexport function pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2 {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n x: from.point.x + (to.point.x - from.point.x) * t,\n y: from.point.y + (to.point.y - from.point.y) * t,\n };\n }\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n return {\n x: cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x),\n y: cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y),\n };\n}\n\n/**\n * Splits the segment between two anchors at `t`, returning the three anchors\n * that replace them — the two ends with their outer handles shortened, and the\n * new anchor in the middle carrying both halves of the split tangent.\n *\n * De Casteljau, which is what makes the insertion *invisible*: the curve through\n * the new point is the same curve, so double-clicking a segment adds somewhere\n * to grab rather than changing the shape under the pointer.\n */\nexport function split(\n from: PathAnchor, to: PathAnchor, t: number,\n): { from: PathAnchor; middle: PathAnchor; to: PathAnchor } {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n from,\n middle: { point: pointOn(from, to, t), inHandle: null, outHandle: null },\n to,\n };\n }\n\n const { left, right } = splitCubicAt(\n from.point,\n from.outHandle ?? from.point,\n to.inHandle ?? to.point,\n to.point,\n t,\n );\n return {\n from: { ...from, outHandle: left.cp1 },\n middle: { point: left.to, inHandle: left.cp2, outHandle: right.cp1 },\n to: { ...to, inHandle: right.cp2 },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"anchors.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/anchors.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI9C,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,8EAA8E;AAE9E,qEAAqE;AACrE,SAAS,SAAS,CAAC,CAAU,EAAE,CAAU;IACrC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AACpE,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,YAAY,CAAC,OAAoB;IACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO;IAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IACzB,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACzC,IA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C,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;KACxD,CAAC;AACN,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,KAAK,CACjB,IAAgB,EAAE,EAAc,EAAE,CAAS;IAE3C,IAAI,IAAI,CAAC,SAAS,KAAK,IAAI,IAAI,EAAE,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;QAClD,OAAO;YACH,IAAI;YACJ,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE;YACxE,EAAE;SACL,CAAC;IACN,CAAC;IAED,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,YAAY,CAChC,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,EAC5B,EAAE,CAAC,QAAQ,IAAI,EAAE,CAAC,KAAK,EACvB,EAAE,CAAC,KAAK,EACR,CAAC,CACJ,CAAC;IACF,OAAO;QACH,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACtC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,GAAG,EAAE;QACpE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE;KACrC,CAAC;AACN,CAAC","sourcesContent":["/**\n * The editable vector model — subpaths of anchors, each carrying the two bezier\n * handles that govern the segments either side of it — and the unit box it is\n * quoted against. Figma's vector model, and what a person actually drags.\n *\n * The **second** of the two boundaries where geometry is deliberately flattened\n * to one curve type. An arc has no handles to drag, so it becomes cubics on the\n * way in — a conversion, where it used to be a truncation: `A` was missing from\n * the old parser's letter list, so it stopped dead at the first arc and\n * everything after it disappeared. Real-world icons draw their rounded joins\n * with arcs, so pasting one in lost most of the shape.\n *\n * **The coordinate space is the node's own box**: `x` and `y` run -0.5 to +0.5\n * across its width and height, y pointing *down* the way SVG's does. Resizing is\n * then an ordinary width/height drag, because the geometry is a fraction of the\n * box rather than a pixel count inside it — no gizmo code has to know a path\n * from a rect. Points *may* sit outside it: a point dragged past an edge is\n * honest about where it was dropped, and {@link normalize} pulls the\n * box back around the geometry once, on the way out of an edit.\n */\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { arcSweepToCubics, cubicAxis, cubicExtrema, quadToCubic, splitCubicAt } from \"./bezier\";\nimport { contours, segmentArc } from \"./walk\";\nimport type { Extents } from \"@/layout/bounds\";\nimport type { Cubic, PathAnchor, PathContour, PathNormalization, PathSubpath, VectorPath } from \"./types\";\n\n/** An empty path, as the value an unset `data` field resolves to. */\nexport const EMPTY_PATH_DATA = \"\";\n\n// ── Reading ────────────────────────────────────────────────────────────────\n\n/** Whether two points are the same to within serialization noise. */\nfunction samePoint(a: Vector2, b: Vector2): boolean {\n return Math.abs(a.x - b.x) < 1e-6 && Math.abs(a.y - b.y) < 1e-6;\n}\n\n/**\n * Marks a subpath closed, folding a duplicated last anchor into the first.\n *\n * A `d` string that ends `… L 0 0 Z` — which every serializer that closes\n * explicitly produces, ours included when a closing segment carries handles —\n * names the start point twice: once as the last `L`/`C` target and once\n * implicitly by `Z`. Left alone, the round trip would grow an anchor on every\n * load, which is the kind of drift that only shows up after a file has been\n * opened a hundred times.\n */\nfunction closeSubpath(subpath: PathSubpath): void {\n subpath.closed = true;\n const { anchors } = subpath;\n if (anchors.length < 2) return;\n const first = anchors[0];\n const last = anchors[anchors.length - 1];\n if (!samePoint(first.point, last.point)) return;\n // The closing segment's own curvature belongs to the join, so the duplicate's\n // in-handle becomes the first anchor's.\n first.inHandle = last.inHandle;\n anchors.pop();\n}\n\n/** A copy of a point of the memoized contour — the model is edited in place. */\nconst copy = (v: Vector2): Vector2 => ({ x: v.x, y: v.y });\n\nfunction contourToSubpath(contour: PathContour): PathSubpath {\n // Every point and handle is copied out of the memoized contour: `contours`\n // shares its result between callers, and an editor moves these in place.\n const anchors: PathAnchor[] = [\n { point: copy(contour.start), inHandle: null, outHandle: null },\n ];\n const curve = (cubic: Cubic) => {\n anchors[anchors.length - 1].outHandle = copy(cubic.c1);\n anchors.push({ point: copy(cubic.p1), inHandle: copy(cubic.c2), outHandle: null });\n };\n\n for (const segment of contour.segments) {\n switch (segment.kind) {\n case \"line\":\n // Both handles stay null, which is what draws a straight segment.\n anchors.push({ point: copy(segment.to), inHandle: null, outHandle: null });\n break;\n case \"cubic\":\n curve({ p0: segment.from, c1: segment.c1, c2: segment.c2, p1: segment.to });\n break;\n case \"quad\":\n curve(quadToCubic(segment.from, segment.c, segment.to));\n break;\n case \"arc\": {\n const arc = segmentArc(segment);\n for (const cubic of arcSweepToCubics(arc, arc.theta1, arc.theta1 + arc.dtheta)) {\n curve(cubic);\n }\n break;\n }\n }\n }\n\n const subpath: PathSubpath = { anchors, closed: false };\n if (contour.closed) closeSubpath(subpath);\n return subpath;\n}\n\n/**\n * Any {@link PathData} as the editable model.\n *\n * Takes `PathData`, not a string. The old entry point took only a string and\n * every caller had to guard — `typeof data === \"string\" ? data : \"\"` — which\n * meant a node animating its `data` drew *nothing* for the whole tween, because\n * a morph hands over a `PathCommand[]` at every `t` strictly between 0 and 1.\n */\nexport function anchors(d: PathData | null | undefined): VectorPath {\n return contours(d)\n .map(contourToSubpath)\n .filter((subpath) => subpath.anchors.length > 0);\n}\n\n// ── Writing ────────────────────────────────────────────────────────────────\n\n/**\n * How many decimals a stored coordinate keeps.\n *\n * The space is the unit box, so a coordinate is a fraction of the node's size:\n * five decimals is sub-pixel on a 10,000px node and keeps the string short\n * enough that a path is a sane thing to hold in a JSON column. It also makes the\n * round trip *stable* — a drag that lands where it started re-serializes to the\n * identical string, which is what lets an editor tell \"nothing changed\" from\n * \"changed by a rounding error\".\n */\nconst COORD_PRECISION = 5;\n\nfunction fmt(value: number): string {\n if (!Number.isFinite(value)) return \"0\";\n const rounded = Number(value.toFixed(COORD_PRECISION));\n // `-0` serializes as \"0\": the two are the same point, and a sign that flips\n // with the wind would make the \"did anything change\" comparison lie.\n return String(rounded === 0 ? 0 : rounded);\n}\n\n/**\n * What one segment between two anchors *is* — a line, or a cubic and its\n * controls.\n *\n * The decision lived twice, once per output format: `segmentData` wrote it as a\n * `d` string and `pushSegment` as a `PathCommand`, with the same rule about a\n * missing handle standing in as its own anchor written out both times.\n */\nfunction segmentBetween(from: PathAnchor, to: PathAnchor):\n | { line: true; to: Vector2 }\n | { line: false; c1: Vector2; c2: Vector2; to: Vector2 } {\n if (from.outHandle === null && to.inHandle === null) {\n return { line: true, to: to.point };\n }\n // A missing handle stands in as its own anchor, which is the degenerate cubic\n // that draws as a straight pull towards the other end — the same thing every\n // vector editor means by \"one side of this segment is a curve\".\n return {\n line: false,\n c1: from.outHandle ?? from.point,\n c2: to.inHandle ?? to.point,\n to: to.point,\n };\n}\n\n/**\n * Serializes the model back to a `d` string.\n *\n * Only `M`, `L`, `C` and `Z` are emitted — the four commands the editor can\n * round-trip — so what is stored is always what can be edited.\n */\nexport function fromAnchors(path: VectorPath): string {\n const parts: string[] = [];\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n parts.push(`M ${fmt(anchors[0].point.x)} ${fmt(anchors[0].point.y)}`);\n for (let i = 1; i < anchors.length; i++) {\n const segment = segmentBetween(anchors[i - 1], anchors[i]);\n parts.push(segment.line\n ? `L ${fmt(segment.to.x)} ${fmt(segment.to.y)}`\n : `C ${fmt(segment.c1.x)} ${fmt(segment.c1.y)} ${fmt(segment.c2.x)} ${fmt(segment.c2.y)} ${fmt(segment.to.x)} ${fmt(segment.to.y)}`);\n }\n if (closed) {\n if (anchors.length > 1) {\n const join = segmentBetween(anchors[anchors.length - 1], anchors[0]);\n // A straight closing segment is what `Z` already draws, so emitting\n // it as well would add the duplicate anchor `closeSubpath` undoes.\n if (!join.line) {\n parts.push(`C ${fmt(join.c1.x)} ${fmt(join.c1.y)} ${fmt(join.c2.x)} ${fmt(join.c2.y)} ${fmt(join.to.x)} ${fmt(join.to.y)}`);\n }\n }\n parts.push(\"Z\");\n }\n }\n return parts.join(\" \");\n}\n\nconst identity = (point: Vector2): Vector2 => point;\n\n/**\n * The model as drawable commands, with a transform folded into the same pass.\n *\n * Every caller needs one — unit box → the node's laid-out pixels, and y-down →\n * the renderer's y-up — and doing it here means one allocation per frame instead\n * of two, on a list rebuilt every time the node repaints.\n */\nexport function anchorCommands(\n path: VectorPath,\n transform: (point: Vector2) => Vector2 = identity,\n): PathCommand[] {\n const out: PathCommand[] = [];\n const emit = (from: PathAnchor, to: PathAnchor) => {\n const segment = segmentBetween(from, to);\n const end = transform(segment.to);\n if (segment.line) {\n out.push({ type: \"L\", x: end.x, y: end.y });\n return;\n }\n const c1 = transform(segment.c1);\n const c2 = transform(segment.c2);\n out.push({ type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y });\n };\n\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n const start = transform(anchors[0].point);\n out.push({ type: \"M\", x: start.x, y: start.y });\n for (let i = 1; i < anchors.length; i++) emit(anchors[i - 1], anchors[i]);\n if (closed) {\n if (anchors.length > 1) {\n const from = anchors[anchors.length - 1];\n const to = anchors[0];\n if (from.outHandle !== null || to.inHandle !== null) emit(from, to);\n }\n out.push({ type: \"Z\" });\n }\n }\n return out;\n}\n\n// ── Measuring ──────────────────────────────────────────────────────────────\n\n/**\n * The path's tight bounding box, or `null` when it has no points.\n *\n * Tight, not the handle polygon's hull: a cubic's own extrema are solved for,\n * because the handles can sit a long way outside the curve and a box derived\n * from them would leave a visible gap between a normalized shape and the edge of\n * its node.\n */\nexport function anchorBounds(path: VectorPath): Extents | null {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n let seen = false;\n\n const includeX = (x: number) => { seen = true; if (x < minX) minX = x; if (x > maxX) maxX = x; };\n const includeY = (y: number) => { seen = true; if (y < minY) minY = y; if (y > maxY) maxY = y; };\n\n for (const { anchors, closed } of path) {\n for (const anchor of anchors) {\n includeX(anchor.point.x);\n includeY(anchor.point.y);\n }\n // The closing join exists only with a second anchor to join: the writers\n // emit none for a lone one (`M x y Z` draws nothing), so its self-loop\n // must not widen the box either.\n const last = closed && anchors.length > 1 ? anchors.length : anchors.length - 1;\n for (let i = 0; i < last; i++) {\n const from = anchors[i];\n const to = anchors[(i + 1) % anchors.length];\n if (from.outHandle === null && to.inHandle === null) continue;\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n for (const t of cubicExtrema(from.point.x, c1.x, c2.x, to.point.x)) {\n includeX(cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x));\n }\n for (const t of cubicExtrema(from.point.y, c1.y, c2.y, to.point.y)) {\n includeY(cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y));\n }\n }\n }\n\n return seen ? { minX, minY, maxX, maxY } : null;\n}\n\n// ── Transforming ───────────────────────────────────────────────────────────\n\n/** Applies `fn` to every point and handle, returning a new path. */\nexport function map(path: VectorPath, fn: (point: Vector2) => Vector2): VectorPath {\n return path.map((subpath) => ({\n closed: subpath.closed,\n anchors: subpath.anchors.map((anchor) => ({\n point: fn(anchor.point),\n inHandle: anchor.inHandle ? fn(anchor.inHandle) : null,\n outHandle: anchor.outHandle ? fn(anchor.outHandle) : null,\n })),\n }));\n}\n\n/**\n * The turn-and-scale about `start` that carries `end` onto `to` — how `moveTo`\n * fits a path aimed at another node. Where `start` and `end` coincide there is\n * no chord to turn, so it translates instead.\n */\nexport function endFit(start: Vector2, end: Vector2, to: Vector2): (point: Vector2) => Vector2 {\n const cx = end.x - start.x;\n const cy = end.y - start.y;\n const chord = cx * cx + cy * cy;\n if (chord < 1e-12) {\n const dx = to.x - end.x;\n const dy = to.y - end.y;\n return (p) => ({ x: p.x + dx, y: p.y + dy });\n }\n // (to - start) / (end - start) as complex numbers: a rotation and a uniform scale.\n const tx = to.x - start.x;\n const ty = to.y - start.y;\n const re = (tx * cx + ty * cy) / chord;\n const im = (ty * cx - tx * cy) / chord;\n return (p) => {\n const ux = p.x - start.x;\n const uy = p.y - start.y;\n return { x: start.x + re * ux - im * uy, y: start.y + im * ux + re * uy };\n };\n}\n\n/** Whether a path would draw anything at all. */\nexport function isEmpty(path: VectorPath): boolean {\n return path.every((subpath) => subpath.anchors.length < 2);\n}\n\n/**\n * The unit box's extent — the node's own layout rect, as a fraction of itself.\n *\n * Exported because two very different callers need the same half: a renderer\n * scales by the extent (1 unit = the node's full width), and an editor projects\n * a screen point into it.\n */\nexport const PATH_UNIT_EXTENT = 1;\n\n/** Half of {@link PATH_UNIT_EXTENT} — the distance from the centre to an edge. */\nexport const PATH_UNIT_HALF = PATH_UNIT_EXTENT / 2;\n\n/**\n * The box a path's coordinates are already quoted against — the node's own\n * frame, as {@link PATH_UNIT_HALF} either side of centre.\n */\nexport const UNIT_PATH_BOX: Extents = {\n minX: -PATH_UNIT_HALF,\n minY: -PATH_UNIT_HALF,\n maxX: PATH_UNIT_HALF,\n maxY: PATH_UNIT_HALF,\n};\n\n/**\n * Pulls the unit box back around the geometry.\n *\n * What an editor runs on the way *out* of a path edit, and the reason a node\n * whose points were dragged all over the canvas still ends up with a selection\n * box that hugs it. The caller pairs it with the node's own size and position:\n * the box grows by `scaleX`/`scaleY` and moves by `centerX`/`centerY` scaled\n * into the node's parent, so the drawing doesn't shift on screen while its frame\n * changes underneath it.\n */\nexport function normalize(path: VectorPath): PathNormalization {\n const bounds = anchorBounds(path);\n if (!bounds) return { path, scaleX: 1, scaleY: 1, centerX: 0, centerY: 0 };\n return fitToBox(path, bounds);\n}\n\n/**\n * Re-quotes a path against `box` — the general form of\n * {@link normalize}, which is this with the geometry's own bounds.\n *\n * The two callers want the same arithmetic for opposite reasons. A canvas editor\n * fits the box to the drawing on the way out, so a node drawn in a corner of its\n * frame ends up with a frame that hugs it. An appearance dialog lets the frame\n * be **stated** instead — dragged wider than the drawing to leave a margin, or\n * slid so the drawing sits off-centre — and then fits to that.\n *\n * A degenerate axis — every point on one line, which is a perfectly reasonable\n * thing to draw — keeps its scale at 1 rather than dividing by zero, so a flat\n * path stays where it is instead of becoming NaN.\n */\nexport function fitToBox(path: VectorPath, box: Extents): PathNormalization {\n const width = box.maxX - box.minX;\n const height = box.maxY - box.minY;\n const centerX = (box.minX + box.maxX) / 2;\n const centerY = (box.minY + box.maxY) / 2;\n const scaleX = width > 1e-9 ? width / PATH_UNIT_EXTENT : 1;\n const scaleY = height > 1e-9 ? height / PATH_UNIT_EXTENT : 1;\n\n return {\n path: map(path, (p) => ({\n x: (p.x - centerX) / scaleX,\n y: (p.y - centerY) / scaleY,\n })),\n scaleX,\n scaleY,\n centerX,\n centerY,\n };\n}\n\n/** Moves every point and handle by the same delta. */\nexport function translate(path: VectorPath, delta: Vector2): VectorPath {\n return map(path, (p) => ({ x: p.x + delta.x, y: p.y + delta.y }));\n}\n\n/**\n * A point on the segment between two anchors, at parameter `t`.\n *\n * An editor needs it twice over: to find where on a segment a click landed (so a\n * double-click can insert an anchor there), and to draw the preview of the\n * anchor that insertion would create.\n */\nexport function pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2 {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n x: from.point.x + (to.point.x - from.point.x) * t,\n y: from.point.y + (to.point.y - from.point.y) * t,\n };\n }\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n return {\n x: cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x),\n y: cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y),\n };\n}\n\n/**\n * Splits the segment between two anchors at `t`, returning the three anchors\n * that replace them — the two ends with their outer handles shortened, and the\n * new anchor in the middle carrying both halves of the split tangent.\n *\n * De Casteljau, which is what makes the insertion *invisible*: the curve through\n * the new point is the same curve, so double-clicking a segment adds somewhere\n * to grab rather than changing the shape under the pointer.\n */\nexport function split(\n from: PathAnchor, to: PathAnchor, t: number,\n): { from: PathAnchor; middle: PathAnchor; to: PathAnchor } {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n from,\n middle: { point: pointOn(from, to, t), inHandle: null, outHandle: null },\n to,\n };\n }\n\n const { left, right } = splitCubicAt(\n from.point,\n from.outHandle ?? from.point,\n to.inHandle ?? to.point,\n to.point,\n t,\n );\n return {\n from: { ...from, outHandle: left.cp1 },\n middle: { point: left.to, inHandle: left.cp2, outHandle: right.cp1 },\n to: { ...to, inHandle: right.cp2 },\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morph.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,KAAK,EAAS,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"morph.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,KAAK,EAAS,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAC,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,GAAG,YAAY,EAAE,CAgBrE;AAkMD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,SAAS,CAuCtE;AAcD;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,EAAE,CAehE;AAuBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,QAAQ,CAItE"}
|
|
@@ -40,10 +40,22 @@ import { commands, contourSegments, contours, segmentCubics } from "./walk.js";
|
|
|
40
40
|
* where SVG says two.
|
|
41
41
|
*/
|
|
42
42
|
export function cubics(d) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
const out = [];
|
|
44
|
+
for (const contour of contours(d)) {
|
|
45
|
+
// A lone `M` has nothing to interpolate: it draws nothing and has no
|
|
46
|
+
// first anchor to seed a partner from, so it is not a subpath here. It
|
|
47
|
+
// stays in `contours`, where it still occupies a point of the bounds.
|
|
48
|
+
const chain = contourSegments(contour).flatMap(segmentCubics);
|
|
49
|
+
if (chain.length === 0)
|
|
50
|
+
continue;
|
|
51
|
+
// `contours` is memoized and shared, so hand out copies of its points: a
|
|
52
|
+
// caller moving an anchor of the result must not move the cached path.
|
|
53
|
+
out.push({
|
|
54
|
+
cubics: chain.map((c) => ({ p0: { ...c.p0 }, c1: { ...c.c1 }, c2: { ...c.c2 }, p1: { ...c.p1 } })),
|
|
55
|
+
closed: contour.closed,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
47
59
|
}
|
|
48
60
|
/** First anchor of a subpath (the implicit `M` target). */
|
|
49
61
|
function startPoint(cubics) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morph.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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U,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACvC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,IAAc,EAAE,EAAY,EAAE,CAAS;IACxD,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Path morphing — smooth interpolation between two arbitrary path shapes.\n *\n * Lerping two SVG paths command-by-command only works when they happen to share\n * the same command structure; in general one path is a triangle and the other a\n * star with a different number of points, different command types, a different\n * start point, and the opposite winding. Naively pairing commands produces\n * kinks, self-intersections, and points that fly across the canvas.\n *\n * This module reshapes both paths into a common, directly-interpolatable form —\n * the same approach GSAP's MorphSVGPlugin uses:\n *\n * 1. {@link cubics} converts each path into a list of {@link CubicSubpath}s.\n * Every drawing command (L/H/V/Q/A/Z-close) is rewritten as a cubic Bézier, so\n * a subpath becomes a uniform chain of cubics described purely by anchor and\n * control points.\n * 2. {@link plan} pairs the two paths' subpaths (padding the shorter side\n * with degenerate, collapsed subpaths so every subpath has a partner),\n * equalizes the number of cubics in each pair by subdividing the coarser\n * subpath along its perimeter, and — for closed rings — rotates and optionally\n * reverses one ring so the two start at the same place and wind the same way.\n * 3. {@link lerpPathData} samples that aligned correspondence at a given `t`,\n * interpolating every control point with {@link lerpVector2}.\n *\n * The result is a {@link PathCommand} list (one `M` + N `C`s per subpath) that the\n * existing renderer draws unchanged.\n */\nimport { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { distance, cubicPoint } from \"./bezier\";\nimport { commands, contourSegments, contours, segmentCubics } from \"./walk\";\nimport type { Cubic, CubicSubpath, MorphPlan } from \"./types\";\n\n/**\n * A path as cubic subpaths — one of the two boundaries where geometry is\n * deliberately flattened to a single curve type.\n *\n * A morph has to pair segments up and interpolate them, which needs both sides\n * speaking one language, so an arc becomes cubics here (and only here, and in\n * the anchor model). This used to carry the sixth copy of the pen walk; the one\n * thing it got wrong that the shared walk does not is `Z`, which it marked\n * without closing the run — so `M0 0 L10 0 Z L20 0` came back as one subpath\n * where SVG says two.\n */\nexport function cubics(d: PathData | null | undefined): CubicSubpath[] {\n return contours(d).map((contour) => ({\n cubics: contourSegments(contour).flatMap(segmentCubics),\n closed: contour.closed,\n }));\n}\n\n/** First anchor of a subpath (the implicit `M` target). */\nfunction startPoint(cubics: Cubic[]): Vector2 {\n return cubics[0].p0;\n}\n\n/** Approximate length of a cubic by flattening — cheap, used only for weighting. */\nfunction cubicLength(c: Cubic, steps = 8): number {\n let len = 0;\n let prev = c.p0;\n for (let i = 1; i <= steps; i++) {\n const p = cubicPoint(c.p0, c.c1, c.c2, c.p1, i / steps);\n len += distance(prev, p);\n prev = p;\n }\n return len;\n}\n\n/** Centroid of a subpath's anchor points — used to pair subpaths by proximity. */\nfunction centroid(cubics: Cubic[]): Vector2 {\n let x = 0, y = 0;\n for (const c of cubics) { x += c.p0.x; y += c.p0.y; }\n return { x: x / cubics.length, y: y / cubics.length };\n}\n\n// --- Subdivision: grow a subpath to a target number of cubics ---------------\n\n/** Split one cubic at parameter `t` into two cubics tracing the same curve (De Casteljau). */\nfunction splitCubic(c: Cubic, t: number): [Cubic, Cubic] {\n const a = lerpVector2(c.p0, c.c1, t);\n const b = lerpVector2(c.c1, c.c2, t);\n const d = lerpVector2(c.c2, c.p1, t);\n const e = lerpVector2(a, b, t);\n const f = lerpVector2(b, d, t);\n const g = lerpVector2(e, f, t);\n return [\n { p0: c.p0, c1: a, c2: e, p1: g },\n { p0: g, c1: f, c2: d, p1: c.p1 },\n ];\n}\n\n/**\n * Subdivide `cubics` until it has exactly `target` cubics (target ≥ current).\n * Splits are spread across the longest segments first so the added anchor points\n * land roughly evenly along the perimeter — the key to a smooth morph, since each\n * added point becomes a correspondence point with the other shape.\n */\nfunction subdivideTo(cubics: Cubic[], target: number): Cubic[] {\n let work = cubics.slice();\n while (work.length < target) {\n // Find the longest cubic and split it in half.\n let longest = 0;\n let maxLen = -1;\n for (let i = 0; i < work.length; i++) {\n const len = cubicLength(work[i]);\n if (len > maxLen) { maxLen = len; longest = i; }\n }\n const [left, right] = splitCubic(work[longest], 0.5);\n work.splice(longest, 1, left, right);\n }\n return work;\n}\n\n// --- Ring alignment: rotate + reverse a closed subpath ----------------------\n\n/** Reverse a chain of cubics so it traces the same shape in the opposite direction. */\nfunction reverseCubics(cubics: Cubic[]): Cubic[] {\n const out: Cubic[] = [];\n for (let i = cubics.length - 1; i >= 0; i--) {\n const c = cubics[i];\n out.push({ p0: c.p1, c1: c.c2, c2: c.c1, p1: c.p0 });\n }\n return out;\n}\n\n/** Rotate a closed ring so it begins at cubic index `offset` (wraps around). */\nfunction rotateCubics(cubics: Cubic[], offset: number): Cubic[] {\n if (offset === 0) return cubics.slice();\n return cubics.slice(offset).concat(cubics.slice(0, offset));\n}\n\n/** Sum of squared distances between paired anchor points — the alignment cost. */\nfunction anchorCost(a: Cubic[], b: Cubic[]): number {\n let cost = 0;\n for (let i = 0; i < a.length; i++) {\n const dx = a[i].p0.x - b[i].p0.x;\n const dy = a[i].p0.y - b[i].p0.y;\n cost += dx * dx + dy * dy;\n }\n return cost;\n}\n\n/**\n * Align a closed `to` ring against a fixed `from` ring (same cubic count). Tries\n * every rotation offset, in both winding directions, and keeps whichever pairs the\n * anchor points with the least total travel. This is what lets two shapes whose\n * points are listed in any order — or that wind in opposite directions — morph\n * without spinning or folding through themselves.\n */\nfunction alignClosedRing(from: Cubic[], to: Cubic[]): Cubic[] {\n const n = from.length;\n let best = to;\n let bestCost = Infinity;\n\n for (const candidate of [to, reverseCubics(to)]) {\n for (let offset = 0; offset < n; offset++) {\n const rotated = rotateCubics(candidate, offset);\n const cost = anchorCost(from, rotated);\n if (cost < bestCost) {\n bestCost = cost;\n best = rotated;\n }\n }\n }\n return best;\n}\n\n/**\n * For an open subpath, only the winding can be flipped (rotation would change the\n * shape). Pick the direction whose endpoints best match the `from` subpath.\n */\nfunction alignOpenSubpath(from: Cubic[], to: Cubic[]): Cubic[] {\n const reversed = reverseCubics(to);\n return anchorCost(from, to) <= anchorCost(from, reversed) ? to : reversed;\n}\n\n// --- Degenerate subpaths (for count mismatches) -----------------------------\n\n/**\n * A subpath collapsed onto a single point `at`, with `count` zero-length cubics.\n * Pairing a real subpath with one of these makes it grow out of / shrink into a\n * point, which is how added or removed subpaths animate.\n */\nfunction degenerateSubpath(at: Vector2, count: number): Cubic[] {\n const cubics: Cubic[] = [];\n for (let i = 0; i < count; i++) {\n cubics.push({ p0: { ...at }, c1: { ...at }, c2: { ...at }, p1: { ...at } });\n }\n return cubics;\n}\n\n// --- Subpath pairing --------------------------------------------------------\n\n/**\n * Greedily pair `from` subpaths with the nearest unused `to` subpath (by centroid),\n * so morphing maps each shape onto its closest counterpart rather than by list\n * order. Leftover subpaths on either side are paired with a degenerate partner\n * collapsed at their own centroid, so they grow/shrink in place.\n */\nfunction pairSubpaths(\n fromSubs: CubicSubpath[],\n toSubs: CubicSubpath[],\n): Array<{ from: CubicSubpath; to: CubicSubpath }> {\n const pairs: Array<{ from: CubicSubpath; to: CubicSubpath }> = [];\n const toUsed = new Array(toSubs.length).fill(false);\n\n for (const f of fromSubs) {\n const fc = centroid(f.cubics);\n let bestIdx = -1;\n let bestDist = Infinity;\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const d = distance(fc, centroid(toSubs[j].cubics));\n if (d < bestDist) { bestDist = d; bestIdx = j; }\n }\n if (bestIdx >= 0) {\n toUsed[bestIdx] = true;\n pairs.push({ from: f, to: toSubs[bestIdx] });\n } else {\n // No `to` subpath left → collapse to this subpath's own centroid.\n pairs.push({\n from: f,\n to: { cubics: degenerateSubpath(fc, f.cubics.length), closed: f.closed },\n });\n }\n }\n\n // Any unused `to` subpaths grow out of their own centroid.\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const t = toSubs[j];\n const tc = centroid(t.cubics);\n pairs.push({\n from: { cubics: degenerateSubpath(tc, t.cubics.length), closed: t.closed },\n to: t,\n });\n }\n\n return pairs;\n}\n\n// --- Building the morph plan ------------------------------------------------\n\n/**\n * Build a reusable {@link MorphPlan} aligning `from` to `to`. All the expensive\n * work — converting to cubics, pairing subpaths, equalizing counts, and rotating\n * rings — happens here once; {@link sample} then samples it cheaply per frame.\n */\nexport function plan(from: PathCommand[], to: PathCommand[]): MorphPlan {\n const fromSubs = cubics(from);\n const toSubs = cubics(to);\n\n // Both empty → nothing to morph.\n if (fromSubs.length === 0 && toSubs.length === 0) {\n return { pairs: [] };\n }\n\n // One side empty → collapse/grow the other against a point at its start.\n if (fromSubs.length === 0) {\n const seed = startPoint(toSubs[0].cubics);\n fromSubs.push({ cubics: degenerateSubpath(seed, 1), closed: toSubs[0].closed });\n }\n if (toSubs.length === 0) {\n const seed = startPoint(fromSubs[0].cubics);\n toSubs.push({ cubics: degenerateSubpath(seed, 1), closed: fromSubs[0].closed });\n }\n\n const subPairs = pairSubpaths(fromSubs, toSubs);\n\n const pairs = subPairs.map(({ from: f, to: t }) => {\n // Equalize cubic counts by subdividing the coarser side.\n const count = Math.max(f.cubics.length, t.cubics.length);\n const fromCubics = subdivideTo(f.cubics, count);\n let toCubics = subdivideTo(t.cubics, count);\n\n // Align the `to` side to the `from` side so points correspond and travel\n // the shortest path. Closed rings can rotate + reverse; open paths only\n // reverse (rotating an open path would tear it).\n const bothClosed = f.closed && t.closed;\n toCubics = bothClosed\n ? alignClosedRing(fromCubics, toCubics)\n : alignOpenSubpath(fromCubics, toCubics);\n\n return { from: fromCubics, to: toCubics, closed: bothClosed };\n });\n\n return { pairs };\n}\n\n// --- Sampling ---------------------------------------------------------------\n\n/** Interpolate a single cubic's four points. */\nfunction lerpCubic(from: Cubic, to: Cubic, t: number): Cubic {\n return {\n p0: lerpVector2(from.p0, to.p0, t),\n c1: lerpVector2(from.c1, to.c1, t),\n c2: lerpVector2(from.c2, to.c2, t),\n p1: lerpVector2(from.p1, to.p1, t),\n };\n}\n\n/**\n * Sample a {@link MorphPlan} at progress `t` (0 → `from`, 1 → `to`), producing a\n * fresh {@link PathCommand} list: one `M`, one `C` per cubic, and a trailing `Z`\n * for closed subpaths.\n *\n * Closed subpaths emit `Z` rather than a final line back to the start. The ring's\n * last cubic already lands on its first anchor, so `Z` adds no length; what it does\n * is tell the renderer the contour is closed, which is what makes the stroke join\n * cleanly at the seam instead of drawing two unjoined end caps there.\n */\nexport function sample(plan: MorphPlan, t: number): PathCommand[] {\n const out: PathCommand[] = [];\n for (const pair of plan.pairs) {\n const n = pair.from.length;\n if (n === 0) continue;\n const first = lerpCubic(pair.from[0], pair.to[0], t);\n out.push({ type: \"M\", x: first.p0.x, y: first.p0.y });\n out.push({ type: \"C\", x1: first.c1.x, y1: first.c1.y, x2: first.c2.x, y2: first.c2.y, x: first.p1.x, y: first.p1.y });\n for (let i = 1; i < n; i++) {\n const c = lerpCubic(pair.from[i], pair.to[i], t);\n out.push({ type: \"C\", x1: c.c1.x, y1: c.c1.y, x2: c.c2.x, y2: c.c2.y, x: c.p1.x, y: c.p1.y });\n }\n if (pair.closed) out.push({ type: \"Z\" });\n }\n return out;\n}\n\n// --- Public tween entry point ----------------------------------------------\n\n/**\n * The morph plan is built from a `(from, to)` pair, which is constant for the\n * duration of one tween while `t` sweeps 0→1. {@link lerp} is invoked once\n * per frame with that same pair, so we cache the most recent plan to avoid\n * rebuilding it (subdivision + ring alignment is the costly part) every frame.\n * A one-entry cache is enough: tweens run one at a time per property and call us\n * with monotonically advancing `t` against fixed endpoints.\n */\nlet cachedPlan: { from: PathData; to: PathData; plan: MorphPlan } | null = null;\n\nfunction planFor(from: PathData, to: PathData): MorphPlan {\n if (cachedPlan && cachedPlan.from === from && cachedPlan.to === to) {\n return cachedPlan.plan;\n }\n const built = plan(commands(from), commands(to));\n cachedPlan = { from, to, plan: built };\n return built;\n}\n\n/**\n * Smoothly interpolate between two path shapes — the {@link PathData} tween used\n * by `Path`'s animatable `d` property and usable directly as a `LerpFunction`.\n *\n * `from`/`to` may be SVG `d` strings or {@link PathCommand} arrays and need not\n * share structure, command count, subpath count, point order, or winding — the\n * shapes are reconciled into a common cubic correspondence first (see the module\n * overview). At `t = 0` and `t = 1` the endpoints are returned verbatim so the\n * start and end frames are pixel-exact; in between, a morphed command list is\n * produced.\n *\n * @param from Source path (the shape at `t = 0`).\n * @param to Target path (the shape at `t = 1`).\n * @param t Progress in `[0, 1]`.\n */\nexport function lerp(from: PathData, to: PathData, t: number): PathData {\n if (t <= 0) return from;\n if (t >= 1) return to;\n return sample(planFor(from, to), t);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"morph.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/morph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAW,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAG5E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,MAAM,CAAC,CAA8B;IACjD,MAAM,GAAG,GAAmB,EAAE,CAAC;IAC/B,KAAK,MAAM,OAAO,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;QAChC,qEAAqE;QACrE,uEAAuE;QACvE,sEAAsE;QACtE,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACjC,y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,EAAE,CAAC;IACvC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,IAAc,EAAE,EAAY,EAAE,CAAS;IACxD,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACxB,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,EAAE,CAAC;IACtB,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * Path morphing — smooth interpolation between two arbitrary path shapes.\n *\n * Lerping two SVG paths command-by-command only works when they happen to share\n * the same command structure; in general one path is a triangle and the other a\n * star with a different number of points, different command types, a different\n * start point, and the opposite winding. Naively pairing commands produces\n * kinks, self-intersections, and points that fly across the canvas.\n *\n * This module reshapes both paths into a common, directly-interpolatable form —\n * the same approach GSAP's MorphSVGPlugin uses:\n *\n * 1. {@link cubics} converts each path into a list of {@link CubicSubpath}s.\n * Every drawing command (L/H/V/Q/A/Z-close) is rewritten as a cubic Bézier, so\n * a subpath becomes a uniform chain of cubics described purely by anchor and\n * control points.\n * 2. {@link plan} pairs the two paths' subpaths (padding the shorter side\n * with degenerate, collapsed subpaths so every subpath has a partner),\n * equalizes the number of cubics in each pair by subdividing the coarser\n * subpath along its perimeter, and — for closed rings — rotates and optionally\n * reverses one ring so the two start at the same place and wind the same way.\n * 3. {@link lerpPathData} samples that aligned correspondence at a given `t`,\n * interpolating every control point with {@link lerpVector2}.\n *\n * The result is a {@link PathCommand} list (one `M` + N `C`s per subpath) that the\n * existing renderer draws unchanged.\n */\nimport { Vector2, lerpVector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { distance, cubicPoint } from \"./bezier\";\nimport { commands, contourSegments, contours, segmentCubics } from \"./walk\";\nimport type { Cubic, CubicSubpath, MorphPlan } from \"./types\";\n\n/**\n * A path as cubic subpaths — one of the two boundaries where geometry is\n * deliberately flattened to a single curve type.\n *\n * A morph has to pair segments up and interpolate them, which needs both sides\n * speaking one language, so an arc becomes cubics here (and only here, and in\n * the anchor model). This used to carry the sixth copy of the pen walk; the one\n * thing it got wrong that the shared walk does not is `Z`, which it marked\n * without closing the run — so `M0 0 L10 0 Z L20 0` came back as one subpath\n * where SVG says two.\n */\nexport function cubics(d: PathData | null | undefined): CubicSubpath[] {\n const out: CubicSubpath[] = [];\n for (const contour of contours(d)) {\n // A lone `M` has nothing to interpolate: it draws nothing and has no\n // first anchor to seed a partner from, so it is not a subpath here. It\n // stays in `contours`, where it still occupies a point of the bounds.\n const chain = contourSegments(contour).flatMap(segmentCubics);\n if (chain.length === 0) continue;\n // `contours` is memoized and shared, so hand out copies of its points: a\n // caller moving an anchor of the result must not move the cached path.\n out.push({\n cubics: chain.map((c) => ({ p0: { ...c.p0 }, c1: { ...c.c1 }, c2: { ...c.c2 }, p1: { ...c.p1 } })),\n closed: contour.closed,\n });\n }\n return out;\n}\n\n/** First anchor of a subpath (the implicit `M` target). */\nfunction startPoint(cubics: Cubic[]): Vector2 {\n return cubics[0].p0;\n}\n\n/** Approximate length of a cubic by flattening — cheap, used only for weighting. */\nfunction cubicLength(c: Cubic, steps = 8): number {\n let len = 0;\n let prev = c.p0;\n for (let i = 1; i <= steps; i++) {\n const p = cubicPoint(c.p0, c.c1, c.c2, c.p1, i / steps);\n len += distance(prev, p);\n prev = p;\n }\n return len;\n}\n\n/** Centroid of a subpath's anchor points — used to pair subpaths by proximity. */\nfunction centroid(cubics: Cubic[]): Vector2 {\n let x = 0, y = 0;\n for (const c of cubics) { x += c.p0.x; y += c.p0.y; }\n return { x: x / cubics.length, y: y / cubics.length };\n}\n\n// --- Subdivision: grow a subpath to a target number of cubics ---------------\n\n/** Split one cubic at parameter `t` into two cubics tracing the same curve (De Casteljau). */\nfunction splitCubic(c: Cubic, t: number): [Cubic, Cubic] {\n const a = lerpVector2(c.p0, c.c1, t);\n const b = lerpVector2(c.c1, c.c2, t);\n const d = lerpVector2(c.c2, c.p1, t);\n const e = lerpVector2(a, b, t);\n const f = lerpVector2(b, d, t);\n const g = lerpVector2(e, f, t);\n return [\n { p0: c.p0, c1: a, c2: e, p1: g },\n { p0: g, c1: f, c2: d, p1: c.p1 },\n ];\n}\n\n/**\n * Subdivide `cubics` until it has exactly `target` cubics (target ≥ current).\n * Splits are spread across the longest segments first so the added anchor points\n * land roughly evenly along the perimeter — the key to a smooth morph, since each\n * added point becomes a correspondence point with the other shape.\n */\nfunction subdivideTo(cubics: Cubic[], target: number): Cubic[] {\n let work = cubics.slice();\n while (work.length < target) {\n // Find the longest cubic and split it in half.\n let longest = 0;\n let maxLen = -1;\n for (let i = 0; i < work.length; i++) {\n const len = cubicLength(work[i]);\n if (len > maxLen) { maxLen = len; longest = i; }\n }\n const [left, right] = splitCubic(work[longest], 0.5);\n work.splice(longest, 1, left, right);\n }\n return work;\n}\n\n// --- Ring alignment: rotate + reverse a closed subpath ----------------------\n\n/** Reverse a chain of cubics so it traces the same shape in the opposite direction. */\nfunction reverseCubics(cubics: Cubic[]): Cubic[] {\n const out: Cubic[] = [];\n for (let i = cubics.length - 1; i >= 0; i--) {\n const c = cubics[i];\n out.push({ p0: c.p1, c1: c.c2, c2: c.c1, p1: c.p0 });\n }\n return out;\n}\n\n/** Rotate a closed ring so it begins at cubic index `offset` (wraps around). */\nfunction rotateCubics(cubics: Cubic[], offset: number): Cubic[] {\n if (offset === 0) return cubics.slice();\n return cubics.slice(offset).concat(cubics.slice(0, offset));\n}\n\n/** Sum of squared distances between paired anchor points — the alignment cost. */\nfunction anchorCost(a: Cubic[], b: Cubic[]): number {\n let cost = 0;\n for (let i = 0; i < a.length; i++) {\n const dx = a[i].p0.x - b[i].p0.x;\n const dy = a[i].p0.y - b[i].p0.y;\n cost += dx * dx + dy * dy;\n }\n return cost;\n}\n\n/**\n * Align a closed `to` ring against a fixed `from` ring (same cubic count). Tries\n * every rotation offset, in both winding directions, and keeps whichever pairs the\n * anchor points with the least total travel. This is what lets two shapes whose\n * points are listed in any order — or that wind in opposite directions — morph\n * without spinning or folding through themselves.\n */\nfunction alignClosedRing(from: Cubic[], to: Cubic[]): Cubic[] {\n const n = from.length;\n let best = to;\n let bestCost = Infinity;\n\n for (const candidate of [to, reverseCubics(to)]) {\n for (let offset = 0; offset < n; offset++) {\n const rotated = rotateCubics(candidate, offset);\n const cost = anchorCost(from, rotated);\n if (cost < bestCost) {\n bestCost = cost;\n best = rotated;\n }\n }\n }\n return best;\n}\n\n/**\n * For an open subpath, only the winding can be flipped (rotation would change the\n * shape). Pick the direction whose endpoints best match the `from` subpath.\n */\nfunction alignOpenSubpath(from: Cubic[], to: Cubic[]): Cubic[] {\n const reversed = reverseCubics(to);\n return anchorCost(from, to) <= anchorCost(from, reversed) ? to : reversed;\n}\n\n// --- Degenerate subpaths (for count mismatches) -----------------------------\n\n/**\n * A subpath collapsed onto a single point `at`, with `count` zero-length cubics.\n * Pairing a real subpath with one of these makes it grow out of / shrink into a\n * point, which is how added or removed subpaths animate.\n */\nfunction degenerateSubpath(at: Vector2, count: number): Cubic[] {\n const cubics: Cubic[] = [];\n for (let i = 0; i < count; i++) {\n cubics.push({ p0: { ...at }, c1: { ...at }, c2: { ...at }, p1: { ...at } });\n }\n return cubics;\n}\n\n// --- Subpath pairing --------------------------------------------------------\n\n/**\n * Greedily pair `from` subpaths with the nearest unused `to` subpath (by centroid),\n * so morphing maps each shape onto its closest counterpart rather than by list\n * order. Leftover subpaths on either side are paired with a degenerate partner\n * collapsed at their own centroid, so they grow/shrink in place.\n */\nfunction pairSubpaths(\n fromSubs: CubicSubpath[],\n toSubs: CubicSubpath[],\n): Array<{ from: CubicSubpath; to: CubicSubpath }> {\n const pairs: Array<{ from: CubicSubpath; to: CubicSubpath }> = [];\n const toUsed = new Array(toSubs.length).fill(false);\n\n for (const f of fromSubs) {\n const fc = centroid(f.cubics);\n let bestIdx = -1;\n let bestDist = Infinity;\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const d = distance(fc, centroid(toSubs[j].cubics));\n if (d < bestDist) { bestDist = d; bestIdx = j; }\n }\n if (bestIdx >= 0) {\n toUsed[bestIdx] = true;\n pairs.push({ from: f, to: toSubs[bestIdx] });\n } else {\n // No `to` subpath left → collapse to this subpath's own centroid.\n pairs.push({\n from: f,\n to: { cubics: degenerateSubpath(fc, f.cubics.length), closed: f.closed },\n });\n }\n }\n\n // Any unused `to` subpaths grow out of their own centroid.\n for (let j = 0; j < toSubs.length; j++) {\n if (toUsed[j]) continue;\n const t = toSubs[j];\n const tc = centroid(t.cubics);\n pairs.push({\n from: { cubics: degenerateSubpath(tc, t.cubics.length), closed: t.closed },\n to: t,\n });\n }\n\n return pairs;\n}\n\n// --- Building the morph plan ------------------------------------------------\n\n/**\n * Build a reusable {@link MorphPlan} aligning `from` to `to`. All the expensive\n * work — converting to cubics, pairing subpaths, equalizing counts, and rotating\n * rings — happens here once; {@link sample} then samples it cheaply per frame.\n */\nexport function plan(from: PathCommand[], to: PathCommand[]): MorphPlan {\n const fromSubs = cubics(from);\n const toSubs = cubics(to);\n\n // Both empty → nothing to morph.\n if (fromSubs.length === 0 && toSubs.length === 0) {\n return { pairs: [] };\n }\n\n // One side empty → collapse/grow the other against a point at its start.\n if (fromSubs.length === 0) {\n const seed = startPoint(toSubs[0].cubics);\n fromSubs.push({ cubics: degenerateSubpath(seed, 1), closed: toSubs[0].closed });\n }\n if (toSubs.length === 0) {\n const seed = startPoint(fromSubs[0].cubics);\n toSubs.push({ cubics: degenerateSubpath(seed, 1), closed: fromSubs[0].closed });\n }\n\n const subPairs = pairSubpaths(fromSubs, toSubs);\n\n const pairs = subPairs.map(({ from: f, to: t }) => {\n // Equalize cubic counts by subdividing the coarser side.\n const count = Math.max(f.cubics.length, t.cubics.length);\n const fromCubics = subdivideTo(f.cubics, count);\n let toCubics = subdivideTo(t.cubics, count);\n\n // Align the `to` side to the `from` side so points correspond and travel\n // the shortest path. Closed rings can rotate + reverse; open paths only\n // reverse (rotating an open path would tear it).\n const bothClosed = f.closed && t.closed;\n toCubics = bothClosed\n ? alignClosedRing(fromCubics, toCubics)\n : alignOpenSubpath(fromCubics, toCubics);\n\n return { from: fromCubics, to: toCubics, closed: bothClosed };\n });\n\n return { pairs };\n}\n\n// --- Sampling ---------------------------------------------------------------\n\n/** Interpolate a single cubic's four points. */\nfunction lerpCubic(from: Cubic, to: Cubic, t: number): Cubic {\n return {\n p0: lerpVector2(from.p0, to.p0, t),\n c1: lerpVector2(from.c1, to.c1, t),\n c2: lerpVector2(from.c2, to.c2, t),\n p1: lerpVector2(from.p1, to.p1, t),\n };\n}\n\n/**\n * Sample a {@link MorphPlan} at progress `t` (0 → `from`, 1 → `to`), producing a\n * fresh {@link PathCommand} list: one `M`, one `C` per cubic, and a trailing `Z`\n * for closed subpaths.\n *\n * Closed subpaths emit `Z` rather than a final line back to the start. The ring's\n * last cubic already lands on its first anchor, so `Z` adds no length; what it does\n * is tell the renderer the contour is closed, which is what makes the stroke join\n * cleanly at the seam instead of drawing two unjoined end caps there.\n */\nexport function sample(plan: MorphPlan, t: number): PathCommand[] {\n const out: PathCommand[] = [];\n for (const pair of plan.pairs) {\n const n = pair.from.length;\n if (n === 0) continue;\n const first = lerpCubic(pair.from[0], pair.to[0], t);\n out.push({ type: \"M\", x: first.p0.x, y: first.p0.y });\n out.push({ type: \"C\", x1: first.c1.x, y1: first.c1.y, x2: first.c2.x, y2: first.c2.y, x: first.p1.x, y: first.p1.y });\n for (let i = 1; i < n; i++) {\n const c = lerpCubic(pair.from[i], pair.to[i], t);\n out.push({ type: \"C\", x1: c.c1.x, y1: c.c1.y, x2: c.c2.x, y2: c.c2.y, x: c.p1.x, y: c.p1.y });\n }\n if (pair.closed) out.push({ type: \"Z\" });\n }\n return out;\n}\n\n// --- Public tween entry point ----------------------------------------------\n\n/**\n * The morph plan is built from a `(from, to)` pair, which is constant for the\n * duration of one tween while `t` sweeps 0→1. {@link lerp} is invoked once\n * per frame with that same pair, so we cache the most recent plan to avoid\n * rebuilding it (subdivision + ring alignment is the costly part) every frame.\n * A one-entry cache is enough: tweens run one at a time per property and call us\n * with monotonically advancing `t` against fixed endpoints.\n */\nlet cachedPlan: { from: PathData; to: PathData; plan: MorphPlan } | null = null;\n\nfunction planFor(from: PathData, to: PathData): MorphPlan {\n if (cachedPlan && cachedPlan.from === from && cachedPlan.to === to) {\n return cachedPlan.plan;\n }\n const built = plan(commands(from), commands(to));\n cachedPlan = { from, to, plan: built };\n return built;\n}\n\n/**\n * Smoothly interpolate between two path shapes — the {@link PathData} tween used\n * by `Path`'s animatable `d` property and usable directly as a `LerpFunction`.\n *\n * `from`/`to` may be SVG `d` strings or {@link PathCommand} arrays and need not\n * share structure, command count, subpath count, point order, or winding — the\n * shapes are reconciled into a common cubic correspondence first (see the module\n * overview). At `t = 0` and `t = 1` the endpoints are returned verbatim so the\n * start and end frames are pixel-exact; in between, a morphed command list is\n * produced.\n *\n * @param from Source path (the shape at `t = 0`).\n * @param to Target path (the shape at `t = 1`).\n * @param t Progress in `[0, 1]`.\n */\nexport function lerp(from: PathData, to: PathData, t: number): PathData {\n if (t <= 0) return from;\n if (t >= 1) return to;\n return sample(planFor(from, to), t);\n}\n"]}
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* carries the rest, which is the repo's existing shape for an attribute whose
|
|
6
6
|
* operations go past interpolation — `insetsOps` is `AttributeOps & InsetsOps`,
|
|
7
7
|
* `alignmentOps` is `AttributeOps & AlignmentOps`, `cornerRadiusOps` the same.
|
|
8
|
-
*
|
|
9
|
-
* addition.
|
|
8
|
+
* Every `Types.path` entry is untouched by the addition.
|
|
10
9
|
*
|
|
11
10
|
* Behind it is **one** pen walk. There were seven — one each in `bounds`,
|
|
12
11
|
* `length`, `dash`, `sampler`, `subpath`, `morph` and the editor's vector model
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.d.ts","sourceRoot":"","sources":["../../../../src/att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AG,UAAU,CAAC;IAC/D,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAAC;IACxD,8EAA8E;IAC9E,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,OAAO,GAAG,CAAC,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAC3E,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC;IAGnC,kDAAkD;IAClD,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAAC;IAC/C,qFAAqF;IACrF,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAAC;IAC5D,6EAA6E;IAC7E,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9D,0EAA0E;IAC1E,KAAK,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,UAAU,CAAC;QAAC,EAAE,EAAE,UAAU,CAAA;KAAE,CAAC;CAChH;AAGD,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,OAkCxD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/ops.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ops.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/ops.ts"],"names":[],"mappings":"AA8BA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EACH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EACpE,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,GACrD,MAAM,WAAW,CAAC;AAoEnB,MAAM,CAAC,MAAM,OAAO,GAA+C;IAC/D,6DAA6D;IAC7D,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK;IACzB,IAAI;IAEJ,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,OAAO;IAEP,MAAM;IACN,IAAI;IACJ,MAAM;IACN,OAAO;IAEP,IAAI;IACJ,IAAI;IACJ,SAAS;IAET,IAAI;IACJ,MAAM;IAEN,WAAW;IACX,cAAc;IACd,YAAY;IACZ,GAAG;IACH,SAAS;IACT,MAAM;IACN,OAAO;IAEP,SAAS;IACT,QAAQ;IACR,OAAO;IACP,KAAK;CACR,CAAC","sourcesContent":["/**\n * Every path-geometry operation, on one object.\n *\n * `pathOps` was already the path attribute's `resolve`/`lerp` pair; it now\n * carries the rest, which is the repo's existing shape for an attribute whose\n * operations go past interpolation — `insetsOps` is `AttributeOps & InsetsOps`,\n * `alignmentOps` is `AttributeOps & AlignmentOps`, `cornerRadiusOps` the same.\n * Every `Types.path` entry is untouched by the addition.\n *\n * Behind it is **one** pen walk. There were seven — one each in `bounds`,\n * `length`, `dash`, `sampler`, `subpath`, `morph` and the editor's vector model\n * — and they disagreed about where `Z` leaves the cursor, which control point an\n * `S`/`T` reflects, and what an arc is. The pipeline is now:\n *\n * PathData ── commands ──▶ PathCommand[] ── contours ──▶ PathContour[]\n * │\n * bounds · size · length · sampler · dash · trim ◀─────┤\n * cubics ── morph ◀──────────┤\n * anchors ── editing ◀────────┘\n *\n * `cubics` and `anchors` are the only two places geometry is flattened to a\n * single curve type, because a morph needs one segment kind to pair up and\n * nobody can drag an arc's handles. Everything that measures keeps the arc.\n *\n * Each method is the module function of the same name, so a call site and its\n * implementation are one grep apart.\n */\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport type { AttributeOps } from \"@/attributes/shared/operators\";\n\nimport { bounds, commands, contours, size } from \"./walk\";\nimport { dash, dashScale, length, sampler, trim } from \"./measure\";\nimport { cubics, lerp, plan, sample } from \"./morph\";\nimport {\n anchorBounds, anchorCommands, anchors, endFit, fitToBox, fromAnchors,\n isEmpty, map, normalize, pointOn, split, translate,\n} from \"./anchors\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { Extents } from \"@/layout/bounds\";\nimport { PathContour, CubicSubpath, VectorPath, PathSampler, MorphPlan, PathNormalization, PathAnchor } from \"./types\";\n\n\n/** The path attribute's operations beyond `resolve`/`lerp`. */\nexport interface PathOps {\n // ── Reading ────────────────────────────────────────────────────────────\n /** Parse. A `PathCommand[]` passes through by reference; nullish gives `[]`. */\n commands(d: PathData | null | undefined): PathCommand[];\n /** The normal form: absolute, shorthands expanded, grouped into contours. */\n contours(d: PathData | null | undefined): PathContour[];\n /** All-cubic form. Lossy for arcs — one of the two flattening boundaries. */\n cubics(d: PathData | null | undefined): CubicSubpath[];\n /** The editable anchor model. Lossy for arcs — the other boundary. */\n anchors(d: PathData | null | undefined): VectorPath;\n\n // ── Measuring ──────────────────────────────────────────────────────────\n /** Tight box: each segment's own extrema, not its control hull. */\n bounds(d: PathData | null | undefined): Extents | null;\n /** {@link bounds} as a size; `0 x 0` for an empty path. */\n size(d: PathData | null | undefined): { width: number; height: number };\n /** Total arc length. An arc is measured along the arc, not across its chord. */\n length(d: PathData | null | undefined): number;\n /** Point and unit tangent at a distance along the path. */\n sampler(d: PathData): PathSampler;\n\n // ── Rewriting ──────────────────────────────────────────────────────────\n /** The portion between two arc-length fractions. Works on strings. */\n trim(d: PathData, start: number, end: number): PathData;\n /** Only the \"on\" runs of a dash pattern, fit as the renderer fits it, as a `d` string. */\n dash(d: PathData | null | undefined, pattern: number[], offset?: number): string;\n /** How far a pattern is stretched to fit one contour of a path — see `dash`. */\n dashScale(pattern: number[], contour: { length: number; closed: boolean }, total: number): number | null;\n\n // ── Morphing ───────────────────────────────────────────────────────────\n /** A reusable correspondence between two paths. Expensive; `lerp` caches one. */\n plan(from: PathCommand[], to: PathCommand[]): MorphPlan;\n /** Sample a plan at `t`. Cheap. */\n sample(plan: MorphPlan, t: number): PathCommand[];\n\n // ── The anchor model ───────────────────────────────────────────────────\n /** Anchors back to a `d` string. Emits only `M`/`L`/`C`/`Z`. */\n fromAnchors(path: VectorPath): string;\n /** Anchors to commands, with a transform folded into the same pass. */\n anchorCommands(path: VectorPath, transform?: (p: Vector2) => Vector2): PathCommand[];\n /** Tight box of an anchor path. */\n anchorBounds(path: VectorPath): Extents | null;\n /** Every point and handle mapped. */\n map(path: VectorPath, fn: (p: Vector2) => Vector2): VectorPath;\n translate(path: VectorPath, delta: Vector2): VectorPath;\n /** The turn-and-scale about `start` carrying `end` onto `to` — a `map` fn. */\n endFit(start: Vector2, end: Vector2, to: Vector2): (p: Vector2) => Vector2;\n isEmpty(path: VectorPath): boolean;\n\n // ── The unit box ───────────────────────────────────────────────────────\n /** Re-quote against the geometry's own bounds. */\n normalize(path: VectorPath): PathNormalization;\n /** Re-quote against a stated box — the general form of {@link PathOps.normalize}. */\n fitToBox(path: VectorPath, box: Extents): PathNormalization;\n /** A point on the segment between two anchors, for hit-testing an insert. */\n pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2;\n /** De Casteljau split, so inserting an anchor does not move the curve. */\n split(from: PathAnchor, to: PathAnchor, t: number): { from: PathAnchor; middle: PathAnchor; to: PathAnchor };\n}\n\n\nexport const pathOps: AttributeOps<PathData, PathData> & PathOps = {\n // An SVG path string or command list needs no normalization.\n resolve: (value) => value,\n lerp,\n\n commands,\n contours,\n cubics,\n anchors,\n\n bounds,\n size,\n length,\n sampler,\n\n trim,\n dash,\n dashScale,\n\n plan,\n sample,\n\n fromAnchors,\n anchorCommands,\n anchorBounds,\n map,\n translate,\n endFit,\n isEmpty,\n\n normalize,\n fitToBox,\n pointOn,\n split,\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC","sourcesContent":["export * from \"./pack\";\nexport * from \"./resolve\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC","sourcesContent":["export * from \"./language\";\nexport * from \"./pack\";\nexport * from \"./resolve\";\nexport * from \"./uniforms\";\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The language a custom shader is written in: WGSL, the only one the renderer
|
|
3
|
+
* runs. A fill defines `fn fill(in: FillIn) -> vec4f`, an effect
|
|
4
|
+
* `fn effect(in: EffectIn) -> vec4f`; uniforms are the members of
|
|
5
|
+
* `struct Params`, read as `u.<name>`.
|
|
6
|
+
*/
|
|
7
|
+
export type ShaderLanguage = "wgsl";
|
|
8
|
+
/** Whether a shader fill, shader effect or shader pack is WGSL: its `language` is absent or `"wgsl"`. */
|
|
9
|
+
export declare function isWgslShader(shader: {
|
|
10
|
+
language?: string;
|
|
11
|
+
}): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* The version of the WGSL contract a shader is written against: `FillIn` /
|
|
14
|
+
* `EffectIn`, the helpers, and uniforms bound to `struct Params` by name
|
|
15
|
+
* (packages/renderer/DESIGN.md §6.3). Bumped only by a change that would draw
|
|
16
|
+
* an existing shader differently. A WGSL fill or effect resolves with
|
|
17
|
+
* `contract` set (stamped with this when absent), so a stored document says
|
|
18
|
+
* what it was written for and a renderer can tell a newer one apart.
|
|
19
|
+
*/
|
|
20
|
+
export declare const WGSL_CONTRACT = 1;
|
|
21
|
+
/** The contract a shader states, or the current one for a WGSL shader that states none; `undefined` for any other language. */
|
|
22
|
+
export declare function shaderContractOf(shader: {
|
|
23
|
+
language?: string;
|
|
24
|
+
contract?: number;
|
|
25
|
+
}): number | undefined;
|
|
26
|
+
//# sourceMappingURL=language.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/language.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,yGAAyG;AACzG,wBAAgB,YAAY,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAEnE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,+HAA+H;AAC/H,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,SAAS,CAGrG"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Whether a shader fill, shader effect or shader pack is WGSL: its `language` is absent or `"wgsl"`. */
|
|
2
|
+
export function isWgslShader(shader) {
|
|
3
|
+
return shader.language === undefined || shader.language === "wgsl";
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The version of the WGSL contract a shader is written against: `FillIn` /
|
|
7
|
+
* `EffectIn`, the helpers, and uniforms bound to `struct Params` by name
|
|
8
|
+
* (packages/renderer/DESIGN.md §6.3). Bumped only by a change that would draw
|
|
9
|
+
* an existing shader differently. A WGSL fill or effect resolves with
|
|
10
|
+
* `contract` set (stamped with this when absent), so a stored document says
|
|
11
|
+
* what it was written for and a renderer can tell a newer one apart.
|
|
12
|
+
*/
|
|
13
|
+
export const WGSL_CONTRACT = 1;
|
|
14
|
+
/** The contract a shader states, or the current one for a WGSL shader that states none; `undefined` for any other language. */
|
|
15
|
+
export function shaderContractOf(shader) {
|
|
16
|
+
if (!isWgslShader(shader))
|
|
17
|
+
return undefined;
|
|
18
|
+
return shader.contract ?? WGSL_CONTRACT;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=language.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"language.js","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/language.ts"],"names":[],"mappings":"AAQA,yGAAyG;AACzG,MAAM,UAAU,YAAY,CAAC,MAA6B;IACtD,OAAO,MAAM,CAAC,QAAQ,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,KAAK,MAAM,CAAC;AACvE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,+HAA+H;AAC/H,MAAM,UAAU,gBAAgB,CAAC,MAAgD;IAC7E,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5C,OAAO,MAAM,CAAC,QAAQ,IAAI,aAAa,CAAC;AAC5C,CAAC","sourcesContent":["/**\n * The language a custom shader is written in: WGSL, the only one the renderer\n * runs. A fill defines `fn fill(in: FillIn) -> vec4f`, an effect\n * `fn effect(in: EffectIn) -> vec4f`; uniforms are the members of\n * `struct Params`, read as `u.<name>`.\n */\nexport type ShaderLanguage = \"wgsl\";\n\n/** Whether a shader fill, shader effect or shader pack is WGSL: its `language` is absent or `\"wgsl\"`. */\nexport function isWgslShader(shader: { language?: string }): boolean {\n return shader.language === undefined || shader.language === \"wgsl\";\n}\n\n/**\n * The version of the WGSL contract a shader is written against: `FillIn` /\n * `EffectIn`, the helpers, and uniforms bound to `struct Params` by name\n * (packages/renderer/DESIGN.md §6.3). Bumped only by a change that would draw\n * an existing shader differently. A WGSL fill or effect resolves with\n * `contract` set (stamped with this when absent), so a stored document says\n * what it was written for and a renderer can tell a newer one apart.\n */\nexport const WGSL_CONTRACT = 1;\n\n/** The contract a shader states, or the current one for a WGSL shader that states none; `undefined` for any other language. */\nexport function shaderContractOf(shader: { language?: string; contract?: number }): number | undefined {\n if (!isWgslShader(shader)) return undefined;\n return shader.contract ?? WGSL_CONTRACT;\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ShaderUniformRecord } from "./uniforms.js";
|
|
2
|
+
import type { ShaderLanguage } from "./language.js";
|
|
2
3
|
/**
|
|
3
4
|
* A **shader pack**: a program, plus what a host may edit about it.
|
|
4
5
|
*
|
|
@@ -9,9 +10,9 @@ import type { ShaderFillCoords, SkSLUniformRecord } from "../sksl-uniforms.js";
|
|
|
9
10
|
* to offer a slider had to keep that table itself, beside a program it did not
|
|
10
11
|
* own.
|
|
11
12
|
*
|
|
12
|
-
* **Two scopes, one shape.** A fill paints inside a shape's path and
|
|
13
|
-
*
|
|
14
|
-
*
|
|
13
|
+
* **Two scopes, one shape.** A fill paints inside a shape's path and may sample
|
|
14
|
+
* textures; an effect paints over a layer and may sample what is beneath it.
|
|
15
|
+
* Those are the only two differences, and making them arms of a union rather
|
|
15
16
|
* than optional fields on one type is what makes `Fills.shader(anEffectShader)`
|
|
16
17
|
* a compile error instead of a program that fails at the first frame.
|
|
17
18
|
*/
|
|
@@ -32,25 +33,38 @@ export interface ShaderBase {
|
|
|
32
33
|
id?: string;
|
|
33
34
|
name: string;
|
|
34
35
|
description?: string;
|
|
35
|
-
/**
|
|
36
|
+
/** The language `source` is written in; normalising a pack stamps WGSL when absent. */
|
|
37
|
+
language?: ShaderLanguage;
|
|
38
|
+
/**
|
|
39
|
+
* The program. In WGSL, a fill defines `fn fill(in: FillIn) -> vec4f` and an
|
|
40
|
+
* effect `fn effect(in: EffectIn) -> vec4f`, and the uniforms are the
|
|
41
|
+
* members of `struct Params` (types, layout and all); `properties` name
|
|
42
|
+
* those members in their `inputs`.
|
|
43
|
+
*/
|
|
36
44
|
source: string;
|
|
37
45
|
/** Uniform values the properties do not cover, by name. */
|
|
38
|
-
uniforms?:
|
|
46
|
+
uniforms?: ShaderUniformRecord;
|
|
39
47
|
/** The editable values, by property id. */
|
|
40
48
|
properties: Record<string, ShaderProperty>;
|
|
41
49
|
}
|
|
42
50
|
/** A shader that paints inside a shape's path. */
|
|
43
51
|
export interface FillShader extends ShaderBase {
|
|
44
52
|
scope: "fill";
|
|
45
|
-
/**
|
|
46
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The images the program samples, by name. In WGSL, `sample_texture(uv)`
|
|
55
|
+
* samples the first; the fill that applies the pack supplies each `src`.
|
|
56
|
+
*/
|
|
57
|
+
textures?: readonly {
|
|
58
|
+
name: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
}[];
|
|
47
61
|
}
|
|
48
62
|
/** A shader that paints over a layer. */
|
|
49
63
|
export interface EffectShader extends ShaderBase {
|
|
50
64
|
scope: "effect";
|
|
51
65
|
/**
|
|
52
|
-
* Whether the
|
|
53
|
-
*
|
|
66
|
+
* Whether the program is meant to run on the backdrop path, where
|
|
67
|
+
* `sample_src` reads what is beneath the node rather than its own layer.
|
|
54
68
|
*
|
|
55
69
|
* A fact about the **program**, which is why it lives here rather than on
|
|
56
70
|
* the effect instance: the instance keeps `mode`, the cross-cutting field
|
|
@@ -102,7 +116,7 @@ export interface HueProperty extends ShaderPropertyBase {
|
|
|
102
116
|
kind: "hue";
|
|
103
117
|
default: number;
|
|
104
118
|
}
|
|
105
|
-
/** Written to its uniform as 1 or 0
|
|
119
|
+
/** Written to its uniform as 1 or 0, since a `bool` cannot be a uniform member in WGSL. */
|
|
106
120
|
export interface BooleanProperty extends ShaderPropertyBase {
|
|
107
121
|
kind: "boolean";
|
|
108
122
|
default: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/pack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"pack.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/shaders/pack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,MAAM,GAAG,UAAU,GAAG,YAAY,CAAC;AAE/C,8BAA8B;AAC9B,MAAM,WAAW,UAAU;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uFAAuF;IACvF,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,mBAAmB,CAAC;IAC/B,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CAC9C;AAED,kDAAkD;AAClD,MAAM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