@retikz/core 0.3.0-alpha.5 → 0.3.0-beta.1
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 +14 -1
- 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 +39 -39
- 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 +32 -0
- package/dist/es/compile/constant.d.ts.map +1 -0
- package/dist/es/compile/constant.js +23 -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 +18 -7
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +39 -63
- 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 +57 -34
- 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 +29 -13
- 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/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 +2 -2
- 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} +4 -5
- package/dist/es/geometry/contour.d.ts.map +1 -0
- package/dist/es/geometry/{roundedContour.js → contour.js} +22 -34
- package/dist/es/geometry/diamond.d.ts +3 -3
- package/dist/es/geometry/diamond.d.ts.map +1 -1
- package/dist/es/geometry/diamond.js +2 -2
- 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 +2 -2
- package/dist/es/geometry/index.d.ts +2 -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.map +1 -1
- package/dist/es/geometry/segment.js +25 -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 +11 -11
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +17 -14
- package/dist/es/ir/animation.d.ts +6 -5
- package/dist/es/ir/animation.d.ts.map +1 -1
- package/dist/es/ir/boundary.d.ts +1 -1
- package/dist/es/ir/boundary.d.ts.map +1 -1
- package/dist/es/ir/coordinate.d.ts +8 -8
- package/dist/es/ir/node.d.ts +73 -72
- 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 +19 -18
- 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 +15 -14
- 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 +893 -152
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +1 -1
- package/dist/es/ir/path/step.d.ts +932 -20
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +73 -22
- package/dist/es/ir/path/target.js +3 -3
- package/dist/es/ir/position/at-position.d.ts +18 -18
- 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/scope.d.ts +2559 -1057
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +5 -5
- package/dist/es/ir/transform.d.ts +44 -17
- package/dist/es/ir/transform.d.ts.map +1 -1
- package/dist/es/ir/transform.js +10 -3
- 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} +1 -1
- package/dist/es/parsers/way.d.ts.map +1 -0
- package/dist/es/parsers/{parseWay.js → way.js} +9 -5
- 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 +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.js +2 -2
- 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 +5 -5
- 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} +4 -8
- package/dist/es/shapes/shared.d.ts.map +1 -0
- package/dist/es/shapes/{_shared.js → shared.js} +8 -12
- package/dist/es/shapes/star.d.ts.map +1 -1
- package/dist/es/shapes/star.js +4 -14
- 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 +14 -1
- 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 +37 -37
- 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 +24 -0
- package/dist/lib/compile/constant.d.ts +32 -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 +39 -62
- package/dist/lib/compile/node.d.ts +18 -7
- 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 +56 -33
- 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/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 +29 -13
- 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/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 +2 -2
- 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} +21 -32
- package/dist/lib/geometry/{roundedContour.d.ts → contour.d.ts} +4 -5
- package/dist/lib/geometry/contour.d.ts.map +1 -0
- package/dist/lib/geometry/diamond.cjs +7 -7
- package/dist/lib/geometry/diamond.d.ts +3 -3
- 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 +8 -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 +2 -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 +25 -47
- 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 +29 -22
- package/dist/lib/index.d.ts +11 -11
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/animation.d.ts +6 -5
- package/dist/lib/ir/animation.d.ts.map +1 -1
- package/dist/lib/ir/boundary.d.ts +1 -1
- package/dist/lib/ir/boundary.d.ts.map +1 -1
- package/dist/lib/ir/coordinate.d.ts +8 -8
- package/dist/lib/ir/node.cjs +23 -23
- package/dist/lib/ir/node.d.ts +73 -72
- 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 +19 -18
- 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 +15 -14
- package/dist/lib/ir/path/arrow.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +1 -1
- package/dist/lib/ir/path/path.d.ts +893 -152
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +73 -21
- package/dist/lib/ir/path/step.d.ts +932 -20
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +3 -3
- package/dist/lib/ir/position/at-position.cjs +11 -11
- package/dist/lib/ir/position/at-position.d.ts +18 -18
- package/dist/lib/ir/position/at-position.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +5 -5
- package/dist/lib/ir/scope.d.ts +2559 -1057
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/dist/lib/ir/transform.cjs +9 -2
- package/dist/lib/ir/transform.d.ts +44 -17
- 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} +12 -8
- package/dist/{es/parsers/parseWay.d.ts → lib/parsers/way.d.ts} +1 -1
- 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 +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 +4 -4
- 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 +11 -11
- 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} +7 -12
- package/dist/lib/shapes/{_shared.d.ts → shared.d.ts} +4 -8
- package/dist/lib/shapes/shared.d.ts.map +1 -0
- package/dist/lib/shapes/star.cjs +7 -17
- package/dist/lib/shapes/star.d.ts.map +1 -1
- package/package.json +2 -3
- 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
package/dist/es/shapes/arc.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { localToWorld } from "../geometry/
|
|
1
|
+
import { localToWorld } from "../geometry/transform.js";
|
|
2
2
|
import { arcBoundingPoints, arcEndPoint } from "../geometry/arc.js";
|
|
3
3
|
import { defineShape } from "./define.js";
|
|
4
|
-
import { normalizeAngularRange } from "./
|
|
4
|
+
import { normalizeAngularRange } from "./shared.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/shapes/arc.ts
|
|
7
7
|
/** arc 的派生几何:圆心局部系 AABB + 圆心相对 AABB 中心偏移 */
|
|
@@ -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,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,5 +56,17 @@ 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
|
-
export { contourToPathCommands, verticesToSegments };
|
|
72
|
+
export { contourToPathCommands, contourToPathPrimitive, verticesToSegments };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineShape } from "./define.js";
|
|
2
|
-
import { asRectAnchor } from "./_shared.js";
|
|
3
2
|
import { ellipse as ellipse$1 } from "../geometry/ellipse.js";
|
|
3
|
+
import { normalizeCompassAnchor } from "../geometry/anchor.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
//#region src/shapes/ellipse.ts
|
|
6
6
|
/** 外接框 Rect → Ellipse(rx/ry = 半宽/半高) */
|
|
@@ -29,7 +29,7 @@ var ellipse = defineShape({
|
|
|
29
29
|
},
|
|
30
30
|
boundaryPoint: (r, toward) => ellipse$1.boundaryPoint(toEllipse(r), toward),
|
|
31
31
|
anchor: (r, name) => {
|
|
32
|
-
const a =
|
|
32
|
+
const a = normalizeCompassAnchor(name);
|
|
33
33
|
return a ? ellipse$1.anchor(toEllipse(r), a) : void 0;
|
|
34
34
|
},
|
|
35
35
|
edgePoint: (r, side, t) => ellipse$1.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,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,2FAA2F;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,
|
|
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,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,2FAA2F;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"}
|
package/dist/es/shapes/index.js
CHANGED
|
@@ -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"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { localToWorld } from "../geometry/
|
|
1
|
+
import { localToWorld } from "../geometry/transform.js";
|
|
2
2
|
import { rect } from "../geometry/rect.js";
|
|
3
3
|
import { defineShape } from "./define.js";
|
|
4
|
-
import {
|
|
5
|
-
import { boundaryFromContour, contourCommands } from "../geometry/
|
|
6
|
-
import { contourToPathCommands, verticesToSegments } from "./
|
|
4
|
+
import { normalizeCompassAnchor } from "../geometry/anchor.js";
|
|
5
|
+
import { boundaryFromContour, contourCommands } from "../geometry/contour.js";
|
|
6
|
+
import { contourToPathCommands, contourToPathPrimitive, verticesToSegments } from "./contour.js";
|
|
7
7
|
import { z } from "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 从内框推外接。
|
|
@@ -57,20 +65,27 @@ 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 = defineShape({
|
|
63
71
|
paramsSchema: z.strictObject({
|
|
64
|
-
sides: z.number().int().min(3).describe(
|
|
72
|
+
sides: z.number().int().min(3).max(MAX_POLYGON_SIDES).describe(`Number of sides of the regular polygon (3..${MAX_POLYGON_SIDES}).`),
|
|
65
73
|
rotate: z.number().finite().optional().describe("Shape self-rotation in degrees (vertex start direction); default 0. Composes with Node.rotate."),
|
|
66
74
|
cornerRadius: 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) => {
|
|
@@ -79,21 +94,11 @@ var polygon = defineShape({
|
|
|
79
94
|
return boundaryFromContour(segments, params.cornerRadius, center, toward) ?? center;
|
|
80
95
|
},
|
|
81
96
|
anchor: (rect$1, name, params) => {
|
|
82
|
-
const a =
|
|
97
|
+
const a = normalizeCompassAnchor(name);
|
|
83
98
|
return a ? rect.anchor(rect$1, a) : void 0;
|
|
84
99
|
},
|
|
85
100
|
*emit(rect, style, round, params) {
|
|
86
|
-
yield
|
|
87
|
-
type: "path",
|
|
88
|
-
commands: contourToPathCommands(contourCommands(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 contourToPathPrimitive(contourToPathCommands(contourCommands(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,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { localToWorld } from "../geometry/
|
|
1
|
+
import { localToWorld } from "../geometry/transform.js";
|
|
2
2
|
import { rect } from "../geometry/rect.js";
|
|
3
3
|
import { defineShape } from "./define.js";
|
|
4
|
-
import {
|
|
5
|
-
import { boundaryFromContour } from "../geometry/
|
|
6
|
-
import { verticesToSegments } from "./
|
|
4
|
+
import { normalizeCompassAnchor } from "../geometry/anchor.js";
|
|
5
|
+
import { boundaryFromContour } from "../geometry/contour.js";
|
|
6
|
+
import { verticesToSegments } from "./contour.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
//#region src/shapes/rectangle.ts
|
|
9
9
|
/** 轴对齐 / 旋转矩形的 4 个角(CW 绕向:左上 → 右上 → 右下 → 左下),局部系经 localToWorld 投世界 */
|
|
@@ -37,7 +37,7 @@ var rectangle = defineShape({
|
|
|
37
37
|
return boundaryFromContour(segments, params.cornerRadius, center, toward) ?? center;
|
|
38
38
|
},
|
|
39
39
|
anchor: (r, name) => {
|
|
40
|
-
const a =
|
|
40
|
+
const a = normalizeCompassAnchor(name);
|
|
41
41
|
return a ? rect.anchor(r, a) : void 0;
|
|
42
42
|
},
|
|
43
43
|
edgePoint: (r, side, t) => rect.edgePoint(r, side, t),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sector.d.ts","sourceRoot":"","sources":["../../../src/shapes/sector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sector.d.ts","sourceRoot":"","sources":["../../../src/shapes/sector.ts"],"names":[],"mappings":"AAoGA;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,mCAmFjB,CAAC"}
|
package/dist/es/shapes/sector.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { localToWorld } from "../geometry/
|
|
1
|
+
import { localToWorld } from "../geometry/transform.js";
|
|
2
2
|
import { defineShape } from "./define.js";
|
|
3
|
-
import { sectorGeometry, sectorPolarPoint } from "./
|
|
4
|
-
import { boundaryFromContour, contourCommands } from "../geometry/
|
|
5
|
-
import { contourToPathCommands } from "./
|
|
3
|
+
import { sectorGeometry, sectorPolarPoint } from "./shared.js";
|
|
4
|
+
import { boundaryFromContour, contourCommands, filletContour } from "../geometry/contour.js";
|
|
5
|
+
import { contourToPathCommands, contourToPathPrimitive } from "./contour.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/shapes/sector.ts
|
|
8
8
|
/** sector 局部 AABB 系点(圆心为原点偏移后)→ 世界系(含 rect 旋转 / 平移) */
|
|
@@ -76,6 +76,23 @@ var sectorSegments = (rect, geo, params) => {
|
|
|
76
76
|
}
|
|
77
77
|
];
|
|
78
78
|
};
|
|
79
|
+
var sectorGeometryCache = /* @__PURE__ */ new WeakMap();
|
|
80
|
+
var getSectorGeometry = (params) => {
|
|
81
|
+
const cached = sectorGeometryCache.get(params);
|
|
82
|
+
if (cached !== void 0) return cached;
|
|
83
|
+
const geo = sectorGeometry(params);
|
|
84
|
+
sectorGeometryCache.set(params, geo);
|
|
85
|
+
return geo;
|
|
86
|
+
};
|
|
87
|
+
var createSectorContour = (rect, params) => {
|
|
88
|
+
const geo = getSectorGeometry(params);
|
|
89
|
+
const segments = sectorSegments(rect, geo, params);
|
|
90
|
+
return {
|
|
91
|
+
geo,
|
|
92
|
+
segments,
|
|
93
|
+
fillets: filletContour(segments, params.cornerRadius)
|
|
94
|
+
};
|
|
95
|
+
};
|
|
79
96
|
/**
|
|
80
97
|
* sector 注册项:环楔(内外半径 + 起止角围成的可填充 2D 区域)
|
|
81
98
|
* @description 四何函数共用 `sectorGeometry`(单一真源):circumscribe 返回含圆心 + 内外弧的精确 AABB 半轴
|
|
@@ -88,21 +105,21 @@ var sector = defineShape({
|
|
|
88
105
|
innerRadius: z.number().finite().nonnegative().describe("Inner radius (user units); 0 = solid pie slice."),
|
|
89
106
|
outerRadius: z.number().finite().positive().describe("Outer radius (user units); must be > innerRadius."),
|
|
90
107
|
startAngle: z.number().finite().describe("Start angle in degrees; polar convention 0°=+x, 90°=+y (screen y-down), matching core polar."),
|
|
91
|
-
endAngle: z.number().finite().describe("End angle in degrees; swept
|
|
108
|
+
endAngle: z.number().finite().describe("End angle in degrees; swept clockwise in screen space from startAngle."),
|
|
92
109
|
cornerRadius: 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.")
|
|
93
110
|
}).refine((p) => p.outerRadius > p.innerRadius, { message: "outerRadius must be greater than innerRadius" }),
|
|
94
|
-
circumscribe: (_hw, _hh, params) =>
|
|
111
|
+
circumscribe: (_hw, _hh, params) => getSectorGeometry(params).aabbHalfAxes,
|
|
95
112
|
circumscribeOffset: (params) => {
|
|
96
|
-
const { apexOffset } =
|
|
113
|
+
const { apexOffset } = getSectorGeometry(params);
|
|
97
114
|
return [-apexOffset[0], -apexOffset[1]];
|
|
98
115
|
},
|
|
99
116
|
boundaryPoint: (rect, toward, params) => {
|
|
100
|
-
const geo =
|
|
101
|
-
const
|
|
102
|
-
return boundaryFromContour(
|
|
117
|
+
const { geo, segments, fillets } = createSectorContour(rect, params);
|
|
118
|
+
const originWorld = localToWorld(rect, geo.boundaryOriginOffset);
|
|
119
|
+
return boundaryFromContour(segments, params.cornerRadius, originWorld, toward, fillets) ?? originWorld;
|
|
103
120
|
},
|
|
104
121
|
anchor: (rect, name, params) => {
|
|
105
|
-
const geo =
|
|
122
|
+
const geo = getSectorGeometry(params);
|
|
106
123
|
const { innerRadius, outerRadius } = params;
|
|
107
124
|
const { start, end, mid } = geo.range;
|
|
108
125
|
switch (name) {
|
|
@@ -117,17 +134,8 @@ var sector = defineShape({
|
|
|
117
134
|
}
|
|
118
135
|
},
|
|
119
136
|
*emit(rect, style, round, params) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
commands: contourToPathCommands(contourCommands(sectorSegments(rect, sectorGeometry(params), params), params.cornerRadius), round),
|
|
123
|
-
fill: style.fill ?? "transparent",
|
|
124
|
-
fillOpacity: style.fillOpacity,
|
|
125
|
-
stroke: style.stroke ?? "currentColor",
|
|
126
|
-
strokeOpacity: style.strokeOpacity,
|
|
127
|
-
strokeWidth: style.strokeWidth ?? 1,
|
|
128
|
-
dashPattern: style.dashPattern,
|
|
129
|
-
opacity: style.opacity
|
|
130
|
-
};
|
|
137
|
+
const { segments, fillets } = createSectorContour(rect, params);
|
|
138
|
+
yield contourToPathPrimitive(contourToPathCommands(contourCommands(segments, params.cornerRadius, fillets), round), style);
|
|
131
139
|
},
|
|
132
140
|
scaleParams: (params, sx, sy) => {
|
|
133
141
|
const factor = Math.sqrt(sx * sy);
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import { Position } from '../geometry/point';
|
|
2
|
-
import { RectAnchor } from '../geometry/rect';
|
|
3
|
-
/**
|
|
4
|
-
* 把任意字符串收窄为合法 RectAnchor,否则 undefined
|
|
5
|
-
* @description 内置 4 shape 的 anchor 只认这 9 名;不在集合内返回 undefined,由 `anchorOf` 抛 Unknown anchor
|
|
6
|
-
*/
|
|
7
|
-
export declare const asRectAnchor: (name: string) => RectAnchor | undefined;
|
|
8
2
|
/** sector / arc 共用的角度约定起止角 */
|
|
9
3
|
type AngularRange = {
|
|
10
4
|
/** 规范化后的起始角(度)= 原 startAngle */
|
|
@@ -38,8 +32,10 @@ export type SectorGeometry = {
|
|
|
38
32
|
};
|
|
39
33
|
/** 圆心(apex)相对 AABB 中心的偏移(apex 常在 AABB 内角,非 AABB 中心) */
|
|
40
34
|
apexOffset: Position;
|
|
41
|
-
/** 质心(centroid)相对 AABB
|
|
35
|
+
/** 质心(centroid)相对 AABB 中心的偏移;大角度环形扇区的质心可能落入内孔。 */
|
|
42
36
|
centroidOffset: Position;
|
|
37
|
+
/** boundaryPoint 射线起点偏移;环形扇区使用填充环楔内的点,而不是质心。 */
|
|
38
|
+
boundaryOriginOffset: Position;
|
|
43
39
|
};
|
|
44
40
|
/** sector params 的最小结构(与 sector.ts 的 SectorParams 同形,避免循环 import 类型) */
|
|
45
41
|
type SectorGeometryInput = {
|
|
@@ -58,4 +54,4 @@ export declare const sectorGeometry: (params: SectorGeometryInput) => SectorGeom
|
|
|
58
54
|
/** sector 局部系点(圆心为原点):极角(度) + 半径 → 直角坐标 */
|
|
59
55
|
export declare const sectorPolarPoint: (radius: number, angleDeg: number) => Position;
|
|
60
56
|
export {};
|
|
61
|
-
//# sourceMappingURL=
|
|
57
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/shapes/shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAIlD,8BAA8B;AAC9B,KAAK,YAAY,GAAG;IAClB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB,GAAI,YAAY,MAAM,EAAE,UAAU,MAAM,KAAG,YAI5E,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iBAAiB;IACjB,KAAK,EAAE,YAAY,CAAC;IACpB,4CAA4C;IAC5C,YAAY,EAAE;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,uDAAuD;IACvD,UAAU,EAAE,QAAQ,CAAC;IACrB,kDAAkD;IAClD,cAAc,EAAE,QAAQ,CAAC;IACzB,gDAAgD;IAChD,oBAAoB,EAAE,QAAQ,CAAC;CAChC,CAAC;AAEF,wEAAwE;AACxE,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,mBAAmB,KAAG,cAoE5D,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,EAAE,UAAU,MAAM,KAAG,QAC7B,CAAC"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import { RECT_ANCHORS } from "../geometry/rect.js";
|
|
2
1
|
import { arcBoundingPoints, arcEndPoint } from "../geometry/arc.js";
|
|
3
|
-
//#region src/shapes/
|
|
4
|
-
/** RECT_ANCHORS 的 9 个合法 anchor 名集合(成员校验用) */
|
|
5
|
-
var RECT_ANCHOR_SET = new Set(Object.values(RECT_ANCHORS));
|
|
6
|
-
/**
|
|
7
|
-
* 把任意字符串收窄为合法 RectAnchor,否则 undefined
|
|
8
|
-
* @description 内置 4 shape 的 anchor 只认这 9 名;不在集合内返回 undefined,由 `anchorOf` 抛 Unknown anchor
|
|
9
|
-
*/
|
|
10
|
-
var asRectAnchor = (name) => RECT_ANCHOR_SET.has(name) ? name : void 0;
|
|
2
|
+
//#region src/shapes/shared.ts
|
|
11
3
|
var DEG_TO_RAD = Math.PI / 180;
|
|
12
4
|
/**
|
|
13
5
|
* 规范化起止角:保证 end ≥ start(end<start 时加 360° 直至 ≥ start),并给出中分角
|
|
@@ -34,7 +26,7 @@ var sectorGeometry = (params) => {
|
|
|
34
26
|
const { innerRadius, outerRadius } = params;
|
|
35
27
|
const range = normalizeAngularRange(params.startAngle, params.endAngle);
|
|
36
28
|
const apex = [0, 0];
|
|
37
|
-
const candidates = [apex];
|
|
29
|
+
const candidates = innerRadius === 0 ? [apex] : [];
|
|
38
30
|
candidates.push(...arcBoundingPoints(apex, outerRadius, range.start, range.end));
|
|
39
31
|
if (innerRadius > 0) candidates.push(...arcBoundingPoints(apex, innerRadius, range.start, range.end));
|
|
40
32
|
let minX = Infinity;
|
|
@@ -62,6 +54,9 @@ var sectorGeometry = (params) => {
|
|
|
62
54
|
else centroidRadius = 2 / 3 * (Math.sin(half) / half) * ((R * R * R - r * r * r) / areaDenom);
|
|
63
55
|
const centroidLocal = [Math.cos(midRad) * centroidRadius, Math.sin(midRad) * centroidRadius];
|
|
64
56
|
const centroidOffset = [centroidLocal[0] - aabbCenter[0], centroidLocal[1] - aabbCenter[1]];
|
|
57
|
+
const boundaryOriginRadius = innerRadius > 0 ? (innerRadius + outerRadius) / 2 : centroidRadius;
|
|
58
|
+
const boundaryOriginLocal = [Math.cos(midRad) * boundaryOriginRadius, Math.sin(midRad) * boundaryOriginRadius];
|
|
59
|
+
const boundaryOriginOffset = [boundaryOriginLocal[0] - aabbCenter[0], boundaryOriginLocal[1] - aabbCenter[1]];
|
|
65
60
|
return {
|
|
66
61
|
range,
|
|
67
62
|
aabbHalfAxes: {
|
|
@@ -69,10 +64,11 @@ var sectorGeometry = (params) => {
|
|
|
69
64
|
halfHeight
|
|
70
65
|
},
|
|
71
66
|
apexOffset,
|
|
72
|
-
centroidOffset
|
|
67
|
+
centroidOffset,
|
|
68
|
+
boundaryOriginOffset
|
|
73
69
|
};
|
|
74
70
|
};
|
|
75
71
|
/** sector 局部系点(圆心为原点):极角(度) + 半径 → 直角坐标 */
|
|
76
72
|
var sectorPolarPoint = (radius, angleDeg) => arcEndPoint([0, 0], radius, angleDeg);
|
|
77
73
|
//#endregion
|
|
78
|
-
export {
|
|
74
|
+
export { normalizeAngularRange, sectorGeometry, sectorPolarPoint };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"star.d.ts","sourceRoot":"","sources":["../../../src/shapes/star.ts"],"names":[],"mappings":"AAsFA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"star.d.ts","sourceRoot":"","sources":["../../../src/shapes/star.ts"],"names":[],"mappings":"AAsFA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,IAAI,mCAiFf,CAAC"}
|
package/dist/es/shapes/star.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { localToWorld } from "../geometry/
|
|
1
|
+
import { localToWorld } from "../geometry/transform.js";
|
|
2
2
|
import { defineShape } from "./define.js";
|
|
3
|
-
import { boundaryFromContour, contourCommands } from "../geometry/
|
|
4
|
-
import { contourToPathCommands, verticesToSegments } from "./
|
|
3
|
+
import { boundaryFromContour, contourCommands } from "../geometry/contour.js";
|
|
4
|
+
import { contourToPathCommands, contourToPathPrimitive, verticesToSegments } from "./contour.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/shapes/star.ts
|
|
7
7
|
var DEG_TO_RAD = Math.PI / 180;
|
|
@@ -87,17 +87,7 @@ var star = defineShape({
|
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
*emit(rect, style, round, params) {
|
|
90
|
-
yield
|
|
91
|
-
type: "path",
|
|
92
|
-
commands: contourToPathCommands(contourCommands(verticesToSegments(worldVertices(rect, starGeometry(params))), params.cornerRadius), round),
|
|
93
|
-
fill: style.fill ?? "transparent",
|
|
94
|
-
fillOpacity: style.fillOpacity,
|
|
95
|
-
stroke: style.stroke ?? "currentColor",
|
|
96
|
-
strokeOpacity: style.strokeOpacity,
|
|
97
|
-
strokeWidth: style.strokeWidth ?? 1,
|
|
98
|
-
dashPattern: style.dashPattern,
|
|
99
|
-
opacity: style.opacity
|
|
100
|
-
};
|
|
90
|
+
yield contourToPathPrimitive(contourToPathCommands(contourCommands(verticesToSegments(worldVertices(rect, starGeometry(params))), params.cornerRadius), round), style);
|
|
101
91
|
},
|
|
102
92
|
scaleParams: (params, sx, sy) => {
|
|
103
93
|
const factor = Math.sqrt(sx * sy);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/arrows/define.ts
|
|
2
|
+
/**
|
|
3
|
+
* 定义一个 arrow 注册项
|
|
4
|
+
* @description 与 `defineShape` / `definePathGenerator` 对齐的定义点 helper;当前不做额外运行时校验,
|
|
5
|
+
* 只保留 `ArrowDefinition` 形态并让第三方扩展面写法一致。
|
|
6
|
+
* @returns 原样返回的 def(便于 `export const bracket = defineArrow({ ... })`)
|
|
7
|
+
*/
|
|
8
|
+
var defineArrow = (def) => def;
|
|
9
|
+
//#endregion
|
|
10
|
+
exports.defineArrow = defineArrow;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ArrowDefinition } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* 定义一个 arrow 注册项
|
|
4
|
+
* @description 与 `defineShape` / `definePathGenerator` 对齐的定义点 helper;当前不做额外运行时校验,
|
|
5
|
+
* 只保留 `ArrowDefinition` 形态并让第三方扩展面写法一致。
|
|
6
|
+
* @returns 原样返回的 def(便于 `export const bracket = defineArrow({ ... })`)
|
|
7
|
+
*/
|
|
8
|
+
export declare const defineArrow: (def: ArrowDefinition) => ArrowDefinition;
|
|
9
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../../src/arrows/define.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,eAAe,KAAG,eAAsB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
require("./define.cjs");
|
|
1
2
|
//#region src/arrows/index.ts
|
|
2
3
|
/** 实心闭合三角 / 菱形 / V 形的 path 工厂:填充走 ctx.fill(无 override = contextStroke) */
|
|
3
4
|
var filledPath = (ctx, points) => ({
|
|
@@ -34,9 +35,10 @@ var hollowPath = (ctx, points, strokeLinejoin) => ({
|
|
|
34
35
|
...strokeLinejoin ? { strokeLinejoin } : {}
|
|
35
36
|
});
|
|
36
37
|
/**
|
|
37
|
-
* 内置
|
|
38
|
+
* 内置 8 arrow 注册项;与 `CompileOptions.arrows` 合并时被同名注入覆盖
|
|
38
39
|
* @description 几何字段(lineContactX 静态 base / tipX / hollow):
|
|
39
40
|
* 实心 normal/diamond/circle lineContactX=0;stealth=3;open/openDiamond base=1 + tipX=9 + hollow;
|
|
41
|
+
* openStealth base=3 + tipX=9 + hollow;
|
|
40
42
|
* openCircle base=0.75 + hollow。baseSize / defaultLength / defaultWidth 走类型缺省(10 / 6 / 6)。
|
|
41
43
|
* framework 对 hollow def 统一把 lineContactX 减 lineWidth/2 得实际 refX / shrink 接触点。
|
|
42
44
|
* emit 几何在局部 baseSize=10 坐标系(renderer-agnostic)。
|
|
@@ -69,6 +71,17 @@ var BUILTIN_ARROWS = {
|
|
|
69
71
|
[3, 5]
|
|
70
72
|
])]
|
|
71
73
|
},
|
|
74
|
+
openStealth: {
|
|
75
|
+
hollow: true,
|
|
76
|
+
lineContactX: 3,
|
|
77
|
+
tipX: 9,
|
|
78
|
+
emit: (ctx) => [hollowPath(ctx, [
|
|
79
|
+
[1, 1],
|
|
80
|
+
[9, 5],
|
|
81
|
+
[1, 9],
|
|
82
|
+
[3, 5]
|
|
83
|
+
], "miter")]
|
|
84
|
+
},
|
|
72
85
|
diamond: {
|
|
73
86
|
lineContactX: 0,
|
|
74
87
|
emit: (ctx) => [filledPath(ctx, [
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { BuiltinArrowName } from '../ir/path/arrow';
|
|
2
2
|
import { ArrowDefinition } from './types';
|
|
3
3
|
/**
|
|
4
|
-
* 内置
|
|
4
|
+
* 内置 8 arrow 注册项;与 `CompileOptions.arrows` 合并时被同名注入覆盖
|
|
5
5
|
* @description 几何字段(lineContactX 静态 base / tipX / hollow):
|
|
6
6
|
* 实心 normal/diamond/circle lineContactX=0;stealth=3;open/openDiamond base=1 + tipX=9 + hollow;
|
|
7
|
+
* openStealth base=3 + tipX=9 + hollow;
|
|
7
8
|
* openCircle base=0.75 + hollow。baseSize / defaultLength / defaultWidth 走类型缺省(10 / 6 / 6)。
|
|
8
9
|
* framework 对 hollow def 统一把 lineContactX 减 lineWidth/2 得实际 refX / shrink 接触点。
|
|
9
10
|
* emit 几何在局部 baseSize=10 坐标系(renderer-agnostic)。
|
|
10
11
|
*/
|
|
11
12
|
export declare const BUILTIN_ARROWS: Record<BuiltinArrowName, ArrowDefinition>;
|
|
12
13
|
export type { ArrowDefinition, ArrowEmitContext } from './types';
|
|
14
|
+
export { defineArrow } from './define';
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/arrows/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,SAAS,CAAC;AAiCjE
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/arrows/index.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,SAAS,CAAC;AAiCjE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,gBAAgB,EAAE,eAAe,CA2DpE,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -18,10 +18,10 @@ export type ArrowEmitContext = {
|
|
|
18
18
|
/**
|
|
19
19
|
* 一个 arrow 的可注册定义:几何尺寸 + emit
|
|
20
20
|
* @description plain object(factory 友好),含函数、**不进 IR**,走 `CompileOptions.arrows` 运行时注入。
|
|
21
|
-
* 内置
|
|
21
|
+
* 内置 8 箭头也是注册项(无内置特权,对齐 `ShapeDefinition` / `BUILTIN_SHAPES`)。
|
|
22
22
|
*
|
|
23
23
|
* `lineContactX` 存**静态 base**(不含 lineWidth 调整):实心 normal/diamond/circle = 0、stealth = 3、
|
|
24
|
-
* open/openDiamond base = 1、openCircle base = 0.75。framework 对 `hollow: true` 的 def 统一减
|
|
24
|
+
* open/openDiamond base = 1、openStealth base = 3、openCircle base = 0.75。framework 对 `hollow: true` 的 def 统一减
|
|
25
25
|
* `lineWidth/2` 得到实际 refX / shrink 接触点(这条调整由编译器 / adapter 落,def 只声明静态 base)。
|
|
26
26
|
*/
|
|
27
27
|
export type ArrowDefinition = {
|
|
@@ -31,6 +31,8 @@ export type ArrowDefinition = {
|
|
|
31
31
|
hollow?: boolean;
|
|
32
32
|
/** 线接触点静态 base(决定 path shrink + marker refX);空心 def 由 framework 再减 lineWidth/2 */
|
|
33
33
|
lineContactX: number;
|
|
34
|
+
/** 外轮廓补偿量(marker 局部坐标);缺省时空心箭头用 lineWidth/2,实心箭头用 0 */
|
|
35
|
+
outerInset?: number;
|
|
34
36
|
/** 尖端 x(shrink 用);缺省 = baseSize */
|
|
35
37
|
tipX?: number;
|
|
36
38
|
/** 默认箭头长度(length fallback);缺省 6 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/arrows/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sEAAsE;IACtE,MAAM,EAAE,UAAU,CAAC;IACnB,qDAAqD;IACrD,IAAI,EAAE,UAAU,CAAC;IACjB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,IAAI,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;CAC5D,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/arrows/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,sEAAsE;IACtE,MAAM,EAAE,UAAU,CAAC;IACnB,qDAAqD;IACrD,IAAI,EAAE,UAAU,CAAC;IACjB,8CAA8C;IAC9C,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kFAAkF;IAClF,YAAY,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iEAAiE;IACjE,IAAI,EAAE,CAAC,GAAG,EAAE,gBAAgB,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC;CAC5D,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_anchor = require("../geometry/anchor.cjs");
|
|
1
2
|
const require_boundary = require("./boundary.cjs");
|
|
2
3
|
const require_node = require("./node.cjs");
|
|
3
4
|
//#region src/compile/anchor-cache.ts
|
|
@@ -8,19 +9,31 @@ const require_node = require("./node.cjs");
|
|
|
8
9
|
var cache = /* @__PURE__ */ new WeakMap();
|
|
9
10
|
/** 角度字符串识别:可选负号 + 数字 + 可选小数;与 parseTarget.ts 的 ANGLE_RE 同语义 */
|
|
10
11
|
var ANGLE_RE = /^-?\d+(\.\d+)?$/;
|
|
12
|
+
/** 把 layout 的 rect 换成外边界 AABB(外扩 outerSep)——border 类 anchor 在其上解析(ADR-07 §1) */
|
|
13
|
+
var withOuterRect = (layout) => ({
|
|
14
|
+
...layout,
|
|
15
|
+
rect: require_node.outerRectOf(layout)
|
|
16
|
+
});
|
|
11
17
|
/**
|
|
12
18
|
* 把 anchorName 解析到对应 shape 的 anchor / boundaryPoint 上
|
|
13
|
-
* @description 数字字符串走 angleBoundaryOf
|
|
19
|
+
* @description 数字字符串走 angleBoundaryOf;其余按标准方位 / shape-specific anchor 走 anchorOf;boundary 透传给两者。
|
|
20
|
+
* border 类 anchor(数字角度 + compass 方位名)按 outerSep 外推:在外扩 margin 的 rect(`outerRectOf`)上解析
|
|
21
|
+
* (ADR-07 §1)。形状专属命名 anchor(tip-N / apex 等)恒走视觉 rect、不外扩(§3)。`center` 在 inflate 下
|
|
22
|
+
* 中心不变,走哪条路结果一致。
|
|
14
23
|
*/
|
|
15
24
|
var computeAnchor = (layout, anchorName, boundary) => {
|
|
16
|
-
if (ANGLE_RE.test(anchorName))
|
|
25
|
+
if (ANGLE_RE.test(anchorName)) {
|
|
26
|
+
const angle = Number(anchorName);
|
|
27
|
+
return positionToIR(require_node.angleBoundaryOf(withOuterRect(layout), angle, boundary));
|
|
28
|
+
}
|
|
29
|
+
if (require_anchor.normalizeCompassAnchor(anchorName) !== void 0) return positionToIR(require_node.anchorOf(withOuterRect(layout), anchorName, boundary));
|
|
17
30
|
return positionToIR(require_node.anchorOf(layout, anchorName, boundary));
|
|
18
31
|
};
|
|
19
32
|
/** geometry Position(含 readonly 形态)转 IRPosition 元组(IRPosition === [number, number]) */
|
|
20
33
|
var positionToIR = (p) => [p[0], p[1]];
|
|
21
34
|
/**
|
|
22
35
|
* 取节点 anchor 的全局坐标,带 per-layout 缓存
|
|
23
|
-
* @description name
|
|
36
|
+
* @description name 接受方位 anchor 关键字(如 `'north'` / `'south-west'` / `'top-left'`)或数字角度字符串(如 `'30'` / `'-45'`);
|
|
24
37
|
* boundary 指定连接面(默认 `'shape'`,即节点自身视觉轮廓);不同 boundary 产生独立缓存条目,互不串扰;
|
|
25
38
|
* 同一 (layout, name, boundary) 组合第二次起返回首调用结果的**同一引用**——上游可用 `===` 判定 cache 命中
|
|
26
39
|
* @param layout 已 Pass 1 完成的 NodeLayout(rect 已是全局坐标)
|
|
@@ -44,7 +57,7 @@ var resolveAnchor = (layout, anchorName, boundary = "shape") => {
|
|
|
44
57
|
/**
|
|
45
58
|
* 取节点边上比例点 `{ side, t }` 的全局坐标,带 per-layout 缓存
|
|
46
59
|
* @description 走 `layout.shapeDef.edgePoint`——shape 未实现(如自定义 shape)抛"does not support side anchors";
|
|
47
|
-
* 零尺寸 layout(Coordinate
|
|
60
|
+
* 零尺寸 layout(Coordinate)抛错(边上比例点对一个点无意义,报错比退化中心更可诊断)。
|
|
48
61
|
* 缓存 key = `${side}:${t}`,与命名 anchor(`'north'` / `'30'`)共用 layout 的 Map——key 含 `:` 故命名空间不冲突。
|
|
49
62
|
* @param layout 已 Pass 1 完成的 NodeLayout(rect 已是全局坐标)
|
|
50
63
|
* @returns 全局坐标系下的 IRPosition `[x, y]`
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Side } from '../geometry/
|
|
1
|
+
import { Side } from '../geometry/edge';
|
|
2
2
|
import { IRBoundary, IRPosition } from '../ir';
|
|
3
3
|
import { NodeLayout } from './node';
|
|
4
4
|
/**
|
|
5
5
|
* 取节点 anchor 的全局坐标,带 per-layout 缓存
|
|
6
|
-
* @description name
|
|
6
|
+
* @description name 接受方位 anchor 关键字(如 `'north'` / `'south-west'` / `'top-left'`)或数字角度字符串(如 `'30'` / `'-45'`);
|
|
7
7
|
* boundary 指定连接面(默认 `'shape'`,即节点自身视觉轮廓);不同 boundary 产生独立缓存条目,互不串扰;
|
|
8
8
|
* 同一 (layout, name, boundary) 组合第二次起返回首调用结果的**同一引用**——上游可用 `===` 判定 cache 命中
|
|
9
9
|
* @param layout 已 Pass 1 完成的 NodeLayout(rect 已是全局坐标)
|
|
@@ -15,7 +15,7 @@ export declare const resolveAnchor: (layout: NodeLayout, anchorName: string, bou
|
|
|
15
15
|
/**
|
|
16
16
|
* 取节点边上比例点 `{ side, t }` 的全局坐标,带 per-layout 缓存
|
|
17
17
|
* @description 走 `layout.shapeDef.edgePoint`——shape 未实现(如自定义 shape)抛"does not support side anchors";
|
|
18
|
-
* 零尺寸 layout(Coordinate
|
|
18
|
+
* 零尺寸 layout(Coordinate)抛错(边上比例点对一个点无意义,报错比退化中心更可诊断)。
|
|
19
19
|
* 缓存 key = `${side}:${t}`,与命名 anchor(`'north'` / `'30'`)共用 layout 的 Map——key 含 `:` 故命名空间不冲突。
|
|
20
20
|
* @param layout 已 Pass 1 完成的 NodeLayout(rect 已是全局坐标)
|
|
21
21
|
* @returns 全局坐标系下的 IRPosition `[x, y]`
|