@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-render-context2d.js","sourceRoot":"","sources":["../../src/render/canvas-render-context2d.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAI5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAgB,qBAAqB;IAGvC,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,qEAAqE;IACrE,0EAA0E;IAE1E;;;;OAIG;IACc,cAAc,GAAgB,EAAE,CAAC;IAElD,iDAAiD;IACjD,aAAa,CAAC,KAAuB;QACjC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,CAAC;IACnH,CAAC;IAED,iEAAiE;IACjE,YAAY;QACR,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,CAAC;IAC9B,CAAC;IAED;;;;;;;;OAQG;IACH,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC5F,CAAC;IAED,6FAA6F;IAC7F,IAAI,CAAC,QAAoB;QACrB,IAAI,CAAC,YAAY,CAAC,yBAAyB,CAAC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAClF,CAAC;IAMD;;;;;OAKG;IACH,eAAe,CAAC,KAAyB;QACrC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,+DAA+D;IACrD,gBAAgB,GAAa,EAAE,CAAC;IAE1C,kEAAkE;IACxD,aAAa;Q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AAK,IAAI,EAAE,CAAC;IAChF,CAAC;IAED,qFAAqF;IAC3E,kBAAkB;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACO,YAAY;QAClB,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import { Graphics2D } from \"./graphics2d\";\nimport type { Clip } from \"./clip\";\nimport type { TransformState } from \"./descriptors/transform\";\nimport type { FontStyle, TextStyle } from \"@/attributes/text/types\";\nimport type { Size2D } from \"@/attributes/layout/size\";\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\nimport { TextState } from \"./descriptors/text\";\nimport { TextBlockLayout } from \"./text-layout\";\nimport { EMPTY_TEXT_STYLE, textOps } from \"@/attributes/text/ops\";\nimport { applyGraphicsTextDefaults } from \"./text-defaults\";\nimport type { NodeRenderState, RasterizedSurface, RenderContext2D, RenderPass2D, SpaceRects, EffectTarget } from \"./render-context2d\";\nimport type { SceneEffect } from \"@/attributes/shape/effects/union\";\n\n/**\n * The base every {@link RenderContext2D} backend extends.\n *\n * It owns the parts of a render context that are the *same* whatever is being\n * rasterized — the text-default stack, the node scope stack, disposal — plus\n * the host-facing half of the surface (`execute`, `screenshot`, `unmount`),\n * which the {@link RenderContext2D} interface deliberately leaves out because a\n * node has no business driving a render pass from inside one.\n *\n * **`draw` is final by convention.** It resolves the ambient text defaults onto\n * the op list and hands the result to {@link drawGraphics}, which is where a\n * backend does its actual drawing. Owning that step here rather than in each\n * backend is what keeps the real renderer and the precomp asset walk agreeing\n * on which font an under-specified `text` op shapes with: a family that one\n * resolves and the other does not is a font that never loads and glyphs that\n * never paint.\n */\nexport abstract class CanvasRenderContext2D implements RenderPass2D {\n abstract measureText(text: string, fontSize: number, fontFamily: string, fontWeight?: number, letterSpacing?: number, fontStyle?: FontStyle): Size2D;\n\n // ---- Inherited text-style defaults ------------------------------------\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\n // bind, so it inherits the same defaults here instead — pushed around a\n // subtree's draw scope, and folded into each `text`/`richText` op by\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\n\n /**\n * Defaults in effect for the current draw scope, innermost last. Each entry\n * is **already merged** onto the one below it (see {@link pushTextStyle}), so\n * the top of the stack is the effective style and reading it costs nothing.\n */\n private readonly textStyleStack: TextStyle[] = [];\n\n /** See {@link RenderContext2D.pushTextStyle}. */\n pushTextStyle(style: TextStyle | null): void {\n this.textStyleStack.push(style === null ? EMPTY_TEXT_STYLE : textOps.mergeStyle(this.defaultTextStyle, style));\n }\n\n /** Close the innermost scope opened by {@link pushTextStyle}. */\n popTextStyle(): void {\n this.textStyleStack.pop();\n }\n\n /**\n * The text-style defaults in effect right now — the innermost\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\n * when no scope is open.\n *\n * Carries all ten {@link TEXT_STYLE_KEYS}, but only the shaping ones reach a\n * `Graphics2D` op; see `TEXT_SHAPING_KEYS` for why `fill`/`stroke`/`shadow`\n * stay a node-level concern.\n */\n get defaultTextStyle(): TextStyle {\n return this.textStyleStack[this.textStyleStack.length - 1] ?? textOps.preset(\"default\");\n }\n\n /** See {@link RenderContext2D.draw}. Final by convention — override {@link drawGraphics}. */\n draw(graphics: Graphics2D): void {\n this.drawGraphics(applyGraphicsTextDefaults(graphics, this.defaultTextStyle));\n }\n\n /** Paint a `Graphics2D` whose text ops have already been resolved against the\n * ambient defaults. Backends implement this instead of {@link draw}. */\n protected abstract drawGraphics(graphics: Graphics2D): void;\n\n /**\n * See {@link RenderContext2D.layoutTextBlock}. Concrete rather than abstract,\n * and `null` by default, so a backend that has no need to report glyph\n * positions is unaffected — the only thing it gives up is on-canvas text\n * editing in a host built on it.\n */\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null {\n return null;\n }\n\n /** Stack of node ids currently being drawn, innermost last. */\n protected currentNodeStack: string[] = [];\n\n /** Returns the id of the innermost node currently being drawn. */\n protected currentNodeId(): string {\n if (this.currentNodeStack.length === 0) {\n throw new Error(\"No current node in context\");\n }\n\n return this.currentNodeStack[this.currentNodeStack.length - 1];\n }\n\n /** Remove all renderer-side resources for the current node (called on unmount). */\n abstract unmount(): void;\n\n private _disposed = false;\n /** `true` after `dispose()` — the context must not be used after this point. */\n isDisposed(): boolean {\n return this._disposed;\n }\n dispose(): void {\n this._disposed = true;\n }\n\n /**\n * Execute `callback`, which issues shape/paint calls, and flush the result\n * to the underlying render target (canvas, SVG document, etc.). A callback\n * that throws still throws, and the next pass starts from a clean context.\n */\n abstract execute(callback: () => void): void;\n /** Capture the current frame as a base-64 PNG data URL, or `undefined` if unsupported. */\n abstract screenshot(): string | undefined;\n\n abstract transform(state: Partial<TransformState>): RenderContext2D;\n\n abstract beginBoolean(op: BooleanOperation): void;\n abstract endBoolean(): void;\n\n abstract beginMask(options?: MaskOptions): void;\n abstract applyMask(): void;\n abstract endMask(): void;\n\n abstract beginClip(clip: Clip): void;\n abstract endClip(): void;\n\n /** See {@link RenderContext2D.beginEffects}. No-op by default. */\n beginEffects(effects: SceneEffect[], target: EffectTarget, width: number, height: number): void { }\n endEffects(): void { }\n\n /** See {@link RenderContext2D.rasterize}. Returns `null` by default. */\n rasterize(\n width: number,\n height: number,\n draw: () => void,\n pixelRatio?: number,\n ): RasterizedSurface | null {\n return null;\n }\n\n abstract beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\n abstract endCamera(): void;\n\n /**\n * Per-node render state for each node on the draw stack, in push order\n * (innermost last). Kept parallel to `currentNodeStack` so fills with\n * `space: 'parent'` can resolve their reference rect and so\n * motion-driven effects can read the current node's velocity.\n */\n protected renderStateStack: NodeRenderState[] = [];\n\n /** See {@link RenderContext2D.readsSpaceRects}. */\n readonly readsSpaceRects: boolean = true;\n\n /** See {@link RenderContext2D.drawsVisibleOnly}. */\n readonly drawsVisibleOnly: boolean = true;\n\n /** See {@link RenderPass2D.begin}. */\n begin(state: NodeRenderState): void {\n this.currentNodeStack.push(state.id);\n this.renderStateStack.push(state);\n }\n\n /** Close the innermost node draw scope opened by `begin()`. */\n end(): void {\n this.currentNodeStack.pop();\n this.renderStateStack.pop();\n }\n\n /** Reference rects for the node currently being drawn (parent / viewport). */\n protected currentSpaceRects(): SpaceRects {\n return this.renderStateStack[this.renderStateStack.length - 1]?.rects ?? {};\n }\n\n /** Full render state (incl. velocity) for the node currently being drawn, if any. */\n protected currentRenderState(): NodeRenderState | undefined {\n return this.renderStateStack[this.renderStateStack.length - 1];\n }\n\n /**\n * Close every node and text-style scope still open. A backend calls this\n * when a pass ends, so a pass that threw cannot leave the next one inside\n * its scopes.\n */\n protected _resetScopes(): void {\n this.textStyleStack.length = 0;\n this.currentNodeStack.length = 0;\n this.renderStateStack.length = 0;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"canvas-render-context2d.js","sourceRoot":"","sources":["../../src/render/canvas-render-context2d.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAI5D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAgB,qBAAqB;IAGvC,0EAA0E;IAC1E,4EAA4E;IAC5E,2EAA2E;IAC3E,wEAAwE;IACxE,qEAAqE;IACrE,0EAA0E;IAE1E;;;;OAIG;IACc,cAAc,GAAgB,EAAE,CAAC;IAElD,iDAAiD;IACjD,aAAa,CAAC,KAAuB;QACjC,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,MAAc,IAAU,CAAC;IAClG,UAAU,KAAW,CAAC;IAEtB,wEAAwE;IACxE,SAAS,CACL,KAAa,EACb,MAAc,EACd,IAAgB,EAChB,UAAmB;QAEnB,OAAO,IAAI,CAAC;IAChB,CAAC;IAKD;;;;;OAKG;IACO,gBAAgB,GAAsB,EAAE,CAAC;IAEnD,mDAAmD;IAC1C,eAAe,GAAY,IAAI,CAAC;IAEzC,oDAAoD;IAC3C,gBAAgB,GAAY,IAAI,CAAC;IAE1C,sCAAsC;IACtC,KAAK,CAAC,KAAsB;QACxB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,+DAA+D;IAC/D,GAAG;QACC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;QAC5B,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC;IAChC,CAAC;IAED,8EAA8E;IACpE,iBAAiB;QACvB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;IAChF,CAAC;IAED,qFAAqF;IAC3E,kBAAkB;QACxB,OAAO,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;IAED;;;;OAIG;IACO,YAAY;QAClB,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,gBAAgB,CAAC,MAAM,GAAG,CAAC,CAAC;IACrC,CAAC;CACJ","sourcesContent":["import { Graphics2D } from \"./graphics2d\";\r\nimport type { Clip } from \"./clip\";\r\nimport type { TransformState } from \"./descriptors/transform\";\r\nimport type { FontStyle, TextStyle } from \"@/attributes/text/types\";\r\nimport type { Size2D } from \"@/attributes/layout/size\";\r\nimport type { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { MaskOptions } from \"@/attributes/mask/mask\";\r\nimport type { BooleanOperation } from \"@/attributes/mask/boolean\";\r\nimport { TextState } from \"./descriptors/text\";\r\nimport { TextBlockLayout } from \"./text-layout\";\r\nimport { EMPTY_TEXT_STYLE, textOps } from \"@/attributes/text/ops\";\r\nimport { applyGraphicsTextDefaults } from \"./text-defaults\";\r\nimport type { NodeRenderState, RasterizedSurface, RenderContext2D, RenderPass2D, SpaceRects, EffectTarget } from \"./render-context2d\";\r\nimport type { NodeEffect } from \"@/attributes/shape/effects/union\";\r\n\r\n/**\r\n * The base every {@link RenderContext2D} backend extends.\r\n *\r\n * It owns the parts of a render context that are the *same* whatever is being\r\n * rasterized — the text-default stack, the node scope stack, disposal — plus\r\n * the host-facing half of the surface (`execute`, `screenshot`, `unmount`),\r\n * which the {@link RenderContext2D} interface deliberately leaves out because a\r\n * node has no business driving a render pass from inside one.\r\n *\r\n * **`draw` is final by convention.** It resolves the ambient text defaults onto\r\n * the op list and hands the result to {@link drawGraphics}, which is where a\r\n * backend does its actual drawing. Owning that step here rather than in each\r\n * backend is what keeps the real renderer and the precomp asset walk agreeing\r\n * on which font an under-specified `text` op shapes with: a family that one\r\n * resolves and the other does not is a font that never loads and glyphs that\r\n * never paint.\r\n */\r\nexport abstract class CanvasRenderContext2D implements RenderPass2D {\r\n abstract measureText(text: string, fontSize: number, fontFamily: string, fontWeight?: number, letterSpacing?: number, fontStyle?: FontStyle): Size2D;\r\n\r\n // ---- Inherited text-style defaults ------------------------------------\r\n // `<DefaultTextStyle>` reaches a `Text`/`RichText` node through the context\r\n // map, applied once when the node binds. A raw `Graphics2D` has no node to\r\n // bind, so it inherits the same defaults here instead — pushed around a\r\n // subtree's draw scope, and folded into each `text`/`richText` op by\r\n // `draw()`. Same vocabulary (`TextStyle`), same precedence, two channels.\r\n\r\n /**\r\n * Defaults in effect for the current draw scope, innermost last. Each entry\r\n * is **already merged** onto the one below it (see {@link pushTextStyle}), so\r\n * the top of the stack is the effective style and reading it costs nothing.\r\n */\r\n private readonly textStyleStack: TextStyle[] = [];\r\n\r\n /** See {@link RenderContext2D.pushTextStyle}. */\r\n pushTextStyle(style: TextStyle | null): void {\r\n this.textStyleStack.push(style === null ? EMPTY_TEXT_STYLE : textOps.mergeStyle(this.defaultTextStyle, style));\r\n }\r\n\r\n /** Close the innermost scope opened by {@link pushTextStyle}. */\r\n popTextStyle(): void {\r\n this.textStyleStack.pop();\r\n }\r\n\r\n /**\r\n * The text-style defaults in effect right now — the innermost\r\n * {@link pushTextStyle} scope, or the project's `theme.typography.default`\r\n * when no scope is open.\r\n *\r\n * Carries all ten {@link TEXT_STYLE_KEYS}, but only the shaping ones reach a\r\n * `Graphics2D` op; see `TEXT_SHAPING_KEYS` for why `fill`/`stroke`/`shadow`\r\n * stay a node-level concern.\r\n */\r\n get defaultTextStyle(): TextStyle {\r\n return this.textStyleStack[this.textStyleStack.length - 1] ?? textOps.preset(\"default\");\r\n }\r\n\r\n /** See {@link RenderContext2D.draw}. Final by convention — override {@link drawGraphics}. */\r\n draw(graphics: Graphics2D): void {\r\n this.drawGraphics(applyGraphicsTextDefaults(graphics, this.defaultTextStyle));\r\n }\r\n\r\n /** Paint a `Graphics2D` whose text ops have already been resolved against the\r\n * ambient defaults. Backends implement this instead of {@link draw}. */\r\n protected abstract drawGraphics(graphics: Graphics2D): void;\r\n\r\n /**\r\n * See {@link RenderContext2D.layoutTextBlock}. Concrete rather than abstract,\r\n * and `null` by default, so a backend that has no need to report glyph\r\n * positions is unaffected — the only thing it gives up is on-canvas text\r\n * editing in a host built on it.\r\n */\r\n layoutTextBlock(state: Partial<TextState>): TextBlockLayout | null {\r\n return null;\r\n }\r\n\r\n /** Stack of node ids currently being drawn, innermost last. */\r\n protected currentNodeStack: string[] = [];\r\n\r\n /** Returns the id of the innermost node currently being drawn. */\r\n protected currentNodeId(): string {\r\n if (this.currentNodeStack.length === 0) {\r\n throw new Error(\"No current node in context\");\r\n }\r\n\r\n return this.currentNodeStack[this.currentNodeStack.length - 1];\r\n }\r\n\r\n /** Remove all renderer-side resources for the current node (called on unmount). */\r\n abstract unmount(): void;\r\n\r\n private _disposed = false;\r\n /** `true` after `dispose()` — the context must not be used after this point. */\r\n isDisposed(): boolean {\r\n return this._disposed;\r\n }\r\n dispose(): void {\r\n this._disposed = true;\r\n }\r\n\r\n /**\r\n * Execute `callback`, which issues shape/paint calls, and flush the result\r\n * to the underlying render target (canvas, SVG document, etc.). A callback\r\n * that throws still throws, and the next pass starts from a clean context.\r\n */\r\n abstract execute(callback: () => void): void;\r\n /** Capture the current frame as a base-64 PNG data URL, or `undefined` if unsupported. */\r\n abstract screenshot(): string | undefined;\r\n\r\n abstract transform(state: Partial<TransformState>): RenderContext2D;\r\n\r\n abstract beginBoolean(op: BooleanOperation): void;\r\n abstract endBoolean(): void;\r\n\r\n abstract beginMask(options?: MaskOptions): void;\r\n abstract applyMask(): void;\r\n abstract endMask(): void;\r\n\r\n abstract beginClip(clip: Clip): void;\r\n abstract endClip(): void;\r\n\r\n /** See {@link RenderContext2D.beginEffects}. No-op by default. */\r\n beginEffects(effects: NodeEffect[], target: EffectTarget, width: number, height: number): void { }\r\n endEffects(): void { }\r\n\r\n /** See {@link RenderContext2D.rasterize}. Returns `null` by default. */\r\n rasterize(\r\n width: number,\r\n height: number,\r\n draw: () => void,\r\n pixelRatio?: number,\r\n ): RasterizedSurface | null {\r\n return null;\r\n }\r\n\r\n abstract beginCamera(viewport: { x: number; y: number; width: number; height: number }, lookAt: Vector2, zoom: number, heading: number): void;\r\n abstract endCamera(): void;\r\n\r\n /**\r\n * Per-node render state for each node on the draw stack, in push order\r\n * (innermost last). Kept parallel to `currentNodeStack` so fills with\r\n * `space: 'parent'` can resolve their reference rect and so\r\n * motion-driven effects can read the current node's velocity.\r\n */\r\n protected renderStateStack: NodeRenderState[] = [];\r\n\r\n /** See {@link RenderContext2D.readsSpaceRects}. */\r\n readonly readsSpaceRects: boolean = true;\r\n\r\n /** See {@link RenderContext2D.drawsVisibleOnly}. */\r\n readonly drawsVisibleOnly: boolean = true;\r\n\r\n /** See {@link RenderPass2D.begin}. */\r\n begin(state: NodeRenderState): void {\r\n this.currentNodeStack.push(state.id);\r\n this.renderStateStack.push(state);\r\n }\r\n\r\n /** Close the innermost node draw scope opened by `begin()`. */\r\n end(): void {\r\n this.currentNodeStack.pop();\r\n this.renderStateStack.pop();\r\n }\r\n\r\n /** Reference rects for the node currently being drawn (parent / viewport). */\r\n protected currentSpaceRects(): SpaceRects {\r\n return this.renderStateStack[this.renderStateStack.length - 1]?.rects ?? {};\r\n }\r\n\r\n /** Full render state (incl. velocity) for the node currently being drawn, if any. */\r\n protected currentRenderState(): NodeRenderState | undefined {\r\n return this.renderStateStack[this.renderStateStack.length - 1];\r\n }\r\n\r\n /**\r\n * Close every node and text-style scope still open. A backend calls this\r\n * when a pass ends, so a pass that threw cannot leave the next one inside\r\n * its scopes.\r\n */\r\n protected _resetScopes(): void {\r\n this.textStyleStack.length = 0;\r\n this.currentNodeStack.length = 0;\r\n this.renderStateStack.length = 0;\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip-contains.js","sourceRoot":"","sources":["../../src/render/clip-contains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;;;GAcG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AC,CAAC,CAAC,CAAC;IAC1D,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,KAAK,CAAC;IACtD,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\nimport { Clip, ClipOp, ClipShapeOp } from \"./clip\";\nimport { withRectDescriptor } from \"./descriptors/rect\";\nimport { withEllipseDescriptor } from \"./descriptors/ellipse\";\nimport { withPolygonDescriptor } from \"./descriptors/polygon\";\nimport { withPolygramDescriptor } from \"./descriptors/polygram\";\nimport { withLineDescriptor } from \"./descriptors/line\";\nimport { cornerRadiusOps } from \"@/attributes/shape/corners/corner-radius\";\n\n/**\n * Point-in-region tests for {@link Clip}, used by node hit testing so a click\n * follows a shape's silhouette rather than its bounding box.\n *\n * Geometry only — no renderer, no CanvasKit — because a `Clip` is a declarative\n * record of primitives rather than a built path. That is what lets hit testing\n * live in `core` and share one outline definition with clipping and backdrop\n * effects: a shape declares its outline once, in `clipSelf()`, and both the\n * pixels and the grab region derive from it.\n *\n * Every point and every descriptor coordinate here is in **y-up author space**\n * (the space `Graphics2D`/`Clip` descriptors are written in; the renderer flips to\n * canvas y-down at draw time — see `flipPositionY`). Angles follow from that:\n * `startAngle`/`sweep` measure counter-clockwise from +x.\n */\n\n/** Guard against divide-by-zero on collapsed geometry. */\nconst EPS = 1e-9;\n\n/**\n * Whether `point` falls inside the region a {@link Clip} describes, within\n * `tolerance` scene units of its edge.\n *\n * Shape ops union; a `cut` subtracts the immediately preceding shape from\n * everything declared before it, mirroring how the renderer replays the op list.\n * `tolerance` widens each shape outward — including a cutter, which therefore\n * takes a slightly larger bite, keeping the test forgiving in both directions\n * rather than making a hole's rim unpickable.\n */\nexport function containsClip(clip: Clip, point: Vector2, tolerance = 0): boolean {\n return containsOps(clip.ops(), point, tolerance);\n}\n\n/** {@link containsClip} over a raw op list. */\nexport function containsOps(ops: readonly ClipOp[], point: Vector2, tolerance = 0): boolean {\n let inside = false;\n // The shape immediately preceding the current position, held back so a\n // following `cut` can subtract it instead of unioning it.\n let pending: ClipShapeOp | null = null;\n\n const flush = (): void => {\n if (pending && containsShape(pending, point, tolerance)) inside = true;\n pending = null;\n };\n\n for (const op of ops) {\n if (op.kind === \"cut\") {\n // The pending shape is the cutter: it never joins the union, and it\n // punches whatever was accumulated before it.\n if (pending && containsShape(pending, point, tolerance)) inside = false;\n pending = null;\n continue;\n }\n flush();\n pending = op;\n }\n flush();\n return inside;\n}\n\n/**\n * Dispatch one shape op to its own containment test, after undoing the shape's\n * local rotation/scale about its pivot — mirroring `BaseShape.applyShapeTransform`,\n * which bakes that same transform into the drawn path.\n */\nfunction containsShape(op: ClipShapeOp, point: Vector2, tolerance: number): boolean {\n switch (op.kind) {\n case \"rect\": {\n const s = withRectDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsRect(p, s.width, s.height, cornerRadiusOps.resolve(s.cornerRadius), tolerance);\n }\n case \"ellipse\": {\n const s = withEllipseDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsEllipse(p, s.width, s.height, s.ratio, s.sweep, s.startAngle, tolerance);\n }\n case \"polygon\": {\n const s = withPolygonDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsPolyline(p, polygonVertices(s.width, s.height, s.sides), true, tolerance);\n }\n case \"polygram\": {\n const s = withPolygramDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n return p !== null && containsPolyline(p, polygramVertices(s.width, s.height, s.sides, s.ratio), true, tolerance);\n }\n case \"line\": {\n const s = withLineDescriptor(op.state);\n const p = toShapeLocal(point, s, s.width, s.height);\n if (p === null || s.points.length === 0) return false;\n // As a clip region a polyline is filled with its contour implicitly\n // closed, whether or not `closed` was set — so test the enclosed area\n // first, then fall back to the band around the stroke itself.\n if (s.points.length >= 3 && containsPolyline(p, s.points, true, tolerance)) return true;\n return nearPolyline(p, s.points, s.closed, tolerance);\n }\n case \"path\": {\n // An arbitrary Bézier winding test is not worth carrying, and no\n // built-in shape emits a `path` clip — only a hand-built `Clip` can.\n // Fall back to the declared box.\n const s = op.state;\n const local = { x: point.x - (s.x ?? 0), y: point.y - (s.y ?? 0) };\n return containsRect(local, s.width ?? 0, s.height ?? 0, cornerRadiusOps.resolve(0), tolerance);\n }\n }\n}\n\n/** The positioning fields every shape descriptor resolves to. */\ninterface ShapePlacement {\n x: number;\n y: number;\n rotation: number;\n scale: number;\n pivot: unknown;\n}\n\n/**\n * Map `point` out of the shape's own `x`/`y`/`rotation`/`scale` (about its\n * pivot) and into the shape's un-transformed, centred frame. Returns `null` when\n * the scale is zero — the shape has collapsed and encloses nothing.\n */\nfunction toShapeLocal(point: Vector2, s: ShapePlacement, width: number, height: number): Vector2 | null {\n if (s.scale === 0) return null;\n const pivot = s.pivot as Vector2;\n // Pivot is normalised [-1, 1] about the shape centre, y-up here (the\n // renderer negates its y because it works in canvas space).\n const px = pivot.x * (width / 2);\n const py = pivot.y * (height / 2);\n // Relative to the pivot, in the parent's (unrotated) frame.\n const dx = point.x - (s.x + px);\n const dy = point.y - (s.y + py);\n // Undo the clockwise rotation: in y-up space the forward map is\n // (cos·x + sin·y, -sin·x + cos·y), so the inverse swaps the sine signs.\n const rad = (s.rotation * Math.PI) / 180;\n const cos = Math.cos(rad);\n const sin = Math.sin(rad);\n const rx = (cos * dx - sin * dy) / s.scale;\n const ry = (sin * dx + cos * dy) / s.scale;\n // Back to centre-relative: the pivot sits (px, py) from the centre.\n return { x: rx + px, y: ry + py };\n}\n\n// ─── Primitives ──────────────────────────────────────────────────────────────\n\ninterface Corners4 { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }\n\n/**\n * Axis-aligned box centred on the origin, with per-corner rounding. A corner is\n * only excluded when the point sits beyond that corner's quarter-circle, so a\n * plain rect (all radii 0) reduces to the box test exactly. `cornerStyle` is not\n * consulted: an `'angled'` chamfer cuts strictly inside the arc, so testing the\n * arc over-estimates by a sliver — the forgiving direction for a grab test.\n */\nfunction containsRect(p: Vector2, width: number, height: number, radius: Corners4, tolerance: number): boolean {\n const halfW = width / 2 + tolerance;\n const halfH = height / 2 + tolerance;\n if (Math.abs(p.x) > halfW || Math.abs(p.y) > halfH) return false;\n\n // Pick the corner the point is nearest and test its arc. Radii are clamped\n // the way any rounded-rect rasteriser clamps them: never past half the side.\n const maxR = Math.min(width, height) / 2;\n const r = Math.min(\n maxR,\n p.x <= 0\n ? (p.y >= 0 ? radius.topLeft : radius.bottomLeft)\n : (p.y >= 0 ? radius.topRight : radius.bottomRight),\n );\n if (r <= 0) return true;\n\n // Centre of that corner's arc, then the usual \"outside the quarter-circle\"\n // check — which only bites inside the corner square itself.\n const sx = Math.sign(p.x || 1);\n const sy = Math.sign(p.y || 1);\n const dx = p.x - sx * (width / 2 - r);\n const dy = p.y - sy * (height / 2 - r);\n if (Math.sign(dx || 1) !== sx || Math.sign(dy || 1) !== sy) return true;\n return dx * dx + dy * dy <= (r + tolerance) * (r + tolerance);\n}\n\n/**\n * Ellipse, honouring the same `ratio`/`sweep`/`startAngle` family the renderer\n * draws (see `EllipseShape.buildSVGPath`), so the grab region is the region that\n * was actually painted:\n *\n * - `ratio` ≤ 0 → solid disk, or a wedge for a partial sweep\n * - 0 < `ratio` < 1 → annulus / annular sector (the hole is not hittable)\n * - `ratio` ≥ 1 → the band has collapsed to the bare outer curve, so only\n * points near that curve hit\n */\nfunction containsEllipse(\n p: Vector2, width: number, height: number,\n ratio: number, sweep: number, startAngle: number,\n tolerance: number,\n): boolean {\n const rx = width / 2;\n const ry = height / 2;\n if (rx <= 0 || ry <= 0) return false;\n\n const clamped = Math.max(0, Math.min(1, ratio));\n const full = Math.abs(sweep) >= 360;\n\n // Outside the outer curve (grown by tolerance) can never hit.\n if (norm(p, rx + tolerance, ry + tolerance) > 1) return false;\n\n if (clamped > 0) {\n const inner = norm(p, Math.max(EPS, rx * clamped - tolerance), Math.max(EPS, ry * clamped - tolerance));\n if (inner < 1) return false;\n }\n\n if (full) return true;\n return withinSweep(Math.atan2(p.y / ry, p.x / rx) * (180 / Math.PI), startAngle, sweep, p, tolerance);\n}\n\n/** Normalised radius of `p` on an ellipse of half-axes `rx`/`ry` (1 = on the curve). */\nfunction norm(p: Vector2, rx: number, ry: number): number {\n return Math.hypot(p.x / rx, p.y / ry);\n}\n\n/**\n * Whether `angleDeg` lies within the arc `[startAngle, startAngle + sweep]`,\n * with `tolerance` converted to angular slack at the point's own radius so\n * grab-slop widens the wedge's straight edges too. Handles negative sweeps.\n */\nfunction withinSweep(\n angleDeg: number, startAngle: number, sweep: number,\n p: Vector2, tolerance: number,\n): boolean {\n const lo = sweep >= 0 ? startAngle : startAngle + sweep;\n const span = Math.abs(sweep);\n // Near the centre every angle is within tolerance of the wedge.\n const radius = Math.hypot(p.x, p.y);\n if (radius <= tolerance) return true;\n const slack = tolerance > 0 ? (tolerance / Math.max(radius, EPS)) * (180 / Math.PI) : 0;\n let delta = (angleDeg - lo) % 360;\n if (delta < 0) delta += 360;\n // Accept the wrap-around side within slack as well.\n return delta <= span + slack || delta >= 360 - slack;\n}\n\n/**\n * Vertices of a regular polygon inscribed in `width`×`height`, y-up author\n * space. The renderer starts at the top vertex and steps clockwise in canvas\n * space; in y-up that is `+π/2` stepping negative.\n */\nexport function polygonVertices(width: number, height: number, sides: number): Vector2[] {\n const n = Math.max(3, Math.round(sides));\n const rx = width / 2;\n const ry = height / 2;\n const step = (2 * Math.PI) / n;\n const out: Vector2[] = [];\n for (let i = 0; i < n; i++) {\n const a = Math.PI / 2 - i * step;\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) });\n }\n return out;\n}\n\n/** Vertices of a star polygon: outer radius 1 alternating with inner radius `ratio`. */\nexport function polygramVertices(width: number, height: number, sides: number, ratio: number): Vector2[] {\n const n = Math.max(3, Math.round(sides));\n const r = Math.max(0, Math.min(1, ratio));\n const rx = width / 2;\n const ry = height / 2;\n const step = Math.PI / n;\n const out: Vector2[] = [];\n for (let i = 0; i < n * 2; i++) {\n const a = Math.PI / 2 - i * step;\n const k = i % 2 === 0 ? 1 : r;\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) });\n }\n return out;\n}\n\n/**\n * Even-odd crossing test against a polygon, widened by `tolerance`: a point just\n * outside an edge still counts. `closed` also closes the last→first segment for\n * the tolerance band.\n */\nfunction containsPolyline(p: Vector2, verts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\n if (verts.length >= 3 && pointInPolygon(p, verts)) return true;\n return tolerance > 0 && nearPolyline(p, verts, closed, tolerance);\n}\n\n/** Even-odd crossing test against a closed polygon. No tolerance band. */\nexport function pointInPolygon(p: Vector2, verts: readonly Vector2[]): boolean {\n if (verts.length < 3) return false;\n let inside = false;\n for (let i = 0, j = verts.length - 1; i < verts.length; j = i++) {\n const a = verts[i];\n const b = verts[j];\n if ((a.y > p.y) !== (b.y > p.y) && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x) {\n inside = !inside;\n }\n }\n return inside;\n}\n\n/** Whether `p` is within `tolerance` of any segment of the polyline. */\nexport function nearPolyline(p: Vector2, pts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\n if (pts.length === 0) return false;\n if (pts.length === 1) return Math.hypot(p.x - pts[0].x, p.y - pts[0].y) <= tolerance;\n const last = closed ? pts.length : pts.length - 1;\n for (let i = 0; i < last; i++) {\n if (distanceToSegment(p, pts[i], pts[(i + 1) % pts.length]) <= tolerance) return true;\n }\n return false;\n}\n\n/** Shortest distance from `p` to the segment `a`–`b`. */\nexport function distanceToSegment(p: Vector2, a: Vector2, b: Vector2): number {\n const dx = b.x - a.x;\n const dy = b.y - a.y;\n const lenSq = dx * dx + dy * dy;\n if (lenSq <= EPS) return Math.hypot(p.x - a.x, p.y - a.y);\n let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq;\n t = t < 0 ? 0 : t > 1 ? 1 : t;\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"clip-contains.js","sourceRoot":"","sources":["../../src/render/clip-contains.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;;;GAcG;AAEH,0DAA0D;AAC1D,MAAM,GAAG,GAAG,IAAI,CAAC;AAEjB;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAAC,IAAU,EAAE,KAAc,EAAE,SAAS,GAAG,CAAC;IAClE,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACrD,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,WAAW,CAAC,GAAsB,EAAE,KAAc,EAAE,SAAS,GAAG,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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { Clip, ClipOp, ClipShapeOp } from \"./clip\";\r\nimport { withRectDescriptor } from \"./descriptors/rect\";\r\nimport { withEllipseDescriptor } from \"./descriptors/ellipse\";\r\nimport { withPolygonDescriptor } from \"./descriptors/polygon\";\r\nimport { withPolygramDescriptor } from \"./descriptors/polygram\";\r\nimport { withLineDescriptor } from \"./descriptors/line\";\r\nimport { cornerRadiusOps } from \"@/attributes/shape/corners/corner-radius\";\r\n\r\n/**\r\n * Point-in-region tests for {@link Clip}, used by node hit testing so a click\r\n * follows a shape's silhouette rather than its bounding box.\r\n *\r\n * Geometry only — no renderer, no CanvasKit — because a `Clip` is a declarative\r\n * record of primitives rather than a built path. That is what lets hit testing\r\n * live in `core` and share one outline definition with clipping and backdrop\r\n * effects: a shape declares its outline once, in `clipSelf()`, and both the\r\n * pixels and the grab region derive from it.\r\n *\r\n * Every point and every descriptor coordinate here is in **y-up author space**\r\n * (the space `Graphics2D`/`Clip` descriptors are written in; the renderer flips to\r\n * canvas y-down at draw time — see `flipPositionY`). Angles follow from that:\r\n * `startAngle`/`sweep` measure counter-clockwise from +x.\r\n */\r\n\r\n/** Guard against divide-by-zero on collapsed geometry. */\r\nconst EPS = 1e-9;\r\n\r\n/**\r\n * Whether `point` falls inside the region a {@link Clip} describes, within\r\n * `tolerance` scene units of its edge.\r\n *\r\n * Shape ops union; a `cut` subtracts the immediately preceding shape from\r\n * everything declared before it, mirroring how the renderer replays the op list.\r\n * `tolerance` widens each shape outward — including a cutter, which therefore\r\n * takes a slightly larger bite, keeping the test forgiving in both directions\r\n * rather than making a hole's rim unpickable.\r\n */\r\nexport function containsClip(clip: Clip, point: Vector2, tolerance = 0): boolean {\r\n return containsOps(clip.ops(), point, tolerance);\r\n}\r\n\r\n/** {@link containsClip} over a raw op list. */\r\nexport function containsOps(ops: readonly ClipOp[], point: Vector2, tolerance = 0): boolean {\r\n let inside = false;\r\n // The shape immediately preceding the current position, held back so a\r\n // following `cut` can subtract it instead of unioning it.\r\n let pending: ClipShapeOp | null = null;\r\n\r\n const flush = (): void => {\r\n if (pending && containsShape(pending, point, tolerance)) inside = true;\r\n pending = null;\r\n };\r\n\r\n for (const op of ops) {\r\n if (op.kind === \"cut\") {\r\n // The pending shape is the cutter: it never joins the union, and it\r\n // punches whatever was accumulated before it.\r\n if (pending && containsShape(pending, point, tolerance)) inside = false;\r\n pending = null;\r\n continue;\r\n }\r\n flush();\r\n pending = op;\r\n }\r\n flush();\r\n return inside;\r\n}\r\n\r\n/**\r\n * Dispatch one shape op to its own containment test, after undoing the shape's\r\n * local rotation/scale about its pivot — mirroring `BaseShape.applyShapeTransform`,\r\n * which bakes that same transform into the drawn path.\r\n */\r\nfunction containsShape(op: ClipShapeOp, point: Vector2, tolerance: number): boolean {\r\n switch (op.kind) {\r\n case \"rect\": {\r\n const s = withRectDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsRect(p, s.width, s.height, cornerRadiusOps.resolve(s.cornerRadius), tolerance);\r\n }\r\n case \"ellipse\": {\r\n const s = withEllipseDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsEllipse(p, s.width, s.height, s.ratio, s.sweep, s.startAngle, tolerance);\r\n }\r\n case \"polygon\": {\r\n const s = withPolygonDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygonVertices(s.width, s.height, s.sides), true, tolerance);\r\n }\r\n case \"polygram\": {\r\n const s = withPolygramDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n return p !== null && containsPolyline(p, polygramVertices(s.width, s.height, s.sides, s.ratio), true, tolerance);\r\n }\r\n case \"line\": {\r\n const s = withLineDescriptor(op.state);\r\n const p = toShapeLocal(point, s, s.width, s.height);\r\n if (p === null || s.points.length === 0) return false;\r\n // As a clip region a polyline is filled with its contour implicitly\r\n // closed, whether or not `closed` was set — so test the enclosed area\r\n // first, then fall back to the band around the stroke itself.\r\n if (s.points.length >= 3 && containsPolyline(p, s.points, true, tolerance)) return true;\r\n return nearPolyline(p, s.points, s.closed, tolerance);\r\n }\r\n case \"path\": {\r\n // An arbitrary Bézier winding test is not worth carrying, and no\r\n // built-in shape emits a `path` clip — only a hand-built `Clip` can.\r\n // Fall back to the declared box.\r\n const s = op.state;\r\n const local = { x: point.x - (s.x ?? 0), y: point.y - (s.y ?? 0) };\r\n return containsRect(local, s.width ?? 0, s.height ?? 0, cornerRadiusOps.resolve(0), tolerance);\r\n }\r\n }\r\n}\r\n\r\n/** The positioning fields every shape descriptor resolves to. */\r\ninterface ShapePlacement {\r\n x: number;\r\n y: number;\r\n rotation: number;\r\n scale: number;\r\n pivot: unknown;\r\n}\r\n\r\n/**\r\n * Map `point` out of the shape's own `x`/`y`/`rotation`/`scale` (about its\r\n * pivot) and into the shape's un-transformed, centred frame. Returns `null` when\r\n * the scale is zero — the shape has collapsed and encloses nothing.\r\n */\r\nfunction toShapeLocal(point: Vector2, s: ShapePlacement, width: number, height: number): Vector2 | null {\r\n if (s.scale === 0) return null;\r\n const pivot = s.pivot as Vector2;\r\n // Pivot is normalised [-1, 1] about the shape centre, y-up here (the\r\n // renderer negates its y because it works in canvas space).\r\n const px = pivot.x * (width / 2);\r\n const py = pivot.y * (height / 2);\r\n // Relative to the pivot, in the parent's (unrotated) frame.\r\n const dx = point.x - (s.x + px);\r\n const dy = point.y - (s.y + py);\r\n // Undo the clockwise rotation: in y-up space the forward map is\r\n // (cos·x + sin·y, -sin·x + cos·y), so the inverse swaps the sine signs.\r\n const rad = (s.rotation * Math.PI) / 180;\r\n const cos = Math.cos(rad);\r\n const sin = Math.sin(rad);\r\n const rx = (cos * dx - sin * dy) / s.scale;\r\n const ry = (sin * dx + cos * dy) / s.scale;\r\n // Back to centre-relative: the pivot sits (px, py) from the centre.\r\n return { x: rx + px, y: ry + py };\r\n}\r\n\r\n// ─── Primitives ──────────────────────────────────────────────────────────────\r\n\r\ninterface Corners4 { topLeft: number; topRight: number; bottomRight: number; bottomLeft: number }\r\n\r\n/**\r\n * Axis-aligned box centred on the origin, with per-corner rounding. A corner is\r\n * only excluded when the point sits beyond that corner's quarter-circle, so a\r\n * plain rect (all radii 0) reduces to the box test exactly. `cornerStyle` is not\r\n * consulted: an `'angled'` chamfer cuts strictly inside the arc, so testing the\r\n * arc over-estimates by a sliver — the forgiving direction for a grab test.\r\n */\r\nfunction containsRect(p: Vector2, width: number, height: number, radius: Corners4, tolerance: number): boolean {\r\n const halfW = width / 2 + tolerance;\r\n const halfH = height / 2 + tolerance;\r\n if (Math.abs(p.x) > halfW || Math.abs(p.y) > halfH) return false;\r\n\r\n // Pick the corner the point is nearest and test its arc. Radii are clamped\r\n // the way any rounded-rect rasteriser clamps them: never past half the side.\r\n const maxR = Math.min(width, height) / 2;\r\n const r = Math.min(\r\n maxR,\r\n p.x <= 0\r\n ? (p.y >= 0 ? radius.topLeft : radius.bottomLeft)\r\n : (p.y >= 0 ? radius.topRight : radius.bottomRight),\r\n );\r\n if (r <= 0) return true;\r\n\r\n // Centre of that corner's arc, then the usual \"outside the quarter-circle\"\r\n // check — which only bites inside the corner square itself.\r\n const sx = Math.sign(p.x || 1);\r\n const sy = Math.sign(p.y || 1);\r\n const dx = p.x - sx * (width / 2 - r);\r\n const dy = p.y - sy * (height / 2 - r);\r\n if (Math.sign(dx || 1) !== sx || Math.sign(dy || 1) !== sy) return true;\r\n return dx * dx + dy * dy <= (r + tolerance) * (r + tolerance);\r\n}\r\n\r\n/**\r\n * Ellipse, honouring the same `ratio`/`sweep`/`startAngle` family the renderer\r\n * draws (see `EllipseShape.buildSVGPath`), so the grab region is the region that\r\n * was actually painted:\r\n *\r\n * - `ratio` ≤ 0 → solid disk, or a wedge for a partial sweep\r\n * - 0 < `ratio` < 1 → annulus / annular sector (the hole is not hittable)\r\n * - `ratio` ≥ 1 → the band has collapsed to the bare outer curve, so only\r\n * points near that curve hit\r\n */\r\nfunction containsEllipse(\r\n p: Vector2, width: number, height: number,\r\n ratio: number, sweep: number, startAngle: number,\r\n tolerance: number,\r\n): boolean {\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n if (rx <= 0 || ry <= 0) return false;\r\n\r\n const clamped = Math.max(0, Math.min(1, ratio));\r\n const full = Math.abs(sweep) >= 360;\r\n\r\n // Outside the outer curve (grown by tolerance) can never hit.\r\n if (norm(p, rx + tolerance, ry + tolerance) > 1) return false;\r\n\r\n if (clamped > 0) {\r\n const inner = norm(p, Math.max(EPS, rx * clamped - tolerance), Math.max(EPS, ry * clamped - tolerance));\r\n if (inner < 1) return false;\r\n }\r\n\r\n if (full) return true;\r\n return withinSweep(Math.atan2(p.y / ry, p.x / rx) * (180 / Math.PI), startAngle, sweep, p, tolerance);\r\n}\r\n\r\n/** Normalised radius of `p` on an ellipse of half-axes `rx`/`ry` (1 = on the curve). */\r\nfunction norm(p: Vector2, rx: number, ry: number): number {\r\n return Math.hypot(p.x / rx, p.y / ry);\r\n}\r\n\r\n/**\r\n * Whether `angleDeg` lies within the arc `[startAngle, startAngle + sweep]`,\r\n * with `tolerance` converted to angular slack at the point's own radius so\r\n * grab-slop widens the wedge's straight edges too. Handles negative sweeps.\r\n */\r\nfunction withinSweep(\r\n angleDeg: number, startAngle: number, sweep: number,\r\n p: Vector2, tolerance: number,\r\n): boolean {\r\n const lo = sweep >= 0 ? startAngle : startAngle + sweep;\r\n const span = Math.abs(sweep);\r\n // Near the centre every angle is within tolerance of the wedge.\r\n const radius = Math.hypot(p.x, p.y);\r\n if (radius <= tolerance) return true;\r\n const slack = tolerance > 0 ? (tolerance / Math.max(radius, EPS)) * (180 / Math.PI) : 0;\r\n let delta = (angleDeg - lo) % 360;\r\n if (delta < 0) delta += 360;\r\n // Accept the wrap-around side within slack as well.\r\n return delta <= span + slack || delta >= 360 - slack;\r\n}\r\n\r\n/**\r\n * Vertices of a regular polygon inscribed in `width`×`height`, y-up author\r\n * space. The renderer starts at the top vertex and steps clockwise in canvas\r\n * space; in y-up that is `+π/2` stepping negative.\r\n */\r\nexport function polygonVertices(width: number, height: number, sides: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = (2 * Math.PI) / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n out.push({ x: rx * Math.cos(a), y: ry * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/** Vertices of a star polygon: outer radius 1 alternating with inner radius `ratio`. */\r\nexport function polygramVertices(width: number, height: number, sides: number, ratio: number): Vector2[] {\r\n const n = Math.max(3, Math.round(sides));\r\n const r = Math.max(0, Math.min(1, ratio));\r\n const rx = width / 2;\r\n const ry = height / 2;\r\n const step = Math.PI / n;\r\n const out: Vector2[] = [];\r\n for (let i = 0; i < n * 2; i++) {\r\n const a = Math.PI / 2 - i * step;\r\n const k = i % 2 === 0 ? 1 : r;\r\n out.push({ x: rx * k * Math.cos(a), y: ry * k * Math.sin(a) });\r\n }\r\n return out;\r\n}\r\n\r\n/**\r\n * Even-odd crossing test against a polygon, widened by `tolerance`: a point just\r\n * outside an edge still counts. `closed` also closes the last→first segment for\r\n * the tolerance band.\r\n */\r\nfunction containsPolyline(p: Vector2, verts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (verts.length >= 3 && pointInPolygon(p, verts)) return true;\r\n return tolerance > 0 && nearPolyline(p, verts, closed, tolerance);\r\n}\r\n\r\n/** Even-odd crossing test against a closed polygon. No tolerance band. */\r\nexport function pointInPolygon(p: Vector2, verts: readonly Vector2[]): boolean {\r\n if (verts.length < 3) return false;\r\n let inside = false;\r\n for (let i = 0, j = verts.length - 1; i < verts.length; j = i++) {\r\n const a = verts[i];\r\n const b = verts[j];\r\n if ((a.y > p.y) !== (b.y > p.y) && p.x < ((b.x - a.x) * (p.y - a.y)) / (b.y - a.y) + a.x) {\r\n inside = !inside;\r\n }\r\n }\r\n return inside;\r\n}\r\n\r\n/** Whether `p` is within `tolerance` of any segment of the polyline. */\r\nexport function nearPolyline(p: Vector2, pts: readonly Vector2[], closed: boolean, tolerance: number): boolean {\r\n if (pts.length === 0) return false;\r\n if (pts.length === 1) return Math.hypot(p.x - pts[0].x, p.y - pts[0].y) <= tolerance;\r\n const last = closed ? pts.length : pts.length - 1;\r\n for (let i = 0; i < last; i++) {\r\n if (distanceToSegment(p, pts[i], pts[(i + 1) % pts.length]) <= tolerance) return true;\r\n }\r\n return false;\r\n}\r\n\r\n/** Shortest distance from `p` to the segment `a`–`b`. */\r\nexport function distanceToSegment(p: Vector2, a: Vector2, b: Vector2): number {\r\n const dx = b.x - a.x;\r\n const dy = b.y - a.y;\r\n const lenSq = dx * dx + dy * dy;\r\n if (lenSq <= EPS) return Math.hypot(p.x - a.x, p.y - a.y);\r\n let t = ((p.x - a.x) * dx + (p.y - a.y) * dy) / lenSq;\r\n t = t < 0 ? 0 : t > 1 ? 1 : t;\r\n return Math.hypot(p.x - (a.x + t * dx), p.y - (a.y + t * dy));\r\n}\r\n"]}
|
package/dist/render/clip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.js","sourceRoot":"","sources":["../../src/render/clip.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAuBzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,IAAI;IACL,IAAI,GAAa,EAAE,CAAC;IAE5B,4EAA4E;IAE5E,I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AChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\nimport type { EllipseState } from \"./descriptors/ellipse\";\nimport type { PathState } from \"./descriptors/path\";\nimport type { LineState } from \"./descriptors/line\";\nimport type { PolygonState } from \"./descriptors/polygon\";\nimport type { PolygramState } from \"./descriptors/polygram\";\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\nimport { PathBuilder } from \"./descriptors/path-builder\";\n\n/**\n * The shape ops a {@link Clip} can record — the same geometry primitives a\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\n * Each carries the partial descriptor state for that shape.\n */\nexport type ClipShapeOp =\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\n | { kind: \"path\"; state: Partial<PathState> }\n | { kind: \"line\"; state: Partial<LineState> }\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\n\n/**\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\n * region; `cut` subtracts the last-declared shape from the ones before it. The\n * renderer replays this list into a single clip path via\n * `RenderContext2D.beginClip()`.\n */\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\n\n/**\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\n *\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\n * the renderer unions into a single clip path. Multiple shapes combine, so a\n * clip can be any compound silhouette, not just a single rect or ellipse:\n *\n * const c = new Clip()\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\n * .ellipse({ x: -80, width: 40, height: 40 })\n * .cut(); // punches the last hole\n * ctx.beginClip(c);\n * ...draw clipped content...\n * ctx.endClip();\n *\n * A `Clip` carries no paint — it's purely the outline. It's what a `ShapeNode`\n * returns from `clipSelf()` to describe both its `clip` boundary and the\n * silhouette its backdrop effects (blur, magnify, …) are confined to, so a\n * single definition drives every clip the node needs.\n */\nexport class Clip {\n private _ops: ClipOp[] = [];\n\n // ─── Shapes ──────────────────────────────────────────────────────────────\n\n rect(state: Partial<RectState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"rect\", state });\n return this;\n }\n\n ellipse(state: Partial<EllipseState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"ellipse\", state });\n return this;\n }\n\n /** Add a vector path to the clip region, from a `PathState` or a `PathBuilder`. */\n path(state: Partial<PathState> | PathBuilder): this {\n const resolved = state instanceof PathBuilder ? state.toPathState() : state;\n this._ops.push({ kind: \"path\", state: resolved });\n return this;\n }\n\n line(state: Partial<LineState>): this {\n this._ops.push({ kind: \"line\", state });\n return this;\n }\n\n polygon(state: Partial<PolygonState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"polygon\", state });\n return this;\n }\n\n polygram(state: Partial<PolygramState> & ShapeAlignmentInput): this {\n this._ops.push({ kind: \"polygram\", state });\n return this;\n }\n\n // ─── Compositing ─────────────────────────────────────────────────────────\n\n /**\n * Use the last-declared shape as a cutter: union the shapes before it and\n * subtract that last shape, punching a hole in the clip region. Mirrors\n * {@link Graphics2D.cut}.\n */\n cut(): this {\n this._ops.push({ kind: \"cut\" });\n return this;\n }\n\n // ─── Consumption ─────────────────────────────────────────────────────────\n\n /** The recorded ops, in order. Consumed by `RenderContext2D.beginClip()`. */\n ops(): readonly ClipOp[] {\n return this._ops;\n }\n\n /** True when no shape op has been recorded — the clip region is empty. */\n isEmpty(): boolean {\n return !this._ops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AAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E;;;;OAIG;IACH,GAAG;QACC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,4EAA4E;IAE5E,6EAA6E;IAC7E,GAAG;QACC,OAAO,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;IAED,0EAA0E;IAC1E,OAAO;QACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IACtD,CAAC;CACJ","sourcesContent":["import type { RectState } from \"./descriptors/rect\";\r\nimport type { EllipseState } from \"./descriptors/ellipse\";\r\nimport type { PathState } from \"./descriptors/path\";\r\nimport type { LineState } from \"./descriptors/line\";\r\nimport type { PolygonState } from \"./descriptors/polygon\";\r\nimport type { PolygramState } from \"./descriptors/polygram\";\r\nimport type { ShapeAlignmentInput } from \"./descriptors/shape\";\r\nimport { PathBuilder } from \"./descriptors/path-builder\";\r\n\r\n/**\r\n * The shape ops a {@link Clip} can record — the same geometry primitives a\r\n * {@link Graphics2D} can draw, minus text/image (which have no clippable outline).\r\n * Each carries the partial descriptor state for that shape.\r\n */\r\nexport type ClipShapeOp =\r\n | { kind: \"rect\"; state: Partial<RectState> & ShapeAlignmentInput }\r\n | { kind: \"ellipse\"; state: Partial<EllipseState> & ShapeAlignmentInput }\r\n | { kind: \"path\"; state: Partial<PathState> }\r\n | { kind: \"line\"; state: Partial<LineState> }\r\n | { kind: \"polygon\"; state: Partial<PolygonState> & ShapeAlignmentInput }\r\n | { kind: \"polygram\"; state: Partial<PolygramState> & ShapeAlignmentInput };\r\n\r\n/**\r\n * A single recorded op in a {@link Clip}. Shape ops add geometry to the clip\r\n * region; `cut` subtracts the last-declared shape from the ones before it. The\r\n * renderer replays this list into a single clip path via\r\n * `RenderContext2D.beginClip()`.\r\n */\r\nexport type ClipOp = ClipShapeOp | { kind: \"cut\" };\r\n\r\n/**\r\n * A renderer-agnostic, chainable clip-region builder — `Graphics2D` for clipping.\r\n *\r\n * `Clip` records a sequence of shape declarations (and optional `cut()`s) that\r\n * the renderer unions into a single clip path. Multiple shapes combine, so a\r\n * clip can be any compound silhouette, not just a single rect or ellipse:\r\n *\r\n * const c = new Clip()\r\n * .rect({ width: 200, height: 120, cornerRadius: 16 })\r\n * .ellipse({ x: 80, width: 60, height: 60 }) // unions with the rect\r\n * .ellipse({ x: -80, width: 40, height: 40 })\r\n * .cut(); // punches the last hole\r\n * ctx.beginClip(c);\r\n * ...draw clipped content...\r\n * ctx.endClip();\r\n *\r\n * A `Clip` carries no paint — it's purely the outline. It's what a `ShapeNode`\r\n * returns from `clipSelf()` to describe both its `clip` boundary and the\r\n * silhouette its backdrop effects (blur, magnify, …) are confined to, so a\r\n * single definition drives every clip the node needs.\r\n */\r\nexport class Clip {\r\n private _ops: ClipOp[] = [];\r\n\r\n // ─── Shapes ──────────────────────────────────────────────────────────────\r\n\r\n rect(state: Partial<RectState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"rect\", state });\r\n return this;\r\n }\r\n\r\n ellipse(state: Partial<EllipseState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"ellipse\", state });\r\n return this;\r\n }\r\n\r\n /** Add a vector path to the clip region, from a `PathState` or a `PathBuilder`. */\r\n path(state: Partial<PathState> | PathBuilder): this {\r\n const resolved = state instanceof PathBuilder ? state.toPathState() : state;\r\n this._ops.push({ kind: \"path\", state: resolved });\r\n return this;\r\n }\r\n\r\n line(state: Partial<LineState>): this {\r\n this._ops.push({ kind: \"line\", state });\r\n return this;\r\n }\r\n\r\n polygon(state: Partial<PolygonState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygon\", state });\r\n return this;\r\n }\r\n\r\n polygram(state: Partial<PolygramState> & ShapeAlignmentInput): this {\r\n this._ops.push({ kind: \"polygram\", state });\r\n return this;\r\n }\r\n\r\n // ─── Compositing ─────────────────────────────────────────────────────────\r\n\r\n /**\r\n * Use the last-declared shape as a cutter: union the shapes before it and\r\n * subtract that last shape, punching a hole in the clip region. Mirrors\r\n * {@link Graphics2D.cut}.\r\n */\r\n cut(): this {\r\n this._ops.push({ kind: \"cut\" });\r\n return this;\r\n }\r\n\r\n // ─── Consumption ─────────────────────────────────────────────────────────\r\n\r\n /** The recorded ops, in order. Consumed by `RenderContext2D.beginClip()`. */\r\n ops(): readonly ClipOp[] {\r\n return this._ops;\r\n }\r\n\r\n /** True when no shape op has been recorded — the clip region is empty. */\r\n isEmpty(): boolean {\r\n return !this._ops.some((op) => op.kind !== \"cut\");\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ellipse.js","sourceRoot":"","sources":["../../../src/render/descriptors/ellipse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAS7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC;KACzC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\nexport interface EllipseState extends ShapeState {\n width: number;\n height: number;\n ratio: number;\n sweep: number;\n startAngle: number;\n}\n\nexport function withEllipseDescriptor(descriptor: Partial<EllipseState> & ShapeAlignmentInput): EllipseState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n ratio: descriptor.ratio ?? 0,\n sweep: descriptor.sweep ?? 360,\n startAngle: descriptor.startAngle ?? 0,\n };\n}"]}
|
|
1
|
+
{"version":3,"file":"ellipse.js","sourceRoot":"","sources":["../../../src/render/descriptors/ellipse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAS7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,CAAC;KACzC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\nexport interface EllipseState extends ShapeState {\r\n width: number;\r\n height: number;\r\n ratio: number;\r\n sweep: number;\r\n startAngle: number;\r\n}\r\n\r\nexport function withEllipseDescriptor(descriptor: Partial<EllipseState> & ShapeAlignmentInput): EllipseState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n ratio: descriptor.ratio ?? 0,\r\n sweep: descriptor.sweep ?? 360,\r\n startAngle: descriptor.startAngle ?? 0,\r\n };\r\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"latex.js","sourceRoot":"","sources":["../../../src/render/descriptors/latex.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeState } from \"./shape\";\n\nexport interface LatexState extends ShapeState {\n latex: string;\n fontSize: number;\n}\n\n"]}
|
|
1
|
+
{"version":3,"file":"latex.js","sourceRoot":"","sources":["../../../src/render/descriptors/latex.ts"],"names":[],"mappings":"","sourcesContent":["import { ShapeState } from \"./shape\";\r\n\r\nexport interface LatexState extends ShapeState {\r\n latex: string;\r\n fontSize: number;\r\n}\r\n\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../src/render/descriptors/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQxD,MAAM,UAAU,kBAAkB,CAAC,UAA8B;IAC7D,OAAO;QACH,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC;QAE1C,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,EAAE;QAC/B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,KAAK;KACrC,CAAC;AACN,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\nimport { ShapeState, resolveShapePivot } from \"./shape\";\n\nexport interface LineState extends ShapeState {\n points: Vector2[];\n radius: number;\n closed: boolean;\n}\n\nexport function withLineDescriptor(descriptor: Partial<LineState>): LineState {\n return {\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x: descriptor.x ?? 0,\n y: descriptor.y ?? 0,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n width: descriptor.width ?? 0,\n height: descriptor.height ?? 0,\n pivot: resolveShapePivot(descriptor.pivot),\n\n points: descriptor.points ?? [],\n radius: descriptor.radius ?? 0,\n closed: descriptor.closed ?? false,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../src/render/descriptors/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAQxD,MAAM,UAAU,kBAAkB,CAAC,UAA8B;IAC7D,OAAO;QACH,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC;QACpB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,KAAK,EAAE,iBAAiB,CAAC,UAAU,CAAC,KAAK,CAAC;QAE1C,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,EAAE;QAC/B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC;QAC9B,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,KAAK;KACrC,CAAC;AACN,CAAC","sourcesContent":["import { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport { ShapeState, resolveShapePivot } from \"./shape\";\r\n\r\nexport interface LineState extends ShapeState {\r\n points: Vector2[];\r\n radius: number;\r\n closed: boolean;\r\n}\r\n\r\nexport function withLineDescriptor(descriptor: Partial<LineState>): LineState {\r\n return {\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x: descriptor.x ?? 0,\r\n y: descriptor.y ?? 0,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n pivot: resolveShapePivot(descriptor.pivot),\r\n\r\n points: descriptor.points ?? [],\r\n radius: descriptor.radius ?? 0,\r\n closed: descriptor.closed ?? false,\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path-builder.js","sourceRoot":"","sources":["../../../src/render/descriptors/path-builder.ts"],"names":[],"mappings":"AAsBA,MAAM,OAAO,WAAW;IACZ,KAAK,GAAkB,EAAE,CAAC;IAC1B,EAAE,GAAG,CAAC,CAAC;IACP,EAAE,GAAG,CAAC,CAAC;IACP,OAAO,GAAG,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC,CAAC;IACZ,KAAK,GAAG,KAAK,CAAC;IAEtB,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO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E,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;YACnD,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAED,SAAS,UAAU,CAAC,GAAe;IAC/B,OAAO;QACH,EAAE,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QACd,EAAE,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;QACd,EAAE,EAAE,GAAG,CAAC,KAAK,GAAG,CAAC;QACjB,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC;QACjC,IAAI,EAAE,GAAG,CAAC,UAAU,IAAI,CAAC;QACzB,KAAK,EAAE,GAAG,CAAC,KAAK,IAAI,GAAG;KAC1B,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,KAAa;IAC1E,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACpC,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { PathCommand } from \"./path\";\nimport type { PathState } from \"./path\";\n\n/**\n * A full or partial revolution of an ellipse, in the same **y-up** space the\n * commands themselves are authored in (`y = 100` is 100px *above* the centre,\n * matching a node's `x`/`y`). Angles are degrees from 3 o'clock, positive\n * counter-clockwise — the vocabulary the `Ellipse` node already uses.\n */\nexport interface EllipseArc {\n /** Centre. Both default to the origin. */\n x?: number;\n y?: number;\n width: number;\n /** Defaults to `width`, i.e. a circle. */\n height?: number;\n /** Where on the perimeter the curve starts. */\n startAngle?: number;\n /** Degrees travelled; negative goes clockwise. Past ±360 it keeps looping. */\n sweep?: number;\n}\n\nexport class PathBuilder {\n private _cmds: PathCommand[] = [];\n private _x = 0;\n private _y = 0;\n private _startX = 0;\n private _startY = 0;\n private _open = false;\n\n moveTo(x: number, y: number): this {\n this._cmds.push({ type: \"M\", x, y });\n this._startX = x;\n this._startY = y;\n return this._at(x, y);\n }\n\n lineTo(x: number, y: number): this {\n this._cmds.push({ type: \"L\", x, y });\n return this._at(x, y);\n }\n\n bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): this {\n this._cmds.push({ type: \"C\", x1, y1, x2, y2, x, y });\n return this._at(x, y);\n }\n\n quadraticCurveTo(x1: number, y1: number, x: number, y: number): this {\n this._cmds.push({ type: \"Q\", x1, y1, x, y });\n return this._at(x, y);\n }\n\n /** The raw SVG arc command: an elliptical arc to (`x`, `y`), picked out of the four candidates by `largeArc`/`sweep`. */\n arcTo(rx: number, ry: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1, x: number, y: number): this {\n this._cmds.push({ type: \"A\", rx, ry, rotation, largeArc, sweep, x, y });\n return this._at(x, y);\n }\n\n /**\n * An **open** elliptical arc: the perimeter of {@link EllipseArc} from\n * `startAngle` through `sweep` degrees.\n *\n * Continues the current subpath — a straight line joins the pen's position\n * to the arc's start when the two differ — so `moveTo(...).arc(...)` is one\n * unbroken curve, which is what a `moveTo` command following the path needs.\n * A new `M` there would be a subpath break the walk teleports across.\n *\n * ```ts\n * new PathBuilder().arc({ x: 0, y: 0, width: 400, startAngle: 180, sweep: -180 });\n * ```\n */\n arc(arc: EllipseArc): this {\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\n const start = pointOn(cx, cy, rx, ry, from);\n if (!this._open) this.moveTo(start.x, start.y);\n else if (start.x !== this._x || start.y !== this._y) this.lineTo(start.x, start.y);\n return this._sweep(cx, cy, rx, ry, from, sweep);\n }\n\n /**\n * A **closed** subpath tracing an ellipse — the shape form of {@link arc}.\n *\n * A `sweep` short of a full turn closes across the chord back to the start;\n * for a pie wedge or an annular sector, that is an `Ellipse` node's `ratio`.\n */\n ellipse(arc: EllipseArc): this {\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\n const start = pointOn(cx, cy, rx, ry, from);\n this.moveTo(start.x, start.y);\n this._sweep(cx, cy, rx, ry, from, sweep);\n return this.close();\n }\n\n close(): this {\n this._cmds.push({ type: \"Z\" });\n return this._at(this._startX, this._startY);\n }\n\n toCommands(): PathCommand[] {\n return [...this._cmds];\n }\n\n toPathState(partial: Omit<Partial<PathState>, \"data\"> = {}): Partial<PathState> {\n return { ...partial, data: this._cmds };\n }\n\n /** Record where the pen ended up, so {@link arc} knows whether it has to join up to its start. */\n private _at(x: number, y: number): this {\n this._x = x;\n this._y = y;\n this._open = true;\n return this;\n }\n\n /**\n * Emit the arc as segments of at most a quarter turn. One `A` command cannot\n * express a full revolution at all (its endpoints would coincide, leaving the\n * arc undefined) and grows imprecise well before that, so the split is what\n * makes `sweep` a real angle rather than a value capped just under 360.\n */\n private _sweep(cx: number, cy: number, rx: number, ry: number, from: number, sweep: number): this {\n if (sweep === 0) return this;\n const steps = Math.ceil(Math.abs(sweep) / 90);\n const step = sweep / steps;\n const direction = sweep > 0 ? 1 : 0;\n for (let i = 1; i <= steps; i++) {\n const p = pointOn(cx, cy, rx, ry, from + step * i);\n this.arcTo(rx, ry, 0, 0, direction, p.x, p.y);\n }\n return this;\n }\n}\n\nfunction resolveArc(arc: EllipseArc): { cx: number; cy: number; rx: number; ry: number; from: number; sweep: number } {\n return {\n cx: arc.x ?? 0,\n cy: arc.y ?? 0,\n rx: arc.width / 2,\n ry: (arc.height ?? arc.width) / 2,\n from: arc.startAngle ?? 0,\n sweep: arc.sweep ?? 360,\n };\n}\n\nfunction pointOn(cx: number, cy: number, rx: number, ry: number, angle: number): { x: number; y: number } {\n const rad = (angle * Math.PI) / 180;\n return { x: cx + rx * Math.cos(rad), y: cy + ry * Math.sin(rad) };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"path-builder.js","sourceRoot":"","sources":["../../../src/render/descriptors/path-builder.ts"],"names":[],"mappings":"AAsBA,MAAM,OAAO,WAAW;IACZ,KAAK,GAAkB,EAAE,CAAC;IAC1B,EAAE,GAAG,CAAC,CAAC;IACP,EAAE,GAAG,CAAC,CAAC;IACP,OAAO,GAAG,CAAC,CAAC;IACZ,OAAO,GAAG,CAAC,CAAC;IACZ,KAAK,GAAG,KAAK,CAAC;IAEtB,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,CAAS,EAAE,CAAS;QACvB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IAED,aAAa,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,CAAS,EAAE,CAAS;QAC9E,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC,GAAG,CAA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AI,GAAG;KAC1B,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,EAAU,EAAE,KAAa;IAC1E,MAAM,GAAG,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;IACpC,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;AACtE,CAAC","sourcesContent":["import { PathCommand } from \"./path\";\r\nimport type { PathState } from \"./path\";\r\n\r\n/**\r\n * A full or partial revolution of an ellipse, in the same **y-up** space the\r\n * commands themselves are authored in (`y = 100` is 100px *above* the centre,\r\n * matching a node's `x`/`y`). Angles are degrees from 3 o'clock, positive\r\n * counter-clockwise — the vocabulary the `Ellipse` node already uses.\r\n */\r\nexport interface EllipseArc {\r\n /** Centre. Both default to the origin. */\r\n x?: number;\r\n y?: number;\r\n width: number;\r\n /** Defaults to `width`, i.e. a circle. */\r\n height?: number;\r\n /** Where on the perimeter the curve starts. */\r\n startAngle?: number;\r\n /** Degrees travelled; negative goes clockwise. Past ±360 it keeps looping. */\r\n sweep?: number;\r\n}\r\n\r\nexport class PathBuilder {\r\n private _cmds: PathCommand[] = [];\r\n private _x = 0;\r\n private _y = 0;\r\n private _startX = 0;\r\n private _startY = 0;\r\n private _open = false;\r\n\r\n moveTo(x: number, y: number): this {\r\n this._cmds.push({ type: \"M\", x, y });\r\n this._startX = x;\r\n this._startY = y;\r\n return this._at(x, y);\r\n }\r\n\r\n lineTo(x: number, y: number): this {\r\n this._cmds.push({ type: \"L\", x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): this {\r\n this._cmds.push({ type: \"C\", x1, y1, x2, y2, x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n quadraticCurveTo(x1: number, y1: number, x: number, y: number): this {\r\n this._cmds.push({ type: \"Q\", x1, y1, x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n /** The raw SVG arc command: an elliptical arc to (`x`, `y`), picked out of the four candidates by `largeArc`/`sweep`. */\r\n arcTo(rx: number, ry: number, rotation: number, largeArc: 0 | 1, sweep: 0 | 1, x: number, y: number): this {\r\n this._cmds.push({ type: \"A\", rx, ry, rotation, largeArc, sweep, x, y });\r\n return this._at(x, y);\r\n }\r\n\r\n /**\r\n * An **open** elliptical arc: the perimeter of {@link EllipseArc} from\r\n * `startAngle` through `sweep` degrees.\r\n *\r\n * Continues the current subpath — a straight line joins the pen's position\r\n * to the arc's start when the two differ — so `moveTo(...).arc(...)` is one\r\n * unbroken curve, which is what a `moveTo` command following the path needs.\r\n * A new `M` there would be a subpath break the walk teleports across.\r\n *\r\n * ```ts\r\n * new PathBuilder().arc({ x: 0, y: 0, width: 400, startAngle: 180, sweep: -180 });\r\n * ```\r\n */\r\n arc(arc: EllipseArc): this {\r\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\r\n const start = pointOn(cx, cy, rx, ry, from);\r\n if (!this._open) this.moveTo(start.x, start.y);\r\n else if (start.x !== this._x || start.y !== this._y) this.lineTo(start.x, start.y);\r\n return this._sweep(cx, cy, rx, ry, from, sweep);\r\n }\r\n\r\n /**\r\n * A **closed** subpath tracing an ellipse — the shape form of {@link arc}.\r\n *\r\n * A `sweep` short of a full turn closes across the chord back to the start;\r\n * for a pie wedge or an annular sector, that is an `Ellipse` node's `ratio`.\r\n */\r\n ellipse(arc: EllipseArc): this {\r\n const { cx, cy, rx, ry, from, sweep } = resolveArc(arc);\r\n const start = pointOn(cx, cy, rx, ry, from);\r\n this.moveTo(start.x, start.y);\r\n this._sweep(cx, cy, rx, ry, from, sweep);\r\n return this.close();\r\n }\r\n\r\n close(): this {\r\n this._cmds.push({ type: \"Z\" });\r\n return this._at(this._startX, this._startY);\r\n }\r\n\r\n toCommands(): PathCommand[] {\r\n return [...this._cmds];\r\n }\r\n\r\n toPathState(partial: Omit<Partial<PathState>, \"data\"> = {}): Partial<PathState> {\r\n return { ...partial, data: this._cmds };\r\n }\r\n\r\n /** Record where the pen ended up, so {@link arc} knows whether it has to join up to its start. */\r\n private _at(x: number, y: number): this {\r\n this._x = x;\r\n this._y = y;\r\n this._open = true;\r\n return this;\r\n }\r\n\r\n /**\r\n * Emit the arc as segments of at most a quarter turn. One `A` command cannot\r\n * express a full revolution at all (its endpoints would coincide, leaving the\r\n * arc undefined) and grows imprecise well before that, so the split is what\r\n * makes `sweep` a real angle rather than a value capped just under 360.\r\n */\r\n private _sweep(cx: number, cy: number, rx: number, ry: number, from: number, sweep: number): this {\r\n if (sweep === 0) return this;\r\n const steps = Math.ceil(Math.abs(sweep) / 90);\r\n const step = sweep / steps;\r\n const direction = sweep > 0 ? 1 : 0;\r\n for (let i = 1; i <= steps; i++) {\r\n const p = pointOn(cx, cy, rx, ry, from + step * i);\r\n this.arcTo(rx, ry, 0, 0, direction, p.x, p.y);\r\n }\r\n return this;\r\n }\r\n}\r\n\r\nfunction resolveArc(arc: EllipseArc): { cx: number; cy: number; rx: number; ry: number; from: number; sweep: number } {\r\n return {\r\n cx: arc.x ?? 0,\r\n cy: arc.y ?? 0,\r\n rx: arc.width / 2,\r\n ry: (arc.height ?? arc.width) / 2,\r\n from: arc.startAngle ?? 0,\r\n sweep: arc.sweep ?? 360,\r\n };\r\n}\r\n\r\nfunction pointOn(cx: number, cy: number, rx: number, ry: number, angle: number): { x: number; y: number } {\r\n const rad = (angle * Math.PI) / 180;\r\n return { x: cx + rx * Math.cos(rad), y: cy + ry * Math.sin(rad) };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/render/descriptors/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,CA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U,CAAC,KAAK,CAAC;QAE1C,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,EAAE;QAC3B,YAAY,EAAE,UAAU,CAAC,YAAY;KACxC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeState, resolveShapePivot } from \"./shape\";\n\nexport type PathCommand =\n | { type: \"M\"; x: number; y: number }\n | { type: \"m\"; x: number; y: number }\n | { type: \"L\"; x: number; y: number }\n | { type: \"l\"; x: number; y: number }\n | { type: \"H\"; x: number }\n | { type: \"h\"; x: number }\n | { type: \"V\"; y: number }\n | { type: \"v\"; y: number }\n | { type: \"C\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\n | { type: \"c\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\n | { type: \"S\"; x2: number; y2: number; x: number; y: number }\n | { type: \"s\"; x2: number; y2: number; x: number; y: number }\n | { type: \"Q\"; x1: number; y1: number; x: number; y: number }\n | { type: \"q\"; x1: number; y1: number; x: number; y: number }\n | { type: \"T\"; x: number; y: number }\n | { type: \"t\"; x: number; y: number }\n | { type: \"A\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\n | { type: \"a\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\n | { type: \"Z\" | \"z\" };\n\n\n\nexport type PathData = string | PathCommand[];\n\nexport function toPathString(d: PathData): string {\n if (typeof d === \"string\") return d;\n return d.map(cmd => {\n switch (cmd.type) {\n case \"M\": case \"m\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\n case \"L\": case \"l\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\n case \"T\": case \"t\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\n case \"H\": case \"h\": return `${cmd.type} ${cmd.x}`;\n case \"V\": case \"v\": return `${cmd.type} ${cmd.y}`;\n case \"C\": case \"c\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\n case \"S\": case \"s\": return `${cmd.type} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\n case \"Q\": case \"q\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x} ${cmd.y}`;\n case \"A\": case \"a\": return `${cmd.type} ${cmd.rx} ${cmd.ry} ${cmd.rotation} ${cmd.largeArc} ${cmd.sweep} ${cmd.x} ${cmd.y}`;\n case \"Z\": case \"z\": return cmd.type;\n }\n }).join(\" \");\n}\n\n/** An axis-aligned bounding box in path coordinates: [minX, minY, maxX, maxY]. */\nexport type PathBounds = readonly [number, number, number, number];\n\nexport interface PathState extends ShapeState {\n data: PathData;\n /**\n * Explicit frame to center the path against, as [minX, minY, maxX, maxY] in\n * the path's own coordinate space. When set, the path is shifted so this\n * box's center lands on the local origin — instead of the path centering on\n * its *own* bbox.\n *\n * Use this when several paths share one layout frame (e.g. per-glyph LaTeX\n * tokens). Passing the same whole-shape bounds to every path keeps their\n * relative positions intact, where per-path self-centering would collapse\n * them onto a single point. When unset, the path centers on its own bbox.\n */\n centerBounds?: PathBounds;\n}\n\nexport function withPathDescriptor(descriptor: Partial<PathState>): PathState {\n return {\n opacity: descriptor.opacity ?? 1,\n\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x: descriptor.x ?? 0,\n y: descriptor.y ?? 0,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n width: descriptor.width ?? 0,\n height: descriptor.height ?? 0,\n pivot: resolveShapePivot(descriptor.pivot),\n\n data: descriptor.data ?? \"\",\n centerBounds: descriptor.centerBounds,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../src/render/descriptors/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA2BxD,MAAM,UAAU,YAAY,CAAC,CAAW;IACpC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,CAAC,CAAC;IAC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;KACxC,CAAC;AACN,CAAC","sourcesContent":["import { ShapeState, resolveShapePivot } from \"./shape\";\r\n\r\nexport type PathCommand =\r\n | { type: \"M\"; x: number; y: number }\r\n | { type: \"m\"; x: number; y: number }\r\n | { type: \"L\"; x: number; y: number }\r\n | { type: \"l\"; x: number; y: number }\r\n | { type: \"H\"; x: number }\r\n | { type: \"h\"; x: number }\r\n | { type: \"V\"; y: number }\r\n | { type: \"v\"; y: number }\r\n | { type: \"C\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\r\n | { type: \"c\"; x1: number; y1: number; x2: number; y2: number; x: number; y: number }\r\n | { type: \"S\"; x2: number; y2: number; x: number; y: number }\r\n | { type: \"s\"; x2: number; y2: number; x: number; y: number }\r\n | { type: \"Q\"; x1: number; y1: number; x: number; y: number }\r\n | { type: \"q\"; x1: number; y1: number; x: number; y: number }\r\n | { type: \"T\"; x: number; y: number }\r\n | { type: \"t\"; x: number; y: number }\r\n | { type: \"A\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\r\n | { type: \"a\"; rx: number; ry: number; rotation: number; largeArc: 0 | 1; sweep: 0 | 1; x: number; y: number }\r\n | { type: \"Z\" | \"z\" };\r\n\r\n\r\n\r\nexport type PathData = string | PathCommand[];\r\n\r\nexport function toPathString(d: PathData): string {\r\n if (typeof d === \"string\") return d;\r\n return d.map(cmd => {\r\n switch (cmd.type) {\r\n case \"M\": case \"m\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\r\n case \"L\": case \"l\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\r\n case \"T\": case \"t\": return `${cmd.type} ${cmd.x} ${cmd.y}`;\r\n case \"H\": case \"h\": return `${cmd.type} ${cmd.x}`;\r\n case \"V\": case \"v\": return `${cmd.type} ${cmd.y}`;\r\n case \"C\": case \"c\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\r\n case \"S\": case \"s\": return `${cmd.type} ${cmd.x2} ${cmd.y2} ${cmd.x} ${cmd.y}`;\r\n case \"Q\": case \"q\": return `${cmd.type} ${cmd.x1} ${cmd.y1} ${cmd.x} ${cmd.y}`;\r\n case \"A\": case \"a\": return `${cmd.type} ${cmd.rx} ${cmd.ry} ${cmd.rotation} ${cmd.largeArc} ${cmd.sweep} ${cmd.x} ${cmd.y}`;\r\n case \"Z\": case \"z\": return cmd.type;\r\n }\r\n }).join(\" \");\r\n}\r\n\r\n/** An axis-aligned bounding box in path coordinates: [minX, minY, maxX, maxY]. */\r\nexport type PathBounds = readonly [number, number, number, number];\r\n\r\nexport interface PathState extends ShapeState {\r\n data: PathData;\r\n /**\r\n * Explicit frame to center the path against, as [minX, minY, maxX, maxY] in\r\n * the path's own coordinate space. When set, the path is shifted so this\r\n * box's center lands on the local origin — instead of the path centering on\r\n * its *own* bbox.\r\n *\r\n * Use this when several paths share one layout frame (e.g. per-glyph LaTeX\r\n * tokens). Passing the same whole-shape bounds to every path keeps their\r\n * relative positions intact, where per-path self-centering would collapse\r\n * them onto a single point. When unset, the path centers on its own bbox.\r\n */\r\n centerBounds?: PathBounds;\r\n}\r\n\r\nexport function withPathDescriptor(descriptor: Partial<PathState>): PathState {\r\n return {\r\n opacity: descriptor.opacity ?? 1,\r\n\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x: descriptor.x ?? 0,\r\n y: descriptor.y ?? 0,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n width: descriptor.width ?? 0,\r\n height: descriptor.height ?? 0,\r\n pivot: resolveShapePivot(descriptor.pivot),\r\n\r\n data: descriptor.data ?? \"\",\r\n centerBounds: descriptor.centerBounds,\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\nexport interface PolygonState extends ShapeState {\n width: number;\n height: number;\n sides: number;\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\n cornerRadius: number;\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\n cornerStyle: CornerStyle;\n}\n\nexport function withPolygonDescriptor(descriptor: Partial<PolygonState> & ShapeAlignmentInput): PolygonState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n sides: descriptor.sides ?? 5,\n cornerRadius: descriptor.cornerRadius ?? 0,\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"polygon.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygon.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,qBAAqB,CAAC,UAAuD;IACzF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\nexport interface PolygonState extends ShapeState {\r\n width: number;\r\n height: number;\r\n sides: number;\r\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\r\n cornerRadius: number;\r\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\r\n cornerStyle: CornerStyle;\r\n}\r\n\r\nexport function withPolygonDescriptor(descriptor: Partial<PolygonState> & ShapeAlignmentInput): PolygonState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n sides: descriptor.sides ?? 5,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygram.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygram.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\nexport interface PolygramState extends ShapeState {\n width: number;\n height: number;\n sides: number;\n ratio: number;\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\n cornerRadius: number;\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\n cornerStyle: CornerStyle;\n}\n\nexport function withPolygramDescriptor(descriptor: Partial<PolygramState> & ShapeAlignmentInput): PolygramState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n sides: descriptor.sides ?? 5,\n ratio: descriptor.ratio ?? 0.5,\n cornerRadius: descriptor.cornerRadius ?? 0,\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"polygram.js","sourceRoot":"","sources":["../../../src/render/descriptors/polygram.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,GAAG;QAC9B,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { CornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\nexport interface PolygramState extends ShapeState {\r\n width: number;\r\n height: number;\r\n sides: number;\r\n ratio: number;\r\n /** Vertex rounding radius in pixels (applied uniformly to every vertex). */\r\n cornerRadius: number;\r\n /** Vertex shape: `'rounded'` (circular arc) or `'angled'` (chamfer). */\r\n cornerStyle: CornerStyle;\r\n}\r\n\r\nexport function withPolygramDescriptor(descriptor: Partial<PolygramState> & ShapeAlignmentInput): PolygramState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n sides: descriptor.sides ?? 5,\r\n ratio: descriptor.ratio ?? 0.5,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\n\nexport interface RectState extends ShapeState {\n width: number;\n height: number;\n // Accepts loose input or an already-resolved value (both are part of\n // RectCornerRadius/RectCornerStyle): the node resolves via its @property\n // mapper, and the renderer re-resolves idempotently.\n cornerRadius: RectCornerRadius;\n cornerStyle: RectCornerStyle;\n}\n\nexport function withRectDescriptor(descriptor: Partial<RectState> & ShapeAlignmentInput): RectState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n\n width,\n height,\n cornerRadius: descriptor.cornerRadius ?? 0,\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../src/render/descriptors/rect.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAa7H,MAAM,UAAU,kBAAkB,CAAC,UAAoD;IACnF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAE/B,KAAK;QACL,MAAM;QACN,YAAY,EAAE,UAAU,CAAC,YAAY,IAAI,CAAC;QAC1C,WAAW,EAAE,UAAU,CAAC,WAAW,IAAI,SAAS;KACnD,CAAC;AACN,CAAC","sourcesContent":["import { RectCornerRadius } from \"@/attributes/shape/corners/corner-radius\";\r\nimport { RectCornerStyle } from \"@/attributes/shape/corners/corner-style\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\n\r\nexport interface RectState extends ShapeState {\r\n width: number;\r\n height: number;\r\n // Accepts loose input or an already-resolved value (both are part of\r\n // RectCornerRadius/RectCornerStyle): the node resolves via its @property\r\n // mapper, and the renderer re-resolves idempotently.\r\n cornerRadius: RectCornerRadius;\r\n cornerStyle: RectCornerStyle;\r\n}\r\n\r\nexport function withRectDescriptor(descriptor: Partial<RectState> & ShapeAlignmentInput): RectState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n\r\n width,\r\n height,\r\n cornerRadius: descriptor.cornerRadius ?? 0,\r\n cornerStyle: descriptor.cornerStyle ?? \"rounded\",\r\n };\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"richtext.js","sourceRoot":"","sources":["../../../src/render/descriptors/richtext.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;QAC7B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,GAAG;QACxC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,KAAK;QACL,MAAM;KACT,CAAC;AACN,CAAC","sourcesContent":["import type { ResolvedTextSpan, TextAlign } from \"@/attributes/text/types\";\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\n\nexport interface RichTextState extends ShapeState {\n spans: ResolvedTextSpan[];\n /** A named typography preset — see {@link TextState.variant}. Applied per span. */\n variant?: string;\n lineHeight: number;\n textAlign: TextAlign;\n width: number;\n height: number;\n}\n\nexport function withRichTextDescriptor(descriptor: Partial<RichTextState> & ShapeAlignmentInput): RichTextState {\n const width = descriptor.width ?? 0;\n const height = descriptor.height ?? 0;\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\n return {\n ...stripShapeAlignmentKeys(descriptor),\n opacity: descriptor.opacity ?? 1,\n rotation: descriptor.rotation ?? 0,\n scale: descriptor.scale ?? 1,\n x,\n y,\n start: descriptor.start ?? 0,\n end: descriptor.end ?? 1,\n pivot: resolveShapePivot(pivot),\n spans: descriptor.spans ?? [],\n lineHeight: descriptor.lineHeight ?? 1.2,\n textAlign: descriptor.textAlign ?? 'center',\n width,\n height,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"richtext.js","sourceRoot":"","sources":["../../../src/render/descriptors/richtext.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,qBAAqB,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAY7H,MAAM,UAAU,sBAAsB,CAAC,UAAwD;IAC3F,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;IACtC,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,qBAAqB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO;QACH,GAAG,uBAAuB,CAAC,UAAU,CAAC;QACtC,OAAO,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC;QAChC,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,CAAC;QAClC,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,CAAC;QACD,CAAC;QACD,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,CAAC;QAC5B,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,CAAC;QACxB,KAAK,EAAE,iBAAiB,CAAC,KAAK,CAAC;QAC/B,KAAK,EAAE,UAAU,CAAC,KAAK,IAAI,EAAE;QAC7B,UAAU,EAAE,UAAU,CAAC,UAAU,IAAI,GAAG;QACxC,SAAS,EAAE,UAAU,CAAC,SAAS,IAAI,QAAQ;QAC3C,KAAK;QACL,MAAM;KACT,CAAC;AACN,CAAC","sourcesContent":["import type { ResolvedTextSpan, TextAlign } from \"@/attributes/text/types\";\r\nimport { ShapeAlignmentInput, ShapeState, resolveShapeAlignment, resolveShapePivot, stripShapeAlignmentKeys } from \"./shape\";\r\n\r\nexport interface RichTextState extends ShapeState {\r\n spans: ResolvedTextSpan[];\r\n /** A named typography preset — see {@link TextState.variant}. Applied per span. */\r\n variant?: string;\r\n lineHeight: number;\r\n textAlign: TextAlign;\r\n width: number;\r\n height: number;\r\n}\r\n\r\nexport function withRichTextDescriptor(descriptor: Partial<RichTextState> & ShapeAlignmentInput): RichTextState {\r\n const width = descriptor.width ?? 0;\r\n const height = descriptor.height ?? 0;\r\n const { x, y, pivot } = resolveShapeAlignment(descriptor, width, height);\r\n return {\r\n ...stripShapeAlignmentKeys(descriptor),\r\n opacity: descriptor.opacity ?? 1,\r\n rotation: descriptor.rotation ?? 0,\r\n scale: descriptor.scale ?? 1,\r\n x,\r\n y,\r\n start: descriptor.start ?? 0,\r\n end: descriptor.end ?? 1,\r\n pivot: resolveShapePivot(pivot),\r\n spans: descriptor.spans ?? [],\r\n lineHeight: descriptor.lineHeight ?? 1.2,\r\n textAlign: descriptor.textAlign ?? 'center',\r\n width,\r\n height,\r\n };\r\n}\r\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { TransformState } from "./transform.js";
|
|
2
2
|
import { AlignmentKey, Alignment } from "../../attributes/layout/alignment.js";
|
|
3
3
|
import { Vector2 } from "../../attributes/layout/vector2.js";
|
|
4
|
+
import type { NodeBlendMode } from "../../attributes/shape/fill/blend.js";
|
|
4
5
|
/**
|
|
5
6
|
* Per-shape descriptor state. Shapes carry geometry and a *local* transform
|
|
6
7
|
* (`rotation`/`scale` baked into the path before it joins the union) but **not**
|
|
@@ -9,6 +10,17 @@ import { Vector2 } from "../../attributes/layout/vector2.js";
|
|
|
9
10
|
* `TransformState.effects` (which remains for node-level transforms).
|
|
10
11
|
*/
|
|
11
12
|
export interface ShapeState extends Omit<TransformState, "effects" | "pivot"> {
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Not drawn. A shape has no layer of its own, so a per-shape alpha
|
|
15
|
+
* does nothing; use `Graphics2D.opacity()` for the whole group, or the node's
|
|
16
|
+
* own opacity. The renderer warns once when one is given.
|
|
17
|
+
*/
|
|
18
|
+
opacity: number;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Not drawn, for the same reason as {@link ShapeState.opacity}; use
|
|
21
|
+
* the node's own `blend`. The renderer warns once when one is given.
|
|
22
|
+
*/
|
|
23
|
+
blend?: NodeBlendMode;
|
|
12
24
|
start: number;
|
|
13
25
|
end: number;
|
|
14
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../../src/render/descriptors/shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAgB,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"shape.d.ts","sourceRoot":"","sources":["../../../src/render/descriptors/shape.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAgB,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,OAAO,CAAC;IACzE;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;OAMG;IACH,KAAK,EAAE,SAAS,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAEvE;AAYD;;4FAE4F;AAC5F,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,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E,OAAO,UAAU,CAAC;IAEtE,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B;IAC5E,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC;IAE9C,MAAM,MAAM,GAAG,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9D,OAAO;QACH,GAAG,UAAU;QACb,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;QAC/B,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QAChC,KAAK,EAAE,CAAC;KACX,CAAC;AACN,CAAC","sourcesContent":["import { TransformState } from \"./transform\";\nimport { AlignmentKey, Alignment, alignmentOps } from \"@/attributes/layout/alignment\";\nimport { Vector2 } from \"@/attributes/layout/vector2\";\n\n/**\n * Per-shape descriptor state. Shapes carry geometry and a *local* transform\n * (`rotation`/`scale` baked into the path before it joins the union) but **not**\n * layer effects: effects are applied to the whole drawn union via\n * {@link Graphics2D.effects}, not per shape. So `ShapeState` omits\n * `TransformState.effects` (which remains for node-level transforms).\n */\nexport interface ShapeState extends Omit<TransformState, \"effects\" | \"pivot\"> {\n start: number;\n end: number;\n /**\n * Pivot for the shape's local rotation/scale. Widened from a `Vector2` to an\n * {@link Alignment} so a shape can pivot about a **named alignment**\n * (`.rect({ pivot: 'topRight' })`) as well as an explicit `Vector2`.\n * `with*Descriptor` normalises it to a `Vector2` (via {@link resolveShapePivot}),\n * so the resolved state the renderer reads always carries a concrete pivot.\n */\n pivot: Alignment;\n}\n\n/**\n * Normalise a per-shape `pivot` input to a `Vector2`. Resolves a named alignment\n * (`'topRight'`, …) to its normalised `[-1, 1]` pivot and passes an explicit\n * `Vector2` through. Idempotent — safe to call on already-resolved state — so\n * both `with*Descriptor` and the renderer can call it. Defaults to centre when\n * the pivot is absent.\n */\nexport function resolveShapePivot(pivot: Alignment | undefined): Vector2 {\n return alignmentOps.resolve(pivot ?? { x: 0, y: 0 });\n}\n\n// ─── Cardinal-alignment positioning ──────────────────────────────────────────\n// A shape can be positioned by a named alignment instead of its centre `x`/`y`,\n// exactly like a node: `.rect({ topRight: { x, y }, width, height })` places the\n// rect so its top-right corner lands at that point. The nine names share the node\n// `align` vocabulary (`center`, `topLeft`, …). Targets are in the same y-UP author\n// space as `x`/`y` (the renderer flips to canvas), so `topRight` is the visually\n// top-right corner. Like a node, using an alignment also sets the shape's `pivot`\n// to that alignment, so a subsequent per-shape `rotation`/`scale` turns about the\n// pinned corner.\n\n/** The cardinal-alignment positioning props a shape descriptor accepts (input-only;\n * they don't appear on the resolved `*State`). Pass at most one, and not together\n * with `x`, `y`, or `pivot`. Each value is the y-up point the named alignment lands on. */\nexport interface ShapeAlignmentInput {\n center?: Vector2;\n topLeft?: Vector2;\n topRight?: Vector2;\n bottomLeft?: Vector2;\n bottomRight?: Vector2;\n topCenter?: Vector2;\n bottomCenter?: Vector2;\n centerLeft?: Vector2;\n centerRight?: Vector2;\n}\n\n/** The nine alignment keys, in the node `align` vocabulary. */\nexport const SHAPE_ALIGNMENT_KEYS: AlignmentKey[] = [\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\",\n \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\n];\n\n/**\n * Validate a shape descriptor's alignment usage — mirrors `alignmentOps.validateProps`,\n * extended to also reject `x`/`y` (a shape positioned by an alignment cannot also set\n * its centre). Throws if more than one alignment is set, or an alignment is combined with\n * `pivot`, `x`, or `y`. `x`/`y`/`pivot` may freely combine with each other.\n */\nexport function validateShapeAlignmentProps(descriptor: Record<string, unknown>): void {\n const present = SHAPE_ALIGNMENT_KEYS.filter(k => descriptor[k] !== undefined);\n if (present.length > 1) {\n throw new Error(`Cannot set multiple shape alignment props at once: ${present.join(\", \")}`);\n }\n if (present.length === 1) {\n const conflict = ([\"pivot\", \"x\", \"y\"] as const).find(k => descriptor[k] !== undefined);\n if (conflict) {\n throw new Error(`Cannot set both shape alignment prop '${present[0]}' and '${conflict}' at the same time`);\n }\n }\n}\n\n/**\n * Drop the input-only alignment keys from a descriptor, so a `{ ...descriptor }`\n * spread doesn't leak them onto the resolved `*State` (the resolved x/y/pivot\n * already carry the alignment's effect). Returns a shallow copy without those keys.\n */\nexport function stripShapeAlignmentKeys<T extends object>(descriptor: T): Omit<T, keyof ShapeAlignmentInput> {\n const out = { ...descriptor } as Record<string, unknown>;\n for (const k of SHAPE_ALIGNMENT_KEYS) delete out[k];\n return out as Omit<T, keyof ShapeAlignmentInput>;\n}\n\n/**\n * Resolve a shape descriptor's positioning into a concrete centre `x`/`y` and\n * `pivot` (all in y-up author space), handling the cardinal-alignment shorthand.\n *\n * When an alignment is present its normalised pivot `a` (in `[-1, 1]`, y-up) is mapped\n * onto the shape's own `width`×`height` box: the centre that lands the named alignment\n * on `target` is `centre = target − a · (size / 2)`, and `pivot` is set to `a`\n * (matching `Node2D`'s auto-pivot). Otherwise `x`/`y`/`pivot` pass through unchanged —\n * `pivot` alone never repositions the shape here, since this same function re-runs\n * on already-resolved state (`with*Descriptor` is called again from\n * `BaseShape.resolveState`) and re-deriving an offset from an already-resolved\n * `pivot` would double-apply it. The `pivot` + plain `x`/`y` shorthand ({@link\n * resolvePivotPosition}) bakes its offset in exactly once, before this function\n * ever sees the descriptor, precisely to preserve that idempotency.\n *\n * Idempotent in the no-alignment case; safe to call more than once per descriptor\n * resolve. Validates via {@link validateShapeAlignmentProps} first.\n */\nexport function resolveShapeAlignment(\n descriptor: Partial<ShapeState> & ShapeAlignmentInput,\n width: number,\n height: number,\n): { x: number; y: number; pivot: Alignment } {\n validateShapeAlignmentProps(descriptor as Record<string, unknown>);\n\n const alignmentKey = SHAPE_ALIGNMENT_KEYS.find(k => (descriptor as Record<string, unknown>)[k] !== undefined);\n if (alignmentKey) {\n const target = (descriptor as Record<string, Vector2>)[alignmentKey];\n const a = alignmentOps.resolve(alignmentKey); // normalised [-1,1], y-up\n return {\n x: target.x - a.x * (width / 2),\n y: target.y - a.y * (height / 2),\n pivot: a,\n };\n }\n\n return {\n x: descriptor.x ?? 0,\n y: descriptor.y ?? 0,\n pivot: descriptor.pivot ?? { x: 0, y: 0 },\n };\n}\n\n/**\n * Fold a plain `pivot` + `x`/`y` into an equivalent resolved centre, so\n * `{ x, y, pivot: 'topRight' }` lands the top-right corner at `(x, y)` — the same\n * place `{ topRight: { x, y } }` would — instead of `x`/`y` always positioning the\n * centre regardless of `pivot`. Uses the same `centre = target − a · (size / 2)`\n * formula as the alignment shorthand.\n *\n * Must run exactly once, on the raw author-facing descriptor, **before**\n * {@link resolveShapeAlignment} ever sees it (i.e. in `flipPositionY`, not inside\n * `with*Descriptor`, which `BaseShape.resolveState` calls a second time on\n * already-resolved state — re-running this there would double the offset, since\n * the output below is indistinguishable from a plain `x`/`y`/`pivot` descriptor).\n * A no-op when an alignment shorthand is already present (validated downstream) or\n * `pivot` is centre/absent.\n */\nexport function resolvePivotPosition<T extends Partial<ShapeState> & ShapeAlignmentInput>(\n descriptor: T,\n width: number,\n height: number,\n): T {\n const alignmentKey = SHAPE_ALIGNMENT_KEYS.find(k => (descriptor as Record<string, unknown>)[k] !== undefined);\n if (alignmentKey || descriptor.pivot === undefined) return descriptor;\n\n const a = alignmentOps.resolve(descriptor.pivot); // normalised [-1,1], y-up\n if (a.x === 0 && a.y === 0) return descriptor;\n\n const target = { x: descriptor.x ?? 0, y: descriptor.y ?? 0 };\n return {\n ...descriptor,\n x: target.x - a.x * (width / 2),\n y: target.y - a.y * (height / 2),\n pivot: a,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"shape.js","sourceRoot":"","sources":["../../../src/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CAAC,KAAK,SAAS,CAAC,CAAC;IAC9G,IAAI,YAAY,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS;QAAE,OAAO,UAAU,CAAC;IAEtE,MAAM,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,0BAA0B;IAC5E,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAAE,OAAO,UAAU,CAAC;IAE9C,MAAM,MAAM,GAAG,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9D,OAAO;QACH,GAAG,UAAU;QACb,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;QAC/B,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QAChC,KAAK,EAAE,CAAC;KACX,CAAC;AACN,CAAC","sourcesContent":["import { TransformState } from \"./transform\";\r\nimport { AlignmentKey, Alignment, alignmentOps } from \"@/attributes/layout/alignment\";\r\nimport { Vector2 } from \"@/attributes/layout/vector2\";\r\nimport type { NodeBlendMode } from \"@/attributes/shape/fill/blend\";\r\n\r\n/**\r\n * Per-shape descriptor state. Shapes carry geometry and a *local* transform\r\n * (`rotation`/`scale` baked into the path before it joins the union) but **not**\r\n * layer effects: effects are applied to the whole drawn union via\r\n * {@link Graphics2D.effects}, not per shape. So `ShapeState` omits\r\n * `TransformState.effects` (which remains for node-level transforms).\r\n */\r\nexport interface ShapeState extends Omit<TransformState, \"effects\" | \"pivot\"> {\r\n /**\r\n * @deprecated Not drawn. A shape has no layer of its own, so a per-shape alpha\r\n * does nothing; use `Graphics2D.opacity()` for the whole group, or the node's\r\n * own opacity. The renderer warns once when one is given.\r\n */\r\n opacity: number;\r\n /**\r\n * @deprecated Not drawn, for the same reason as {@link ShapeState.opacity}; use\r\n * the node's own `blend`. The renderer warns once when one is given.\r\n */\r\n blend?: NodeBlendMode;\r\n start: number;\r\n end: number;\r\n /**\r\n * Pivot for the shape's local rotation/scale. Widened from a `Vector2` to an\r\n * {@link Alignment} so a shape can pivot about a **named alignment**\r\n * (`.rect({ pivot: 'topRight' })`) as well as an explicit `Vector2`.\r\n * `with*Descriptor` normalises it to a `Vector2` (via {@link resolveShapePivot}),\r\n * so the resolved state the renderer reads always carries a concrete pivot.\r\n */\r\n pivot: Alignment;\r\n}\r\n\r\n/**\r\n * Normalise a per-shape `pivot` input to a `Vector2`. Resolves a named alignment\r\n * (`'topRight'`, …) to its normalised `[-1, 1]` pivot and passes an explicit\r\n * `Vector2` through. Idempotent — safe to call on already-resolved state — so\r\n * both `with*Descriptor` and the renderer can call it. Defaults to centre when\r\n * the pivot is absent.\r\n */\r\nexport function resolveShapePivot(pivot: Alignment | undefined): Vector2 {\r\n return alignmentOps.resolve(pivot ?? { x: 0, y: 0 });\r\n}\r\n\r\n// ─── Cardinal-alignment positioning ──────────────────────────────────────────\r\n// A shape can be positioned by a named alignment instead of its centre `x`/`y`,\r\n// exactly like a node: `.rect({ topRight: { x, y }, width, height })` places the\r\n// rect so its top-right corner lands at that point. The nine names share the node\r\n// `align` vocabulary (`center`, `topLeft`, …). Targets are in the same y-UP author\r\n// space as `x`/`y` (the renderer flips to canvas), so `topRight` is the visually\r\n// top-right corner. Like a node, using an alignment also sets the shape's `pivot`\r\n// to that alignment, so a subsequent per-shape `rotation`/`scale` turns about the\r\n// pinned corner.\r\n\r\n/** The cardinal-alignment positioning props a shape descriptor accepts (input-only;\r\n * they don't appear on the resolved `*State`). Pass at most one, and not together\r\n * with `x`, `y`, or `pivot`. Each value is the y-up point the named alignment lands on. */\r\nexport interface ShapeAlignmentInput {\r\n center?: Vector2;\r\n topLeft?: Vector2;\r\n topRight?: Vector2;\r\n bottomLeft?: Vector2;\r\n bottomRight?: Vector2;\r\n topCenter?: Vector2;\r\n bottomCenter?: Vector2;\r\n centerLeft?: Vector2;\r\n centerRight?: Vector2;\r\n}\r\n\r\n/** The nine alignment keys, in the node `align` vocabulary. */\r\nexport const SHAPE_ALIGNMENT_KEYS: AlignmentKey[] = [\r\n \"center\", \"topLeft\", \"topRight\", \"bottomLeft\", \"bottomRight\",\r\n \"topCenter\", \"bottomCenter\", \"centerLeft\", \"centerRight\",\r\n];\r\n\r\n/**\r\n * Validate a shape descriptor's alignment usage — mirrors `alignmentOps.validateProps`,\r\n * extended to also reject `x`/`y` (a shape positioned by an alignment cannot also set\r\n * its centre). Throws if more than one alignment is set, or an alignment is combined with\r\n * `pivot`, `x`, or `y`. `x`/`y`/`pivot` may freely combine with each other.\r\n */\r\nexport function validateShapeAlignmentProps(descriptor: Record<string, unknown>): void {\r\n const present = SHAPE_ALIGNMENT_KEYS.filter(k => descriptor[k] !== undefined);\r\n if (present.length > 1) {\r\n throw new Error(`Cannot set multiple shape alignment props at once: ${present.join(\", \")}`);\r\n }\r\n if (present.length === 1) {\r\n const conflict = ([\"pivot\", \"x\", \"y\"] as const).find(k => descriptor[k] !== undefined);\r\n if (conflict) {\r\n throw new Error(`Cannot set both shape alignment prop '${present[0]}' and '${conflict}' at the same time`);\r\n }\r\n }\r\n}\r\n\r\n/**\r\n * Drop the input-only alignment keys from a descriptor, so a `{ ...descriptor }`\r\n * spread doesn't leak them onto the resolved `*State` (the resolved x/y/pivot\r\n * already carry the alignment's effect). Returns a shallow copy without those keys.\r\n */\r\nexport function stripShapeAlignmentKeys<T extends object>(descriptor: T): Omit<T, keyof ShapeAlignmentInput> {\r\n const out = { ...descriptor } as Record<string, unknown>;\r\n for (const k of SHAPE_ALIGNMENT_KEYS) delete out[k];\r\n return out as Omit<T, keyof ShapeAlignmentInput>;\r\n}\r\n\r\n/**\r\n * Resolve a shape descriptor's positioning into a concrete centre `x`/`y` and\r\n * `pivot` (all in y-up author space), handling the cardinal-alignment shorthand.\r\n *\r\n * When an alignment is present its normalised pivot `a` (in `[-1, 1]`, y-up) is mapped\r\n * onto the shape's own `width`×`height` box: the centre that lands the named alignment\r\n * on `target` is `centre = target − a · (size / 2)`, and `pivot` is set to `a`\r\n * (matching `Node2D`'s auto-pivot). Otherwise `x`/`y`/`pivot` pass through unchanged —\r\n * `pivot` alone never repositions the shape here, since this same function re-runs\r\n * on already-resolved state (`with*Descriptor` is called again from\r\n * `BaseShape.resolveState`) and re-deriving an offset from an already-resolved\r\n * `pivot` would double-apply it. The `pivot` + plain `x`/`y` shorthand ({@link\r\n * resolvePivotPosition}) bakes its offset in exactly once, before this function\r\n * ever sees the descriptor, precisely to preserve that idempotency.\r\n *\r\n * Idempotent in the no-alignment case; safe to call more than once per descriptor\r\n * resolve. Validates via {@link validateShapeAlignmentProps} first.\r\n */\r\nexport function resolveShapeAlignment(\r\n descriptor: Partial<ShapeState> & ShapeAlignmentInput,\r\n width: number,\r\n height: number,\r\n): { x: number; y: number; pivot: Alignment } {\r\n validateShapeAlignmentProps(descriptor as Record<string, unknown>);\r\n\r\n const alignmentKey = SHAPE_ALIGNMENT_KEYS.find(k => (descriptor as Record<string, unknown>)[k] !== undefined);\r\n if (alignmentKey) {\r\n const target = (descriptor as Record<string, Vector2>)[alignmentKey];\r\n const a = alignmentOps.resolve(alignmentKey); // normalised [-1,1], y-up\r\n return {\r\n x: target.x - a.x * (width / 2),\r\n y: target.y - a.y * (height / 2),\r\n pivot: a,\r\n };\r\n }\r\n\r\n return {\r\n x: descriptor.x ?? 0,\r\n y: descriptor.y ?? 0,\r\n pivot: descriptor.pivot ?? { x: 0, y: 0 },\r\n };\r\n}\r\n\r\n/**\r\n * Fold a plain `pivot` + `x`/`y` into an equivalent resolved centre, so\r\n * `{ x, y, pivot: 'topRight' }` lands the top-right corner at `(x, y)` — the same\r\n * place `{ topRight: { x, y } }` would — instead of `x`/`y` always positioning the\r\n * centre regardless of `pivot`. Uses the same `centre = target − a · (size / 2)`\r\n * formula as the alignment shorthand.\r\n *\r\n * Must run exactly once, on the raw author-facing descriptor, **before**\r\n * {@link resolveShapeAlignment} ever sees it (i.e. in `flipPositionY`, not inside\r\n * `with*Descriptor`, which `BaseShape.resolveState` calls a second time on\r\n * already-resolved state — re-running this there would double the offset, since\r\n * the output below is indistinguishable from a plain `x`/`y`/`pivot` descriptor).\r\n * A no-op when an alignment shorthand is already present (validated downstream) or\r\n * `pivot` is centre/absent.\r\n */\r\nexport function resolvePivotPosition<T extends Partial<ShapeState> & ShapeAlignmentInput>(\r\n descriptor: T,\r\n width: number,\r\n height: number,\r\n): T {\r\n const alignmentKey = SHAPE_ALIGNMENT_KEYS.find(k => (descriptor as Record<string, unknown>)[k] !== undefined);\r\n if (alignmentKey || descriptor.pivot === undefined) return descriptor;\r\n\r\n const a = alignmentOps.resolve(descriptor.pivot); // normalised [-1,1], y-up\r\n if (a.x === 0 && a.y === 0) return descriptor;\r\n\r\n const target = { x: descriptor.x ?? 0, y: descriptor.y ?? 0 };\r\n return {\r\n ...descriptor,\r\n x: target.x - a.x * (width / 2),\r\n y: target.y - a.y * (height / 2),\r\n pivot: a,\r\n };\r\n}\r\n"]}
|
|
@@ -113,9 +113,9 @@ export interface TextState extends ShapeState {
|
|
|
113
113
|
*
|
|
114
114
|
* What it falls back to instead is {@link hostTextFamily} — a face the
|
|
115
115
|
* **application** named, once, at its composition root, out of the fonts it
|
|
116
|
-
* actually vendors. That is a different bargain:
|
|
116
|
+
* actually vendors. That is a different bargain: a host that ships a typeface
|
|
117
117
|
* registers it in every manifest, so a chart axis that nobody styled comes out
|
|
118
|
-
* in
|
|
118
|
+
* in it and paints glyphs, while the engine still refuses to invent a face of
|
|
119
119
|
* its own. A host that declares nothing gets the error below, which is the right
|
|
120
120
|
* answer for a headless render whose fonts all come from a manifest.
|
|
121
121
|
*
|
|
@@ -27,9 +27,9 @@ export function isStyleOnlySegment(segment) {
|
|
|
27
27
|
*
|
|
28
28
|
* What it falls back to instead is {@link hostTextFamily} — a face the
|
|
29
29
|
* **application** named, once, at its composition root, out of the fonts it
|
|
30
|
-
* actually vendors. That is a different bargain:
|
|
30
|
+
* actually vendors. That is a different bargain: a host that ships a typeface
|
|
31
31
|
* registers it in every manifest, so a chart axis that nobody styled comes out
|
|
32
|
-
* in
|
|
32
|
+
* in it and paints glyphs, while the engine still refuses to invent a face of
|
|
33
33
|
* its own. A host that declares nothing gets the error below, which is the right
|
|
34
34
|
* answer for a headless render whose fonts all come from a manifest.
|
|
35
35
|
*
|