@motionscript/core 0.1.0-alpha.3 → 0.1.0-alpha.6
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 +247 -0
- package/LICENSE +201 -201
- package/NOTICE +48 -0
- package/README.md +93 -72
- package/dist/assets/asset-index.js.map +1 -1
- package/dist/assets/catalog.d.ts +9 -0
- package/dist/assets/catalog.d.ts.map +1 -1
- package/dist/assets/catalog.js +11 -0
- package/dist/assets/catalog.js.map +1 -1
- package/dist/assets/errors.d.ts.map +1 -1
- package/dist/assets/errors.js +8 -3
- package/dist/assets/errors.js.map +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/manager.d.ts +26 -1
- package/dist/assets/manager.d.ts.map +1 -1
- package/dist/assets/manager.js +79 -4
- package/dist/assets/manager.js.map +1 -1
- package/dist/assets/manifest.js.map +1 -1
- package/dist/assets/record.js.map +1 -1
- package/dist/assets/scope.d.ts +3 -3
- package/dist/assets/scope.d.ts.map +1 -1
- package/dist/assets/scope.js.map +1 -1
- package/dist/attributes/audio/filters/chain.d.ts +1 -1
- package/dist/attributes/audio/filters/chain.js.map +1 -1
- package/dist/attributes/audio/filters/curve.d.ts +8 -8
- package/dist/attributes/audio/filters/curve.d.ts.map +1 -1
- package/dist/attributes/audio/filters/curve.js +20 -19
- package/dist/attributes/audio/filters/curve.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/gain.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/highpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/lowpass.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/speed.d.ts +2 -2
- package/dist/attributes/audio/filters/implementations/speed.js.map +1 -1
- package/dist/attributes/audio/filters/implementations/tremolo.js.map +1 -1
- package/dist/attributes/audio/filters/index.d.ts +1 -1
- package/dist/attributes/audio/filters/index.d.ts.map +1 -1
- package/dist/attributes/audio/filters/index.js +1 -1
- package/dist/attributes/audio/filters/index.js.map +1 -1
- package/dist/attributes/audio/filters/registry.js.map +1 -1
- package/dist/attributes/audio/filters/union.js.map +1 -1
- package/dist/attributes/audio/request.d.ts +17 -2
- package/dist/attributes/audio/request.d.ts.map +1 -1
- package/dist/attributes/audio/request.js.map +1 -1
- package/dist/attributes/audio/schedule.d.ts +4 -2
- package/dist/attributes/audio/schedule.d.ts.map +1 -1
- package/dist/attributes/audio/schedule.js +15 -8
- package/dist/attributes/audio/schedule.js.map +1 -1
- package/dist/attributes/audio/sound.d.ts +4 -2
- package/dist/attributes/audio/sound.d.ts.map +1 -1
- package/dist/attributes/audio/sound.js +8 -4
- package/dist/attributes/audio/sound.js.map +1 -1
- package/dist/attributes/index.js.map +1 -1
- package/dist/attributes/layout/alignment.js +1 -1
- package/dist/attributes/layout/alignment.js.map +1 -1
- package/dist/attributes/layout/index.js.map +1 -1
- package/dist/attributes/layout/insets.js.map +1 -1
- package/dist/attributes/layout/matrix2d.js.map +1 -1
- package/dist/attributes/layout/size.js.map +1 -1
- package/dist/attributes/layout/transform3d.js.map +1 -1
- package/dist/attributes/layout/vector2.js.map +1 -1
- package/dist/attributes/layout/world-transform.js.map +1 -1
- package/dist/attributes/mask/boolean.js.map +1 -1
- package/dist/attributes/mask/mask.js.map +1 -1
- package/dist/attributes/properties/decorator.d.ts +3 -1
- package/dist/attributes/properties/decorator.d.ts.map +1 -1
- package/dist/attributes/properties/decorator.js.map +1 -1
- package/dist/attributes/properties/inputs.js.map +1 -1
- package/dist/attributes/properties/typed.d.ts +9 -2
- package/dist/attributes/properties/typed.d.ts.map +1 -1
- package/dist/attributes/properties/typed.js +15 -1
- package/dist/attributes/properties/typed.js.map +1 -1
- package/dist/attributes/render3d/orbit.d.ts +8 -8
- package/dist/attributes/render3d/orbit.js +7 -7
- package/dist/attributes/render3d/orbit.js.map +1 -1
- package/dist/attributes/shape/corners/corner-radius.js.map +1 -1
- package/dist/attributes/shape/corners/corner-style.js.map +1 -1
- package/dist/attributes/shape/corners/corners.js.map +1 -1
- package/dist/attributes/shape/corners/index.js.map +1 -1
- package/dist/attributes/shape/effects/backdrop.d.ts +4 -4
- package/dist/attributes/shape/effects/backdrop.d.ts.map +1 -1
- package/dist/attributes/shape/effects/backdrop.js.map +1 -1
- package/dist/attributes/shape/effects/chain.d.ts +28 -120
- package/dist/attributes/shape/effects/chain.d.ts.map +1 -1
- package/dist/attributes/shape/effects/chain.js +16 -88
- package/dist/attributes/shape/effects/chain.js.map +1 -1
- package/dist/attributes/shape/effects/effect-data.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/ascii.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bit-crush.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/block-displace.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bloom.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/bulge.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/chromatic-aberration.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/color-adjustment.d.ts +2 -2
- package/dist/attributes/shape/effects/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/curves.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/directional-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/dither.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/drop-shadow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/duotone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/edges.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.d.ts +15 -24
- package/dist/attributes/shape/effects/implementations/glass.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/glass.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/glow.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grain.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/halftone.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/invert.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/kaleidoscope.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/lut.d.ts +1 -1
- package/dist/attributes/shape/effects/implementations/lut.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/magnify.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/motion-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/oil-paint.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/outline.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/pixelate.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/posterize.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/progressive-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/radial-blur.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/rgb-shift.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scanlines.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/scatter.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.d.ts.map +1 -1
- package/dist/attributes/shape/effects/implementations/shader.js +15 -8
- package/dist/attributes/shape/effects/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/sharpen.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/streak.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/threshold.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/twirl.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vignette.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/vintage.js.map +1 -1
- package/dist/attributes/shape/effects/implementations/wave.js.map +1 -1
- package/dist/attributes/shape/effects/index.d.ts +2 -6
- package/dist/attributes/shape/effects/index.d.ts.map +1 -1
- package/dist/attributes/shape/effects/index.js.map +1 -1
- package/dist/attributes/shape/effects/registry.d.ts +23 -6
- package/dist/attributes/shape/effects/registry.d.ts.map +1 -1
- package/dist/attributes/shape/effects/registry.js +44 -10
- package/dist/attributes/shape/effects/registry.js.map +1 -1
- package/dist/attributes/shape/effects/union.d.ts +2 -6
- package/dist/attributes/shape/effects/union.d.ts.map +1 -1
- package/dist/attributes/shape/effects/union.js.map +1 -1
- package/dist/attributes/shape/fill/blend.js.map +1 -1
- package/dist/attributes/shape/fill/chain.js.map +1 -1
- package/dist/attributes/shape/fill/coerce.js.map +1 -1
- package/dist/attributes/shape/fill/color/constants.js.map +1 -1
- package/dist/attributes/shape/fill/color/parser.d.ts.map +1 -1
- package/dist/attributes/shape/fill/color/parser.js +81 -44
- package/dist/attributes/shape/fill/color/parser.js.map +1 -1
- package/dist/attributes/shape/fill/gradient-stops.d.ts +16 -0
- package/dist/attributes/shape/fill/gradient-stops.d.ts.map +1 -0
- package/dist/attributes/shape/fill/gradient-stops.js +65 -0
- package/dist/attributes/shape/fill/gradient-stops.js.map +1 -0
- package/dist/attributes/shape/fill/implementations/canvas3d.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/color.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/conic-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/conic-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/dot-grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/fractal-noise.js +2 -10
- package/dist/attributes/shape/fill/implementations/fractal-noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/grid.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/image.js +5 -4
- package/dist/attributes/shape/fill/implementations/image.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/linear-gradient.js +2 -6
- package/dist/attributes/shape/fill/implementations/linear-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/noise.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.d.ts.map +1 -1
- package/dist/attributes/shape/fill/implementations/radial-gradient.js +2 -5
- package/dist/attributes/shape/fill/implementations/radial-gradient.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/shader.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/stripe.js.map +1 -1
- package/dist/attributes/shape/fill/implementations/video.js +1 -1
- package/dist/attributes/shape/fill/implementations/video.js.map +1 -1
- package/dist/attributes/shape/fill/index.js.map +1 -1
- package/dist/attributes/shape/fill/lerp.js.map +1 -1
- package/dist/attributes/shape/fill/media-preset.js.map +1 -1
- package/dist/attributes/shape/fill/registry.js.map +1 -1
- package/dist/attributes/shape/fill/union.js.map +1 -1
- package/dist/attributes/shape/filters/chain.d.ts +4 -10
- package/dist/attributes/shape/filters/chain.d.ts.map +1 -1
- package/dist/attributes/shape/filters/chain.js +1 -13
- package/dist/attributes/shape/filters/chain.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/alpha.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/blur.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-adjustment.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/color-matrix.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/curves.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/echo.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/exposure.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/grayscale.js.map +1 -1
- package/dist/attributes/shape/filters/implementations/posterize-time.js.map +1 -1
- package/dist/attributes/shape/filters/index.d.ts +1 -1
- package/dist/attributes/shape/filters/index.js.map +1 -1
- package/dist/attributes/shape/filters/registry.d.ts +2 -2
- package/dist/attributes/shape/filters/registry.js +3 -3
- package/dist/attributes/shape/filters/registry.js.map +1 -1
- package/dist/attributes/shape/filters/union.d.ts +6 -7
- package/dist/attributes/shape/filters/union.d.ts.map +1 -1
- package/dist/attributes/shape/filters/union.js.map +1 -1
- package/dist/attributes/shape/path/anchors.d.ts.map +1 -1
- package/dist/attributes/shape/path/anchors.js +12 -5
- package/dist/attributes/shape/path/anchors.js.map +1 -1
- package/dist/attributes/shape/path/bezier.js.map +1 -1
- package/dist/attributes/shape/path/index.js.map +1 -1
- package/dist/attributes/shape/path/measure.js.map +1 -1
- package/dist/attributes/shape/path/morph.d.ts.map +1 -1
- package/dist/attributes/shape/path/morph.js +16 -4
- package/dist/attributes/shape/path/morph.js.map +1 -1
- package/dist/attributes/shape/path/ops.js.map +1 -1
- package/dist/attributes/shape/path/types.js.map +1 -1
- package/dist/attributes/shape/path/walk.js.map +1 -1
- package/dist/attributes/shape/shaders/index.js.map +1 -1
- package/dist/attributes/shape/shaders/pack.js.map +1 -1
- package/dist/attributes/shape/shaders/resolve.js.map +1 -1
- package/dist/attributes/shape/shadow/index.js.map +1 -1
- package/dist/attributes/shape/shadow/shadow.js.map +1 -1
- package/dist/attributes/shape/stroke/index.d.ts +2 -2
- package/dist/attributes/shape/stroke/index.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/index.js +1 -1
- package/dist/attributes/shape/stroke/index.js.map +1 -1
- package/dist/attributes/shape/stroke/stroke.d.ts +27 -6
- package/dist/attributes/shape/stroke/stroke.d.ts.map +1 -1
- package/dist/attributes/shape/stroke/stroke.js +22 -2
- package/dist/attributes/shape/stroke/stroke.js.map +1 -1
- package/dist/attributes/shared/operators.js.map +1 -1
- package/dist/attributes/text/index.js.map +1 -1
- package/dist/attributes/text/ops.d.ts +6 -0
- package/dist/attributes/text/ops.d.ts.map +1 -1
- package/dist/attributes/text/ops.js +1 -0
- package/dist/attributes/text/ops.js.map +1 -1
- package/dist/attributes/text/types.js.map +1 -1
- package/dist/browser/chunks/chunk-2RIYH36X.js +3 -0
- package/dist/browser/chunks/chunk-2RIYH36X.js.map +7 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js +15 -0
- package/dist/browser/chunks/chunk-DDJN3QII.js.map +7 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js +2 -0
- package/dist/browser/chunks/chunk-DHB4COFY.js.map +7 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.js +5 -0
- package/dist/browser/chunks/chunk-EJDPYDQI.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/chunks/chunk-XAWE4EAK.js +2 -0
- package/dist/browser/chunks/chunk-XAWE4EAK.js.map +7 -0
- package/dist/browser/component.js +1 -1
- package/dist/browser/component.js.map +4 -4
- package/dist/browser/experimental.js +2 -0
- package/dist/browser/experimental.js.map +7 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/jsx-jsx-dev-runtime.js +1 -1
- package/dist/browser/jsx-jsx-runtime.js +1 -1
- package/dist/browser/manifest.json +4 -2
- package/dist/browser/sdk.js +1 -1
- package/dist/component/api.d.ts +508 -0
- package/dist/component/api.d.ts.map +1 -0
- package/dist/component/api.js +4 -0
- package/dist/component/api.js.map +1 -0
- package/dist/component/builtins/audio.d.ts +26 -0
- package/dist/component/builtins/audio.d.ts.map +1 -0
- package/dist/component/builtins/audio.js +41 -0
- package/dist/component/builtins/audio.js.map +1 -0
- package/dist/component/builtins/canvas3d.d.ts +98 -0
- package/dist/component/builtins/canvas3d.d.ts.map +1 -0
- package/dist/component/builtins/canvas3d.js +21 -0
- package/dist/component/builtins/canvas3d.js.map +1 -0
- package/dist/component/builtins/composite.d.ts +56 -0
- package/dist/component/builtins/composite.d.ts.map +1 -0
- package/dist/component/builtins/composite.js +25 -0
- package/dist/component/builtins/composite.js.map +1 -0
- package/dist/component/builtins/geometry.d.ts +505 -0
- package/dist/component/builtins/geometry.d.ts.map +1 -0
- package/dist/component/builtins/geometry.js +107 -0
- package/dist/component/builtins/geometry.js.map +1 -0
- package/dist/component/builtins/layout.d.ts +88 -0
- package/dist/component/builtins/layout.d.ts.map +1 -0
- package/dist/component/builtins/layout.js +84 -0
- package/dist/component/builtins/layout.js.map +1 -0
- package/dist/component/builtins/media.d.ts +95 -0
- package/dist/component/builtins/media.d.ts.map +1 -0
- package/dist/component/builtins/media.js +149 -0
- package/dist/component/builtins/media.js.map +1 -0
- package/dist/component/builtins/providers.d.ts +23 -0
- package/dist/component/builtins/providers.d.ts.map +1 -0
- package/dist/component/builtins/providers.js +30 -0
- package/dist/component/builtins/providers.js.map +1 -0
- package/dist/component/builtins/text.d.ts +193 -0
- package/dist/component/builtins/text.d.ts.map +1 -0
- package/dist/component/builtins/text.js +113 -0
- package/dist/component/builtins/text.js.map +1 -0
- package/dist/component/builtins/three.d.ts +1085 -0
- package/dist/component/builtins/three.d.ts.map +1 -0
- package/dist/component/builtins/three.js +265 -0
- package/dist/component/builtins/three.js.map +1 -0
- package/dist/component/clip-of.d.ts +5 -0
- package/dist/component/clip-of.d.ts.map +1 -0
- package/dist/component/clip-of.js +33 -0
- package/dist/component/clip-of.js.map +1 -0
- package/dist/component/commands-for.d.ts +19 -0
- package/dist/component/commands-for.d.ts.map +1 -0
- package/dist/component/commands-for.js +5 -0
- package/dist/component/commands-for.js.map +1 -0
- package/dist/component/component-audio.d.ts +9 -0
- package/dist/component/component-audio.d.ts.map +1 -0
- package/dist/component/component-audio.js +18 -0
- package/dist/component/component-audio.js.map +1 -0
- package/dist/component/component2d.d.ts +9 -0
- package/dist/component/component2d.d.ts.map +1 -0
- package/dist/component/component2d.js +239 -0
- package/dist/component/component2d.js.map +1 -0
- package/dist/component/component3d.d.ts +9 -0
- package/dist/component/component3d.d.ts.map +1 -0
- package/dist/component/component3d.js +99 -0
- package/dist/component/component3d.js.map +1 -0
- package/dist/component/factory.d.ts +63 -0
- package/dist/component/factory.d.ts.map +1 -0
- package/dist/component/factory.js +313 -0
- package/dist/component/factory.js.map +1 -0
- package/dist/component/modules/aim.d.ts +30 -0
- package/dist/component/modules/aim.d.ts.map +1 -0
- package/dist/component/modules/aim.js +39 -0
- package/dist/component/modules/aim.js.map +1 -0
- package/dist/component/modules/corners.d.ts +13 -0
- package/dist/component/modules/corners.d.ts.map +1 -0
- package/dist/component/modules/corners.js +12 -0
- package/dist/component/modules/corners.js.map +1 -0
- package/dist/component/modules/flow.d.ts +26 -0
- package/dist/component/modules/flow.d.ts.map +1 -0
- package/dist/component/modules/flow.js +55 -0
- package/dist/component/modules/flow.js.map +1 -0
- package/dist/component/modules/material.d.ts +40 -0
- package/dist/component/modules/material.d.ts.map +1 -0
- package/dist/component/modules/material.js +75 -0
- package/dist/component/modules/material.js.map +1 -0
- package/dist/component/modules/paint.d.ts +71 -0
- package/dist/component/modules/paint.d.ts.map +1 -0
- package/dist/component/modules/paint.js +106 -0
- package/dist/component/modules/paint.js.map +1 -0
- package/dist/component/modules/shapes.d.ts +31 -0
- package/dist/component/modules/shapes.d.ts.map +1 -0
- package/dist/component/modules/shapes.js +43 -0
- package/dist/component/modules/shapes.js.map +1 -0
- package/dist/component/modules/text-layout.d.ts +26 -0
- package/dist/component/modules/text-layout.d.ts.map +1 -0
- package/dist/component/modules/text-layout.js +57 -0
- package/dist/component/modules/text-layout.js.map +1 -0
- package/dist/component/modules/text-style.d.ts +48 -0
- package/dist/component/modules/text-style.d.ts.map +1 -0
- package/dist/component/modules/text-style.js +63 -0
- package/dist/component/modules/text-style.js.map +1 -0
- package/dist/component/modules/three-entries.d.ts +23 -0
- package/dist/component/modules/three-entries.d.ts.map +1 -0
- package/dist/component/modules/three-entries.js +41 -0
- package/dist/component/modules/three-entries.js.map +1 -0
- package/dist/component/modules/view3d.d.ts +55 -0
- package/dist/component/modules/view3d.d.ts.map +1 -0
- package/dist/component/modules/view3d.js +160 -0
- package/dist/component/modules/view3d.js.map +1 -0
- package/dist/component/timeline.d.ts +22 -0
- package/dist/component/timeline.d.ts.map +1 -0
- package/dist/component/timeline.js +128 -0
- package/dist/component/timeline.js.map +1 -0
- package/dist/component/type-def.d.ts +26 -0
- package/dist/component/type-def.d.ts.map +1 -0
- package/dist/component/type-def.js +16 -0
- package/dist/component/type-def.js.map +1 -0
- package/dist/component/types.d.ts +91 -0
- package/dist/component/types.d.ts.map +1 -0
- package/dist/component/types.js +88 -0
- package/dist/component/types.js.map +1 -0
- package/dist/component/views.d.ts +121 -0
- package/dist/component/views.d.ts.map +1 -0
- package/dist/component/views.js +413 -0
- package/dist/component/views.js.map +1 -0
- package/dist/component.d.ts +4 -5
- package/dist/component.d.ts.map +1 -1
- package/dist/component.js +3 -5
- package/dist/component.js.map +1 -1
- package/dist/document/audio.d.ts +10 -2
- package/dist/document/audio.d.ts.map +1 -1
- package/dist/document/audio.js +45 -4
- package/dist/document/audio.js.map +1 -1
- package/dist/document/builtins.d.ts.map +1 -1
- package/dist/document/builtins.js +15 -39
- package/dist/document/builtins.js.map +1 -1
- package/dist/document/command-traits.d.ts +1 -1
- package/dist/document/command-traits.js +16 -1
- package/dist/document/command-traits.js.map +1 -1
- package/dist/document/deny-globals.js.map +1 -1
- package/dist/document/diff.d.ts.map +1 -1
- package/dist/document/diff.js +3 -3
- package/dist/document/diff.js.map +1 -1
- package/dist/document/doc-index.d.ts +2 -2
- package/dist/document/doc-index.d.ts.map +1 -1
- package/dist/document/doc-index.js +3 -3
- package/dist/document/doc-index.js.map +1 -1
- package/dist/document/expression/compile.d.ts.map +1 -1
- package/dist/document/expression/compile.js +8 -5
- package/dist/document/expression/compile.js.map +1 -1
- package/dist/document/expression/index.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 +25 -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 +23 -11
- package/dist/document/registry.d.ts.map +1 -1
- package/dist/document/registry.js +46 -19
- package/dist/document/registry.js.map +1 -1
- package/dist/document/settled-index.d.ts +49 -0
- package/dist/document/settled-index.d.ts.map +1 -0
- package/dist/document/settled-index.js +247 -0
- package/dist/document/settled-index.js.map +1 -0
- package/dist/document/timeline-patch.js.map +1 -1
- package/dist/document/timeline.d.ts +100 -19
- package/dist/document/timeline.d.ts.map +1 -1
- package/dist/document/timeline.js +290 -42
- 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/experimental.d.ts +22 -0
- package/dist/experimental.d.ts.map +1 -0
- package/dist/experimental.js +20 -0
- package/dist/experimental.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/jsx/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx/jsx-runtime.d.ts +9 -1
- package/dist/jsx/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx/jsx-runtime.js +13 -3
- package/dist/jsx/jsx-runtime.js.map +1 -1
- package/dist/layout/bounds.d.ts +0 -1
- package/dist/layout/bounds.d.ts.map +1 -1
- package/dist/layout/bounds.js.map +1 -1
- package/dist/layout/constraints.js.map +1 -1
- package/dist/layout/flex.d.ts +4 -2
- package/dist/layout/flex.d.ts.map +1 -1
- package/dist/layout/flex.js +27 -11
- package/dist/layout/flex.js.map +1 -1
- package/dist/layout/freeform.js.map +1 -1
- package/dist/layout/grid.js.map +1 -1
- package/dist/layout/index.js.map +1 -1
- package/dist/layout/item.js.map +1 -1
- package/dist/layout/ops.d.ts +6 -0
- package/dist/layout/ops.d.ts.map +1 -1
- package/dist/layout/ops.js +6 -0
- package/dist/layout/ops.js.map +1 -1
- package/dist/layout/types.js.map +1 -1
- package/dist/nodes/2d/node-lifecycle.js.map +1 -1
- package/dist/nodes/2d/node-motion.js.map +1 -1
- package/dist/nodes/2d/node-render.d.ts +3 -3
- package/dist/nodes/2d/node-render.d.ts.map +1 -1
- package/dist/nodes/2d/node-render.js.map +1 -1
- package/dist/nodes/2d/node-transform.js.map +1 -1
- package/dist/nodes/2d/node2d.d.ts +115 -3
- package/dist/nodes/2d/node2d.d.ts.map +1 -1
- package/dist/nodes/2d/node2d.js +180 -28
- package/dist/nodes/2d/node2d.js.map +1 -1
- package/dist/nodes/2d/paint-node.d.ts +27 -0
- package/dist/nodes/2d/paint-node.d.ts.map +1 -1
- package/dist/nodes/2d/paint-node.js +42 -0
- package/dist/nodes/2d/paint-node.js.map +1 -1
- package/dist/nodes/audio/audio-bus.js.map +1 -1
- package/dist/nodes/audio/index.d.ts +2 -2
- package/dist/nodes/audio/index.d.ts.map +1 -1
- package/dist/nodes/audio/index.js +0 -2
- package/dist/nodes/audio/index.js.map +1 -1
- package/dist/nodes/audio/node-audio.js.map +1 -1
- package/dist/nodes/audio/sound-node.d.ts +4 -3
- package/dist/nodes/audio/sound-node.d.ts.map +1 -1
- package/dist/nodes/audio/sound-node.js +4 -1
- package/dist/nodes/audio/sound-node.js.map +1 -1
- package/dist/nodes/geometry/bounds-shape-node.d.ts +4 -4
- package/dist/nodes/geometry/bounds-shape-node.js +2 -2
- package/dist/nodes/geometry/bounds-shape-node.js.map +1 -1
- package/dist/nodes/geometry/box-path-node.d.ts +3 -3
- package/dist/nodes/geometry/box-path-node.js +2 -2
- package/dist/nodes/geometry/box-path-node.js.map +1 -1
- package/dist/nodes/geometry/ellipse-node.js.map +1 -1
- package/dist/nodes/geometry/group-bounds.d.ts +2 -2
- package/dist/nodes/geometry/group-bounds.d.ts.map +1 -1
- package/dist/nodes/geometry/group-bounds.js +1 -2
- package/dist/nodes/geometry/group-bounds.js.map +1 -1
- package/dist/nodes/geometry/path-node.d.ts.map +1 -1
- package/dist/nodes/geometry/path-node.js +6 -0
- package/dist/nodes/geometry/path-node.js.map +1 -1
- package/dist/nodes/geometry/polygon-node.js.map +1 -1
- package/dist/nodes/geometry/polygram-node.js.map +1 -1
- package/dist/nodes/geometry/rect-node.js.map +1 -1
- package/dist/nodes/geometry/shape-node.js.map +1 -1
- package/dist/nodes/geometry/shape-outline.d.ts +2 -2
- package/dist/nodes/geometry/shape-outline.d.ts.map +1 -1
- package/dist/nodes/geometry/shape-outline.js +2 -13
- package/dist/nodes/geometry/shape-outline.js.map +1 -1
- package/dist/nodes/index.d.ts +40 -33
- package/dist/nodes/index.d.ts.map +1 -1
- package/dist/nodes/index.js +17 -36
- package/dist/nodes/index.js.map +1 -1
- package/dist/nodes/layout/camera-node.d.ts +9 -0
- package/dist/nodes/layout/camera-node.d.ts.map +1 -1
- package/dist/nodes/layout/camera-node.js +38 -3
- package/dist/nodes/layout/camera-node.js.map +1 -1
- package/dist/nodes/layout/orbit-camera-node.d.ts +1 -1
- package/dist/nodes/layout/orbit-camera-node.js +1 -1
- package/dist/nodes/layout/orbit-camera-node.js.map +1 -1
- package/dist/nodes/layout/rotated-box.js.map +1 -1
- package/dist/nodes/media/video-node.d.ts.map +1 -1
- package/dist/nodes/media/video-node.js +2 -0
- package/dist/nodes/media/video-node.js.map +1 -1
- package/dist/nodes/node/declare-paints.js.map +1 -1
- package/dist/nodes/node/node-editor-state.js.map +1 -1
- package/dist/nodes/node/node-reactive.js.map +1 -1
- package/dist/nodes/node/node-time.d.ts +3 -3
- package/dist/nodes/node/node-time.d.ts.map +1 -1
- package/dist/nodes/node/node-time.js +1 -1
- package/dist/nodes/node/node-time.js.map +1 -1
- package/dist/nodes/node/node-walk.js.map +1 -1
- package/dist/nodes/node/node.d.ts +12 -4
- package/dist/nodes/node/node.d.ts.map +1 -1
- package/dist/nodes/node/node.js +67 -27
- 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 +4 -3
- package/dist/nodes/root/canvas2d-node.d.ts.map +1 -0
- package/dist/nodes/{scene → root}/canvas2d-node.js +5 -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.d.ts +0 -5
- package/dist/nodes/text/richtext-node.d.ts.map +1 -1
- package/dist/nodes/text/richtext-node.js +6 -72
- package/dist/nodes/text/richtext-node.js.map +1 -1
- package/dist/nodes/text/text-base.d.ts +5 -22
- package/dist/nodes/text/text-base.d.ts.map +1 -1
- package/dist/nodes/text/text-base.js +13 -364
- package/dist/nodes/text/text-base.js.map +1 -1
- package/dist/nodes/text/text-layout.d.ts +87 -0
- package/dist/nodes/text/text-layout.d.ts.map +1 -0
- package/dist/nodes/text/text-layout.js +368 -0
- package/dist/nodes/text/text-layout.js.map +1 -0
- 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 +32 -7
- package/dist/nodes/three/canvas3d-node.d.ts.map +1 -1
- package/dist/nodes/three/canvas3d-node.js +50 -2
- package/dist/nodes/three/canvas3d-node.js.map +1 -1
- package/dist/nodes/three/drawable-nodes.d.ts +25 -11
- package/dist/nodes/three/drawable-nodes.d.ts.map +1 -1
- package/dist/nodes/three/drawable-nodes.js +43 -13
- package/dist/nodes/three/drawable-nodes.js.map +1 -1
- package/dist/nodes/three/environment-nodes.d.ts +9 -3
- package/dist/nodes/three/environment-nodes.d.ts.map +1 -1
- package/dist/nodes/three/environment-nodes.js.map +1 -1
- package/dist/nodes/three/geometry-nodes.d.ts +2 -2
- package/dist/nodes/three/geometry-nodes.js +2 -2
- package/dist/nodes/three/geometry-nodes.js.map +1 -1
- package/dist/nodes/three/grid-geometry3d.js.map +1 -1
- package/dist/nodes/three/group3d.js.map +1 -1
- package/dist/nodes/three/light-nodes.d.ts.map +1 -1
- package/dist/nodes/three/light-nodes.js +3 -3
- package/dist/nodes/three/light-nodes.js.map +1 -1
- package/dist/nodes/three/mesh3d.js.map +1 -1
- package/dist/nodes/three/node3d.d.ts +48 -0
- package/dist/nodes/three/node3d.d.ts.map +1 -1
- package/dist/nodes/three/node3d.js +53 -3
- package/dist/nodes/three/node3d.js.map +1 -1
- package/dist/platform/audio-sink.d.ts +2 -2
- package/dist/platform/audio-sink.d.ts.map +1 -1
- package/dist/platform/audio-sink.js.map +1 -1
- package/dist/platform/exporter.d.ts +13 -8
- package/dist/platform/exporter.d.ts.map +1 -1
- package/dist/platform/exporter.js.map +1 -1
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.d.ts.map +1 -1
- package/dist/platform/index.js.map +1 -1
- package/dist/platform/stepped-clock.js.map +1 -1
- package/dist/platform/storage-adapter.d.ts +12 -6
- package/dist/platform/storage-adapter.d.ts.map +1 -1
- package/dist/platform/storage-adapter.js +4 -0
- package/dist/platform/storage-adapter.js.map +1 -1
- package/dist/platform/ticker.d.ts +6 -0
- package/dist/platform/ticker.d.ts.map +1 -1
- package/dist/platform/ticker.js +6 -0
- package/dist/platform/ticker.js.map +1 -1
- package/dist/project/config.js.map +1 -1
- package/dist/project/index.js.map +1 -1
- package/dist/project/tree.d.ts +3 -3
- package/dist/project/tree.d.ts.map +1 -1
- package/dist/project/tree.js.map +1 -1
- package/dist/props/host.js.map +1 -1
- package/dist/props/index.js.map +1 -1
- package/dist/props/observer.js.map +1 -1
- package/dist/props/slot.js.map +1 -1
- package/dist/renamed-scene-names.d.ts +17 -0
- package/dist/renamed-scene-names.d.ts.map +1 -0
- package/dist/renamed-scene-names.js +9 -0
- package/dist/renamed-scene-names.js.map +1 -0
- package/dist/render/canvas-render-context2d.d.ts +2 -2
- package/dist/render/canvas-render-context2d.d.ts.map +1 -1
- package/dist/render/canvas-render-context2d.js.map +1 -1
- package/dist/render/clip-contains.js.map +1 -1
- package/dist/render/clip.js.map +1 -1
- package/dist/render/descriptors/ellipse.js.map +1 -1
- package/dist/render/descriptors/latex.js.map +1 -1
- package/dist/render/descriptors/line.js.map +1 -1
- package/dist/render/descriptors/path-builder.js.map +1 -1
- package/dist/render/descriptors/path.js.map +1 -1
- package/dist/render/descriptors/polygon.js.map +1 -1
- package/dist/render/descriptors/polygram.js.map +1 -1
- package/dist/render/descriptors/rect.js.map +1 -1
- package/dist/render/descriptors/richtext.js.map +1 -1
- package/dist/render/descriptors/shape.d.ts +12 -0
- package/dist/render/descriptors/shape.d.ts.map +1 -1
- package/dist/render/descriptors/shape.js.map +1 -1
- package/dist/render/descriptors/text.d.ts +2 -2
- package/dist/render/descriptors/text.js +2 -2
- package/dist/render/descriptors/text.js.map +1 -1
- package/dist/render/descriptors/transform.d.ts +2 -2
- package/dist/render/descriptors/transform.d.ts.map +1 -1
- package/dist/render/descriptors/transform.js.map +1 -1
- package/dist/render/graphics2d.d.ts +3 -3
- package/dist/render/graphics2d.d.ts.map +1 -1
- package/dist/render/graphics2d.js +1 -1
- package/dist/render/graphics2d.js.map +1 -1
- package/dist/render/index.js.map +1 -1
- package/dist/render/measure-context.js.map +1 -1
- package/dist/render/null-render-context.js.map +1 -1
- package/dist/render/render-context2d.d.ts +2 -2
- package/dist/render/render-context2d.d.ts.map +1 -1
- package/dist/render/render-context2d.js.map +1 -1
- package/dist/render/surface.js.map +1 -1
- package/dist/render/text-defaults.js.map +1 -1
- package/dist/render/text-layout.js.map +1 -1
- package/dist/render3d/bounds3d.d.ts.map +1 -1
- package/dist/render3d/bounds3d.js +4 -2
- package/dist/render3d/bounds3d.js.map +1 -1
- package/dist/render3d/builders.js.map +1 -1
- package/dist/render3d/camera.d.ts +6 -0
- package/dist/render3d/camera.d.ts.map +1 -1
- package/dist/render3d/camera.js +5 -3
- package/dist/render3d/camera.js.map +1 -1
- package/dist/render3d/fill3d.d.ts +2 -9
- package/dist/render3d/fill3d.d.ts.map +1 -1
- package/dist/render3d/fill3d.js +2 -13
- package/dist/render3d/fill3d.js.map +1 -1
- package/dist/render3d/geometry.d.ts +8 -1
- package/dist/render3d/geometry.d.ts.map +1 -1
- package/dist/render3d/geometry.js.map +1 -1
- package/dist/render3d/graphics3d.d.ts +8 -4
- package/dist/render3d/graphics3d.d.ts.map +1 -1
- package/dist/render3d/graphics3d.js +18 -10
- package/dist/render3d/graphics3d.js.map +1 -1
- package/dist/render3d/index.d.ts +1 -1
- package/dist/render3d/index.js +1 -1
- package/dist/render3d/index.js.map +1 -1
- package/dist/render3d/inert.d.ts +14 -0
- package/dist/render3d/inert.d.ts.map +1 -0
- package/dist/render3d/inert.js +62 -0
- package/dist/render3d/inert.js.map +1 -0
- package/dist/render3d/light.js.map +1 -1
- package/dist/render3d/material.d.ts +10 -5
- package/dist/render3d/material.d.ts.map +1 -1
- package/dist/render3d/material.js.map +1 -1
- package/dist/render3d/matrix4.js.map +1 -1
- package/dist/render3d/render-context3d.js.map +1 -1
- package/dist/render3d/resources.js.map +1 -1
- package/dist/render3d/rounded-box.js.map +1 -1
- package/dist/render3d/scene-settings.d.ts +23 -4
- package/dist/render3d/scene-settings.d.ts.map +1 -1
- package/dist/render3d/scene-settings.js.map +1 -1
- package/dist/render3d/scene3d.d.ts +11 -0
- package/dist/render3d/scene3d.d.ts.map +1 -1
- package/dist/render3d/scene3d.js +39 -6
- package/dist/render3d/scene3d.js.map +1 -1
- package/dist/render3d/segments.js.map +1 -1
- package/dist/render3d/texture.d.ts +9 -0
- package/dist/render3d/texture.d.ts.map +1 -1
- package/dist/render3d/texture.js +13 -0
- package/dist/render3d/texture.js.map +1 -1
- package/dist/render3d/tracking.js.map +1 -1
- package/dist/render3d/transform.d.ts +1 -1
- package/dist/render3d/transform.js.map +1 -1
- package/dist/render3d/vector3.d.ts +18 -1
- package/dist/render3d/vector3.d.ts.map +1 -1
- package/dist/render3d/vector3.js +27 -0
- package/dist/render3d/vector3.js.map +1 -1
- package/dist/render3d/walk.d.ts +1 -1
- package/dist/render3d/walk.d.ts.map +1 -1
- package/dist/render3d/walk.js +5 -1
- package/dist/render3d/walk.js.map +1 -1
- package/dist/runtime/asset-refine.js.map +1 -1
- package/dist/runtime/asset-timeline.js.map +1 -1
- package/dist/runtime/asset-update.js.map +1 -1
- package/dist/runtime/audio-index.js.map +1 -1
- package/dist/runtime/builtin-context.js.map +1 -1
- package/dist/runtime/clip-instance.d.ts +9 -4
- package/dist/runtime/clip-instance.d.ts.map +1 -1
- package/dist/runtime/clip-instance.js +27 -9
- package/dist/runtime/clip-instance.js.map +1 -1
- package/dist/runtime/clip-store.d.ts +18 -0
- package/dist/runtime/clip-store.d.ts.map +1 -1
- package/dist/runtime/clip-store.js +97 -0
- package/dist/runtime/clip-store.js.map +1 -1
- package/dist/runtime/engine.d.ts +5 -0
- package/dist/runtime/engine.d.ts.map +1 -1
- package/dist/runtime/engine.js +2 -0
- package/dist/runtime/engine.js.map +1 -1
- package/dist/runtime/frame-time.d.ts +31 -0
- package/dist/runtime/frame-time.d.ts.map +1 -0
- package/dist/runtime/frame-time.js +29 -0
- package/dist/runtime/frame-time.js.map +1 -0
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/node-picking.d.ts +44 -3
- package/dist/runtime/node-picking.d.ts.map +1 -1
- package/dist/runtime/node-picking.js +124 -10
- package/dist/runtime/node-picking.js.map +1 -1
- package/dist/runtime/node-picking3d.d.ts +13 -5
- package/dist/runtime/node-picking3d.d.ts.map +1 -1
- package/dist/runtime/node-picking3d.js +10 -2
- package/dist/runtime/node-picking3d.js.map +1 -1
- package/dist/runtime/placement.d.ts.map +1 -1
- package/dist/runtime/placement.js +4 -5
- package/dist/runtime/placement.js.map +1 -1
- package/dist/runtime/playback-controller.d.ts +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.d.ts.map +1 -1
- package/dist/runtime/text-geometry.js +7 -3
- package/dist/runtime/text-geometry.js.map +1 -1
- package/dist/sdk/index.d.ts +50 -25
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +52 -42
- package/dist/sdk/index.js.map +1 -1
- package/dist/tween/command-decorator.d.ts +2 -0
- package/dist/tween/command-decorator.d.ts.map +1 -1
- package/dist/tween/command-decorator.js.map +1 -1
- package/dist/tween/command.d.ts +12 -0
- package/dist/tween/command.d.ts.map +1 -1
- package/dist/tween/command.js +14 -0
- package/dist/tween/command.js.map +1 -1
- package/dist/tween/ease/constants.d.ts.map +1 -1
- package/dist/tween/ease/constants.js +8 -5
- package/dist/tween/ease/constants.js.map +1 -1
- package/dist/tween/ease/curve.d.ts.map +1 -1
- package/dist/tween/ease/curve.js +4 -3
- package/dist/tween/ease/curve.js.map +1 -1
- package/dist/tween/ease/describe.d.ts +15 -0
- package/dist/tween/ease/describe.d.ts.map +1 -0
- package/dist/tween/ease/describe.js +37 -0
- package/dist/tween/ease/describe.js.map +1 -0
- package/dist/tween/ease/type.js.map +1 -1
- package/dist/tween/index.js.map +1 -1
- package/dist/tween/inert.js.map +1 -1
- package/dist/tween/lerp.js.map +1 -1
- package/dist/tween/loop.js.map +1 -1
- package/dist/tween/prepare.d.ts +3 -3
- package/dist/tween/prepare.js +3 -3
- package/dist/tween/prepare.js.map +1 -1
- package/dist/tween/seekable.d.ts +1 -1
- package/dist/tween/seekable.js.map +1 -1
- package/dist/tween/stepper.js.map +1 -1
- package/dist/tween/to-command.js.map +1 -1
- package/dist/util/clamp.js.map +1 -1
- package/dist/util/context.js.map +1 -1
- package/dist/util/csv.js.map +1 -1
- package/dist/util/generateList.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/dist/util/metrics.d.ts +1 -1
- package/dist/util/metrics.js +1 -1
- package/dist/util/metrics.js.map +1 -1
- package/dist/util/random.js.map +1 -1
- package/dist/util/reference.js.map +1 -1
- package/dist/util/scheduler.js.map +1 -1
- package/package.json +7 -1
- package/dist/attributes/shape/effects/implementations/displace.d.ts +0 -48
- package/dist/attributes/shape/effects/implementations/displace.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/displace.js +0 -30
- package/dist/attributes/shape/effects/implementations/displace.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/god-rays.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/god-rays.js +0 -26
- package/dist/attributes/shape/effects/implementations/god-rays.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.d.ts +0 -28
- package/dist/attributes/shape/effects/implementations/texture.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/texture.js +0 -25
- package/dist/attributes/shape/effects/implementations/texture.js.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.d.ts +0 -41
- package/dist/attributes/shape/effects/implementations/trails.d.ts.map +0 -1
- package/dist/attributes/shape/effects/implementations/trails.js +0 -22
- package/dist/attributes/shape/effects/implementations/trails.js.map +0 -1
- package/dist/browser/chunks/chunk-2T3HXSC2.js +0 -2
- package/dist/browser/chunks/chunk-2T3HXSC2.js.map +0 -7
- package/dist/browser/chunks/chunk-KJXGRHOL.js +0 -3
- package/dist/browser/chunks/chunk-KJXGRHOL.js.map +0 -7
- package/dist/browser/chunks/chunk-TGDX2SS2.js +0 -18
- package/dist/browser/chunks/chunk-TGDX2SS2.js.map +0 -7
- package/dist/nodes/geometry/dot-grid-node.d.ts +0 -105
- package/dist/nodes/geometry/dot-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/dot-grid-node.js +0 -142
- package/dist/nodes/geometry/dot-grid-node.js.map +0 -1
- package/dist/nodes/geometry/grid-lines.d.ts +0 -101
- package/dist/nodes/geometry/grid-lines.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-lines.js +0 -128
- package/dist/nodes/geometry/grid-lines.js.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.d.ts +0 -58
- package/dist/nodes/geometry/grid-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/grid-pattern-node.js +0 -172
- package/dist/nodes/geometry/grid-pattern-node.js.map +0 -1
- package/dist/nodes/geometry/line-grid-node.d.ts +0 -62
- package/dist/nodes/geometry/line-grid-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-grid-node.js +0 -127
- package/dist/nodes/geometry/line-grid-node.js.map +0 -1
- package/dist/nodes/geometry/line-node.d.ts +0 -58
- package/dist/nodes/geometry/line-node.d.ts.map +0 -1
- package/dist/nodes/geometry/line-node.js +0 -123
- package/dist/nodes/geometry/line-node.js.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.d.ts +0 -39
- package/dist/nodes/geometry/viewport-pattern-node.d.ts.map +0 -1
- package/dist/nodes/geometry/viewport-pattern-node.js +0 -79
- package/dist/nodes/geometry/viewport-pattern-node.js.map +0 -1
- package/dist/nodes/scene/canvas2d-node.d.ts.map +0 -1
- package/dist/nodes/scene/canvas2d-node.js.map +0 -1
- package/dist/nodes/scene/provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/provider-node.js.map +0 -1
- package/dist/nodes/scene/theme-provider-node.d.ts.map +0 -1
- package/dist/nodes/scene/theme-provider-node.js.map +0 -1
- /package/dist/nodes/{scene → root}/provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/provider-node.js +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.d.ts +0 -0
- /package/dist/nodes/{scene → root}/theme-provider-node.js +0 -0
|
@@ -27,8 +27,8 @@ import { BoxBounds } from "../../layout/bounds.js";
|
|
|
27
27
|
*
|
|
28
28
|
* ## Why this composes with a resize that scales the children
|
|
29
29
|
*
|
|
30
|
-
*
|
|
31
|
-
* the drag holds still
|
|
30
|
+
* An editor can resize one of these nodes by scaling every child about the
|
|
31
|
+
* corner the drag holds still, and that gesture is only
|
|
32
32
|
* coherent if the box it is dragging follows the parts by the same factor. It
|
|
33
33
|
* does, for all three modes: an axis-aligned scale about a point commutes with
|
|
34
34
|
* union and intersection alike, so scaling every child by `k` scales the answer
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-bounds.d.ts","sourceRoot":"","sources":["../../../src/nodes/geometry/group-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,eAAe;AACvB,2DAA2D;AACzD,OAAO;AACT,6EAA6E;GAC3E,OAAO;AACT,sDAAsD;GACpD,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"group-bounds.d.ts","sourceRoot":"","sources":["../../../src/nodes/geometry/group-bounds.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAK5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,MAAM,eAAe;AACvB,2DAA2D;AACzD,OAAO;AACT,6EAA6E;GAC3E,OAAO;AACT,sDAAsD;GACpD,WAAW,CAAC;AAkDlB;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC1B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,eAAe,GACtB,SAAS,GAAG,IAAI,CA+BlB"}
|
|
@@ -7,8 +7,7 @@ import { worldAnchors } from "../../nodes/2d/node-transform.js";
|
|
|
7
7
|
* The same two-step `nodeBox` makes: shift the child's matrix onto the ink's own
|
|
8
8
|
* centre (the matrix is canvas y-down and the bounds are y-up, hence the sign),
|
|
9
9
|
* then read the corners off it. That is what makes this correct for a child that
|
|
10
|
-
* is rotated, scaled, or whose ink is off-centre
|
|
11
|
-
* points are nowhere near its layout cell.
|
|
10
|
+
* is rotated, scaled, or whose ink is off-centre.
|
|
12
11
|
*/
|
|
13
12
|
function inkCorners(child) {
|
|
14
13
|
const b = child._localBounds();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group-bounds.js","sourceRoot":"","sources":["../../../src/nodes/geometry/group-bounds.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAoDzD
|
|
1
|
+
{"version":3,"file":"group-bounds.js","sourceRoot":"","sources":["../../../src/nodes/geometry/group-bounds.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAoDzD;;;;;;;;GAQG;AACH,SAAS,UAAU,CAAC,KAAa;IAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;IACnC,MAAM,CAAC,GACH,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,MAAM,CAAC,GAAG,YAAY,CAAC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I,CAAC,IAAI,CAAC;gBACpC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC;aACvC;YACH,CAAC,CAAC,IAAI,CAAC;QACX,wEAAwE;QACxE,+BAA+B;QAC/B,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;IACpE,CAAC;IACD,OAAO,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACxC,CAAC","sourcesContent":["import { Node2D } from \"@/nodes/2d/node2d\";\r\nimport { BoxBounds } from \"@/layout/bounds\";\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { multiply, translation } from \"@/attributes/layout/matrix2d\";\r\nimport { worldAnchors } from \"@/nodes/2d/node-transform\";\r\n\r\n/**\r\n * The ink extent of a node whose drawing is made **out of its children** rather\r\n * than out of a box of its own — a {@link BooleanGroup}, a {@link MaskGroup}.\r\n *\r\n * Both of those classes report their layout cell as their bounds by default,\r\n * and for both that cell is a fiction: nothing is drawn at its edges, nothing\r\n * is grabbable there, and it does not move when the parts inside it do. An\r\n * editor drawing a selection box around one is drawing a rectangle that has no\r\n * relationship to the pixels — which is exactly what {@link Node2D._localBounds}\r\n * exists to fix, and the reason it is a separate seam from `measure()`: the box\r\n * moves, the layout does not.\r\n *\r\n * ## Why an op decides the answer\r\n *\r\n * A bounding box is the one thing about a boolean result you *can* work out\r\n * without running the boolean. For a union it is even exact —\r\n * `bounds(A ∪ B) = bounds(A) ∪ bounds(B)` — and the same union is the honest\r\n * answer for `exclude`, whose result is a subset of it and whose parts are all\r\n * still there to be seen. The other two shrink instead: subtracting can only\r\n * ever cut into the first child, and an intersection lives inside every child\r\n * at once. So each mode below states which of those it is, and the result is a\r\n * *superset* of the true silhouette for `subtract`/`intersect` and exact for\r\n * the other two — never a box the drawing spills out of, which is the failure\r\n * that would matter.\r\n *\r\n * ## Why this composes with a resize that scales the children\r\n *\r\n * An editor can resize one of these nodes by scaling every child about the\r\n * corner the drag holds still, and that gesture is only\r\n * coherent if the box it is dragging follows the parts by the same factor. It\r\n * does, for all three modes: an axis-aligned scale about a point commutes with\r\n * union and intersection alike, so scaling every child by `k` scales the answer\r\n * here by exactly `k`. Neither half has to know about the other.\r\n */\r\nexport type ChildBoundsMode =\r\n /** Every child's ink, together — `union` and `exclude`. */\r\n | \"union\"\r\n /** The first child's ink alone — `subtract`'s base, and a mask's stencil. */\r\n | \"first\"\r\n /** Where every child's ink overlaps — `intersect`. */\r\n | \"intersect\";\r\n\r\n/** Min/max in the node's own local space, y-up, relative to its centre. */\r\ninterface Span {\r\n minX: number;\r\n minY: number;\r\n maxX: number;\r\n maxY: number;\r\n}\r\n\r\n/**\r\n * The four corners of `child`'s ink, in its **parent's** local space (y-up,\r\n * relative to the parent's centre).\r\n *\r\n * The same two-step `nodeBox` makes: shift the child's matrix onto the ink's own\r\n * centre (the matrix is canvas y-down and the bounds are y-up, hence the sign),\r\n * then read the corners off it. That is what makes this correct for a child that\r\n * is rotated, scaled, or whose ink is off-centre.\r\n */\r\nfunction inkCorners(child: Node2D): Vector2[] {\r\n const b = child._localBounds();\r\n const local = child._localMatrix();\r\n const m =\r\n b.x === 0 && b.y === 0 ? local : multiply(local, translation(b.x, -b.y));\r\n const a = worldAnchors(m, b.width / 2, b.height / 2);\r\n return [a.topLeft, a.topRight, a.bottomRight, a.bottomLeft];\r\n}\r\n\r\n/** The axis-aligned span of a point set, or `null` for an empty one. */\r\nfunction spanOf(points: Vector2[]): Span | null {\r\n if (points.length === 0) return null;\r\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\r\n for (const p of points) {\r\n if (p.x < minX) minX = p.x;\r\n if (p.x > maxX) maxX = p.x;\r\n if (p.y < minY) minY = p.y;\r\n if (p.y > maxY) maxY = p.y;\r\n }\r\n return { minX, minY, maxX, maxY };\r\n}\r\n\r\nfunction toBounds(span: Span): BoxBounds {\r\n return {\r\n x: (span.minX + span.maxX) / 2,\r\n y: (span.minY + span.maxY) / 2,\r\n width: span.maxX - span.minX,\r\n height: span.maxY - span.minY,\r\n };\r\n}\r\n\r\n/**\r\n * The extent of `node`'s children's ink in `node`'s own local space, or `null`\r\n * when there is nothing to measure — no children, or an `intersect` whose parts\r\n * don't overlap at all.\r\n *\r\n * `null` is the caller's cue to keep the layout cell: a node with no children\r\n * has nothing else to offer, and an empty intersection draws nothing anywhere,\r\n * so a box round the parts would be a box round a shape that isn't there. The\r\n * cell at least stays in one place and stays grabbable, which is what a node you\r\n * need to put another child into has to be.\r\n */\r\nexport function childInkBounds(\r\n node: Node2D,\r\n mode: ChildBoundsMode\r\n): BoxBounds | null {\r\n const children = node.children;\r\n if (children.length === 0) return null;\r\n\r\n if (mode === \"first\") {\r\n const span = spanOf(inkCorners(children[0]));\r\n return span ? toBounds(span) : null;\r\n }\r\n\r\n if (mode === \"union\") {\r\n const span = spanOf(children.flatMap(inkCorners));\r\n return span ? toBounds(span) : null;\r\n }\r\n\r\n let span: Span | null = null;\r\n for (const child of children) {\r\n const next = spanOf(inkCorners(child));\r\n if (!next) return null;\r\n span = span\r\n ? {\r\n minX: Math.max(span.minX, next.minX),\r\n minY: Math.max(span.minY, next.minY),\r\n maxX: Math.min(span.maxX, next.maxX),\r\n maxY: Math.min(span.maxY, next.maxY),\r\n }\r\n : next;\r\n // The parts have stopped overlapping — nothing is drawn, so there is no\r\n // box to draw. See the header.\r\n if (span.minX > span.maxX || span.minY > span.maxY) return null;\r\n }\r\n return span ? toBounds(span) : null;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-node.d.ts","sourceRoot":"","sources":["../../../src/nodes/geometry/path-node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD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AI/C,MAAM,WAAW,SAAU,SAAQ,UAAU;IACzC,IAAI,EAAE,QAAQ,CAAC;CAClB;AAED,qBAAa,IAAK,SAAQ,SAAS,CAAC,SAAS,CAAC;IAE1C;;;;;;;OAOG;IACH,SACiB,IAAI,EAAE,QAAQ,CAAC;gBAEpB,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC;cAM3B,gBAAgB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,IAAI;IAK9E,OAAO,CAAC,WAAW,EAAE,eAAe,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;cA0B5D,aAAa,IAAI,UAAU;CAoBjD"}
|
|
@@ -39,8 +39,14 @@ export class Path extends ShapeNode {
|
|
|
39
39
|
return { width: resolvedW, height: resolvedH };
|
|
40
40
|
}
|
|
41
41
|
shapeGraphics() {
|
|
42
|
+
// Centre on the same tight box `measure` hugs. Left to itself the renderer
|
|
43
|
+
// centres on the bounds of the point array, control points included, which
|
|
44
|
+
// for a curve is not the ink: `M 0 0 C 0 100 100 100 100 0` hugs 100 x 75
|
|
45
|
+
// but would be centred on 100 x 100, drawing off-centre in its own box.
|
|
46
|
+
const box = pathOps.bounds(this.data);
|
|
42
47
|
return new Graphics2D().path({
|
|
43
48
|
data: this.data,
|
|
49
|
+
centerBounds: box ? [box.minX, box.minY, box.maxX, box.maxY] : undefined,
|
|
44
50
|
start: this.start,
|
|
45
51
|
end: this.end,
|
|
46
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/path-node.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAMjD,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAA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AG;SAChB,CAAC,CAAC;IACP,CAAC;CAQJ;AA3DoB;IADhB,YAAY,EAAE;kCACiB","sourcesContent":["\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport type { PathData } from \"@/render/descriptors/path\";\r\nimport { SizeConstraints } from \"@/layout/constraints\";\r\nimport { MeasureContext2D } from \"@/render/measure-context\";\r\nimport { Size2D } from \"@/attributes/layout/size\";\r\nimport { InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport { ShapeNode, ShapeProps } from \"./shape-node\";\r\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { pathProperty } from \"@/attributes/properties/typed\";\r\nimport { pathOps } from \"@/attributes/shape/path/ops\";\r\n\r\nexport interface PathProps extends ShapeProps {\r\n data: PathData;\r\n}\r\n\r\nexport class Path extends ShapeNode<PathProps> {\r\n\r\n /**\r\n * The path geometry, as an SVG `d` string or a {@link PathCommand} array.\r\n *\r\n * Animatable: `to({ data })` morphs smoothly between arbitrary shapes via\r\n * `pathOps.lerp`, which reconciles differing command/subpath counts, point\r\n * order, and winding before interpolating. Strings and command arrays may be\r\n * freely mixed as the source and target.\r\n */\r\n @pathProperty()\r\n declare readonly data: PathData;\r\n\r\n constructor(props: NodeConfig<Path, PathProps>) {\r\n super(props);\r\n }\r\n\r\n // A Path always sizes to its own geometry — it has no children to hug —\r\n // so it ignores the base has-children default and always hugs.\r\n protected override applyDefaultSize(props?: NodeConfig<Path, PathProps>): void {\r\n this.applyProp(\"width\", props?.width ?? \"hug\");\r\n this.applyProp(\"height\", props?.height ?? \"hug\");\r\n }\r\n\r\n measure(constraints: SizeConstraints, scope: MeasureContext2D): Partial<Size2D> {\r\n const wm = this.width;\r\n const hm = this.height;\r\n\r\n if (wm !== \"hug\" && hm !== \"hug\") {\r\n return super.measure(constraints, scope);\r\n }\r\n\r\n const intrinsic = pathOps.size(this.data);\r\n const pad = this.padding as InsetsResolved;\r\n\r\n const resolvedW = typeof wm === \"number\"\r\n ? wm\r\n : wm === \"hug\"\r\n ? intrinsic.width + pad.left + pad.right\r\n : constraints.maxWidth ?? 0;\r\n\r\n const resolvedH = typeof hm === \"number\"\r\n ? hm\r\n : hm === \"hug\"\r\n ? intrinsic.height + pad.top + pad.bottom\r\n : constraints.maxHeight ?? 0;\r\n\r\n return { width: resolvedW, height: resolvedH };\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D {\r\n // Centre on the same tight box `measure` hugs. Left to itself the renderer\r\n // centres on the bounds of the point array, control points included, which\r\n // for a curve is not the ink: `M 0 0 C 0 100 100 100 100 0` hugs 100 x 75\r\n // but would be centred on 100 x 100, drawing off-centre in its own box.\r\n const box = pathOps.bounds(this.data);\r\n return new Graphics2D().path({\r\n data: this.data,\r\n centerBounds: box ? [box.minX, box.minY, box.maxX, box.maxY] : undefined,\r\n start: this.start,\r\n end: this.end,\r\n });\r\n }\r\n\r\n // No `renderSelf` of its own: `ShapeNode`'s draws shadow + fill of exactly\r\n // this silhouette and already defers the stroke to `renderStroke`, so the\r\n // override this class used to carry differed from the base in one thing —\r\n // it dropped the `.shadow()` op — and a Path was the one shape type that\r\n // could not cast a shadow at all, fill or no fill. It predates the base\r\n // implementation rather than disagreeing with it.\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/polygon-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAe,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAW7F,0FAA0F;AAC1F,MAAM,OAAO,OAAQ,SAAQ,SAAuB;IAShD,YAAY,KAAwC;QAChD,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEkB,aAAa;QAC5B,OAAO,IAAI,UAAU,EAAE,CAAC,OAAO,CAAC;YAC5B,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;IACP,CAAC;IAEkB,QAAQ;QACvB,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC,CAAC;IACP,CAAC;CACJ;AA/BqC;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;sCAAuB;AAEd;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;6CAA8B;AAEiB;IAAvE,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;4CAAkC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport { ShapeNode, ShapeProps } from \"./shape-node\";\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { Clip } from \"@/render/clip\";\nimport { CornerStyle, lerpCornerScalarStyle } from \"@/attributes/shape/corners/corner-style\";\n\nexport interface PolygonProps extends ShapeProps {\n /** Number of sides. Must be ≥ 3. */\n sides: number;\n /** Vertex rounding radius in pixels. */\n cornerRadius: number;\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\n cornerStyle: CornerStyle;\n}\n\n/** Regular polygon (equilateral, equiangular) inscribed within the node's layout rect. */\nexport class Polygon extends ShapeNode<PolygonProps> {\n\n /** Number of sides (default: 5). */\n @property({ default: 5 }) declare sides: number;\n /** Vertex rounding radius in pixels (default: 0). */\n @property({ default: 0 }) declare cornerRadius: number;\n /** Vertex shape (default: `'rounded'`). */\n @property({ default: \"rounded\", tween: lerpCornerScalarStyle }) declare cornerStyle: CornerStyle;\n\n constructor(props: NodeConfig<Polygon, PolygonProps>) {\n super(props);\n }\n\n protected override shapeGraphics(): Graphics2D {\n return new Graphics2D().polygon({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n sides: this.sides,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n start: this.start,\n end: this.end,\n });\n }\n\n protected override clipSelf(): Clip {\n return new Clip().polygon({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n sides: this.sides,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"polygon-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/polygon-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAe,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAW7F,0FAA0F;AAC1F,MAAM,OAAO,OAAQ,SAAQ,SAAuB;IAShD,YAAY,KAAwC;QAChD,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEkB,aAAa;QAC5B,OAAO,IAAI,UAAU,EAAE,CAAC,OAAO,CAAC;YAC5B,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;IACP,CAAC;IAEkB,QAAQ;QACvB,OAAO,IAAI,IAAI,EAAE,CAAC,OAAO,CAAC;YACtB,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC,CAAC;IACP,CAAC;CACJ;AA/BqC;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;sCAAuB;AAEd;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;6CAA8B;AAEiB;IAAvE,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;4CAAkC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { ShapeNode, ShapeProps } from \"./shape-node\";\r\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { Clip } from \"@/render/clip\";\r\nimport { CornerStyle, lerpCornerScalarStyle } from \"@/attributes/shape/corners/corner-style\";\r\n\r\nexport interface PolygonProps extends ShapeProps {\r\n /** Number of sides. Must be ≥ 3. */\r\n sides: number;\r\n /** Vertex rounding radius in pixels. */\r\n cornerRadius: number;\r\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\r\n cornerStyle: CornerStyle;\r\n}\r\n\r\n/** Regular polygon (equilateral, equiangular) inscribed within the node's layout rect. */\r\nexport class Polygon extends ShapeNode<PolygonProps> {\r\n\r\n /** Number of sides (default: 5). */\r\n @property({ default: 5 }) declare sides: number;\r\n /** Vertex rounding radius in pixels (default: 0). */\r\n @property({ default: 0 }) declare cornerRadius: number;\r\n /** Vertex shape (default: `'rounded'`). */\r\n @property({ default: \"rounded\", tween: lerpCornerScalarStyle }) declare cornerStyle: CornerStyle;\r\n\r\n constructor(props: NodeConfig<Polygon, PolygonProps>) {\r\n super(props);\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D {\r\n return new Graphics2D().polygon({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n sides: this.sides,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n start: this.start,\r\n end: this.end,\r\n });\r\n }\r\n\r\n protected override clipSelf(): Clip {\r\n return new Clip().polygon({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n sides: this.sides,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygram-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/polygram-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAe,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAgB7F,0FAA0F;AAC1F,MAAM,OAAO,QAAS,SAAQ,SAAwB;IAWlD,YAAY,KAA0C;QAClD,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEkB,aAAa;QAC5B,OAAO,IAAI,UAAU,EAAE,CAAC,QAAQ,CAAC;YAC7B,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;IACP,CAAC;IAEkB,QAAQ;QACvB,OAAO,IAAI,IAAI,EAAE,CAAC,QAAQ,CAAC;YACvB,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC,CAAC;IACP,CAAC;CACJ;AAnCqC;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;uCAAuB;AAEZ;IAAnC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;uCAAuB;AAEhB;IAAjC,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;8CAA8B;AAEiB;IAAvE,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;6CAAkC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\nimport { ShapeNode, ShapeProps } from \"./shape-node\";\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\nimport { Graphics2D } from \"@/render/graphics2d\";\nimport { Clip } from \"@/render/clip\";\nimport { CornerStyle, lerpCornerScalarStyle } from \"@/attributes/shape/corners/corner-style\";\n\nexport interface PolygramProps extends ShapeProps {\n /** Number of outer points. Must be ≥ 3. */\n sides: number;\n /**\n * Inner-to-outer radius ratio (0–1). Controls how deeply the star points are cut.\n * At 1 the shape degenerates into a regular polygon; lower values produce sharper points.\n */\n ratio: number;\n /** Vertex rounding radius in pixels applied to both inner and outer vertices. */\n cornerRadius: number;\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\n cornerStyle: CornerStyle;\n}\n\n/** Star polygon (polygram) — alternates outer and inner vertices to form a star shape. */\nexport class Polygram extends ShapeNode<PolygramProps> {\n\n /** Number of outer points (default: 5). */\n @property({ default: 5 }) declare sides: number;\n /** Inner-to-outer radius ratio (default: 0.5). */\n @property({ default: 0.5 }) declare ratio: number;\n /** Vertex rounding radius in pixels (default: 0). */\n @property({ default: 0 }) declare cornerRadius: number;\n /** Vertex shape (default: `'rounded'`). */\n @property({ default: \"rounded\", tween: lerpCornerScalarStyle }) declare cornerStyle: CornerStyle;\n\n constructor(props: NodeConfig<Polygram, PolygramProps>) {\n super(props);\n }\n\n protected override shapeGraphics(): Graphics2D {\n return new Graphics2D().polygram({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n sides: this.sides,\n ratio: this.ratio,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n start: this.start,\n end: this.end,\n });\n }\n\n protected override clipSelf(): Clip {\n return new Clip().polygram({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n sides: this.sides,\n ratio: this.ratio,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"polygram-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/polygram-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAC7D,OAAO,E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AAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;8CAA8B;AAEiB;IAAvE,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,qBAAqB,EAAE,CAAC;6CAAkC","sourcesContent":["import { property } from \"@/attributes/properties/decorator\";\r\nimport { ShapeNode, ShapeProps } from \"./shape-node\";\r\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { Graphics2D } from \"@/render/graphics2d\";\r\nimport { Clip } from \"@/render/clip\";\r\nimport { CornerStyle, lerpCornerScalarStyle } from \"@/attributes/shape/corners/corner-style\";\r\n\r\nexport interface PolygramProps extends ShapeProps {\r\n /** Number of outer points. Must be ≥ 3. */\r\n sides: number;\r\n /**\r\n * Inner-to-outer radius ratio (0–1). Controls how deeply the star points are cut.\r\n * At 1 the shape degenerates into a regular polygon; lower values produce sharper points.\r\n */\r\n ratio: number;\r\n /** Vertex rounding radius in pixels applied to both inner and outer vertices. */\r\n cornerRadius: number;\r\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\r\n cornerStyle: CornerStyle;\r\n}\r\n\r\n/** Star polygon (polygram) — alternates outer and inner vertices to form a star shape. */\r\nexport class Polygram extends ShapeNode<PolygramProps> {\r\n\r\n /** Number of outer points (default: 5). */\r\n @property({ default: 5 }) declare sides: number;\r\n /** Inner-to-outer radius ratio (default: 0.5). */\r\n @property({ default: 0.5 }) declare ratio: number;\r\n /** Vertex rounding radius in pixels (default: 0). */\r\n @property({ default: 0 }) declare cornerRadius: number;\r\n /** Vertex shape (default: `'rounded'`). */\r\n @property({ default: \"rounded\", tween: lerpCornerScalarStyle }) declare cornerStyle: CornerStyle;\r\n\r\n constructor(props: NodeConfig<Polygram, PolygramProps>) {\r\n super(props);\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D {\r\n return new Graphics2D().polygram({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n sides: this.sides,\r\n ratio: this.ratio,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n start: this.start,\r\n end: this.end,\r\n });\r\n }\r\n\r\n protected override clipSelf(): Clip {\r\n return new Clip().polygram({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n sides: this.sides,\r\n ratio: this.ratio,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/rect-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAc1F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,IAAsC,SAAQ,SAAY;IAOnE,YAAY,KAA6B;QACrC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEkB,aAAa;QAC5B,OAAO,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC;YACzB,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;IACP,CAAC;IAEkB,QAAQ;QACvB,OAAO,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC;YACnB,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC,CAAC;IACP,CAAC;CACJ;AA3BW;IADP,oBAAoB,EAAE;0CACgB;AAE/B;IADP,mBAAmB,EAAE;yCACe","sourcesContent":["import { Graphics2D } from \"@/render/graphics2d\";\nimport { Clip } from \"@/render/clip\";\nimport { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { ShapeNode, ShapeProps } from \"./shape-node\";\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\nimport { cornerRadiusProperty, cornerStyleProperty } from \"@/attributes/properties/typed\";\n\n\nexport type { FlowMode, GapSize } from \"@/layout/types\";\n\nexport type FlexSize = number | \"fill\" | \"hug\";\n\nexport interface RectProps extends ShapeProps {\n /** Corner radius in pixels — uniform, per-corner, or per-axis. */\n cornerRadius: RectCornerRadius;\n /** How each corner is shaped once it has a radius: `'rounded'` or `'angled'`. */\n cornerStyle: RectCornerStyle;\n}\n\n/**\n * A rounded rectangle drawn behind its children.\n *\n * It used to be the only node that laid its children out, and everything that\n * did so — `flow`, `gap`/`crossGap`, `wrap`, `columns`, `align`, the padding\n * that clears the stroke — now lives on {@link ShapeNode}, where every shape\n * can reach it. What is left here is the rectangle itself: its two corner props\n * and the silhouette they describe.\n *\n * There used to be four more classes here — `Row`, `Column`, `Grid` and `Image`\n * — each a Rect with one of its answers frozen. They were a convenience that\n * cost more than it saved: a row that needed to become a column had to become a\n * *different node*, losing its identity and every command bound to it, and the\n * frozen ones drifted (only `Rect` ever learned the cross-mode `flow` blend).\n * One class that can be asked is the whole point of the `flow` prop.\n */\nexport class Rect<P extends RectProps = RectProps> extends ShapeNode<P> {\n\n @cornerRadiusProperty()\n declare cornerRadius: RectCornerRadius;\n @cornerStyleProperty()\n declare cornerStyle: RectCornerStyle;\n\n constructor(props: NodeConfig<Rect<P>, P>) {\n super(props);\n }\n\n protected override shapeGraphics(): Graphics2D {\n return new Graphics2D().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n start: this.start,\n end: this.end,\n });\n }\n\n protected override clipSelf(): Clip {\n return new Clip().rect({\n width: this.layoutBounds.width,\n height: this.layoutBounds.height,\n cornerRadius: this.cornerRadius,\n cornerStyle: this.cornerStyle,\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rect-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/rect-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,SAAS,EAAc,MAAM,cAAc,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAc1F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,IAAsC,SAAQ,SAAY;IAOnE,YAAY,KAA6B;QACrC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEkB,aAAa;QAC5B,OAAO,IAAI,UAAU,EAAE,CAAC,IAAI,CAAC;YACzB,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;IACP,CAAC;IAEkB,QAAQ;QACvB,OAAO,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC;YACnB,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK;YAC9B,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,MAAM;YAChC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,WAAW,EAAE,IAAI,CAAC,WAAW;SAChC,CAAC,CAAC;IACP,CAAC;CACJ;AA3BW;IADP,oBAAoB,EAAE;0CACgB;AAE/B;IADP,mBAAmB,EAAE;yCACe","sourcesContent":["import { Graphics2D } from \"@/render/graphics2d\";\r\nimport { Clip } from \"@/render/clip\";\r\nimport { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeNode, ShapeProps } from \"./shape-node\";\r\nimport { NodeConfig } from \"@/nodes/2d/node2d\";\r\nimport { cornerRadiusProperty, cornerStyleProperty } from \"@/attributes/properties/typed\";\r\n\r\n\r\nexport type { FlowMode, GapSize } from \"@/layout/types\";\r\n\r\nexport type FlexSize = number | \"fill\" | \"hug\";\r\n\r\nexport interface RectProps extends ShapeProps {\r\n /** Corner radius in pixels — uniform, per-corner, or per-axis. */\r\n cornerRadius: RectCornerRadius;\r\n /** How each corner is shaped once it has a radius: `'rounded'` or `'angled'`. */\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\n/**\r\n * A rounded rectangle drawn behind its children.\r\n *\r\n * It used to be the only node that laid its children out, and everything that\r\n * did so — `flow`, `gap`/`crossGap`, `wrap`, `columns`, `align`, the padding\r\n * that clears the stroke — now lives on {@link ShapeNode}, where every shape\r\n * can reach it. What is left here is the rectangle itself: its two corner props\r\n * and the silhouette they describe.\r\n *\r\n * There used to be four more classes here — `Row`, `Column`, `Grid` and `Image`\r\n * — each a Rect with one of its answers frozen. They were a convenience that\r\n * cost more than it saved: a row that needed to become a column had to become a\r\n * *different node*, losing its identity and every command bound to it, and the\r\n * frozen ones drifted (only `Rect` ever learned the cross-mode `flow` blend).\r\n * One class that can be asked is the whole point of the `flow` prop.\r\n */\r\nexport class Rect<P extends RectProps = RectProps> extends ShapeNode<P> {\r\n\r\n @cornerRadiusProperty()\r\n declare cornerRadius: RectCornerRadius;\r\n @cornerStyleProperty()\r\n declare cornerStyle: RectCornerStyle;\r\n\r\n constructor(props: NodeConfig<Rect<P>, P>) {\r\n super(props);\r\n }\r\n\r\n protected override shapeGraphics(): Graphics2D {\r\n return new Graphics2D().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n start: this.start,\r\n end: this.end,\r\n });\r\n }\r\n\r\n protected override clipSelf(): Clip {\r\n return new Clip().rect({\r\n width: this.layoutBounds.width,\r\n height: this.layoutBounds.height,\r\n cornerRadius: this.cornerRadius,\r\n cornerStyle: this.cornerStyle,\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/shape-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAG3D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAO7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAc,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAc,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAiBxD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAgB,SAA6C,SAAQ,SAAY;IAsBnF,SAAS,CAAC,IAA8D;QACpE,MAAM,IAAI,GAAG,IAAI,CAAC,OAAyB,CAAC;QAC5C,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAY,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;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,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC/C,IAAI,SAAS,GAAG,KAAK;gBAAE,KAAK,GAAG,SAAS,CAAC;QAC7C,CAAC;QACD,IAAI,KAAK,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QAC1B,OAAO;YACH,IAAI,EAAE,CAAC,CAAC,IAAI,GAAG,KAAK;YACpB,KAAK,EAAE,CAAC,CAAC,KAAK,GAAG,KAAK;YACtB,GAAG,EAAE,CAAC,CAAC,GAAG,GAAG,KAAK;YAClB,MAAM,EAAE,CAAC,CAAC,MAAM,GAAG,KAAK;SAC3B,CAAC;IACN,CAAC;CACJ;AAtGW;IADP,YAAY,EAAE;0CACO;AAEE;IAAvB,YAAY,EAAE;uCAAwB;AACI;IAA1C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;sCAA+B;AACT;IAA9C,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;uCAAgC;AAIV;IAAlD,QAAQ,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;2CAA+C;AACrC;IAA1C,QAAQ,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;0CAAkC;AAKnD;IADP,iBAAiB,EAAE;wCACK;AAGzB;IADC,OAAO,EAAE;0CAMT","sourcesContent":["import { fillOps } from \"@/attributes/shape/fill/registry\";\nimport type { AssetScope } from \"@/assets/scope\";\n\nimport { alignmentProperty, fillProperty, flowProperty } from \"@/attributes/properties/typed\";\nimport { property } from \"@/attributes/properties/decorator\";\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\nimport { Fill } from \"@/attributes/shape/fill/chain\";\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\n\nimport { RenderContext2D } from \"@/render/render-context2d\";\nimport { type Command, type CommandArgs } from \"@/tween/command\";\nimport { command } from \"@/tween/command-decorator\";\nimport { PaintNode, PaintProps } from \"@/nodes/2d/paint-node\";\nimport { Node2D, NodeConfig } from \"@/nodes/2d/node2d\";\n\nimport { sizeInputOps } from \"@/attributes/layout/size\";\nimport { InsetsResolved } from \"@/attributes/layout/insets\";\nimport { Alignment } from \"@/attributes/layout/alignment\";\nimport type { FlowMode, FlowProps, FlowSettings, GapSize } from \"@/layout/types\";\n\n\nexport interface ShapeProps extends PaintProps, FlowProps {\n /**\n * Overlay layer(s) — the same loose values as {@link PaintProps.fill}, but\n * painted *over* this node's fill **and** its children (clipped to the node's\n * silhouette) while still sitting **under** the stroke. Use for textures\n * laid across the whole subtree, e.g. a VHS-grain image or video.\n */\n overlay?: Fill;\n}\n\n\n/**\n * A {@link PaintNode} with a **silhouette and a subtree**: an overlay, and the\n * layout props that arrange children.\n *\n * Both are here for the same reason, and it is the reason the text nodes stop at\n * the base. An overlay is a wash over this node's fill *and everything nested\n * inside it*, clipped to the shape it draws; the layout pass measures children\n * against a rectangular content box. `Text` and `RichText` have no fillable\n * silhouette and no children — an overlay on one could only be a second fill of\n * the same glyphs, which the fill stack already says, and a flow mode on one\n * would arrange nothing while colliding with `wrap`, which for text means\n * something else entirely.\n *\n * The layout pass is *not* `Rect`'s alone, though: every shape here has a\n * rectangular content box, so \"put a title and an icon in a column\" is a\n * question about the layout you want rather than about which node you picked.\n */\nexport abstract class ShapeNode<P extends ShapeProps = ShapeProps> extends PaintNode<P> {\n\n // Same paint type/mapper/tween as `fill`; differs only in draw order —\n // painted over fill + children and under the stroke (see renderOverlay).\n @fillProperty()\n declare overlay: Fill;\n\n @flowProperty() declare flow: FlowMode;\n @property({ default: 0 }) declare readonly gap: GapSize;\n @property({ default: false }) declare readonly wrap: boolean;\n // `undefined` is a real value here, not a missing one: it means \"follow\n // `gap`\". A default of 0 would make an author who turned wrap on get lines\n // stacked flush, which is never what they meant — see FlowProps.crossGap.\n @property({ default: undefined }) declare readonly crossGap: number | undefined;\n @property({ default: 1 }) declare readonly columns: number;\n // Declared as the loose `Alignment` so one @property covers both assignment\n // (`this.align = 'center'`) and reads. At runtime the accessor stores the\n // resolved per-axis `Vector2` pivot; readers cast at the read site.\n @alignmentProperty()\n declare align: Alignment;\n\n @command()\n overlayTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<P> {\n const from = this.overlay as FillResolved[];\n const target = fillOps.resolve(args.data as Fill);\n const lerp = args.lerp ?? fillOps.lerp;\n return this.command<P>(t => ({ overlay: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\n }\n\n // Overlay over fill + children, under stroke. Painted as a fill of the\n // node's silhouette, so it's clipped to the outline exactly like `fill`.\n protected override renderOverlay(ctx: RenderContext2D): void {\n const overlay = this.overlay as FillResolved[];\n if (overlay.length === 0) return;\n const base = this.shapeGraphics();\n if (base) ctx.draw(base.fill(overlay));\n }\n\n /** The fourth paint slot, on top of the three {@link PaintNode} declares. */\n override declareAssets(assets: AssetScope): void {\n super.declareAssets(assets);\n assets.fill(this.overlay as FillResolved[]);\n }\n\n /**\n * Figma-style smart default (see base {@link Node2D.applyDefaultSize}), plus\n * one refinement for containers: hugging an axis that a direct child asks to\n * `\"fill\"` stacks the child against nothing — the child would either collapse\n * to 0 (freeform, or the container's cross axis) or measure unconstrained (a\n * run's main axis; see `measureRun`). Since JSX children are\n * already-constructed `Node2D`s by the time they reach this constructor, their\n * own resolved `width`/`height` can be inspected here — so a bare `fill` child\n * flips *this* default from `hug` to `fill` on that exact axis, matching what\n * the author almost certainly wants. An explicit `width`/`height` always wins;\n * this only adjusts the *default* used when neither is given.\n *\n * `\"horizontal\"`/`\"vertical\"` only promote their single main axis;\n * `\"freeform\"` (the default, and the mode with no distinct main axis) checks\n * both axes independently.\n */\n protected override applyDefaultSize(props?: NodeConfig<any, P>): void {\n const children = Node2D.flowChildrenProp(props);\n const hasChildren = children.length > 0;\n const flow: FlowMode = (props as any)?.flow ?? \"freeform\";\n\n // `grid` counts as width-main: its column tracks are cut from the box's\n // width, so a child asking to fill that axis is asking for a width the\n // container must have decided before the tracks exist.\n const widthIsMain = flow === \"horizontal\" || flow === \"freeform\" || flow === \"grid\";\n const heightIsMain = flow === \"vertical\" || flow === \"freeform\";\n\n const defaultWidth = hasChildren && widthIsMain && Node2D.hasFillChild(children, \"width\") ? \"fill\" : hasChildren ? \"hug\" : \"fill\";\n const defaultHeight = hasChildren && heightIsMain && Node2D.hasFillChild(children, \"height\") ? \"fill\" : hasChildren ? \"hug\" : \"fill\";\n\n if (!props || props.width === undefined) this.applyProp(\"width\", defaultWidth, { tween: sizeInputOps.lerp });\n if (!props || props.height === undefined) this.applyProp(\"height\", defaultHeight, { tween: sizeInputOps.lerp });\n }\n\n protected override flowArrangement(): FlowSettings {\n return this;\n }\n\n // Children must sit inside the stroke; the stroke is drawn at the layout-rect\n // edge and would otherwise visually cover them. Only the portion of the\n // stroke that intrudes into the content box needs clearing, which depends on\n // its alignment: inside strokes (align -1) intrude their full weight, centered\n // strokes (align 0) half, outside strokes (align +1) none. The intrusion is\n // weight·(1 - align)/2.\n override effectivePadding(): InsetsResolved {\n let extra = 0;\n const p = this.padding as InsetsResolved;\n const strokes = this.stroke as StrokeResolved[];\n if (!strokes || !(Symbol.iterator in Object(strokes))) {\n return p;\n }\n for (const s of strokes) {\n const intrusion = s.weight * (1 - s.align) / 2;\n if (intrusion > extra) extra = intrusion;\n }\n if (extra === 0) return p;\n return {\n left: p.left + extra,\n right: p.right + extra,\n top: p.top + extra,\n bottom: p.bottom + extra,\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shape-node.js","sourceRoot":"","sources":["../../../src/nodes/geometry/shape-node.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAG3D,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAO7D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAc,MAAM,uBAA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["import { fillOps } from \"@/attributes/shape/fill/registry\";\r\nimport type { AssetScope } from \"@/assets/scope\";\r\n\r\nimport { alignmentProperty, fillProperty, flowProperty } from \"@/attributes/properties/typed\";\r\nimport { property } from \"@/attributes/properties/decorator\";\r\nimport { FillResolved } from \"@/attributes/shape/fill/union\";\r\nimport { Fill } from \"@/attributes/shape/fill/chain\";\r\nimport { StrokeResolved } from \"@/attributes/shape/stroke/stroke\";\r\n\r\nimport { RenderContext2D } from \"@/render/render-context2d\";\r\nimport { type Command, type CommandArgs } from \"@/tween/command\";\r\nimport { command } from \"@/tween/command-decorator\";\r\nimport { PaintNode, PaintProps } from \"@/nodes/2d/paint-node\";\r\nimport { Node2D, NodeConfig } from \"@/nodes/2d/node2d\";\r\n\r\nimport { sizeInputOps } from \"@/attributes/layout/size\";\r\nimport { InsetsResolved } from \"@/attributes/layout/insets\";\r\nimport { Alignment } from \"@/attributes/layout/alignment\";\r\nimport type { FlowMode, FlowProps, FlowSettings, GapSize } from \"@/layout/types\";\r\n\r\n\r\nexport interface ShapeProps extends PaintProps, FlowProps {\r\n /**\r\n * Overlay layer(s) — the same loose values as {@link PaintProps.fill}, but\r\n * painted *over* this node's fill **and** its children (clipped to the node's\r\n * silhouette) while still sitting **under** the stroke. Use for textures\r\n * laid across the whole subtree, e.g. a VHS-grain image or video.\r\n */\r\n overlay?: Fill;\r\n}\r\n\r\n\r\n/**\r\n * A {@link PaintNode} with a **silhouette and a subtree**: an overlay, and the\r\n * layout props that arrange children.\r\n *\r\n * Both are here for the same reason, and it is the reason the text nodes stop at\r\n * the base. An overlay is a wash over this node's fill *and everything nested\r\n * inside it*, clipped to the shape it draws; the layout pass measures children\r\n * against a rectangular content box. `Text` and `RichText` have no fillable\r\n * silhouette and no children — an overlay on one could only be a second fill of\r\n * the same glyphs, which the fill stack already says, and a flow mode on one\r\n * would arrange nothing while colliding with `wrap`, which for text means\r\n * something else entirely.\r\n *\r\n * The layout pass is *not* `Rect`'s alone, though: every shape here has a\r\n * rectangular content box, so \"put a title and an icon in a column\" is a\r\n * question about the layout you want rather than about which node you picked.\r\n */\r\nexport abstract class ShapeNode<P extends ShapeProps = ShapeProps> extends PaintNode<P> {\r\n\r\n // Same paint type/mapper/tween as `fill`; differs only in draw order —\r\n // painted over fill + children and under the stroke (see renderOverlay).\r\n @fillProperty()\r\n declare overlay: Fill;\r\n\r\n @flowProperty() declare flow: FlowMode;\r\n @property({ default: 0 }) declare readonly gap: GapSize;\r\n @property({ default: false }) declare readonly wrap: boolean;\r\n // `undefined` is a real value here, not a missing one: it means \"follow\r\n // `gap`\". A default of 0 would make an author who turned wrap on get lines\r\n // stacked flush, which is never what they meant — see FlowProps.crossGap.\r\n @property({ default: undefined }) declare readonly crossGap: number | undefined;\r\n @property({ default: 1 }) declare readonly columns: number;\r\n // Declared as the loose `Alignment` so one @property covers both assignment\r\n // (`this.align = 'center'`) and reads. At runtime the accessor stores the\r\n // resolved per-axis `Vector2` pivot; readers cast at the read site.\r\n @alignmentProperty()\r\n declare align: Alignment;\r\n\r\n @command()\r\n overlayTo(args: CommandArgs<Fill, FillResolved[]> & { duration: number }): Command<P> {\r\n const from = this.overlay as FillResolved[];\r\n const target = fillOps.resolve(args.data as Fill);\r\n const lerp = args.lerp ?? fillOps.lerp;\r\n return this.command<P>(t => ({ overlay: lerp(from, target, t) }) as Partial<P>, args.duration, args.easing);\r\n }\r\n\r\n // Overlay over fill + children, under stroke. Painted as a fill of the\r\n // node's silhouette, so it's clipped to the outline exactly like `fill`.\r\n protected override renderOverlay(ctx: RenderContext2D): void {\r\n const overlay = this.overlay as FillResolved[];\r\n if (overlay.length === 0) return;\r\n const base = this.shapeGraphics();\r\n if (base) ctx.draw(base.fill(overlay));\r\n }\r\n\r\n /** The fourth paint slot, on top of the three {@link PaintNode} declares. */\r\n override declareAssets(assets: AssetScope): void {\r\n super.declareAssets(assets);\r\n assets.fill(this.overlay as FillResolved[]);\r\n }\r\n\r\n /**\r\n * Figma-style smart default (see base {@link Node2D.applyDefaultSize}), plus\r\n * one refinement for containers: hugging an axis that a direct child asks to\r\n * `\"fill\"` stacks the child against nothing — the child would either collapse\r\n * to 0 (freeform, or the container's cross axis) or measure unconstrained (a\r\n * run's main axis; see `measureRun`). Since JSX children are\r\n * already-constructed `Node2D`s by the time they reach this constructor, their\r\n * own resolved `width`/`height` can be inspected here — so a bare `fill` child\r\n * flips *this* default from `hug` to `fill` on that exact axis, matching what\r\n * the author almost certainly wants. An explicit `width`/`height` always wins;\r\n * this only adjusts the *default* used when neither is given.\r\n *\r\n * `\"horizontal\"`/`\"vertical\"` only promote their single main axis;\r\n * `\"freeform\"` (the default, and the mode with no distinct main axis) checks\r\n * both axes independently.\r\n */\r\n protected override applyDefaultSize(props?: NodeConfig<any, P>): void {\r\n const children = Node2D.flowChildrenProp(props);\r\n const hasChildren = children.length > 0;\r\n const flow: FlowMode = (props as any)?.flow ?? \"freeform\";\r\n\r\n // `grid` counts as width-main: its column tracks are cut from the box's\r\n // width, so a child asking to fill that axis is asking for a width the\r\n // container must have decided before the tracks exist.\r\n const widthIsMain = flow === \"horizontal\" || flow === \"freeform\" || flow === \"grid\";\r\n const heightIsMain = flow === \"vertical\" || flow === \"freeform\";\r\n\r\n const defaultWidth = hasChildren && widthIsMain && Node2D.hasFillChild(children, \"width\") ? \"fill\" : hasChildren ? \"hug\" : \"fill\";\r\n const defaultHeight = hasChildren && heightIsMain && Node2D.hasFillChild(children, \"height\") ? \"fill\" : hasChildren ? \"hug\" : \"fill\";\r\n\r\n if (!props || props.width === undefined) this.applyProp(\"width\", defaultWidth, { tween: sizeInputOps.lerp });\r\n if (!props || props.height === undefined) this.applyProp(\"height\", defaultHeight, { tween: sizeInputOps.lerp });\r\n }\r\n\r\n protected override flowArrangement(): FlowSettings {\r\n return this;\r\n }\r\n\r\n // Children must sit inside the stroke; the stroke is drawn at the layout-rect\r\n // edge and would otherwise visually cover them. Only the portion of the\r\n // stroke that intrudes into the content box needs clearing, which depends on\r\n // its alignment: inside strokes (align -1) intrude their full weight, centered\r\n // strokes (align 0) half, outside strokes (align +1) none. The intrusion is\r\n // weight·(1 - align)/2.\r\n override effectivePadding(): InsetsResolved {\r\n let extra = 0;\r\n const p = this.padding as InsetsResolved;\r\n const strokes = this.stroke as StrokeResolved[];\r\n if (!strokes || !(Symbol.iterator in Object(strokes))) {\r\n return p;\r\n }\r\n for (const s of strokes) {\r\n const intrusion = s.weight * (1 - s.align) / 2;\r\n if (intrusion > extra) extra = intrusion;\r\n }\r\n if (extra === 0) return p;\r\n return {\r\n left: p.left + extra,\r\n right: p.right + extra,\r\n top: p.top + extra,\r\n bottom: p.bottom + extra,\r\n };\r\n }\r\n}\r\n"]}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ## Why these shapes exist at all
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* The engine's `Polygon` inscribes its n-gon in the node's box — the vertices
|
|
19
19
|
* sit on the box's inscribed ellipse — which is what makes a `sides` tween
|
|
20
20
|
* smooth: every vertex count is the same circle sampled differently, so a
|
|
21
21
|
* triangle morphing into a square doesn't lurch. The cost is that a triangle
|
|
@@ -37,7 +37,7 @@ import type { CornerRadiusResolved } from "../../attributes/shape/corners/corner
|
|
|
37
37
|
import type { CornerStyle } from "../../attributes/shape/corners/corner-style.js";
|
|
38
38
|
import type { VectorPath } from "../../attributes/shape/path/types.js";
|
|
39
39
|
/** The shape types this module can draw an outline for. */
|
|
40
|
-
export type ShapeOutlineKind = "rect" | "ellipse" | "polygon" | "polygram" | "triangle" | "rightTriangle" | "pentagon" | "hexagon" | "octagon" | "star"
|
|
40
|
+
export type ShapeOutlineKind = "rect" | "ellipse" | "polygon" | "polygram" | "triangle" | "rightTriangle" | "pentagon" | "hexagon" | "octagon" | "star";
|
|
41
41
|
/** Everything an outline can depend on. Unstated fields take the schema's default. */
|
|
42
42
|
export interface ShapeOutlineOptions {
|
|
43
43
|
/** The node's box, in pixels. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-outline.d.ts","sourceRoot":"","sources":["../../../src/nodes/geometry/shape-outline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAI3E,OAAO,KAAK,EAA2B,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEzF,2DAA2D;AAC3D,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,UAAU,GACV,SAAS,GACT,SAAS,GACT,MAAM,
|
|
1
|
+
{"version":3,"file":"shape-outline.d.ts","sourceRoot":"","sources":["../../../src/nodes/geometry/shape-outline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAI3E,OAAO,KAAK,EAA2B,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEzF,2DAA2D;AAC3D,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,SAAS,GACT,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,UAAU,GACV,SAAS,GACT,SAAS,GACT,MAAM,CAAA;AAEV,sFAAsF;AACtF,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,qFAAqF;IACrF,YAAY,CAAC,EAAE,MAAM,GAAG,oBAAoB,CAAA;IAC5C,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAkBD;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAA;AAEvC,mDAAmD;AACnD,eAAO,MAAM,mBAAmB,IAAI,CAAA;AAEpC;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,mBAAmB,GAC3B,UAAU,CA8EZ;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,mBAAmB,GAC3B,UAAU,CAKZ;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,gBAAgB,CAEtE"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* ## Why these shapes exist at all
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* The engine's `Polygon` inscribes its n-gon in the node's box — the vertices
|
|
19
19
|
* sit on the box's inscribed ellipse — which is what makes a `sides` tween
|
|
20
20
|
* smooth: every vertex count is the same circle sampled differently, so a
|
|
21
21
|
* triangle morphing into a square doesn't lurch. The cost is that a triangle
|
|
@@ -78,16 +78,6 @@ export function shapeOutlinePixels(kind, options) {
|
|
|
78
78
|
return [rectOutline(width, height, options)];
|
|
79
79
|
case "ellipse":
|
|
80
80
|
return ellipseOutline(width, height, options);
|
|
81
|
-
case "line":
|
|
82
|
-
return [
|
|
83
|
-
{
|
|
84
|
-
anchors: [
|
|
85
|
-
corner({ x: -width / 2, y: 0 }),
|
|
86
|
-
corner({ x: width / 2, y: 0 }),
|
|
87
|
-
],
|
|
88
|
-
closed: false,
|
|
89
|
-
},
|
|
90
|
-
];
|
|
91
81
|
case "triangle":
|
|
92
82
|
return [
|
|
93
83
|
polygonOutline([
|
|
@@ -159,7 +149,6 @@ const OUTLINE_KINDS = new Set([
|
|
|
159
149
|
"hexagon",
|
|
160
150
|
"octagon",
|
|
161
151
|
"star",
|
|
162
|
-
"line",
|
|
163
152
|
]);
|
|
164
153
|
// ── Building blocks ────────────────────────────────────────────────────────
|
|
165
154
|
function corner(point) {
|
|
@@ -174,7 +163,7 @@ function clamp01(value) {
|
|
|
174
163
|
/**
|
|
175
164
|
* The vertices of a regular n-gon on the ellipse `rx` × `ry`, starting at the
|
|
176
165
|
* top and stepping clockwise — the same order and the same first vertex
|
|
177
|
-
*
|
|
166
|
+
* The engine's own `polygonVertices` uses, so a converted `polygon` keeps its
|
|
178
167
|
* points in the order the author has been looking at.
|
|
179
168
|
*
|
|
180
169
|
* `turn` rotates the whole figure; see {@link NAMED_POLYGONS}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape-outline.js","sourceRoot":"","sources":["../../../src/nodes/geometry/shape-outline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAqCrD;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAoD;IACtE,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;IAC/B,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;IAC9B,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;CACzC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAEvC,mDAAmD;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAEpC;;;;;;GA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;IAED,IAAI,KAAK,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,2EAA2E;QAC3E,wEAAwE;QACxE,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,EAAG,CAAA;QAC3B,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IACrC,CAAC;IACD,OAAO,OAAO,CAAA;AAChB,CAAC","sourcesContent":["/**\n * The silhouette of every shape type, as a {@link VectorPath}.\n *\n * One module, two callers with the same question asked at different scales:\n *\n * - The **shape node classes** (`nodes/shapes`) draw their outline every frame\n * from their laid-out box, so they ask in pixels.\n * - The **path editor** converts a shape into an editable Path node the moment\n * somebody moves one of its points, so it asks in the unit box the Path node\n * stores its geometry in (see `./vector-path`).\n *\n * Sharing the definition is what makes that conversion invisible: a triangle\n * that becomes a path is the *same* triangle, down to the rounding on its\n * corners, rather than a fresh approximation of one.\n *\n * ## Why these shapes exist at all\n *\n * motion-script's `Polygon` inscribes its n-gon in the node's box — the vertices\n * sit on the box's inscribed ellipse — which is what makes a `sides` tween\n * smooth: every vertex count is the same circle sampled differently, so a\n * triangle morphing into a square doesn't lurch. The cost is that a triangle\n * *doesn't touch the bottom of its own bounds*, because the two base vertices\n * sit at 30° below the horizontal rather than on the ellipse's lowest point.\n * Figma's polygon does exactly the same thing for exactly the same reason.\n *\n * That is right for a shape you intend to animate and wrong for a shape you\n * intend to *be a triangle*. So the parametric `polygon`/`polygram` keep the\n * inscribed geometry, and the named shapes here are stretched to fill their box\n * — the vertices are computed on the circle exactly as before, then their\n * bounding box is mapped onto the node's. Same silhouette, no gap.\n *\n * Everything here works in **y-down** coordinates, the convention the stored\n * `d` string uses. The node classes flip once on the way to the renderer, whose\n * local space is y-up.\n */\n\nimport type { CornerRadiusResolved } from \"@/attributes/shape/corners/corner-radius\";\nimport type { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport { distance } from \"@/attributes/shape/path/bezier\"\nimport { pathOps } from \"@/attributes/shape/path/ops\"\nimport type { PathAnchor, PathSubpath, VectorPath } from \"@/attributes/shape/path/types\";\n\n/** The shape types this module can draw an outline for. */\nexport type ShapeOutlineKind =\n | \"rect\"\n | \"ellipse\"\n | \"polygon\"\n | \"polygram\"\n | \"triangle\"\n | \"rightTriangle\"\n | \"pentagon\"\n | \"hexagon\"\n | \"octagon\"\n | \"star\"\n | \"line\"\n\n/** Everything an outline can depend on. Unstated fields take the schema's default. */\nexport interface ShapeOutlineOptions {\n /** The node's box, in pixels. */\n width: number\n height: number\n /** Vertex/corner rounding, in pixels. Ignored by the shapes that have no corners. */\n cornerRadius?: number | CornerRadiusResolved\n cornerStyle?: CornerStyle\n /** Vertex count — `polygon`/`polygram`'s `sides`, `star`'s number of points. */\n sides?: number\n /**\n * The inner radius as a fraction of the outer one: a polygram's or star's\n * point depth, and an ellipse's donut hole.\n */\n ratio?: number\n /** The ellipse's arc, in degrees. */\n startAngle?: number\n sweep?: number\n}\n\n/**\n * The named shapes' vertex counts and how far they're turned from \"a vertex at\n * the top\".\n *\n * Pointy-top is the regular polygon's natural orientation and the one every icon\n * set draws a pentagon and a hexagon in. The octagon is the exception, and it is\n * not a matter of taste: an octagon with a vertex at the top reads as a rotated\n * stop sign, because a stop sign is the only octagon most people have ever\n * looked at and it has a flat top. Half a step turns it into that one.\n */\nconst NAMED_POLYGONS: Record<string, { sides: number; turn: number }> = {\n pentagon: { sides: 5, turn: 0 },\n hexagon: { sides: 6, turn: 0 },\n octagon: { sides: 8, turn: Math.PI / 8 },\n}\n\n/**\n * A star's default point depth: the classic five-pointed star, where the inner\n * vertices sit where the extended edges of a pentagram cross.\n *\n * Not the polygram node's 50%, and deliberately so. The parametric polygram\n * opens at a round number because it is a *control* you are expected to move;\n * this node exists for the person who wanted a star and got a geometry lesson,\n * so it opens on the star they were picturing.\n */\nexport const STAR_DEFAULT_RATIO = 0.382\n\n/** The default number of points on a Star node. */\nexport const STAR_DEFAULT_POINTS = 5\n\n/**\n * The shape's outline in **pixel** space: centred on the origin, spanning\n * `width` × `height`, y-down.\n *\n * Returns an empty path for a degenerate box, which draws nothing rather than\n * producing NaN coordinates the renderer would have to cope with.\n */\nexport function shapeOutlinePixels(\n kind: ShapeOutlineKind,\n options: ShapeOutlineOptions\n): VectorPath {\n const { width, height } = options\n if (!(width > 0) || !(height > 0)) return []\n\n switch (kind) {\n case \"rect\":\n return [rectOutline(width, height, options)]\n case \"ellipse\":\n return ellipseOutline(width, height, options)\n case \"line\":\n return [\n {\n anchors: [\n corner({ x: -width / 2, y: 0 }),\n corner({ x: width / 2, y: 0 }),\n ],\n closed: false,\n },\n ]\n case \"triangle\":\n return [\n polygonOutline(\n [\n { x: 0, y: -height / 2 },\n { x: width / 2, y: height / 2 },\n { x: -width / 2, y: height / 2 },\n ],\n options\n ),\n ]\n case \"rightTriangle\":\n return [\n polygonOutline(\n [\n { x: -width / 2, y: -height / 2 },\n { x: width / 2, y: height / 2 },\n { x: -width / 2, y: height / 2 },\n ],\n options\n ),\n ]\n case \"polygon\":\n // The parametric one: inscribed, *not* stretched — see the module note.\n return [\n polygonOutline(\n regularVertices(sidesOf(options, 5), 0, width / 2, height / 2),\n options\n ),\n ]\n case \"polygram\":\n return [\n polygonOutline(\n starVertices(\n sidesOf(options, 5),\n clamp01(options.ratio ?? 0.5),\n width / 2,\n height / 2\n ),\n options\n ),\n ]\n case \"star\":\n return [\n polygonOutline(\n fillBox(\n starVertices(\n sidesOf(options, STAR_DEFAULT_POINTS),\n clamp01(options.ratio ?? STAR_DEFAULT_RATIO),\n 1,\n 1\n ),\n width,\n height\n ),\n options\n ),\n ]\n default: {\n const named = NAMED_POLYGONS[kind]\n if (!named) return []\n return [\n polygonOutline(\n fillBox(regularVertices(named.sides, named.turn, 1, 1), width, height),\n options\n ),\n ]\n }\n }\n}\n\n/**\n * The same outline in the **unit box** a Path node stores — pixels divided by\n * the node's own size, so the geometry is a fraction of the box rather than a\n * count of pixels inside it.\n *\n * This is what a shape→path conversion writes. Dividing at the end rather than\n * computing in unit space throughout is what keeps a corner radius circular: a\n * 20px corner on a 400×200 node is 0.05 × 0.1 of the box, and only comes back\n * out round because the renderer multiplies by the same two numbers.\n */\nexport function shapeOutline(\n kind: ShapeOutlineKind,\n options: ShapeOutlineOptions\n): VectorPath {\n const { width, height } = options\n const pixels = shapeOutlinePixels(kind, options)\n if (!(width > 0) || !(height > 0)) return pixels\n return pathOps.map(pixels, (p) => ({ x: p.x / width, y: p.y / height }))\n}\n\n/** Whether this module knows how to draw a type — i.e. whether it can be edited as a path. */\nexport function hasShapeOutline(kind: string): kind is ShapeOutlineKind {\n return OUTLINE_KINDS.has(kind)\n}\n\nconst OUTLINE_KINDS: ReadonlySet<string> = new Set<ShapeOutlineKind>([\n \"rect\",\n \"ellipse\",\n \"polygon\",\n \"polygram\",\n \"triangle\",\n \"rightTriangle\",\n \"pentagon\",\n \"hexagon\",\n \"octagon\",\n \"star\",\n \"line\",\n])\n\n// ── Building blocks ────────────────────────────────────────────────────────\n\nfunction corner(point: Vector2): PathAnchor {\n return { point, inHandle: null, outHandle: null }\n}\n\nfunction sidesOf(options: ShapeOutlineOptions, fallback: number): number {\n return Math.max(3, Math.round(options.sides ?? fallback))\n}\n\nfunction clamp01(value: number): number {\n return Math.max(0, Math.min(1, value))\n}\n\n\n/**\n * The vertices of a regular n-gon on the ellipse `rx` × `ry`, starting at the\n * top and stepping clockwise — the same order and the same first vertex\n * motion-script's own `polygonVertices` uses, so a converted `polygon` keeps its\n * points in the order the author has been looking at.\n *\n * `turn` rotates the whole figure; see {@link NAMED_POLYGONS}.\n */\nfunction regularVertices(\n sides: number,\n turn: number,\n rx: number,\n ry: number\n): Vector2[] {\n const step = (2 * Math.PI) / sides\n const out: Vector2[] = []\n for (let i = 0; i < sides; i++) {\n // −π/2 is straight up in y-down coordinates.\n const a = -Math.PI / 2 + turn + i * step\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) })\n }\n return out\n}\n\n/** Outer and inner vertices alternating — a star with `points` points. */\nfunction starVertices(\n points: number,\n ratio: number,\n rx: number,\n ry: number\n): Vector2[] {\n const step = Math.PI / points\n const out: Vector2[] = []\n for (let i = 0; i < points * 2; i++) {\n const a = -Math.PI / 2 + i * step\n const k = i % 2 === 0 ? 1 : ratio\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) })\n }\n return out\n}\n\n/**\n * Stretches a vertex ring so its bounding box *is* the node's box.\n *\n * The one line that separates a shape from its parametric sibling. Everything\n * before it is the inscribed figure; this maps that figure's own extent onto the\n * box, so the flat base of a triangle lands on the bottom edge and a pentagon's\n * two lower vertices land on the left and right ones.\n *\n * A ring with no extent on an axis (which no shape here produces, but a\n * `sides: 3` star with ratio 0 comes close) keeps that axis rather than dividing\n * by zero.\n */\nfunction fillBox(points: Vector2[], width: number, height: number): Vector2[] {\n if (points.length === 0) return points\n let minX = Infinity\n let minY = Infinity\n let maxX = -Infinity\n let maxY = -Infinity\n for (const p of points) {\n if (p.x < minX) minX = p.x\n if (p.x > maxX) maxX = p.x\n if (p.y < minY) minY = p.y\n if (p.y > maxY) maxY = p.y\n }\n const spanX = maxX - minX\n const spanY = maxY - minY\n const kx = spanX > 1e-9 ? width / spanX : 1\n const ky = spanY > 1e-9 ? height / spanY : 1\n const cx = (minX + maxX) / 2\n const cy = (minY + maxY) / 2\n return points.map((p) => ({ x: (p.x - cx) * kx, y: (p.y - cy) * ky }))\n}\n\n// ── Corners ────────────────────────────────────────────────────────────────\n\n/**\n * The cubic control-point offset that approximates a circular arc, as a\n * fraction of the distance from the tangent point to the corner.\n *\n * `k = (4/3)·tan(φ/4) / tan(φ/2)`, where φ is the arc's central angle. The\n * familiar 0.5523 is this at φ = 90°; a shallow corner needs less and a sharp\n * one needs more, which is why the constant can't simply be hard-coded — a\n * five-pointed star's inner vertices turn through nearly 180°, where 0.5523\n * would visibly flatten the curve.\n */\nfunction arcHandleRatio(sweep: number): number {\n const half = sweep / 2\n if (Math.abs(half) < 1e-6) return 0\n return ((4 / 3) * Math.tan(sweep / 4)) / Math.tan(half)\n}\n\n/**\n * A closed ring of vertices as a subpath, with each corner rounded or chamfered\n * by `cornerRadius`.\n *\n * The radius is clamped per corner to half of each adjacent edge, so a large\n * radius on a small shape rounds it as far as it can go instead of turning the\n * outline inside out. A radius of zero (or a `cornerStyle` of neither kind)\n * returns the plain polygon, which is the common case and costs nothing.\n */\nfunction polygonOutline(\n points: Vector2[],\n options: ShapeOutlineOptions\n): PathSubpath {\n const radius = uniformRadius(options.cornerRadius)\n if (points.length < 3 || radius <= 0) {\n return { anchors: points.map(corner), closed: true }\n }\n const style = options.cornerStyle ?? \"rounded\"\n\n const anchors: PathAnchor[] = []\n for (let i = 0; i < points.length; i++) {\n const c = points[i]\n const prev = points[(i - 1 + points.length) % points.length]\n const next = points[(i + 1) % points.length]\n\n const toPrev = direction(c, prev)\n const toNext = direction(c, next)\n if (!toPrev || !toNext) {\n anchors.push(corner(c))\n continue\n }\n\n // The interior angle at this vertex, and the arc that replaces it.\n const cosine = Math.max(-1, Math.min(1, toPrev.x * toNext.x + toPrev.y * toNext.y))\n const interior = Math.acos(cosine)\n // A vertex where the two edges double back on themselves has no corner to\n // round; leaving it sharp is the only honest answer.\n if (interior < 1e-6 || Math.PI - interior < 1e-6) {\n anchors.push(corner(c))\n continue\n }\n\n // How far back along each edge the arc starts. Never more than half the\n // edge, so two adjacent corners can't overlap.\n const tangent = Math.min(\n radius / Math.tan(interior / 2),\n distance(c, prev) / 2,\n distance(c, next) / 2\n )\n const a = { x: c.x + toPrev.x * tangent, y: c.y + toPrev.y * tangent }\n const b = { x: c.x + toNext.x * tangent, y: c.y + toNext.y * tangent }\n\n if (style === \"angled\") {\n // A chamfer: the same two tangent points, joined by a straight line.\n anchors.push(corner(a), corner(b))\n continue\n }\n\n const k = arcHandleRatio(Math.PI - interior)\n anchors.push(\n { point: a, inHandle: null, outHandle: { x: a.x + (c.x - a.x) * k, y: a.y + (c.y - a.y) * k } },\n { point: b, inHandle: { x: b.x + (c.x - b.x) * k, y: b.y + (c.y - b.y) * k }, outHandle: null }\n )\n }\n return { anchors, closed: true }\n}\n\n/** The unit vector from `from` towards `to`, or null when they coincide. */\nfunction direction(from: Vector2, to: Vector2): Vector2 | null {\n const dx = to.x - from.x\n const dy = to.y - from.y\n const len = Math.hypot(dx, dy)\n if (len < 1e-9) return null\n return { x: dx / len, y: dy / len }\n}\n\n\n/**\n * A single radius from whichever shape the value arrived in.\n *\n * A per-corner value only means anything on a rect, which builds its outline\n * corner by corner below; every other shape takes the smallest of the four, so\n * converting a rect with mixed corners into a polygon can't silently invent a\n * radius bigger than any the author set.\n */\nfunction uniformRadius(value: number | CornerRadiusResolved | undefined): number {\n if (value === undefined) return 0\n if (typeof value === \"number\") return Math.max(0, value)\n return Math.max(\n 0,\n Math.min(value.topLeft, value.topRight, value.bottomLeft, value.bottomRight)\n )\n}\n\n// ── Rect ───────────────────────────────────────────────────────────────────\n\n/**\n * A rectangle, with each corner carrying its own radius.\n *\n * Written out rather than routed through {@link polygonOutline} because a rect\n * is the one shape whose corners are *individually* set, and because its right\n * angles make the arc exact: the tangent length equals the radius and the handle\n * ratio is the familiar 0.5523, with no trigonometry involved.\n */\nfunction rectOutline(\n width: number,\n height: number,\n options: ShapeOutlineOptions\n): PathSubpath {\n const radii = perCornerRadii(options.cornerRadius, width, height)\n const style = options.cornerStyle ?? \"rounded\"\n const x = width / 2\n const y = height / 2\n const k = arcHandleRatio(Math.PI / 2)\n\n const anchors: PathAnchor[] = []\n /**\n * One corner, walking clockwise from the top-left: `at` is the sharp corner,\n * `from`/`to` the directions the outline arrives and leaves along.\n */\n const push = (\n at: Vector2,\n incoming: Vector2,\n outgoing: Vector2,\n r: number\n ) => {\n if (r <= 0) {\n anchors.push(corner(at))\n return\n }\n const a = { x: at.x - incoming.x * r, y: at.y - incoming.y * r }\n const b = { x: at.x + outgoing.x * r, y: at.y + outgoing.y * r }\n if (style === \"angled\") {\n anchors.push(corner(a), corner(b))\n return\n }\n anchors.push(\n { point: a, inHandle: null, outHandle: { x: a.x + (at.x - a.x) * k, y: a.y + (at.y - a.y) * k } },\n { point: b, inHandle: { x: b.x + (at.x - b.x) * k, y: b.y + (at.y - b.y) * k }, outHandle: null }\n )\n }\n\n const right = { x: 1, y: 0 }\n const down = { x: 0, y: 1 }\n const left = { x: -1, y: 0 }\n const up = { x: 0, y: -1 }\n // Clockwise, and the *incoming* direction is the one the walk is travelling\n // when it reaches the corner — not the edge it is about to leave along. The\n // loop closes back into the top-left from the bottom-left, so it arrives there\n // heading **up**; `down` put that corner's first anchor a radius *above* the\n // rectangle and drew the arc back into the box, which is the reversed top-left\n // corner you get on any rounded rect converted to a path.\n push({ x: -x, y: -y }, up, right, radii.topLeft)\n push({ x, y: -y }, right, down, radii.topRight)\n push({ x, y }, down, left, radii.bottomRight)\n push({ x: -x, y }, left, up, radii.bottomLeft)\n return { anchors, closed: true }\n}\n\n/** The four radii, clamped so opposite corners on an edge can't overlap. */\nfunction perCornerRadii(\n value: number | CornerRadiusResolved | undefined,\n width: number,\n height: number\n): CornerRadiusResolved {\n const raw: CornerRadiusResolved =\n value === undefined\n ? { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }\n : typeof value === \"number\"\n ? {\n topLeft: value,\n topRight: value,\n bottomLeft: value,\n bottomRight: value,\n }\n : value\n const cap = Math.min(width, height) / 2\n return {\n topLeft: Math.max(0, Math.min(raw.topLeft, cap)),\n topRight: Math.max(0, Math.min(raw.topRight, cap)),\n bottomLeft: Math.max(0, Math.min(raw.bottomLeft, cap)),\n bottomRight: Math.max(0, Math.min(raw.bottomRight, cap)),\n }\n}\n\n// ── Ellipse ────────────────────────────────────────────────────────────────\n\n/**\n * The ellipse family: a full oval, an arc (`sweep` under 360°), a ring\n * (`ratio` above 0), and the wedge the two make together.\n *\n * The arc is emitted as cubics rather than as an SVG `A` command, and that is\n * the whole reason this is worth writing out. A Path node's geometry is stored\n * as a fraction of its box and multiplied back by the box's *two* dimensions —\n * so an arc, whose parameters describe a circle rather than a set of points,\n * would come out of a non-uniform resize as a different curve rather than a\n * stretched one. Cubics survive that transform exactly.\n */\nfunction ellipseOutline(\n width: number,\n height: number,\n options: ShapeOutlineOptions\n): VectorPath {\n const rx = width / 2\n const ry = height / 2\n const inner = clamp01(options.ratio ?? 0)\n const sweep = Math.max(0, Math.min(360, options.sweep ?? 360))\n if (sweep <= 0) return []\n\n // A full oval with no hole is the common case: one closed ring.\n const full = sweep >= 360\n // Degrees clockwise from twelve o'clock, matching the appearance schema's\n // `startAngle` — which is measured the way a clock face is, not the way\n // `Math.atan2` is.\n const from = ((options.startAngle ?? 0) - 90) * (Math.PI / 180)\n const to = from + sweep * (Math.PI / 180)\n\n if (full && inner <= 0) {\n return [{ anchors: arcAnchors(rx, ry, from, to, true), closed: true }]\n }\n if (full) {\n // A ring: two closed rings, the inner one wound the other way so the\n // even-odd fill leaves a hole.\n return [\n { anchors: arcAnchors(rx, ry, from, to, true), closed: true },\n { anchors: arcAnchors(rx * inner, ry * inner, to, from, true), closed: true },\n ]\n }\n\n // An arc, closed back on itself: out along the outer edge, back along the\n // inner one (or through the centre, when there is no hole).\n const outer = arcAnchors(rx, ry, from, to, false)\n const back =\n inner > 0\n ? arcAnchors(rx * inner, ry * inner, to, from, false)\n : [corner({ x: 0, y: 0 })]\n return [{ anchors: [...outer, ...back], closed: true }]\n}\n\n/**\n * An elliptical arc as a run of anchors, split into segments of at most 90° —\n * the span a single cubic approximates to within a fraction of a pixel.\n *\n * `whole` drops the duplicated final anchor, for the case where the arc closes\n * back on its own start.\n */\nfunction arcAnchors(\n rx: number,\n ry: number,\n from: number,\n to: number,\n whole: boolean\n): PathAnchor[] {\n const total = to - from\n const steps = Math.max(1, Math.ceil(Math.abs(total) / (Math.PI / 2)))\n const step = total / steps\n // The classic elliptical-arc approximation: each control point sits α along\n // the curve's own tangent, with α = (4/3)·tan(Δ/4) for a segment spanning Δ.\n // Signed with the step, so a clockwise arc bulges the right way.\n const alpha = (4 / 3) * Math.tan(step / 4)\n\n const anchors: PathAnchor[] = []\n for (let i = 0; i <= steps; i++) {\n const a = from + step * i\n const point = { x: rx * Math.cos(a), y: ry * Math.sin(a) }\n // d/da of the point — the arc's tangent at this angle.\n const tangent = { x: -rx * Math.sin(a), y: ry * Math.cos(a) }\n const offset = { x: tangent.x * alpha, y: tangent.y * alpha }\n anchors.push({\n point,\n inHandle:\n i === 0 ? null : { x: point.x - offset.x, y: point.y - offset.y },\n outHandle:\n i === steps ? null : { x: point.x + offset.x, y: point.y + offset.y },\n })\n }\n\n if (whole && anchors.length > 1) {\n // The arc came back to where it started; fold the duplicate into the first\n // anchor so the ring has one anchor per corner rather than two stacked.\n const last = anchors.pop()!\n anchors[0].inHandle = last.inHandle\n }\n return anchors\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shape-outline.js","sourceRoot":"","sources":["../../../src/nodes/geometry/shape-outline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAKH,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AAoCrD;;;;;;;;;GASG;AACH,MAAM,cAAc,GAAoD;IACtE,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;IAC/B,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE;IAC9B,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;CACzC,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAA;AAEvC,mDAAmD;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAA;AAEpC;;;;;;GAMG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, as a {@link VectorPath}.\r\n *\r\n * One module, two callers with the same question asked at different scales:\r\n *\r\n * - The **shape node classes** (`nodes/shapes`) draw their outline every frame\r\n * from their laid-out box, so they ask in pixels.\r\n * - The **path editor** converts a shape into an editable Path node the moment\r\n * somebody moves one of its points, so it asks in the unit box the Path node\r\n * stores its geometry in (see `./vector-path`).\r\n *\r\n * Sharing the definition is what makes that conversion invisible: a triangle\r\n * that becomes a path is the *same* triangle, down to the rounding on its\r\n * corners, rather than a fresh approximation of one.\r\n *\r\n * ## Why these shapes exist at all\r\n *\r\n * The engine's `Polygon` inscribes its n-gon in the node's box — the vertices\r\n * sit on the box's inscribed ellipse — which is what makes a `sides` tween\r\n * smooth: every vertex count is the same circle sampled differently, so a\r\n * triangle morphing into a square doesn't lurch. The cost is that a triangle\r\n * *doesn't touch the bottom of its own bounds*, because the two base vertices\r\n * sit at 30° below the horizontal rather than on the ellipse's lowest point.\r\n * Figma's polygon does exactly the same thing for exactly the same reason.\r\n *\r\n * That is right for a shape you intend to animate and wrong for a shape you\r\n * intend to *be a triangle*. So the parametric `polygon`/`polygram` keep the\r\n * inscribed geometry, and the named shapes here are stretched to fill their box\r\n * — the vertices are computed on the circle exactly as before, then their\r\n * bounding box is mapped onto the node's. Same silhouette, no gap.\r\n *\r\n * Everything here works in **y-down** coordinates, the convention the stored\r\n * `d` string uses. The node classes flip once on the way to the renderer, whose\r\n * local space is y-up.\r\n */\r\n\r\nimport type { CornerRadiusResolved } from \"@/attributes/shape/corners/corner-radius\";\r\nimport type { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { distance } from \"@/attributes/shape/path/bezier\"\r\nimport { pathOps } from \"@/attributes/shape/path/ops\"\r\nimport type { PathAnchor, PathSubpath, VectorPath } from \"@/attributes/shape/path/types\";\r\n\r\n/** The shape types this module can draw an outline for. */\r\nexport type ShapeOutlineKind =\r\n | \"rect\"\r\n | \"ellipse\"\r\n | \"polygon\"\r\n | \"polygram\"\r\n | \"triangle\"\r\n | \"rightTriangle\"\r\n | \"pentagon\"\r\n | \"hexagon\"\r\n | \"octagon\"\r\n | \"star\"\r\n\r\n/** Everything an outline can depend on. Unstated fields take the schema's default. */\r\nexport interface ShapeOutlineOptions {\r\n /** The node's box, in pixels. */\r\n width: number\r\n height: number\r\n /** Vertex/corner rounding, in pixels. Ignored by the shapes that have no corners. */\r\n cornerRadius?: number | CornerRadiusResolved\r\n cornerStyle?: CornerStyle\r\n /** Vertex count — `polygon`/`polygram`'s `sides`, `star`'s number of points. */\r\n sides?: number\r\n /**\r\n * The inner radius as a fraction of the outer one: a polygram's or star's\r\n * point depth, and an ellipse's donut hole.\r\n */\r\n ratio?: number\r\n /** The ellipse's arc, in degrees. */\r\n startAngle?: number\r\n sweep?: number\r\n}\r\n\r\n/**\r\n * The named shapes' vertex counts and how far they're turned from \"a vertex at\r\n * the top\".\r\n *\r\n * Pointy-top is the regular polygon's natural orientation and the one every icon\r\n * set draws a pentagon and a hexagon in. The octagon is the exception, and it is\r\n * not a matter of taste: an octagon with a vertex at the top reads as a rotated\r\n * stop sign, because a stop sign is the only octagon most people have ever\r\n * looked at and it has a flat top. Half a step turns it into that one.\r\n */\r\nconst NAMED_POLYGONS: Record<string, { sides: number; turn: number }> = {\r\n pentagon: { sides: 5, turn: 0 },\r\n hexagon: { sides: 6, turn: 0 },\r\n octagon: { sides: 8, turn: Math.PI / 8 },\r\n}\r\n\r\n/**\r\n * A star's default point depth: the classic five-pointed star, where the inner\r\n * vertices sit where the extended edges of a pentagram cross.\r\n *\r\n * Not the polygram node's 50%, and deliberately so. The parametric polygram\r\n * opens at a round number because it is a *control* you are expected to move;\r\n * this node exists for the person who wanted a star and got a geometry lesson,\r\n * so it opens on the star they were picturing.\r\n */\r\nexport const STAR_DEFAULT_RATIO = 0.382\r\n\r\n/** The default number of points on a Star node. */\r\nexport const STAR_DEFAULT_POINTS = 5\r\n\r\n/**\r\n * The shape's outline in **pixel** space: centred on the origin, spanning\r\n * `width` × `height`, y-down.\r\n *\r\n * Returns an empty path for a degenerate box, which draws nothing rather than\r\n * producing NaN coordinates the renderer would have to cope with.\r\n */\r\nexport function shapeOutlinePixels(\r\n kind: ShapeOutlineKind,\r\n options: ShapeOutlineOptions\r\n): VectorPath {\r\n const { width, height } = options\r\n if (!(width > 0) || !(height > 0)) return []\r\n\r\n switch (kind) {\r\n case \"rect\":\r\n return [rectOutline(width, height, options)]\r\n case \"ellipse\":\r\n return ellipseOutline(width, height, options)\r\n case \"triangle\":\r\n return [\r\n polygonOutline(\r\n [\r\n { x: 0, y: -height / 2 },\r\n { x: width / 2, y: height / 2 },\r\n { x: -width / 2, y: height / 2 },\r\n ],\r\n options\r\n ),\r\n ]\r\n case \"rightTriangle\":\r\n return [\r\n polygonOutline(\r\n [\r\n { x: -width / 2, y: -height / 2 },\r\n { x: width / 2, y: height / 2 },\r\n { x: -width / 2, y: height / 2 },\r\n ],\r\n options\r\n ),\r\n ]\r\n case \"polygon\":\r\n // The parametric one: inscribed, *not* stretched — see the module note.\r\n return [\r\n polygonOutline(\r\n regularVertices(sidesOf(options, 5), 0, width / 2, height / 2),\r\n options\r\n ),\r\n ]\r\n case \"polygram\":\r\n return [\r\n polygonOutline(\r\n starVertices(\r\n sidesOf(options, 5),\r\n clamp01(options.ratio ?? 0.5),\r\n width / 2,\r\n height / 2\r\n ),\r\n options\r\n ),\r\n ]\r\n case \"star\":\r\n return [\r\n polygonOutline(\r\n fillBox(\r\n starVertices(\r\n sidesOf(options, STAR_DEFAULT_POINTS),\r\n clamp01(options.ratio ?? STAR_DEFAULT_RATIO),\r\n 1,\r\n 1\r\n ),\r\n width,\r\n height\r\n ),\r\n options\r\n ),\r\n ]\r\n default: {\r\n const named = NAMED_POLYGONS[kind]\r\n if (!named) return []\r\n return [\r\n polygonOutline(\r\n fillBox(regularVertices(named.sides, named.turn, 1, 1), width, height),\r\n options\r\n ),\r\n ]\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * The same outline in the **unit box** a Path node stores — pixels divided by\r\n * the node's own size, so the geometry is a fraction of the box rather than a\r\n * count of pixels inside it.\r\n *\r\n * This is what a shape→path conversion writes. Dividing at the end rather than\r\n * computing in unit space throughout is what keeps a corner radius circular: a\r\n * 20px corner on a 400×200 node is 0.05 × 0.1 of the box, and only comes back\r\n * out round because the renderer multiplies by the same two numbers.\r\n */\r\nexport function shapeOutline(\r\n kind: ShapeOutlineKind,\r\n options: ShapeOutlineOptions\r\n): VectorPath {\r\n const { width, height } = options\r\n const pixels = shapeOutlinePixels(kind, options)\r\n if (!(width > 0) || !(height > 0)) return pixels\r\n return pathOps.map(pixels, (p) => ({ x: p.x / width, y: p.y / height }))\r\n}\r\n\r\n/** Whether this module knows how to draw a type — i.e. whether it can be edited as a path. */\r\nexport function hasShapeOutline(kind: string): kind is ShapeOutlineKind {\r\n return OUTLINE_KINDS.has(kind)\r\n}\r\n\r\nconst OUTLINE_KINDS: ReadonlySet<string> = new Set<ShapeOutlineKind>([\r\n \"rect\",\r\n \"ellipse\",\r\n \"polygon\",\r\n \"polygram\",\r\n \"triangle\",\r\n \"rightTriangle\",\r\n \"pentagon\",\r\n \"hexagon\",\r\n \"octagon\",\r\n \"star\",\r\n])\r\n\r\n// ── Building blocks ────────────────────────────────────────────────────────\r\n\r\nfunction corner(point: Vector2): PathAnchor {\r\n return { point, inHandle: null, outHandle: null }\r\n}\r\n\r\nfunction sidesOf(options: ShapeOutlineOptions, fallback: number): number {\r\n return Math.max(3, Math.round(options.sides ?? fallback))\r\n}\r\n\r\nfunction clamp01(value: number): number {\r\n return Math.max(0, Math.min(1, value))\r\n}\r\n\r\n\r\n/**\r\n * The vertices of a regular n-gon on the ellipse `rx` × `ry`, starting at the\r\n * top and stepping clockwise — the same order and the same first vertex\r\n * The engine's own `polygonVertices` uses, so a converted `polygon` keeps its\r\n * points in the order the author has been looking at.\r\n *\r\n * `turn` rotates the whole figure; see {@link NAMED_POLYGONS}.\r\n */\r\nfunction regularVertices(\r\n sides: number,\r\n turn: number,\r\n rx: number,\r\n ry: number\r\n): Vector2[] {\r\n const step = (2 * Math.PI) / sides\r\n const out: Vector2[] = []\r\n for (let i = 0; i < sides; i++) {\r\n // −π/2 is straight up in y-down coordinates.\r\n const a = -Math.PI / 2 + turn + 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/** Outer and inner vertices alternating — a star with `points` points. */\r\nfunction starVertices(\r\n points: number,\r\n ratio: number,\r\n rx: number,\r\n ry: number\r\n): Vector2[] {\r\n const step = Math.PI / points\r\n const out: Vector2[] = []\r\n for (let i = 0; i < points * 2; i++) {\r\n const a = -Math.PI / 2 + i * step\r\n const k = i % 2 === 0 ? 1 : ratio\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 * Stretches a vertex ring so its bounding box *is* the node's box.\r\n *\r\n * The one line that separates a shape from its parametric sibling. Everything\r\n * before it is the inscribed figure; this maps that figure's own extent onto the\r\n * box, so the flat base of a triangle lands on the bottom edge and a pentagon's\r\n * two lower vertices land on the left and right ones.\r\n *\r\n * A ring with no extent on an axis (which no shape here produces, but a\r\n * `sides: 3` star with ratio 0 comes close) keeps that axis rather than dividing\r\n * by zero.\r\n */\r\nfunction fillBox(points: Vector2[], width: number, height: number): Vector2[] {\r\n if (points.length === 0) return points\r\n let minX = Infinity\r\n let minY = Infinity\r\n let maxX = -Infinity\r\n let maxY = -Infinity\r\n for (const p of points) {\r\n if (p.x < minX) minX = p.x\r\n if (p.x > maxX) maxX = p.x\r\n if (p.y < minY) minY = p.y\r\n if (p.y > maxY) maxY = p.y\r\n }\r\n const spanX = maxX - minX\r\n const spanY = maxY - minY\r\n const kx = spanX > 1e-9 ? width / spanX : 1\r\n const ky = spanY > 1e-9 ? height / spanY : 1\r\n const cx = (minX + maxX) / 2\r\n const cy = (minY + maxY) / 2\r\n return points.map((p) => ({ x: (p.x - cx) * kx, y: (p.y - cy) * ky }))\r\n}\r\n\r\n// ── Corners ────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * The cubic control-point offset that approximates a circular arc, as a\r\n * fraction of the distance from the tangent point to the corner.\r\n *\r\n * `k = (4/3)·tan(φ/4) / tan(φ/2)`, where φ is the arc's central angle. The\r\n * familiar 0.5523 is this at φ = 90°; a shallow corner needs less and a sharp\r\n * one needs more, which is why the constant can't simply be hard-coded — a\r\n * five-pointed star's inner vertices turn through nearly 180°, where 0.5523\r\n * would visibly flatten the curve.\r\n */\r\nfunction arcHandleRatio(sweep: number): number {\r\n const half = sweep / 2\r\n if (Math.abs(half) < 1e-6) return 0\r\n return ((4 / 3) * Math.tan(sweep / 4)) / Math.tan(half)\r\n}\r\n\r\n/**\r\n * A closed ring of vertices as a subpath, with each corner rounded or chamfered\r\n * by `cornerRadius`.\r\n *\r\n * The radius is clamped per corner to half of each adjacent edge, so a large\r\n * radius on a small shape rounds it as far as it can go instead of turning the\r\n * outline inside out. A radius of zero (or a `cornerStyle` of neither kind)\r\n * returns the plain polygon, which is the common case and costs nothing.\r\n */\r\nfunction polygonOutline(\r\n points: Vector2[],\r\n options: ShapeOutlineOptions\r\n): PathSubpath {\r\n const radius = uniformRadius(options.cornerRadius)\r\n if (points.length < 3 || radius <= 0) {\r\n return { anchors: points.map(corner), closed: true }\r\n }\r\n const style = options.cornerStyle ?? \"rounded\"\r\n\r\n const anchors: PathAnchor[] = []\r\n for (let i = 0; i < points.length; i++) {\r\n const c = points[i]\r\n const prev = points[(i - 1 + points.length) % points.length]\r\n const next = points[(i + 1) % points.length]\r\n\r\n const toPrev = direction(c, prev)\r\n const toNext = direction(c, next)\r\n if (!toPrev || !toNext) {\r\n anchors.push(corner(c))\r\n continue\r\n }\r\n\r\n // The interior angle at this vertex, and the arc that replaces it.\r\n const cosine = Math.max(-1, Math.min(1, toPrev.x * toNext.x + toPrev.y * toNext.y))\r\n const interior = Math.acos(cosine)\r\n // A vertex where the two edges double back on themselves has no corner to\r\n // round; leaving it sharp is the only honest answer.\r\n if (interior < 1e-6 || Math.PI - interior < 1e-6) {\r\n anchors.push(corner(c))\r\n continue\r\n }\r\n\r\n // How far back along each edge the arc starts. Never more than half the\r\n // edge, so two adjacent corners can't overlap.\r\n const tangent = Math.min(\r\n radius / Math.tan(interior / 2),\r\n distance(c, prev) / 2,\r\n distance(c, next) / 2\r\n )\r\n const a = { x: c.x + toPrev.x * tangent, y: c.y + toPrev.y * tangent }\r\n const b = { x: c.x + toNext.x * tangent, y: c.y + toNext.y * tangent }\r\n\r\n if (style === \"angled\") {\r\n // A chamfer: the same two tangent points, joined by a straight line.\r\n anchors.push(corner(a), corner(b))\r\n continue\r\n }\r\n\r\n const k = arcHandleRatio(Math.PI - interior)\r\n anchors.push(\r\n { point: a, inHandle: null, outHandle: { x: a.x + (c.x - a.x) * k, y: a.y + (c.y - a.y) * k } },\r\n { point: b, inHandle: { x: b.x + (c.x - b.x) * k, y: b.y + (c.y - b.y) * k }, outHandle: null }\r\n )\r\n }\r\n return { anchors, closed: true }\r\n}\r\n\r\n/** The unit vector from `from` towards `to`, or null when they coincide. */\r\nfunction direction(from: Vector2, to: Vector2): Vector2 | null {\r\n const dx = to.x - from.x\r\n const dy = to.y - from.y\r\n const len = Math.hypot(dx, dy)\r\n if (len < 1e-9) return null\r\n return { x: dx / len, y: dy / len }\r\n}\r\n\r\n\r\n/**\r\n * A single radius from whichever shape the value arrived in.\r\n *\r\n * A per-corner value only means anything on a rect, which builds its outline\r\n * corner by corner below; every other shape takes the smallest of the four, so\r\n * converting a rect with mixed corners into a polygon can't silently invent a\r\n * radius bigger than any the author set.\r\n */\r\nfunction uniformRadius(value: number | CornerRadiusResolved | undefined): number {\r\n if (value === undefined) return 0\r\n if (typeof value === \"number\") return Math.max(0, value)\r\n return Math.max(\r\n 0,\r\n Math.min(value.topLeft, value.topRight, value.bottomLeft, value.bottomRight)\r\n )\r\n}\r\n\r\n// ── Rect ───────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * A rectangle, with each corner carrying its own radius.\r\n *\r\n * Written out rather than routed through {@link polygonOutline} because a rect\r\n * is the one shape whose corners are *individually* set, and because its right\r\n * angles make the arc exact: the tangent length equals the radius and the handle\r\n * ratio is the familiar 0.5523, with no trigonometry involved.\r\n */\r\nfunction rectOutline(\r\n width: number,\r\n height: number,\r\n options: ShapeOutlineOptions\r\n): PathSubpath {\r\n const radii = perCornerRadii(options.cornerRadius, width, height)\r\n const style = options.cornerStyle ?? \"rounded\"\r\n const x = width / 2\r\n const y = height / 2\r\n const k = arcHandleRatio(Math.PI / 2)\r\n\r\n const anchors: PathAnchor[] = []\r\n /**\r\n * One corner, walking clockwise from the top-left: `at` is the sharp corner,\r\n * `from`/`to` the directions the outline arrives and leaves along.\r\n */\r\n const push = (\r\n at: Vector2,\r\n incoming: Vector2,\r\n outgoing: Vector2,\r\n r: number\r\n ) => {\r\n if (r <= 0) {\r\n anchors.push(corner(at))\r\n return\r\n }\r\n const a = { x: at.x - incoming.x * r, y: at.y - incoming.y * r }\r\n const b = { x: at.x + outgoing.x * r, y: at.y + outgoing.y * r }\r\n if (style === \"angled\") {\r\n anchors.push(corner(a), corner(b))\r\n return\r\n }\r\n anchors.push(\r\n { point: a, inHandle: null, outHandle: { x: a.x + (at.x - a.x) * k, y: a.y + (at.y - a.y) * k } },\r\n { point: b, inHandle: { x: b.x + (at.x - b.x) * k, y: b.y + (at.y - b.y) * k }, outHandle: null }\r\n )\r\n }\r\n\r\n const right = { x: 1, y: 0 }\r\n const down = { x: 0, y: 1 }\r\n const left = { x: -1, y: 0 }\r\n const up = { x: 0, y: -1 }\r\n // Clockwise, and the *incoming* direction is the one the walk is travelling\r\n // when it reaches the corner — not the edge it is about to leave along. The\r\n // loop closes back into the top-left from the bottom-left, so it arrives there\r\n // heading **up**; `down` put that corner's first anchor a radius *above* the\r\n // rectangle and drew the arc back into the box, which is the reversed top-left\r\n // corner you get on any rounded rect converted to a path.\r\n push({ x: -x, y: -y }, up, right, radii.topLeft)\r\n push({ x, y: -y }, right, down, radii.topRight)\r\n push({ x, y }, down, left, radii.bottomRight)\r\n push({ x: -x, y }, left, up, radii.bottomLeft)\r\n return { anchors, closed: true }\r\n}\r\n\r\n/** The four radii, clamped so opposite corners on an edge can't overlap. */\r\nfunction perCornerRadii(\r\n value: number | CornerRadiusResolved | undefined,\r\n width: number,\r\n height: number\r\n): CornerRadiusResolved {\r\n const raw: CornerRadiusResolved =\r\n value === undefined\r\n ? { topLeft: 0, topRight: 0, bottomLeft: 0, bottomRight: 0 }\r\n : typeof value === \"number\"\r\n ? {\r\n topLeft: value,\r\n topRight: value,\r\n bottomLeft: value,\r\n bottomRight: value,\r\n }\r\n : value\r\n const cap = Math.min(width, height) / 2\r\n return {\r\n topLeft: Math.max(0, Math.min(raw.topLeft, cap)),\r\n topRight: Math.max(0, Math.min(raw.topRight, cap)),\r\n bottomLeft: Math.max(0, Math.min(raw.bottomLeft, cap)),\r\n bottomRight: Math.max(0, Math.min(raw.bottomRight, cap)),\r\n }\r\n}\r\n\r\n// ── Ellipse ────────────────────────────────────────────────────────────────\r\n\r\n/**\r\n * The ellipse family: a full oval, an arc (`sweep` under 360°), a ring\r\n * (`ratio` above 0), and the wedge the two make together.\r\n *\r\n * The arc is emitted as cubics rather than as an SVG `A` command, and that is\r\n * the whole reason this is worth writing out. A Path node's geometry is stored\r\n * as a fraction of its box and multiplied back by the box's *two* dimensions —\r\n * so an arc, whose parameters describe a circle rather than a set of points,\r\n * would come out of a non-uniform resize as a different curve rather than a\r\n * stretched one. Cubics survive that transform exactly.\r\n */\r\nfunction ellipseOutline(\r\n width: number,\r\n height: number,\r\n options: ShapeOutlineOptions\r\n): VectorPath {\r\n const rx = width / 2\r\n const ry = height / 2\r\n const inner = clamp01(options.ratio ?? 0)\r\n const sweep = Math.max(0, Math.min(360, options.sweep ?? 360))\r\n if (sweep <= 0) return []\r\n\r\n // A full oval with no hole is the common case: one closed ring.\r\n const full = sweep >= 360\r\n // Degrees clockwise from twelve o'clock, matching the appearance schema's\r\n // `startAngle` — which is measured the way a clock face is, not the way\r\n // `Math.atan2` is.\r\n const from = ((options.startAngle ?? 0) - 90) * (Math.PI / 180)\r\n const to = from + sweep * (Math.PI / 180)\r\n\r\n if (full && inner <= 0) {\r\n return [{ anchors: arcAnchors(rx, ry, from, to, true), closed: true }]\r\n }\r\n if (full) {\r\n // A ring: two closed rings, the inner one wound the other way so the\r\n // even-odd fill leaves a hole.\r\n return [\r\n { anchors: arcAnchors(rx, ry, from, to, true), closed: true },\r\n { anchors: arcAnchors(rx * inner, ry * inner, to, from, true), closed: true },\r\n ]\r\n }\r\n\r\n // An arc, closed back on itself: out along the outer edge, back along the\r\n // inner one (or through the centre, when there is no hole).\r\n const outer = arcAnchors(rx, ry, from, to, false)\r\n const back =\r\n inner > 0\r\n ? arcAnchors(rx * inner, ry * inner, to, from, false)\r\n : [corner({ x: 0, y: 0 })]\r\n return [{ anchors: [...outer, ...back], closed: true }]\r\n}\r\n\r\n/**\r\n * An elliptical arc as a run of anchors, split into segments of at most 90° —\r\n * the span a single cubic approximates to within a fraction of a pixel.\r\n *\r\n * `whole` drops the duplicated final anchor, for the case where the arc closes\r\n * back on its own start.\r\n */\r\nfunction arcAnchors(\r\n rx: number,\r\n ry: number,\r\n from: number,\r\n to: number,\r\n whole: boolean\r\n): PathAnchor[] {\r\n const total = to - from\r\n const steps = Math.max(1, Math.ceil(Math.abs(total) / (Math.PI / 2)))\r\n const step = total / steps\r\n // The classic elliptical-arc approximation: each control point sits α along\r\n // the curve's own tangent, with α = (4/3)·tan(Δ/4) for a segment spanning Δ.\r\n // Signed with the step, so a clockwise arc bulges the right way.\r\n const alpha = (4 / 3) * Math.tan(step / 4)\r\n\r\n const anchors: PathAnchor[] = []\r\n for (let i = 0; i <= steps; i++) {\r\n const a = from + step * i\r\n const point = { x: rx * Math.cos(a), y: ry * Math.sin(a) }\r\n // d/da of the point — the arc's tangent at this angle.\r\n const tangent = { x: -rx * Math.sin(a), y: ry * Math.cos(a) }\r\n const offset = { x: tangent.x * alpha, y: tangent.y * alpha }\r\n anchors.push({\r\n point,\r\n inHandle:\r\n i === 0 ? null : { x: point.x - offset.x, y: point.y - offset.y },\r\n outHandle:\r\n i === steps ? null : { x: point.x + offset.x, y: point.y + offset.y },\r\n })\r\n }\r\n\r\n if (whole && anchors.length > 1) {\r\n // The arc came back to where it started; fold the duplicate into the first\r\n // anchor so the ring has one anchor per corner rather than two stacked.\r\n const last = anchors.pop()!\r\n anchors[0].inHandle = last.inHandle\r\n }\r\n return anchors\r\n}\r\n"]}
|