@retikz/core 0.3.0-alpha.5 → 0.3.0-beta.2
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/dist/es/arrows/define.d.ts +9 -0
- package/dist/es/arrows/define.d.ts.map +1 -0
- package/dist/es/arrows/define.js +10 -0
- package/dist/es/arrows/index.d.ts +3 -1
- package/dist/es/arrows/index.d.ts.map +1 -1
- package/dist/es/arrows/index.js +15 -2
- package/dist/es/arrows/types.d.ts +4 -2
- package/dist/es/arrows/types.d.ts.map +1 -1
- package/dist/es/compile/anchor-cache.d.ts +3 -3
- package/dist/es/compile/anchor-cache.d.ts.map +1 -1
- package/dist/es/compile/anchor-cache.js +18 -5
- package/dist/es/compile/compile.d.ts +5 -14
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +46 -43
- package/dist/es/compile/{lowerComposites.d.ts → composite.d.ts} +9 -2
- package/dist/es/compile/composite.d.ts.map +1 -0
- package/dist/es/compile/{lowerComposites.js → composite.js} +9 -1
- package/dist/es/compile/constant.d.ts +30 -0
- package/dist/es/compile/constant.d.ts.map +1 -0
- package/dist/es/compile/constant.js +21 -0
- package/dist/es/compile/direction.d.ts +27 -0
- package/dist/es/compile/direction.d.ts.map +1 -0
- package/dist/es/compile/direction.js +30 -0
- package/dist/es/compile/index.d.ts +3 -1
- package/dist/es/compile/index.d.ts.map +1 -1
- package/dist/es/compile/name-stack.d.ts +3 -1
- package/dist/es/compile/name-stack.d.ts.map +1 -1
- package/dist/es/compile/name-stack.js +5 -1
- package/dist/es/compile/node.d.ts +19 -8
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +56 -70
- package/dist/es/compile/paint.js +1 -1
- package/dist/es/compile/path/anchor.d.ts +4 -3
- package/dist/es/compile/path/anchor.d.ts.map +1 -1
- package/dist/es/compile/path/anchor.js +9 -12
- package/dist/es/compile/path/index.d.ts +6 -8
- package/dist/es/compile/path/index.d.ts.map +1 -1
- package/dist/es/compile/path/index.js +97 -44
- package/dist/es/compile/path/label.d.ts.map +1 -1
- package/dist/es/compile/path/label.js +8 -4
- package/dist/es/compile/path/relative.d.ts +1 -1
- package/dist/es/compile/path/relative.js +1 -1
- package/dist/es/compile/path/shrink.d.ts +3 -1
- package/dist/es/compile/path/shrink.d.ts.map +1 -1
- package/dist/es/compile/path/shrink.js +16 -11
- package/dist/es/compile/position.d.ts +2 -2
- package/dist/es/compile/position.d.ts.map +1 -1
- package/dist/es/compile/position.js +6 -19
- package/dist/es/compile/precision.d.ts +1 -1
- package/dist/es/compile/precision.d.ts.map +1 -1
- package/dist/es/compile/precision.js +2 -2
- package/dist/es/compile/scope.d.ts +7 -5
- package/dist/es/compile/scope.d.ts.map +1 -1
- package/dist/es/compile/scope.js +44 -16
- package/dist/es/compile/style.d.ts +2 -2
- package/dist/es/compile/style.d.ts.map +1 -1
- package/dist/es/compile/style.js +2 -2
- package/dist/es/compile/text-metrics.d.ts +1 -1
- package/dist/es/compile/text-metrics.js +2 -2
- package/dist/es/composites/define.d.ts +8 -0
- package/dist/es/composites/define.d.ts.map +1 -0
- package/dist/es/composites/{types.js → define.js} +2 -2
- package/dist/es/composites/index.d.ts +1 -1
- package/dist/es/composites/index.d.ts.map +1 -1
- package/dist/es/composites/types.d.ts +0 -6
- package/dist/es/composites/types.d.ts.map +1 -1
- package/dist/es/geometry/anchor.d.ts +33 -0
- package/dist/es/geometry/anchor.d.ts.map +1 -0
- package/dist/es/geometry/anchor.js +45 -0
- package/dist/es/geometry/bend.d.ts +1 -1
- package/dist/es/geometry/bend.js +3 -3
- package/dist/es/geometry/circle.d.ts +4 -4
- package/dist/es/geometry/circle.d.ts.map +1 -1
- package/dist/es/geometry/circle.js +3 -3
- package/dist/es/geometry/{roundedContour.d.ts → contour.d.ts} +9 -5
- package/dist/es/geometry/contour.d.ts.map +1 -0
- package/dist/es/geometry/{roundedContour.js → contour.js} +27 -37
- package/dist/es/geometry/diamond.d.ts +10 -4
- package/dist/es/geometry/diamond.d.ts.map +1 -1
- package/dist/es/geometry/diamond.js +11 -3
- package/dist/{lib/geometry/_edge.d.ts → es/geometry/edge.d.ts} +1 -1
- package/dist/es/geometry/edge.d.ts.map +1 -0
- package/dist/es/geometry/{_edge.js → edge.js} +1 -1
- package/dist/es/geometry/ellipse.d.ts +3 -3
- package/dist/es/geometry/ellipse.d.ts.map +1 -1
- package/dist/es/geometry/ellipse.js +4 -2
- package/dist/es/geometry/index.d.ts +6 -1
- package/dist/es/geometry/index.d.ts.map +1 -1
- package/dist/es/geometry/point.d.ts +6 -0
- package/dist/es/geometry/point.d.ts.map +1 -1
- package/dist/es/geometry/point.js +17 -0
- package/dist/es/geometry/rect.d.ts +4 -17
- package/dist/es/geometry/rect.d.ts.map +1 -1
- package/dist/es/geometry/rect.js +4 -16
- package/dist/es/geometry/segment.d.ts +7 -0
- package/dist/es/geometry/segment.d.ts.map +1 -1
- package/dist/es/geometry/segment.js +48 -47
- package/dist/{lib/geometry/_transform.d.ts → es/geometry/transform.d.ts} +1 -1
- package/dist/es/geometry/transform.d.ts.map +1 -0
- package/dist/es/geometry/{_transform.js → transform.js} +1 -1
- package/dist/es/index.d.ts +13 -13
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +20 -16
- package/dist/es/ir/animation.d.ts +26 -125
- package/dist/es/ir/animation.d.ts.map +1 -1
- package/dist/es/ir/animation.js +6 -6
- package/dist/es/ir/boundary.d.ts +4 -10
- package/dist/es/ir/boundary.d.ts.map +1 -1
- package/dist/es/ir/clip.d.ts +6 -46
- package/dist/es/ir/clip.d.ts.map +1 -1
- package/dist/es/ir/composite.d.ts +2 -14
- package/dist/es/ir/composite.d.ts.map +1 -1
- package/dist/es/ir/coordinate.d.ts +14 -50
- package/dist/es/ir/coordinate.d.ts.map +1 -1
- package/dist/es/ir/coordinate.js +1 -1
- package/dist/es/ir/font.d.ts +10 -13
- package/dist/es/ir/font.d.ts.map +1 -1
- package/dist/es/ir/json.d.ts +1 -1
- package/dist/es/ir/json.d.ts.map +1 -1
- package/dist/es/ir/json.js +1 -1
- package/dist/es/ir/node.d.ts +175 -821
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +23 -23
- package/dist/es/ir/paint.d.ts +23 -100
- package/dist/es/ir/paint.d.ts.map +1 -1
- package/dist/es/ir/paint.js +10 -10
- package/dist/es/ir/path/arrow.d.ts +19 -131
- package/dist/es/ir/path/arrow.d.ts.map +1 -1
- package/dist/es/ir/path/arrow.js +18 -16
- package/dist/es/ir/path/path.d.ts +519 -3065
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +3 -3
- package/dist/es/ir/path/step.d.ts +929 -3474
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +74 -23
- package/dist/es/ir/path/target.d.ts +40 -121
- package/dist/es/ir/path/target.d.ts.map +1 -1
- package/dist/es/ir/path/target.js +3 -3
- package/dist/es/ir/position/at-position.d.ts +20 -28
- package/dist/es/ir/position/at-position.d.ts.map +1 -1
- package/dist/es/ir/position/at-position.js +11 -11
- package/dist/es/ir/position/offset-position.d.ts +2 -8
- package/dist/es/ir/position/offset-position.d.ts.map +1 -1
- package/dist/es/ir/scene.d.ts +17 -181
- package/dist/es/ir/scene.d.ts.map +1 -1
- package/dist/es/ir/scope.d.ts +315 -7291
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +10 -7
- package/dist/es/ir/shape.d.ts +2 -8
- package/dist/es/ir/shape.d.ts.map +1 -1
- package/dist/es/ir/text.d.ts +24 -70
- package/dist/es/ir/text.d.ts.map +1 -1
- package/dist/es/ir/transform.d.ts +47 -144
- package/dist/es/ir/transform.d.ts.map +1 -1
- package/dist/es/ir/transform.js +12 -5
- package/dist/es/parsers/index.d.ts +3 -3
- package/dist/es/parsers/index.d.ts.map +1 -1
- package/dist/es/parsers/{parseNodeTarget.d.ts → node-target.d.ts} +1 -1
- package/dist/es/parsers/node-target.d.ts.map +1 -0
- package/dist/es/parsers/{parseNodeTarget.js → node-target.js} +10 -8
- package/dist/{lib/parsers/parseTargetSugar.d.ts → es/parsers/target-sugar.d.ts} +1 -1
- package/dist/es/parsers/target-sugar.d.ts.map +1 -0
- package/dist/es/parsers/{parseTargetSugar.js → target-sugar.js} +9 -4
- package/dist/{lib/parsers/parseWay.d.ts → es/parsers/way.d.ts} +2 -2
- package/dist/es/parsers/way.d.ts.map +1 -0
- package/dist/es/parsers/{parseWay.js → way.js} +10 -6
- package/dist/es/path-generators/define.d.ts.map +1 -0
- package/dist/es/{pathGenerators → path-generators}/define.js +1 -1
- package/dist/es/path-generators/index.d.ts.map +1 -0
- package/dist/es/path-generators/types.d.ts.map +1 -0
- package/dist/es/patterns/define.d.ts +9 -0
- package/dist/es/patterns/define.d.ts.map +1 -0
- package/dist/es/patterns/define.js +10 -0
- package/dist/es/patterns/index.d.ts +1 -0
- package/dist/es/patterns/index.d.ts.map +1 -1
- package/dist/es/patterns/index.js +42 -35
- package/dist/es/presets/animation.js +2 -2
- package/dist/es/primitive/marker.d.ts +7 -7
- package/dist/es/primitive/marker.d.ts.map +1 -1
- package/dist/es/primitive/paint.d.ts +1 -1
- package/dist/es/primitive/path.d.ts +1 -1
- package/dist/es/shapes/arc.d.ts.map +1 -1
- package/dist/es/shapes/arc.js +24 -5
- package/dist/{lib/shapes/_contour.d.ts → es/shapes/contour.d.ts} +6 -3
- package/dist/es/shapes/contour.d.ts.map +1 -0
- package/dist/es/shapes/{_contour.js → contour.js} +14 -2
- package/dist/es/shapes/ellipse.js +2 -2
- package/dist/es/shapes/index.d.ts +1 -1
- package/dist/es/shapes/index.d.ts.map +1 -1
- package/dist/es/shapes/index.js +1 -1
- package/dist/es/shapes/polygon.d.ts +1 -1
- package/dist/es/shapes/polygon.d.ts.map +1 -1
- package/dist/es/shapes/polygon.js +26 -21
- package/dist/es/shapes/rectangle.js +6 -6
- package/dist/es/shapes/sector.d.ts.map +1 -1
- package/dist/es/shapes/sector.js +30 -22
- package/dist/es/shapes/{_shared.d.ts → shared.d.ts} +7 -10
- package/dist/es/shapes/shared.d.ts.map +1 -0
- package/dist/es/shapes/{_shared.js → shared.js} +13 -15
- package/dist/es/shapes/star.d.ts.map +1 -1
- package/dist/es/shapes/star.js +6 -15
- package/dist/es/shapes/types.d.ts +10 -3
- package/dist/es/shapes/types.d.ts.map +1 -1
- package/dist/es/types.d.ts +1 -1
- package/dist/lib/arrows/define.cjs +10 -0
- package/dist/lib/arrows/define.d.ts +9 -0
- package/dist/lib/arrows/define.d.ts.map +1 -0
- package/dist/lib/arrows/index.cjs +15 -2
- package/dist/lib/arrows/index.d.ts +3 -1
- package/dist/lib/arrows/index.d.ts.map +1 -1
- package/dist/lib/arrows/types.d.ts +4 -2
- package/dist/lib/arrows/types.d.ts.map +1 -1
- package/dist/lib/compile/anchor-cache.cjs +17 -4
- package/dist/lib/compile/anchor-cache.d.ts +3 -3
- package/dist/lib/compile/anchor-cache.d.ts.map +1 -1
- package/dist/lib/compile/compile.cjs +44 -41
- package/dist/lib/compile/compile.d.ts +5 -14
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/{lowerComposites.cjs → composite.cjs} +9 -1
- package/dist/lib/compile/{lowerComposites.d.ts → composite.d.ts} +9 -2
- package/dist/lib/compile/composite.d.ts.map +1 -0
- package/dist/lib/compile/constant.cjs +22 -0
- package/dist/lib/compile/constant.d.ts +30 -0
- package/dist/lib/compile/constant.d.ts.map +1 -0
- package/dist/lib/compile/direction.cjs +31 -0
- package/dist/lib/compile/direction.d.ts +27 -0
- package/dist/lib/compile/direction.d.ts.map +1 -0
- package/dist/lib/compile/index.d.ts +3 -1
- package/dist/lib/compile/index.d.ts.map +1 -1
- package/dist/lib/compile/name-stack.cjs +5 -1
- package/dist/lib/compile/name-stack.d.ts +3 -1
- package/dist/lib/compile/name-stack.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +56 -69
- package/dist/lib/compile/node.d.ts +19 -8
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/paint.cjs +1 -1
- package/dist/lib/compile/path/anchor.cjs +10 -12
- package/dist/lib/compile/path/anchor.d.ts +4 -3
- package/dist/lib/compile/path/anchor.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +95 -42
- package/dist/lib/compile/path/index.d.ts +6 -8
- package/dist/lib/compile/path/index.d.ts.map +1 -1
- package/dist/lib/compile/path/label.cjs +8 -4
- package/dist/lib/compile/path/label.d.ts.map +1 -1
- package/dist/lib/compile/path/relative.cjs +1 -1
- package/dist/lib/compile/path/relative.d.ts +1 -1
- package/dist/lib/compile/path/shrink.cjs +16 -11
- package/dist/lib/compile/path/shrink.d.ts +3 -1
- package/dist/lib/compile/path/shrink.d.ts.map +1 -1
- package/dist/lib/compile/position.cjs +6 -19
- package/dist/lib/compile/position.d.ts +2 -2
- package/dist/lib/compile/position.d.ts.map +1 -1
- package/dist/lib/compile/precision.cjs +2 -2
- package/dist/lib/compile/precision.d.ts +1 -1
- package/dist/lib/compile/precision.d.ts.map +1 -1
- package/dist/lib/compile/scope.cjs +44 -16
- package/dist/lib/compile/scope.d.ts +7 -5
- package/dist/lib/compile/scope.d.ts.map +1 -1
- package/dist/lib/compile/style.cjs +2 -2
- package/dist/lib/compile/style.d.ts +2 -2
- package/dist/lib/compile/style.d.ts.map +1 -1
- package/dist/lib/compile/text-metrics.cjs +2 -2
- package/dist/lib/compile/text-metrics.d.ts +1 -1
- package/dist/lib/composites/{types.cjs → define.cjs} +2 -2
- package/dist/lib/composites/define.d.ts +8 -0
- package/dist/lib/composites/define.d.ts.map +1 -0
- package/dist/lib/composites/index.d.ts +1 -1
- package/dist/lib/composites/index.d.ts.map +1 -1
- package/dist/lib/composites/types.d.ts +0 -6
- package/dist/lib/composites/types.d.ts.map +1 -1
- package/dist/lib/geometry/anchor.cjs +47 -0
- package/dist/lib/geometry/anchor.d.ts +33 -0
- package/dist/lib/geometry/anchor.d.ts.map +1 -0
- package/dist/lib/geometry/bend.cjs +3 -3
- package/dist/lib/geometry/bend.d.ts +1 -1
- package/dist/lib/geometry/circle.cjs +9 -9
- package/dist/lib/geometry/circle.d.ts +4 -4
- package/dist/lib/geometry/circle.d.ts.map +1 -1
- package/dist/lib/geometry/{roundedContour.cjs → contour.cjs} +26 -35
- package/dist/lib/geometry/{roundedContour.d.ts → contour.d.ts} +9 -5
- package/dist/lib/geometry/contour.d.ts.map +1 -0
- package/dist/lib/geometry/diamond.cjs +16 -8
- package/dist/lib/geometry/diamond.d.ts +10 -4
- package/dist/lib/geometry/diamond.d.ts.map +1 -1
- package/dist/lib/geometry/{_edge.cjs → edge.cjs} +1 -1
- package/dist/{es/geometry/_edge.d.ts → lib/geometry/edge.d.ts} +1 -1
- package/dist/lib/geometry/edge.d.ts.map +1 -0
- package/dist/lib/geometry/ellipse.cjs +10 -8
- package/dist/lib/geometry/ellipse.d.ts +3 -3
- package/dist/lib/geometry/ellipse.d.ts.map +1 -1
- package/dist/lib/geometry/index.d.ts +6 -1
- package/dist/lib/geometry/index.d.ts.map +1 -1
- package/dist/lib/geometry/point.cjs +17 -0
- package/dist/lib/geometry/point.d.ts +6 -0
- package/dist/lib/geometry/point.d.ts.map +1 -1
- package/dist/lib/geometry/rect.cjs +9 -22
- package/dist/lib/geometry/rect.d.ts +4 -17
- package/dist/lib/geometry/rect.d.ts.map +1 -1
- package/dist/lib/geometry/segment.cjs +48 -46
- package/dist/lib/geometry/segment.d.ts +7 -0
- package/dist/lib/geometry/segment.d.ts.map +1 -1
- package/dist/lib/geometry/{_transform.cjs → transform.cjs} +1 -1
- package/dist/{es/geometry/_transform.d.ts → lib/geometry/transform.d.ts} +1 -1
- package/dist/lib/geometry/transform.d.ts.map +1 -0
- package/dist/lib/index.cjs +35 -22
- package/dist/lib/index.d.ts +13 -13
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/animation.cjs +6 -6
- package/dist/lib/ir/animation.d.ts +26 -125
- package/dist/lib/ir/animation.d.ts.map +1 -1
- package/dist/lib/ir/boundary.d.ts +4 -10
- package/dist/lib/ir/boundary.d.ts.map +1 -1
- package/dist/lib/ir/clip.d.ts +6 -46
- package/dist/lib/ir/clip.d.ts.map +1 -1
- package/dist/lib/ir/composite.d.ts +2 -14
- package/dist/lib/ir/composite.d.ts.map +1 -1
- package/dist/lib/ir/coordinate.cjs +1 -1
- package/dist/lib/ir/coordinate.d.ts +14 -50
- package/dist/lib/ir/coordinate.d.ts.map +1 -1
- package/dist/lib/ir/font.d.ts +10 -13
- package/dist/lib/ir/font.d.ts.map +1 -1
- package/dist/lib/ir/json.cjs +1 -1
- package/dist/lib/ir/json.d.ts +1 -1
- package/dist/lib/ir/json.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +23 -23
- package/dist/lib/ir/node.d.ts +175 -821
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/paint.cjs +10 -10
- package/dist/lib/ir/paint.d.ts +23 -100
- package/dist/lib/ir/paint.d.ts.map +1 -1
- package/dist/lib/ir/path/arrow.cjs +18 -16
- package/dist/lib/ir/path/arrow.d.ts +19 -131
- package/dist/lib/ir/path/arrow.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +4 -2
- package/dist/lib/ir/path/path.d.ts +519 -3065
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +74 -22
- package/dist/lib/ir/path/step.d.ts +929 -3474
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +3 -3
- package/dist/lib/ir/path/target.d.ts +40 -121
- package/dist/lib/ir/path/target.d.ts.map +1 -1
- package/dist/lib/ir/position/at-position.cjs +11 -11
- package/dist/lib/ir/position/at-position.d.ts +20 -28
- package/dist/lib/ir/position/at-position.d.ts.map +1 -1
- package/dist/lib/ir/position/offset-position.d.ts +2 -8
- package/dist/lib/ir/position/offset-position.d.ts.map +1 -1
- package/dist/lib/ir/scene.d.ts +17 -181
- package/dist/lib/ir/scene.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +10 -7
- package/dist/lib/ir/scope.d.ts +315 -7291
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/dist/lib/ir/shape.d.ts +2 -8
- package/dist/lib/ir/shape.d.ts.map +1 -1
- package/dist/lib/ir/text.d.ts +24 -70
- package/dist/lib/ir/text.d.ts.map +1 -1
- package/dist/lib/ir/transform.cjs +11 -4
- package/dist/lib/ir/transform.d.ts +47 -144
- package/dist/lib/ir/transform.d.ts.map +1 -1
- package/dist/lib/parsers/index.d.ts +3 -3
- package/dist/lib/parsers/index.d.ts.map +1 -1
- package/dist/lib/parsers/{parseNodeTarget.cjs → node-target.cjs} +10 -8
- package/dist/lib/parsers/{parseNodeTarget.d.ts → node-target.d.ts} +1 -1
- package/dist/lib/parsers/node-target.d.ts.map +1 -0
- package/dist/lib/parsers/{parseTargetSugar.cjs → target-sugar.cjs} +9 -4
- package/dist/{es/parsers/parseTargetSugar.d.ts → lib/parsers/target-sugar.d.ts} +1 -1
- package/dist/lib/parsers/target-sugar.d.ts.map +1 -0
- package/dist/lib/parsers/{parseWay.cjs → way.cjs} +13 -9
- package/dist/{es/parsers/parseWay.d.ts → lib/parsers/way.d.ts} +2 -2
- package/dist/lib/parsers/way.d.ts.map +1 -0
- package/dist/lib/{pathGenerators → path-generators}/define.cjs +1 -1
- package/dist/lib/path-generators/define.d.ts.map +1 -0
- package/dist/lib/path-generators/index.d.ts.map +1 -0
- package/dist/lib/path-generators/types.d.ts.map +1 -0
- package/dist/lib/patterns/define.cjs +10 -0
- package/dist/lib/patterns/define.d.ts +9 -0
- package/dist/lib/patterns/define.d.ts.map +1 -0
- package/dist/lib/patterns/index.cjs +42 -35
- package/dist/lib/patterns/index.d.ts +1 -0
- package/dist/lib/patterns/index.d.ts.map +1 -1
- package/dist/lib/presets/animation.cjs +2 -2
- package/dist/lib/primitive/marker.d.ts +7 -7
- package/dist/lib/primitive/marker.d.ts.map +1 -1
- package/dist/lib/primitive/paint.d.ts +1 -1
- package/dist/lib/primitive/path.d.ts +1 -1
- package/dist/lib/shapes/arc.cjs +26 -7
- package/dist/lib/shapes/arc.d.ts.map +1 -1
- package/dist/lib/shapes/{_contour.cjs → contour.cjs} +14 -1
- package/dist/{es/shapes/_contour.d.ts → lib/shapes/contour.d.ts} +6 -3
- package/dist/lib/shapes/contour.d.ts.map +1 -0
- package/dist/lib/shapes/ellipse.cjs +2 -2
- package/dist/lib/shapes/index.cjs +1 -1
- package/dist/lib/shapes/index.d.ts +1 -1
- package/dist/lib/shapes/index.d.ts.map +1 -1
- package/dist/lib/shapes/polygon.cjs +29 -24
- package/dist/lib/shapes/polygon.d.ts +1 -1
- package/dist/lib/shapes/polygon.d.ts.map +1 -1
- package/dist/lib/shapes/rectangle.cjs +12 -12
- package/dist/lib/shapes/sector.cjs +41 -33
- package/dist/lib/shapes/sector.d.ts.map +1 -1
- package/dist/lib/shapes/{_shared.cjs → shared.cjs} +12 -15
- package/dist/lib/shapes/{_shared.d.ts → shared.d.ts} +7 -10
- package/dist/lib/shapes/shared.d.ts.map +1 -0
- package/dist/lib/shapes/star.cjs +9 -18
- package/dist/lib/shapes/star.d.ts.map +1 -1
- package/dist/lib/shapes/types.d.ts +10 -3
- package/dist/lib/shapes/types.d.ts.map +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/package.json +3 -4
- package/dist/es/compile/lowerComposites.d.ts.map +0 -1
- package/dist/es/geometry/_edge.d.ts.map +0 -1
- package/dist/es/geometry/_transform.d.ts.map +0 -1
- package/dist/es/geometry/roundedContour.d.ts.map +0 -1
- package/dist/es/parsers/parseNodeTarget.d.ts.map +0 -1
- package/dist/es/parsers/parseTargetSugar.d.ts.map +0 -1
- package/dist/es/parsers/parseWay.d.ts.map +0 -1
- package/dist/es/pathGenerators/define.d.ts.map +0 -1
- package/dist/es/pathGenerators/index.d.ts.map +0 -1
- package/dist/es/pathGenerators/types.d.ts.map +0 -1
- package/dist/es/shapes/_contour.d.ts.map +0 -1
- package/dist/es/shapes/_shared.d.ts.map +0 -1
- package/dist/lib/compile/lowerComposites.d.ts.map +0 -1
- package/dist/lib/geometry/_edge.d.ts.map +0 -1
- package/dist/lib/geometry/_transform.d.ts.map +0 -1
- package/dist/lib/geometry/roundedContour.d.ts.map +0 -1
- package/dist/lib/parsers/parseNodeTarget.d.ts.map +0 -1
- package/dist/lib/parsers/parseTargetSugar.d.ts.map +0 -1
- package/dist/lib/parsers/parseWay.d.ts.map +0 -1
- package/dist/lib/pathGenerators/define.d.ts.map +0 -1
- package/dist/lib/pathGenerators/index.d.ts.map +0 -1
- package/dist/lib/pathGenerators/types.d.ts.map +0 -1
- package/dist/lib/shapes/_contour.d.ts.map +0 -1
- package/dist/lib/shapes/_shared.d.ts.map +0 -1
- /package/dist/es/{pathGenerators → path-generators}/define.d.ts +0 -0
- /package/dist/es/{pathGenerators → path-generators}/index.d.ts +0 -0
- /package/dist/es/{pathGenerators → path-generators}/types.d.ts +0 -0
- /package/dist/lib/{pathGenerators → path-generators}/define.d.ts +0 -0
- /package/dist/lib/{pathGenerators → path-generators}/index.d.ts +0 -0
- /package/dist/lib/{pathGenerators → path-generators}/types.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
//#region src/parsers/
|
|
1
|
+
const require_target_sugar = require("./target-sugar.cjs");
|
|
2
|
+
//#region src/parsers/way.ts
|
|
3
3
|
/**
|
|
4
4
|
* Sugar 层 way 数组的关键字常量
|
|
5
5
|
* @description Cycle 闭合到 way 起点(底层字符串故意写丑避节点 id 冲突,只通过 DrawWay.Cycle 引用);Hv/Vh 折角算子(裸字面量 `-|`/`|-` 与常量等价);Relative/Accumulate 相对偏移 way item 的 type 鉴别值(Relative=TikZ `(+x,+y)` 不推进 prevEnd,Accumulate=TikZ `(++x,++y)` 累积更新)。用 const + as const 而非 TS enum 避免 reverse-mapping 与字面量不互通
|
|
@@ -35,7 +35,10 @@ var normalizeLabel = (l) => typeof l === "string" ? { text: l } : { ...l };
|
|
|
35
35
|
/** sugar `{position,type}` → IR `{relative}|{relativeAccumulate}`;其它形态原样返回 */
|
|
36
36
|
var desugarRelativeItem = (item) => {
|
|
37
37
|
if (!isWayRelativeItem(item)) return item;
|
|
38
|
-
|
|
38
|
+
const candidate = item;
|
|
39
|
+
if (candidate.type === DrawWay.Accumulate) return { relativeAccumulate: candidate.position };
|
|
40
|
+
if (candidate.type === DrawWay.Relative) return { relative: candidate.position };
|
|
41
|
+
throw new Error(`parseWay: WayRelativeItem.type must be DrawWay.Relative or DrawWay.Accumulate`);
|
|
39
42
|
};
|
|
40
43
|
/** WayItem 归约为"目标点",算子/关键字返回 null */
|
|
41
44
|
var targetOf = (item) => {
|
|
@@ -44,7 +47,7 @@ var targetOf = (item) => {
|
|
|
44
47
|
};
|
|
45
48
|
/**
|
|
46
49
|
* way 数组 → IRStep 序列
|
|
47
|
-
* @description
|
|
50
|
+
* @description 首元素必须是 move 目标(way[0] 是算子 / label 算子时抛错,不降级);后续元素按各自规则:target/RelItem→line;Cycle→cycle;-|/|- 与下一项合并 fold;curve/cubic/bend 与下一项合并;arc/circle/ellipse 单独成 step;label 算子修饰下一段。连续 label/末尾 label/cycle 上的 label 抛错。纯函数,各框架 adapter Sugar 组件复用
|
|
48
51
|
*/
|
|
49
52
|
var parseWay = (way) => {
|
|
50
53
|
if (way.length < 2) throw new Error("parseWay: way must contain at least 2 items");
|
|
@@ -58,10 +61,11 @@ var parseWay = (way) => {
|
|
|
58
61
|
};
|
|
59
62
|
if (isWayLabelOp(way[0])) throw new Error(`parseWay: way[0] must be a target (move start), got label operator`);
|
|
60
63
|
const rawMove = targetOf(way[0]);
|
|
64
|
+
if (rawMove === null) throw new Error(`parseWay: way[0] must be a target (move start), got operator`);
|
|
61
65
|
const moveStep = {
|
|
62
66
|
type: "step",
|
|
63
67
|
kind: "move",
|
|
64
|
-
to:
|
|
68
|
+
to: require_target_sugar.parseTargetSugar(rawMove)
|
|
65
69
|
};
|
|
66
70
|
out.push(moveStep);
|
|
67
71
|
for (let i = 1; i < way.length; i++) {
|
|
@@ -85,9 +89,9 @@ var parseWay = (way) => {
|
|
|
85
89
|
if (isWayOperator(next)) throw new Error(`parseWay: via operator '${item}' must be followed by a target, got '${String(next)}'`);
|
|
86
90
|
const fold = {
|
|
87
91
|
type: "step",
|
|
88
|
-
kind: "
|
|
92
|
+
kind: "fold",
|
|
89
93
|
via: item,
|
|
90
|
-
to:
|
|
94
|
+
to: require_target_sugar.parseTargetSugar(desugarRelativeItem(next))
|
|
91
95
|
};
|
|
92
96
|
const label = consumeLabel();
|
|
93
97
|
if (label) fold.label = label;
|
|
@@ -99,7 +103,7 @@ var parseWay = (way) => {
|
|
|
99
103
|
if (i + 1 >= way.length) throw new Error(`parseWay: curve operator at end of way must be followed by a target`);
|
|
100
104
|
const next = way[i + 1];
|
|
101
105
|
if (isWayOperator(next)) throw new Error(`parseWay: curve operator must be followed by a target, got operator/keyword`);
|
|
102
|
-
const target =
|
|
106
|
+
const target = require_target_sugar.parseTargetSugar(desugarRelativeItem(next));
|
|
103
107
|
const label = consumeLabel();
|
|
104
108
|
if (isWayCurveOp(item)) {
|
|
105
109
|
const curve = {
|
|
@@ -169,7 +173,7 @@ var parseWay = (way) => {
|
|
|
169
173
|
const lineStep = {
|
|
170
174
|
type: "step",
|
|
171
175
|
kind: "line",
|
|
172
|
-
to:
|
|
176
|
+
to: require_target_sugar.parseTargetSugar(desugarRelativeItem(item))
|
|
173
177
|
};
|
|
174
178
|
const label = consumeLabel();
|
|
175
179
|
if (label) lineStep.label = label;
|
|
@@ -82,7 +82,7 @@ export type WayItem = IRTarget | string | WayRelativeItem | WayVia | WayCycle |
|
|
|
82
82
|
export type WayDSL = Array<WayItem>;
|
|
83
83
|
/**
|
|
84
84
|
* way 数组 → IRStep 序列
|
|
85
|
-
* @description
|
|
85
|
+
* @description 首元素必须是 move 目标(way[0] 是算子 / label 算子时抛错,不降级);后续元素按各自规则:target/RelItem→line;Cycle→cycle;-|/|- 与下一项合并 fold;curve/cubic/bend 与下一项合并;arc/circle/ellipse 单独成 step;label 算子修饰下一段。连续 label/末尾 label/cycle 上的 label 抛错。纯函数,各框架 adapter Sugar 组件复用
|
|
86
86
|
*/
|
|
87
87
|
export declare const parseWay: (way: WayDSL) => Array<IRStep>;
|
|
88
|
-
//# sourceMappingURL=
|
|
88
|
+
//# sourceMappingURL=way.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"way.d.ts","sourceRoot":"","sources":["../../../src/parsers/way.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAIV,cAAc,EAQd,MAAM,EACN,WAAW,EACX,QAAQ,EACT,MAAM,OAAO,CAAC;AAGf;;;GAGG;AACH,eAAO,MAAM,OAAO;IAClB,oDAAoD;;IAEpD,2BAA2B;;IAE3B,2BAA2B;;IAE3B,gDAAgD;;IAEhD,kDAAkD;;CAE1C,CAAC;AAEX,oBAAoB;AACpB,MAAM,MAAM,MAAM,GAAG,OAAO,OAAO,CAAC,EAAE,GAAG,OAAO,OAAO,CAAC,EAAE,CAAC;AAE3D,qBAAqB;AACrB,MAAM,MAAM,QAAQ,GAAG,OAAO,OAAO,CAAC,KAAK,CAAC;AAE5C;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B,IAAI,EAAE,OAAO,OAAO,CAAC,QAAQ,GAAG,OAAO,OAAO,CAAC,UAAU,CAAC;CAC3D,CAAC;AAOF,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,CAAC;AAEnD,+CAA+C;AAC/C,MAAM,MAAM,UAAU,GAAG;IAAE,KAAK,EAAE,CAAC,cAAc,EAAE,cAAc,CAAC,CAAA;CAAE,CAAC;AAErE,qDAAqD;AACrD,MAAM,MAAM,SAAS,GAAG;IAAE,IAAI,E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AAO,MAAM,mBAAmB,GAC9B,KAAK,uBAAuB,KAC3B,uBAwBF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/path-generators/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/path-generators/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,oCAAoC;IACpC,IAAI,EAAE,QAAQ,CAAC;IACf,uDAAuD;IACvD,EAAE,CAAC,EAAE,QAAQ,CAAC;IACd,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC1C,8CAA8C;IAC9C,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,8DAA8D;IAC9D,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACpC,qEAAqE;IACrE,YAAY,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,6EAA6E;IAC7E,QAAQ,EAAE,CAAC,GAAG,EAAE,oBAAoB,KAAK,KAAK,CAAC,WAAW,CAAC,CAAC;CAC7D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/patterns/define.ts
|
|
2
|
+
/**
|
|
3
|
+
* 定义一个 pattern motif 注册项
|
|
4
|
+
* @description 与 `defineShape` / `definePathGenerator` 对齐的定义点 helper;当前不做额外运行时校验,
|
|
5
|
+
* 只保留 `PatternDefinition` 形态并让第三方扩展面写法一致。
|
|
6
|
+
* @returns 原样返回的 def(便于 `export const cross = definePattern({ ... })`)
|
|
7
|
+
*/
|
|
8
|
+
var definePattern = (def) => def;
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.definePattern = definePattern;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PatternDefinition } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 定义一个 pattern motif 注册项
|
|
4
|
+
* @description 与 `defineShape` / `definePathGenerator` 对齐的定义点 helper;当前不做额外运行时校验,
|
|
5
|
+
* 只保留 `PatternDefinition` 形态并让第三方扩展面写法一致。
|
|
6
|
+
* @returns 原样返回的 def(便于 `export const cross = definePattern({ ... })`)
|
|
7
|
+
*/
|
|
8
|
+
export declare const definePattern: (def: PatternDefinition) => PatternDefinition;
|
|
9
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../src/patterns/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,iBAAiB,KAAG,iBAAwB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require("./define.cjs");
|
|
1
2
|
//#region src/patterns/index.ts
|
|
2
3
|
/** 内置 3 motif 默认 tile 周期(user units);用户 `pattern.size` 覆盖 */
|
|
3
4
|
var DEFAULT_PATTERN_SIZE = 8;
|
|
@@ -24,44 +25,50 @@ var withBackground = (ctx, motif) => ctx.background === void 0 ? [...motif] : [{
|
|
|
24
25
|
var BUILTIN_PATTERNS = {
|
|
25
26
|
lines: {
|
|
26
27
|
defaultSize: DEFAULT_PATTERN_SIZE,
|
|
27
|
-
emit: (ctx) =>
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
emit: (ctx) => {
|
|
29
|
+
const half = ctx.round(ctx.size / 2);
|
|
30
|
+
return withBackground(ctx, [{
|
|
31
|
+
type: "path",
|
|
32
|
+
commands: [{
|
|
33
|
+
kind: "move",
|
|
34
|
+
to: [0, half]
|
|
35
|
+
}, {
|
|
36
|
+
kind: "line",
|
|
37
|
+
to: [ctx.size, half]
|
|
38
|
+
}],
|
|
39
|
+
stroke: ctx.color,
|
|
40
|
+
strokeWidth: ctx.lineWidth ?? DEFAULT_STROKE_WIDTH
|
|
41
|
+
}]);
|
|
42
|
+
}
|
|
39
43
|
},
|
|
40
44
|
grid: {
|
|
41
45
|
defaultSize: DEFAULT_PATTERN_SIZE,
|
|
42
|
-
emit: (ctx) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
46
|
+
emit: (ctx) => {
|
|
47
|
+
const half = ctx.round(ctx.size / 2);
|
|
48
|
+
return withBackground(ctx, [{
|
|
49
|
+
type: "path",
|
|
50
|
+
commands: [
|
|
51
|
+
{
|
|
52
|
+
kind: "move",
|
|
53
|
+
to: [0, half]
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
kind: "line",
|
|
57
|
+
to: [ctx.size, half]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
kind: "move",
|
|
61
|
+
to: [half, 0]
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
kind: "line",
|
|
65
|
+
to: [half, ctx.size]
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
stroke: ctx.color,
|
|
69
|
+
strokeWidth: ctx.lineWidth ?? DEFAULT_STROKE_WIDTH
|
|
70
|
+
}]);
|
|
71
|
+
}
|
|
65
72
|
},
|
|
66
73
|
dots: {
|
|
67
74
|
defaultSize: DEFAULT_PATTERN_SIZE,
|
|
@@ -7,4 +7,5 @@ import { PatternDefinition } from './types';
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const BUILTIN_PATTERNS: Record<BuiltinPatternName, PatternDefinition>;
|
|
9
9
|
export type { PatternDefinition, PatternEmitContext } from './types';
|
|
10
|
+
export { definePattern } from './define';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,SAAS,CAAC;AAwBrE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/patterns/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,EAAE,iBAAiB,EAAsB,MAAM,SAAS,CAAC;AAwBrE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,kBAAkB,EAAE,iBAAiB,CAmD1E,CAAC;AAEF,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -97,7 +97,7 @@ var slideIn = (opts = {}) => ({
|
|
|
97
97
|
/** 变色:`fill|stroke` from→to(oklch 插值,由 renderer 端处理) */
|
|
98
98
|
var colorShift = (opts) => {
|
|
99
99
|
const { from, to } = opts;
|
|
100
|
-
if (from
|
|
100
|
+
if (from == null || to == null) throw new Error("colorShift: `from` and `to` colors are required.");
|
|
101
101
|
return {
|
|
102
102
|
property: (opts.channel ?? "fill") === "stroke" ? require_animation.AnimationProperty.Stroke : require_animation.AnimationProperty.Fill,
|
|
103
103
|
keyframes: [{
|
|
@@ -116,7 +116,7 @@ var colorShift = (opts) => {
|
|
|
116
116
|
/** 镜头:scene 根 `viewBox` from→to(挂 `<Layout animations>` / IR 根 `animations`) */
|
|
117
117
|
var cameraTo = (opts) => {
|
|
118
118
|
const { from, to } = opts;
|
|
119
|
-
if (from
|
|
119
|
+
if (from == null || to == null) throw new Error("cameraTo: `from` and `to` viewBox [x, y, w, h] are required.");
|
|
120
120
|
return {
|
|
121
121
|
property: require_animation.AnimationProperty.ViewBox,
|
|
122
122
|
keyframes: [{
|
|
@@ -24,8 +24,8 @@ export type MarkerPathPrim = {
|
|
|
24
24
|
fillOpacity?: number;
|
|
25
25
|
/** 填充规则:`nonzero`(默认)/ `evenodd`(环形 / 孔洞场景) */
|
|
26
26
|
fillRule?: 'nonzero' | 'evenodd';
|
|
27
|
-
/**
|
|
28
|
-
stroke?:
|
|
27
|
+
/** 描边色:纯色 CSS 或 `{ kind: 'contextStroke' }`(继承所在元素描边);与 fill 同词汇,core 不持 SVG 裸关键字 */
|
|
28
|
+
stroke?: MarkerFill;
|
|
29
29
|
/** 描边透明度 0~1 */
|
|
30
30
|
strokeOpacity?: number;
|
|
31
31
|
/** 描边宽度(marker 局部坐标) */
|
|
@@ -97,8 +97,8 @@ export type MarkerEllipsePrim = {
|
|
|
97
97
|
fill?: MarkerFill;
|
|
98
98
|
/** 填充透明度 0~1 */
|
|
99
99
|
fillOpacity?: number;
|
|
100
|
-
/**
|
|
101
|
-
stroke?:
|
|
100
|
+
/** 描边色:纯色 CSS 或 `{ kind: 'contextStroke' }` */
|
|
101
|
+
stroke?: MarkerFill;
|
|
102
102
|
/** 描边透明度 0~1 */
|
|
103
103
|
strokeOpacity?: number;
|
|
104
104
|
/** 描边宽度 */
|
|
@@ -125,8 +125,8 @@ export type MarkerRectPrim = {
|
|
|
125
125
|
fill?: MarkerFill;
|
|
126
126
|
/** 填充透明度 0~1 */
|
|
127
127
|
fillOpacity?: number;
|
|
128
|
-
/**
|
|
129
|
-
stroke?:
|
|
128
|
+
/** 描边色:纯色 CSS 或 `{ kind: 'contextStroke' }` */
|
|
129
|
+
stroke?: MarkerFill;
|
|
130
130
|
/** 描边透明度 0~1 */
|
|
131
131
|
strokeOpacity?: number;
|
|
132
132
|
/** 描边宽度 */
|
|
@@ -154,7 +154,7 @@ export type MarkerGroupPrim = {
|
|
|
154
154
|
* @description renderer-agnostic:core 只产此结构(局部 baseSize 坐标系),react adapter 把它嵌进
|
|
155
155
|
* `<marker>`。相对 `ScenePrimitive` 的收窄——禁 `TextPrim`、禁 `arrowStart`/`arrowEnd`、禁外部
|
|
156
156
|
* `resourceRef`、禁 `clip`;`fill` 限 `MarkerFill`。这条收窄兜住"marker 内递归引用 marker / clip /
|
|
157
|
-
* 文本布局"
|
|
157
|
+
* 文本布局"的复杂度。
|
|
158
158
|
*/
|
|
159
159
|
export type MarkerPrimitive = MarkerPathPrim | MarkerEllipsePrim | MarkerRectPrim | MarkerGroupPrim;
|
|
160
160
|
//# sourceMappingURL=marker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../src/primitive/marker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,oCAAoC;IACpC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,
|
|
1
|
+
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../src/primitive/marker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,CAAC;AAE5D;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,QAAQ,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACnC,oCAAoC;IACpC,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,qFAAqF;IACrF,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,gBAAgB;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,wBAAwB;IACxB,WAAW,CAAC,EAAE,M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AAE,MAAM,CAAC;IACvB,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,YAAY;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,2CAA2C;IAC3C,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC9B,qDAAqD;IACrD,QAAQ,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;CAClC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,eAAe,GACvB,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,eAAe,CAAC"}
|
|
@@ -5,7 +5,7 @@ import { MarkerPrimitive } from './marker';
|
|
|
5
5
|
* paint 属性取值词汇表(可用于 fill / stroke,不绑定单一属性)
|
|
6
6
|
* @description 渲染无关:`string` 纯色(含 var() 由 adapter 走 inline style);`{ kind:'resourceRef' }` 指向
|
|
7
7
|
* `Scene.resources` 里的 paint server(gradient / 后续 pattern·image);`{ kind:'contextStroke' }` 继承所在元素描边
|
|
8
|
-
* (adapter → SVG context-stroke
|
|
8
|
+
* (adapter → SVG context-stroke)。
|
|
9
9
|
*/
|
|
10
10
|
export type PaintValue = string | {
|
|
11
11
|
kind: 'resourceRef';
|
|
@@ -91,7 +91,7 @@ export type PathCommand = MovePathCommand | LinePathCommand | QuadPathCommand |
|
|
|
91
91
|
* markerHeight>`,不再 switch、不调 emit、不需要 arrows 注册表。纯 JSON 数据(无函数)。
|
|
92
92
|
*/
|
|
93
93
|
export type ArrowEndSpec = {
|
|
94
|
-
/** 形状名:内置
|
|
94
|
+
/** 形状名:内置 8 或经 `CompileOptions.arrows` 注册的扩展名;标识 / 调试用,已解析后渲染不依赖(保留) */
|
|
95
95
|
shape: ArrowShapeName;
|
|
96
96
|
/** marker viewBox 边长(`def.baseSize ?? 10`);adapter 据此推 viewBox `0 0 baseSize baseSize` 与 refY = baseSize/2 */
|
|
97
97
|
baseSize: number;
|
package/dist/lib/shapes/arc.cjs
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_transform = require("../geometry/transform.cjs");
|
|
2
2
|
const require_arc = require("../geometry/arc.cjs");
|
|
3
3
|
const require_define = require("./define.cjs");
|
|
4
|
-
const
|
|
4
|
+
const require_shared = require("./shared.cjs");
|
|
5
5
|
let zod = require("zod");
|
|
6
6
|
//#region src/shapes/arc.ts
|
|
7
|
+
var RAD_TO_DEG = 180 / Math.PI;
|
|
7
8
|
/** arc 的派生几何:圆心局部系 AABB + 圆心相对 AABB 中心偏移 */
|
|
8
|
-
var
|
|
9
|
+
var computeArcGeometry = (params) => {
|
|
9
10
|
const { radius } = params;
|
|
10
|
-
const range =
|
|
11
|
+
const range = require_shared.normalizeAngularRange(params.startAngle, params.endAngle);
|
|
11
12
|
const points = require_arc.arcBoundingPoints([0, 0], radius, range.start, range.end);
|
|
12
13
|
let minX = Infinity;
|
|
13
14
|
let maxX = -Infinity;
|
|
@@ -29,8 +30,17 @@ var arcGeometry = (params) => {
|
|
|
29
30
|
centerOffset: [-aabbCenter[0], -aabbCenter[1]]
|
|
30
31
|
};
|
|
31
32
|
};
|
|
33
|
+
/** params → 派生几何的 WeakMap 缓存(同 sector:同一 params 实例多次取几何只算一次,纯性能、行为不变) */
|
|
34
|
+
var arcGeometryCache = /* @__PURE__ */ new WeakMap();
|
|
35
|
+
var arcGeometry = (params) => {
|
|
36
|
+
const cached = arcGeometryCache.get(params);
|
|
37
|
+
if (cached !== void 0) return cached;
|
|
38
|
+
const geo = computeArcGeometry(params);
|
|
39
|
+
arcGeometryCache.set(params, geo);
|
|
40
|
+
return geo;
|
|
41
|
+
};
|
|
32
42
|
/** 圆心局部点(相对圆心)→ 世界系(+centerOffset 到相对 AABB 中心后经 rect 投影) */
|
|
33
|
-
var arcLocalToWorld = (rect, centerOffset, localFromCenter) =>
|
|
43
|
+
var arcLocalToWorld = (rect, centerOffset, localFromCenter) => require_transform.localToWorld(rect, [localFromCenter[0] + centerOffset[0], localFromCenter[1] + centerOffset[1]]);
|
|
34
44
|
/**
|
|
35
45
|
* arc 注册项:单半径曲线(描边、可选闭合为弓形)
|
|
36
46
|
* @description circumscribe 返回弧 bbox 半轴(含弧跨过的 90°·k 轴向极值点),node position = AABB 中心;
|
|
@@ -49,9 +59,18 @@ var arc = require_define.defineShape({
|
|
|
49
59
|
const { centerOffset } = arcGeometry(params);
|
|
50
60
|
return [-centerOffset[0], -centerOffset[1]];
|
|
51
61
|
},
|
|
52
|
-
boundaryPoint: (rect,
|
|
62
|
+
boundaryPoint: (rect, toward, params) => {
|
|
53
63
|
const geo = arcGeometry(params);
|
|
54
|
-
|
|
64
|
+
const { radius } = params;
|
|
65
|
+
const { start, end } = geo.range;
|
|
66
|
+
const local = require_transform.worldToLocal(rect, toward);
|
|
67
|
+
const fx = local[0] - geo.centerOffset[0];
|
|
68
|
+
const fy = local[1] - geo.centerOffset[1];
|
|
69
|
+
let theta = Math.atan2(fy, fx) * RAD_TO_DEG;
|
|
70
|
+
while (theta < start) theta += 360;
|
|
71
|
+
while (theta >= start + 360) theta -= 360;
|
|
72
|
+
const angle = theta <= end ? theta : theta - end <= start + 360 - theta ? end : start;
|
|
73
|
+
return arcLocalToWorld(rect, geo.centerOffset, require_arc.arcEndPoint([0, 0], radius, angle));
|
|
55
74
|
},
|
|
56
75
|
anchor: (rect, name, params) => {
|
|
57
76
|
const geo = arcGeometry(params);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../src/shapes/arc.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../src/shapes/arc.ts"],"names":[],"mappings":"AA4EA;;;;;GAKG;AACH,eAAO,MAAM,GAAG,mCAyFd,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/shapes/
|
|
1
|
+
//#region src/shapes/contour.ts
|
|
2
2
|
/**
|
|
3
3
|
* 由顶点环构造闭合折线段序列(接缝顺序同顶点顺序)
|
|
4
4
|
* @description 第 i 段 from = 顶点 i、to = 顶点 (i+1)%n;供 polygon / star 的 emit / boundaryPoint
|
|
@@ -56,6 +56,19 @@ var contourToPathCommands = (commands, round) => {
|
|
|
56
56
|
});
|
|
57
57
|
return out;
|
|
58
58
|
};
|
|
59
|
+
/** contour shape 共用的 path primitive 样式落地。 */
|
|
60
|
+
var contourToPathPrimitive = (commands, style) => ({
|
|
61
|
+
type: "path",
|
|
62
|
+
commands,
|
|
63
|
+
fill: style.fill ?? "transparent",
|
|
64
|
+
fillOpacity: style.fillOpacity,
|
|
65
|
+
stroke: style.stroke ?? "currentColor",
|
|
66
|
+
strokeOpacity: style.strokeOpacity,
|
|
67
|
+
strokeWidth: style.strokeWidth ?? 1,
|
|
68
|
+
dashPattern: style.dashPattern,
|
|
69
|
+
opacity: style.opacity
|
|
70
|
+
});
|
|
59
71
|
//#endregion
|
|
60
72
|
exports.contourToPathCommands = contourToPathCommands;
|
|
73
|
+
exports.contourToPathPrimitive = contourToPathPrimitive;
|
|
61
74
|
exports.verticesToSegments = verticesToSegments;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Position } from '../geometry/point';
|
|
2
|
-
import { ContourCommand, LineSegment } from '../geometry/
|
|
3
|
-
import { PathCommand } from '../primitive';
|
|
2
|
+
import { ContourCommand, LineSegment } from '../geometry/contour';
|
|
3
|
+
import { PathCommand, PathPrim } from '../primitive';
|
|
4
|
+
import { ShapeStyle } from './types';
|
|
4
5
|
/**
|
|
5
6
|
* 由顶点环构造闭合折线段序列(接缝顺序同顶点顺序)
|
|
6
7
|
* @description 第 i 段 from = 顶点 i、to = 顶点 (i+1)%n;供 polygon / star 的 emit / boundaryPoint
|
|
@@ -16,4 +17,6 @@ export declare const verticesToSegments: (verts: Array<Position>) => Array<LineS
|
|
|
16
17
|
* polygon / star 共用此映射器(单一实现)。
|
|
17
18
|
*/
|
|
18
19
|
export declare const contourToPathCommands: (commands: Array<ContourCommand>, round: (n: number) => number) => Array<PathCommand>;
|
|
19
|
-
|
|
20
|
+
/** contour shape 共用的 path primitive 样式落地。 */
|
|
21
|
+
export declare const contourToPathPrimitive: (commands: Array<PathCommand>, style: ShapeStyle) => PathPrim;
|
|
22
|
+
//# sourceMappingURL=contour.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contour.d.ts","sourceRoot":"","sources":["../../../src/shapes/contour.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,KAAK,CAAC,QAAQ,CAAC,KAAG,KAAK,CAAC,WAAW,CACQ,CAAC;AAEtF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,KAAK,CAAC,cAAc,CAAC,EAC/B,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAC3B,KAAK,CAAC,WAAW,CAqCnB,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,sBAAsB,GACjC,UAAU,KAAK,CAAC,WAAW,CAAC,EAC5B,OAAO,UAAU,KAChB,QAUD,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_define = require("./define.cjs");
|
|
2
|
-
const require__shared = require("./_shared.cjs");
|
|
3
2
|
const require_ellipse = require("../geometry/ellipse.cjs");
|
|
3
|
+
const require_anchor = require("../geometry/anchor.cjs");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
//#region src/shapes/ellipse.ts
|
|
6
6
|
/** 外接框 Rect → Ellipse(rx/ry = 半宽/半高) */
|
|
@@ -29,7 +29,7 @@ var ellipse = require_define.defineShape({
|
|
|
29
29
|
},
|
|
30
30
|
boundaryPoint: (r, toward) => require_ellipse.ellipse.boundaryPoint(toEllipse(r), toward),
|
|
31
31
|
anchor: (r, name) => {
|
|
32
|
-
const a =
|
|
32
|
+
const a = require_anchor.normalizeCompassAnchor(name);
|
|
33
33
|
return a ? require_ellipse.ellipse.anchor(toEllipse(r), a) : void 0;
|
|
34
34
|
},
|
|
35
35
|
edgePoint: (r, side, t) => require_ellipse.ellipse.edgePoint(toEllipse(r), side, t),
|
|
@@ -13,5 +13,5 @@ export { rectangle, ellipse, polygon, sector, arc, star, defineShape };
|
|
|
13
13
|
export type { ShapeDefinition, ShapeDefinitionInput, ShapeStyle } from './types';
|
|
14
14
|
export type { Rect } from '../geometry/rect';
|
|
15
15
|
export type { Position } from '../geometry/point';
|
|
16
|
-
export { worldToLocal, localToWorld } from '../geometry/
|
|
16
|
+
export { worldToLocal, localToWorld } from '../geometry/transform';
|
|
17
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shapes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,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;AAC3F,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,EAAE,eAAe,CAO3I,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC;AACvE,YAAY,EAAE,eAAe,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEjF,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC7C,YAAY,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_transform = require("../geometry/transform.cjs");
|
|
2
2
|
const require_rect = require("../geometry/rect.cjs");
|
|
3
3
|
const require_define = require("./define.cjs");
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
4
|
+
const require_anchor = require("../geometry/anchor.cjs");
|
|
5
|
+
const require_contour = require("../geometry/contour.cjs");
|
|
6
|
+
const require_contour$1 = require("./contour.cjs");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
//#region src/shapes/polygon.ts
|
|
9
9
|
var DEG_TO_RAD = Math.PI / 180;
|
|
10
|
+
var MAX_POLYGON_SIDES = 1024;
|
|
10
11
|
/** 顶点角集合(度):第 k 个顶点角 = rotate + k·(360/sides) */
|
|
11
12
|
var vertexAngles = (params) => {
|
|
12
13
|
const startDeg = params.rotate ?? 0;
|
|
@@ -16,7 +17,14 @@ var vertexAngles = (params) => {
|
|
|
16
17
|
return out;
|
|
17
18
|
};
|
|
18
19
|
/** 顶点角的 |cos| 最大值(恒 >0,sides≥3 时至少一个顶点不在 ±y 轴上);用于由 AABB 半宽反推外接半径 */
|
|
19
|
-
var maxAbsCos = (params) =>
|
|
20
|
+
var maxAbsCos = (params) => {
|
|
21
|
+
let max = 0;
|
|
22
|
+
for (const angle of vertexAngles(params)) {
|
|
23
|
+
const value = Math.abs(Math.cos(angle * DEG_TO_RAD));
|
|
24
|
+
if (value > max) max = value;
|
|
25
|
+
}
|
|
26
|
+
return max;
|
|
27
|
+
};
|
|
20
28
|
/**
|
|
21
29
|
* 能容纳内框(半轴 hw/hh)的正 sides 边形外接圆半径
|
|
22
30
|
* @description rectangle / polygon 是文本容器——尺寸由内框(text + padding)驱动,circumscribe 从内框推外接。
|
|
@@ -46,7 +54,7 @@ var circumradiusFromRect = (rect, params) => rect.width / 2 / maxAbsCos(params);
|
|
|
46
54
|
*/
|
|
47
55
|
var polygonVertices = (rect, radius, params) => vertexAngles(params).map((deg) => {
|
|
48
56
|
const a = deg * DEG_TO_RAD;
|
|
49
|
-
return
|
|
57
|
+
return require_transform.localToWorld(rect, [radius * Math.cos(a), radius * Math.sin(a)]);
|
|
50
58
|
});
|
|
51
59
|
/**
|
|
52
60
|
* polygon 注册项:正多边形(sides 顶点均布外接圆,rotate 定起始角,cornerRadius 顶点倒角)
|
|
@@ -57,43 +65,40 @@ var polygonVertices = (rect, radius, params) => vertexAngles(params).map((deg) =
|
|
|
57
65
|
* (多边形关于中心对称,AABB 中心 = 形心 = node position)。命名 anchor 走外接 AABB 的 9 名 rect anchor(不随
|
|
58
66
|
* cornerRadius 移);self-rotate(params.rotate)与 Node.rotate 叠加。scaleParams:cornerRadius 是长度随 scale
|
|
59
67
|
* 缩(几何均值因子),sides 计数 / rotate 角度不缩。
|
|
60
|
-
* diamond ≡ `{ type: 'polygon', params: { sides: 4, rotate:
|
|
68
|
+
* diamond ≡ `{ type: 'polygon', params: { sides: 4, rotate: 0 } }`,由 compile 规范化。
|
|
61
69
|
*/
|
|
62
70
|
var polygon = require_define.defineShape({
|
|
63
71
|
paramsSchema: zod.z.strictObject({
|
|
64
|
-
sides: zod.z.number().int().min(3).describe(
|
|
72
|
+
sides: zod.z.number().int().min(3).max(MAX_POLYGON_SIDES).describe(`Number of sides of the regular polygon (3..${MAX_POLYGON_SIDES}).`),
|
|
65
73
|
rotate: zod.z.number().finite().optional().describe("Shape self-rotation in degrees (vertex start direction); default 0. Composes with Node.rotate."),
|
|
66
74
|
cornerRadius: zod.z.number().finite().nonnegative().optional().describe("Corner radius in user units; 0 / omitted = sharp corners. Clamped per corner to the largest non-self-intersecting fillet.")
|
|
67
75
|
}),
|
|
68
76
|
circumscribe: (hw, hh, params) => {
|
|
69
77
|
const radius = circumradiusFor(hw, hh, params);
|
|
70
78
|
const angles = vertexAngles(params);
|
|
79
|
+
let halfWidth = 0;
|
|
80
|
+
let halfHeight = 0;
|
|
81
|
+
for (const angle of angles) {
|
|
82
|
+
const rad = angle * DEG_TO_RAD;
|
|
83
|
+
halfWidth = Math.max(halfWidth, Math.abs(radius * Math.cos(rad)));
|
|
84
|
+
halfHeight = Math.max(halfHeight, Math.abs(radius * Math.sin(rad)));
|
|
85
|
+
}
|
|
71
86
|
return {
|
|
72
|
-
halfWidth
|
|
73
|
-
halfHeight
|
|
87
|
+
halfWidth,
|
|
88
|
+
halfHeight
|
|
74
89
|
};
|
|
75
90
|
},
|
|
76
91
|
boundaryPoint: (rect, toward, params) => {
|
|
77
|
-
const segments =
|
|
92
|
+
const segments = require_contour$1.verticesToSegments(polygonVertices(rect, circumradiusFromRect(rect, params), params));
|
|
78
93
|
const center = [rect.x, rect.y];
|
|
79
|
-
return
|
|
94
|
+
return require_contour.boundaryFromContour(segments, params.cornerRadius, center, toward) ?? center;
|
|
80
95
|
},
|
|
81
96
|
anchor: (rect$1, name, params) => {
|
|
82
|
-
const a =
|
|
97
|
+
const a = require_anchor.normalizeCompassAnchor(name);
|
|
83
98
|
return a ? require_rect.rect.anchor(rect$1, a) : void 0;
|
|
84
99
|
},
|
|
85
100
|
*emit(rect, style, round, params) {
|
|
86
|
-
yield
|
|
87
|
-
type: "path",
|
|
88
|
-
commands: require__contour.contourToPathCommands(require_roundedContour.contourCommands(require__contour.verticesToSegments(polygonVertices(rect, circumradiusFromRect(rect, params), params)), params.cornerRadius), round),
|
|
89
|
-
fill: style.fill ?? "transparent",
|
|
90
|
-
fillOpacity: style.fillOpacity,
|
|
91
|
-
stroke: style.stroke ?? "currentColor",
|
|
92
|
-
strokeOpacity: style.strokeOpacity,
|
|
93
|
-
strokeWidth: style.strokeWidth ?? 1,
|
|
94
|
-
dashPattern: style.dashPattern,
|
|
95
|
-
opacity: style.opacity
|
|
96
|
-
};
|
|
101
|
+
yield require_contour$1.contourToPathPrimitive(require_contour$1.contourToPathCommands(require_contour.contourCommands(require_contour$1.verticesToSegments(polygonVertices(rect, circumradiusFromRect(rect, params), params)), params.cornerRadius), round), style);
|
|
97
102
|
},
|
|
98
103
|
scaleParams: (params, sx, sy) => params.cornerRadius === void 0 ? params : {
|
|
99
104
|
...params,
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* (多边形关于中心对称,AABB 中心 = 形心 = node position)。命名 anchor 走外接 AABB 的 9 名 rect anchor(不随
|
|
8
8
|
* cornerRadius 移);self-rotate(params.rotate)与 Node.rotate 叠加。scaleParams:cornerRadius 是长度随 scale
|
|
9
9
|
* 缩(几何均值因子),sides 计数 / rotate 角度不缩。
|
|
10
|
-
* diamond ≡ `{ type: 'polygon', params: { sides: 4, rotate:
|
|
10
|
+
* diamond ≡ `{ type: 'polygon', params: { sides: 4, rotate: 0 } }`,由 compile 规范化。
|
|
11
11
|
*/
|
|
12
12
|
export declare const polygon: import('./types').ShapeDefinition;
|
|
13
13
|
//# sourceMappingURL=polygon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../src/shapes/polygon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"polygon.d.ts","sourceRoot":"","sources":["../../../src/shapes/polygon.ts"],"names":[],"mappings":"AAqFA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,mCA6DlB,CAAC"}
|