@motionscript/core 0.1.0-alpha.9 → 0.1.1-alpha.0
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 +29 -0
- package/dist/assets/asset-index.d.ts +1 -8
- package/dist/assets/asset-index.d.ts.map +1 -1
- package/dist/assets/asset-index.js +1 -8
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +10 -72
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +3 -29
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts +8 -20
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -20
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +9 -51
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +13 -78
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/record.d.ts +2 -18
- package/dist/assets/record.d.ts.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -18
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js +2 -11
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/effects/chain.d.ts +2 -12
- package/dist/attributes/audio/effects/chain.d.ts.map +1 -1
- package/dist/attributes/audio/effects/chain.js +1 -7
- package/dist/attributes/audio/effects/chain.js.map +1 -1
- package/dist/attributes/audio/effects/registry.d.ts +3 -18
- package/dist/attributes/audio/effects/registry.d.ts.map +1 -1
- package/dist/attributes/audio/effects/registry.js +4 -23
- package/dist/attributes/audio/effects/registry.js.map +1 -1
- package/dist/attributes/audio/ramp.d.ts +5 -38
- package/dist/attributes/audio/ramp.d.ts.map +1 -1
- package/dist/attributes/audio/ramp.js +3 -28
- package/dist/attributes/audio/ramp.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +10 -80
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +1 -4
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +2 -12
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +2 -11
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +2 -26
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +1 -9
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/audio/transition.d.ts +1 -8
- package/dist/attributes/audio/transition.d.ts.map +1 -1
- package/dist/attributes/audio/transition.js.map +1 -1
- package/dist/attributes/layout/alignment.d.ts +6 -38
- package/dist/attributes/layout/alignment.d.ts.map +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/insets.d.ts +2 -27
- package/dist/attributes/layout/insets.d.ts.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.d.ts +29 -114
- package/dist/attributes/layout/matrix2d.d.ts.map +1 -1
- package/dist/attributes/layout/matrix2d.js +26 -110
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.d.ts +3 -25
- package/dist/attributes/layout/size.d.ts.map +1 -1
- package/dist/attributes/layout/size.js +2 -18
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/space3d.d.ts +16 -79
- package/dist/attributes/layout/space3d.d.ts.map +1 -1
- package/dist/attributes/layout/space3d.js +17 -81
- package/dist/attributes/layout/space3d.js.map +1 -1
- package/dist/attributes/layout/transform3d.d.ts +2 -23
- package/dist/attributes/layout/transform3d.d.ts.map +1 -1
- package/dist/attributes/layout/transform3d.js +1 -7
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/world-transform.d.ts +2 -16
- package/dist/attributes/layout/world-transform.d.ts.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +13 -73
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +9 -40
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +6 -45
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +6 -37
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +11 -83
- package/dist/attributes/render3d/orbit.d.ts.map +1 -1
- package/dist/attributes/render3d/orbit.js +10 -73
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.d.ts +1 -6
- package/dist/attributes/shape/corners/corner-radius.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.d.ts +4 -25
- package/dist/attributes/shape/corners/corner-style.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js +2 -12
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.d.ts +2 -21
- package/dist/attributes/shape/corners/corners.d.ts.map +1 -1
- package/dist/attributes/shape/corners/corners.js +2 -12
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +2 -18
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js +3 -26
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +36 -328
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +24 -242
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.d.ts +19 -127
- package/dist/attributes/shape/effects/effect-data.d.ts.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js +6 -33
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.d.ts +6 -26
- package/dist/attributes/shape/effects/implementations/ascii.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js +0 -3
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts +2 -21
- package/dist/attributes/shape/effects/implementations/bit-crush.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js +0 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts +1 -14
- package/dist/attributes/shape/effects/implementations/block-displace.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js +0 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/bloom.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js +0 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js +0 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/bulge.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js +0 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js +0 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +1 -12
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js +0 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -11
- package/dist/attributes/shape/effects/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js +1 -6
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js +0 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.d.ts +4 -35
- package/dist/attributes/shape/effects/implementations/dither.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js +1 -7
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts +1 -22
- package/dist/attributes/shape/effects/implementations/drop-shadow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js +0 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.d.ts +1 -9
- package/dist/attributes/shape/effects/implementations/duotone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js +0 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.d.ts +2 -15
- package/dist/attributes/shape/effects/implementations/edges.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js +0 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +1 -14
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js +0 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.d.ts +7 -47
- package/dist/attributes/shape/effects/implementations/glow.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js +1 -9
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.d.ts +1 -14
- package/dist/attributes/shape/effects/implementations/grain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js +0 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/grayscale.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js +0 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.d.ts +5 -29
- package/dist/attributes/shape/effects/implementations/halftone.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js +0 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.d.ts +3 -12
- package/dist/attributes/shape/effects/implementations/invert.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js +0 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts +2 -19
- package/dist/attributes/shape/effects/implementations/kaleidoscope.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js +1 -5
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +11 -36
- package/dist/attributes/shape/effects/implementations/lut.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js +2 -8
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/magnify.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js +0 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts +3 -17
- package/dist/attributes/shape/effects/implementations/motion-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js +2 -11
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts +1 -12
- package/dist/attributes/shape/effects/implementations/oil-paint.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js +0 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.d.ts +2 -14
- package/dist/attributes/shape/effects/implementations/outline.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js +0 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts +1 -15
- package/dist/attributes/shape/effects/implementations/pixelate.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js +0 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.d.ts +1 -10
- package/dist/attributes/shape/effects/implementations/posterize.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js +0 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts +3 -26
- package/dist/attributes/shape/effects/implementations/progressive-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js +1 -2
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts +2 -16
- package/dist/attributes/shape/effects/implementations/radial-blur.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js +0 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts +1 -13
- package/dist/attributes/shape/effects/implementations/rgb-shift.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js +0 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts +1 -8
- package/dist/attributes/shape/effects/implementations/scanlines.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js +0 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/scatter.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js +0 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts +10 -53
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +2 -9
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts +1 -12
- package/dist/attributes/shape/effects/implementations/sharpen.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js +0 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.d.ts +1 -8
- package/dist/attributes/shape/effects/implementations/streak.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js +0 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.d.ts +1 -9
- package/dist/attributes/shape/effects/implementations/threshold.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js +0 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.d.ts +1 -13
- package/dist/attributes/shape/effects/implementations/twirl.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js +0 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.d.ts +1 -9
- package/dist/attributes/shape/effects/implementations/vignette.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js +0 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.d.ts +0 -1
- package/dist/attributes/shape/effects/implementations/vintage.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js +0 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.d.ts +3 -24
- package/dist/attributes/shape/effects/implementations/wave.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js +1 -5
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +6 -41
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +7 -45
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/spec.d.ts +6 -30
- package/dist/attributes/shape/effects/spec.d.ts.map +1 -1
- package/dist/attributes/shape/effects/spec.js +3 -9
- package/dist/attributes/shape/effects/spec.js.map +1 -1
- package/dist/attributes/shape/fill/blend.d.ts +1 -17
- package/dist/attributes/shape/fill/blend.d.ts.map +1 -1
- package/dist/attributes/shape/fill/blend.js +2 -15
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.d.ts +17 -125
- package/dist/attributes/shape/fill/chain.d.ts.map +1 -1
- package/dist/attributes/shape/fill/chain.js +22 -109
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.d.ts +10 -35
- package/dist/attributes/shape/fill/coerce.d.ts.map +1 -1
- package/dist/attributes/shape/fill/coerce.js +12 -47
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts +10 -44
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +35 -96
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +1 -8
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.js +2 -13
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts +2 -24
- package/dist/attributes/shape/fill/implementations/canvas3d.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/canvas3d.js +2 -9
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.d.ts +1 -14
- package/dist/attributes/shape/fill/implementations/dot-grid.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts +5 -28
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +0 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.d.ts +8 -21
- package/dist/attributes/shape/fill/implementations/grid.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js +2 -8
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts +13 -79
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +6 -23
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.d.ts +2 -15
- package/dist/attributes/shape/fill/implementations/noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.d.ts +11 -45
- package/dist/attributes/shape/fill/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js +5 -17
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.d.ts +12 -64
- package/dist/attributes/shape/fill/implementations/video.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +12 -50
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.d.ts +2 -13
- package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
- package/dist/attributes/shape/fill/lerp.js +2 -9
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.d.ts +8 -49
- package/dist/attributes/shape/fill/media-preset.d.ts.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js +8 -35
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.d.ts +2 -26
- package/dist/attributes/shape/fill/registry.d.ts.map +1 -1
- package/dist/attributes/shape/fill/registry.js +5 -40
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.d.ts +6 -30
- package/dist/attributes/shape/fill/union.d.ts.map +1 -1
- package/dist/attributes/shape/fill/union.js +1 -9
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +15 -168
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +8 -132
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts +1 -7
- package/dist/attributes/shape/filters/implementations/color-matrix.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.d.ts +1 -7
- package/dist/attributes/shape/filters/implementations/curves.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.d.ts +1 -11
- package/dist/attributes/shape/filters/implementations/echo.d.ts.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -6
- package/dist/attributes/shape/filters/index.d.ts.map +1 -1
- package/dist/attributes/shape/filters/index.js +0 -2
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +5 -35
- package/dist/attributes/shape/filters/registry.d.ts.map +1 -1
- package/dist/attributes/shape/filters/registry.js +7 -50
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +10 -51
- 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 +18 -106
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +15 -124
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.d.ts +6 -54
- package/dist/attributes/shape/path/bezier.d.ts.map +1 -1
- package/dist/attributes/shape/path/bezier.js +10 -98
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.d.ts +1 -11
- package/dist/attributes/shape/path/index.d.ts.map +1 -1
- package/dist/attributes/shape/path/index.js +1 -11
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.d.ts +5 -41
- package/dist/attributes/shape/path/measure.d.ts.map +1 -1
- package/dist/attributes/shape/path/measure.js +8 -57
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts +4 -41
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +17 -117
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.d.ts +5 -19
- 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/path/types.d.ts +10 -67
- package/dist/attributes/shape/path/types.d.ts.map +1 -1
- package/dist/attributes/shape/path/types.js +0 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.d.ts +9 -63
- package/dist/attributes/shape/path/walk.d.ts.map +1 -1
- package/dist/attributes/shape/path/walk.js +21 -100
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/language.d.ts +2 -14
- package/dist/attributes/shape/shaders/language.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/language.js +1 -8
- package/dist/attributes/shape/shaders/language.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.d.ts +13 -78
- package/dist/attributes/shape/shaders/pack.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/pack.js +1 -10
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.d.ts +1 -11
- package/dist/attributes/shape/shaders/resolve.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js +3 -28
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.d.ts +3 -24
- package/dist/attributes/shape/shaders/uniforms.d.ts.map +1 -1
- package/dist/attributes/shape/shaders/uniforms.js +0 -0
- package/dist/attributes/shape/shaders/uniforms.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.d.ts +3 -20
- package/dist/attributes/shape/shadow/shadow.d.ts.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js +0 -3
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +9 -58
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +0 -6
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.d.ts +1 -8
- package/dist/attributes/shared/operators.d.ts.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.d.ts +1 -11
- package/dist/attributes/text/index.d.ts.map +1 -1
- package/dist/attributes/text/index.js +1 -11
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +4 -30
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +7 -23
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.d.ts +5 -28
- package/dist/attributes/text/types.d.ts.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-3ZIUZZC7.js +13 -0
- package/dist/browser/chunks/chunk-3ZIUZZC7.js.map +7 -0
- package/dist/browser/chunks/chunk-5TDMGUXQ.js +3 -0
- package/dist/browser/chunks/chunk-5TDMGUXQ.js.map +7 -0
- package/dist/browser/chunks/chunk-7YOYMMXK.js +6 -0
- package/dist/browser/chunks/chunk-7YOYMMXK.js.map +7 -0
- package/dist/browser/chunks/{chunk-4BDLFEOC.js → chunk-GEJEQQER.js} +1 -1
- package/dist/browser/chunks/chunk-GEJEQQER.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/experimental.js +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/manifest.json +1 -1
- package/dist/browser/sdk.js +1 -1
- package/dist/component.d.ts +3 -10
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -10
- package/dist/component.js.map +1 -1
- package/dist/components/builtins/geometry/geometry.d.ts +15 -62
- package/dist/components/builtins/geometry/geometry.d.ts.map +1 -1
- package/dist/components/builtins/geometry/geometry.js.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.d.ts +12 -61
- package/dist/components/builtins/geometry/shape-outline.d.ts.map +1 -1
- package/dist/components/builtins/geometry/shape-outline.js +29 -168
- package/dist/components/builtins/geometry/shape-outline.js.map +1 -1
- package/dist/components/builtins/layout/layout.d.ts +1 -14
- package/dist/components/builtins/layout/layout.d.ts.map +1 -1
- package/dist/components/builtins/layout/layout.js.map +1 -1
- package/dist/components/builtins/media/media.d.ts +11 -51
- package/dist/components/builtins/media/media.d.ts.map +1 -1
- package/dist/components/builtins/media/media.js +3 -7
- package/dist/components/builtins/media/media.js.map +1 -1
- package/dist/components/builtins/text/number-format.d.ts +14 -47
- package/dist/components/builtins/text/number-format.d.ts.map +1 -1
- package/dist/components/builtins/text/number-format.js +19 -69
- package/dist/components/builtins/text/number-format.js.map +1 -1
- package/dist/components/builtins/text/number-pattern.d.ts +3 -37
- package/dist/components/builtins/text/number-pattern.d.ts.map +1 -1
- package/dist/components/builtins/text/number-pattern.js +6 -48
- package/dist/components/builtins/text/number-pattern.js.map +1 -1
- package/dist/components/builtins/text/text-defaults.d.ts +7 -25
- package/dist/components/builtins/text/text-defaults.d.ts.map +1 -1
- package/dist/components/builtins/text/text-defaults.js +7 -25
- package/dist/components/builtins/text/text-defaults.js.map +1 -1
- package/dist/components/builtins/text/text-layout.d.ts +2 -11
- package/dist/components/builtins/text/text-layout.d.ts.map +1 -1
- package/dist/components/builtins/text/text-layout.js +7 -22
- package/dist/components/builtins/text/text-layout.js.map +1 -1
- package/dist/components/builtins/text/text.d.ts +8 -46
- package/dist/components/builtins/text/text.d.ts.map +1 -1
- package/dist/components/builtins/text/text.js.map +1 -1
- package/dist/components/builtins/three/canvas3d.d.ts +6 -51
- package/dist/components/builtins/three/canvas3d.d.ts.map +1 -1
- package/dist/components/builtins/three/canvas3d.js.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.d.ts +3 -39
- package/dist/components/builtins/three/grid-geometry3d.d.ts.map +1 -1
- package/dist/components/builtins/three/grid-geometry3d.js +8 -46
- package/dist/components/builtins/three/grid-geometry3d.js.map +1 -1
- package/dist/components/builtins/three/three.d.ts +22 -117
- package/dist/components/builtins/three/three.d.ts.map +1 -1
- package/dist/components/builtins/three/three.js +5 -17
- package/dist/components/builtins/three/three.js.map +1 -1
- package/dist/components/factory/api.d.ts.map +1 -1
- package/dist/components/factory/api.js.map +1 -1
- package/dist/components/factory/views.d.ts.map +1 -1
- package/dist/components/factory/views.js +41 -3
- package/dist/components/factory/views.js.map +1 -1
- package/dist/components/trees/2d/group-bounds.d.ts +12 -41
- package/dist/components/trees/2d/group-bounds.d.ts.map +1 -1
- package/dist/components/trees/2d/group-bounds.js +3 -22
- package/dist/components/trees/2d/group-bounds.js.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.d.ts +8 -36
- package/dist/components/trees/2d/node-lifecycle.d.ts.map +1 -1
- package/dist/components/trees/2d/node-lifecycle.js +35 -127
- package/dist/components/trees/2d/node-lifecycle.js.map +1 -1
- package/dist/components/trees/2d/node-motion.d.ts +4 -36
- package/dist/components/trees/2d/node-motion.d.ts.map +1 -1
- package/dist/components/trees/2d/node-motion.js +3 -31
- package/dist/components/trees/2d/node-motion.js.map +1 -1
- package/dist/components/trees/2d/node-render.d.ts +3 -20
- package/dist/components/trees/2d/node-render.d.ts.map +1 -1
- package/dist/components/trees/2d/node-render.js +4 -23
- package/dist/components/trees/2d/node-render.js.map +1 -1
- package/dist/components/trees/2d/node-space.d.ts +4 -23
- package/dist/components/trees/2d/node-space.d.ts.map +1 -1
- package/dist/components/trees/2d/node-space.js +3 -17
- package/dist/components/trees/2d/node-space.js.map +1 -1
- package/dist/components/trees/2d/node-transform.d.ts +4 -33
- package/dist/components/trees/2d/node-transform.d.ts.map +1 -1
- package/dist/components/trees/2d/node-transform.js +4 -33
- package/dist/components/trees/2d/node-transform.js.map +1 -1
- package/dist/components/trees/2d/node2d.d.ts +112 -622
- package/dist/components/trees/2d/node2d.d.ts.map +1 -1
- package/dist/components/trees/2d/node2d.js +131 -605
- package/dist/components/trees/2d/node2d.js.map +1 -1
- package/dist/components/trees/audio/node-audio.d.ts +17 -65
- package/dist/components/trees/audio/node-audio.d.ts.map +1 -1
- package/dist/components/trees/audio/node-audio.js +18 -68
- package/dist/components/trees/audio/node-audio.js.map +1 -1
- package/dist/components/trees/node/node-editor-state.d.ts +5 -45
- package/dist/components/trees/node/node-editor-state.d.ts.map +1 -1
- package/dist/components/trees/node/node-editor-state.js +1 -13
- package/dist/components/trees/node/node-editor-state.js.map +1 -1
- package/dist/components/trees/node/node-reactive.d.ts +6 -54
- package/dist/components/trees/node/node-reactive.d.ts.map +1 -1
- package/dist/components/trees/node/node-reactive.js +13 -39
- package/dist/components/trees/node/node-reactive.js.map +1 -1
- package/dist/components/trees/node/node-time.d.ts +2 -15
- package/dist/components/trees/node/node-time.d.ts.map +1 -1
- package/dist/components/trees/node/node-time.js.map +1 -1
- package/dist/components/trees/node/node-walk.d.ts +7 -32
- package/dist/components/trees/node/node-walk.d.ts.map +1 -1
- package/dist/components/trees/node/node-walk.js +7 -32
- package/dist/components/trees/node/node-walk.js.map +1 -1
- package/dist/components/trees/node/node.d.ts +43 -248
- package/dist/components/trees/node/node.d.ts.map +1 -1
- package/dist/components/trees/node/node.js +51 -229
- package/dist/components/trees/node/node.js.map +1 -1
- package/dist/components/trees/root/canvas2d-node.d.ts +7 -60
- package/dist/components/trees/root/canvas2d-node.d.ts.map +1 -1
- package/dist/components/trees/root/canvas2d-node.js +7 -47
- package/dist/components/trees/root/canvas2d-node.js.map +1 -1
- package/dist/components/trees/three/node3d.d.ts +24 -112
- package/dist/components/trees/three/node3d.d.ts.map +1 -1
- package/dist/components/trees/three/node3d.js +22 -104
- package/dist/components/trees/three/node3d.js.map +1 -1
- package/dist/document/audio.d.ts +9 -21
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +13 -28
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts +3 -9
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +43 -89
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +15 -30
- package/dist/document/command-traits.d.ts.map +1 -1
- package/dist/document/command-traits.js +31 -31
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.d.ts +9 -43
- package/dist/document/deny-globals.d.ts.map +1 -1
- package/dist/document/deny-globals.js +18 -58
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.d.ts +6 -16
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +5 -11
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +5 -13
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +0 -2
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts +2 -2
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -18
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.d.ts +11 -41
- package/dist/document/expression/index.d.ts.map +1 -1
- package/dist/document/expression/index.js +11 -41
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.d.ts +3 -12
- package/dist/document/expression/ops.d.ts.map +1 -1
- package/dist/document/expression/ops.js +4 -20
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts +4 -14
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +34 -55
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +2 -8
- package/dist/document/expression/refs.d.ts.map +1 -1
- package/dist/document/expression/refs.js +2 -6
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.d.ts +18 -63
- package/dist/document/expression/types.d.ts.map +1 -1
- package/dist/document/expression/types.js +4 -15
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.d.ts +6 -20
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +18 -44
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.js +2 -3
- package/dist/document/index.js.map +1 -1
- package/dist/document/migrate.d.ts +7 -22
- package/dist/document/migrate.d.ts.map +1 -1
- package/dist/document/migrate.js +44 -15
- package/dist/document/migrate.js.map +1 -1
- package/dist/document/missing-node.d.ts +4 -11
- package/dist/document/missing-node.d.ts.map +1 -1
- package/dist/document/missing-node.js +2 -5
- package/dist/document/missing-node.js.map +1 -1
- package/dist/document/node-decorator.d.ts +12 -53
- package/dist/document/node-decorator.d.ts.map +1 -1
- package/dist/document/node-decorator.js +16 -57
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +25 -62
- 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 +18 -41
- package/dist/document/placement.d.ts.map +1 -1
- package/dist/document/placement.js +4 -11
- package/dist/document/placement.js.map +1 -1
- package/dist/document/project.d.ts +19 -52
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js +2 -6
- package/dist/document/project.js.map +1 -1
- package/dist/document/prop-evolution.d.ts +10 -20
- package/dist/document/prop-evolution.d.ts.map +1 -1
- package/dist/document/prop-evolution.js +3 -7
- package/dist/document/prop-evolution.js.map +1 -1
- package/dist/document/registry.d.ts +80 -318
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +43 -147
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +12 -18
- package/dist/document/settled-index.d.ts.map +1 -1
- package/dist/document/settled-index.js +29 -31
- package/dist/document/settled-index.js.map +1 -1
- package/dist/document/timeline-patch.d.ts +6 -15
- package/dist/document/timeline-patch.d.ts.map +1 -1
- package/dist/document/timeline-patch.js +12 -21
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +56 -263
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +97 -281
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +90 -264
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +13 -30
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +10 -40
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +72 -137
- package/dist/document/validate.js.map +1 -1
- package/dist/document/vocabulary.d.ts +4 -7
- package/dist/document/vocabulary.d.ts.map +1 -1
- package/dist/document/vocabulary.js +0 -1
- package/dist/document/vocabulary.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/layout/bounds.d.ts +1 -11
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/flex.d.ts +6 -20
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +7 -28
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/ops.d.ts +2 -11
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +2 -22
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.d.ts +11 -55
- package/dist/layout/types.d.ts.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +7 -43
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js +4 -29
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +5 -31
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/stepped-clock.d.ts +1 -16
- package/dist/platform/stepped-clock.d.ts.map +1 -1
- package/dist/platform/stepped-clock.js +1 -16
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +8 -68
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +8 -60
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +11 -45
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +10 -37
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.d.ts +4 -14
- package/dist/project/config.d.ts.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/tree.d.ts +6 -35
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js +1 -8
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.d.ts +7 -13
- 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 +18 -0
- package/dist/props/layout.d.ts.map +1 -0
- package/dist/props/layout.js +73 -0
- package/dist/props/layout.js.map +1 -0
- package/dist/props/observer.d.ts +1 -7
- package/dist/props/observer.d.ts.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.d.ts +6 -19
- package/dist/props/slot.d.ts.map +1 -1
- package/dist/props/slot.js +5 -14
- package/dist/props/slot.js.map +1 -1
- package/dist/render/canvas-render-context2d.d.ts +8 -68
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +8 -69
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.d.ts +2 -16
- package/dist/render/clip-contains.d.ts.map +1 -1
- package/dist/render/clip-contains.js +21 -82
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.d.ts +7 -25
- package/dist/render/clip.d.ts.map +1 -1
- package/dist/render/clip.js +5 -17
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.d.ts.map +1 -1
- package/dist/render/descriptors/ellipse.js +0 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/line.d.ts.map +1 -1
- package/dist/render/descriptors/line.js +0 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.d.ts +4 -32
- package/dist/render/descriptors/path-builder.d.ts.map +1 -1
- package/dist/render/descriptors/path-builder.js +3 -25
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.d.ts +1 -11
- package/dist/render/descriptors/path.d.ts.map +1 -1
- package/dist/render/descriptors/path.js +0 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.d.ts.map +1 -1
- package/dist/render/descriptors/polygon.js +0 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.d.ts.map +1 -1
- package/dist/render/descriptors/polygram.js +0 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.d.ts.map +1 -1
- package/dist/render/descriptors/rect.js +0 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.d.ts.map +1 -1
- package/dist/render/descriptors/richtext.js +0 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +17 -77
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js +13 -47
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +15 -94
- package/dist/render/descriptors/text.d.ts.map +1 -1
- package/dist/render/descriptors/text.js +8 -50
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +5 -16
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js +1 -17
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +24 -116
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +23 -108
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/measure-context.d.ts +5 -29
- package/dist/render/measure-context.d.ts.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.d.ts +2 -20
- package/dist/render/null-render-context.d.ts.map +1 -1
- package/dist/render/null-render-context.js +2 -20
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +52 -208
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.d.ts +2 -19
- package/dist/render/surface.d.ts.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.d.ts +1 -17
- package/dist/render/text-defaults.d.ts.map +1 -1
- package/dist/render/text-defaults.js +6 -40
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.d.ts +12 -55
- package/dist/render/text-layout.d.ts.map +1 -1
- package/dist/render/text-layout.js +2 -16
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts +10 -32
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +2 -12
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.d.ts +8 -35
- package/dist/render3d/builders.d.ts.map +1 -1
- package/dist/render3d/builders.js +8 -35
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +10 -57
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +4 -26
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +7 -45
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +15 -85
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +18 -106
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js +2 -20
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +29 -133
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +23 -110
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -16
- package/dist/render3d/index.d.ts.map +1 -1
- package/dist/render3d/index.js +1 -16
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts.map +1 -1
- package/dist/render3d/inert.js +1 -14
- package/dist/render3d/inert.js.map +1 -1
- package/dist/render3d/light.d.ts +3 -26
- package/dist/render3d/light.d.ts.map +1 -1
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +13 -87
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js +2 -16
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.d.ts +14 -68
- package/dist/render3d/matrix4.d.ts.map +1 -1
- package/dist/render3d/matrix4.js +11 -60
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.d.ts +13 -51
- package/dist/render3d/render-context3d.d.ts.map +1 -1
- package/dist/render3d/render-context3d.js +9 -21
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.d.ts +9 -53
- package/dist/render3d/resources.d.ts.map +1 -1
- package/dist/render3d/resources.js +8 -48
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.d.ts +7 -21
- package/dist/render3d/rounded-box.d.ts.map +1 -1
- package/dist/render3d/rounded-box.js +7 -46
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +20 -78
- 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 +11 -53
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +12 -59
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.d.ts +2 -25
- package/dist/render3d/segments.d.ts.map +1 -1
- package/dist/render3d/segments.js +1 -11
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +25 -112
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +3 -27
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.d.ts +2 -19
- package/dist/render3d/tracking.d.ts.map +1 -1
- package/dist/render3d/tracking.js +2 -19
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +14 -60
- package/dist/render3d/transform.d.ts.map +1 -1
- package/dist/render3d/transform.js +0 -2
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +6 -48
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +4 -38
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +3 -27
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -33
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.d.ts +34 -20
- package/dist/runtime/asset-refine.d.ts.map +1 -1
- package/dist/runtime/asset-refine.js +127 -31
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.d.ts +14 -53
- package/dist/runtime/asset-timeline.d.ts.map +1 -1
- package/dist/runtime/asset-timeline.js +6 -27
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.d.ts +7 -26
- package/dist/runtime/asset-update.d.ts.map +1 -1
- package/dist/runtime/asset-update.js +6 -18
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.d.ts +0 -2
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +0 -2
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.d.ts +3 -9
- package/dist/runtime/builtin-context.d.ts.map +1 -1
- package/dist/runtime/builtin-context.js +3 -9
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +12 -39
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +21 -45
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +26 -68
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +47 -81
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +31 -85
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +16 -49
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +4 -15
- package/dist/runtime/frame-time.d.ts.map +1 -1
- package/dist/runtime/frame-time.js +5 -12
- package/dist/runtime/frame-time.js.map +1 -1
- package/dist/runtime/index.d.ts +0 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +0 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +59 -139
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +87 -157
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +39 -96
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +98 -141
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts +8 -17
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +7 -16
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +78 -207
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +111 -226
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.d.ts +6 -14
- package/dist/runtime/playback.d.ts.map +1 -1
- package/dist/runtime/playback.js +6 -14
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/project-assets.d.ts +6 -14
- package/dist/runtime/project-assets.d.ts.map +1 -1
- package/dist/runtime/project-assets.js +7 -16
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +22 -45
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +26 -46
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.d.ts +4 -10
- package/dist/runtime/settle.d.ts.map +1 -1
- package/dist/runtime/settle.js +4 -10
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +15 -37
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +27 -44
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.d.ts +18 -47
- package/dist/runtime/text-geometry.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +13 -27
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +1 -7
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +30 -138
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +6 -26
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +1 -6
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +6 -53
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +5 -40
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/curve.d.ts +2 -17
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +1 -6
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +0 -11
- package/dist/tween/ease/describe.d.ts.map +1 -1
- package/dist/tween/ease/describe.js +0 -23
- package/dist/tween/ease/describe.js.map +1 -1
- package/dist/tween/ease/spec.d.ts +2 -18
- package/dist/tween/ease/spec.d.ts.map +1 -1
- package/dist/tween/ease/spec.js.map +1 -1
- package/dist/tween/inert.d.ts +1 -14
- package/dist/tween/inert.d.ts.map +1 -1
- package/dist/tween/inert.js +1 -14
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.d.ts +2 -26
- package/dist/tween/lerp.d.ts.map +1 -1
- package/dist/tween/lerp.js +2 -26
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.d.ts +9 -50
- package/dist/tween/loop.d.ts.map +1 -1
- package/dist/tween/loop.js +6 -31
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +2 -30
- package/dist/tween/prepare.d.ts.map +1 -1
- package/dist/tween/prepare.js +2 -30
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/stepper.d.ts +4 -25
- package/dist/tween/stepper.d.ts.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.d.ts +1 -8
- package/dist/tween/to-command.d.ts.map +1 -1
- package/dist/tween/to-command.js +2 -25
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/context.d.ts +4 -29
- package/dist/util/context.d.ts.map +1 -1
- package/dist/util/context.js +3 -15
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.d.ts +4 -29
- package/dist/util/csv.d.ts.map +1 -1
- package/dist/util/csv.js +3 -22
- package/dist/util/csv.js.map +1 -1
- package/dist/util/metrics.d.ts +2 -26
- package/dist/util/metrics.d.ts.map +1 -1
- package/dist/util/metrics.js +2 -26
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.d.ts +20 -87
- package/dist/util/random.d.ts.map +1 -1
- package/dist/util/random.js +20 -87
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.d.ts +6 -35
- package/dist/util/reference.d.ts.map +1 -1
- package/dist/util/reference.js +1 -4
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.d.ts +6 -27
- package/dist/util/scheduler.d.ts.map +1 -1
- package/dist/util/scheduler.js +8 -35
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +1 -1
- package/dist/browser/chunks/chunk-4BDLFEOC.js.map +0 -7
- package/dist/browser/chunks/chunk-7DB6BI27.js +0 -6
- package/dist/browser/chunks/chunk-7DB6BI27.js.map +0 -7
- package/dist/browser/chunks/chunk-IX53IFBD.js +0 -13
- package/dist/browser/chunks/chunk-IX53IFBD.js.map +0 -7
- package/dist/browser/chunks/chunk-Q55UPA3E.js +0 -3
- package/dist/browser/chunks/chunk-Q55UPA3E.js.map +0 -7
- package/dist/renamed-scene-names.d.ts +0 -17
- package/dist/renamed-scene-names.d.ts.map +0 -1
- package/dist/renamed-scene-names.js +0 -9
- package/dist/renamed-scene-names.js.map +0 -1
- package/dist/runtime/precompisition.d.ts +0 -24
- package/dist/runtime/precompisition.d.ts.map +0 -1
- package/dist/runtime/precompisition.js +0 -7
- package/dist/runtime/precompisition.js.map +0 -1
|
@@ -11,74 +11,47 @@ function withOptions(base, options = {}) {
|
|
|
11
11
|
out.space = options.space;
|
|
12
12
|
return out;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Immutable, chainable list of fill layers.
|
|
16
|
-
*
|
|
17
|
-
* Each builder method returns a new `FillChain` with the layer appended, so
|
|
18
|
-
* chains are safe to share and branch — mirroring {@link EffectChain}.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* const bg = Fills.image('./background.jpg', { blend: 'overlay', opacity: 0.2 })
|
|
22
|
-
* .color('red', { opacity: 0.3 });
|
|
23
|
-
* node.fill = bg; // assign directly
|
|
24
|
-
* node.fill = [...bg, 'white']; // spread into an array
|
|
25
|
-
*/
|
|
14
|
+
/** Immutable, chainable list of fill layers; each builder returns a new chain, so chains can be shared and branched. */
|
|
26
15
|
export class FillChain {
|
|
27
16
|
list;
|
|
28
17
|
constructor(list = []) {
|
|
29
18
|
this.list = list;
|
|
30
19
|
}
|
|
31
|
-
/** Append a solid color fill. A CSS string or normalized `[r,g,b,a]`. */
|
|
32
20
|
color(color, options) {
|
|
33
21
|
return new FillChain([...this.list, withOptions({ type: 'solid', color }, options)]);
|
|
34
22
|
}
|
|
35
|
-
/**
|
|
36
|
-
* Append an image fill from `src`.
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* Fills.image('./city.jpg', { zoom: 1.4, anchor: 'topCenter', crop: { bottom: 0.2 } })
|
|
40
|
-
*/
|
|
41
23
|
image(src, options) {
|
|
42
|
-
const { fit, crop, zoom, anchor, matrix, preset,
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
// about what a grade means.
|
|
24
|
+
const { fit, crop, zoom, anchor, matrix, preset, ...common } = options ?? {};
|
|
25
|
+
// Forwarded unresolved: `imageFill.resolve` is the one place that
|
|
26
|
+
// flattens a chain, so a fill built here and a fill written as a
|
|
27
|
+
// literal cannot disagree about what a grade means.
|
|
47
28
|
return new FillChain([...this.list, withOptions({
|
|
48
29
|
type: 'image',
|
|
49
30
|
src,
|
|
50
31
|
fit, crop, zoom, anchor, matrix,
|
|
51
|
-
preset,
|
|
32
|
+
preset,
|
|
52
33
|
}, common)]);
|
|
53
34
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Append a video fill from `src`. Plays by default: its source timestamp is
|
|
56
|
-
* derived as it paints, from how long the node carrying the fill has
|
|
57
|
-
* existed — so the clip runs wherever the fill is used (fill, overlay,
|
|
58
|
-
* stroke, shadow, a custom node's `Graphics2D`) with nothing to advance.
|
|
59
|
-
*/
|
|
35
|
+
/** Plays by default: the source timestamp is derived as it paints, from how long the carrying node has existed, so the clip runs wherever the fill is used with nothing to advance. */
|
|
60
36
|
video(src, options) {
|
|
61
|
-
const { fit, crop, zoom, anchor, matrix, preset,
|
|
37
|
+
const { fit, crop, zoom, anchor, matrix, preset, timestamp, playing, trimStart, trimEnd, playStart, speed, loop, duration, ...common } = options ?? {};
|
|
62
38
|
return new FillChain([...this.list, withOptions({
|
|
63
39
|
type: 'video',
|
|
64
40
|
src,
|
|
65
|
-
fit, crop, zoom, anchor, matrix, preset,
|
|
41
|
+
fit, crop, zoom, anchor, matrix, preset,
|
|
66
42
|
timestamp,
|
|
67
43
|
playing: playing ?? true,
|
|
68
44
|
trimStart, trimEnd, playStart, speed, loop, duration,
|
|
69
45
|
}, common)]);
|
|
70
46
|
}
|
|
71
|
-
/** Append a linear gradient between `colors`. */
|
|
72
47
|
linearGradient(colors, options) {
|
|
73
48
|
const { stops, start, end, ...common } = options ?? {};
|
|
74
49
|
return new FillChain([...this.list, withOptions({ type: 'linear-gradient', colors, stops, start, end }, common)]);
|
|
75
50
|
}
|
|
76
|
-
/** Append a radial gradient between `colors`. */
|
|
77
51
|
radialGradient(colors, options) {
|
|
78
52
|
const { stops, center, radius, ...common } = options ?? {};
|
|
79
53
|
return new FillChain([...this.list, withOptions({ type: 'radial-gradient', colors, stops, center, radius }, common)]);
|
|
80
54
|
}
|
|
81
|
-
/** Append a conic gradient between `colors`. */
|
|
82
55
|
conicGradient(colors, options) {
|
|
83
56
|
const { stops, center, startAngle, ...common } = options ?? {};
|
|
84
57
|
return new FillChain([...this.list, withOptions({ type: 'conic-gradient', colors, stops, center, startAngle }, common)]);
|
|
@@ -88,13 +61,7 @@ export class FillChain {
|
|
|
88
61
|
const { size, density, color, seed, ...common } = options ?? {};
|
|
89
62
|
return new FillChain([...this.list, withOptions({ type: 'noise', size, density, color, seed }, common)]);
|
|
90
63
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Append a fractal (fBm) noise fill — a continuous field rather than the
|
|
93
|
-
* speckle {@link noise} paints. Cloud, marble, smoke, terrain, plasma.
|
|
94
|
-
*
|
|
95
|
-
* Tween `offset` to travel through the field (it flows); tween `seed` to
|
|
96
|
-
* shift to a different field entirely (it churns).
|
|
97
|
-
*/
|
|
64
|
+
/** A continuous field (cloud, marble, smoke), unlike the speckle of {@link noise}. Tween `offset` to flow through it, `seed` to churn to a different field. */
|
|
98
65
|
fractalNoise(options) {
|
|
99
66
|
const { basis, octaves, frequency, lacunarity, gain, seed, offset, angle, colors, stops, contrast, ...common } = options ?? {};
|
|
100
67
|
return new FillChain([...this.list, withOptions({
|
|
@@ -104,18 +71,10 @@ export class FillChain {
|
|
|
104
71
|
}, common)]);
|
|
105
72
|
}
|
|
106
73
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* uniforms as `struct Params`, read as `u.<name>`. It returns
|
|
112
|
-
* **premultiplied** rgba, without folding `opacity` in (the layer's opacity is
|
|
113
|
-
* already applied, so applying it twice squares it). Uniforms are keyed by
|
|
114
|
-
* their declared name, so order is irrelevant.
|
|
115
|
-
*
|
|
116
|
-
* Keep `source` constant — it is the compile-cache key, so it snaps at a
|
|
117
|
-
* tween's midpoint and rebuilding it per frame compiles a program per frame.
|
|
118
|
-
* Everything that changes belongs in a uniform, which is an in-place write.
|
|
74
|
+
* Custom shader fill. The WGSL `source` defines `fn fill(in: FillIn) -> vec4f` and declares uniforms as
|
|
75
|
+
* `struct Params`, read as `u.<name>`. It returns **premultiplied** rgba without folding `opacity` in (already
|
|
76
|
+
* applied; doing it twice squares it). Keep `source` constant: it is the compile-cache key, so it snaps at a
|
|
77
|
+
* tween's midpoint and rebuilding it per frame compiles a program per frame. Changing values belong in uniforms.
|
|
119
78
|
*
|
|
120
79
|
* @example
|
|
121
80
|
* Fills.shader(GLOW, { uniforms: { amount: 0.6 } })
|
|
@@ -142,34 +101,16 @@ export class FillChain {
|
|
|
142
101
|
...(pack?.id !== undefined ? { shaderId: pack.id } : {}),
|
|
143
102
|
}, common)]);
|
|
144
103
|
}
|
|
145
|
-
/** Append a stripe (hatch) fill. */
|
|
146
104
|
stripe(options) {
|
|
147
105
|
const { gap, strokeWidth, angle, color, ...common } = options ?? {};
|
|
148
106
|
return new FillChain([...this.list, withOptions({ type: 'stripe', gap, strokeWidth, angle, color }, common)]);
|
|
149
107
|
}
|
|
150
|
-
/**
|
|
151
|
-
* Append a dot-grid fill — a lattice of dots at a pixel pitch.
|
|
152
|
-
*
|
|
153
|
-
* Tween `offset` to drift the field under a shape that isn't moving; tween
|
|
154
|
-
* `spacing` or `radius` to breathe it.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* Fills.dotGrid({ radius: 1.5, spacing: 24, color: 'muted' })
|
|
158
|
-
*/
|
|
108
|
+
/** Lattice of dots at a pixel pitch. Tween `offset` to drift the field under a still shape. */
|
|
159
109
|
dotGrid(options) {
|
|
160
110
|
const { radius, spacing, offset, color, ...common } = options ?? {};
|
|
161
111
|
return new FillChain([...this.list, withOptions({ type: 'dotGrid', radius, spacing, offset, color }, common)]);
|
|
162
112
|
}
|
|
163
|
-
/**
|
|
164
|
-
* Append a grid fill — ruled lines dividing the shape into cells, with an
|
|
165
|
-
* optional finer ruling nested inside each one.
|
|
166
|
-
*
|
|
167
|
-
* Sized in divisions of the shape rather than in px (unlike {@link dotGrid}),
|
|
168
|
-
* so it holds its structure as the shape resizes.
|
|
169
|
-
*
|
|
170
|
-
* @example
|
|
171
|
-
* Fills.grid({ divisions: 8, subdivisions: 4, color: 'border' })
|
|
172
|
-
*/
|
|
113
|
+
/** Ruled lines dividing the shape into cells, optionally with a finer ruling inside. Sized in divisions rather than px (unlike {@link dotGrid}), so it holds its structure as the shape resizes. */
|
|
173
114
|
grid(options) {
|
|
174
115
|
const { divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color, ...common } = options ?? {};
|
|
175
116
|
return new FillChain([...this.list, withOptions({
|
|
@@ -178,59 +119,31 @@ export class FillChain {
|
|
|
178
119
|
}, common)]);
|
|
179
120
|
}
|
|
180
121
|
/**
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
184
|
-
* comes from where the value is produced (a `renderSelf`, or a `() => …`
|
|
185
|
-
* reactive binding), like every other fill.
|
|
186
|
-
*
|
|
187
|
-
* Note two same-type 3D layers hard-cut rather than cross-fading, because a
|
|
188
|
-
* command list has no meaningful in-between. To dissolve between two scenes,
|
|
189
|
-
* stack them and tween their opacities in opposite directions.
|
|
122
|
+
* A 3D scene painted through the shape's own path. Takes a **built** {@link Scene3D}, never a builder; freshness
|
|
123
|
+
* comes from where the value is produced (a `renderSelf`, or a `() => …` binding). Two same-type 3D layers
|
|
124
|
+
* hard-cut rather than cross-fading (a command list has no in-between): stack them and tween opacities instead.
|
|
190
125
|
*/
|
|
191
126
|
canvas3D(scene, options) {
|
|
192
127
|
const { maxPixelRatio, antialias, ...common } = options ?? {};
|
|
193
128
|
return new FillChain([...this.list, withOptions({ type: 'canvas3D', scene, maxPixelRatio, antialias }, common)]);
|
|
194
129
|
}
|
|
195
|
-
/** Allows spreading the chain into an array: `[...Fills.color('red')]`. */
|
|
196
130
|
*[Symbol.iterator]() {
|
|
197
131
|
yield* this.list;
|
|
198
132
|
}
|
|
199
|
-
/** Serializes to the raw fill array so frameworks that call `toJSON` get a plain value. */
|
|
200
133
|
toJSON() {
|
|
201
134
|
return this.list;
|
|
202
135
|
}
|
|
203
136
|
}
|
|
204
|
-
/**
|
|
205
|
-
* Entry point for building fill chains fluently.
|
|
206
|
-
*
|
|
207
|
-
* An empty {@link FillChain}, so `Fills.image(src)` *is* `new FillChain().image(src)`
|
|
208
|
-
* — every builder's signature and documentation has one definition, on the
|
|
209
|
-
* class, which is what an editor shows when you hover `Fills.image`. The chain
|
|
210
|
-
* is immutable (each builder returns a new one), so sharing one empty instance
|
|
211
|
-
* as the entry point is safe.
|
|
212
|
-
*
|
|
213
|
-
* @example
|
|
214
|
-
* node.fill = Fills.image('./bg.jpg', { opacity: 0.2 }).color('red', { opacity: 0.3 });
|
|
215
|
-
*/
|
|
137
|
+
/** An empty {@link FillChain}: `Fills.image(src)` *is* `new FillChain().image(src)`, so builders are documented once, on the class. Chains are immutable, so sharing one instance is safe. */
|
|
216
138
|
export const Fills = new FillChain();
|
|
217
|
-
/**
|
|
218
|
-
* Normalises any {@link Fill} value to a plain `FillProp[]`.
|
|
219
|
-
* Used by `resolveFillArray` before resolving to the renderer shape.
|
|
220
|
-
*
|
|
221
|
-
* Already-resolved fills (`FillResolved`) structurally satisfy `FillProp`, so
|
|
222
|
-
* they pass straight through and `resolveFill` re-normalises them idempotently.
|
|
223
|
-
*/
|
|
139
|
+
/** Normalises any {@link Fill} to `FillProp[]`. Already-resolved fills structurally satisfy `FillProp` and pass through (`resolveFill` re-normalises idempotently). */
|
|
224
140
|
export function resolveChainFill(fill) {
|
|
225
141
|
if (fill == null)
|
|
226
142
|
return [];
|
|
227
143
|
if (fill instanceof FillChain)
|
|
228
144
|
return fill.list;
|
|
229
145
|
if (Array.isArray(fill)) {
|
|
230
|
-
// Flatten
|
|
231
|
-
// layers in place: `['#e8c584', Fills.image('bg.jpg')]` — and the plain
|
|
232
|
-
// array a chain serializes to, which is how that value reads back out of
|
|
233
|
-
// a stored document.
|
|
146
|
+
// Flatten chains used as array elements, and the plain array a chain serializes to (how it reads back from a stored document).
|
|
234
147
|
const out = [];
|
|
235
148
|
for (const item of fill) {
|
|
236
149
|
if (item instanceof FillChain)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/chain.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAA6B,MAAM,oBAAoB,CAAC;AA0DxF,mFAAmF;AACnF,SAAS,WAAW,CAAmB,IAAO,EAAE,UAAuB,EAAE;IACrE,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,EAAqB,CAAC;IAC3C,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjE,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC3D,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;QAAE,GAAG,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC3D,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,SAAS;IACC;IAAnB,YAAmB,OAAmB,EAAE;QAArB,SAAI,GAAJ,IAAI,CAAiB;IAAI,CAAC;IAE7C,yEAAyE;IACzE,KAAK,CAAC,KAAY,EAAE,OAAqB;QACrC,OAAO,IAAI,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,IAAI,EAAE,OAAgB,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAClG,CAAC;IAED;;;;;OAKG;IACH,KAAK,CACD,GAAW,EACX,OAKC;QAED,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,IAAI,EAAE,C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ACtB,oEAAoE;QACpE,wEAAwE;QACxE,yEAAyE;QACzE,qBAAqB;QACrB,MAAM,GAAG,GAAe,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,IAAI,YAAY,SAAS;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;iBACjD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,IAAY,CAAC,CAAC,CAAC;;gBACrE,GAAG,CAAC,IAAI,CAAC,IAAgB,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,CAAC,IAAgB,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { Color } from \"./color/parser\";\nimport type { BlendMode } from \"./blend\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { ImageAdjustment, VideoAdjustment } from \"../filters/chain\";\nimport type { MediaPresetProp, VideoPresetProp } from \"./media-preset\";\nimport type { FillProp, FillResolved, FillSpace } from \"./union\";\nimport { normalizeUniforms } from \"../shaders/uniforms\";\nimport { resolveShaderProperties, type ShaderPropertyValues } from \"../shaders/resolve\";\nimport type { FillShader } from \"../shaders/pack\";\nimport type { ImageCrop, ImageFit, ImageMatrix } from \"./implementations/image\";\nimport type { Alignment } from \"@/attributes/layout/alignment\";\nimport type { FractalNoiseFillProp } from \"./implementations/fractal-noise\";\nimport type { DotGridFillProp } from \"./implementations/dot-grid\";\nimport type { GridFillProp } from \"./implementations/grid\";\nimport type { ShaderFillProp } from \"./implementations/shader\";\nimport type { Scene3D } from \"@/render3d/scene3d\";\n\n/** Placement options shared by the image and video fill builders. */\nexport interface MediaPlacementOptions {\n /** How the (cropped) source is scaled into the node's bounds. Default `'fill'`. */\n fit?: ImageFit;\n /** Window onto the source, in fractions of its own size, applied before `fit`. */\n crop?: ImageCrop;\n /** Magnification on top of the fitted scale. `1` is the fitted size. */\n zoom?: number;\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\n anchor?: Alignment;\n /** Raw source→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\n matrix?: ImageMatrix;\n}\n\n/** Author-facing options for a {@link FillChain.video} layer. */\nexport interface VideoFillOptions extends FillOptions, MediaPlacementOptions {\n /** The grade laid over the footage — an adjustment chain plus a 0–1 mix. */\n preset?: VideoPresetProp;\n /** @deprecated Moved to `preset.adjustments`. Removed in the next major. */\n filters?: VideoAdjustment;\n /**\n * Explicit source time to paint, in seconds. Omit it and the clip plays by\n * itself, timed from the moment the node painting it appeared — set it only\n * to drive the playhead yourself (`null` hands the playhead back).\n */\n timestamp?: number | null;\n /** Whether playback advances with the node's clock. Defaults to `true`. */\n playing?: boolean;\n trimStart?: number;\n trimEnd?: number;\n /** Seconds after the painting node appears before playback begins. Default `0`. */\n playStart?: number;\n speed?: number;\n loop?: 'forward' | 'reverse' | 'none';\n duration?: number;\n}\n\n/**\n * Cross-cutting options shared by every fill layer. These map onto the\n * `opacity` / `blend` fields each fill prop already accepts, plus the\n * `space` directive carried generically by the registry.\n */\nexport interface FillOptions {\n opacity?: number;\n blend?: BlendMode;\n space?: FillSpace;\n}\n\n/** Strip `undefined` option keys so the produced props stay minimal/comparable. */\nfunction withOptions<T extends object>(base: T, options: FillOptions = {}): T & FillOptions {\n const out = { ...base } as T & FillOptions;\n if (options.opacity !== undefined) out.opacity = options.opacity;\n if (options.blend !== undefined) out.blend = options.blend;\n if (options.space !== undefined) out.space = options.space;\n return out;\n}\n\n/**\n * Immutable, chainable list of fill layers.\n *\n * Each builder method returns a new `FillChain` with the layer appended, so\n * chains are safe to share and branch — mirroring {@link EffectChain}.\n *\n * @example\n * const bg = Fills.image('./background.jpg', { blend: 'overlay', opacity: 0.2 })\n * .color('red', { opacity: 0.3 });\n * node.fill = bg; // assign directly\n * node.fill = [...bg, 'white']; // spread into an array\n */\nexport class FillChain {\n constructor(public list: FillProp[] = []) { }\n\n /** Append a solid color fill. A CSS string or normalized `[r,g,b,a]`. */\n color(color: Color, options?: FillOptions) {\n return new FillChain([...this.list, withOptions({ type: 'solid' as const, color }, options)]);\n }\n\n /**\n * Append an image fill from `src`.\n *\n * @example\n * Fills.image('./city.jpg', { zoom: 1.4, anchor: 'topCenter', crop: { bottom: 0.2 } })\n */\n image(\n src: string,\n options?: FillOptions & MediaPlacementOptions & {\n /** The grade laid over the picture — an adjustment chain plus a 0–1 mix. */\n preset?: MediaPresetProp;\n /** @deprecated Moved to `preset.adjustments`. Removed in the next major. */\n filters?: ImageAdjustment;\n },\n ) {\n const { fit, crop, zoom, anchor, matrix, preset, filters, ...common } = options ?? {};\n // Both are forwarded unresolved: `imageFill.resolve` is the one place\n // that flattens a chain and folds the deprecated prop into the preset,\n // so a fill built here and a fill written as a literal cannot disagree\n // about what a grade means.\n return new FillChain([...this.list, withOptions({\n type: 'image' as const,\n src,\n fit, crop, zoom, anchor, matrix,\n preset, filters,\n }, common)]);\n }\n\n /**\n * Append a video fill from `src`. Plays by default: its source timestamp is\n * derived as it paints, from how long the node carrying the fill has\n * existed — so the clip runs wherever the fill is used (fill, overlay,\n * stroke, shadow, a custom node's `Graphics2D`) with nothing to advance.\n */\n video(src: string, options?: VideoFillOptions) {\n const { fit, crop, zoom, anchor, matrix, preset, filters, timestamp, playing, trimStart, trimEnd, playStart, speed, loop, duration, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({\n type: 'video' as const,\n src,\n fit, crop, zoom, anchor, matrix, preset, filters,\n timestamp,\n playing: playing ?? true,\n trimStart, trimEnd, playStart, speed, loop, duration,\n }, common)]);\n }\n\n\n /** Append a linear gradient between `colors`. */\n linearGradient(colors: Color[], options?: FillOptions & { stops?: number[]; start?: Vector2; end?: Vector2 }) {\n const { stops, start, end, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'linear-gradient' as const, colors, stops, start, end }, common)]);\n }\n\n /** Append a radial gradient between `colors`. */\n radialGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; radius?: number }) {\n const { stops, center, radius, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'radial-gradient' as const, colors, stops, center, radius }, common)]);\n }\n\n /** Append a conic gradient between `colors`. */\n conicGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; startAngle?: number }) {\n const { stops, center, startAngle, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'conic-gradient' as const, colors, stops, center, startAngle }, common)]);\n }\n\n /** Append a noise (speckle) fill. Tween `seed` to make the static crawl. */\n noise(options?: FillOptions & { size?: Vector2; density?: number; color?: Color; seed?: number }) {\n const { size, density, color, seed, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'noise' as const, size, density, color, seed }, common)]);\n }\n\n /**\n * Append a fractal (fBm) noise fill — a continuous field rather than the\n * speckle {@link noise} paints. Cloud, marble, smoke, terrain, plasma.\n *\n * Tween `offset` to travel through the field (it flows); tween `seed` to\n * shift to a different field entirely (it churns).\n */\n fractalNoise(options?: FillOptions & Omit<FractalNoiseFillProp, 'type' | 'opacity' | 'blend'>) {\n const {\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\n colors, stops, contrast, ...common\n } = options ?? {};\n return new FillChain([...this.list, withOptions(\n {\n type: 'fractalNoise' as const,\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\n colors, stops, contrast,\n },\n common,\n )]);\n }\n\n /**\n * Append a custom shader fill — the escape hatch past {@link noise} and\n * {@link fractalNoise}, where the author writes the fragment function.\n *\n * The WGSL `source` defines `fn fill(in: FillIn) -> vec4f` and declares its\n * uniforms as `struct Params`, read as `u.<name>`. It returns\n * **premultiplied** rgba, without folding `opacity` in (the layer's opacity is\n * already applied, so applying it twice squares it). Uniforms are keyed by\n * their declared name, so order is irrelevant.\n *\n * Keep `source` constant — it is the compile-cache key, so it snaps at a\n * tween's midpoint and rebuilding it per frame compiles a program per frame.\n * Everything that changes belongs in a uniform, which is an in-place write.\n *\n * @example\n * Fills.shader(GLOW, { uniforms: { amount: 0.6 } })\n */\n shader(\n source: string | FillShader,\n options?: FillOptions\n & Omit<ShaderFillProp, 'type' | 'source' | 'language' | 'opacity' | 'blend' | 'shaderId'>\n & { values?: ShaderPropertyValues },\n ) {\n const pack = typeof source === 'string' ? undefined : source;\n if (pack && pack.scope !== 'fill') {\n throw new Error(\n `Fills.shader was given a \"${(pack as { scope: string }).scope}\" shader ` +\n `(\"${pack.name}\"). An effect shader samples a backdrop a fill does not have; ` +\n `use Effects.shader.`,\n );\n }\n const { uniforms, textures, values, ...common } = options ?? {};\n // A pack resolves to plain uniforms here; anything passed as `uniforms`\n // still wins, matching how an author value overrides a built-in.\n const resolved = pack\n ? { ...resolveShaderProperties(pack, values), ...normalizeUniforms(uniforms ?? {}) }\n : uniforms;\n return new FillChain([...this.list, withOptions(\n {\n type: 'shader' as const,\n source: typeof source === 'string' ? source : source.source,\n language: 'wgsl' as const,\n uniforms: resolved,\n textures,\n ...(pack?.id !== undefined ? { shaderId: pack.id } : {}),\n },\n common,\n )]);\n }\n\n /** Append a stripe (hatch) fill. */\n stripe(options?: FillOptions & { gap?: number; strokeWidth?: number; angle?: number; color?: Color }) {\n const { gap, strokeWidth, angle, color, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'stripe' as const, gap, strokeWidth, angle, color }, common)]);\n }\n\n /**\n * Append a dot-grid fill — a lattice of dots at a pixel pitch.\n *\n * Tween `offset` to drift the field under a shape that isn't moving; tween\n * `spacing` or `radius` to breathe it.\n *\n * @example\n * Fills.dotGrid({ radius: 1.5, spacing: 24, color: 'muted' })\n */\n dotGrid(options?: FillOptions & Omit<DotGridFillProp, 'type' | 'opacity' | 'blend'>) {\n const { radius, spacing, offset, color, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions(\n { type: 'dotGrid' as const, radius, spacing, offset, color },\n common,\n )]);\n }\n\n /**\n * Append a grid fill — ruled lines dividing the shape into cells, with an\n * optional finer ruling nested inside each one.\n *\n * Sized in divisions of the shape rather than in px (unlike {@link dotGrid}),\n * so it holds its structure as the shape resizes.\n *\n * @example\n * Fills.grid({ divisions: 8, subdivisions: 4, color: 'border' })\n */\n grid(options?: FillOptions & Omit<GridFillProp, 'type' | 'opacity' | 'blend'>) {\n const {\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color, ...common\n } = options ?? {};\n return new FillChain([...this.list, withOptions(\n {\n type: 'grid' as const,\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color,\n },\n common,\n )]);\n }\n\n /**\n * Append a 3D scene, painted through the shape's own path.\n *\n * Takes a **built** {@link Scene3D}, never a builder — per-frame freshness\n * comes from where the value is produced (a `renderSelf`, or a `() => …`\n * reactive binding), like every other fill.\n *\n * Note two same-type 3D layers hard-cut rather than cross-fading, because a\n * command list has no meaningful in-between. To dissolve between two scenes,\n * stack them and tween their opacities in opposite directions.\n */\n canvas3D(scene: Scene3D, options?: FillOptions & { maxPixelRatio?: number; antialias?: boolean }) {\n const { maxPixelRatio, antialias, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'canvas3D' as const, scene, maxPixelRatio, antialias }, common)]);\n }\n\n /** Allows spreading the chain into an array: `[...Fills.color('red')]`. */\n *[Symbol.iterator]() {\n yield* this.list;\n }\n\n /** Serializes to the raw fill array so frameworks that call `toJSON` get a plain value. */\n toJSON() {\n return this.list;\n }\n}\n\n/**\n * Accepted shapes for a node's `fill` prop.\n *\n * Can be a single fill, a `FillChain` builder result, an already-resolved\n * {@link FillResolved}, or an array mixing any of these (each chain contributes\n * all its layers in place):\n *\n * 'red' // plain CSS color\n * Fills.image('bg.jpg') // chain\n * ['#e8c584', Fills.image('bg.jpg')]\n * ['#e8c584', ...Fills.image('bg.jpg')]\n * resolvedFills // FillResolved[] passes through\n */\nexport type Fill =\n | FillProp\n | FillResolved\n | FillChain\n | (FillProp | FillResolved | FillChain)[];\n\n/**\n * Entry point for building fill chains fluently.\n *\n * An empty {@link FillChain}, so `Fills.image(src)` *is* `new FillChain().image(src)`\n * — every builder's signature and documentation has one definition, on the\n * class, which is what an editor shows when you hover `Fills.image`. The chain\n * is immutable (each builder returns a new one), so sharing one empty instance\n * as the entry point is safe.\n *\n * @example\n * node.fill = Fills.image('./bg.jpg', { opacity: 0.2 }).color('red', { opacity: 0.3 });\n */\nexport const Fills = new FillChain();\n\n/**\n * Normalises any {@link Fill} value to a plain `FillProp[]`.\n * Used by `resolveFillArray` before resolving to the renderer shape.\n *\n * Already-resolved fills (`FillResolved`) structurally satisfy `FillProp`, so\n * they pass straight through and `resolveFill` re-normalises them idempotently.\n */\nexport function resolveChainFill(fill: Fill | undefined): FillProp[] {\n if (fill == null) return [];\n if (fill instanceof FillChain) return fill.list;\n if (Array.isArray(fill)) {\n // Flatten any chains used as array elements so each contributes its\n // layers in place: `['#e8c584', Fills.image('bg.jpg')]` — and the plain\n // array a chain serializes to, which is how that value reads back out of\n // a stored document.\n const out: FillProp[] = [];\n for (const item of fill) {\n if (item instanceof FillChain) out.push(...item.list);\n else if (Array.isArray(item)) out.push(...resolveChainFill(item as Fill));\n else out.push(item as FillProp);\n }\n return out;\n }\n return [fill as FillProp];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chain.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/chain.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAA6B,MAAM,oBAAoB,CAAC;AAgDxF,mFAAmF;AACnF,SAAS,WAAW,CAAmB,IAAO,EAAE,UAAuB,EAAE;IACrE,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,EAAqB,CAAC;IAC3C,IAAI,OAAO,CAAC,OAAO,KAAK,SAAS;QAAE,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjE,IAAI,OAAO,CAAC,KAA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,CAAC,CAAC,CAAC;IAC9H,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QACd,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACJ;AASD,8LAA8L;AAC9L,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,SAAS,EAAE,CAAC;AAErC,uKAAuK;AACvK,MAAM,UAAU,gBAAgB,CAAC,IAAsB;IACnD,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,EAAE,CAAC;IAC5B,IAAI,IAAI,YAAY,SAAS;QAAE,OAAO,IAAI,CAAC,IAAI,CAAC;IAChD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACtB,+HAA+H;QAC/H,MAAM,GAAG,GAAe,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,IAAI,YAAY,SAAS;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;iBACjD,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBAAE,GAAG,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,IAAY,CAAC,CAAC,CAAC;;gBACrE,GAAG,CAAC,IAAI,CAAC,IAAgB,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,CAAC,IAAgB,CAAC,CAAC;AAC9B,CAAC","sourcesContent":["import type { Color } from \"./color/parser\";\nimport type { BlendMode } from \"./blend\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { MediaPresetProp, VideoPresetProp } from \"./media-preset\";\nimport type { FillProp, FillResolved, FillSpace } from \"./union\";\nimport { normalizeUniforms } from \"../shaders/uniforms\";\nimport { resolveShaderProperties, type ShaderPropertyValues } from \"../shaders/resolve\";\nimport type { FillShader } from \"../shaders/pack\";\nimport type { ImageCrop, ImageFit, ImageMatrix } from \"./implementations/image\";\nimport type { Alignment } from \"@/attributes/layout/alignment\";\nimport type { FractalNoiseFillProp } from \"./implementations/fractal-noise\";\nimport type { DotGridFillProp } from \"./implementations/dot-grid\";\nimport type { GridFillProp } from \"./implementations/grid\";\nimport type { ShaderFillProp } from \"./implementations/shader\";\nimport type { Scene3D } from \"@/render3d/scene3d\";\n\n/** Placement options shared by the image and video fill builders. */\nexport interface MediaPlacementOptions {\n /** How the (cropped) source is scaled into the node's bounds. Default `'fill'`. */\n fit?: ImageFit;\n /** Window onto the source, in fractions of its own size, applied before `fit`. */\n crop?: ImageCrop;\n /** Magnification on top of the fitted scale. `1` is the fitted size. */\n zoom?: number;\n /** The point held fixed as `zoom` scales; also the alignment when it doesn't cover. */\n anchor?: Alignment;\n /** Raw source→shape matrix; bypasses `crop`/`fit`/`zoom`/`anchor` and the bounds. */\n matrix?: ImageMatrix;\n}\n\n/** Author-facing options for a {@link FillChain.video} layer. */\nexport interface VideoFillOptions extends FillOptions, MediaPlacementOptions {\n /** The grade laid over the footage — an adjustment chain plus a 0–1 mix. */\n preset?: VideoPresetProp;\n /** Explicit source time in seconds. Omit and the clip plays by itself from when the node appeared; set only to drive the playhead yourself (`null` hands it back). */\n timestamp?: number | null;\n /** Whether playback advances with the node's clock. Defaults to `true`. */\n playing?: boolean;\n trimStart?: number;\n trimEnd?: number;\n /** Seconds after the painting node appears before playback begins. Default `0`. */\n playStart?: number;\n speed?: number;\n loop?: 'forward' | 'reverse' | 'none';\n duration?: number;\n}\n\n/** Cross-cutting options for every fill layer: the `opacity` / `blend` fields each fill prop accepts, plus the registry's generic `space` directive. */\nexport interface FillOptions {\n opacity?: number;\n blend?: BlendMode;\n space?: FillSpace;\n}\n\n/** Strip `undefined` option keys so the produced props stay minimal/comparable. */\nfunction withOptions<T extends object>(base: T, options: FillOptions = {}): T & FillOptions {\n const out = { ...base } as T & FillOptions;\n if (options.opacity !== undefined) out.opacity = options.opacity;\n if (options.blend !== undefined) out.blend = options.blend;\n if (options.space !== undefined) out.space = options.space;\n return out;\n}\n\n/** Immutable, chainable list of fill layers; each builder returns a new chain, so chains can be shared and branched. */\nexport class FillChain {\n constructor(public list: FillProp[] = []) { }\n\n color(color: Color, options?: FillOptions) {\n return new FillChain([...this.list, withOptions({ type: 'solid' as const, color }, options)]);\n }\n\n image(\n src: string,\n options?: FillOptions & MediaPlacementOptions & {\n /** The grade laid over the picture — an adjustment chain plus a 0–1 mix. */\n preset?: MediaPresetProp;\n },\n ) {\n const { fit, crop, zoom, anchor, matrix, preset, ...common } = options ?? {};\n // Forwarded unresolved: `imageFill.resolve` is the one place that\n // flattens a chain, so a fill built here and a fill written as a\n // literal cannot disagree about what a grade means.\n return new FillChain([...this.list, withOptions({\n type: 'image' as const,\n src,\n fit, crop, zoom, anchor, matrix,\n preset,\n }, common)]);\n }\n\n /** Plays by default: the source timestamp is derived as it paints, from how long the carrying node has existed, so the clip runs wherever the fill is used with nothing to advance. */\n video(src: string, options?: VideoFillOptions) {\n const { fit, crop, zoom, anchor, matrix, preset, timestamp, playing, trimStart, trimEnd, playStart, speed, loop, duration, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({\n type: 'video' as const,\n src,\n fit, crop, zoom, anchor, matrix, preset,\n timestamp,\n playing: playing ?? true,\n trimStart, trimEnd, playStart, speed, loop, duration,\n }, common)]);\n }\n\n\n linearGradient(colors: Color[], options?: FillOptions & { stops?: number[]; start?: Vector2; end?: Vector2 }) {\n const { stops, start, end, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'linear-gradient' as const, colors, stops, start, end }, common)]);\n }\n\n radialGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; radius?: number }) {\n const { stops, center, radius, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'radial-gradient' as const, colors, stops, center, radius }, common)]);\n }\n\n conicGradient(colors: Color[], options?: FillOptions & { stops?: number[]; center?: Vector2; startAngle?: number }) {\n const { stops, center, startAngle, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'conic-gradient' as const, colors, stops, center, startAngle }, common)]);\n }\n\n /** Append a noise (speckle) fill. Tween `seed` to make the static crawl. */\n noise(options?: FillOptions & { size?: Vector2; density?: number; color?: Color; seed?: number }) {\n const { size, density, color, seed, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'noise' as const, size, density, color, seed }, common)]);\n }\n\n /** A continuous field (cloud, marble, smoke), unlike the speckle of {@link noise}. Tween `offset` to flow through it, `seed` to churn to a different field. */\n fractalNoise(options?: FillOptions & Omit<FractalNoiseFillProp, 'type' | 'opacity' | 'blend'>) {\n const {\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\n colors, stops, contrast, ...common\n } = options ?? {};\n return new FillChain([...this.list, withOptions(\n {\n type: 'fractalNoise' as const,\n basis, octaves, frequency, lacunarity, gain, seed, offset, angle,\n colors, stops, contrast,\n },\n common,\n )]);\n }\n\n /**\n * Custom shader fill. The WGSL `source` defines `fn fill(in: FillIn) -> vec4f` and declares uniforms as\n * `struct Params`, read as `u.<name>`. It returns **premultiplied** rgba without folding `opacity` in (already\n * applied; doing it twice squares it). Keep `source` constant: it is the compile-cache key, so it snaps at a\n * tween's midpoint and rebuilding it per frame compiles a program per frame. Changing values belong in uniforms.\n *\n * @example\n * Fills.shader(GLOW, { uniforms: { amount: 0.6 } })\n */\n shader(\n source: string | FillShader,\n options?: FillOptions\n & Omit<ShaderFillProp, 'type' | 'source' | 'language' | 'opacity' | 'blend' | 'shaderId'>\n & { values?: ShaderPropertyValues },\n ) {\n const pack = typeof source === 'string' ? undefined : source;\n if (pack && pack.scope !== 'fill') {\n throw new Error(\n `Fills.shader was given a \"${(pack as { scope: string }).scope}\" shader ` +\n `(\"${pack.name}\"). An effect shader samples a backdrop a fill does not have; ` +\n `use Effects.shader.`,\n );\n }\n const { uniforms, textures, values, ...common } = options ?? {};\n // A pack resolves to plain uniforms here; anything passed as `uniforms`\n // still wins, matching how an author value overrides a built-in.\n const resolved = pack\n ? { ...resolveShaderProperties(pack, values), ...normalizeUniforms(uniforms ?? {}) }\n : uniforms;\n return new FillChain([...this.list, withOptions(\n {\n type: 'shader' as const,\n source: typeof source === 'string' ? source : source.source,\n language: 'wgsl' as const,\n uniforms: resolved,\n textures,\n ...(pack?.id !== undefined ? { shaderId: pack.id } : {}),\n },\n common,\n )]);\n }\n\n stripe(options?: FillOptions & { gap?: number; strokeWidth?: number; angle?: number; color?: Color }) {\n const { gap, strokeWidth, angle, color, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'stripe' as const, gap, strokeWidth, angle, color }, common)]);\n }\n\n /** Lattice of dots at a pixel pitch. Tween `offset` to drift the field under a still shape. */\n dotGrid(options?: FillOptions & Omit<DotGridFillProp, 'type' | 'opacity' | 'blend'>) {\n const { radius, spacing, offset, color, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions(\n { type: 'dotGrid' as const, radius, spacing, offset, color },\n common,\n )]);\n }\n\n /** Ruled lines dividing the shape into cells, optionally with a finer ruling inside. Sized in divisions rather than px (unlike {@link dotGrid}), so it holds its structure as the shape resizes. */\n grid(options?: FillOptions & Omit<GridFillProp, 'type' | 'opacity' | 'blend'>) {\n const {\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color, ...common\n } = options ?? {};\n return new FillChain([...this.list, withOptions(\n {\n type: 'grid' as const,\n divisions, subdivisions, offset, strokeWidth, subdivisionWidth, color,\n },\n common,\n )]);\n }\n\n /**\n * A 3D scene painted through the shape's own path. Takes a **built** {@link Scene3D}, never a builder; freshness\n * comes from where the value is produced (a `renderSelf`, or a `() => …` binding). Two same-type 3D layers\n * hard-cut rather than cross-fading (a command list has no in-between): stack them and tween opacities instead.\n */\n canvas3D(scene: Scene3D, options?: FillOptions & { maxPixelRatio?: number; antialias?: boolean }) {\n const { maxPixelRatio, antialias, ...common } = options ?? {};\n return new FillChain([...this.list, withOptions({ type: 'canvas3D' as const, scene, maxPixelRatio, antialias }, common)]);\n }\n\n *[Symbol.iterator]() {\n yield* this.list;\n }\n\n toJSON() {\n return this.list;\n }\n}\n\n/** Accepted shapes for a node's `fill`: a single fill, a `FillChain`, an already-resolved {@link FillResolved}, or an array mixing these (chains contribute their layers in place). */\nexport type Fill =\n | FillProp\n | FillResolved\n | FillChain\n | (FillProp | FillResolved | FillChain)[];\n\n/** An empty {@link FillChain}: `Fills.image(src)` *is* `new FillChain().image(src)`, so builders are documented once, on the class. Chains are immutable, so sharing one instance is safe. */\nexport const Fills = new FillChain();\n\n/** Normalises any {@link Fill} to `FillProp[]`. Already-resolved fills structurally satisfy `FillProp` and pass through (`resolveFill` re-normalises idempotently). */\nexport function resolveChainFill(fill: Fill | undefined): FillProp[] {\n if (fill == null) return [];\n if (fill instanceof FillChain) return fill.list;\n if (Array.isArray(fill)) {\n // Flatten chains used as array elements, and the plain array a chain serializes to (how it reads back from a stored document).\n const out: FillProp[] = [];\n for (const item of fill) {\n if (item instanceof FillChain) out.push(...item.list);\n else if (Array.isArray(item)) out.push(...resolveChainFill(item as Fill));\n else out.push(item as FillProp);\n }\n return out;\n }\n return [fill as FillProp];\n}\n"]}
|
|
@@ -1,44 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cross-type fill coercion for tweening.
|
|
2
|
+
* Cross-type fill coercion for tweening. The renderer dispatches by `fill.type`, so an in-between frame must be a
|
|
3
|
+
* fully-formed fill of one concrete type: when a tween's endpoints differ, both are promoted to a common type, then
|
|
4
|
+
* that type's `lerp` runs.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* endpoints to a common target type, then run that type's normal `lerp`.
|
|
6
|
+
* - `color` is a degenerate gradient: against a gradient, the color expands into a uniform gradient (every stop that
|
|
7
|
+
* color), which renders identically to the flat color, so frame 0 of color→gradient looks like the color.
|
|
8
|
+
* - Two *different* gradient types share no geometry, so coerce toward the destination (`to`) type: colors/stops/opacity
|
|
9
|
+
* interpolate while geometry adopts the destination's, snapped at frame 0.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* - `color` is treated as a degenerate gradient — a single solid color. It is
|
|
13
|
-
* the least "rich" fill, so when one side is a color and the other a
|
|
14
|
-
* gradient, the gradient type wins and the color is expanded into a uniform
|
|
15
|
-
* gradient (every stop set to that color). A uniform gradient renders
|
|
16
|
-
* identically to the flat color, so frame 0 of a color→gradient tween looks
|
|
17
|
-
* exactly like the color, then morphs into the gradient.
|
|
18
|
-
*
|
|
19
|
-
* - Two *different* gradient types share no geometry (a linear gradient's
|
|
20
|
-
* start/end has no radial-gradient counterpart). There is no meaningful
|
|
21
|
-
* in-between for that geometry, so we coerce toward the destination (`to`)
|
|
22
|
-
* type: colors/stops/opacity interpolate while the geometry adopts the
|
|
23
|
-
* destination's, snapped at frame 0.
|
|
24
|
-
*
|
|
25
|
-
* Coercion never mutates its input; it returns a fresh resolved fill.
|
|
11
|
+
* Coercion never mutates its input.
|
|
26
12
|
*/
|
|
27
13
|
import type { FillResolved } from "./union.js";
|
|
28
|
-
/** True if `type` is a gradient (linear/radial/conic). */
|
|
29
14
|
export declare function isGradientType(type: FillResolved["type"]): boolean;
|
|
30
|
-
/**
|
|
31
|
-
* True if `a` and `b` can be tweened across their differing types — i.e. each is
|
|
32
|
-
* either a solid color or a gradient, and at least one is a gradient. (Same-type
|
|
33
|
-
* pairs are handled by the registry directly and never reach coercion.)
|
|
34
|
-
*/
|
|
15
|
+
/** True if `a` and `b` can be tweened across differing types: each a color or gradient, at least one a gradient (same-type pairs never reach coercion). */
|
|
35
16
|
export declare function canCoerce(a: FillResolved, b: FillResolved): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Promotes two differing-type fills (color and/or gradient) to a single common
|
|
38
|
-
* type so the registry can lerp them with that type's `lerp`. Returns the
|
|
39
|
-
* coerced `[a, b]` pair, both guaranteed to share `result[0].type`.
|
|
40
|
-
*
|
|
41
|
-
* Caller must have checked {@link canCoerce} first.
|
|
42
|
-
*/
|
|
17
|
+
/** Promotes two differing-type fills to a common type so the registry can lerp them; both results share `result[0].type`. Caller must have checked {@link canCoerce}. */
|
|
43
18
|
export declare function coercePair(a: FillResolved, b: FillResolved): [FillResolved, FillResolved];
|
|
44
19
|
//# sourceMappingURL=coerce.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/coerce.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"coerce.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/coerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,YAAY,EAAyB,MAAM,SAAS,CAAC;AAqBnE,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,GAAG,OAAO,CAElE;AAED,2JAA2J;AAC3J,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAMnE;AA+CD,yKAAyK;AACzK,wBAAgB,UAAU,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAyBzF"}
|
|
@@ -1,28 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cross-type fill coercion for tweening.
|
|
2
|
+
* Cross-type fill coercion for tweening. The renderer dispatches by `fill.type`, so an in-between frame must be a
|
|
3
|
+
* fully-formed fill of one concrete type: when a tween's endpoints differ, both are promoted to a common type, then
|
|
4
|
+
* that type's `lerp` runs.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* endpoints to a common target type, then run that type's normal `lerp`.
|
|
6
|
+
* - `color` is a degenerate gradient: against a gradient, the color expands into a uniform gradient (every stop that
|
|
7
|
+
* color), which renders identically to the flat color, so frame 0 of color→gradient looks like the color.
|
|
8
|
+
* - Two *different* gradient types share no geometry, so coerce toward the destination (`to`) type: colors/stops/opacity
|
|
9
|
+
* interpolate while geometry adopts the destination's, snapped at frame 0.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* - `color` is treated as a degenerate gradient — a single solid color. It is
|
|
13
|
-
* the least "rich" fill, so when one side is a color and the other a
|
|
14
|
-
* gradient, the gradient type wins and the color is expanded into a uniform
|
|
15
|
-
* gradient (every stop set to that color). A uniform gradient renders
|
|
16
|
-
* identically to the flat color, so frame 0 of a color→gradient tween looks
|
|
17
|
-
* exactly like the color, then morphs into the gradient.
|
|
18
|
-
*
|
|
19
|
-
* - Two *different* gradient types share no geometry (a linear gradient's
|
|
20
|
-
* start/end has no radial-gradient counterpart). There is no meaningful
|
|
21
|
-
* in-between for that geometry, so we coerce toward the destination (`to`)
|
|
22
|
-
* type: colors/stops/opacity interpolate while the geometry adopts the
|
|
23
|
-
* destination's, snapped at frame 0.
|
|
24
|
-
*
|
|
25
|
-
* Coercion never mutates its input; it returns a fresh resolved fill.
|
|
11
|
+
* Coercion never mutates its input.
|
|
26
12
|
*/
|
|
27
13
|
/** Fill types that can participate in cross-type color/gradient tweening. */
|
|
28
14
|
const GRADIENT_TYPES = new Set([
|
|
@@ -30,15 +16,10 @@ const GRADIENT_TYPES = new Set([
|
|
|
30
16
|
"radial-gradient",
|
|
31
17
|
"conic-gradient",
|
|
32
18
|
]);
|
|
33
|
-
/** True if `type` is a gradient (linear/radial/conic). */
|
|
34
19
|
export function isGradientType(type) {
|
|
35
20
|
return GRADIENT_TYPES.has(type);
|
|
36
21
|
}
|
|
37
|
-
/**
|
|
38
|
-
* True if `a` and `b` can be tweened across their differing types — i.e. each is
|
|
39
|
-
* either a solid color or a gradient, and at least one is a gradient. (Same-type
|
|
40
|
-
* pairs are handled by the registry directly and never reach coercion.)
|
|
41
|
-
*/
|
|
22
|
+
/** True if `a` and `b` can be tweened across differing types: each a color or gradient, at least one a gradient (same-type pairs never reach coercion). */
|
|
42
23
|
export function canCoerce(a, b) {
|
|
43
24
|
const aColorish = a.type === "solid" || isGradientType(a.type);
|
|
44
25
|
const bColorish = b.type === "solid" || isGradientType(b.type);
|
|
@@ -47,16 +28,10 @@ export function canCoerce(a, b) {
|
|
|
47
28
|
// At least one gradient — color↔color is same-type and never reaches here.
|
|
48
29
|
return isGradientType(a.type) || isGradientType(b.type);
|
|
49
30
|
}
|
|
50
|
-
/** Builds a stop list of `count` evenly spaced positions in [0, 1]. */
|
|
51
31
|
function evenStops(count) {
|
|
52
32
|
return Array.from({ length: count }, (_, i) => i / Math.max(1, count - 1));
|
|
53
33
|
}
|
|
54
|
-
/**
|
|
55
|
-
* Expands a solid color into a gradient of `targetType` whose every stop is that
|
|
56
|
-
* color, matching `stopCount` colors so the resulting gradient lerps cleanly
|
|
57
|
-
* against the real gradient on the other side. The geometry defaults match each
|
|
58
|
-
* gradient's `resolve()` so a uniform gradient renders as a flat color.
|
|
59
|
-
*/
|
|
34
|
+
/** Expands a solid color into a `targetType` gradient with every stop that color, matching `stopCount` so it lerps cleanly against the real gradient. Geometry defaults match each gradient's `resolve()` so it renders as the flat color. */
|
|
60
35
|
function colorToGradient(color, opacity, blend, space, targetType, stopCount) {
|
|
61
36
|
const n = Math.max(2, stopCount);
|
|
62
37
|
const colors = Array.from({ length: n }, () => [...color]);
|
|
@@ -71,11 +46,7 @@ function colorToGradient(color, opacity, blend, space, targetType, stopCount) {
|
|
|
71
46
|
return { type: "conic-gradient", ...common, center: { x: 0, y: 0 }, startAngle: 0 };
|
|
72
47
|
}
|
|
73
48
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Re-types a gradient as `targetType`, carrying its colors/stops/opacity and
|
|
76
|
-
* adopting the target type's default geometry. Used when tweening between two
|
|
77
|
-
* different gradient kinds, whose geometries are not interpolatable.
|
|
78
|
-
*/
|
|
49
|
+
/** Re-types a gradient as `targetType`, carrying colors/stops/opacity and adopting the target's default geometry (the geometries are not interpolatable). */
|
|
79
50
|
function retypeGradient(g, targetType) {
|
|
80
51
|
if (g.type === targetType)
|
|
81
52
|
return g;
|
|
@@ -89,13 +60,7 @@ function retypeGradient(g, targetType) {
|
|
|
89
60
|
return { type: "conic-gradient", ...common, center: { x: 0, y: 0 }, startAngle: 0 };
|
|
90
61
|
}
|
|
91
62
|
}
|
|
92
|
-
/**
|
|
93
|
-
* Promotes two differing-type fills (color and/or gradient) to a single common
|
|
94
|
-
* type so the registry can lerp them with that type's `lerp`. Returns the
|
|
95
|
-
* coerced `[a, b]` pair, both guaranteed to share `result[0].type`.
|
|
96
|
-
*
|
|
97
|
-
* Caller must have checked {@link canCoerce} first.
|
|
98
|
-
*/
|
|
63
|
+
/** Promotes two differing-type fills to a common type so the registry can lerp them; both results share `result[0].type`. Caller must have checked {@link canCoerce}. */
|
|
99
64
|
export function coercePair(a, b) {
|
|
100
65
|
const aIsColor = a.type === "solid";
|
|
101
66
|
const bIsColor = b.type === "solid";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/coerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAqBH,6EAA6E;AAC7E,MAAM,cAAc,GAAG,IAAI,GAAG,CAAuB;IACjD,iBAAiB;IACjB,iBAAiB;IACjB,gBAAgB;CACnB,CAAC,CAAC;AAEH,0DAA0D;AAC1D,MAAM,UAAU,cAAc,CAAC,IAA0B;IACrD,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,CAAe,EAAE,CAAe;IACtD,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,KAAK,OAAO,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC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B,CAAC;IACjC,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * Cross-type fill coercion for tweening.\n *\n * The renderer dispatches by `fill.type`, so an in-between frame of a tween must\n * be a fully-formed fill of a single concrete type. When the two endpoints of a\n * tween have different types (e.g. a solid `color` animating into a\n * `linear-gradient`, or one gradient kind into another) we first promote both\n * endpoints to a common target type, then run that type's normal `lerp`.\n *\n * The rules, in order:\n *\n * - `color` is treated as a degenerate gradient — a single solid color. It is\n * the least \"rich\" fill, so when one side is a color and the other a\n * gradient, the gradient type wins and the color is expanded into a uniform\n * gradient (every stop set to that color). A uniform gradient renders\n * identically to the flat color, so frame 0 of a color→gradient tween looks\n * exactly like the color, then morphs into the gradient.\n *\n * - Two *different* gradient types share no geometry (a linear gradient's\n * start/end has no radial-gradient counterpart). There is no meaningful\n * in-between for that geometry, so we coerce toward the destination (`to`)\n * type: colors/stops/opacity interpolate while the geometry adopts the\n * destination's, snapped at frame 0.\n *\n * Coercion never mutates its input; it returns a fresh resolved fill.\n */\n\nimport type { NormalizedColor } from \"./color/parser\";\nimport type { FillResolved, FillCommon, FillSpace } from \"./union\";\nimport type { BlendMode } from \"./blend\";\nimport type { SolidFillResolved } from \"./implementations/color\";\nimport type { LinearGradientFillResolved } from \"./implementations/linear-gradient\";\nimport type { RadialGradientFillResolved } from \"./implementations/radial-gradient\";\nimport type { ConicGradientFillResolved } from \"./implementations/conic-gradient\";\n\n/**\n * Resolved fills that carry a `colors` array (every gradient variant), with the\n * cross-cutting {@link FillCommon} fields (`space`) mixed in — mirroring how the\n * registry's `FillResolved` union wraps each implementation in `WithCommon`.\n */\ntype GradientResolved = FillCommon & (\n | LinearGradientFillResolved\n | RadialGradientFillResolved\n | ConicGradientFillResolved\n);\n\n/** Fill types that can participate in cross-type color/gradient tweening. */\nconst GRADIENT_TYPES = new Set<FillResolved[\"type\"]>([\n \"linear-gradient\",\n \"radial-gradient\",\n \"conic-gradient\",\n]);\n\n/** True if `type` is a gradient (linear/radial/conic). */\nexport function isGradientType(type: FillResolved[\"type\"]): boolean {\n return GRADIENT_TYPES.has(type);\n}\n\n/**\n * True if `a` and `b` can be tweened across their differing types — i.e. each is\n * either a solid color or a gradient, and at least one is a gradient. (Same-type\n * pairs are handled by the registry directly and never reach coercion.)\n */\nexport function canCoerce(a: FillResolved, b: FillResolved): boolean {\n const aColorish = a.type === \"solid\" || isGradientType(a.type);\n const bColorish = b.type === \"solid\" || isGradientType(b.type);\n if (!aColorish || !bColorish) return false;\n // At least one gradient — color↔color is same-type and never reaches here.\n return isGradientType(a.type) || isGradientType(b.type);\n}\n\n/** Builds a stop list of `count` evenly spaced positions in [0, 1]. */\nfunction evenStops(count: number): number[] {\n return Array.from({ length: count }, (_, i) => i / Math.max(1, count - 1));\n}\n\n/**\n * Expands a solid color into a gradient of `targetType` whose every stop is that\n * color, matching `stopCount` colors so the resulting gradient lerps cleanly\n * against the real gradient on the other side. The geometry defaults match each\n * gradient's `resolve()` so a uniform gradient renders as a flat color.\n */\nfunction colorToGradient(\n color: NormalizedColor,\n opacity: number | undefined,\n blend: BlendMode | undefined,\n space: FillSpace | undefined,\n targetType: GradientResolved[\"type\"],\n stopCount: number,\n): GradientResolved {\n const n = Math.max(2, stopCount);\n const colors: NormalizedColor[] = Array.from({ length: n }, () => [...color] as NormalizedColor);\n const stops = evenStops(n);\n const common = { colors, stops, opacity, blend, space };\n\n switch (targetType) {\n case \"linear-gradient\":\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\n case \"radial-gradient\":\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\n case \"conic-gradient\":\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\n }\n}\n\n/**\n * Re-types a gradient as `targetType`, carrying its colors/stops/opacity and\n * adopting the target type's default geometry. Used when tweening between two\n * different gradient kinds, whose geometries are not interpolatable.\n */\nfunction retypeGradient(\n g: GradientResolved,\n targetType: GradientResolved[\"type\"],\n): GradientResolved {\n if (g.type === targetType) return g;\n const common = { colors: g.colors, stops: g.stops, opacity: g.opacity, blend: g.blend, space: g.space };\n switch (targetType) {\n case \"linear-gradient\":\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\n case \"radial-gradient\":\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\n case \"conic-gradient\":\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\n }\n}\n\n/**\n * Promotes two differing-type fills (color and/or gradient) to a single common\n * type so the registry can lerp them with that type's `lerp`. Returns the\n * coerced `[a, b]` pair, both guaranteed to share `result[0].type`.\n *\n * Caller must have checked {@link canCoerce} first.\n */\nexport function coercePair(a: FillResolved, b: FillResolved): [FillResolved, FillResolved] {\n const aIsColor = a.type === \"solid\";\n const bIsColor = b.type === \"solid\";\n\n // color → gradient: expand the color to match the gradient's type.\n if (aIsColor && !bIsColor) {\n const grad = b as GradientResolved;\n const expanded = colorToGradient(\n (a as SolidFillResolved).color, a.opacity, a.blend, a.space, grad.type, grad.colors.length,\n );\n return [expanded, grad];\n }\n // gradient → color: expand the color (b) to match the gradient's (a) type.\n if (bIsColor && !aIsColor) {\n const grad = a as GradientResolved;\n const expanded = colorToGradient(\n (b as SolidFillResolved).color, b.opacity, b.blend, b.space, grad.type, grad.colors.length,\n );\n return [grad, expanded];\n }\n\n // Two different gradient types: coerce toward the destination (b) type.\n const ga = a as GradientResolved;\n const gb = b as GradientResolved;\n return [retypeGradient(ga, gb.type), gb];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"coerce.js","sourceRoot":"","sources":["../../../../src/attributes/shape/fill/coerce.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAiBH,6EAA6E;AAC7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C;QACxB,MAAM,IAAI,GAAG,CAAqB,CAAC;QACnC,MAAM,QAAQ,GAAG,eAAe,CAC3B,CAAuB,CAAC,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAC7F,CAAC;QACF,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,wEAAwE;IACxE,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,MAAM,EAAE,GAAG,CAAqB,CAAC;IACjC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;AAC7C,CAAC","sourcesContent":["/**\n * Cross-type fill coercion for tweening. The renderer dispatches by `fill.type`, so an in-between frame must be a\n * fully-formed fill of one concrete type: when a tween's endpoints differ, both are promoted to a common type, then\n * that type's `lerp` runs.\n *\n * - `color` is a degenerate gradient: against a gradient, the color expands into a uniform gradient (every stop that\n * color), which renders identically to the flat color, so frame 0 of color→gradient looks like the color.\n * - Two *different* gradient types share no geometry, so coerce toward the destination (`to`) type: colors/stops/opacity\n * interpolate while geometry adopts the destination's, snapped at frame 0.\n *\n * Coercion never mutates its input.\n */\n\nimport type { NormalizedColor } from \"./color/parser\";\nimport type { FillResolved, FillCommon, FillSpace } from \"./union\";\nimport type { BlendMode } from \"./blend\";\nimport type { SolidFillResolved } from \"./implementations/color\";\nimport type { LinearGradientFillResolved } from \"./implementations/linear-gradient\";\nimport type { RadialGradientFillResolved } from \"./implementations/radial-gradient\";\nimport type { ConicGradientFillResolved } from \"./implementations/conic-gradient\";\n\n/** Resolved fills that carry a `colors` array (every gradient variant), with {@link FillCommon} (`space`) mixed in as the registry's `FillResolved` does. */\ntype GradientResolved = FillCommon & (\n | LinearGradientFillResolved\n | RadialGradientFillResolved\n | ConicGradientFillResolved\n);\n\n/** Fill types that can participate in cross-type color/gradient tweening. */\nconst GRADIENT_TYPES = new Set<FillResolved[\"type\"]>([\n \"linear-gradient\",\n \"radial-gradient\",\n \"conic-gradient\",\n]);\n\nexport function isGradientType(type: FillResolved[\"type\"]): boolean {\n return GRADIENT_TYPES.has(type);\n}\n\n/** True if `a` and `b` can be tweened across differing types: each a color or gradient, at least one a gradient (same-type pairs never reach coercion). */\nexport function canCoerce(a: FillResolved, b: FillResolved): boolean {\n const aColorish = a.type === \"solid\" || isGradientType(a.type);\n const bColorish = b.type === \"solid\" || isGradientType(b.type);\n if (!aColorish || !bColorish) return false;\n // At least one gradient — color↔color is same-type and never reaches here.\n return isGradientType(a.type) || isGradientType(b.type);\n}\n\nfunction evenStops(count: number): number[] {\n return Array.from({ length: count }, (_, i) => i / Math.max(1, count - 1));\n}\n\n/** Expands a solid color into a `targetType` gradient with every stop that color, matching `stopCount` so it lerps cleanly against the real gradient. Geometry defaults match each gradient's `resolve()` so it renders as the flat color. */\nfunction colorToGradient(\n color: NormalizedColor,\n opacity: number | undefined,\n blend: BlendMode | undefined,\n space: FillSpace | undefined,\n targetType: GradientResolved[\"type\"],\n stopCount: number,\n): GradientResolved {\n const n = Math.max(2, stopCount);\n const colors: NormalizedColor[] = Array.from({ length: n }, () => [...color] as NormalizedColor);\n const stops = evenStops(n);\n const common = { colors, stops, opacity, blend, space };\n\n switch (targetType) {\n case \"linear-gradient\":\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\n case \"radial-gradient\":\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\n case \"conic-gradient\":\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\n }\n}\n\n/** Re-types a gradient as `targetType`, carrying colors/stops/opacity and adopting the target's default geometry (the geometries are not interpolatable). */\nfunction retypeGradient(\n g: GradientResolved,\n targetType: GradientResolved[\"type\"],\n): GradientResolved {\n if (g.type === targetType) return g;\n const common = { colors: g.colors, stops: g.stops, opacity: g.opacity, blend: g.blend, space: g.space };\n switch (targetType) {\n case \"linear-gradient\":\n return { type: \"linear-gradient\", ...common, start: { x: -1, y: 1 }, end: { x: 1, y: -1 } };\n case \"radial-gradient\":\n return { type: \"radial-gradient\", ...common, center: { x: 0, y: 0 }, radius: 100 };\n case \"conic-gradient\":\n return { type: \"conic-gradient\", ...common, center: { x: 0, y: 0 }, startAngle: 0 };\n }\n}\n\n/** Promotes two differing-type fills to a common type so the registry can lerp them; both results share `result[0].type`. Caller must have checked {@link canCoerce}. */\nexport function coercePair(a: FillResolved, b: FillResolved): [FillResolved, FillResolved] {\n const aIsColor = a.type === \"solid\";\n const bIsColor = b.type === \"solid\";\n\n // color → gradient: expand the color to match the gradient's type.\n if (aIsColor && !bIsColor) {\n const grad = b as GradientResolved;\n const expanded = colorToGradient(\n (a as SolidFillResolved).color, a.opacity, a.blend, a.space, grad.type, grad.colors.length,\n );\n return [expanded, grad];\n }\n // gradient → color: expand the color (b) to match the gradient's (a) type.\n if (bIsColor && !aIsColor) {\n const grad = a as GradientResolved;\n const expanded = colorToGradient(\n (b as SolidFillResolved).color, b.opacity, b.blend, b.space, grad.type, grad.colors.length,\n );\n return [grad, expanded];\n }\n\n // Two different gradient types: coerce toward the destination (b) type.\n const ga = a as GradientResolved;\n const gb = b as GradientResolved;\n return [retypeGradient(ga, gb.type), gb];\n}\n"]}
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* CSS
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* - Named colors (CSS Level 4, 148 entries) and theme aliases via {@link setTheme}
|
|
6
|
-
* - Hex: `#RGB`, `#RGBA`, `#RRGGBB`, `#RRGGBBAA`
|
|
7
|
-
* - `rgb()` / `rgba()` — legacy comma and modern space/slash syntax
|
|
8
|
-
* - `hsl()` / `hsla()`
|
|
9
|
-
* - `lab()`, `lch()`
|
|
10
|
-
* - `oklab()`, `oklch()`
|
|
11
|
-
* - Tailwind-style opacity suffix: `"white/10"`, `"primary/90"` (percent 0–100)
|
|
12
|
-
*
|
|
13
|
-
* All output values are in the linear 0–1 range suitable for WebGL uniforms.
|
|
14
|
-
* Named-color lookup is O(1); all other formats are parsed with lightweight
|
|
15
|
-
* regex — no DOM, no `getComputedStyle`.
|
|
2
|
+
* CSS colour string -> normalized [R, G, B, A] tuple (0-1, for GPU uniforms). Accepts named colours (CSS plus theme
|
|
3
|
+
* aliases via {@link setTheme}), hex, rgb/hsl, lab/lch, oklab/oklch and a Tailwind-style opacity suffix (`"white/10"`).
|
|
4
|
+
* No DOM, no `getComputedStyle`.
|
|
16
5
|
*/
|
|
17
6
|
/** Normalized RGBA color: `[red, green, blue, alpha]` each in the 0–1 range. */
|
|
18
7
|
export type NormalizedColor = [number, number, number, number];
|
|
@@ -26,41 +15,18 @@ interface ThemeInput {
|
|
|
26
15
|
typography?: Record<string, object>;
|
|
27
16
|
}
|
|
28
17
|
/**
|
|
29
|
-
* Registers a project theme: named
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* flattened to dash-joined names (`{ brand: { 500: … } }` → `brand-500`). Call
|
|
34
|
-
* with no argument, `null`, or an empty object to clear both registries — a
|
|
35
|
-
* document's own `theme` is optional, and a host reading one out of storage
|
|
36
|
-
* (a database column, a JSON file) typically gets that absence back as `null`
|
|
37
|
-
* rather than `undefined`.
|
|
38
|
-
*
|
|
39
|
-
* The `default` typography key is reserved: it's read directly by
|
|
40
|
-
* {@link applyTextDefaults} (not just via `variant`) and applied to every
|
|
41
|
-
* `Text`/`RichText` as a project-wide base style.
|
|
18
|
+
* Registers a project theme: named colours (usable in any colour string; they win over CSS names) and typography
|
|
19
|
+
* presets (selected via `variant`). No argument, `null` or `{}` clears both, since a host reading a document's
|
|
20
|
+
* optional `theme` from storage gets `null`. The `default` typography key is reserved: it is the project-wide base
|
|
21
|
+
* style read by {@link applyTextDefaults}.
|
|
42
22
|
*
|
|
43
23
|
* @example
|
|
44
|
-
* setTheme({
|
|
45
|
-
* colors: { brand: "#ff6b35", accent: { 500: "oklch(70% 0.2 145)" } },
|
|
46
|
-
* typography: {
|
|
47
|
-
* default: { fontFamily: "Inter", fontSize: 32 },
|
|
48
|
-
* header: { fontSize: 96, fontWeight: 700 },
|
|
49
|
-
* },
|
|
50
|
-
* });
|
|
51
|
-
* // Later: fill: "brand", fill: "accent-500", Text({ variant: "header" })
|
|
24
|
+
* setTheme({ colors: { brand: "#ff6b35", accent: { 500: "oklch(70% 0.2 145)" } }, typography: { header: { fontSize: 96 } } });
|
|
52
25
|
*/
|
|
53
26
|
export declare function setTheme(input?: ThemeInput | null): void;
|
|
54
|
-
/**
|
|
55
|
-
* `undefined` if none is registered. */
|
|
27
|
+
/** Case-insensitive; `undefined` if none is registered. */
|
|
56
28
|
export declare function getTypographyPreset(name: string): Record<string, unknown> | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* Parses a CSS color string into a normalized `[R, G, B, A]` array (0.0–1.0).
|
|
59
|
-
*
|
|
60
|
-
* Supported formats: named colors (CSS + theme), hex, rgb/rgba, hsl/hsla,
|
|
61
|
-
* lab, lch, oklab, oklch, plus a Tailwind-style opacity suffix (`"white/10"`).
|
|
62
|
-
* Falls back to opaque black and logs a warning for unrecognised input.
|
|
63
|
-
*/
|
|
29
|
+
/** Parses a CSS colour string into normalized `[R, G, B, A]`; warns and returns opaque black for unrecognised input. */
|
|
64
30
|
export declare function parseColor(cssStr: string): NormalizedColor;
|
|
65
31
|
export {};
|
|
66
32
|
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/shape/fill/color/parser.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../../../../src/attributes/shape/fill/color/parser.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAE/D,0FAA0F;AAC1F,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG,eAAe,CAAC;AA8E7C,KAAK,eAAe,GAAG,KAAK,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAA;CAAE,CAAC;AAClE,UAAU,UAAU;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACvC;AAoBD;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,KAAK,GAAE,UAAU,GAAG,IAAS,GAAG,IAAI,CAY5D;AAED,2DAA2D;AAC3D,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAErF;AA+HD,wHAAwH;AACxH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAsB1D"}
|