@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +220 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +93 -72
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +9 -0
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +11 -0
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -3
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +26 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +79 -4
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -3
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +1 -1
- package/dist/attributes/audio/filters/chain.js.map +1 -1
- package/dist/attributes/audio/filters/curve.d.ts +8 -8
- package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
- package/dist/attributes/audio/filters/curve.js +20 -19
- package/dist/attributes/audio/filters/curve.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
- package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/filters/index.d.ts +1 -1
- package/dist/attributes/audio/filters/index.d.ts.map +1 -1
- package/dist/attributes/audio/filters/index.js +1 -1
- package/dist/attributes/audio/filters/index.js.map +1 -1
- package/dist/attributes/audio/filters/registry.js.map +1 -1
- package/dist/attributes/audio/filters/union.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +17 -2
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +4 -2
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +15 -8
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +4 -2
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -4
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +3 -1
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +9 -2
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +15 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +8 -8
- package/dist/attributes/render3d/orbit.js +7 -7
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +28 -120
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +16 -88
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +15 -8
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +2 -6
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +23 -6
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +44 -10
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/union.d.ts +2 -6
- package/dist/attributes/shape/effects/union.d.ts.map +1 -1
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +81 -44
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
- package/dist/attributes/shape/fill/gradient-stops.js +65 -0
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +5 -4
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +4 -10
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -13
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +2 -2
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +6 -7
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +12 -5
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +16 -4
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.d.ts +2 -2
- package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/index.js +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +22 -2
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +6 -0
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +1 -0
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-FUZVFT3W.js +18 -0
- package/dist/browser/chunks/chunk-FUZVFT3W.js.map +7 -0
- package/dist/browser/chunks/chunk-QG6C23IJ.js +3 -0
- package/dist/browser/chunks/chunk-QG6C23IJ.js.map +7 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js +2 -0
- package/dist/browser/chunks/chunk-SFNJRPBV.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +3 -2
- package/dist/browser/sdk.js +1 -1
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +1 -1
- package/dist/document/audio.js +4 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +8 -14
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +1 -1
- package/dist/document/command-traits.js +13 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -5
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.js.map +1 -1
- package/dist/document/expression/ops.js +1 -1
- package/dist/document/expression/ops.js.map +1 -1
- package/dist/document/expression/parse.d.ts.map +1 -1
- package/dist/document/expression/parse.js +15 -6
- package/dist/document/expression/parse.js.map +1 -1
- package/dist/document/expression/refs.d.ts +1 -1
- package/dist/document/expression/refs.js +1 -1
- package/dist/document/expression/refs.js.map +1 -1
- package/dist/document/expression/types.js.map +1 -1
- package/dist/document/expression/walk.d.ts.map +1 -1
- package/dist/document/expression/walk.js +2 -1
- package/dist/document/expression/walk.js.map +1 -1
- package/dist/document/index.d.ts +2 -0
- package/dist/document/index.d.ts.map +1 -1
- package/dist/document/index.js +2 -0
- package/dist/document/index.js.map +1 -1
- package/dist/document/node-decorator.js.map +1 -1
- package/dist/document/node-descriptor.d.ts +19 -0
- package/dist/document/node-descriptor.d.ts.map +1 -1
- package/dist/document/node-descriptor.js.map +1 -1
- package/dist/document/placement.d.ts +70 -0
- package/dist/document/placement.d.ts.map +1 -0
- package/dist/document/placement.js +83 -0
- package/dist/document/placement.js.map +1 -0
- package/dist/document/project.d.ts +2 -2
- package/dist/document/project.d.ts.map +1 -1
- package/dist/document/project.js.map +1 -1
- package/dist/document/registry.d.ts +17 -0
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +29 -2
- package/dist/document/registry.js.map +1 -1
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +73 -18
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +192 -40
- package/dist/document/timeline.js.map +1 -1
- package/dist/document/types.d.ts +12 -12
- package/dist/document/types.d.ts.map +1 -1
- package/dist/document/types.js +2 -2
- package/dist/document/types.js.map +1 -1
- package/dist/document/validate.d.ts +2 -2
- package/dist/document/validate.d.ts.map +1 -1
- package/dist/document/validate.js +37 -31
- package/dist/document/validate.js.map +1 -1
- package/dist/document/withdraw.d.ts +28 -0
- package/dist/document/withdraw.d.ts.map +1 -0
- package/dist/document/withdraw.js +61 -0
- package/dist/document/withdraw.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +9 -1
- package/dist/jsx/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime.js +13 -3
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/layout/bounds.d.ts +0 -1
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.d.ts +4 -2
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +27 -11
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.d.ts +6 -0
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +6 -0
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/nodes/2d/node-lifecycle.js.map +1 -1
- package/dist/nodes/2d/node-motion.js.map +1 -1
- package/dist/nodes/2d/node-render.d.ts +3 -3
- package/dist/nodes/2d/node-render.d.ts.map +1 -1
- package/dist/nodes/2d/node-render.js.map +1 -1
- package/dist/nodes/2d/node-transform.js.map +1 -1
- package/dist/nodes/2d/node2d.d.ts +115 -3
- package/dist/nodes/2d/node2d.d.ts.map +1 -1
- package/dist/nodes/2d/node2d.js +180 -28
- package/dist/nodes/2d/node2d.js.map +1 -1
- package/dist/nodes/2d/paint-node.d.ts +27 -0
- package/dist/nodes/2d/paint-node.d.ts.map +1 -1
- package/dist/nodes/2d/paint-node.js +42 -0
- package/dist/nodes/2d/paint-node.js.map +1 -1
- package/dist/nodes/audio/audio-bus.js.map +1 -1
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/node-audio.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +2 -2
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +1 -1
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
- package/dist/nodes/geometry/bounds-shape-node.js +2 -2
- package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
- package/dist/nodes/geometry/box-path-node.d.ts +3 -3
- package/dist/nodes/geometry/box-path-node.js +2 -2
- package/dist/nodes/geometry/box-path-node.js.map +1 -1
- package/dist/nodes/geometry/ellipse-node.js.map +1 -1
- package/dist/nodes/geometry/group-bounds.d.ts +2 -2
- package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
- package/dist/nodes/geometry/group-bounds.js +1 -2
- package/dist/nodes/geometry/group-bounds.js.map +1 -1
- package/dist/nodes/geometry/path-node.d.ts.map +1 -1
- package/dist/nodes/geometry/path-node.js +6 -0
- package/dist/nodes/geometry/path-node.js.map +1 -1
- package/dist/nodes/geometry/polygon-node.js.map +1 -1
- package/dist/nodes/geometry/polygram-node.js.map +1 -1
- package/dist/nodes/geometry/rect-node.js.map +1 -1
- package/dist/nodes/geometry/shape-node.js.map +1 -1
- package/dist/nodes/geometry/shape-outline.d.ts +2 -2
- package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
- package/dist/nodes/geometry/shape-outline.js +2 -13
- package/dist/nodes/geometry/shape-outline.js.map +1 -1
- package/dist/nodes/index.d.ts +3 -8
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +3 -8
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/layout/camera-node.d.ts +9 -0
- package/dist/nodes/layout/camera-node.d.ts.map +1 -1
- package/dist/nodes/layout/camera-node.js +38 -3
- package/dist/nodes/layout/camera-node.js.map +1 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
- package/dist/nodes/layout/orbit-camera-node.js +1 -1
- package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
- package/dist/nodes/layout/rotated-box.js.map +1 -1
- package/dist/nodes/media/video-node.d.ts.map +1 -1
- package/dist/nodes/media/video-node.js +2 -0
- package/dist/nodes/media/video-node.js.map +1 -1
- package/dist/nodes/node/declare-paints.js.map +1 -1
- package/dist/nodes/node/node-editor-state.js.map +1 -1
- package/dist/nodes/node/node-reactive.js.map +1 -1
- package/dist/nodes/node/node-time.d.ts +3 -3
- package/dist/nodes/node/node-time.d.ts.map +1 -1
- package/dist/nodes/node/node-time.js +1 -1
- package/dist/nodes/node/node-time.js.map +1 -1
- package/dist/nodes/node/node-walk.js.map +1 -1
- package/dist/nodes/node/node.d.ts +5 -3
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +44 -19
- package/dist/nodes/node/node.js.map +1 -1
- package/dist/nodes/node/text-defaults.d.ts +10 -12
- package/dist/nodes/node/text-defaults.d.ts.map +1 -1
- package/dist/nodes/node/text-defaults.js +10 -12
- package/dist/nodes/node/text-defaults.js.map +1 -1
- package/dist/nodes/{scene → root}/canvas2d-node.d.ts +2 -2
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
- package/dist/nodes/{scene → root}/canvas2d-node.js +2 -2
- package/dist/nodes/root/canvas2d-node.js.map +1 -0
- package/dist/nodes/root/provider-node.d.ts.map +1 -0
- package/dist/nodes/root/provider-node.js.map +1 -0
- package/dist/nodes/root/theme-provider-node.d.ts.map +1 -0
- package/dist/nodes/root/theme-provider-node.js.map +1 -0
- package/dist/nodes/text/default-text-style-node.d.ts +5 -2
- package/dist/nodes/text/default-text-style-node.d.ts.map +1 -1
- package/dist/nodes/text/default-text-style-node.js +10 -4
- package/dist/nodes/text/default-text-style-node.js.map +1 -1
- package/dist/nodes/text/number-format.d.ts +1 -1
- package/dist/nodes/text/number-format.js +1 -1
- package/dist/nodes/text/number-format.js.map +1 -1
- package/dist/nodes/text/number-node.js.map +1 -1
- package/dist/nodes/text/number-pattern.js.map +1 -1
- package/dist/nodes/text/richtext-node.js +1 -1
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +1 -1
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-node.js.map +1 -1
- package/dist/nodes/text/text-selection.js.map +1 -1
- package/dist/nodes/three/camera-nodes.d.ts +21 -3
- package/dist/nodes/three/camera-nodes.d.ts.map +1 -1
- package/dist/nodes/three/camera-nodes.js +42 -1
- package/dist/nodes/three/camera-nodes.js.map +1 -1
- package/dist/nodes/three/canvas3d-node.d.ts +29 -6
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +44 -2
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/nodes/three/drawable-nodes.d.ts +25 -11
- package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
- package/dist/nodes/three/drawable-nodes.js +43 -13
- package/dist/nodes/three/drawable-nodes.js.map +1 -1
- package/dist/nodes/three/environment-nodes.d.ts +9 -3
- package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
- package/dist/nodes/three/environment-nodes.js.map +1 -1
- package/dist/nodes/three/geometry-nodes.d.ts +2 -2
- package/dist/nodes/three/geometry-nodes.js +2 -2
- package/dist/nodes/three/geometry-nodes.js.map +1 -1
- package/dist/nodes/three/grid-geometry3d.js.map +1 -1
- package/dist/nodes/three/group3d.js.map +1 -1
- package/dist/nodes/three/light-nodes.d.ts.map +1 -1
- package/dist/nodes/three/light-nodes.js +3 -3
- package/dist/nodes/three/light-nodes.js.map +1 -1
- package/dist/nodes/three/mesh3d.js.map +1 -1
- package/dist/nodes/three/node3d.d.ts +48 -0
- package/dist/nodes/three/node3d.d.ts.map +1 -1
- package/dist/nodes/three/node3d.js +53 -3
- package/dist/nodes/three/node3d.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +2 -2
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -8
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +12 -6
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +4 -0
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +6 -0
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +6 -0
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.d.ts +3 -3
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +17 -0
- package/dist/renamed-scene-names.d.ts.map +1 -0
- package/dist/renamed-scene-names.js +9 -0
- package/dist/renamed-scene-names.js.map +1 -0
- package/dist/render/canvas-render-context2d.d.ts +2 -2
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/latex.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +12 -0
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +2 -2
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +3 -3
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +4 -2
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +6 -0
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +5 -3
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +2 -9
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +2 -13
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +8 -1
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +8 -4
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +18 -10
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -1
- package/dist/render3d/index.js +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts +14 -0
- package/dist/render3d/inert.d.ts.map +1 -0
- package/dist/render3d/inert.js +62 -0
- package/dist/render3d/inert.js.map +1 -0
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +10 -5
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +23 -4
- package/dist/render3d/scene-settings.d.ts.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +11 -0
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +39 -6
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +9 -0
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +13 -0
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +18 -1
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +27 -0
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +1 -1
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +5 -3
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +10 -6
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +9 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +19 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -0
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -0
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +31 -0
- package/dist/runtime/frame-time.d.ts.map +1 -0
- package/dist/runtime/frame-time.js +29 -0
- package/dist/runtime/frame-time.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +44 -3
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +118 -3
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +2 -1
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +5 -2
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +4 -5
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +31 -2
- package/dist/runtime/playback-controller.d.ts.map +1 -1
- package/dist/runtime/playback-controller.js +63 -6
- package/dist/runtime/playback-controller.js.map +1 -1
- package/dist/runtime/playback.js.map +1 -1
- package/dist/runtime/precompisition.js.map +1 -1
- package/dist/runtime/project-assets.js.map +1 -1
- package/dist/runtime/session.d.ts +9 -7
- package/dist/runtime/session.d.ts.map +1 -1
- package/dist/runtime/session.js +12 -4
- package/dist/runtime/session.js.map +1 -1
- package/dist/runtime/settle.js.map +1 -1
- package/dist/runtime/state-evaluator.d.ts +1 -1
- package/dist/runtime/state-evaluator.d.ts.map +1 -1
- package/dist/runtime/state-evaluator.js +4 -3
- package/dist/runtime/state-evaluator.js.map +1 -1
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +19 -15
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +11 -6
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +2 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.d.ts.map +1 -1
- package/dist/tween/ease/constants.js +8 -5
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +4 -3
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +15 -0
- package/dist/tween/ease/describe.d.ts.map +1 -0
- package/dist/tween/ease/describe.js +37 -0
- package/dist/tween/ease/describe.js.map +1 -0
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +3 -3
- package/dist/tween/prepare.js +3 -3
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/seekable.d.ts +1 -1
- package/dist/tween/seekable.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.d.ts +1 -1
- package/dist/util/metrics.js +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +2 -1
- package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
- package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/displace.js +0 -30
- package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
- package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.js +0 -25
- package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
- package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.js +0 -22
- package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
- package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
- package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
- package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
- package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
- package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
- package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
- package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
- package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/dot-grid-node.js +0 -142
- package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
- package/dist/nodes/geometry/grid-lines.d.ts +0 -101
- package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-lines.js +0 -128
- package/dist/nodes/geometry/grid-lines.js.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
- package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.js +0 -172
- package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
- package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
- package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-grid-node.js +0 -127
- package/dist/nodes/geometry/line-grid-node.js.map +0 -1
- package/dist/nodes/geometry/line-node.d.ts +0 -58
- package/dist/nodes/geometry/line-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-node.js +0 -123
- package/dist/nodes/geometry/line-node.js.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
- package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
- package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
- package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/scene/canvas2d-node.js.map +0 -1
- package/dist/nodes/scene/provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/provider-node.js.map +0 -1
- package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/theme-provider-node.js.map +0 -1
- /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/provider-node.js +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-matrix.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/color-matrix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,MAAM,CAAC,MAAM,iBAAiB,GAAkC;IAC5D,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;KACzE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CACvG,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\n/**\n * Applies an arbitrary 4×5 color transform in Skia format.\n *\n * The matrix is row-major with rows [R, G, B, A], each row being\n * [rScale, gScale, bScale, aScale, bias]. Useful for tinting,\n * channel swaps, or any effect not covered by the named filters.\n */\nexport interface ColorMatrixFilter {\n type: 'colorMatrix';\n /** 4×5 row-major color matrix in Skia format. */\n matrix: number[];\n}\n\nexport const colorMatrixFilter: FilterData<ColorMatrixFilter> = {\n // Lerps each matrix coefficient independently; missing target coefficients\n // hold their source value so partial matrices still animate gracefully.\n lerp: (from, to, t) => ({\n type: \"colorMatrix\",\n matrix: from.matrix.map((v, i) => lerpNumber(v, to.matrix[i] ?? v, t)),\n }),\n equals: (a, b) => a.matrix.length === b.matrix.length && a.matrix.every((v, i) => v === b.matrix[i]),\n};\n"]}
|
|
1
|
+
{"version":3,"file":"color-matrix.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/color-matrix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,MAAM,CAAC,MAAM,iBAAiB,GAAkC;IAC5D,2EAA2E;IAC3E,wEAAwE;IACxE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,aAAa;QACnB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;KACzE,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CACvG,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/**\r\n * Applies an arbitrary 4×5 color transform in Skia format.\r\n *\r\n * The matrix is row-major with rows [R, G, B, A], each row being\r\n * [rScale, gScale, bScale, aScale, bias]. Useful for tinting,\r\n * channel swaps, or any effect not covered by the named filters.\r\n */\r\nexport interface ColorMatrixFilter {\r\n type: 'colorMatrix';\r\n /** 4×5 row-major color matrix in Skia format. */\r\n matrix: number[];\r\n}\r\n\r\nexport const colorMatrixFilter: FilterData<ColorMatrixFilter> = {\r\n // Lerps each matrix coefficient independently; missing target coefficients\r\n // hold their source value so partial matrices still animate gracefully.\r\n lerp: (from, to, t) => ({\r\n type: \"colorMatrix\",\r\n matrix: from.matrix.map((v, i) => lerpNumber(v, to.matrix[i] ?? v, t)),\r\n }),\r\n equals: (a, b) => a.matrix.length === b.matrix.length && a.matrix.every((v, i) => v === b.matrix[i]),\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"curves.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/curves.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoB1C,MAAM,CAAC,MAAM,YAAY,GAA6B;IAClD,yEAAyE;IACzE,iDAAiD;IACjD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO;QAC5C,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAClC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACxC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAqB,CAAC;QAC5E,CAAC,CAAC;KACL,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;QACvB,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM;QACnC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACtF,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\n/** Which color channel(s) a curves adjustment targets. */\nexport type CurvesChannel = 'rgb' | 'r' | 'g' | 'b' | 'a';\n\n/**\n * Remaps pixel values along a tone curve defined by control points.\n *\n * Points are [input, output] pairs in the [0, 1] range. The renderer\n * interpolates a smooth curve through them. Applies to composite RGB\n * by default; set `channel` to target a single channel.\n */\nexport interface CurvesFilter {\n type: 'curves';\n /** Curve control points as [input, output] pairs in [0, 1]. */\n points: [number, number][];\n /** Channel(s) to apply the curve to. Default 'rgb'. */\n channel?: CurvesChannel;\n}\n\nexport const curvesFilter: FilterData<CurvesFilter> = {\n // Channel hard-cuts at t=0.5 because interpolating between channel names\n // would produce meaningless intermediate states.\n lerp: (from, to, t) => ({\n type: \"curves\",\n channel: t < 0.5 ? from.channel : to.channel,\n points: from.points.map(([x, y], i) => {\n const [tx, ty] = to.points[i] ?? [x, y];\n return [lerpNumber(x, tx, t), lerpNumber(y, ty, t)] as [number, number];\n }),\n }),\n equals: (a, b) =>\n a.channel === b.channel &&\n a.points.length === b.points.length &&\n a.points.every(([x, y], i) => x === b.points[i]?.[0] && y === b.points[i]?.[1]),\n};\n"]}
|
|
1
|
+
{"version":3,"file":"curves.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/curves.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAoB1C,MAAM,CAAC,MAAM,YAAY,GAA6B;IAClD,yEAAyE;IACzE,iDAAiD;IACjD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO;QAC5C,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YAClC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACxC,OAAO,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAqB,CAAC;QAC5E,CAAC,CAAC;KACL,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,OAAO;QACvB,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM,CAAC,MAAM;QACnC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CACtF,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/** Which color channel(s) a curves adjustment targets. */\r\nexport type CurvesChannel = 'rgb' | 'r' | 'g' | 'b' | 'a';\r\n\r\n/**\r\n * Remaps pixel values along a tone curve defined by control points.\r\n *\r\n * Points are [input, output] pairs in the [0, 1] range. The renderer\r\n * interpolates a smooth curve through them. Applies to composite RGB\r\n * by default; set `channel` to target a single channel.\r\n */\r\nexport interface CurvesFilter {\r\n type: 'curves';\r\n /** Curve control points as [input, output] pairs in [0, 1]. */\r\n points: [number, number][];\r\n /** Channel(s) to apply the curve to. Default 'rgb'. */\r\n channel?: CurvesChannel;\r\n}\r\n\r\nexport const curvesFilter: FilterData<CurvesFilter> = {\r\n // Channel hard-cuts at t=0.5 because interpolating between channel names\r\n // would produce meaningless intermediate states.\r\n lerp: (from, to, t) => ({\r\n type: \"curves\",\r\n channel: t < 0.5 ? from.channel : to.channel,\r\n points: from.points.map(([x, y], i) => {\r\n const [tx, ty] = to.points[i] ?? [x, y];\r\n return [lerpNumber(x, tx, t), lerpNumber(y, ty, t)] as [number, number];\r\n }),\r\n }),\r\n equals: (a, b) =>\r\n a.channel === b.channel &&\r\n a.points.length === b.points.length &&\r\n a.points.every(([x, y], i) => x === b.points[i]?.[0] && y === b.points[i]?.[1]),\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/echo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAyB1C,MAAM,CAAC,MAAM,UAAU,GAAgC;IACnD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACzD,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1C,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,EAAE,EAAE,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;QACxD,6DAA6D;QAC7D,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;KACzC,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QACnB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC;QACrC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;CAC1B,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\nimport type { BlendMode } from \"../../fill/blend\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\n/**\n * Composites the current video frame with a trail of past frames (After Effects'\n * Echo), each delayed by `delay` seconds and faded by a `decay` factor. Needs\n * several decoded frames at once, so — unlike the pixel filters — it is rendered\n * by a dedicated multi-pass path in the video fill renderer rather than the\n * `setImageFilter` chain. Video-only; a no-op on image fills.\n *\n * The trail reaches back `echoes * delay` source seconds; frames outside the\n * adapter's decoded back-window are simply skipped (the trail fills in over the\n * first second of playback after a cold seek).\n */\nexport interface VideoEchoFilter {\n type: 'echo';\n /** Number of past-frame taps drawn behind the current frame. */\n echoes: number;\n /** Delay between successive taps, in source seconds. */\n delay: number;\n /** Per-tap alpha multiplier; tap `n` is drawn at `decay ** n`. Default 0.5. */\n decay?: number;\n /** Blend mode used to composite the echo taps. Default `'screen'`. */\n blend?: BlendMode;\n}\n\nexport const echoFilter: FilterData<VideoEchoFilter> = {\n lerp: (from, to, t) => ({\n type: \"echo\",\n echoes: Math.round(lerpNumber(from.echoes, to.echoes, t)),\n delay: lerpNumber(from.delay, to.delay, t),\n decay: lerpNumber(from.decay ?? 0.5, to.decay ?? 0.5, t),\n // Blend is a discrete enum, so it hard-cuts at the midpoint.\n blend: t < 0.5 ? from.blend : to.blend,\n }),\n equals: (a, b) =>\n a.echoes === b.echoes &&\n a.delay === b.delay &&\n (a.decay ?? 0.5) === (b.decay ?? 0.5) &&\n a.blend === b.blend,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"echo.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/echo.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAyB1C,MAAM,CAAC,MAAM,UAAU,GAAgC;IACnD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACzD,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1C,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,KAAK,IAAI,GAAG,EAAE,EAAE,CAAC,KAAK,IAAI,GAAG,EAAE,CAAC,CAAC;QACxD,6DAA6D;QAC7D,KAAK,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK;KACzC,CAAC;IACF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACb,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QACrB,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;QACnB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,CAAC;QACrC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,KAAK;CAC1B,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport type { BlendMode } from \"../../fill/blend\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/**\r\n * Composites the current video frame with a trail of past frames (After Effects'\r\n * Echo), each delayed by `delay` seconds and faded by a `decay` factor. Needs\r\n * several decoded frames at once, so — unlike the pixel filters — it is rendered\r\n * by a dedicated multi-pass path in the video fill renderer rather than the\r\n * `setImageFilter` chain. Video-only; a no-op on image fills.\r\n *\r\n * The trail reaches back `echoes * delay` source seconds; frames outside the\r\n * adapter's decoded back-window are simply skipped (the trail fills in over the\r\n * first second of playback after a cold seek).\r\n */\r\nexport interface VideoEchoFilter {\r\n type: 'echo';\r\n /** Number of past-frame taps drawn behind the current frame. */\r\n echoes: number;\r\n /** Delay between successive taps, in source seconds. */\r\n delay: number;\r\n /** Per-tap alpha multiplier; tap `n` is drawn at `decay ** n`. Default 0.5. */\r\n decay?: number;\r\n /** Blend mode used to composite the echo taps. Default `'screen'`. */\r\n blend?: BlendMode;\r\n}\r\n\r\nexport const echoFilter: FilterData<VideoEchoFilter> = {\r\n lerp: (from, to, t) => ({\r\n type: \"echo\",\r\n echoes: Math.round(lerpNumber(from.echoes, to.echoes, t)),\r\n delay: lerpNumber(from.delay, to.delay, t),\r\n decay: lerpNumber(from.decay ?? 0.5, to.decay ?? 0.5, t),\r\n // Blend is a discrete enum, so it hard-cuts at the midpoint.\r\n blend: t < 0.5 ? from.blend : to.blend,\r\n }),\r\n equals: (a, b) =>\r\n a.echoes === b.echoes &&\r\n a.delay === b.delay &&\r\n (a.decay ?? 0.5) === (b.decay ?? 0.5) &&\r\n a.blend === b.blend,\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposure.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/exposure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,MAAM,CAAC,MAAM,cAAc,GAA+B;IACtD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IAC5F,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAC1C,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\n/** Scales the overall luminance of the media layer. */\nexport interface ExposureFilter {\n type: 'exposure';\n /** Exposure multiplier. 1 = unchanged, >1 brighter, <1 darker. */\n amount: number;\n}\n\nexport const exposureFilter: FilterData<ExposureFilter> = {\n lerp: (from, to, t) => ({ type: \"exposure\", amount: lerpNumber(from.amount, to.amount, t) }),\n equals: (a, b) => a.amount === b.amount,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"exposure.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/exposure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,MAAM,CAAC,MAAM,cAAc,GAA+B;IACtD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IAC5F,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAC1C,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/** Scales the overall luminance of the media layer. */\r\nexport interface ExposureFilter {\r\n type: 'exposure';\r\n /** Exposure multiplier. 1 = unchanged, >1 brighter, <1 darker. */\r\n amount: number;\r\n}\r\n\r\nexport const exposureFilter: FilterData<ExposureFilter> = {\r\n lerp: (from, to, t) => ({ type: \"exposure\", amount: lerpNumber(from.amount, to.amount, t) }),\r\n equals: (a, b) => a.amount === b.amount,\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grayscale.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/grayscale.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,MAAM,CAAC,MAAM,eAAe,GAAgC;IACxD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAC1C,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\n/** Desaturates the media layer toward black and white. */\nexport interface GrayscaleFilter {\n type: 'grayscale';\n /** 0 = original, 1 = fully grayscale. */\n amount: number;\n}\n\nexport const grayscaleFilter: FilterData<GrayscaleFilter> = {\n lerp: (from, to, t) => ({ type: \"grayscale\", amount: lerpNumber(from.amount, to.amount, t) }),\n equals: (a, b) => a.amount === b.amount,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"grayscale.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/grayscale.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAS1C,MAAM,CAAC,MAAM,eAAe,GAAgC;IACxD,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC;IAC7F,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAC1C,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/** Desaturates the media layer toward black and white. */\r\nexport interface GrayscaleFilter {\r\n type: 'grayscale';\r\n /** 0 = original, 1 = fully grayscale. */\r\n amount: number;\r\n}\r\n\r\nexport const grayscaleFilter: FilterData<GrayscaleFilter> = {\r\n lerp: (from, to, t) => ({ type: \"grayscale\", amount: lerpNumber(from.amount, to.amount, t) }),\r\n equals: (a, b) => a.amount === b.amount,\r\n};\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"posterize-time.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/posterize-time.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,MAAM,CAAC,MAAM,mBAAmB,GAAoC;IAChE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACxF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG;CACpC,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\nimport { lerpNumber } from \"@/tween/lerp\";\n\n/**\n * Resamples a video fill to a lower frame rate, holding each source frame for a\n * `1 / fps` interval — the \"stop-motion\" / stutter look (After Effects' Posterize\n * Time). Purely temporal: it changes *which* source timestamp is shown, not the\n * pixels, so it is consumed in the video fill's per-frame `update()` (it never\n * reaches the pixel-filter / `setImageFilter` path). No-op on image fills.\n */\nexport interface PosterizeTimeFilter {\n type: 'posterizeTime';\n /** Target frame rate the source playhead snaps to, in frames per second. */\n fps: number;\n}\n\nexport const posterizeTimeFilter: FilterData<PosterizeTimeFilter> = {\n lerp: (from, to, t) => ({ type: \"posterizeTime\", fps: lerpNumber(from.fps, to.fps, t) }),\n equals: (a, b) => a.fps === b.fps,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"posterize-time.js","sourceRoot":"","sources":["../../../../../src/attributes/shape/filters/implementations/posterize-time.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAe1C,MAAM,CAAC,MAAM,mBAAmB,GAAoC;IAChE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,GAAG,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC;IACxF,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG;CACpC,CAAC","sourcesContent":["import type { FilterData } from \"../registry\";\r\nimport { lerpNumber } from \"@/tween/lerp\";\r\n\r\n/**\r\n * Resamples a video fill to a lower frame rate, holding each source frame for a\r\n * `1 / fps` interval — the \"stop-motion\" / stutter look (After Effects' Posterize\r\n * Time). Purely temporal: it changes *which* source timestamp is shown, not the\r\n * pixels, so it is consumed in the video fill's per-frame `update()` (it never\r\n * reaches the pixel-filter / `setImageFilter` path). No-op on image fills.\r\n */\r\nexport interface PosterizeTimeFilter {\r\n type: 'posterizeTime';\r\n /** Target frame rate the source playhead snaps to, in frames per second. */\r\n fps: number;\r\n}\r\n\r\nexport const posterizeTimeFilter: FilterData<PosterizeTimeFilter> = {\r\n lerp: (from, to, t) => ({ type: \"posterizeTime\", fps: lerpNumber(from.fps, to.fps, t) }),\r\n equals: (a, b) => a.fps === b.fps,\r\n};\r\n"]}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
/** @internal */ export type { BlurFilterOptions, GrayscaleFilterOptions, AlphaFilterOptions, ExposureFilterOptions, ColorMatrixFilterOptions, CurvesFilterOptions, ColorAdjustmentFilterOptions, PosterizeTimeFilterOptions, EchoFilterOptions as VideoEchoFilterOptions, } from './chain.js';
|
|
18
18
|
/**
|
|
19
19
|
* @internal Unions of concrete filter types: pixel (`MediaAdjustment`), video-only,
|
|
20
|
-
* and the
|
|
20
|
+
* and the node effects that double as filters.
|
|
21
21
|
*/
|
|
22
22
|
/** @internal */ export type { MediaAdjustment, VideoOnlyAdjustment, EffectAdjustment } from './union.js';
|
|
23
23
|
/** @internal Interpolation/equality registry: constants map plus the lerp helpers. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/index.ts"],"names":[],"mappings":"AAWA,iGAAiG;AACjG,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACzI,yEAAyE;AACzE,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAsBtE,sFAAsF;AACtF,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC","sourcesContent":["/** @internal Media-filter data types for each built-in filter. */\n/** @internal */ export type { ExposureFilter } from './implementations/exposure';\n/** @internal */ export type { BlurFilter } from './implementations/blur';\n/** @internal */ export type { GrayscaleFilter } from './implementations/grayscale';\n/** @internal */ export type { AlphaFilter } from './implementations/alpha';\n/** @internal */ export type { ColorMatrixFilter } from './implementations/color-matrix';\n/** @internal */ export type { CurvesChannel, CurvesFilter } from './implementations/curves';\n/** @internal */ export type { ColorAdjustmentFilter } from './implementations/color-adjustment';\n/** @internal */ export type { PosterizeTimeFilter } from './implementations/posterize-time';\n/** @internal */ export type { VideoEchoFilter } from './implementations/echo';\n\n/** @internal Chainable filter builder API, chain classes, and the loose author-facing unions. */\n/** @internal */ export { Adjustments, VideoAdjustments, AdjustmentChain, VideoAdjustmentChain, resolveChainAdjustments } from './chain';\n/** @internal @deprecated Renamed to `Adjustments`/`VideoAdjustments`. */\n/** @internal */ export { ImageFilters, VideoFilters } from './chain';\n/** @internal */ export type { ImageAdjustment, VideoAdjustment } from './chain';\n\n/** @internal Per-builder options. Each builder takes one of these, or its dominant scalar. */\n/** @internal */ export type {\n BlurFilterOptions,\n GrayscaleFilterOptions,\n AlphaFilterOptions,\n ExposureFilterOptions,\n ColorMatrixFilterOptions,\n CurvesFilterOptions,\n ColorAdjustmentFilterOptions,\n PosterizeTimeFilterOptions,\n EchoFilterOptions as VideoEchoFilterOptions,\n} from './chain';\n\n/**\n * @internal Unions of concrete filter types: pixel (`MediaAdjustment`), video-only,\n * and the
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/index.ts"],"names":[],"mappings":"AAWA,iGAAiG;AACjG,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AACzI,yEAAyE;AACzE,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAsBtE,sFAAsF;AACtF,gBAAgB,CAAC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC","sourcesContent":["/** @internal Media-filter data types for each built-in filter. */\r\n/** @internal */ export type { ExposureFilter } from './implementations/exposure';\r\n/** @internal */ export type { BlurFilter } from './implementations/blur';\r\n/** @internal */ export type { GrayscaleFilter } from './implementations/grayscale';\r\n/** @internal */ export type { AlphaFilter } from './implementations/alpha';\r\n/** @internal */ export type { ColorMatrixFilter } from './implementations/color-matrix';\r\n/** @internal */ export type { CurvesChannel, CurvesFilter } from './implementations/curves';\r\n/** @internal */ export type { ColorAdjustmentFilter } from './implementations/color-adjustment';\r\n/** @internal */ export type { PosterizeTimeFilter } from './implementations/posterize-time';\r\n/** @internal */ export type { VideoEchoFilter } from './implementations/echo';\r\n\r\n/** @internal Chainable filter builder API, chain classes, and the loose author-facing unions. */\r\n/** @internal */ export { Adjustments, VideoAdjustments, AdjustmentChain, VideoAdjustmentChain, resolveChainAdjustments } from './chain';\r\n/** @internal @deprecated Renamed to `Adjustments`/`VideoAdjustments`. */\r\n/** @internal */ export { ImageFilters, VideoFilters } from './chain';\r\n/** @internal */ export type { ImageAdjustment, VideoAdjustment } from './chain';\r\n\r\n/** @internal Per-builder options. Each builder takes one of these, or its dominant scalar. */\r\n/** @internal */ export type {\r\n BlurFilterOptions,\r\n GrayscaleFilterOptions,\r\n AlphaFilterOptions,\r\n ExposureFilterOptions,\r\n ColorMatrixFilterOptions,\r\n CurvesFilterOptions,\r\n ColorAdjustmentFilterOptions,\r\n PosterizeTimeFilterOptions,\r\n EchoFilterOptions as VideoEchoFilterOptions,\r\n} from './chain';\r\n\r\n/**\r\n * @internal Unions of concrete filter types: pixel (`MediaAdjustment`), video-only,\r\n * and the node effects that double as filters.\r\n */\r\n/** @internal */ export type { MediaAdjustment, VideoOnlyAdjustment, EffectAdjustment } from './union';\r\n\r\n/** @internal Interpolation/equality registry: constants map plus the lerp helpers. */\r\n/** @internal */ export { lerpFilter, lerpFilterArray, isPixelFilter, hasFilter, filterSurface } from './registry';\r\n/** @internal */ export type { FilterData, AnyFilter } from './registry';\r\n"]}
|
|
@@ -24,8 +24,8 @@ export declare function hasFilter(type: string): boolean;
|
|
|
24
24
|
export declare function lerpFilter(from: AnyFilter, to: AnyFilter, t: number): AnyFilter;
|
|
25
25
|
/**
|
|
26
26
|
* The filters defined here reference nothing, but an {@link EffectAdjustment} can —
|
|
27
|
-
* `
|
|
28
|
-
*
|
|
27
|
+
* `lut` samples an image — and an undeclared one is a lookup the effect can only
|
|
28
|
+
* read as "no lookup table".
|
|
29
29
|
*/
|
|
30
30
|
export declare function declareFilter(filter: AnyFilter, assets: AssetScope): void;
|
|
31
31
|
/**
|
|
@@ -15,7 +15,7 @@ import { echoFilter } from "./implementations/echo.js";
|
|
|
15
15
|
* import to forget.
|
|
16
16
|
*
|
|
17
17
|
* It holds only the filters that exist *solely* as filters. Most of the roster
|
|
18
|
-
* is {@link EffectAdjustment} — a
|
|
18
|
+
* is {@link EffectAdjustment} — a node effect applied to a fill's own pixels — and
|
|
19
19
|
* those are looked up in the effects registry rather than duplicated here, so
|
|
20
20
|
* `dither` interpolates the same way whether it is on a node or on an image.
|
|
21
21
|
*/
|
|
@@ -63,8 +63,8 @@ export function lerpFilter(from, to, t) {
|
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* The filters defined here reference nothing, but an {@link EffectAdjustment} can —
|
|
66
|
-
* `
|
|
67
|
-
*
|
|
66
|
+
* `lut` samples an image — and an undeclared one is a lookup the effect can only
|
|
67
|
+
* read as "no lookup table".
|
|
68
68
|
*/
|
|
69
69
|
export function declareFilter(filter, assets) {
|
|
70
70
|
if (FILTERS.has(filter.type))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAI1F,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAapD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAgC;IACnD,CAAC,UAAU,EAAE,cAAuC,CAAC;IACrD,CAAC,MAAM,EAAE,UAAmC,CAAC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AAE,CAAC,CAAQ,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,IAAiB,EAAE,EAAe,EAAE,CAAS;IACzE,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;QAChB,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACT,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;aAAM,IAAI,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;aAAM,IAAI,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import { MediaAdjustment, VideoOnlyAdjustment } from \"./union\";\r\nimport { declareEffect, effectSurface, hasEffect, lerpEffect } from \"../effects/registry\";\r\nimport type { NodeEffect } from \"../effects/union\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\n\r\nimport { exposureFilter } from \"./implementations/exposure\";\r\nimport { blurFilter } from \"./implementations/blur\";\r\nimport { grayscaleFilter } from \"./implementations/grayscale\";\r\nimport { alphaFilter } from \"./implementations/alpha\";\r\nimport { colorMatrixFilter } from \"./implementations/color-matrix\";\r\nimport { curvesFilter } from \"./implementations/curves\";\r\nimport { colorAdjustmentFilter } from \"./implementations/color-adjustment\";\r\nimport { posterizeTimeFilter } from \"./implementations/posterize-time\";\r\nimport { echoFilter } from \"./implementations/echo\";\r\n\r\n/** Any concrete filter object accepted on a media fill — pixel or video-only. */\r\nexport type AnyFilter = MediaAdjustment | VideoOnlyAdjustment;\r\n\r\n/** Interpolation and equality contract every filter implementation must implement. */\r\nexport interface FilterData<T extends AnyFilter> {\r\n /** Return a new filter linearly interpolated between `from` and `to` at progress `t` (0–1). */\r\n lerp(from: T, to: T, t: number): T;\r\n /** Return true when both filters are visually identical (used to skip redundant redraws). */\r\n equals(a: T, b: T): boolean;\r\n}\r\n\r\n/**\r\n * Maps each filter `type` to its `FilterData` handler. Statically imported\r\n * constants (no runtime registration step), mirroring the `FILLS` map in the\r\n * fill registry — so the table is always populated and there is no side-effect\r\n * import to forget.\r\n *\r\n * It holds only the filters that exist *solely* as filters. Most of the roster\r\n * is {@link EffectAdjustment} — a node effect applied to a fill's own pixels — and\r\n * those are looked up in the effects registry rather than duplicated here, so\r\n * `dither` interpolates the same way whether it is on a node or on an image.\r\n */\r\nconst FILTERS = new Map<string, FilterData<AnyFilter>>([\r\n [\"exposure\", exposureFilter as FilterData<AnyFilter>],\r\n [\"blur\", blurFilter as FilterData<AnyFilter>],\r\n [\"grayscale\", grayscaleFilter as FilterData<AnyFilter>],\r\n [\"alpha\", alphaFilter as FilterData<AnyFilter>],\r\n [\"colorMatrix\", colorMatrixFilter as FilterData<AnyFilter>],\r\n [\"curves\", curvesFilter as FilterData<AnyFilter>],\r\n [\"colorAdjustment\", colorAdjustmentFilter as FilterData<AnyFilter>],\r\n [\"posterizeTime\", posterizeTimeFilter as FilterData<AnyFilter>],\r\n [\"echo\", echoFilter as FilterData<AnyFilter>],\r\n]);\r\n\r\n/**\r\n * Video-only filter types. These are consumed by the video fill's per-frame\r\n * `update()` (`posterizeTime`) or a dedicated multi-pass renderer (`echo`),\r\n * NOT the pixel `setImageFilter` chain. `isPixelFilter` lets the web layer skip\r\n * them when composing the CanvasKit image filter.\r\n */\r\nconst VIDEO_ONLY = new Set<string>([\"posterizeTime\", \"echo\"]);\r\n\r\n/** True when `type` is a pixel filter that composes into a CanvasKit image filter. */\r\nexport function isPixelFilter(type: string): boolean {\r\n return !VIDEO_ONLY.has(type);\r\n}\r\n\r\n/** True when `type` has a registered `FilterData` handler, here or in the effects registry. */\r\nexport function hasFilter(type: string): boolean {\r\n return FILTERS.has(type) || hasEffect(type);\r\n}\r\n\r\n/**\r\n * Interpolate between two individual filters at progress `t`.\r\n * Falls back to a hard cut at t = 0.5 when the types differ or are unregistered.\r\n *\r\n * A type with no dedicated `FilterData` is an {@link EffectAdjustment}, so it is\r\n * handed to `lerpEffect` — one interpolation per effect, whether it is animated\r\n * on a node or inside a fill.\r\n */\r\nexport function lerpFilter(from: AnyFilter, to: AnyFilter, t: number): AnyFilter {\r\n if (from.type !== to.type) return t < 0.5 ? from : to;\r\n const data = FILTERS.get(from.type);\r\n if (data) return data.lerp(from, to, t);\r\n return lerpEffect(from as NodeEffect, to as NodeEffect, t) as AnyFilter;\r\n}\r\n\r\n/**\r\n * The filters defined here reference nothing, but an {@link EffectAdjustment} can —\r\n * `lut` samples an image — and an undeclared one is a lookup the effect can only\r\n * read as \"no lookup table\".\r\n */\r\nexport function declareFilter(filter: AnyFilter, assets: AssetScope): void {\r\n if (FILTERS.has(filter.type)) return;\r\n declareEffect(filter as NodeEffect, assets);\r\n}\r\n\r\n/**\r\n * How a backend must realise `filter` — `\"shader\"` when it resamples pixel\r\n * positions and therefore has to wrap the fill's shader rather than compose\r\n * into its `ImageFilter` chain. The filters defined here are all `\"filter\"`;\r\n * an {@link EffectAdjustment} answers with its effect's own declaration.\r\n */\r\nexport function filterSurface(filter: AnyFilter): \"filter\" | \"shader\" {\r\n if (FILTERS.has(filter.type)) return \"filter\";\r\n // A filter is applied to the fill's own pixels, so it is never a backdrop\r\n // effect however the underlying effect's `mode` predicate reads.\r\n return effectSurface({ ...filter, mode: \"foreground\" } as NodeEffect);\r\n}\r\n\r\n/**\r\n * {@link lerpFilterArray} over two *optional* arrays, answering `undefined`\r\n * when neither side has a filter.\r\n *\r\n * A media fill's `lerp` is spread over the whole fill (`{...a, ...lerp(a,b,t)}`),\r\n * so returning `[]` for the overwhelmingly common no-filter case would allocate\r\n * a fresh array per fill per frame and turn an absent field into a present one.\r\n */\r\nexport function lerpOptionalFilters<T extends AnyFilter>(\r\n from: T[] | undefined,\r\n to: T[] | undefined,\r\n t: number,\r\n): T[] | undefined {\r\n if (!from?.length && !to?.length) return undefined;\r\n return lerpFilterArray(from ?? [], to ?? [], t) as T[];\r\n}\r\n\r\n/**\r\n * Interpolate between two filter arrays of potentially different lengths.\r\n * Indices present in only one array are kept as-is; matched indices are lerped pairwise.\r\n */\r\nexport function lerpFilterArray(from: AnyFilter[], to: AnyFilter[], t: number): AnyFilter[] {\r\n const maxLen = Math.max(from.length, to.length);\r\n const result: AnyFilter[] = [];\r\n for (let i = 0; i < maxLen; i++) {\r\n const a = from[i];\r\n const b = to[i];\r\n if (a && b) {\r\n result.push(lerpFilter(a, b, t));\r\n } else if (a) {\r\n result.push(a);\r\n } else if (b) {\r\n result.push(b);\r\n }\r\n }\r\n return result;\r\n}\r\n"]}
|
|
@@ -7,22 +7,21 @@ import type { ExposureFilter } from "./implementations/exposure.js";
|
|
|
7
7
|
import type { GrayscaleFilter } from "./implementations/grayscale.js";
|
|
8
8
|
import type { PosterizeTimeFilter } from "./implementations/posterize-time.js";
|
|
9
9
|
import type { VideoEchoFilter } from "./implementations/echo.js";
|
|
10
|
-
import type {
|
|
10
|
+
import type { NodeEffect } from "../effects/union.js";
|
|
11
11
|
import type { BlurEffect } from "../effects/implementations/blur.js";
|
|
12
12
|
import type { GrayscaleEffect } from "../effects/implementations/grayscale.js";
|
|
13
13
|
import type { CurvesEffect } from "../effects/implementations/curves.js";
|
|
14
14
|
import type { ColorAdjustmentEffect } from "../effects/implementations/color-adjustment.js";
|
|
15
15
|
import type { MagnifyEffect } from "../effects/implementations/magnify.js";
|
|
16
16
|
import type { MotionBlurEffect } from "../effects/implementations/motion-blur.js";
|
|
17
|
-
import type { TrailsEffect } from "../effects/implementations/trails.js";
|
|
18
17
|
import type { OutlineEffect } from "../effects/implementations/outline.js";
|
|
19
18
|
import type { DropShadowEffect } from "../../../attributes/shape/effects/implementations/drop-shadow.js";
|
|
20
19
|
import type { GlowEffect } from "../effects/implementations/glow.js";
|
|
21
20
|
import type { GlassEffect } from "../effects/implementations/glass.js";
|
|
22
21
|
/**
|
|
23
|
-
* The
|
|
22
|
+
* The node effects that are **not** media filters, and why.
|
|
24
23
|
*
|
|
25
|
-
* Everything else in {@link
|
|
24
|
+
* Everything else in {@link NodeEffect} is a function of the pixels it is
|
|
26
25
|
* given, so it means exactly the same thing applied to a node's rendered
|
|
27
26
|
* content or to one fill layer's own pixels — and the renderer already runs
|
|
28
27
|
* both through a single handler registry. This is the exception list, so a new
|
|
@@ -46,9 +45,9 @@ import type { GlassEffect } from "../effects/implementations/glass.js";
|
|
|
46
45
|
* bookkeeping reason: they already have a dedicated filter type below, sharing
|
|
47
46
|
* the same fields and the same renderer handler.
|
|
48
47
|
*/
|
|
49
|
-
type NonFilterEffect = MagnifyEffect | GlassEffect | MotionBlurEffect |
|
|
48
|
+
type NonFilterEffect = MagnifyEffect | GlassEffect | MotionBlurEffect | OutlineEffect | DropShadowEffect | GlowEffect | BlurEffect | GrayscaleEffect | CurvesEffect | ColorAdjustmentEffect;
|
|
50
49
|
/**
|
|
51
|
-
*
|
|
50
|
+
* Node effects usable as a media filter — i.e. applied to one image/video
|
|
52
51
|
* fill's own pixels rather than to a node and everything under it.
|
|
53
52
|
*
|
|
54
53
|
* This is what lets a background image be oil-painted, dithered or posterized
|
|
@@ -62,7 +61,7 @@ type NonFilterEffect = MagnifyEffect | GlassEffect | MotionBlurEffect | TrailsEf
|
|
|
62
61
|
* backdrop); the {@link VideoAdjustmentChain} builders drop it, and the renderer ignores
|
|
63
62
|
* it on this path.
|
|
64
63
|
*/
|
|
65
|
-
export type EffectAdjustment = Exclude<
|
|
64
|
+
export type EffectAdjustment = Exclude<NodeEffect, NonFilterEffect>;
|
|
66
65
|
/**
|
|
67
66
|
* Discriminated union of pixel filters — the filters valid on both image and
|
|
68
67
|
* video fills. Each is realised either as a single CanvasKit image filter
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"union.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/union.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE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,qBAAqB,GACrB,gBAAgB,CAAC;AAEvB;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GACzB,mBAAmB,GACnB,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/union.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlphaFilter } from \"./implementations/alpha\";\nimport type { BlurFilter } from \"./implementations/blur\";\nimport type { ColorAdjustmentFilter } from \"./implementations/color-adjustment\";\nimport type { ColorMatrixFilter } from \"./implementations/color-matrix\";\nimport type { CurvesFilter } from \"./implementations/curves\";\nimport type { ExposureFilter } from \"./implementations/exposure\";\nimport type { GrayscaleFilter } from \"./implementations/grayscale\";\nimport type { PosterizeTimeFilter } from \"./implementations/posterize-time\";\nimport type { VideoEchoFilter } from \"./implementations/echo\";\n\nimport type {
|
|
1
|
+
{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../../src/attributes/shape/filters/union.ts"],"names":[],"mappings":"","sourcesContent":["import type { AlphaFilter } from \"./implementations/alpha\";\r\nimport type { BlurFilter } from \"./implementations/blur\";\r\nimport type { ColorAdjustmentFilter } from \"./implementations/color-adjustment\";\r\nimport type { ColorMatrixFilter } from \"./implementations/color-matrix\";\r\nimport type { CurvesFilter } from \"./implementations/curves\";\r\nimport type { ExposureFilter } from \"./implementations/exposure\";\r\nimport type { GrayscaleFilter } from \"./implementations/grayscale\";\r\nimport type { PosterizeTimeFilter } from \"./implementations/posterize-time\";\r\nimport type { VideoEchoFilter } from \"./implementations/echo\";\r\n\r\nimport type { NodeEffect } from \"../effects/union\";\r\nimport type { BlurEffect } from \"../effects/implementations/blur\";\r\nimport type { GrayscaleEffect } from \"../effects/implementations/grayscale\";\r\nimport type { CurvesEffect } from \"../effects/implementations/curves\";\r\nimport type { ColorAdjustmentEffect } from \"../effects/implementations/color-adjustment\";\r\nimport type { MagnifyEffect } from \"../effects/implementations/magnify\";\r\nimport type { MotionBlurEffect } from \"../effects/implementations/motion-blur\";\r\nimport type { OutlineEffect } from \"../effects/implementations/outline\";\r\nimport type { DropShadowEffect } from \"@/attributes/shape/effects/implementations/drop-shadow\";\r\nimport type { GlowEffect } from \"../effects/implementations/glow\";\r\nimport type { GlassEffect } from \"../effects/implementations/glass\";\r\n\r\n/**\r\n * The node effects that are **not** media filters, and why.\r\n *\r\n * Everything else in {@link NodeEffect} is a function of the pixels it is\r\n * given, so it means exactly the same thing applied to a node's rendered\r\n * content or to one fill layer's own pixels — and the renderer already runs\r\n * both through a single handler registry. This is the exception list, so a new\r\n * effect becomes a filter by default rather than by remembering to add it.\r\n *\r\n * Two reasons land here:\r\n *\r\n * - **Needs something a fill layer doesn't have.** `magnify` and `glass` sample\r\n * the backdrop beneath the node — glass is a slab you see *through*, and a\r\n * node's own paint is not something there is anything behind; `motionBlur` and\r\n * `trails` are derived from the node's sampled velocity. A fill has no\r\n * backdrop and no motion of its own.\r\n * - **Draws outside the silhouette.** `outline` paints a ring around the\r\n * content, which the shape path a fill is clipped to would cut away, and\r\n * `glow` bleeds past it in every direction — a glow clipped to the thing that\r\n * cast it is not a dimmer glow, it is no glow at all. (`bloom` stays: it is\r\n * the contained version of the same idea, which is what makes it the right\r\n * one to reach for on a fill.)\r\n *\r\n * `blur`, `grayscale`, `curves` and `colorAdjustment` are excluded for a third,\r\n * bookkeeping reason: they already have a dedicated filter type below, sharing\r\n * the same fields and the same renderer handler.\r\n */\r\ntype NonFilterEffect =\r\n | MagnifyEffect\r\n | GlassEffect\r\n | MotionBlurEffect\r\n | OutlineEffect\r\n | DropShadowEffect\r\n | GlowEffect\r\n | BlurEffect\r\n | GrayscaleEffect\r\n | CurvesEffect\r\n | ColorAdjustmentEffect;\r\n\r\n/**\r\n * Node effects usable as a media filter — i.e. applied to one image/video\r\n * fill's own pixels rather than to a node and everything under it.\r\n *\r\n * This is what lets a background image be oil-painted, dithered or posterized\r\n * without wrapping it in a node whose effect would also hit its children:\r\n *\r\n * <Rect fill={Fills.image('bg.jpg', { filters: Adjustments.oilPaint(4) })}>\r\n * <Text text=\"still sharp\" />\r\n * </Rect>\r\n *\r\n * The effects carry a `mode` field that means nothing here (a fill has no\r\n * backdrop); the {@link VideoAdjustmentChain} builders drop it, and the renderer ignores\r\n * it on this path.\r\n */\r\nexport type EffectAdjustment = Exclude<NodeEffect, NonFilterEffect>;\r\n\r\n/**\r\n * Discriminated union of pixel filters — the filters valid on both image and\r\n * video fills. Each is realised either as a single CanvasKit image filter\r\n * applied via `paint.setImageFilter`, or — for the ones that resample pixel\r\n * *positions* — as a lens shader wrapping the fill's own shader.\r\n */\r\nexport type MediaAdjustment =\r\n | ExposureFilter\r\n | BlurFilter\r\n | GrayscaleFilter\r\n | AlphaFilter\r\n | ColorMatrixFilter\r\n | CurvesFilter\r\n | ColorAdjustmentFilter\r\n | EffectAdjustment;\r\n\r\n/**\r\n * Discriminated union of video-only filters — temporal/multi-frame effects that\r\n * are meaningless on a still image (a single frame has no time axis and no\r\n * previous frames). Consumed outside the pixel `setImageFilter` path.\r\n */\r\nexport type VideoOnlyAdjustment =\r\n | PosterizeTimeFilter\r\n | VideoEchoFilter;\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchors.d.ts","sourceRoot":"","sources":["../../../../src/attributes/shape/path/anchors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAS,UAAU,EAAe,iBAAiB,EAAe,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1G,qEAAqE;AACrE,eAAO,MAAM,eAAe,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"anchors.d.ts","sourceRoot":"","sources":["../../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AkF;AAClF,eAAO,MAAM,cAAc,QAAuB,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,OAK3B,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,GAAG,iBAAiB,CAI7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,OAAO,GAAG,iBAAiB,CAkB1E;AAED,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,UAAU,CAEtE;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAa5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,KAAK,CACjB,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,GAC5C;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,EAAE,EAAE,UAAU,CAAA;CAAE,CAqB1D"}
|
|
@@ -31,19 +31,23 @@ function closeSubpath(subpath) {
|
|
|
31
31
|
first.inHandle = last.inHandle;
|
|
32
32
|
anchors.pop();
|
|
33
33
|
}
|
|
34
|
+
/** A copy of a point of the memoized contour — the model is edited in place. */
|
|
35
|
+
const copy = (v) => ({ x: v.x, y: v.y });
|
|
34
36
|
function contourToSubpath(contour) {
|
|
37
|
+
// Every point and handle is copied out of the memoized contour: `contours`
|
|
38
|
+
// shares its result between callers, and an editor moves these in place.
|
|
35
39
|
const anchors = [
|
|
36
|
-
{ point: contour.start, inHandle: null, outHandle: null },
|
|
40
|
+
{ point: copy(contour.start), inHandle: null, outHandle: null },
|
|
37
41
|
];
|
|
38
42
|
const curve = (cubic) => {
|
|
39
|
-
anchors[anchors.length - 1].outHandle = cubic.c1;
|
|
40
|
-
anchors.push({ point: cubic.p1, inHandle: cubic.c2, outHandle: null });
|
|
43
|
+
anchors[anchors.length - 1].outHandle = copy(cubic.c1);
|
|
44
|
+
anchors.push({ point: copy(cubic.p1), inHandle: copy(cubic.c2), outHandle: null });
|
|
41
45
|
};
|
|
42
46
|
for (const segment of contour.segments) {
|
|
43
47
|
switch (segment.kind) {
|
|
44
48
|
case "line":
|
|
45
49
|
// Both handles stay null, which is what draws a straight segment.
|
|
46
|
-
anchors.push({ point: segment.to, inHandle: null, outHandle: null });
|
|
50
|
+
anchors.push({ point: copy(segment.to), inHandle: null, outHandle: null });
|
|
47
51
|
break;
|
|
48
52
|
case "cubic":
|
|
49
53
|
curve({ p0: segment.from, c1: segment.c1, c2: segment.c2, p1: segment.to });
|
|
@@ -215,7 +219,10 @@ export function anchorBounds(path) {
|
|
|
215
219
|
includeX(anchor.point.x);
|
|
216
220
|
includeY(anchor.point.y);
|
|
217
221
|
}
|
|
218
|
-
|
|
222
|
+
// The closing join exists only with a second anchor to join: the writers
|
|
223
|
+
// emit none for a lone one (`M x y Z` draws nothing), so its self-loop
|
|
224
|
+
// must not widen the box either.
|
|
225
|
+
const last = closed && anchors.length > 1 ? anchors.length : anchors.length - 1;
|
|
219
226
|
for (let i = 0; i < last; i++) {
|
|
220
227
|
const from = anchors[i];
|
|
221
228
|
const to = anchors[(i + 1) % anchors.length];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchors.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/anchors.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI9C,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,8EAA8E;AAE9E,q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EAAE,QAAQ,EAAE,KAAK,CAAC,GAAG,EAAE;KACrC,CAAC;AACN,CAAC","sourcesContent":["/**\n * The editable vector model — subpaths of anchors, each carrying the two bezier\n * handles that govern the segments either side of it — and the unit box it is\n * quoted against. Figma's vector model, and what a person actually drags.\n *\n * The **second** of the two boundaries where geometry is deliberately flattened\n * to one curve type. An arc has no handles to drag, so it becomes cubics on the\n * way in — a conversion, where it used to be a truncation: `A` was missing from\n * the old parser's letter list, so it stopped dead at the first arc and\n * everything after it disappeared. Real-world icons draw their rounded joins\n * with arcs, so pasting one in lost most of the shape.\n *\n * **The coordinate space is the node's own box**: `x` and `y` run -0.5 to +0.5\n * across its width and height, y pointing *down* the way SVG's does. Resizing is\n * then an ordinary width/height drag, because the geometry is a fraction of the\n * box rather than a pixel count inside it — no gizmo code has to know a path\n * from a rect. Points *may* sit outside it: a point dragged past an edge is\n * honest about where it was dropped, and {@link normalize} pulls the\n * box back around the geometry once, on the way out of an edit.\n */\nimport { Vector2 } from \"@/attributes/layout/vector2\";\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\nimport { arcSweepToCubics, cubicAxis, cubicExtrema, quadToCubic, splitCubicAt } from \"./bezier\";\nimport { contours, segmentArc } from \"./walk\";\nimport type { Extents } from \"@/layout/bounds\";\nimport type { Cubic, PathAnchor, PathContour, PathNormalization, PathSubpath, VectorPath } from \"./types\";\n\n/** An empty path, as the value an unset `data` field resolves to. */\nexport const EMPTY_PATH_DATA = \"\";\n\n// ── Reading ────────────────────────────────────────────────────────────────\n\n/** Whether two points are the same to within serialization noise. */\nfunction samePoint(a: Vector2, b: Vector2): boolean {\n return Math.abs(a.x - b.x) < 1e-6 && Math.abs(a.y - b.y) < 1e-6;\n}\n\n/**\n * Marks a subpath closed, folding a duplicated last anchor into the first.\n *\n * A `d` string that ends `… L 0 0 Z` — which every serializer that closes\n * explicitly produces, ours included when a closing segment carries handles —\n * names the start point twice: once as the last `L`/`C` target and once\n * implicitly by `Z`. Left alone, the round trip would grow an anchor on every\n * load, which is the kind of drift that only shows up after a file has been\n * opened a hundred times.\n */\nfunction closeSubpath(subpath: PathSubpath): void {\n subpath.closed = true;\n const { anchors } = subpath;\n if (anchors.length < 2) return;\n const first = anchors[0];\n const last = anchors[anchors.length - 1];\n if (!samePoint(first.point, last.point)) return;\n // The closing segment's own curvature belongs to the join, so the duplicate's\n // in-handle becomes the first anchor's.\n first.inHandle = last.inHandle;\n anchors.pop();\n}\n\nfunction contourToSubpath(contour: PathContour): PathSubpath {\n const anchors: PathAnchor[] = [\n { point: contour.start, inHandle: null, outHandle: null },\n ];\n const curve = (cubic: Cubic) => {\n anchors[anchors.length - 1].outHandle = cubic.c1;\n anchors.push({ point: cubic.p1, inHandle: cubic.c2, outHandle: null });\n };\n\n for (const segment of contour.segments) {\n switch (segment.kind) {\n case \"line\":\n // Both handles stay null, which is what draws a straight segment.\n anchors.push({ point: segment.to, inHandle: null, outHandle: null });\n break;\n case \"cubic\":\n curve({ p0: segment.from, c1: segment.c1, c2: segment.c2, p1: segment.to });\n break;\n case \"quad\":\n curve(quadToCubic(segment.from, segment.c, segment.to));\n break;\n case \"arc\": {\n const arc = segmentArc(segment);\n for (const cubic of arcSweepToCubics(arc, arc.theta1, arc.theta1 + arc.dtheta)) {\n curve(cubic);\n }\n break;\n }\n }\n }\n\n const subpath: PathSubpath = { anchors, closed: false };\n if (contour.closed) closeSubpath(subpath);\n return subpath;\n}\n\n/**\n * Any {@link PathData} as the editable model.\n *\n * Takes `PathData`, not a string. The old entry point took only a string and\n * every caller had to guard — `typeof data === \"string\" ? data : \"\"` — which\n * meant a node animating its `data` drew *nothing* for the whole tween, because\n * a morph hands over a `PathCommand[]` at every `t` strictly between 0 and 1.\n */\nexport function anchors(d: PathData | null | undefined): VectorPath {\n return contours(d)\n .map(contourToSubpath)\n .filter((subpath) => subpath.anchors.length > 0);\n}\n\n// ── Writing ────────────────────────────────────────────────────────────────\n\n/**\n * How many decimals a stored coordinate keeps.\n *\n * The space is the unit box, so a coordinate is a fraction of the node's size:\n * five decimals is sub-pixel on a 10,000px node and keeps the string short\n * enough that a path is a sane thing to hold in a JSON column. It also makes the\n * round trip *stable* — a drag that lands where it started re-serializes to the\n * identical string, which is what lets an editor tell \"nothing changed\" from\n * \"changed by a rounding error\".\n */\nconst COORD_PRECISION = 5;\n\nfunction fmt(value: number): string {\n if (!Number.isFinite(value)) return \"0\";\n const rounded = Number(value.toFixed(COORD_PRECISION));\n // `-0` serializes as \"0\": the two are the same point, and a sign that flips\n // with the wind would make the \"did anything change\" comparison lie.\n return String(rounded === 0 ? 0 : rounded);\n}\n\n/**\n * What one segment between two anchors *is* — a line, or a cubic and its\n * controls.\n *\n * The decision lived twice, once per output format: `segmentData` wrote it as a\n * `d` string and `pushSegment` as a `PathCommand`, with the same rule about a\n * missing handle standing in as its own anchor written out both times.\n */\nfunction segmentBetween(from: PathAnchor, to: PathAnchor):\n | { line: true; to: Vector2 }\n | { line: false; c1: Vector2; c2: Vector2; to: Vector2 } {\n if (from.outHandle === null && to.inHandle === null) {\n return { line: true, to: to.point };\n }\n // A missing handle stands in as its own anchor, which is the degenerate cubic\n // that draws as a straight pull towards the other end — the same thing every\n // vector editor means by \"one side of this segment is a curve\".\n return {\n line: false,\n c1: from.outHandle ?? from.point,\n c2: to.inHandle ?? to.point,\n to: to.point,\n };\n}\n\n/**\n * Serializes the model back to a `d` string.\n *\n * Only `M`, `L`, `C` and `Z` are emitted — the four commands the editor can\n * round-trip — so what is stored is always what can be edited.\n */\nexport function fromAnchors(path: VectorPath): string {\n const parts: string[] = [];\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n parts.push(`M ${fmt(anchors[0].point.x)} ${fmt(anchors[0].point.y)}`);\n for (let i = 1; i < anchors.length; i++) {\n const segment = segmentBetween(anchors[i - 1], anchors[i]);\n parts.push(segment.line\n ? `L ${fmt(segment.to.x)} ${fmt(segment.to.y)}`\n : `C ${fmt(segment.c1.x)} ${fmt(segment.c1.y)} ${fmt(segment.c2.x)} ${fmt(segment.c2.y)} ${fmt(segment.to.x)} ${fmt(segment.to.y)}`);\n }\n if (closed) {\n if (anchors.length > 1) {\n const join = segmentBetween(anchors[anchors.length - 1], anchors[0]);\n // A straight closing segment is what `Z` already draws, so emitting\n // it as well would add the duplicate anchor `closeSubpath` undoes.\n if (!join.line) {\n parts.push(`C ${fmt(join.c1.x)} ${fmt(join.c1.y)} ${fmt(join.c2.x)} ${fmt(join.c2.y)} ${fmt(join.to.x)} ${fmt(join.to.y)}`);\n }\n }\n parts.push(\"Z\");\n }\n }\n return parts.join(\" \");\n}\n\nconst identity = (point: Vector2): Vector2 => point;\n\n/**\n * The model as drawable commands, with a transform folded into the same pass.\n *\n * Every caller needs one — unit box → the node's laid-out pixels, and y-down →\n * the renderer's y-up — and doing it here means one allocation per frame instead\n * of two, on a list rebuilt every time the node repaints.\n */\nexport function anchorCommands(\n path: VectorPath,\n transform: (point: Vector2) => Vector2 = identity,\n): PathCommand[] {\n const out: PathCommand[] = [];\n const emit = (from: PathAnchor, to: PathAnchor) => {\n const segment = segmentBetween(from, to);\n const end = transform(segment.to);\n if (segment.line) {\n out.push({ type: \"L\", x: end.x, y: end.y });\n return;\n }\n const c1 = transform(segment.c1);\n const c2 = transform(segment.c2);\n out.push({ type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y });\n };\n\n for (const { anchors, closed } of path) {\n if (anchors.length === 0) continue;\n const start = transform(anchors[0].point);\n out.push({ type: \"M\", x: start.x, y: start.y });\n for (let i = 1; i < anchors.length; i++) emit(anchors[i - 1], anchors[i]);\n if (closed) {\n if (anchors.length > 1) {\n const from = anchors[anchors.length - 1];\n const to = anchors[0];\n if (from.outHandle !== null || to.inHandle !== null) emit(from, to);\n }\n out.push({ type: \"Z\" });\n }\n }\n return out;\n}\n\n// ── Measuring ──────────────────────────────────────────────────────────────\n\n/**\n * The path's tight bounding box, or `null` when it has no points.\n *\n * Tight, not the handle polygon's hull: a cubic's own extrema are solved for,\n * because the handles can sit a long way outside the curve and a box derived\n * from them would leave a visible gap between a normalized shape and the edge of\n * its node.\n */\nexport function anchorBounds(path: VectorPath): Extents | null {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n let seen = false;\n\n const includeX = (x: number) => { seen = true; if (x < minX) minX = x; if (x > maxX) maxX = x; };\n const includeY = (y: number) => { seen = true; if (y < minY) minY = y; if (y > maxY) maxY = y; };\n\n for (const { anchors, closed } of path) {\n for (const anchor of anchors) {\n includeX(anchor.point.x);\n includeY(anchor.point.y);\n }\n const last = closed ? anchors.length : anchors.length - 1;\n for (let i = 0; i < last; i++) {\n const from = anchors[i];\n const to = anchors[(i + 1) % anchors.length];\n if (from.outHandle === null && to.inHandle === null) continue;\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n for (const t of cubicExtrema(from.point.x, c1.x, c2.x, to.point.x)) {\n includeX(cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x));\n }\n for (const t of cubicExtrema(from.point.y, c1.y, c2.y, to.point.y)) {\n includeY(cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y));\n }\n }\n }\n\n return seen ? { minX, minY, maxX, maxY } : null;\n}\n\n// ── Transforming ───────────────────────────────────────────────────────────\n\n/** Applies `fn` to every point and handle, returning a new path. */\nexport function map(path: VectorPath, fn: (point: Vector2) => Vector2): VectorPath {\n return path.map((subpath) => ({\n closed: subpath.closed,\n anchors: subpath.anchors.map((anchor) => ({\n point: fn(anchor.point),\n inHandle: anchor.inHandle ? fn(anchor.inHandle) : null,\n outHandle: anchor.outHandle ? fn(anchor.outHandle) : null,\n })),\n }));\n}\n\n/**\n * The turn-and-scale about `start` that carries `end` onto `to` — how `moveTo`\n * fits a path aimed at another node. Where `start` and `end` coincide there is\n * no chord to turn, so it translates instead.\n */\nexport function endFit(start: Vector2, end: Vector2, to: Vector2): (point: Vector2) => Vector2 {\n const cx = end.x - start.x;\n const cy = end.y - start.y;\n const chord = cx * cx + cy * cy;\n if (chord < 1e-12) {\n const dx = to.x - end.x;\n const dy = to.y - end.y;\n return (p) => ({ x: p.x + dx, y: p.y + dy });\n }\n // (to - start) / (end - start) as complex numbers: a rotation and a uniform scale.\n const tx = to.x - start.x;\n const ty = to.y - start.y;\n const re = (tx * cx + ty * cy) / chord;\n const im = (ty * cx - tx * cy) / chord;\n return (p) => {\n const ux = p.x - start.x;\n const uy = p.y - start.y;\n return { x: start.x + re * ux - im * uy, y: start.y + im * ux + re * uy };\n };\n}\n\n/** Whether a path would draw anything at all. */\nexport function isEmpty(path: VectorPath): boolean {\n return path.every((subpath) => subpath.anchors.length < 2);\n}\n\n/**\n * The unit box's extent — the node's own layout rect, as a fraction of itself.\n *\n * Exported because two very different callers need the same half: a renderer\n * scales by the extent (1 unit = the node's full width), and an editor projects\n * a screen point into it.\n */\nexport const PATH_UNIT_EXTENT = 1;\n\n/** Half of {@link PATH_UNIT_EXTENT} — the distance from the centre to an edge. */\nexport const PATH_UNIT_HALF = PATH_UNIT_EXTENT / 2;\n\n/**\n * The box a path's coordinates are already quoted against — the node's own\n * frame, as {@link PATH_UNIT_HALF} either side of centre.\n */\nexport const UNIT_PATH_BOX: Extents = {\n minX: -PATH_UNIT_HALF,\n minY: -PATH_UNIT_HALF,\n maxX: PATH_UNIT_HALF,\n maxY: PATH_UNIT_HALF,\n};\n\n/**\n * Pulls the unit box back around the geometry.\n *\n * What an editor runs on the way *out* of a path edit, and the reason a node\n * whose points were dragged all over the canvas still ends up with a selection\n * box that hugs it. The caller pairs it with the node's own size and position:\n * the box grows by `scaleX`/`scaleY` and moves by `centerX`/`centerY` scaled\n * into the node's parent, so the drawing doesn't shift on screen while its frame\n * changes underneath it.\n */\nexport function normalize(path: VectorPath): PathNormalization {\n const bounds = anchorBounds(path);\n if (!bounds) return { path, scaleX: 1, scaleY: 1, centerX: 0, centerY: 0 };\n return fitToBox(path, bounds);\n}\n\n/**\n * Re-quotes a path against `box` — the general form of\n * {@link normalize}, which is this with the geometry's own bounds.\n *\n * The two callers want the same arithmetic for opposite reasons. A canvas editor\n * fits the box to the drawing on the way out, so a node drawn in a corner of its\n * frame ends up with a frame that hugs it. An appearance dialog lets the frame\n * be **stated** instead — dragged wider than the drawing to leave a margin, or\n * slid so the drawing sits off-centre — and then fits to that.\n *\n * A degenerate axis — every point on one line, which is a perfectly reasonable\n * thing to draw — keeps its scale at 1 rather than dividing by zero, so a flat\n * path stays where it is instead of becoming NaN.\n */\nexport function fitToBox(path: VectorPath, box: Extents): PathNormalization {\n const width = box.maxX - box.minX;\n const height = box.maxY - box.minY;\n const centerX = (box.minX + box.maxX) / 2;\n const centerY = (box.minY + box.maxY) / 2;\n const scaleX = width > 1e-9 ? width / PATH_UNIT_EXTENT : 1;\n const scaleY = height > 1e-9 ? height / PATH_UNIT_EXTENT : 1;\n\n return {\n path: map(path, (p) => ({\n x: (p.x - centerX) / scaleX,\n y: (p.y - centerY) / scaleY,\n })),\n scaleX,\n scaleY,\n centerX,\n centerY,\n };\n}\n\n/** Moves every point and handle by the same delta. */\nexport function translate(path: VectorPath, delta: Vector2): VectorPath {\n return map(path, (p) => ({ x: p.x + delta.x, y: p.y + delta.y }));\n}\n\n/**\n * A point on the segment between two anchors, at parameter `t`.\n *\n * An editor needs it twice over: to find where on a segment a click landed (so a\n * double-click can insert an anchor there), and to draw the preview of the\n * anchor that insertion would create.\n */\nexport function pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2 {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n x: from.point.x + (to.point.x - from.point.x) * t,\n y: from.point.y + (to.point.y - from.point.y) * t,\n };\n }\n const c1 = from.outHandle ?? from.point;\n const c2 = to.inHandle ?? to.point;\n return {\n x: cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x),\n y: cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y),\n };\n}\n\n/**\n * Splits the segment between two anchors at `t`, returning the three anchors\n * that replace them — the two ends with their outer handles shortened, and the\n * new anchor in the middle carrying both halves of the split tangent.\n *\n * De Casteljau, which is what makes the insertion *invisible*: the curve through\n * the new point is the same curve, so double-clicking a segment adds somewhere\n * to grab rather than changing the shape under the pointer.\n */\nexport function split(\n from: PathAnchor, to: PathAnchor, t: number,\n): { from: PathAnchor; middle: PathAnchor; to: PathAnchor } {\n if (from.outHandle === null && to.inHandle === null) {\n return {\n from,\n middle: { point: pointOn(from, to, t), inHandle: null, outHandle: null },\n to,\n };\n }\n\n const { left, right } = splitCubicAt(\n from.point,\n from.outHandle ?? from.point,\n to.inHandle ?? to.point,\n to.point,\n t,\n );\n return {\n from: { ...from, outHandle: left.cp1 },\n middle: { point: left.to, inHandle: left.cp2, outHandle: right.cp1 },\n to: { ...to, inHandle: right.cp2 },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"anchors.js","sourceRoot":"","sources":["../../../../src/attributes/shape/path/anchors.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAChG,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAI9C,qEAAqE;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,8EAA8E;AAE9E,qEAAqE;AACrE,SAAS,SAAS,CAAC,CAAU,EAAE,CAAU;IACrC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AACpE,CAAC;AAED;;;;;;;;;GASG;AACH,SAAS,YAAY,CAAC,OAAoB;IACtC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAC5B,IAAI,OAAO,CAAC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;AACN,CAAC","sourcesContent":["/**\r\n * The editable vector model — subpaths of anchors, each carrying the two bezier\r\n * handles that govern the segments either side of it — and the unit box it is\r\n * quoted against. Figma's vector model, and what a person actually drags.\r\n *\r\n * The **second** of the two boundaries where geometry is deliberately flattened\r\n * to one curve type. An arc has no handles to drag, so it becomes cubics on the\r\n * way in — a conversion, where it used to be a truncation: `A` was missing from\r\n * the old parser's letter list, so it stopped dead at the first arc and\r\n * everything after it disappeared. Real-world icons draw their rounded joins\r\n * with arcs, so pasting one in lost most of the shape.\r\n *\r\n * **The coordinate space is the node's own box**: `x` and `y` run -0.5 to +0.5\r\n * across its width and height, y pointing *down* the way SVG's does. Resizing is\r\n * then an ordinary width/height drag, because the geometry is a fraction of the\r\n * box rather than a pixel count inside it — no gizmo code has to know a path\r\n * from a rect. Points *may* sit outside it: a point dragged past an edge is\r\n * honest about where it was dropped, and {@link normalize} pulls the\r\n * box back around the geometry once, on the way out of an edit.\r\n */\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { PathCommand, PathData } from \"@/render/descriptors/path\";\r\nimport { arcSweepToCubics, cubicAxis, cubicExtrema, quadToCubic, splitCubicAt } from \"./bezier\";\r\nimport { contours, segmentArc } from \"./walk\";\r\nimport type { Extents } from \"@/layout/bounds\";\r\nimport type { Cubic, PathAnchor, PathContour, PathNormalization, PathSubpath, VectorPath } from \"./types\";\r\n\r\n/** An empty path, as the value an unset `data` field resolves to. */\r\nexport const EMPTY_PATH_DATA = \"\";\r\n\r\n// ── Reading ────────────────────────────────────────────────────────────────\r\n\r\n/** Whether two points are the same to within serialization noise. */\r\nfunction samePoint(a: Vector2, b: Vector2): boolean {\r\n return Math.abs(a.x - b.x) < 1e-6 && Math.abs(a.y - b.y) < 1e-6;\r\n}\r\n\r\n/**\r\n * Marks a subpath closed, folding a duplicated last anchor into the first.\r\n *\r\n * A `d` string that ends `… L 0 0 Z` — which every serializer that closes\r\n * explicitly produces, ours included when a closing segment carries handles —\r\n * names the start point twice: once as the last `L`/`C` target and once\r\n * implicitly by `Z`. Left alone, the round trip would grow an anchor on every\r\n * load, which is the kind of drift that only shows up after a file has been\r\n * opened a hundred times.\r\n */\r\nfunction closeSubpath(subpath: PathSubpath): void {\r\n subpath.closed = true;\r\n const { anchors } = subpath;\r\n if (anchors.length < 2) return;\r\n const first = anchors[0];\r\n const last = anchors[anchors.length - 1];\r\n if (!samePoint(first.point, last.point)) return;\r\n // The closing segment's own curvature belongs to the join, so the duplicate's\r\n // in-handle becomes the first anchor's.\r\n first.inHandle = last.inHandle;\r\n anchors.pop();\r\n}\r\n\r\n/** A copy of a point of the memoized contour — the model is edited in place. */\r\nconst copy = (v: Vector2): Vector2 => ({ x: v.x, y: v.y });\r\n\r\nfunction contourToSubpath(contour: PathContour): PathSubpath {\r\n // Every point and handle is copied out of the memoized contour: `contours`\r\n // shares its result between callers, and an editor moves these in place.\r\n const anchors: PathAnchor[] = [\r\n { point: copy(contour.start), inHandle: null, outHandle: null },\r\n ];\r\n const curve = (cubic: Cubic) => {\r\n anchors[anchors.length - 1].outHandle = copy(cubic.c1);\r\n anchors.push({ point: copy(cubic.p1), inHandle: copy(cubic.c2), outHandle: null });\r\n };\r\n\r\n for (const segment of contour.segments) {\r\n switch (segment.kind) {\r\n case \"line\":\r\n // Both handles stay null, which is what draws a straight segment.\r\n anchors.push({ point: copy(segment.to), inHandle: null, outHandle: null });\r\n break;\r\n case \"cubic\":\r\n curve({ p0: segment.from, c1: segment.c1, c2: segment.c2, p1: segment.to });\r\n break;\r\n case \"quad\":\r\n curve(quadToCubic(segment.from, segment.c, segment.to));\r\n break;\r\n case \"arc\": {\r\n const arc = segmentArc(segment);\r\n for (const cubic of arcSweepToCubics(arc, arc.theta1, arc.theta1 + arc.dtheta)) {\r\n curve(cubic);\r\n }\r\n break;\r\n }\r\n }\r\n }\r\n\r\n const subpath: PathSubpath = { anchors, closed: false };\r\n if (contour.closed) closeSubpath(subpath);\r\n return subpath;\r\n}\r\n\r\n/**\r\n * Any {@link PathData} as the editable model.\r\n *\r\n * Takes `PathData`, not a string. The old entry point took only a string and\r\n * every caller had to guard — `typeof data === \"string\" ? data : \"\"` — which\r\n * meant a node animating its `data` drew *nothing* for the whole tween, because\r\n * a morph hands over a `PathCommand[]` at every `t` strictly between 0 and 1.\r\n */\r\nexport function anchors(d: PathData | null | undefined): VectorPath {\r\n return contours(d)\r\n .map(contourToSubpath)\r\n .filter((subpath) => subpath.anchors.length > 0);\r\n}\r\n\r\n// ── Writing ────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * How many decimals a stored coordinate keeps.\r\n *\r\n * The space is the unit box, so a coordinate is a fraction of the node's size:\r\n * five decimals is sub-pixel on a 10,000px node and keeps the string short\r\n * enough that a path is a sane thing to hold in a JSON column. It also makes the\r\n * round trip *stable* — a drag that lands where it started re-serializes to the\r\n * identical string, which is what lets an editor tell \"nothing changed\" from\r\n * \"changed by a rounding error\".\r\n */\r\nconst COORD_PRECISION = 5;\r\n\r\nfunction fmt(value: number): string {\r\n if (!Number.isFinite(value)) return \"0\";\r\n const rounded = Number(value.toFixed(COORD_PRECISION));\r\n // `-0` serializes as \"0\": the two are the same point, and a sign that flips\r\n // with the wind would make the \"did anything change\" comparison lie.\r\n return String(rounded === 0 ? 0 : rounded);\r\n}\r\n\r\n/**\r\n * What one segment between two anchors *is* — a line, or a cubic and its\r\n * controls.\r\n *\r\n * The decision lived twice, once per output format: `segmentData` wrote it as a\r\n * `d` string and `pushSegment` as a `PathCommand`, with the same rule about a\r\n * missing handle standing in as its own anchor written out both times.\r\n */\r\nfunction segmentBetween(from: PathAnchor, to: PathAnchor):\r\n | { line: true; to: Vector2 }\r\n | { line: false; c1: Vector2; c2: Vector2; to: Vector2 } {\r\n if (from.outHandle === null && to.inHandle === null) {\r\n return { line: true, to: to.point };\r\n }\r\n // A missing handle stands in as its own anchor, which is the degenerate cubic\r\n // that draws as a straight pull towards the other end — the same thing every\r\n // vector editor means by \"one side of this segment is a curve\".\r\n return {\r\n line: false,\r\n c1: from.outHandle ?? from.point,\r\n c2: to.inHandle ?? to.point,\r\n to: to.point,\r\n };\r\n}\r\n\r\n/**\r\n * Serializes the model back to a `d` string.\r\n *\r\n * Only `M`, `L`, `C` and `Z` are emitted — the four commands the editor can\r\n * round-trip — so what is stored is always what can be edited.\r\n */\r\nexport function fromAnchors(path: VectorPath): string {\r\n const parts: string[] = [];\r\n for (const { anchors, closed } of path) {\r\n if (anchors.length === 0) continue;\r\n parts.push(`M ${fmt(anchors[0].point.x)} ${fmt(anchors[0].point.y)}`);\r\n for (let i = 1; i < anchors.length; i++) {\r\n const segment = segmentBetween(anchors[i - 1], anchors[i]);\r\n parts.push(segment.line\r\n ? `L ${fmt(segment.to.x)} ${fmt(segment.to.y)}`\r\n : `C ${fmt(segment.c1.x)} ${fmt(segment.c1.y)} ${fmt(segment.c2.x)} ${fmt(segment.c2.y)} ${fmt(segment.to.x)} ${fmt(segment.to.y)}`);\r\n }\r\n if (closed) {\r\n if (anchors.length > 1) {\r\n const join = segmentBetween(anchors[anchors.length - 1], anchors[0]);\r\n // A straight closing segment is what `Z` already draws, so emitting\r\n // it as well would add the duplicate anchor `closeSubpath` undoes.\r\n if (!join.line) {\r\n parts.push(`C ${fmt(join.c1.x)} ${fmt(join.c1.y)} ${fmt(join.c2.x)} ${fmt(join.c2.y)} ${fmt(join.to.x)} ${fmt(join.to.y)}`);\r\n }\r\n }\r\n parts.push(\"Z\");\r\n }\r\n }\r\n return parts.join(\" \");\r\n}\r\n\r\nconst identity = (point: Vector2): Vector2 => point;\r\n\r\n/**\r\n * The model as drawable commands, with a transform folded into the same pass.\r\n *\r\n * Every caller needs one — unit box → the node's laid-out pixels, and y-down →\r\n * the renderer's y-up — and doing it here means one allocation per frame instead\r\n * of two, on a list rebuilt every time the node repaints.\r\n */\r\nexport function anchorCommands(\r\n path: VectorPath,\r\n transform: (point: Vector2) => Vector2 = identity,\r\n): PathCommand[] {\r\n const out: PathCommand[] = [];\r\n const emit = (from: PathAnchor, to: PathAnchor) => {\r\n const segment = segmentBetween(from, to);\r\n const end = transform(segment.to);\r\n if (segment.line) {\r\n out.push({ type: \"L\", x: end.x, y: end.y });\r\n return;\r\n }\r\n const c1 = transform(segment.c1);\r\n const c2 = transform(segment.c2);\r\n out.push({ type: \"C\", x1: c1.x, y1: c1.y, x2: c2.x, y2: c2.y, x: end.x, y: end.y });\r\n };\r\n\r\n for (const { anchors, closed } of path) {\r\n if (anchors.length === 0) continue;\r\n const start = transform(anchors[0].point);\r\n out.push({ type: \"M\", x: start.x, y: start.y });\r\n for (let i = 1; i < anchors.length; i++) emit(anchors[i - 1], anchors[i]);\r\n if (closed) {\r\n if (anchors.length > 1) {\r\n const from = anchors[anchors.length - 1];\r\n const to = anchors[0];\r\n if (from.outHandle !== null || to.inHandle !== null) emit(from, to);\r\n }\r\n out.push({ type: \"Z\" });\r\n }\r\n }\r\n return out;\r\n}\r\n\r\n// ── Measuring ──────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * The path's tight bounding box, or `null` when it has no points.\r\n *\r\n * Tight, not the handle polygon's hull: a cubic's own extrema are solved for,\r\n * because the handles can sit a long way outside the curve and a box derived\r\n * from them would leave a visible gap between a normalized shape and the edge of\r\n * its node.\r\n */\r\nexport function anchorBounds(path: VectorPath): Extents | null {\r\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\r\n let seen = false;\r\n\r\n const includeX = (x: number) => { seen = true; if (x < minX) minX = x; if (x > maxX) maxX = x; };\r\n const includeY = (y: number) => { seen = true; if (y < minY) minY = y; if (y > maxY) maxY = y; };\r\n\r\n for (const { anchors, closed } of path) {\r\n for (const anchor of anchors) {\r\n includeX(anchor.point.x);\r\n includeY(anchor.point.y);\r\n }\r\n // The closing join exists only with a second anchor to join: the writers\r\n // emit none for a lone one (`M x y Z` draws nothing), so its self-loop\r\n // must not widen the box either.\r\n const last = closed && anchors.length > 1 ? anchors.length : anchors.length - 1;\r\n for (let i = 0; i < last; i++) {\r\n const from = anchors[i];\r\n const to = anchors[(i + 1) % anchors.length];\r\n if (from.outHandle === null && to.inHandle === null) continue;\r\n const c1 = from.outHandle ?? from.point;\r\n const c2 = to.inHandle ?? to.point;\r\n for (const t of cubicExtrema(from.point.x, c1.x, c2.x, to.point.x)) {\r\n includeX(cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x));\r\n }\r\n for (const t of cubicExtrema(from.point.y, c1.y, c2.y, to.point.y)) {\r\n includeY(cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y));\r\n }\r\n }\r\n }\r\n\r\n return seen ? { minX, minY, maxX, maxY } : null;\r\n}\r\n\r\n// ── Transforming ───────────────────────────────────────────────────────────\r\n\r\n/** Applies `fn` to every point and handle, returning a new path. */\r\nexport function map(path: VectorPath, fn: (point: Vector2) => Vector2): VectorPath {\r\n return path.map((subpath) => ({\r\n closed: subpath.closed,\r\n anchors: subpath.anchors.map((anchor) => ({\r\n point: fn(anchor.point),\r\n inHandle: anchor.inHandle ? fn(anchor.inHandle) : null,\r\n outHandle: anchor.outHandle ? fn(anchor.outHandle) : null,\r\n })),\r\n }));\r\n}\r\n\r\n/**\r\n * The turn-and-scale about `start` that carries `end` onto `to` — how `moveTo`\r\n * fits a path aimed at another node. Where `start` and `end` coincide there is\r\n * no chord to turn, so it translates instead.\r\n */\r\nexport function endFit(start: Vector2, end: Vector2, to: Vector2): (point: Vector2) => Vector2 {\r\n const cx = end.x - start.x;\r\n const cy = end.y - start.y;\r\n const chord = cx * cx + cy * cy;\r\n if (chord < 1e-12) {\r\n const dx = to.x - end.x;\r\n const dy = to.y - end.y;\r\n return (p) => ({ x: p.x + dx, y: p.y + dy });\r\n }\r\n // (to - start) / (end - start) as complex numbers: a rotation and a uniform scale.\r\n const tx = to.x - start.x;\r\n const ty = to.y - start.y;\r\n const re = (tx * cx + ty * cy) / chord;\r\n const im = (ty * cx - tx * cy) / chord;\r\n return (p) => {\r\n const ux = p.x - start.x;\r\n const uy = p.y - start.y;\r\n return { x: start.x + re * ux - im * uy, y: start.y + im * ux + re * uy };\r\n };\r\n}\r\n\r\n/** Whether a path would draw anything at all. */\r\nexport function isEmpty(path: VectorPath): boolean {\r\n return path.every((subpath) => subpath.anchors.length < 2);\r\n}\r\n\r\n/**\r\n * The unit box's extent — the node's own layout rect, as a fraction of itself.\r\n *\r\n * Exported because two very different callers need the same half: a renderer\r\n * scales by the extent (1 unit = the node's full width), and an editor projects\r\n * a screen point into it.\r\n */\r\nexport const PATH_UNIT_EXTENT = 1;\r\n\r\n/** Half of {@link PATH_UNIT_EXTENT} — the distance from the centre to an edge. */\r\nexport const PATH_UNIT_HALF = PATH_UNIT_EXTENT / 2;\r\n\r\n/**\r\n * The box a path's coordinates are already quoted against — the node's own\r\n * frame, as {@link PATH_UNIT_HALF} either side of centre.\r\n */\r\nexport const UNIT_PATH_BOX: Extents = {\r\n minX: -PATH_UNIT_HALF,\r\n minY: -PATH_UNIT_HALF,\r\n maxX: PATH_UNIT_HALF,\r\n maxY: PATH_UNIT_HALF,\r\n};\r\n\r\n/**\r\n * Pulls the unit box back around the geometry.\r\n *\r\n * What an editor runs on the way *out* of a path edit, and the reason a node\r\n * whose points were dragged all over the canvas still ends up with a selection\r\n * box that hugs it. The caller pairs it with the node's own size and position:\r\n * the box grows by `scaleX`/`scaleY` and moves by `centerX`/`centerY` scaled\r\n * into the node's parent, so the drawing doesn't shift on screen while its frame\r\n * changes underneath it.\r\n */\r\nexport function normalize(path: VectorPath): PathNormalization {\r\n const bounds = anchorBounds(path);\r\n if (!bounds) return { path, scaleX: 1, scaleY: 1, centerX: 0, centerY: 0 };\r\n return fitToBox(path, bounds);\r\n}\r\n\r\n/**\r\n * Re-quotes a path against `box` — the general form of\r\n * {@link normalize}, which is this with the geometry's own bounds.\r\n *\r\n * The two callers want the same arithmetic for opposite reasons. A canvas editor\r\n * fits the box to the drawing on the way out, so a node drawn in a corner of its\r\n * frame ends up with a frame that hugs it. An appearance dialog lets the frame\r\n * be **stated** instead — dragged wider than the drawing to leave a margin, or\r\n * slid so the drawing sits off-centre — and then fits to that.\r\n *\r\n * A degenerate axis — every point on one line, which is a perfectly reasonable\r\n * thing to draw — keeps its scale at 1 rather than dividing by zero, so a flat\r\n * path stays where it is instead of becoming NaN.\r\n */\r\nexport function fitToBox(path: VectorPath, box: Extents): PathNormalization {\r\n const width = box.maxX - box.minX;\r\n const height = box.maxY - box.minY;\r\n const centerX = (box.minX + box.maxX) / 2;\r\n const centerY = (box.minY + box.maxY) / 2;\r\n const scaleX = width > 1e-9 ? width / PATH_UNIT_EXTENT : 1;\r\n const scaleY = height > 1e-9 ? height / PATH_UNIT_EXTENT : 1;\r\n\r\n return {\r\n path: map(path, (p) => ({\r\n x: (p.x - centerX) / scaleX,\r\n y: (p.y - centerY) / scaleY,\r\n })),\r\n scaleX,\r\n scaleY,\r\n centerX,\r\n centerY,\r\n };\r\n}\r\n\r\n/** Moves every point and handle by the same delta. */\r\nexport function translate(path: VectorPath, delta: Vector2): VectorPath {\r\n return map(path, (p) => ({ x: p.x + delta.x, y: p.y + delta.y }));\r\n}\r\n\r\n/**\r\n * A point on the segment between two anchors, at parameter `t`.\r\n *\r\n * An editor needs it twice over: to find where on a segment a click landed (so a\r\n * double-click can insert an anchor there), and to draw the preview of the\r\n * anchor that insertion would create.\r\n */\r\nexport function pointOn(from: PathAnchor, to: PathAnchor, t: number): Vector2 {\r\n if (from.outHandle === null && to.inHandle === null) {\r\n return {\r\n x: from.point.x + (to.point.x - from.point.x) * t,\r\n y: from.point.y + (to.point.y - from.point.y) * t,\r\n };\r\n }\r\n const c1 = from.outHandle ?? from.point;\r\n const c2 = to.inHandle ?? to.point;\r\n return {\r\n x: cubicAxis(t, from.point.x, c1.x, c2.x, to.point.x),\r\n y: cubicAxis(t, from.point.y, c1.y, c2.y, to.point.y),\r\n };\r\n}\r\n\r\n/**\r\n * Splits the segment between two anchors at `t`, returning the three anchors\r\n * that replace them — the two ends with their outer handles shortened, and the\r\n * new anchor in the middle carrying both halves of the split tangent.\r\n *\r\n * De Casteljau, which is what makes the insertion *invisible*: the curve through\r\n * the new point is the same curve, so double-clicking a segment adds somewhere\r\n * to grab rather than changing the shape under the pointer.\r\n */\r\nexport function split(\r\n from: PathAnchor, to: PathAnchor, t: number,\r\n): { from: PathAnchor; middle: PathAnchor; to: PathAnchor } {\r\n if (from.outHandle === null && to.inHandle === null) {\r\n return {\r\n from,\r\n middle: { point: pointOn(from, to, t), inHandle: null, outHandle: null },\r\n to,\r\n };\r\n }\r\n\r\n const { left, right } = splitCubicAt(\r\n from.point,\r\n from.outHandle ?? from.point,\r\n to.inHandle ?? to.point,\r\n to.point,\r\n t,\r\n );\r\n return {\r\n from: { ...from, outHandle: left.cp1 },\r\n middle: { point: left.to, inHandle: left.cp2, outHandle: right.cp1 },\r\n to: { ...to, inHandle: right.cp2 },\r\n };\r\n}\r\n"]}
|