@motionscript/core 0.1.0-alpha.0 → 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 +282 -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 +93 -11
- 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 +32 -4
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js +9 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +11 -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.d.ts +1 -0
- package/dist/attributes/index.d.ts.map +1 -1
- package/dist/attributes/index.js +1 -0
- 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 +17 -6
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js +26 -14
- 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.d.ts +9 -1
- package/dist/attributes/shape/fill/lerp.d.ts.map +1 -1
- package/dist/attributes/shape/fill/lerp.js +12 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/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 +3 -3
- 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.d.ts.map +1 -1
- package/dist/document/command-traits.js +17 -3
- 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 +34 -16
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +51 -12
- 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 +188 -32
- 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.d.ts +3 -2
- package/dist/nodes/audio/node-audio.d.ts.map +1 -1
- package/dist/nodes/audio/node-audio.js +8 -5
- 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 +2 -2
- 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 +5 -3
- 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 +10 -3
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js +10 -0
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.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 +5 -5
- 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.d.ts +2 -2
- package/dist/render3d/resources.js +2 -2
- 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.d.ts +2 -2
- package/dist/runtime/audio-index.d.ts.map +1 -1
- package/dist/runtime/audio-index.js +8 -2
- 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 +33 -3
- 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 +27 -22
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +23 -9
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +12 -4
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js +10 -22
- 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 +12 -1
- package/dist/tween/seekable.d.ts.map +1 -1
- package/dist/tween/seekable.js +15 -0
- 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-P3XQCHDW.js +0 -16
- package/dist/browser/chunks/chunk-P3XQCHDW.js.map +0 -7
- package/dist/browser/chunks/chunk-VJQMKHGQ.js +0 -3
- package/dist/browser/chunks/chunk-VJQMKHGQ.js.map +0 -7
- package/dist/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
package/dist/props/slot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../src/props/slot.ts"],"names":[],"mappings":"AAcA;;;GA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C;IAED,IAAI,CAAC,EAAW;QACZ,IAAI,SAAS,KAAK,IAAI;YAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,GAAG,GAAG,EAAE,CAAC;IAClB,CAAC;IAED,yDAAyD;IACzD,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,GAAG;YAAE,OAAO;QACtB,IAAI,SAAS,KAAK,IAAI;YAAE,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,OAAO;QACH,OAAO,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC;IAC7B,CAAC;IAED,QAAQ;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IACnF,CAAC;IAED,WAAW,CAAC,IAAqB;QAC7B,IAAI,IAAI,CAAC,EAAE;YAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;;YAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,mFAAmF;IACnF,OAAO;QACH,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,SAAyB,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import type { SlotObserver } from \"./observer\";\n\n/**\n * A captured state of a {@link PropSlot}: the thunk it was bound to, or the\n * plain value it held. Produced by {@link PropSlot.snapshot} and consumed by\n * {@link PropSlot.restoreFrom}.\n */\n/** @internal */\nexport interface PropSnapshot<T> {\n value: T;\n /** Present only for a bound slot; restoring one re-binds rather than freezing it. */\n fn?: () => T;\n}\n\n/**\n * @internal The observer every slot reports to, or `null` — which is every frame of\n * playback, so the hot path pays one null check. Installed by `observeSlots`.\n */\nexport let _observer: SlotObserver | null = null;\n\n/** @internal Only this module can reassign the binding. Returns the observer it replaced. */\nexport function _setObserver(observer: SlotObserver | null): SlotObserver | null {\n const previous = _observer;\n _observer = observer;\n return previous;\n}\n\n/**\n * The storage behind one `@property`: a plain value, or a thunk evaluated on\n * every read.\n *\n * There is no dependency graph and nothing to invalidate. A bound slot\n * recomputes when it is asked, which is what makes a document expression\n * (`\"=4[g]+3\"`), an author's `width={() => …}` and an alignment binding reading\n * a box written mid-layout all correct without anything declaring an edge. The\n * cache-and-invalidate version of this could only get the last one right by\n * observing the write, and paid for it everywhere: a `peek()`/`get()` split at\n * every write path, so a read taken inside whatever computation happened to be\n * running did not register an edge with no business existing.\n *\n * The bet is that recomputing is cheaper than tracking. Bindings here are\n * arithmetic over a handful of reads, and a frame's draw dwarfs all of them.\n */\nexport class PropSlot<T> {\n private _value: T;\n private _fn: (() => T) | null = null;\n private _running = false;\n\n /** `_host` and `_name` only label the slot for an observer — see `slotLabel`. */\n constructor(\n initial: T,\n readonly _host: { readonly id: string } | null = null,\n readonly _name: string = \"\",\n ) {\n this._value = initial;\n }\n\n get(): T {\n // Before the re-entrancy check, so a binding's own reads are recorded\n // under whatever read it.\n if (_observer !== null) _observer.read(this);\n // A binding that reads its own slot re-enters here mid-evaluation —\n // `bind(() => mapper(ext(), slot.get()))` is how a mapper is handed the\n // previous value. It gets the last settled one instead of recursing.\n if (!this._fn || this._running) return this._value;\n this._running = true;\n try {\n return (this._value = this._fn());\n } finally {\n this._running = false;\n }\n }\n\n set(value: T): void {\n if (_observer !== null) _observer.write(this);\n this._fn = null;\n this._value = value;\n }\n\n bind(fn: () => T): void {\n if (_observer !== null) _observer.write(this);\n this._fn = fn;\n }\n\n /** Freeze a bound slot at what it currently computes. */\n unbind(): void {\n if (!this._fn) return;\n if (_observer !== null) _observer.write(this);\n this._value = this.get();\n this._fn = null;\n }\n\n isBound(): boolean {\n return this._fn !== null;\n }\n\n snapshot(): PropSnapshot<T> {\n return this._fn ? { value: this.get(), fn: this._fn } : { value: this._value };\n }\n\n restoreFrom(snap: PropSnapshot<T>): void {\n if (snap.fn) this.bind(snap.fn);\n else this.set(snap.value);\n }\n\n /** Releases the bound closure and the value slot. The slot is inert after this. */\n dispose(): void {\n this._fn = null;\n this._value = undefined as unknown as T;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"slot.js","sourceRoot":"","sources":["../../src/props/slot.ts"],"names":[],"mappings":"AAcA;;;GAGG;AACH,MAAM,CAAC,IAAI,SAAS,GAAwB,IAAI,CAAC;AAEjD,6FAA6F;AAC7F,MAAM,UAAU,YAAY,CAAC,QAA6B;IACtD,MAAM,QAAQ,GAAG,SAAS,CAAC;IAC3B,SAAS,GAAG,QAAQ,CAAC;IACrB,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,QAAQ;IAQJ;IACA;IARL,MAAM,CAAI;IACV,GAAG,GAAqB,IAAI,CAAC;IAC7B,QAAQ,GAAG,KAAK,CAAC;IAEzB,iFAAiF;IACjF,YACI,OAAU,EACD,QAAwC,IAAI,EAC5C,QAAgB,EAAE;QADlB,UAAK,GAAL,KAAK,CAAuC;QAC5C,UAAK,GAAL,KAAK,CAAa;QAE3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,GAAG;QACC,sEAAsE;QACtE,0BAA0B;QAC1B,IAAI,SAAS,KAAK,IAAI;YAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,oEAAoE;QACpE,wEAAwE;QACxE,qEAAqE;QACrE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC;QACnD,IAAI,CAAC,QAA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CAAC;;YAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,mFAAmF;IACnF,OAAO;QACH,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,GAAG,SAAyB,CAAC;IAC5C,CAAC;CACJ","sourcesContent":["import type { SlotObserver } from \"./observer\";\r\n\r\n/**\r\n * A captured state of a {@link PropSlot}: the thunk it was bound to, or the\r\n * plain value it held. Produced by {@link PropSlot.snapshot} and consumed by\r\n * {@link PropSlot.restoreFrom}.\r\n */\r\n/** @internal */\r\nexport interface PropSnapshot<T> {\r\n value: T;\r\n /** Present only for a bound slot; restoring one re-binds rather than freezing it. */\r\n fn?: () => T;\r\n}\r\n\r\n/**\r\n * @internal The observer every slot reports to, or `null` — which is every frame of\r\n * playback, so the hot path pays one null check. Installed by `observeSlots`.\r\n */\r\nexport let _observer: SlotObserver | null = null;\r\n\r\n/** @internal Only this module can reassign the binding. Returns the observer it replaced. */\r\nexport function _setObserver(observer: SlotObserver | null): SlotObserver | null {\r\n const previous = _observer;\r\n _observer = observer;\r\n return previous;\r\n}\r\n\r\n/**\r\n * The storage behind one `@property`: a plain value, or a thunk evaluated on\r\n * every read.\r\n *\r\n * There is no dependency graph and nothing to invalidate. A bound slot\r\n * recomputes when it is asked, which is what makes a document expression\r\n * (`\"=4[g]+3\"`), an author's `width={() => …}` and an alignment binding reading\r\n * a box written mid-layout all correct without anything declaring an edge. The\r\n * cache-and-invalidate version of this could only get the last one right by\r\n * observing the write, and paid for it everywhere: a `peek()`/`get()` split at\r\n * every write path, so a read taken inside whatever computation happened to be\r\n * running did not register an edge with no business existing.\r\n *\r\n * The bet is that recomputing is cheaper than tracking. Bindings here are\r\n * arithmetic over a handful of reads, and a frame's draw dwarfs all of them.\r\n */\r\nexport class PropSlot<T> {\r\n private _value: T;\r\n private _fn: (() => T) | null = null;\r\n private _running = false;\r\n\r\n /** `_host` and `_name` only label the slot for an observer — see `slotLabel`. */\r\n constructor(\r\n initial: T,\r\n readonly _host: { readonly id: string } | null = null,\r\n readonly _name: string = \"\",\r\n ) {\r\n this._value = initial;\r\n }\r\n\r\n get(): T {\r\n // Before the re-entrancy check, so a binding's own reads are recorded\r\n // under whatever read it.\r\n if (_observer !== null) _observer.read(this);\r\n // A binding that reads its own slot re-enters here mid-evaluation —\r\n // `bind(() => mapper(ext(), slot.get()))` is how a mapper is handed the\r\n // previous value. It gets the last settled one instead of recursing.\r\n if (!this._fn || this._running) return this._value;\r\n this._running = true;\r\n try {\r\n return (this._value = this._fn());\r\n } finally {\r\n this._running = false;\r\n }\r\n }\r\n\r\n set(value: T): void {\r\n if (_observer !== null) _observer.write(this);\r\n this._fn = null;\r\n this._value = value;\r\n }\r\n\r\n bind(fn: () => T): void {\r\n if (_observer !== null) _observer.write(this);\r\n this._fn = fn;\r\n }\r\n\r\n /** Freeze a bound slot at what it currently computes. */\r\n unbind(): void {\r\n if (!this._fn) return;\r\n if (_observer !== null) _observer.write(this);\r\n this._value = this.get();\r\n this._fn = null;\r\n }\r\n\r\n isBound(): boolean {\r\n return this._fn !== null;\r\n }\r\n\r\n snapshot(): PropSnapshot<T> {\r\n return this._fn ? { value: this.get(), fn: this._fn } : { value: this._value };\r\n }\r\n\r\n restoreFrom(snap: PropSnapshot<T>): void {\r\n if (snap.fn) this.bind(snap.fn);\r\n else this.set(snap.value);\r\n }\r\n\r\n /** Releases the bound closure and the value slot. The slot is inert after this. */\r\n dispose(): void {\r\n this._fn = null;\r\n this._value = undefined as unknown as T;\r\n }\r\n}\r\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { integrateSpeedToClipTime, sourceTimeAtClipElapsed } from './attributes/audio/filters/curve.js';
|
|
2
|
+
import type { NodeEffect } from './attributes/shape/effects/union.js';
|
|
3
|
+
import { ClipTimeline } from './document/timeline.js';
|
|
4
|
+
import type { VisualDocument } from './document/types.js';
|
|
5
|
+
/** @deprecated Renamed to {@link VisualDocument}. */
|
|
6
|
+
export type SceneDocument = VisualDocument;
|
|
7
|
+
/** @deprecated Renamed to {@link ClipTimeline}. */
|
|
8
|
+
export declare const SceneTimeline: typeof ClipTimeline;
|
|
9
|
+
/** @deprecated Renamed to {@link ClipTimeline}. */
|
|
10
|
+
export type SceneTimeline = ClipTimeline;
|
|
11
|
+
/** @deprecated Renamed to {@link NodeEffect}. */
|
|
12
|
+
export type SceneEffect = NodeEffect;
|
|
13
|
+
/** @deprecated Renamed to {@link integrateSpeedToClipTime}. */
|
|
14
|
+
export declare const integrateSpeedToSceneTime: typeof integrateSpeedToClipTime;
|
|
15
|
+
/** @deprecated Renamed to {@link sourceTimeAtClipElapsed}. */
|
|
16
|
+
export declare const sourceTimeAtSceneElapsed: typeof sourceTimeAtClipElapsed;
|
|
17
|
+
//# sourceMappingURL=renamed-scene-names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renamed-scene-names.d.ts","sourceRoot":"","sources":["../src/renamed-scene-names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AACrG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIvD,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC;AAC3C,mDAAmD;AACnD,eAAO,MAAM,aAAa,qBAAe,CAAC;AAC1C,mDAAmD;AACnD,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC;AACzC,iDAAiD;AACjD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC;AACrC,+DAA+D;AAC/D,eAAO,MAAM,yBAAyB,iCAA2B,CAAC;AAClE,8DAA8D;AAC9D,eAAO,MAAM,wBAAwB,gCAA0B,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { integrateSpeedToClipTime, sourceTimeAtClipElapsed } from './attributes/audio/filters/curve.js';
|
|
2
|
+
import { ClipTimeline } from './document/timeline.js';
|
|
3
|
+
/** @deprecated Renamed to {@link ClipTimeline}. */
|
|
4
|
+
export const SceneTimeline = ClipTimeline;
|
|
5
|
+
/** @deprecated Renamed to {@link integrateSpeedToClipTime}. */
|
|
6
|
+
export const integrateSpeedToSceneTime = integrateSpeedToClipTime;
|
|
7
|
+
/** @deprecated Renamed to {@link sourceTimeAtClipElapsed}. */
|
|
8
|
+
export const sourceTimeAtSceneElapsed = sourceTimeAtClipElapsed;
|
|
9
|
+
//# sourceMappingURL=renamed-scene-names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renamed-scene-names.js","sourceRoot":"","sources":["../src/renamed-scene-names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAErG,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAOnD,mDAAmD;AACnD,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAK1C,+DAA+D;AAC/D,MAAM,CAAC,MAAM,yBAAyB,GAAG,wBAAwB,CAAC;AAClE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,uBAAuB,CAAC","sourcesContent":["import { integrateSpeedToClipTime, sourceTimeAtClipElapsed } from './attributes/audio/filters/curve';\r\nimport type { NodeEffect } from './attributes/shape/effects/union';\r\nimport { ClipTimeline } from './document/timeline';\r\nimport type { VisualDocument } from './document/types';\r\n\r\n// The names the document API had before \"scene\" became \"clip\", kept until 1.0.\r\n\r\n/** @deprecated Renamed to {@link VisualDocument}. */\r\nexport type SceneDocument = VisualDocument;\r\n/** @deprecated Renamed to {@link ClipTimeline}. */\r\nexport const SceneTimeline = ClipTimeline;\r\n/** @deprecated Renamed to {@link ClipTimeline}. */\r\nexport type SceneTimeline = ClipTimeline;\r\n/** @deprecated Renamed to {@link NodeEffect}. */\r\nexport type SceneEffect = NodeEffect;\r\n/** @deprecated Renamed to {@link integrateSpeedToClipTime}. */\r\nexport const integrateSpeedToSceneTime = integrateSpeedToClipTime;\r\n/** @deprecated Renamed to {@link sourceTimeAtClipElapsed}. */\r\nexport const sourceTimeAtSceneElapsed = sourceTimeAtClipElapsed;\r\n"]}
|
|
@@ -9,7 +9,7 @@ import type { BooleanOperation } from "../attributes/mask/boolean.js";
|
|
|
9
9
|
import { TextState } from "./descriptors/text.js";
|
|
10
10
|
import { TextBlockLayout } from "./text-layout.js";
|
|
11
11
|
import type { NodeRenderState, RasterizedSurface, RenderContext2D, RenderPass2D, SpaceRects, EffectTarget } from "./render-context2d.js";
|
|
12
|
-
import type {
|
|
12
|
+
import type { NodeEffect } from "../attributes/shape/effects/union.js";
|
|
13
13
|
/**
|
|
14
14
|
* The base every {@link RenderContext2D} backend extends.
|
|
15
15
|
*
|
|
@@ -73,7 +73,8 @@ export declare abstract class CanvasRenderContext2D implements RenderPass2D {
|
|
|
73
73
|
dispose(): void;
|
|
74
74
|
/**
|
|
75
75
|
* Execute `callback`, which issues shape/paint calls, and flush the result
|
|
76
|
-
* to the underlying render target (canvas, SVG document, etc.).
|
|
76
|
+
* to the underlying render target (canvas, SVG document, etc.). A callback
|
|
77
|
+
* that throws still throws, and the next pass starts from a clean context.
|
|
77
78
|
*/
|
|
78
79
|
abstract execute(callback: () => void): void;
|
|
79
80
|
/** Capture the current frame as a base-64 PNG data URL, or `undefined` if unsupported. */
|
|
@@ -87,7 +88,7 @@ export declare abstract class CanvasRenderContext2D implements RenderPass2D {
|
|
|
87
88
|
abstract beginClip(clip: Clip): void;
|
|
88
89
|
abstract endClip(): void;
|
|
89
90
|
/** See {@link RenderContext2D.beginEffects}. No-op by default. */
|
|
90
|
-
beginEffects(effects:
|
|
91
|
+
beginEffects(effects: NodeEffect[], target: EffectTarget, width: number, height: number): void;
|
|
91
92
|
endEffects(): void;
|
|
92
93
|
/** See {@link RenderContext2D.rasterize}. Returns `null` by default. */
|
|
93
94
|
rasterize(width: number, height: number, draw: () => void, pixelRatio?: number): RasterizedSurface | null;
|
|
@@ -117,5 +118,11 @@ export declare abstract class CanvasRenderContext2D implements RenderPass2D {
|
|
|
117
118
|
protected currentSpaceRects(): SpaceRects;
|
|
118
119
|
/** Full render state (incl. velocity) for the node currently being drawn, if any. */
|
|
119
120
|
protected currentRenderState(): NodeRenderState | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Close every node and text-style scope still open. A backend calls this
|
|
123
|
+
* when a pass ends, so a pass that threw cannot leave the next one inside
|
|
124
|
+
* its scopes.
|
|
125
|
+
*/
|
|
126
|
+
protected _resetScopes(): void;
|
|
120
127
|
}
|
|
121
128
|
//# sourceMappingURL=canvas-render-context2d.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-render-context2d.d.ts","sourceRoot":"","sources":["../../src/render/canvas-render-context2d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO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{
|
|
|
116
116
|
currentRenderState() {
|
|
117
117
|
return this.renderStateStack[this.renderStateStack.length - 1];
|
|
118
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* Close every node and text-style scope still open. A backend calls this
|
|
121
|
+
* when a pass ends, so a pass that threw cannot leave the next one inside
|
|
122
|
+
* its scopes.
|
|
123
|
+
*/
|
|
124
|
+
_resetScopes() {
|
|
125
|
+
this.textStyleStack.length = 0;
|
|
126
|
+
this.currentNodeStack.length = 0;
|
|
127
|
+
this.renderStateStack.length = 0;
|
|
128
|
+
}
|
|
119
129
|
}
|
|
120
130
|
//# sourceMappingURL=canvas-render-context2d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-render-context2d.js","sourceRoot":"","sources":["../../src/render/canvas-render-context2d.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAI5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAgB,qBAAqB;IAGvC,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,qEAAqE;IACrE,0EAA0E;IAE1E;;;;OAIG;IACc,cAAc,GAAgB,EAAE,CAAC;IAElD,iDAAiD;IACjD,aAAa,CAAC,KAAuB;QACjC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC;IACnH,CAAC;IAED,iEAAiE;IACjE,YAAY;QACR,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC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AC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,+DAA+D;IAC/D,GAAG;QACC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,8EAA8E;IACpE,iBAAiB;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;IAChF,CAAC;IAED,qFAAqF;IAC3E,kBAAkB;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;CACJ","sourcesContent":["import { Graphics2D } from \"./graphics2d\";\nimport type { Clip } from \"./clip\";\nimport type { TransformState } from \"./descriptors/transform\";\nimport type { FontStyle, TextStyle } from \"@/attributes/text/types\";\nimport type { Size2D } from \"@/attributes/layout/size\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\nimport { TextState } from \"./descriptors/text\";\nimport { TextBlockLayout } from \"./text-layout\";\nimport { EMPTY_TEXT_STYLE, textOps } from \"@/attributes/text/ops\";\nimport { applyGraphicsTextDefaults } from \"./text-defaults\";\nimport type { NodeRenderState, RasterizedSurface, RenderContext2D, RenderPass2D, SpaceRects, EffectTarget } from \"./render-context2d\";\nimport type { SceneEffect } from \"@/attributes/shape/effects/union\";\n\n/**\n * The base every {@link RenderContext2D} backend extends.\n *\n * It owns the parts of a render context that are the *same* whatever is being\n * rasterized — the text-default stack, the node scope stack, disposal — plus\n * the host-facing half of the surface (`execute`, `screenshot`, `unmount`),\n * which the {@link RenderContext2D} interface deliberately leaves out because a\n * node has no business driving a render pass from inside one.\n *\n * **`draw` is final by convention.** It resolves the ambient text defaults onto\n * the op list and hands the result to {@link drawGraphics}, which is where a\n * backend does its actual drawing. Owning that step here rather than in each\n * backend is what keeps the real renderer and the precomp asset walk agreeing\n * on which font an under-specified `text` op shapes with: a family that one\n * resolves and the other does not is a font that never loads and glyphs that\n * never paint.\n */\nexport abstract class CanvasRenderContext2D implements RenderPass2D {\n abstract measureText(text: string, fontSize: number, fontFamily: string, fontWeight?: number, letterSpacing?: number, fontStyle?: FontStyle): Size2D;\n\n // ---- Inherited text-style defaults ------------------------------------\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\n // bind, so it inherits the same defaults here instead — pushed around a\n // subtree's draw scope, and folded into each `text`/`richText` op by\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\n\n /**\n * Defaults in effect for the current draw scope, innermost last. Each entry\n * is **already merged** onto the one below it (see {@link pushTextStyle}), so\n * the top of the stack is the effective style and reading it costs nothing.\n */\n private readonly textStyleStack: TextStyle[] = [];\n\n /** See {@link RenderContext2D.pushTextStyle}. */\n pushTextStyle(style: TextStyle | null): void {\n this.textStyleStack.push(style === null ? EMPTY_TEXT_STYLE : textOps.mergeStyle(this.defaultTextStyle, style));\n }\n\n /** Close the innermost scope opened by {@link pushTextStyle}. */\n popTextStyle(): void {\n this.textStyleStack.pop();\n }\n\n /**\n * The text-style defaults in effect right now — the innermost\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\n * when no scope is open.\n *\n * Carries all ten {@link TEXT_STYLE_KEYS}, but only the shaping ones reach a\n * `Graphics2D` op; see `TEXT_SHAPING_KEYS` for why `fill`/`stroke`/`shadow`\n * stay a node-level concern.\n */\n get defaultTextStyle(): TextStyle {\n return this.textStyleStack[this.textStyleStack.length - 1] ?? textOps.preset(\"default\");\n }\n\n /** See {@link RenderContext2D.draw}. Final by convention — override {@link drawGraphics}. */\n draw(graphics: Graphics2D): void {\n this.drawGraphics(applyGraphicsTextDefaults(graphics, this.defaultTextStyle));\n }\n\n /** Paint a `Graphics2D` whose text ops have already been resolved against the\n * ambient defaults. Backends implement this instead of {@link draw}. */\n protected abstract drawGraphics(graphics: Graphics2D): void;\n\n /**\n * See {@link RenderContext2D.layoutTextBlock}. Concrete rather than abstract,\n * and `null` by default, so a backend that has no need to report glyph\n * positions is unaffected — the only thing it gives up is on-canvas text\n * editing in a host built on it.\n */\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null {\n return null;\n }\n\n /** Stack of node ids currently being drawn, innermost last. */\n protected currentNodeStack: string[] = [];\n\n /** Returns the id of the innermost node currently being drawn. */\n protected currentNodeId(): string {\n if (this.currentNodeStack.length === 0) {\n throw new Error(\"No current node in context\");\n }\n\n return this.currentNodeStack[this.currentNodeStack.length - 1];\n }\n\n /** Remove all renderer-side resources for the current node (called on unmount). */\n abstract unmount(): void;\n\n private _disposed = false;\n /** `true` after `dispose()` — the context must not be used after this point. */\n isDisposed(): boolean {\n return this._disposed;\n }\n dispose(): void {\n this._disposed = true;\n }\n\n /**\n * Execute `callback`, which issues shape/paint calls, and flush the result\n * to the underlying render target (canvas, SVG document, etc.).\n */\n abstract execute(callback: () => void): void;\n /** Capture the current frame as a base-64 PNG data URL, or `undefined` if unsupported. */\n abstract screenshot(): string | undefined;\n\n abstract transform(state: Partial<TransformState>): RenderContext2D;\n\n abstract beginBoolean(op: BooleanOperation): void;\n abstract endBoolean(): void;\n\n abstract beginMask(options?: MaskOptions): void;\n abstract applyMask(): void;\n abstract endMask(): void;\n\n abstract beginClip(clip: Clip): void;\n abstract endClip(): void;\n\n /** See {@link RenderContext2D.beginEffects}. No-op by default. */\n beginEffects(effects: SceneEffect[], target: EffectTarget, width: number, height: number): void { }\n endEffects(): void { }\n\n /** See {@link RenderContext2D.rasterize}. Returns `null` by default. */\n rasterize(\n width: number,\n height: number,\n draw: () => void,\n pixelRatio?: number,\n ): RasterizedSurface | null {\n return null;\n }\n\n abstract beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\n abstract endCamera(): void;\n\n /**\n * Per-node render state for each node on the draw stack, in push order\n * (innermost last). Kept parallel to `currentNodeStack` so fills with\n * `space: 'parent'` can resolve their reference rect and so\n * motion-driven effects can read the current node's velocity.\n */\n protected renderStateStack: NodeRenderState[] = [];\n\n /** See {@link RenderContext2D.readsSpaceRects}. */\n readonly readsSpaceRects: boolean = true;\n\n /** See {@link RenderContext2D.drawsVisibleOnly}. */\n readonly drawsVisibleOnly: boolean = true;\n\n /** See {@link RenderPass2D.begin}. */\n begin(state: NodeRenderState): void {\n this.currentNodeStack.push(state.id);\n this.renderStateStack.push(state);\n }\n\n /** Close the innermost node draw scope opened by `begin()`. */\n end(): void {\n this.currentNodeStack.pop();\n this.renderStateStack.pop();\n }\n\n /** Reference rects for the node currently being drawn (parent / viewport). */\n protected currentSpaceRects(): SpaceRects {\n return this.renderStateStack[this.renderStateStack.length - 1]?.rects ?? {};\n }\n\n /** Full render state (incl. velocity) for the node currently being drawn, if any. */\n protected currentRenderState(): NodeRenderState | undefined {\n return this.renderStateStack[this.renderStateStack.length - 1];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"canvas-render-context2d.js","sourceRoot":"","sources":["../../src/render/canvas-render-context2d.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAI5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAgB,qBAAqB;IAGvC,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,qEAAqE;IACrE,0EAA0E;IAE1E;;;;OAIG;IACc,cAAc,GAAgB,EAAE,CAAC;IAElD,iDAAiD;IACjD,aAAa,CAAC,KAAuB;QACj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AE,MAAc,IAAU,CAAC;IAClG,UAAU,KAAW,CAAC;IAEtB,wEAAwE;IACxE,SAAS,CACL,KAAa,EACb,MAAc,EACd,IAAgB,EAChB,UAAmB;QAEnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAKD;;;;;OAKG;IACO,gBAAgB,GAAsB,EAAE,CAAC;IAEnD,mDAAmD;IAC1C,eAAe,GAAY,IAAI,CAAC;IAEzC,oDAAoD;IAC3C,gBAAgB,GAAY,IAAI,CAAC;IAE1C,sCAAsC;IACtC,KAAK,CAAC,KAAsB;QACxB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,+DAA+D;IAC/D,GAAG;QACC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,8EAA8E;IACpE,iBAAiB;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;IAChF,CAAC;IAED,qFAAqF;IAC3E,kBAAkB;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACO,YAAY;QAClB,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import { Graphics2D } from \"./graphics2d\";\r\nimport type { Clip } from \"./clip\";\r\nimport type { TransformState } from \"./descriptors/transform\";\r\nimport type { FontStyle, TextStyle } from \"@/attributes/text/types\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport { TextState } from \"./descriptors/text\";\r\nimport { TextBlockLayout } from \"./text-layout\";\r\nimport { EMPTY_TEXT_STYLE, textOps } from \"@/attributes/text/ops\";\r\nimport { applyGraphicsTextDefaults } from \"./text-defaults\";\r\nimport type { NodeRenderState, RasterizedSurface, RenderContext2D, RenderPass2D, SpaceRects, EffectTarget } from \"./render-context2d\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\n\r\n/**\r\n * The base every {@link RenderContext2D} backend extends.\r\n *\r\n * It owns the parts of a render context that are the *same* whatever is being\r\n * rasterized — the text-default stack, the node scope stack, disposal — plus\r\n * the host-facing half of the surface (`execute`, `screenshot`, `unmount`),\r\n * which the {@link RenderContext2D} interface deliberately leaves out because a\r\n * node has no business driving a render pass from inside one.\r\n *\r\n * **`draw` is final by convention.** It resolves the ambient text defaults onto\r\n * the op list and hands the result to {@link drawGraphics}, which is where a\r\n * backend does its actual drawing. Owning that step here rather than in each\r\n * backend is what keeps the real renderer and the precomp asset walk agreeing\r\n * on which font an under-specified `text` op shapes with: a family that one\r\n * resolves and the other does not is a font that never loads and glyphs that\r\n * never paint.\r\n */\r\nexport abstract class CanvasRenderContext2D implements RenderPass2D {\r\n abstract measureText(text: string, fontSize: number, fontFamily: string, fontWeight?: number, letterSpacing?: number, fontStyle?: FontStyle): Size2D;\r\n\r\n // ---- Inherited text-style defaults ------------------------------------\r\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\r\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\r\n // bind, so it inherits the same defaults here instead — pushed around a\r\n // subtree's draw scope, and folded into each `text`/`richText` op by\r\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\r\n\r\n /**\r\n * Defaults in effect for the current draw scope, innermost last. Each entry\r\n * is **already merged** onto the one below it (see {@link pushTextStyle}), so\r\n * the top of the stack is the effective style and reading it costs nothing.\r\n */\r\n private readonly textStyleStack: TextStyle[] = [];\r\n\r\n /** See {@link RenderContext2D.pushTextStyle}. */\r\n pushTextStyle(style: TextStyle | null): void {\r\n this.textStyleStack.push(style === null ? EMPTY_TEXT_STYLE : textOps.mergeStyle(this.defaultTextStyle, style));\r\n }\r\n\r\n /** Close the innermost scope opened by {@link pushTextStyle}. */\r\n popTextStyle(): void {\r\n this.textStyleStack.pop();\r\n }\r\n\r\n /**\r\n * The text-style defaults in effect right now — the innermost\r\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\r\n * when no scope is open.\r\n *\r\n * Carries all ten {@link TEXT_STYLE_KEYS}, but only the shaping ones reach a\r\n * `Graphics2D` op; see `TEXT_SHAPING_KEYS` for why `fill`/`stroke`/`shadow`\r\n * stay a node-level concern.\r\n */\r\n get defaultTextStyle(): TextStyle {\r\n return this.textStyleStack[this.textStyleStack.length - 1] ?? textOps.preset(\"default\");\r\n }\r\n\r\n /** See {@link RenderContext2D.draw}. Final by convention — override {@link drawGraphics}. */\r\n draw(graphics: Graphics2D): void {\r\n this.drawGraphics(applyGraphicsTextDefaults(graphics, this.defaultTextStyle));\r\n }\r\n\r\n /** Paint a `Graphics2D` whose text ops have already been resolved against the\r\n * ambient defaults. Backends implement this instead of {@link draw}. */\r\n protected abstract drawGraphics(graphics: Graphics2D): void;\r\n\r\n /**\r\n * See {@link RenderContext2D.layoutTextBlock}. Concrete rather than abstract,\r\n * and `null` by default, so a backend that has no need to report glyph\r\n * positions is unaffected — the only thing it gives up is on-canvas text\r\n * editing in a host built on it.\r\n */\r\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null {\r\n return null;\r\n }\r\n\r\n /** Stack of node ids currently being drawn, innermost last. */\r\n protected currentNodeStack: string[] = [];\r\n\r\n /** Returns the id of the innermost node currently being drawn. */\r\n protected currentNodeId(): string {\r\n if (this.currentNodeStack.length === 0) {\r\n throw new Error(\"No current node in context\");\r\n }\r\n\r\n return this.currentNodeStack[this.currentNodeStack.length - 1];\r\n }\r\n\r\n /** Remove all renderer-side resources for the current node (called on unmount). */\r\n abstract unmount(): void;\r\n\r\n private _disposed = false;\r\n /** `true` after `dispose()` — the context must not be used after this point. */\r\n isDisposed(): boolean {\r\n return this._disposed;\r\n }\r\n dispose(): void {\r\n this._disposed = true;\r\n }\r\n\r\n /**\r\n * Execute `callback`, which issues shape/paint calls, and flush the result\r\n * to the underlying render target (canvas, SVG document, etc.). A callback\r\n * that throws still throws, and the next pass starts from a clean context.\r\n */\r\n abstract execute(callback: () => void): void;\r\n /** Capture the current frame as a base-64 PNG data URL, or `undefined` if unsupported. */\r\n abstract screenshot(): string | undefined;\r\n\r\n abstract transform(state: Partial<TransformState>): RenderContext2D;\r\n\r\n abstract beginBoolean(op: BooleanOperation): void;\r\n abstract endBoolean(): void;\r\n\r\n abstract beginMask(options?: MaskOptions): void;\r\n abstract applyMask(): void;\r\n abstract endMask(): void;\r\n\r\n abstract beginClip(clip: Clip): void;\r\n abstract endClip(): void;\r\n\r\n /** See {@link RenderContext2D.beginEffects}. No-op by default. */\r\n beginEffects(effects: NodeEffect[], target: EffectTarget, width: number, height: number): void { }\r\n endEffects(): void { }\r\n\r\n /** See {@link RenderContext2D.rasterize}. Returns `null` by default. */\r\n rasterize(\r\n width: number,\r\n height: number,\r\n draw: () => void,\r\n pixelRatio?: number,\r\n ): RasterizedSurface | null {\r\n return null;\r\n }\r\n\r\n abstract beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\r\n abstract endCamera(): void;\r\n\r\n /**\r\n * Per-node render state for each node on the draw stack, in push order\r\n * (innermost last). Kept parallel to `currentNodeStack` so fills with\r\n * `space: 'parent'` can resolve their reference rect and so\r\n * motion-driven effects can read the current node's velocity.\r\n */\r\n protected renderStateStack: NodeRenderState[] = [];\r\n\r\n /** See {@link RenderContext2D.readsSpaceRects}. */\r\n readonly readsSpaceRects: boolean = true;\r\n\r\n /** See {@link RenderContext2D.drawsVisibleOnly}. */\r\n readonly drawsVisibleOnly: boolean = true;\r\n\r\n /** See {@link RenderPass2D.begin}. */\r\n begin(state: NodeRenderState): void {\r\n this.currentNodeStack.push(state.id);\r\n this.renderStateStack.push(state);\r\n }\r\n\r\n /** Close the innermost node draw scope opened by `begin()`. */\r\n end(): void {\r\n this.currentNodeStack.pop();\r\n this.renderStateStack.pop();\r\n }\r\n\r\n /** Reference rects for the node currently being drawn (parent / viewport). */\r\n protected currentSpaceRects(): SpaceRects {\r\n return this.renderStateStack[this.renderStateStack.length - 1]?.rects ?? {};\r\n }\r\n\r\n /** Full render state (incl. velocity) for the node currently being drawn, if any. */\r\n protected currentRenderState(): NodeRenderState | undefined {\r\n return this.renderStateStack[this.renderStateStack.length - 1];\r\n }\r\n\r\n /**\r\n * Close every node and text-style scope still open. A backend calls this\r\n * when a pass ends, so a pass that threw cannot leave the next one inside\r\n * its scopes.\r\n */\r\n protected _resetScopes(): void {\r\n this.textStyleStack.length = 0;\r\n this.currentNodeStack.length = 0;\r\n this.renderStateStack.length = 0;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip-contains.js","sourceRoot":"","sources":["../../src/render/clip-contains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;;;GA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CAAC,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IACtD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\nimport { Clip, ClipOp, ClipShapeOp } from \"./clip\";\nimport { withRectDescriptor } from \"./descriptors/rect\";\nimport { withEllipseDescriptor } from \"./descriptors/ellipse\";\nimport { withPolygonDescriptor } from \"./descriptors/polygon\";\nimport { withPolygramDescriptor } from \"./descriptors/polygram\";\nimport { withLineDescriptor } from \"./descriptors/line\";\nimport { cornerRadiusOps } from \"@/attributes/shape/corners/corner-radius\";\n\n/**\n * Point-in-region tests for {@link Clip}, used by node hit testing so a click\n * follows a shape's silhouette rather than its bounding box.\n *\n * Geometry only — no renderer, no CanvasKit — because a `Clip` is a declarative\n * record of primitives rather than a built path. That is what lets hit testing\n * live in `core` and share one outline definition with clipping and backdrop\n * effects: a shape declares its outline once, in `clipSelf()`, and both the\n * pixels and the grab region derive from it.\n *\n * Every point and every descriptor coordinate here is in **y-up author space**\n * (the space `Graphics2D`/`Clip` descriptors are written in; the renderer flips to\n * canvas y-down at draw time — see `flipPositionY`). Angles follow from that:\n * `startAngle`/`sweep` measure counter-clockwise from +x.\n */\n\n/** Guard against divide-by-zero on collapsed geometry. */\nconst EPS = 1e-9;\n\n/**\n * Whether `point` falls inside the region a {@link Clip} describes, within\n * `tolerance` scene units of its edge.\n *\n * Shape ops union; a `cut` subtracts the immediately preceding shape from\n * everything declared before it, mirroring how the renderer replays the op list.\n * `tolerance` widens each shape outward — including a cutter, which therefore\n * takes a slightly larger bite, keeping the test forgiving in both directions\n * rather than making a hole's rim unpickable.\n */\nexport function containsClip(clip: Clip, point: Vector2, tolerance = 0): boolean {\n return containsOps(clip.ops(), point, tolerance);\n}\n\n/** {@link containsClip} over a raw op list. */\nexport function containsOps(ops: readonly ClipOp[], point: Vector2, tolerance = 0): boolean {\n let inside = false;\n // The shape immediately preceding the current position, held back so a\n // following `cut` can subtract it instead of unioning it.\n let pending: ClipShapeOp | null = null;\n\n const flush = (): void => {\n if (pending && containsShape(pending, point, tolerance)) inside = true;\n pending = null;\n };\n\n for (const op of ops) {\n if (op.kind === \"cut\") {\n // The pending shape is the cutter: it never joins the union, and it\n // punches whatever was accumulated before it.\n if (pending && containsShape(pending, point, tolerance)) inside = false;\n pending = null;\n continue;\n }\n flush();\n pending = op;\n }\n flush();\n return inside;\n}\n\n/**\n * Dispatch one shape op to its own containment test, after undoing the shape's\n * local rotation/scale about its pivot — mirroring `BaseShape.applyShapeTransform`,\n * which bakes that same transform into the drawn path.\n */\nfunction containsShape(op: ClipShapeOp, point: Vector2, tolerance: number): boolean {\n switch (op.kind) {\n case \"rect\": {\n const s = withRectDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsRect(p, s.width, s.height, cornerRadiusOps.resolve(s.cornerRadius), tolerance);\n }\n case \"ellipse\": {\n const s = withEllipseDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsEllipse(p, s.width, s.height, s.ratio, s.sweep, s.startAngle, tolerance);\n }\n case \"polygon\": {\n const s = withPolygonDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsPolyline(p, polygonVertices(s.width, s.height, s.sides), true, tolerance);\n }\n case \"polygram\": {\n const s = withPolygramDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsPolyline(p, polygramVertices(s.width, s.height, s.sides, s.ratio), true, tolerance);\n }\n case \"line\": {\n const s = withLineDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n if (p === null || s.points.length === 0) return false;\n // As a clip region a polyline is filled with its contour implicitly\n // closed, whether or not `closed` was set — so test the enclosed area\n // first, then fall back to the band around the stroke itself.\n if (s.points.length >= 3 && containsPolyline(p, s.points, true, tolerance)) return true;\n return nearPolyline(p, s.points, s.closed, tolerance);\n }\n case \"path\": {\n // An arbitrary Bézier winding test is not worth carrying, and no\n // built-in shape emits a `path` clip — only a hand-built `Clip` can.\n // Fall back to the declared box.\n const s = op.state;\n const local = { x: point.x - (s.x ?? 0), y: point.y - (s.y ?? 0) };\n return containsRect(local, s.width ?? 0, s.height ?? 0, cornerRadiusOps.resolve(0), tolerance);\n }\n }\n}\n\n/** The positioning fields every shape descriptor resolves to. */\ninterface ShapePlacement {\n x: number;\n y: number;\n rotation: number;\n scale: number;\n pivot: unknown;\n}\n\n/**\n * Map `point` out of the shape's own `x`/`y`/`rotation`/`scale` (about its\n * pivot) and into the shape's un-transformed, centred frame. Returns `null` when\n * the scale is zero — the shape has collapsed and encloses nothing.\n */\nfunction toShapeLocal(point: Vector2, s: ShapePlacement, width: number, height: number): Vector2 | null {\n if (s.scale === 0) return null;\n const pivot = s.pivot as Vector2;\n // Pivot is normalised [-1, 1] about the shape centre, y-up here (the\n // renderer negates its y because it works in canvas space).\n const px = pivot.x * (width / 2);\n const py = pivot.y * (height / 2);\n // Relative to the pivot, in the parent's (unrotated) frame.\n const dx = point.x - (s.x + px);\n const dy = point.y - (s.y + py);\n // Undo the clockwise rotation: in y-up space the forward map is\n // (cos·x + sin·y, -sin·x + cos·y), so the inverse swaps the sine signs.\n const rad = (s.rotation * Math.PI) / 180;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n const rx = (cos * dx - sin * dy) / s.scale;\n const ry = (sin * dx + cos * dy) / s.scale;\n // Back to centre-relative: the pivot sits (px, py) from the centre.\n return { x: rx + px, y: ry + py };\n}\n\n// ─── Primitives ──────────────────────────────────────────────────────────────\n\ninterface Corners4 { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }\n\n/**\n * Axis-aligned box centred on the origin, with per-corner rounding. A corner is\n * only excluded when the point sits beyond that corner's quarter-circle, so a\n * plain rect (all radii 0) reduces to the box test exactly. `cornerStyle` is not\n * consulted: an `'angled'` chamfer cuts strictly inside the arc, so testing the\n * arc over-estimates by a sliver — the forgiving direction for a grab test.\n */\nfunction containsRect(p: Vector2, width: number, height: number, radius: Corners4, tolerance: number): boolean {\n const halfW = width / 2 + tolerance;\n const halfH = height / 2 + tolerance;\n if (Math.abs(p.x) > halfW || Math.abs(p.y) > halfH) return false;\n\n // Pick the corner the point is nearest and test its arc. Radii are clamped\n // the way any rounded-rect rasteriser clamps them: never past half the side.\n const maxR = Math.min(width, height) / 2;\n const r = Math.min(\n maxR,\n p.x <= 0\n ? (p.y >= 0 ? radius.topLeft : radius.bottomLeft)\n : (p.y >= 0 ? radius.topRight : radius.bottomRight),\n );\n if (r <= 0) return true;\n\n // Centre of that corner's arc, then the usual \"outside the quarter-circle\"\n // check — which only bites inside the corner square itself.\n const sx = Math.sign(p.x || 1);\n const sy = Math.sign(p.y || 1);\n const dx = p.x - sx * (width / 2 - r);\n const dy = p.y - sy * (height / 2 - r);\n if (Math.sign(dx || 1) !== sx || Math.sign(dy || 1) !== sy) return true;\n return dx * dx + dy * dy <= (r + tolerance) * (r + tolerance);\n}\n\n/**\n * Ellipse, honouring the same `ratio`/`sweep`/`startAngle` family the renderer\n * draws (see `EllipseShape.buildSVGPath`), so the grab region is the region that\n * was actually painted:\n *\n * - `ratio` ≤ 0 → solid disk, or a wedge for a partial sweep\n * - 0 < `ratio` < 1 → annulus / annular sector (the hole is not hittable)\n * - `ratio` ≥ 1 → the band has collapsed to the bare outer curve, so only\n * points near that curve hit\n */\nfunction containsEllipse(\n p: Vector2, width: number, height: number,\n ratio: number, sweep: number, startAngle: number,\n tolerance: number,\n): boolean {\n const rx = width / 2;\n const ry = height / 2;\n if (rx <= 0 || ry <= 0) return false;\n\n const clamped = Math.max(0, Math.min(1, ratio));\n const full = Math.abs(sweep) >= 360;\n\n // Outside the outer curve (grown by tolerance) can never hit.\n if (norm(p, rx + tolerance, ry + tolerance) > 1) return false;\n\n if (clamped > 0) {\n const inner = norm(p, Math.max(EPS, rx * clamped - tolerance), Math.max(EPS, ry * clamped - tolerance));\n if (inner < 1) return false;\n }\n\n if (full) return true;\n return withinSweep(Math.atan2(p.y / ry, p.x / rx) * (180 / Math.PI), startAngle, sweep, p, tolerance);\n}\n\n/** Normalised radius of `p` on an ellipse of half-axes `rx`/`ry` (1 = on the curve). */\nfunction norm(p: Vector2, rx: number, ry: number): number {\n return Math.hypot(p.x / rx, p.y / ry);\n}\n\n/**\n * Whether `angleDeg` lies within the arc `[startAngle, startAngle + sweep]`,\n * with `tolerance` converted to angular slack at the point's own radius so\n * grab-slop widens the wedge's straight edges too. Handles negative sweeps.\n */\nfunction withinSweep(\n angleDeg: number, startAngle: number, sweep: number,\n p: Vector2, tolerance: number,\n): boolean {\n const lo = sweep >= 0 ? startAngle : startAngle + sweep;\n const span = Math.abs(sweep);\n // Near the centre every angle is within tolerance of the wedge.\n const radius = Math.hypot(p.x, p.y);\n if (radius <= tolerance) return true;\n const slack = tolerance > 0 ? (tolerance / Math.max(radius, EPS)) * (180 / Math.PI) : 0;\n let delta = (angleDeg - lo) % 360;\n if (delta < 0) delta += 360;\n // Accept the wrap-around side within slack as well.\n return delta <= span + slack || delta >= 360 - slack;\n}\n\n/**\n * Vertices of a regular polygon inscribed in `width`×`height`, y-up author\n * space. The renderer starts at the top vertex and steps clockwise in canvas\n * space; in y-up that is `+π/2` stepping negative.\n */\nexport function polygonVertices(width: number, height: number, sides: number): Vector2[] {\n const n = Math.max(3, Math.round(sides));\n const rx = width / 2;\n const ry = height / 2;\n const step = (2 * Math.PI) / n;\n const out: Vector2[] = [];\n for (let i = 0; i < n; i++) {\n const a = Math.PI / 2 - i * step;\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) });\n }\n return out;\n}\n\n/** Vertices of a star polygon: outer radius 1 alternating with inner radius `ratio`. */\nexport function polygramVertices(width: number, height: number, sides: number, ratio: number): Vector2[] {\n const n = Math.max(3, Math.round(sides));\n const r = Math.max(0, Math.min(1, ratio));\n const rx = width / 2;\n const ry = height / 2;\n const step = Math.PI / n;\n const out: Vector2[] = [];\n for (let i = 0; i < n * 2; i++) {\n const a = Math.PI / 2 - i * step;\n const k = i % 2 === 0 ? 1 : r;\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) });\n }\n return out;\n}\n\n/**\n * Even-odd crossing test against a polygon, widened by `tolerance`: a point just\n * outside an edge still counts. `closed` also closes the last→first segment for\n * the tolerance band.\n */\nfunction containsPolyline(p: Vector2, verts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\n if (verts.length >= 3 && pointInPolygon(p, verts)) return true;\n return tolerance > 0 && nearPolyline(p, verts, closed, tolerance);\n}\n\n/** Even-odd crossing test against a closed polygon. No tolerance band. */\nexport function pointInPolygon(p: Vector2, verts: readonly Vector2[]): boolean {\n if (verts.length < 3) return false;\n let inside = false;\n for (let i = 0, j = verts.length - 1; i < verts.length; j = i++) {\n const a = verts[i];\n const b = verts[j];\n if ((a.y > p.y) !== (b.y > p.y) && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x) {\n inside = !inside;\n }\n }\n return inside;\n}\n\n/** Whether `p` is within `tolerance` of any segment of the polyline. */\nexport function nearPolyline(p: Vector2, pts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\n if (pts.length === 0) return false;\n if (pts.length === 1) return Math.hypot(p.x - pts[0].x, p.y - pts[0].y) <= tolerance;\n const last = closed ? pts.length : pts.length - 1;\n for (let i = 0; i < last; i++) {\n if (distanceToSegment(p, pts[i], pts[(i + 1) % pts.length]) <= tolerance) return true;\n }\n return false;\n}\n\n/** Shortest distance from `p` to the segment `a`–`b`. */\nexport function distanceToSegment(p: Vector2, a: Vector2, b: Vector2): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const lenSq = dx * dx + dy * dy;\n if (lenSq <= EPS) return Math.hypot(p.x - a.x, p.y - a.y);\n let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq;\n t = t < 0 ? 0 : t > 1 ? 1 : t;\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"clip-contains.js","sourceRoot":"","sources":["../../src/render/clip-contains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AAEH,0DAA0D;AAC1D,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,IAAU,EAAE,KAAc,EAAE,SAAS,GAAG,CAAC;IAClE,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,WAAW,CAAC,GAAsB,EAAE,KAAc,EAAE,SAAS,GAA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C,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { Clip, ClipOp, ClipShapeOp } from \"./clip\";\r\nimport { withRectDescriptor } from \"./descriptors/rect\";\r\nimport { withEllipseDescriptor } from \"./descriptors/ellipse\";\r\nimport { withPolygonDescriptor } from \"./descriptors/polygon\";\r\nimport { withPolygramDescriptor } from \"./descriptors/polygram\";\r\nimport { withLineDescriptor } from \"./descriptors/line\";\r\nimport { cornerRadiusOps } from \"@/attributes/shape/corners/corner-radius\";\r\n\r\n/**\r\n * Point-in-region tests for {@link Clip}, used by node hit testing so a click\r\n * follows a shape's silhouette rather than its bounding box.\r\n *\r\n * Geometry only — no renderer, no CanvasKit — because a `Clip` is a declarative\r\n * record of primitives rather than a built path. That is what lets hit testing\r\n * live in `core` and share one outline definition with clipping and backdrop\r\n * effects: a shape declares its outline once, in `clipSelf()`, and both the\r\n * pixels and the grab region derive from it.\r\n *\r\n * Every point and every descriptor coordinate here is in **y-up author space**\r\n * (the space `Graphics2D`/`Clip` descriptors are written in; the renderer flips to\r\n * canvas y-down at draw time — see `flipPositionY`). Angles follow from that:\r\n * `startAngle`/`sweep` measure counter-clockwise from +x.\r\n */\r\n\r\n/** Guard against divide-by-zero on collapsed geometry. */\r\nconst EPS = 1e-9;\r\n\r\n/**\r\n * Whether `point` falls inside the region a {@link Clip} describes, within\r\n * `tolerance` scene units of its edge.\r\n *\r\n * Shape ops union; a `cut` subtracts the immediately preceding shape from\r\n * everything declared before it, mirroring how the renderer replays the op list.\r\n * `tolerance` widens each shape outward — including a cutter, which therefore\r\n * takes a slightly larger bite, keeping the test forgiving in both directions\r\n * rather than making a hole's rim unpickable.\r\n */\r\nexport function containsClip(clip: Clip, point: Vector2, tolerance = 0): boolean {\r\n return containsOps(clip.ops(), point, tolerance);\r\n}\r\n\r\n/** {@link containsClip} over a raw op list. */\r\nexport function containsOps(ops: readonly ClipOp[], point: Vector2, tolerance = 0): boolean {\r\n let inside = false;\r\n // The shape immediately preceding the current position, held back so a\r\n // following `cut` can subtract it instead of unioning it.\r\n let pending: ClipShapeOp | null = null;\r\n\r\n const flush = (): void => {\r\n if (pending && containsShape(pending, point, tolerance)) inside = true;\r\n pending = null;\r\n };\r\n\r\n for (const op of ops) {\r\n if (op.kind === \"cut\") {\r\n // The pending shape is the cutter: it never joins the union, and it\r\n // punches whatever was accumulated before it.\r\n if (pending && containsShape(pending, point, tolerance)) inside = false;\r\n pending = null;\r\n continue;\r\n }\r\n flush();\r\n pending = op;\r\n }\r\n flush();\r\n return inside;\r\n}\r\n\r\n/**\r\n * Dispatch one shape op to its own containment test, after undoing the shape's\r\n * local rotation/scale about its pivot — mirroring `BaseShape.applyShapeTransform`,\r\n * which bakes that same transform into the drawn path.\r\n */\r\nfunction containsShape(op: ClipShapeOp, point: Vector2, tolerance: number): boolean {\r\n switch (op.kind) {\r\n case \"rect\": {\r\n const s = withRectDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsRect(p, s.width, s.height, cornerRadiusOps.resolve(s.cornerRadius), tolerance);\r\n }\r\n case \"ellipse\": {\r\n const s = withEllipseDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsEllipse(p, s.width, s.height, s.ratio, s.sweep, s.startAngle, tolerance);\r\n }\r\n case \"polygon\": {\r\n const s = withPolygonDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygonVertices(s.width, s.height, s.sides), true, tolerance);\r\n }\r\n case \"polygram\": {\r\n const s = withPolygramDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygramVertices(s.width, s.height, s.sides, s.ratio), true, tolerance);\r\n }\r\n case \"line\": {\r\n const s = withLineDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n if (p === null || s.points.length === 0) return false;\r\n // As a clip region a polyline is filled with its contour implicitly\r\n // closed, whether or not `closed` was set — so test the enclosed area\r\n // first, then fall back to the band around the stroke itself.\r\n if (s.points.length >= 3 && containsPolyline(p, s.points, true, tolerance)) return true;\r\n return nearPolyline(p, s.points, s.closed, tolerance);\r\n }\r\n case \"path\": {\r\n // An arbitrary Bézier winding test is not worth carrying, and no\r\n // built-in shape emits a `path` clip — only a hand-built `Clip` can.\r\n // Fall back to the declared box.\r\n const s = op.state;\r\n const local = { x: point.x - (s.x ?? 0), y: point.y - (s.y ?? 0) };\r\n return containsRect(local, s.width ?? 0, s.height ?? 0, cornerRadiusOps.resolve(0), tolerance);\r\n }\r\n }\r\n}\r\n\r\n/** The positioning fields every shape descriptor resolves to. */\r\ninterface ShapePlacement {\r\n x: number;\r\n y: number;\r\n rotation: number;\r\n scale: number;\r\n pivot: unknown;\r\n}\r\n\r\n/**\r\n * Map `point` out of the shape's own `x`/`y`/`rotation`/`scale` (about its\r\n * pivot) and into the shape's un-transformed, centred frame. Returns `null` when\r\n * the scale is zero — the shape has collapsed and encloses nothing.\r\n */\r\nfunction toShapeLocal(point: Vector2, s: ShapePlacement, width: number, height: number): Vector2 | null {\r\n if (s.scale === 0) return null;\r\n const pivot = s.pivot as Vector2;\r\n // Pivot is normalised [-1, 1] about the shape centre, y-up here (the\r\n // renderer negates its y because it works in canvas space).\r\n const px = pivot.x * (width / 2);\r\n const py = pivot.y * (height / 2);\r\n // Relative to the pivot, in the parent's (unrotated) frame.\r\n const dx = point.x - (s.x + px);\r\n const dy = point.y - (s.y + py);\r\n // Undo the clockwise rotation: in y-up space the forward map is\r\n // (cos·x + sin·y, -sin·x + cos·y), so the inverse swaps the sine signs.\r\n const rad = (s.rotation * Math.PI) / 180;\r\n const cos = Math.cos(rad);\r\n const sin = Math.sin(rad);\r\n const rx = (cos * dx - sin * dy) / s.scale;\r\n const ry = (sin * dx + cos * dy) / s.scale;\r\n // Back to centre-relative: the pivot sits (px, py) from the centre.\r\n return { x: rx + px, y: ry + py };\r\n}\r\n\r\n// ─── Primitives ──────────────────────────────────────────────────────────────\r\n\r\ninterface Corners4 { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }\r\n\r\n/**\r\n * Axis-aligned box centred on the origin, with per-corner rounding. A corner is\r\n * only excluded when the point sits beyond that corner's quarter-circle, so a\r\n * plain rect (all radii 0) reduces to the box test exactly. `cornerStyle` is not\r\n * consulted: an `'angled'` chamfer cuts strictly inside the arc, so testing the\r\n * arc over-estimates by a sliver — the forgiving direction for a grab test.\r\n */\r\nfunction containsRect(p: Vector2, width: number, height: number, radius: Corners4, tolerance: number): boolean {\r\n const halfW = width / 2 + tolerance;\r\n const halfH = height / 2 + tolerance;\r\n if (Math.abs(p.x) > halfW || Math.abs(p.y) > halfH) return false;\r\n\r\n // Pick the corner the point is nearest and test its arc. Radii are clamped\r\n // the way any rounded-rect rasteriser clamps them: never past half the side.\r\n const maxR = Math.min(width, height) / 2;\r\n const r = Math.min(\r\n maxR,\r\n p.x <= 0\r\n ? (p.y >= 0 ? radius.topLeft : radius.bottomLeft)\r\n : (p.y >= 0 ? radius.topRight : radius.bottomRight),\r\n );\r\n if (r <= 0) return true;\r\n\r\n // Centre of that corner's arc, then the usual \"outside the quarter-circle\"\r\n // check — which only bites inside the corner square itself.\r\n const sx = Math.sign(p.x || 1);\r\n const sy = Math.sign(p.y || 1);\r\n const dx = p.x - sx * (width / 2 - r);\r\n const dy = p.y - sy * (height / 2 - r);\r\n if (Math.sign(dx || 1) !== sx || Math.sign(dy || 1) !== sy) return true;\r\n return dx * dx + dy * dy <= (r + tolerance) * (r + tolerance);\r\n}\r\n\r\n/**\r\n * Ellipse, honouring the same `ratio`/`sweep`/`startAngle` family the renderer\r\n * draws (see `EllipseShape.buildSVGPath`), so the grab region is the region that\r\n * was actually painted:\r\n *\r\n * - `ratio` ≤ 0 → solid disk, or a wedge for a partial sweep\r\n * - 0 < `ratio` < 1 → annulus / annular sector (the hole is not hittable)\r\n * - `ratio` ≥ 1 → the band has collapsed to the bare outer curve, so only\r\n * points near that curve hit\r\n */\r\nfunction containsEllipse(\r\n p: Vector2, width: number, height: number,\r\n ratio: number, sweep: number, startAngle: number,\r\n tolerance: number,\r\n): boolean {\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n if (rx <= 0 || ry <= 0) return false;\r\n\r\n const clamped = Math.max(0, Math.min(1, ratio));\r\n const full = Math.abs(sweep) >= 360;\r\n\r\n // Outside the outer curve (grown by tolerance) can never hit.\r\n if (norm(p, rx + tolerance, ry + tolerance) > 1) return false;\r\n\r\n if (clamped > 0) {\r\n const inner = norm(p, Math.max(EPS, rx * clamped - tolerance), Math.max(EPS, ry * clamped - tolerance));\r\n if (inner < 1) return false;\r\n }\r\n\r\n if (full) return true;\r\n return withinSweep(Math.atan2(p.y / ry, p.x / rx) * (180 / Math.PI), startAngle, sweep, p, tolerance);\r\n}\r\n\r\n/** Normalised radius of `p` on an ellipse of half-axes `rx`/`ry` (1 = on the curve). */\r\nfunction norm(p: Vector2, rx: number, ry: number): number {\r\n return Math.hypot(p.x / rx, p.y / ry);\r\n}\r\n\r\n/**\r\n * Whether `angleDeg` lies within the arc `[startAngle, startAngle + sweep]`,\r\n * with `tolerance` converted to angular slack at the point's own radius so\r\n * grab-slop widens the wedge's straight edges too. Handles negative sweeps.\r\n */\r\nfunction withinSweep(\r\n angleDeg: number, startAngle: number, sweep: number,\r\n p: Vector2, tolerance: number,\r\n): boolean {\r\n const lo = sweep >= 0 ? startAngle : startAngle + sweep;\r\n const span = Math.abs(sweep);\r\n // Near the centre every angle is within tolerance of the wedge.\r\n const radius = Math.hypot(p.x, p.y);\r\n if (radius <= tolerance) return true;\r\n const slack = tolerance > 0 ? (tolerance / Math.max(radius, EPS)) * (180 / Math.PI) : 0;\r\n let delta = (angleDeg - lo) % 360;\r\n if (delta < 0) delta += 360;\r\n // Accept the wrap-around side within slack as well.\r\n return delta <= span + slack || delta >= 360 - slack;\r\n}\r\n\r\n/**\r\n * Vertices of a regular polygon inscribed in `width`×`height`, y-up author\r\n * space. The renderer starts at the top vertex and steps clockwise in canvas\r\n * space; in y-up that is `+π/2` stepping negative.\r\n */\r\nexport function polygonVertices(width: number, height: number, sides: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = (2 * Math.PI) / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/** Vertices of a star polygon: outer radius 1 alternating with inner radius `ratio`. */\r\nexport function polygramVertices(width: number, height: number, sides: number, ratio: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const r = Math.max(0, Math.min(1, ratio));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = Math.PI / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n * 2; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n const k = i % 2 === 0 ? 1 : r;\r\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * Even-odd crossing test against a polygon, widened by `tolerance`: a point just\r\n * outside an edge still counts. `closed` also closes the last→first segment for\r\n * the tolerance band.\r\n */\r\nfunction containsPolyline(p: Vector2, verts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (verts.length >= 3 && pointInPolygon(p, verts)) return true;\r\n return tolerance > 0 && nearPolyline(p, verts, closed, tolerance);\r\n}\r\n\r\n/** Even-odd crossing test against a closed polygon. No tolerance band. */\r\nexport function pointInPolygon(p: Vector2, verts: readonly Vector2[]): boolean {\r\n if (verts.length < 3) return false;\r\n let inside = false;\r\n for (let i = 0, j = verts.length - 1; i < verts.length; j = i++) {\r\n const a = verts[i];\r\n const b = verts[j];\r\n if ((a.y > p.y) !== (b.y > p.y) && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x) {\r\n inside = !inside;\r\n }\r\n }\r\n return inside;\r\n}\r\n\r\n/** Whether `p` is within `tolerance` of any segment of the polyline. */\r\nexport function nearPolyline(p: Vector2, pts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (pts.length === 0) return false;\r\n if (pts.length === 1) return Math.hypot(p.x - pts[0].x, p.y - pts[0].y) <= tolerance;\r\n const last = closed ? pts.length : pts.length - 1;\r\n for (let i = 0; i < last; i++) {\r\n if (distanceToSegment(p, pts[i], pts[(i + 1) % pts.length]) <= tolerance) return true;\r\n }\r\n return false;\r\n}\r\n\r\n/** Shortest distance from `p` to the segment `a`–`b`. */\r\nexport function distanceToSegment(p: Vector2, a: Vector2, b: Vector2): number {\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const lenSq = dx * dx + dy * dy;\r\n if (lenSq <= EPS) return Math.hypot(p.x - a.x, p.y - a.y);\r\n let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq;\r\n t = t < 0 ? 0 : t > 1 ? 1 : t;\r\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));\r\n}\r\n"]}
|
package/dist/render/clip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/render/clip.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAuBzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,IAAI;IACL,IAAI,GAAa,EAAE,CAAC;IAE5B,4EAA4E;IAE5E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;IAChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\nimport type { EllipseState } from \"./descriptors/ellipse\";\nimport type { PathState } from \"./descriptors/path\";\nimport type { LineState } from \"./descriptors/line\";\nimport type { PolygonState } from \"./descriptors/polygon\";\nimport type { PolygramState } from \"./descriptors/polygram\";\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\nimport { PathBuilder } from \"./descriptors/path-builder\";\n\n/**\n * The shape ops a {@link Clip} can record — the same geometry primitives a\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\n * Each carries the partial descriptor state for that shape.\n */\nexport type ClipShapeOp =\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\n | { kind: \"path\"; state: Partial<PathState> }\n | { kind: \"line\"; state: Partial<LineState> }\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\n\n/**\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\n * region; `cut` subtracts the last-declared shape from the ones before it. The\n * renderer replays this list into a single clip path via\n * `RenderContext2D.beginClip()`.\n */\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\n\n/**\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\n *\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\n * the renderer unions into a single clip path. Multiple shapes combine, so a\n * clip can be any compound silhouette, not just a single rect or ellipse:\n *\n * const c = new Clip()\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\n * .ellipse({ x: -80, width: 40, height: 40 })\n * .cut(); // punches the last hole\n * ctx.beginClip(c);\n * ...draw clipped content...\n * ctx.endClip();\n *\n * A `Clip` carries no paint — it's purely the outline. It's what a `ShapeNode`\n * returns from `clipSelf()` to describe both its `clip` boundary and the\n * silhouette its backdrop effects (blur, magnify, …) are confined to, so a\n * single definition drives every clip the node needs.\n */\nexport class Clip {\n private _ops: ClipOp[] = [];\n\n // ─── Shapes ──────────────────────────────────────────────────────────────\n\n rect(state: Partial<RectState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"rect\", state });\n return this;\n }\n\n ellipse(state: Partial<EllipseState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"ellipse\", state });\n return this;\n }\n\n /** Add a vector path to the clip region, from a `PathState` or a `PathBuilder`. */\n path(state: Partial<PathState> | PathBuilder): this {\n const resolved = state instanceof PathBuilder ? state.toPathState() : state;\n this._ops.push({ kind: \"path\", state: resolved });\n return this;\n }\n\n line(state: Partial<LineState>): this {\n this._ops.push({ kind: \"line\", state });\n return this;\n }\n\n polygon(state: Partial<PolygonState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"polygon\", state });\n return this;\n }\n\n polygram(state: Partial<PolygramState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"polygram\", state });\n return this;\n }\n\n // ─── Compositing ─────────────────────────────────────────────────────────\n\n /**\n * Use the last-declared shape as a cutter: union the shapes before it and\n * subtract that last shape, punching a hole in the clip region. Mirrors\n * {@link Graphics2D.cut}.\n */\n cut(): this {\n this._ops.push({ kind: \"cut\" });\n return this;\n }\n\n // ─── Consumption ─────────────────────────────────────────────────────────\n\n /** The recorded ops, in order. Consumed by `RenderContext2D.beginClip()`. */\n ops(): readonly ClipOp[] {\n return this._ops;\n }\n\n /** True when no shape op has been recorded — the clip region is empty. */\n isEmpty(): boolean {\n return !this._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,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E;;;;OAIG;IACH,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\r\nimport type { EllipseState } from \"./descriptors/ellipse\";\r\nimport type { PathState } from \"./descriptors/path\";\r\nimport type { LineState } from \"./descriptors/line\";\r\nimport type { PolygonState } from \"./descriptors/polygon\";\r\nimport type { PolygramState } from \"./descriptors/polygram\";\r\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\r\nimport { PathBuilder } from \"./descriptors/path-builder\";\r\n\r\n/**\r\n * The shape ops a {@link Clip} can record — the same geometry primitives a\r\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\r\n * Each carries the partial descriptor state for that shape.\r\n */\r\nexport type ClipShapeOp =\r\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\r\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\r\n | { kind: \"path\"; state: Partial<PathState> }\r\n | { kind: \"line\"; state: Partial<LineState> }\r\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\r\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\r\n\r\n/**\r\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\r\n * region; `cut` subtracts the last-declared shape from the ones before it. The\r\n * renderer replays this list into a single clip path via\r\n * `RenderContext2D.beginClip()`.\r\n */\r\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\r\n\r\n/**\r\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\r\n *\r\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\r\n * the renderer unions into a single clip path. Multiple shapes combine, so a\r\n * clip can be any compound silhouette, not just a single rect or ellipse:\r\n *\r\n * const c = new Clip()\r\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\r\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\r\n * .ellipse({ x: -80, width: 40, height: 40 })\r\n * .cut(); // punches the last hole\r\n * ctx.beginClip(c);\r\n * ...draw clipped content...\r\n * ctx.endClip();\r\n *\r\n * A `Clip` carries no paint — it's purely the outline. It's what a `ShapeNode`\r\n * returns from `clipSelf()` to describe both its `clip` boundary and the\r\n * silhouette its backdrop effects (blur, magnify, …) are confined to, so a\r\n * single definition drives every clip the node needs.\r\n */\r\nexport class Clip {\r\n private _ops: ClipOp[] = [];\r\n\r\n // ─── Shapes ──────────────────────────────────────────────────────────────\r\n\r\n rect(state: Partial<RectState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"rect\", state });\r\n return this;\r\n }\r\n\r\n ellipse(state: Partial<EllipseState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"ellipse\", state });\r\n return this;\r\n }\r\n\r\n /** Add a vector path to the clip region, from a `PathState` or a `PathBuilder`. */\r\n path(state: Partial<PathState> | PathBuilder): this {\r\n const resolved = state instanceof PathBuilder ? state.toPathState() : state;\r\n this._ops.push({ kind: \"path\", state: resolved });\r\n return this;\r\n }\r\n\r\n line(state: Partial<LineState>): this {\r\n this._ops.push({ kind: \"line\", state });\r\n return this;\r\n }\r\n\r\n polygon(state: Partial<PolygonState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygon\", state });\r\n return this;\r\n }\r\n\r\n polygram(state: Partial<PolygramState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygram\", state });\r\n return this;\r\n }\r\n\r\n // ─── Compositing ─────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Use the last-declared shape as a cutter: union the shapes before it and\r\n * subtract that last shape, punching a hole in the clip region. Mirrors\r\n * {@link Graphics2D.cut}.\r\n */\r\n cut(): this {\r\n this._ops.push({ kind: \"cut\" });\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Consumed by `RenderContext2D.beginClip()`. */\r\n ops(): readonly ClipOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** True when no shape op has been recorded — the clip region is empty. */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => op.kind !== \"cut\");\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipse.js","sourceRoot":"","sources":["../../../src/render/descriptors/ellipse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAS7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC;KACzC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\nexport interface EllipseState extends ShapeState {\n width: number;\n height: number;\n ratio: number;\n sweep: number;\n startAngle: number;\n}\n\nexport function withEllipseDescriptor(descriptor: Partial<EllipseState> & ShapeAlignmentInput): EllipseState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n ratio: descriptor.ratio ?? 0,\n sweep: descriptor.sweep ?? 360,\n startAngle: descriptor.startAngle ?? 0,\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"ellipse.js","sourceRoot":"","sources":["../../../src/render/descriptors/ellipse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAS7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC;KACzC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\nexport interface EllipseState extends ShapeState {\r\n width: number;\r\n height: number;\r\n ratio: number;\r\n sweep: number;\r\n startAngle: number;\r\n}\r\n\r\nexport function withEllipseDescriptor(descriptor: Partial<EllipseState> & ShapeAlignmentInput): EllipseState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n ratio: descriptor.ratio ?? 0,\r\n sweep: descriptor.sweep ?? 360,\r\n startAngle: descriptor.startAngle ?? 0,\r\n };\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex.js","sourceRoot":"","sources":["../../../src/render/descriptors/latex.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeState } from \"./shape\";\n\nexport interface LatexState extends ShapeState {\n latex: string;\n fontSize: number;\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"latex.js","sourceRoot":"","sources":["../../../src/render/descriptors/latex.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeState } from \"./shape\";\r\n\r\nexport interface LatexState extends ShapeState {\r\n latex: string;\r\n fontSize: number;\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../src/render/descriptors/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQxD,MAAM,UAAU,kBAAkB,CAAC,UAA8B;IAC7D,OAAO;QACH,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC;QAE1C,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,EAAE;QAC/B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,KAAK;KACrC,CAAC;AACN,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\nimport { ShapeState, resolveShapePivot } from \"./shape\";\n\nexport interface LineState extends ShapeState {\n points: Vector2[];\n radius: number;\n closed: boolean;\n}\n\nexport function withLineDescriptor(descriptor: Partial<LineState>): LineState {\n return {\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x: descriptor.x ?? 0,\n y: descriptor.y ?? 0,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n width: descriptor.width ?? 0,\n height: descriptor.height ?? 0,\n pivot: resolveShapePivot(descriptor.pivot),\n\n points: descriptor.points ?? [],\n radius: descriptor.radius ?? 0,\n closed: descriptor.closed ?? false,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../src/render/descriptors/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQxD,MAAM,UAAU,kBAAkB,CAAC,UAA8B;IAC7D,OAAO;QACH,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC;QAE1C,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,EAAE;QAC/B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,KAAK;KACrC,CAAC;AACN,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { ShapeState, resolveShapePivot } from \"./shape\";\r\n\r\nexport interface LineState extends ShapeState {\r\n points: Vector2[];\r\n radius: number;\r\n closed: boolean;\r\n}\r\n\r\nexport function withLineDescriptor(descriptor: Partial<LineState>): LineState {\r\n return {\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x: descriptor.x ?? 0,\r\n y: descriptor.y ?? 0,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n pivot: resolveShapePivot(descriptor.pivot),\r\n\r\n points: descriptor.points ?? [],\r\n radius: descriptor.radius ?? 0,\r\n closed: descriptor.closed ?? false,\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-builder.js","sourceRoot":"","sources":["../../../src/render/descriptors/path-builder.ts"],"names":[],"mappings":"AAsBA,MAAM,OAAO,WAAW;IACZ,KAAK,GAAkB,EAAE,CAAC;IAC1B,EAAE,GAAG,CAAC,CAAC;IACP,EAAE,GAAG,CAAC,CAAC;IACP,OAAO,GAAG,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC,CAAC;IACZ,KAAK,GAAG,KAAK,CAAC;IAEtB,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,OA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AAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,SAAS,UAAU,CAAC,GAAe;IAC/B,OAAO;QACH,EAAE,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QACd,EAAE,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QACd,EAAE,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC;QACjB,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;QACjC,IAAI,EAAE,GAAG,CAAC,UAAU,IAAI,CAAC;QACzB,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG;KAC1B,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,KAAa;IAC1E,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACpC,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { PathCommand } from \"./path\";\nimport type { PathState } from \"./path\";\n\n/**\n * A full or partial revolution of an ellipse, in the same **y-up** space the\n * commands themselves are authored in (`y = 100` is 100px *above* the centre,\n * matching a node's `x`/`y`). Angles are degrees from 3 o'clock, positive\n * counter-clockwise — the vocabulary the `Ellipse` node already uses.\n */\nexport interface EllipseArc {\n /** Centre. Both default to the origin. */\n x?: number;\n y?: number;\n width: number;\n /** Defaults to `width`, i.e. a circle. */\n height?: number;\n /** Where on the perimeter the curve starts. */\n startAngle?: number;\n /** Degrees travelled; negative goes clockwise. Past ±360 it keeps looping. */\n sweep?: number;\n}\n\nexport class PathBuilder {\n private _cmds: PathCommand[] = [];\n private _x = 0;\n private _y = 0;\n private _startX = 0;\n private _startY = 0;\n private _open = false;\n\n moveTo(x: number, y: number): this {\n this._cmds.push({ type: \"M\", x, y });\n this._startX = x;\n this._startY = y;\n return this._at(x, y);\n }\n\n lineTo(x: number, y: number): this {\n this._cmds.push({ type: \"L\", x, y });\n return this._at(x, y);\n }\n\n bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): this {\n this._cmds.push({ type: \"C\", x1, y1, x2, y2, x, y });\n return this._at(x, y);\n }\n\n quadraticCurveTo(x1: number, y1: number, x: number, y: number): this {\n this._cmds.push({ type: \"Q\", x1, y1, x, y });\n return this._at(x, y);\n }\n\n /** The raw SVG arc command: an elliptical arc to (`x`, `y`), picked out of the four candidates by `largeArc`/`sweep`. */\n arcTo(rx: number, ry: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1, x: number, y: number): this {\n this._cmds.push({ type: \"A\", rx, ry, rotation, largeArc, sweep, x, y });\n return this._at(x, y);\n }\n\n /**\n * An **open** elliptical arc: the perimeter of {@link EllipseArc} from\n * `startAngle` through `sweep` degrees.\n *\n * Continues the current subpath — a straight line joins the pen's position\n * to the arc's start when the two differ — so `moveTo(...).arc(...)` is one\n * unbroken curve, which is what a `moveTo` command following the path needs.\n * A new `M` there would be a subpath break the walk teleports across.\n *\n * ```ts\n * new PathBuilder().arc({ x: 0, y: 0, width: 400, startAngle: 180, sweep: -180 });\n * ```\n */\n arc(arc: EllipseArc): this {\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\n const start = pointOn(cx, cy, rx, ry, from);\n if (!this._open) this.moveTo(start.x, start.y);\n else if (start.x !== this._x || start.y !== this._y) this.lineTo(start.x, start.y);\n return this._sweep(cx, cy, rx, ry, from, sweep);\n }\n\n /**\n * A **closed** subpath tracing an ellipse — the shape form of {@link arc}.\n *\n * A `sweep` short of a full turn closes across the chord back to the start;\n * for a pie wedge or an annular sector, that is an `Ellipse` node's `ratio`.\n */\n ellipse(arc: EllipseArc): this {\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\n const start = pointOn(cx, cy, rx, ry, from);\n this.moveTo(start.x, start.y);\n this._sweep(cx, cy, rx, ry, from, sweep);\n return this.close();\n }\n\n close(): this {\n this._cmds.push({ type: \"Z\" });\n return this._at(this._startX, this._startY);\n }\n\n toCommands(): PathCommand[] {\n return [...this._cmds];\n }\n\n toPathState(partial: Omit<Partial<PathState>, \"data\"> = {}): Partial<PathState> {\n return { ...partial, data: this._cmds };\n }\n\n /** Record where the pen ended up, so {@link arc} knows whether it has to join up to its start. */\n private _at(x: number, y: number): this {\n this._x = x;\n this._y = y;\n this._open = true;\n return this;\n }\n\n /**\n * Emit the arc as segments of at most a quarter turn. One `A` command cannot\n * express a full revolution at all (its endpoints would coincide, leaving the\n * arc undefined) and grows imprecise well before that, so the split is what\n * makes `sweep` a real angle rather than a value capped just under 360.\n */\n private _sweep(cx: number, cy: number, rx: number, ry: number, from: number, sweep: number): this {\n if (sweep === 0) return this;\n const steps = Math.ceil(Math.abs(sweep) / 90);\n const step = sweep / steps;\n const direction = sweep > 0 ? 1 : 0;\n for (let i = 1; i <= steps; i++) {\n const p = pointOn(cx, cy, rx, ry, from + step * i);\n this.arcTo(rx, ry, 0, 0, direction, p.x, p.y);\n }\n return this;\n }\n}\n\nfunction resolveArc(arc: EllipseArc): { cx: number; cy: number; rx: number; ry: number; from: number; sweep: number } {\n return {\n cx: arc.x ?? 0,\n cy: arc.y ?? 0,\n rx: arc.width / 2,\n ry: (arc.height ?? arc.width) / 2,\n from: arc.startAngle ?? 0,\n sweep: arc.sweep ?? 360,\n };\n}\n\nfunction pointOn(cx: number, cy: number, rx: number, ry: number, angle: number): { x: number; y: number } {\n const rad = (angle * Math.PI) / 180;\n return { x: cx + rx * Math.cos(rad), y: cy + ry * Math.sin(rad) };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"path-builder.js","sourceRoot":"","sources":["../../../src/render/descriptors/path-builder.ts"],"names":[],"mappings":"AAsBA,MAAM,OAAO,WAAW;IACZ,KAAK,GAAkB,EAAE,CAAC;IAC1B,EAAE,GAAG,CAAC,CAAC;IACP,EAAE,GAAG,CAAC,CAAC;IACP,OAAO,GAAG,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC,CAAC;IACZ,KAAK,GAAG,KAAK,CAAC;IAEtB,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,aAAa,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,CAAS,EAAE,CAAS;QAC9E,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,GAAG,C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IAAI,GAAG;KAC1B,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,KAAa;IAC1E,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACpC,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { PathCommand } from \"./path\";\r\nimport type { PathState } from \"./path\";\r\n\r\n/**\r\n * A full or partial revolution of an ellipse, in the same **y-up** space the\r\n * commands themselves are authored in (`y = 100` is 100px *above* the centre,\r\n * matching a node's `x`/`y`). Angles are degrees from 3 o'clock, positive\r\n * counter-clockwise — the vocabulary the `Ellipse` node already uses.\r\n */\r\nexport interface EllipseArc {\r\n /** Centre. Both default to the origin. */\r\n x?: number;\r\n y?: number;\r\n width: number;\r\n /** Defaults to `width`, i.e. a circle. */\r\n height?: number;\r\n /** Where on the perimeter the curve starts. */\r\n startAngle?: number;\r\n /** Degrees travelled; negative goes clockwise. Past ±360 it keeps looping. */\r\n sweep?: number;\r\n}\r\n\r\nexport class PathBuilder {\r\n private _cmds: PathCommand[] = [];\r\n private _x = 0;\r\n private _y = 0;\r\n private _startX = 0;\r\n private _startY = 0;\r\n private _open = false;\r\n\r\n moveTo(x: number, y: number): this {\r\n this._cmds.push({ type: \"M\", x, y });\r\n this._startX = x;\r\n this._startY = y;\r\n return this._at(x, y);\r\n }\r\n\r\n lineTo(x: number, y: number): this {\r\n this._cmds.push({ type: \"L\", x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): this {\r\n this._cmds.push({ type: \"C\", x1, y1, x2, y2, x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n quadraticCurveTo(x1: number, y1: number, x: number, y: number): this {\r\n this._cmds.push({ type: \"Q\", x1, y1, x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n /** The raw SVG arc command: an elliptical arc to (`x`, `y`), picked out of the four candidates by `largeArc`/`sweep`. */\r\n arcTo(rx: number, ry: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1, x: number, y: number): this {\r\n this._cmds.push({ type: \"A\", rx, ry, rotation, largeArc, sweep, x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n /**\r\n * An **open** elliptical arc: the perimeter of {@link EllipseArc} from\r\n * `startAngle` through `sweep` degrees.\r\n *\r\n * Continues the current subpath — a straight line joins the pen's position\r\n * to the arc's start when the two differ — so `moveTo(...).arc(...)` is one\r\n * unbroken curve, which is what a `moveTo` command following the path needs.\r\n * A new `M` there would be a subpath break the walk teleports across.\r\n *\r\n * ```ts\r\n * new PathBuilder().arc({ x: 0, y: 0, width: 400, startAngle: 180, sweep: -180 });\r\n * ```\r\n */\r\n arc(arc: EllipseArc): this {\r\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\r\n const start = pointOn(cx, cy, rx, ry, from);\r\n if (!this._open) this.moveTo(start.x, start.y);\r\n else if (start.x !== this._x || start.y !== this._y) this.lineTo(start.x, start.y);\r\n return this._sweep(cx, cy, rx, ry, from, sweep);\r\n }\r\n\r\n /**\r\n * A **closed** subpath tracing an ellipse — the shape form of {@link arc}.\r\n *\r\n * A `sweep` short of a full turn closes across the chord back to the start;\r\n * for a pie wedge or an annular sector, that is an `Ellipse` node's `ratio`.\r\n */\r\n ellipse(arc: EllipseArc): this {\r\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\r\n const start = pointOn(cx, cy, rx, ry, from);\r\n this.moveTo(start.x, start.y);\r\n this._sweep(cx, cy, rx, ry, from, sweep);\r\n return this.close();\r\n }\r\n\r\n close(): this {\r\n this._cmds.push({ type: \"Z\" });\r\n return this._at(this._startX, this._startY);\r\n }\r\n\r\n toCommands(): PathCommand[] {\r\n return [...this._cmds];\r\n }\r\n\r\n toPathState(partial: Omit<Partial<PathState>, \"data\"> = {}): Partial<PathState> {\r\n return { ...partial, data: this._cmds };\r\n }\r\n\r\n /** Record where the pen ended up, so {@link arc} knows whether it has to join up to its start. */\r\n private _at(x: number, y: number): this {\r\n this._x = x;\r\n this._y = y;\r\n this._open = true;\r\n return this;\r\n }\r\n\r\n /**\r\n * Emit the arc as segments of at most a quarter turn. One `A` command cannot\r\n * express a full revolution at all (its endpoints would coincide, leaving the\r\n * arc undefined) and grows imprecise well before that, so the split is what\r\n * makes `sweep` a real angle rather than a value capped just under 360.\r\n */\r\n private _sweep(cx: number, cy: number, rx: number, ry: number, from: number, sweep: number): this {\r\n if (sweep === 0) return this;\r\n const steps = Math.ceil(Math.abs(sweep) / 90);\r\n const step = sweep / steps;\r\n const direction = sweep > 0 ? 1 : 0;\r\n for (let i = 1; i <= steps; i++) {\r\n const p = pointOn(cx, cy, rx, ry, from + step * i);\r\n this.arcTo(rx, ry, 0, 0, direction, p.x, p.y);\r\n }\r\n return this;\r\n }\r\n}\r\n\r\nfunction resolveArc(arc: EllipseArc): { cx: number; cy: number; rx: number; ry: number; from: number; sweep: number } {\r\n return {\r\n cx: arc.x ?? 0,\r\n cy: arc.y ?? 0,\r\n rx: arc.width / 2,\r\n ry: (arc.height ?? arc.width) / 2,\r\n from: arc.startAngle ?? 0,\r\n sweep: arc.sweep ?? 360,\r\n };\r\n}\r\n\r\nfunction pointOn(cx: number, cy: number, rx: number, ry: number, angle: number): { x: number; y: number } {\r\n const rad = (angle * Math.PI) / 180;\r\n return { x: cx + rx * Math.cos(rad), y: cy + ry * Math.sin(rad) };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/render/descriptors/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,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AAU,CAAC,KAAK,CAAC;QAE1C,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE;QAC3B,YAAY,EAAE,UAAU,CAAC,YAAY;KACxC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeState, resolveShapePivot } from \"./shape\";\n\nexport type PathCommand =\n | { type: \"M\"; x: number; y: number }\n | { type: \"m\"; x: number; y: number }\n | { type: \"L\"; x: number; y: number }\n | { type: \"l\"; x: number; y: number }\n | { type: \"H\"; x: number }\n | { type: \"h\"; x: number }\n | { type: \"V\"; y: number }\n | { type: \"v\"; y: number }\n | { type: \"C\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\n | { type: \"c\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\n | { type: \"S\"; x2: number; y2: number; x: number; y: number }\n | { type: \"s\"; x2: number; y2: number; x: number; y: number }\n | { type: \"Q\"; x1: number; y1: number; x: number; y: number }\n | { type: \"q\"; x1: number; y1: number; x: number; y: number }\n | { type: \"T\"; x: number; y: number }\n | { type: \"t\"; x: number; y: number }\n | { type: \"A\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\n | { type: \"a\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\n | { type: \"Z\" | \"z\" };\n\n\n\nexport type PathData = string | PathCommand[];\n\nexport function toPathString(d: PathData): string {\n if (typeof d === \"string\") return d;\n return d.map(cmd => {\n switch (cmd.type) {\n case \"M\": case \"m\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\n case \"L\": case \"l\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\n case \"T\": case \"t\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\n case \"H\": case \"h\": return `${cmd.type} ${cmd.x}`;\n case \"V\": case \"v\": return `${cmd.type} ${cmd.y}`;\n case \"C\": case \"c\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\n case \"S\": case \"s\": return `${cmd.type} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\n case \"Q\": case \"q\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x} ${cmd.y}`;\n case \"A\": case \"a\": return `${cmd.type} ${cmd.rx} ${cmd.ry} ${cmd.rotation} ${cmd.largeArc} ${cmd.sweep} ${cmd.x} ${cmd.y}`;\n case \"Z\": case \"z\": return cmd.type;\n }\n }).join(\" \");\n}\n\n/** An axis-aligned bounding box in path coordinates: [minX, minY, maxX, maxY]. */\nexport type PathBounds = readonly [number, number, number, number];\n\nexport interface PathState extends ShapeState {\n data: PathData;\n /**\n * Explicit frame to center the path against, as [minX, minY, maxX, maxY] in\n * the path's own coordinate space. When set, the path is shifted so this\n * box's center lands on the local origin — instead of the path centering on\n * its *own* bbox.\n *\n * Use this when several paths share one layout frame (e.g. per-glyph LaTeX\n * tokens). Passing the same whole-shape bounds to every path keeps their\n * relative positions intact, where per-path self-centering would collapse\n * them onto a single point. When unset, the path centers on its own bbox.\n */\n centerBounds?: PathBounds;\n}\n\nexport function withPathDescriptor(descriptor: Partial<PathState>): PathState {\n return {\n opacity: descriptor.opacity ?? 1,\n\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x: descriptor.x ?? 0,\n y: descriptor.y ?? 0,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n width: descriptor.width ?? 0,\n height: descriptor.height ?? 0,\n pivot: resolveShapePivot(descriptor.pivot),\n\n data: descriptor.data ?? \"\",\n centerBounds: descriptor.centerBounds,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/render/descriptors/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA2BxD,MAAM,UAAU,YAAY,CAAC,CAAW;IACpC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;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AY;KACxC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeState, resolveShapePivot } from \"./shape\";\r\n\r\nexport type PathCommand =\r\n | { type: \"M\"; x: number; y: number }\r\n | { type: \"m\"; x: number; y: number }\r\n | { type: \"L\"; x: number; y: number }\r\n | { type: \"l\"; x: number; y: number }\r\n | { type: \"H\"; x: number }\r\n | { type: \"h\"; x: number }\r\n | { type: \"V\"; y: number }\r\n | { type: \"v\"; y: number }\r\n | { type: \"C\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\r\n | { type: \"c\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\r\n | { type: \"S\"; x2: number; y2: number; x: number; y: number }\r\n | { type: \"s\"; x2: number; y2: number; x: number; y: number }\r\n | { type: \"Q\"; x1: number; y1: number; x: number; y: number }\r\n | { type: \"q\"; x1: number; y1: number; x: number; y: number }\r\n | { type: \"T\"; x: number; y: number }\r\n | { type: \"t\"; x: number; y: number }\r\n | { type: \"A\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\r\n | { type: \"a\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\r\n | { type: \"Z\" | \"z\" };\r\n\r\n\r\n\r\nexport type PathData = string | PathCommand[];\r\n\r\nexport function toPathString(d: PathData): string {\r\n if (typeof d === \"string\") return d;\r\n return d.map(cmd => {\r\n switch (cmd.type) {\r\n case \"M\": case \"m\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\r\n case \"L\": case \"l\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\r\n case \"T\": case \"t\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\r\n case \"H\": case \"h\": return `${cmd.type} ${cmd.x}`;\r\n case \"V\": case \"v\": return `${cmd.type} ${cmd.y}`;\r\n case \"C\": case \"c\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\r\n case \"S\": case \"s\": return `${cmd.type} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\r\n case \"Q\": case \"q\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x} ${cmd.y}`;\r\n case \"A\": case \"a\": return `${cmd.type} ${cmd.rx} ${cmd.ry} ${cmd.rotation} ${cmd.largeArc} ${cmd.sweep} ${cmd.x} ${cmd.y}`;\r\n case \"Z\": case \"z\": return cmd.type;\r\n }\r\n }).join(\" \");\r\n}\r\n\r\n/** An axis-aligned bounding box in path coordinates: [minX, minY, maxX, maxY]. */\r\nexport type PathBounds = readonly [number, number, number, number];\r\n\r\nexport interface PathState extends ShapeState {\r\n data: PathData;\r\n /**\r\n * Explicit frame to center the path against, as [minX, minY, maxX, maxY] in\r\n * the path's own coordinate space. When set, the path is shifted so this\r\n * box's center lands on the local origin — instead of the path centering on\r\n * its *own* bbox.\r\n *\r\n * Use this when several paths share one layout frame (e.g. per-glyph LaTeX\r\n * tokens). Passing the same whole-shape bounds to every path keeps their\r\n * relative positions intact, where per-path self-centering would collapse\r\n * them onto a single point. When unset, the path centers on its own bbox.\r\n */\r\n centerBounds?: PathBounds;\r\n}\r\n\r\nexport function withPathDescriptor(descriptor: Partial<PathState>): PathState {\r\n return {\r\n opacity: descriptor.opacity ?? 1,\r\n\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x: descriptor.x ?? 0,\r\n y: descriptor.y ?? 0,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n pivot: resolveShapePivot(descriptor.pivot),\r\n\r\n data: descriptor.data ?? \"\",\r\n centerBounds: descriptor.centerBounds,\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\nexport interface PolygonState extends ShapeState {\n width: number;\n height: number;\n sides: number;\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\n cornerRadius: number;\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\n cornerStyle: CornerStyle;\n}\n\nexport function withPolygonDescriptor(descriptor: Partial<PolygonState> & ShapeAlignmentInput): PolygonState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n sides: descriptor.sides ?? 5,\n cornerRadius: descriptor.cornerRadius ?? 0,\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\nexport interface PolygonState extends ShapeState {\r\n width: number;\r\n height: number;\r\n sides: number;\r\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\r\n cornerRadius: number;\r\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\r\n cornerStyle: CornerStyle;\r\n}\r\n\r\nexport function withPolygonDescriptor(descriptor: Partial<PolygonState> & ShapeAlignmentInput): PolygonState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n sides: descriptor.sides ?? 5,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygram.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygram.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\nexport interface PolygramState extends ShapeState {\n width: number;\n height: number;\n sides: number;\n ratio: number;\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\n cornerRadius: number;\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\n cornerStyle: CornerStyle;\n}\n\nexport function withPolygramDescriptor(descriptor: Partial<PolygramState> & ShapeAlignmentInput): PolygramState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n sides: descriptor.sides ?? 5,\n ratio: descriptor.ratio ?? 0.5,\n cornerRadius: descriptor.cornerRadius ?? 0,\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"polygram.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygram.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\nexport interface PolygramState extends ShapeState {\r\n width: number;\r\n height: number;\r\n sides: number;\r\n ratio: number;\r\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\r\n cornerRadius: number;\r\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\r\n cornerStyle: CornerStyle;\r\n}\r\n\r\nexport function withPolygramDescriptor(descriptor: Partial<PolygramState> & ShapeAlignmentInput): PolygramState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n sides: descriptor.sides ?? 5,\r\n ratio: descriptor.ratio ?? 0.5,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\n\nexport interface RectState extends ShapeState {\n width: number;\n height: number;\n // Accepts loose input or an already-resolved value (both are part of\n // RectCornerRadius/RectCornerStyle): the node resolves via its @property\n // mapper, and the renderer re-resolves idempotently.\n cornerRadius: RectCornerRadius;\n cornerStyle: RectCornerStyle;\n}\n\nexport function withRectDescriptor(descriptor: Partial<RectState> & ShapeAlignmentInput): RectState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n cornerRadius: descriptor.cornerRadius ?? 0,\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\n\r\nexport interface RectState extends ShapeState {\r\n width: number;\r\n height: number;\r\n // Accepts loose input or an already-resolved value (both are part of\r\n // RectCornerRadius/RectCornerStyle): the node resolves via its @property\r\n // mapper, and the renderer re-resolves idempotently.\r\n cornerRadius: RectCornerRadius;\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\nexport function withRectDescriptor(descriptor: Partial<RectState> & ShapeAlignmentInput): RectState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richtext.js","sourceRoot":"","sources":["../../../src/render/descriptors/richtext.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;QAC7B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,GAAG;QACxC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,KAAK;QACL,MAAM;KACT,CAAC;AACN,CAAC","sourcesContent":["import type { ResolvedTextSpan, TextAlign } from \"@/attributes/text/types\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\nexport interface RichTextState extends ShapeState {\n spans: ResolvedTextSpan[];\n /** A named typography preset — see {@link TextState.variant}. Applied per span. */\n variant?: string;\n lineHeight: number;\n textAlign: TextAlign;\n width: number;\n height: number;\n}\n\nexport function withRichTextDescriptor(descriptor: Partial<RichTextState> & ShapeAlignmentInput): RichTextState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n spans: descriptor.spans ?? [],\n lineHeight: descriptor.lineHeight ?? 1.2,\n textAlign: descriptor.textAlign ?? 'center',\n width,\n height,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"richtext.js","sourceRoot":"","sources":["../../../src/render/descriptors/richtext.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;QAC7B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,GAAG;QACxC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,KAAK;QACL,MAAM;KACT,CAAC;AACN,CAAC","sourcesContent":["import type { ResolvedTextSpan, TextAlign } from \"@/attributes/text/types\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\nexport interface RichTextState extends ShapeState {\r\n spans: ResolvedTextSpan[];\r\n /** A named typography preset — see {@link TextState.variant}. Applied per span. */\r\n variant?: string;\r\n lineHeight: number;\r\n textAlign: TextAlign;\r\n width: number;\r\n height: number;\r\n}\r\n\r\nexport function withRichTextDescriptor(descriptor: Partial<RichTextState> & ShapeAlignmentInput): RichTextState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n spans: descriptor.spans ?? [],\r\n lineHeight: descriptor.lineHeight ?? 1.2,\r\n textAlign: descriptor.textAlign ?? 'center',\r\n width,\r\n height,\r\n };\r\n}\r\n"]}
|