@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
|
@@ -2,25 +2,35 @@ import { JsonObjectSchema } from "../../ir/json.js";
|
|
|
2
2
|
import { rectOutline } from "../../geometry/rect.js";
|
|
3
3
|
import { arcBoundingPoints, arcEndPoint, ellipseArcBoundingPoints, ellipseArcPoint } from "../../geometry/arc.js";
|
|
4
4
|
import { BUILTIN_ARROWS } from "../../arrows/index.js";
|
|
5
|
+
import { CompileWarningCode } from "../constant.js";
|
|
5
6
|
import { applyTransformChain } from "../scope.js";
|
|
6
7
|
import { bendControlPoints, outInControlPoints } from "../../geometry/bend.js";
|
|
7
|
-
import { arcSegmentSample, circleSegmentSample, cubicSegmentSample, ellipseArcSegmentSample, ellipseSegmentSample, foldSegmentSample, lineSegmentSample, quadSegmentSample } from "../../geometry/segment.js";
|
|
8
|
+
import { arcSegmentSample, circleSegmentSample, cubicSegmentSample, ellipseArcSegmentSample, ellipseSegmentSample, foldSegmentSample, lineSegmentSample, quadSegmentSample, rectPerimeterSample } from "../../geometry/segment.js";
|
|
8
9
|
import { fallbackMeasurer } from "../text-metrics.js";
|
|
9
|
-
import { clipForTarget, cornerOf, refPointOfTarget, samePoint } from "./anchor.js";
|
|
10
|
+
import { clipForTarget, cornerOf, isAutoBoundaryTarget, refPointOfTarget, samePoint } from "./anchor.js";
|
|
10
11
|
import { emitLabelPrimitive, tForLabelPosition } from "./label.js";
|
|
11
12
|
import { normalizeRelativeTargets } from "./relative.js";
|
|
12
13
|
import { applyArrowShrinks, endpointArrows, resolveMarkArrowSpec } from "./shrink.js";
|
|
13
14
|
import { splitSubPathsForEndpointArrows } from "./split.js";
|
|
14
15
|
//#region src/compile/path/index.ts
|
|
15
16
|
/**
|
|
17
|
+
* referent(offset.of / polar.origin 的并集形态:节点 id 字符串 / `[x, y]` 字面量 / 嵌套 PolarPosition)里挖节点 id
|
|
18
|
+
* @description 裸字符串即节点 id(offset.of / polar.origin 的 string 分支语义);其余交回 nodeRefId 递归。
|
|
19
|
+
*/
|
|
20
|
+
var referentNodeId = (ref) => typeof ref === "string" ? ref : nodeRefId(ref);
|
|
21
|
+
/**
|
|
16
22
|
* 目标里的一个代表性节点 id——给 UNRESOLVED_NODE_REFERENCE 诊断用
|
|
17
23
|
* @description 对象 NodeTarget(`{ id, ... }`)直接取 id;between 比例点递归挖端点里第一个节点引用
|
|
18
|
-
* (端点未解析时整 between 失败,需照样报 unresolved
|
|
24
|
+
* (端点未解析时整 between 失败,需照样报 unresolved 而非静默);OffsetPosition(`{ of }`)/ PolarPosition
|
|
25
|
+
* (`{ origin }`)递归挖其 referent——否则引用未定义节点时 refPoint 为 null 但 toId 为 undefined,整条 path
|
|
26
|
+
* 会被静默丢弃(零诊断);直接坐标 / 极坐标无 origin 等形态返回 undefined。
|
|
19
27
|
*/
|
|
20
28
|
var nodeRefId = (t) => {
|
|
21
29
|
if (typeof t !== "object" || Array.isArray(t)) return void 0;
|
|
22
30
|
if ("id" in t) return t.id;
|
|
23
31
|
if ("between" in t) return nodeRefId(t.between[0]) ?? nodeRefId(t.between[1]);
|
|
32
|
+
if ("of" in t) return referentNodeId(t.of);
|
|
33
|
+
if ("origin" in t) return referentNodeId(t.origin);
|
|
24
34
|
};
|
|
25
35
|
/** 有限数 */
|
|
26
36
|
var isFiniteNum = (n) => typeof n === "number" && Number.isFinite(n);
|
|
@@ -65,7 +75,7 @@ var assertValidGeneratedCommand = (name, cmd) => {
|
|
|
65
75
|
/**
|
|
66
76
|
* 语义 stroke 档位 → 数值(user units)
|
|
67
77
|
* @description 对齐 TikZ 比例(thin=0.4pt→1=默认 strokeWidth):ultraThin 0.25、veryThin 0.5、thin 1、semithick 1.5、thick 2、veryThick 3、ultraThick 4。显式 strokeWidth 覆盖 thickness。
|
|
68
|
-
* `as const satisfies` + `AssertEqual` 双约束:加 IRPath['thickness'] 档位时漏写 TS
|
|
78
|
+
* `as const satisfies` + `AssertEqual` 双约束:加 IRPath['thickness'] 档位时漏写 TS 报错(字段表互锁)
|
|
69
79
|
*/
|
|
70
80
|
var THICKNESS_TO_WIDTH = {
|
|
71
81
|
ultraThin: .25,
|
|
@@ -129,13 +139,32 @@ var buildPathTransforms = (rotate, scale, center, round) => {
|
|
|
129
139
|
* 把已物化的 arrow marker(局部 baseSize 坐标系,尖端 +x)按路径切线定向放到采样点
|
|
130
140
|
* @description marker 局部系:viewBox `0 0 baseSize baseSize`,参考点 (refX, baseSize/2),尖端朝 +x。
|
|
131
141
|
* GroupPrim transforms 数组语义 array[0] 最外层(最后 apply),故链 = translate(point) ∘ rotate(tangentDeg)
|
|
132
|
-
* ∘ scale(markerWidth/baseSize, markerHeight/baseSize) ∘ translate(-refX, -baseSize/2)
|
|
133
|
-
*
|
|
142
|
+
* ∘ scale(markerWidth·strokeWidth/baseSize, markerHeight·strokeWidth/baseSize) ∘ translate(-refX, -baseSize/2):
|
|
143
|
+
* 先把参考点移到原点、缩放到目标尺寸、绕切线角旋转、平移到采样点。缩放含 strokeWidth 因子,与端点箭头
|
|
144
|
+
* (SVG markerUnits=strokeWidth / Canvas 同口径 ×strokeWidth)一致——中段 mark 随线宽缩放(TikZ 语义)。
|
|
145
|
+
*
|
|
146
|
+
* marker 几何拍平进 Scene 作 children:marker 窄子集结构上是 ScenePrimitive 子集,唯一差异是 fill/stroke 可为
|
|
147
|
+
* `{ kind: 'contextStroke' }`。端点箭头物化成真正的 `<marker>` 时 contextStroke 由 renderer 继承引用方描边;
|
|
148
|
+
* 但中段 mark 是独立 Scene group,已无引用上下文可继承,故在此把 contextStroke 解析成 path 的实际描边色
|
|
149
|
+
* (contextStroke 字符串单位 = path 的已解析 stroke)。
|
|
134
150
|
*/
|
|
135
|
-
var
|
|
151
|
+
var resolveMarkerContextFill = (value, contextStroke) => typeof value === "string" ? value : contextStroke;
|
|
152
|
+
/** marker 图元 → Scene 图元:结构同构,仅把 fill/stroke 的 contextStroke 解析成具体描边色(递归 group) */
|
|
153
|
+
var markerPrimToScene = (prim, contextStroke) => {
|
|
154
|
+
if (prim.type === "group") return {
|
|
155
|
+
...prim,
|
|
156
|
+
children: prim.children.map((c) => markerPrimToScene(c, contextStroke))
|
|
157
|
+
};
|
|
158
|
+
return {
|
|
159
|
+
...prim,
|
|
160
|
+
...prim.fill !== void 0 && { fill: resolveMarkerContextFill(prim.fill, contextStroke) },
|
|
161
|
+
...prim.stroke !== void 0 && { stroke: resolveMarkerContextFill(prim.stroke, contextStroke) }
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
var buildMarkMarkerGroup = (spec, sample, strokeWidth, round, contextStroke) => {
|
|
136
165
|
const angleDeg = Math.atan2(sample.tangent[1], sample.tangent[0]) * 180 / Math.PI;
|
|
137
|
-
const sx = spec.markerWidth / spec.baseSize;
|
|
138
|
-
const sy = spec.markerHeight / spec.baseSize;
|
|
166
|
+
const sx = spec.markerWidth * strokeWidth / spec.baseSize;
|
|
167
|
+
const sy = spec.markerHeight * strokeWidth / spec.baseSize;
|
|
139
168
|
const refY = spec.baseSize / 2;
|
|
140
169
|
return {
|
|
141
170
|
type: "group",
|
|
@@ -160,7 +189,7 @@ var buildMarkMarkerGroup = (spec, sample, round) => {
|
|
|
160
189
|
y: round(-refY)
|
|
161
190
|
}
|
|
162
191
|
],
|
|
163
|
-
children:
|
|
192
|
+
children: spec.marker.map((p) => markerPrimToScene(p, contextStroke))
|
|
164
193
|
};
|
|
165
194
|
};
|
|
166
195
|
/**
|
|
@@ -181,7 +210,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
181
210
|
const steps = normalizeRelativeTargets(path.children, nameStack, scopeChain);
|
|
182
211
|
const soloSelfContained = steps.length === 1 && steps[0].kind === "rectangle";
|
|
183
212
|
if (steps.length < 2 && !soloSelfContained) {
|
|
184
|
-
warn(
|
|
213
|
+
warn(CompileWarningCode.PathTooShort, `Path requires at least 2 steps (got ${steps.length}); the entire path is skipped`, "children");
|
|
185
214
|
return null;
|
|
186
215
|
}
|
|
187
216
|
/** 每段 step.label 翻译出的 TextPrim(或 sloped 旋转的 group),与 path 主体同级返回 */
|
|
@@ -206,7 +235,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
206
235
|
if (!hasTo(s)) return null;
|
|
207
236
|
const ref = refPointOfTarget(s.to, nameStack, scopeChain);
|
|
208
237
|
const toId = nodeRefId(s.to);
|
|
209
|
-
if (!ref && toId !== void 0) warn(
|
|
238
|
+
if (!ref && toId !== void 0) warn(CompileWarningCode.UnresolvedNodeReference, `Step.to references undefined node id '${toId}'; the entire path is skipped`, `children[${idx}].to`);
|
|
210
239
|
return ref;
|
|
211
240
|
});
|
|
212
241
|
/**
|
|
@@ -244,7 +273,16 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
244
273
|
*/
|
|
245
274
|
const readCursor = () => lastEnd;
|
|
246
275
|
const roundPoint = (p) => [round(p[0]), round(p[1])];
|
|
247
|
-
const
|
|
276
|
+
const endpointSource = {
|
|
277
|
+
firstAutoBoundary: false,
|
|
278
|
+
lastAutoBoundary: false
|
|
279
|
+
};
|
|
280
|
+
const noteEndpointSource = (sourceAutoBoundary) => {
|
|
281
|
+
if (commands.length === 0) endpointSource.firstAutoBoundary = sourceAutoBoundary;
|
|
282
|
+
endpointSource.lastAutoBoundary = sourceAutoBoundary;
|
|
283
|
+
};
|
|
284
|
+
const emitMove = (p, sourceAutoBoundary = false) => {
|
|
285
|
+
noteEndpointSource(sourceAutoBoundary);
|
|
248
286
|
const rp = roundPoint(p);
|
|
249
287
|
commands.push({
|
|
250
288
|
kind: "move",
|
|
@@ -254,7 +292,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
254
292
|
subPathStart = p;
|
|
255
293
|
lastEnd = p;
|
|
256
294
|
};
|
|
257
|
-
const emitLine = (p) => {
|
|
295
|
+
const emitLine = (p, sourceAutoBoundary = false) => {
|
|
296
|
+
noteEndpointSource(sourceAutoBoundary);
|
|
258
297
|
const rp = roundPoint(p);
|
|
259
298
|
commands.push({
|
|
260
299
|
kind: "line",
|
|
@@ -267,7 +306,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
267
306
|
commands.push({ kind: "close" });
|
|
268
307
|
lastEnd = subPathStart;
|
|
269
308
|
};
|
|
270
|
-
const emitQuad = (control, p) => {
|
|
309
|
+
const emitQuad = (control, p, sourceAutoBoundary = false) => {
|
|
310
|
+
noteEndpointSource(sourceAutoBoundary);
|
|
271
311
|
const rc = roundPoint(control);
|
|
272
312
|
const rp = roundPoint(p);
|
|
273
313
|
commands.push({
|
|
@@ -279,7 +319,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
279
319
|
points.push(p);
|
|
280
320
|
lastEnd = p;
|
|
281
321
|
};
|
|
282
|
-
const emitCubic = (c1, c2, p) => {
|
|
322
|
+
const emitCubic = (c1, c2, p, sourceAutoBoundary = false) => {
|
|
323
|
+
noteEndpointSource(sourceAutoBoundary);
|
|
283
324
|
const rc1 = roundPoint(c1);
|
|
284
325
|
const rc2 = roundPoint(c2);
|
|
285
326
|
const rp = roundPoint(p);
|
|
@@ -295,6 +336,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
295
336
|
lastEnd = p;
|
|
296
337
|
};
|
|
297
338
|
const emitArc = (center, radius, startAngle, endAngle) => {
|
|
339
|
+
noteEndpointSource(false);
|
|
298
340
|
const rc = roundPoint(center);
|
|
299
341
|
commands.push({
|
|
300
342
|
kind: "arc",
|
|
@@ -307,6 +349,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
307
349
|
lastEnd = arcEndPoint(center, radius, endAngle);
|
|
308
350
|
};
|
|
309
351
|
const emitEllipseArc = (center, radiusX, radiusY, startAngle, endAngle) => {
|
|
352
|
+
noteEndpointSource(false);
|
|
310
353
|
const rc = roundPoint(center);
|
|
311
354
|
commands.push({
|
|
312
355
|
kind: "ellipseArc",
|
|
@@ -321,15 +364,15 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
321
364
|
lastEnd = endPt;
|
|
322
365
|
};
|
|
323
366
|
/** 段起点:与 lastEnd 相同则复用 cursor(省 move),否则发 move */
|
|
324
|
-
const startSegment = (p) => {
|
|
367
|
+
const startSegment = (p, sourceAutoBoundary = false) => {
|
|
325
368
|
if (samePoint(p, lastEnd)) return;
|
|
326
|
-
emitMove(p);
|
|
369
|
+
emitMove(p, sourceAutoBoundary);
|
|
327
370
|
};
|
|
328
371
|
/** 部分圆/椭圆的闭合模式:'open' 直接返回;'sector' 连回中心;缺省 / 误给 'closed' 回退 'chord' */
|
|
329
372
|
const resolvePartialClosed = (closed, idx) => {
|
|
330
373
|
if (closed === "open") return "open";
|
|
331
374
|
if (closed === "sector") return "sector";
|
|
332
|
-
if (closed === "closed") warn(
|
|
375
|
+
if (closed === "closed") warn(CompileWarningCode.PartialArcClosedInvalid, "Partial circle/ellipse (with angles) cannot use closed:'closed'; falling back to 'chord'", `children[${idx}]`);
|
|
333
376
|
return "chord";
|
|
334
377
|
};
|
|
335
378
|
for (let i = 0; i < steps.length; i++) {
|
|
@@ -339,7 +382,10 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
339
382
|
if (prevStep.kind === "move") lastMoveTo = prevStep.to;
|
|
340
383
|
}
|
|
341
384
|
const step = steps[i];
|
|
342
|
-
if (step.kind === "move")
|
|
385
|
+
if (step.kind === "move") {
|
|
386
|
+
penOverride = null;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
343
389
|
if (step.kind === "generator") {
|
|
344
390
|
const generators = warnHook.effectivePathGenerators ?? {};
|
|
345
391
|
const def = Object.prototype.hasOwnProperty.call(generators, step.name) ? generators[step.name] : void 0;
|
|
@@ -407,20 +453,23 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
407
453
|
continue;
|
|
408
454
|
}
|
|
409
455
|
if (step.kind === "cycle") {
|
|
456
|
+
const usedOverride = penOverride;
|
|
457
|
+
penOverride = null;
|
|
410
458
|
const moveTo = lastMoveTo;
|
|
411
459
|
const prev = findPrev();
|
|
412
|
-
if (!moveTo || !prev) continue;
|
|
460
|
+
if (!moveTo || !prev && !usedOverride) continue;
|
|
413
461
|
const moveAnchor = refPointOfTarget(moveTo, nameStack, scopeChain);
|
|
414
462
|
if (!moveAnchor) return null;
|
|
415
|
-
const fromClip = clipForTarget(prev.step.to, moveAnchor, nameStack, scopeChain);
|
|
416
|
-
const toClip = clipForTarget(moveTo, prev
|
|
463
|
+
const fromClip = usedOverride ?? (prev ? clipForTarget(prev.step.to, moveAnchor, nameStack, scopeChain) : null);
|
|
464
|
+
const toClip = clipForTarget(moveTo, fromClip ?? prev?.anchor ?? moveAnchor, nameStack, scopeChain);
|
|
417
465
|
if (!fromClip || !toClip) return null;
|
|
466
|
+
segmentSamplers.push((t) => lineSegmentSample(fromClip, toClip, t));
|
|
418
467
|
if (samePoint(fromClip, lastEnd) && samePoint(toClip, subPathStart)) {
|
|
419
468
|
emitClose();
|
|
420
469
|
continue;
|
|
421
470
|
}
|
|
422
|
-
startSegment(fromClip);
|
|
423
|
-
emitLine(toClip);
|
|
471
|
+
startSegment(fromClip, usedOverride === null && prev !== null && isAutoBoundaryTarget(prev.step.to));
|
|
472
|
+
emitLine(toClip, isAutoBoundaryTarget(moveTo));
|
|
424
473
|
continue;
|
|
425
474
|
}
|
|
426
475
|
if (step.kind === "rectangle") {
|
|
@@ -429,8 +478,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
429
478
|
if (!fromPt || !toPt) {
|
|
430
479
|
const fromId = nodeRefId(step.from);
|
|
431
480
|
const rectToId = nodeRefId(step.to);
|
|
432
|
-
if (!fromPt && fromId !== void 0) warn(
|
|
433
|
-
if (!toPt && rectToId !== void 0) warn(
|
|
481
|
+
if (!fromPt && fromId !== void 0) warn(CompileWarningCode.UnresolvedNodeReference, `Rectangle from references undefined node id '${fromId}'; the entire path is skipped`, `children[${i}].from`);
|
|
482
|
+
if (!toPt && rectToId !== void 0) warn(CompileWarningCode.UnresolvedNodeReference, `Rectangle to references undefined node id '${rectToId}'; the entire path is skipped`, `children[${i}].to`);
|
|
434
483
|
return null;
|
|
435
484
|
}
|
|
436
485
|
let rectStart = null;
|
|
@@ -445,18 +494,22 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
445
494
|
const ry0 = Math.min(fromPt[1], toPt[1]);
|
|
446
495
|
const ry1 = Math.max(fromPt[1], toPt[1]);
|
|
447
496
|
points.push([rx0, ry0], [rx1, ry0], [rx1, ry1], [rx0, ry1]);
|
|
497
|
+
segmentSamplers.push((t) => rectPerimeterSample(fromPt, toPt, t));
|
|
448
498
|
if (rectStart) penOverride = rectStart;
|
|
449
499
|
continue;
|
|
450
500
|
}
|
|
451
501
|
const prev = findPrev();
|
|
452
|
-
if (!prev)
|
|
502
|
+
if (!prev) {
|
|
503
|
+
warn(CompileWarningCode.PathTooShort, `Step '${step.kind}' requires a previous position; the entire path is skipped`, `children[${i}]`);
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
453
506
|
if (step.kind === "arc") {
|
|
454
507
|
let center;
|
|
455
508
|
if (step.center !== void 0) {
|
|
456
509
|
const c = refPointOfTarget(step.center, nameStack, scopeChain);
|
|
457
510
|
if (!c) {
|
|
458
511
|
const centerId = nodeRefId(step.center);
|
|
459
|
-
if (centerId !== void 0) warn(
|
|
512
|
+
if (centerId !== void 0) warn(CompileWarningCode.UnresolvedNodeReference, `Arc step center references undefined node id '${centerId}'; the entire path is skipped`, `children[${i}].center`);
|
|
460
513
|
return null;
|
|
461
514
|
}
|
|
462
515
|
center = c;
|
|
@@ -480,7 +533,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
480
533
|
penOverride = arcEndPoint(center, r, step.endAngle);
|
|
481
534
|
continue;
|
|
482
535
|
}
|
|
483
|
-
warn(
|
|
536
|
+
warn(CompileWarningCode.ArcMissingRadius, "Arc step requires radius (circular) or both radiusX and radiusY (elliptical); the entire path is skipped", `children[${i}]`);
|
|
484
537
|
return null;
|
|
485
538
|
}
|
|
486
539
|
if (step.kind === "circlePath") {
|
|
@@ -504,7 +557,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
504
557
|
} else penOverride = ellipseArcPoint(center, r, r, endA);
|
|
505
558
|
continue;
|
|
506
559
|
}
|
|
507
|
-
if (step.startAngle !== void 0 || step.endAngle !== void 0) warn(
|
|
560
|
+
if (step.startAngle !== void 0 || step.endAngle !== void 0) warn(CompileWarningCode.PartialArcNeedsBothAngles, "circlePath needs both startAngle and endAngle for a partial circle; treated as a full circle", `children[${i}]`);
|
|
508
561
|
startSegment([center[0] + r, center[1]]);
|
|
509
562
|
emitEllipseArc(center, r, r, 0, 360);
|
|
510
563
|
points.push([center[0] + r, center[1]]);
|
|
@@ -537,7 +590,7 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
537
590
|
} else penOverride = ellipseArcPoint(center, rx, ry, endA);
|
|
538
591
|
continue;
|
|
539
592
|
}
|
|
540
|
-
if (step.startAngle !== void 0 || step.endAngle !== void 0) warn(
|
|
593
|
+
if (step.startAngle !== void 0 || step.endAngle !== void 0) warn(CompileWarningCode.PartialArcNeedsBothAngles, "ellipsePath needs both startAngle and endAngle for a partial ellipse; treated as a full ellipse", `children[${i}]`);
|
|
541
594
|
startSegment([center[0] + rx, center[1]]);
|
|
542
595
|
emitEllipseArc(center, rx, ry, 0, 360);
|
|
543
596
|
points.push([center[0] + rx, center[1]]);
|
|
@@ -556,8 +609,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
556
609
|
const fromClip = usedOverride ?? clipForTarget(prev.step.to, currAnchor, nameStack, scopeChain);
|
|
557
610
|
const toClip = clipForTarget(step.to, prev.anchor, nameStack, scopeChain);
|
|
558
611
|
if (!fromClip || !toClip) return null;
|
|
559
|
-
startSegment(fromClip);
|
|
560
|
-
emitLine(toClip);
|
|
612
|
+
startSegment(fromClip, usedOverride === null && isAutoBoundaryTarget(prev.step.to));
|
|
613
|
+
emitLine(toClip, isAutoBoundaryTarget(step.to));
|
|
561
614
|
collectLabel(step, (t) => lineSegmentSample(fromClip, toClip, t));
|
|
562
615
|
continue;
|
|
563
616
|
}
|
|
@@ -565,8 +618,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
565
618
|
const fromClip = usedOverride ?? clipForTarget(prev.step.to, step.control, nameStack, scopeChain);
|
|
566
619
|
const toClip = clipForTarget(step.to, step.control, nameStack, scopeChain);
|
|
567
620
|
if (!fromClip || !toClip) return null;
|
|
568
|
-
startSegment(fromClip);
|
|
569
|
-
emitQuad(step.control, toClip);
|
|
621
|
+
startSegment(fromClip, usedOverride === null && isAutoBoundaryTarget(prev.step.to));
|
|
622
|
+
emitQuad(step.control, toClip, isAutoBoundaryTarget(step.to));
|
|
570
623
|
collectLabel(step, (t) => quadSegmentSample(fromClip, step.control, toClip, t));
|
|
571
624
|
continue;
|
|
572
625
|
}
|
|
@@ -574,8 +627,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
574
627
|
const fromClip = usedOverride ?? clipForTarget(prev.step.to, step.control1, nameStack, scopeChain);
|
|
575
628
|
const toClip = clipForTarget(step.to, step.control2, nameStack, scopeChain);
|
|
576
629
|
if (!fromClip || !toClip) return null;
|
|
577
|
-
startSegment(fromClip);
|
|
578
|
-
emitCubic(step.control1, step.control2, toClip);
|
|
630
|
+
startSegment(fromClip, usedOverride === null && isAutoBoundaryTarget(prev.step.to));
|
|
631
|
+
emitCubic(step.control1, step.control2, toClip, isAutoBoundaryTarget(step.to));
|
|
579
632
|
collectLabel(step, (t) => cubicSegmentSample(fromClip, step.control1, step.control2, toClip, t));
|
|
580
633
|
continue;
|
|
581
634
|
}
|
|
@@ -585,8 +638,8 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
585
638
|
const fromClip = usedOverride ?? clipForTarget(prev.step.to, c1, nameStack, scopeChain);
|
|
586
639
|
const toClip = clipForTarget(step.to, c2, nameStack, scopeChain);
|
|
587
640
|
if (!fromClip || !toClip) return null;
|
|
588
|
-
startSegment(fromClip);
|
|
589
|
-
emitCubic(c1, c2, toClip);
|
|
641
|
+
startSegment(fromClip, usedOverride === null && isAutoBoundaryTarget(prev.step.to));
|
|
642
|
+
emitCubic(c1, c2, toClip, isAutoBoundaryTarget(step.to));
|
|
590
643
|
collectLabel(step, (t) => cubicSegmentSample(fromClip, c1, c2, toClip, t));
|
|
591
644
|
continue;
|
|
592
645
|
}
|
|
@@ -594,9 +647,9 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
594
647
|
const fromClip = usedOverride ?? clipForTarget(prev.step.to, corner, nameStack, scopeChain);
|
|
595
648
|
const toClip = clipForTarget(step.to, corner, nameStack, scopeChain);
|
|
596
649
|
if (!fromClip || !toClip) return null;
|
|
597
|
-
startSegment(fromClip);
|
|
650
|
+
startSegment(fromClip, usedOverride === null && isAutoBoundaryTarget(prev.step.to));
|
|
598
651
|
emitLine(corner);
|
|
599
|
-
emitLine(toClip);
|
|
652
|
+
emitLine(toClip, isAutoBoundaryTarget(step.to));
|
|
600
653
|
collectLabel(step, (t) => foldSegmentSample(fromClip, corner, toClip, t));
|
|
601
654
|
}
|
|
602
655
|
const strokeWidth = path.strokeWidth ?? (path.thickness ? THICKNESS_TO_WIDTH[path.thickness] : 1);
|
|
@@ -623,11 +676,11 @@ var emitPathPrimitive = (path, nameStack, round, measureText = fallbackMeasurer,
|
|
|
623
676
|
const localT = scaled - segIdx;
|
|
624
677
|
const sample = segmentSamplers[segIdx](pos === 1 ? 1 : localT);
|
|
625
678
|
const spec = resolveMarkArrowSpec(mark, effectiveArrows, round);
|
|
626
|
-
markPrims.push(buildMarkMarkerGroup(spec, sample, round));
|
|
679
|
+
markPrims.push(buildMarkMarkerGroup(spec, sample, strokeWidth, round, baseProps.stroke ?? "currentColor"));
|
|
627
680
|
points.push(sample.point);
|
|
628
681
|
}
|
|
629
682
|
}
|
|
630
|
-
applyArrowShrinks(commands, arrows.shrinkStart, arrows.shrinkEnd, strokeWidth, round);
|
|
683
|
+
applyArrowShrinks(commands, arrows.shrinkStart + (endpointSource.firstAutoBoundary ? arrows.boundaryOuterInsetStart : 0), arrows.shrinkEnd + (endpointSource.lastAutoBoundary ? arrows.boundaryOuterInsetEnd : 0), strokeWidth, round);
|
|
631
684
|
const endpointSpecs = {};
|
|
632
685
|
if (arrows.arrowStart) endpointSpecs.arrowStart = arrows.arrowStart;
|
|
633
686
|
if (arrows.arrowEnd) endpointSpecs.arrowEnd = arrows.arrowEnd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,iBAAiB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAmBpD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,WAAW,CAAC,UAAU,CAAC,KAAG,MAIhE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,WAAW,EAClB,QAAQ,aAAa,EACrB,aAAa,YAAY,EACzB,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAC5B,cAAc,MAAM,KACnB;IAAE,SAAS,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/label.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAY,MAAM,iBAAiB,CAAC;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAmBpD;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,KAAK,WAAW,CAAC,UAAU,CAAC,KAAG,MAIhE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,WAAW,EAClB,QAAQ,aAAa,EACrB,aAAa,YAAY,EACzB,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,EAC5B,cAAc,MAAM,KACnB;IAAE,SAAS,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,KAAK,CAAC,UAAU,CAAC,CAAA;CAyGxD,CAAC"}
|
|
@@ -103,13 +103,17 @@ var emitLabelPrimitive = (label, sample, measureText, round, hostOpacity) => {
|
|
|
103
103
|
}
|
|
104
104
|
const halfW = measuredWidth / 2;
|
|
105
105
|
const halfH = measuredHeight / 2;
|
|
106
|
+
const left = align === "start" ? x : align === "end" ? x - measuredWidth : x - halfW;
|
|
107
|
+
const right = align === "start" ? x + measuredWidth : align === "end" ? x : x + halfW;
|
|
108
|
+
const top = baseline === "top" ? y : baseline === "bottom" ? y - measuredHeight : y - halfH;
|
|
109
|
+
const bottom = baseline === "top" ? y + measuredHeight : baseline === "bottom" ? y : y + halfH;
|
|
106
110
|
return {
|
|
107
111
|
primitive: text,
|
|
108
112
|
points: [
|
|
109
|
-
[
|
|
110
|
-
[
|
|
111
|
-
[
|
|
112
|
-
[
|
|
113
|
+
[left, top],
|
|
114
|
+
[right, top],
|
|
115
|
+
[left, bottom],
|
|
116
|
+
[right, bottom]
|
|
113
117
|
]
|
|
114
118
|
};
|
|
115
119
|
};
|
|
@@ -8,7 +8,7 @@ import { NameStack } from '../name-stack';
|
|
|
8
8
|
* 先反向投影 prevEnd 到 scope 局部 + 加 (dx, dy) 得局部 tuple,写回 step.to。下游
|
|
9
9
|
* `refPointOfTarget` / `clipForTarget` 把 tuple 视作 scope 局部字面量,统一 `applyTransformChain` 投回全局——
|
|
10
10
|
* relative 分支只负责"折算到局部",不能在此处提前投影到全局,否则与下游 chain apply 形成 double-apply。
|
|
11
|
-
* `scopeChain=[]` 时 inverse
|
|
11
|
+
* `scopeChain=[]` 时 inverse 恒等,保持全局坐标语义。
|
|
12
12
|
*/
|
|
13
13
|
export declare const normalizeRelativeTargets: (steps: ReadonlyArray<IRStep>, nameStack: NameStack, scopeChain?: ReadonlyArray<Transform>) => Array<IRStep>;
|
|
14
14
|
//# sourceMappingURL=relative.d.ts.map
|
|
@@ -9,7 +9,7 @@ import { refPointOfTarget } from "./anchor.js";
|
|
|
9
9
|
* 先反向投影 prevEnd 到 scope 局部 + 加 (dx, dy) 得局部 tuple,写回 step.to。下游
|
|
10
10
|
* `refPointOfTarget` / `clipForTarget` 把 tuple 视作 scope 局部字面量,统一 `applyTransformChain` 投回全局——
|
|
11
11
|
* relative 分支只负责"折算到局部",不能在此处提前投影到全局,否则与下游 chain apply 形成 double-apply。
|
|
12
|
-
* `scopeChain=[]` 时 inverse
|
|
12
|
+
* `scopeChain=[]` 时 inverse 恒等,保持全局坐标语义。
|
|
13
13
|
*/
|
|
14
14
|
var normalizeRelativeTargets = (steps, nameStack, scopeChain = []) => {
|
|
15
15
|
let prevEnd = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IRArrowDetail, IRArrowMark } from '../../ir';
|
|
2
2
|
import { ArrowDefinition } from '../../arrows';
|
|
3
3
|
import { ArrowEndSpec, PathCommand } from '../../primitive';
|
|
4
|
-
/** 有效 arrow 表:内置
|
|
4
|
+
/** 有效 arrow 表:内置 8 + 注入(同名注入覆盖内置) */
|
|
5
5
|
export type EffectiveArrows = Record<string, ArrowDefinition>;
|
|
6
6
|
/**
|
|
7
7
|
* IR path-level `arrow` + `arrowDetail` → PathPrim 起末端点已解析 marker 描述
|
|
@@ -14,6 +14,8 @@ export declare const endpointArrows: (arrow: "none" | "->" | "<-" | "<->" | unde
|
|
|
14
14
|
arrowEnd?: ArrowEndSpec;
|
|
15
15
|
shrinkStart: number;
|
|
16
16
|
shrinkEnd: number;
|
|
17
|
+
boundaryOuterInsetStart: number;
|
|
18
|
+
boundaryOuterInsetEnd: number;
|
|
17
19
|
};
|
|
18
20
|
/**
|
|
19
21
|
* 解析一个中段标记 `IRArrowMark` 为已物化的 marker 描述(`ArrowEndSpec`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shrink.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/shrink.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAElB,KAAK,WAAW,EAEjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"shrink.d.ts","sourceRoot":"","sources":["../../../../src/compile/path/shrink.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,aAAa,EAElB,KAAK,WAAW,EAEjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AAEtE,OAAO,KAAK,EAAE,YAAY,EAA+B,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAI9F,qCAAqC;AACrC,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;AAsN9D;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,MAAM,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,SAAS,EAC/C,QAAQ,aAAa,GAAG,SAAS,EACjC,WAAW,eAAe,EAC1B,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAC3B;IACD,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB,EAAE,MAAM,CAAC;IAChC,qBAAqB,EAAE,MAAM,CAAC;CAyC/B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAC/B,MAAM,WAAW,EACjB,WAAW,eAAe,EAC1B,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAC3B,YAaF,CAAC;AAuCF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,KAAK,CAAC,WAAW,CAAC,EAC5B,aAAa,MAAM,EACnB,WAAW,MAAM,EACjB,aAAa,MAAM,EACnB,OAAO,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,KAC3B,IA4CF,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_ARROW_SHAPE } from "../../ir/path/arrow.js";
|
|
2
|
+
import { arcEndPoint, ellipseArcPoint } from "../../geometry/arc.js";
|
|
2
3
|
import { validateMarkerPrimitives } from "../marker-prim.js";
|
|
3
4
|
import { shiftToward } from "./anchor.js";
|
|
4
5
|
//#region src/compile/path/shrink.ts
|
|
@@ -45,6 +46,7 @@ var assertFiniteGeometry = (shape, def) => {
|
|
|
45
46
|
if (!Number.isFinite(def.lineContactX)) throw new Error(`Arrow '${shape}' has a non-finite lineContactX (${String(def.lineContactX)}); it must be a finite number.`);
|
|
46
47
|
if (def.baseSize !== void 0 && (!Number.isFinite(def.baseSize) || def.baseSize <= 0)) throw new Error(`Arrow '${shape}' has an invalid baseSize (${String(def.baseSize)}); it must be a finite number greater than 0.`);
|
|
47
48
|
if (def.tipX !== void 0 && !Number.isFinite(def.tipX)) throw new Error(`Arrow '${shape}' has a non-finite tipX (${String(def.tipX)}); it must be a finite number.`);
|
|
49
|
+
if (def.outerInset !== void 0 && !Number.isFinite(def.outerInset)) throw new Error(`Arrow '${shape}' has a non-finite outerInset (${String(def.outerInset)}); it must be a finite number.`);
|
|
48
50
|
};
|
|
49
51
|
/**
|
|
50
52
|
* 调 def.emit 收集 marker 并跑窄子集 + JSON-safe 校验
|
|
@@ -73,7 +75,9 @@ var resolveGeometry = (visual, effective) => {
|
|
|
73
75
|
const scale = visual.scale ?? 1;
|
|
74
76
|
const resolvedLength = (visual.length ?? def.defaultLength ?? 6) * scale;
|
|
75
77
|
const resolvedWidth = (visual.width ?? def.defaultWidth ?? 6) * scale;
|
|
78
|
+
const boundaryOuterInset = (def.outerInset ?? (def.hollow ? lineWidth / 2 : 0)) * resolvedLength / baseSize;
|
|
76
79
|
if (!Number.isFinite(resolvedLength) || !Number.isFinite(resolvedWidth)) throw new Error(`Arrow '${visual.shape}' resolved length/width is non-finite (length × scale overflowed); use smaller length / scale values.`);
|
|
80
|
+
if (!Number.isFinite(boundaryOuterInset)) throw new Error(`Arrow '${visual.shape}' resolved outerInset is non-finite; use smaller outerInset / length / scale values.`);
|
|
77
81
|
return {
|
|
78
82
|
def,
|
|
79
83
|
baseSize,
|
|
@@ -81,7 +85,8 @@ var resolveGeometry = (visual, effective) => {
|
|
|
81
85
|
contactX,
|
|
82
86
|
lineWidth,
|
|
83
87
|
resolvedLength,
|
|
84
|
-
resolvedWidth
|
|
88
|
+
resolvedWidth,
|
|
89
|
+
boundaryOuterInset
|
|
85
90
|
};
|
|
86
91
|
};
|
|
87
92
|
/**
|
|
@@ -131,26 +136,32 @@ var materializeArrowEndSpec = (visual, geometry, round) => {
|
|
|
131
136
|
var endpointArrows = (arrow, detail, effective, round) => {
|
|
132
137
|
if (!arrow || arrow === "none") return {
|
|
133
138
|
shrinkStart: 0,
|
|
134
|
-
shrinkEnd: 0
|
|
139
|
+
shrinkEnd: 0,
|
|
140
|
+
boundaryOuterInsetStart: 0,
|
|
141
|
+
boundaryOuterInsetEnd: 0
|
|
135
142
|
};
|
|
136
143
|
const top = detail ?? {};
|
|
137
144
|
const wantStart = arrow === "<-" || arrow === "<->";
|
|
138
145
|
const wantEnd = arrow === "->" || arrow === "<->";
|
|
139
146
|
const result = {
|
|
140
147
|
shrinkStart: 0,
|
|
141
|
-
shrinkEnd: 0
|
|
148
|
+
shrinkEnd: 0,
|
|
149
|
+
boundaryOuterInsetStart: 0,
|
|
150
|
+
boundaryOuterInsetEnd: 0
|
|
142
151
|
};
|
|
143
152
|
if (wantStart) {
|
|
144
153
|
const visual = resolveArrowVisual(top, top.start, effective);
|
|
145
154
|
const geometry = resolveGeometry(visual, effective);
|
|
146
155
|
result.arrowStart = materializeArrowEndSpec(visual, geometry, round);
|
|
147
156
|
result.shrinkStart = computeShrink(geometry);
|
|
157
|
+
result.boundaryOuterInsetStart = geometry.boundaryOuterInset;
|
|
148
158
|
}
|
|
149
159
|
if (wantEnd) {
|
|
150
160
|
const visual = resolveArrowVisual(top, top.end, effective);
|
|
151
161
|
const geometry = resolveGeometry(visual, effective);
|
|
152
162
|
result.arrowEnd = materializeArrowEndSpec(visual, geometry, round);
|
|
153
163
|
result.shrinkEnd = computeShrink(geometry);
|
|
164
|
+
result.boundaryOuterInsetEnd = geometry.boundaryOuterInset;
|
|
154
165
|
}
|
|
155
166
|
return result;
|
|
156
167
|
};
|
|
@@ -180,14 +191,8 @@ var endpointOf = (cmd) => {
|
|
|
180
191
|
case "line":
|
|
181
192
|
case "quad":
|
|
182
193
|
case "cubic": return [cmd.to[0], cmd.to[1]];
|
|
183
|
-
case "arc":
|
|
184
|
-
|
|
185
|
-
return [cmd.center[0] + Math.cos(rad) * cmd.radius, cmd.center[1] + Math.sin(rad) * cmd.radius];
|
|
186
|
-
}
|
|
187
|
-
case "ellipseArc": {
|
|
188
|
-
const rad = cmd.endAngle * Math.PI / 180;
|
|
189
|
-
return [cmd.center[0] + Math.cos(rad) * cmd.radiusX, cmd.center[1] + Math.sin(rad) * cmd.radiusY];
|
|
190
|
-
}
|
|
194
|
+
case "arc": return arcEndPoint(cmd.center, cmd.radius, cmd.endAngle);
|
|
195
|
+
case "ellipseArc": return ellipseArcPoint(cmd.center, cmd.radiusX, cmd.radiusY, cmd.endAngle);
|
|
191
196
|
case "close": return null;
|
|
192
197
|
}
|
|
193
198
|
};
|
|
@@ -12,14 +12,14 @@ export type ResolveBetweenGlobal = (between: IRBetweenPosition, nameStack: NameS
|
|
|
12
12
|
* @description
|
|
13
13
|
* - **返回值语义**:当 `scopeChain` 非空时,返回**当前 scope 局部坐标系**下的笛卡尔位置;
|
|
14
14
|
* 调用方负责走 `applyTransformChain(local, scopeChain)` 投回全局。当 `scopeChain` 为空时
|
|
15
|
-
*
|
|
15
|
+
* 直接按全局坐标返回。
|
|
16
16
|
* - **referent 处理**:node id lookup 拿到的 layout.rect 已是全局坐标;本函数内部用
|
|
17
17
|
* `inverseTransformChain` 把全局 referent 反向投影到当前 scope 局部坐标系作为"在当前
|
|
18
18
|
* scope 局部的固定点"基准。relative 部分(polar 的 angle/radius、at 的 direction/distance、
|
|
19
19
|
* offset 的 dx/dy)在当前 scope 局部度量后加到 referent 局部坐标上。
|
|
20
20
|
* - **嵌套**:PolarPosition.origin / OffsetPosition.of 是嵌套 polar 时,递归调用传同样
|
|
21
21
|
* scopeChain——整条嵌套链都在当前 scope 局部度量。
|
|
22
|
-
* - **笛卡尔字面量**:`Position` 形态直接返回(
|
|
22
|
+
* - **笛卡尔字面量**:`Position` 形态直接返回(scope 内笛卡尔字面量在
|
|
23
23
|
* 当前 scope 局部度量;调用方走 applyTransformChain 投全局)。
|
|
24
24
|
* - 极坐标 origin / 偏移定位 of 均可递归引用节点 id 或字面坐标;relative `AtPosition` of
|
|
25
25
|
* 必须引用已定义节点/coordinate;解析失败返回 null。
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/compile/position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../src/compile/position.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE1G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,SAAS,EACpB,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,KACjC,UAAU,GAAG,IAAI,CAAC;AAKvB;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,UAAU,GAAG,aAAa,GAAG,YAAY,GAAG,gBAAgB,GAAG,iBAAiB,GAAG,MAAM,EAC9F,WAAW,SAAS,EACpB,eAAc,MAA8B,EAC5C,aAAY,aAAa,CAAC,SAAS,CAAM,EACzC,uBAAuB,oBAAoB,KAC1C,UAAU,GAAG,IA6Cf,CAAC"}
|
|
@@ -1,34 +1,22 @@
|
|
|
1
|
+
import { arcEndPoint } from "../geometry/arc.js";
|
|
2
|
+
import { DirectionVectorByAtDirection } from "./direction.js";
|
|
1
3
|
import { inverseTransformChain } from "./scope.js";
|
|
2
4
|
//#region src/compile/position.ts
|
|
3
5
|
/** 默认相对定位距离(CompileOptions.nodeDistance 未配时使用) */
|
|
4
6
|
var DEFAULT_NODE_DISTANCE = 1;
|
|
5
7
|
/**
|
|
6
|
-
* 8 方向 → 屏幕坐标系(y 向下)单位向量
|
|
7
|
-
* @description above=视觉上方 (y 减小);4 对角分量 1/√2 保证斜向与水平/垂直距离等长(对角点落在半径=distance 圆周上)
|
|
8
|
-
*/
|
|
9
|
-
var DIRECTION_VECTOR = {
|
|
10
|
-
above: [0, -1],
|
|
11
|
-
below: [0, 1],
|
|
12
|
-
left: [-1, 0],
|
|
13
|
-
right: [1, 0],
|
|
14
|
-
"above-left": [-Math.SQRT1_2, -Math.SQRT1_2],
|
|
15
|
-
"above-right": [Math.SQRT1_2, -Math.SQRT1_2],
|
|
16
|
-
"below-left": [-Math.SQRT1_2, Math.SQRT1_2],
|
|
17
|
-
"below-right": [Math.SQRT1_2, Math.SQRT1_2]
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
8
|
* IR 各种位置形态(笛卡尔/极坐标/相对定位/偏移定位/节点 id)→ 笛卡尔位置
|
|
21
9
|
* @description
|
|
22
10
|
* - **返回值语义**:当 `scopeChain` 非空时,返回**当前 scope 局部坐标系**下的笛卡尔位置;
|
|
23
11
|
* 调用方负责走 `applyTransformChain(local, scopeChain)` 投回全局。当 `scopeChain` 为空时
|
|
24
|
-
*
|
|
12
|
+
* 直接按全局坐标返回。
|
|
25
13
|
* - **referent 处理**:node id lookup 拿到的 layout.rect 已是全局坐标;本函数内部用
|
|
26
14
|
* `inverseTransformChain` 把全局 referent 反向投影到当前 scope 局部坐标系作为"在当前
|
|
27
15
|
* scope 局部的固定点"基准。relative 部分(polar 的 angle/radius、at 的 direction/distance、
|
|
28
16
|
* offset 的 dx/dy)在当前 scope 局部度量后加到 referent 局部坐标上。
|
|
29
17
|
* - **嵌套**:PolarPosition.origin / OffsetPosition.of 是嵌套 polar 时,递归调用传同样
|
|
30
18
|
* scopeChain——整条嵌套链都在当前 scope 局部度量。
|
|
31
|
-
* - **笛卡尔字面量**:`Position` 形态直接返回(
|
|
19
|
+
* - **笛卡尔字面量**:`Position` 形态直接返回(scope 内笛卡尔字面量在
|
|
32
20
|
* 当前 scope 局部度量;调用方走 applyTransformChain 投全局)。
|
|
33
21
|
* - 极坐标 origin / 偏移定位 of 均可递归引用节点 id 或字面坐标;relative `AtPosition` of
|
|
34
22
|
* 必须引用已定义节点/coordinate;解析失败返回 null。
|
|
@@ -49,7 +37,7 @@ var resolvePosition = (pos, nameStack, nodeDistance = DEFAULT_NODE_DISTANCE, sco
|
|
|
49
37
|
const refGlobal = [ref.rect.x, ref.rect.y];
|
|
50
38
|
const refLocal = scopeChain.length === 0 ? refGlobal : inverseTransformChain(refGlobal, scopeChain);
|
|
51
39
|
const distance = pos.distance ?? nodeDistance;
|
|
52
|
-
const [dx, dy] =
|
|
40
|
+
const [dx, dy] = DirectionVectorByAtDirection[pos.direction];
|
|
53
41
|
return [refLocal[0] + dx * distance, refLocal[1] + dy * distance];
|
|
54
42
|
}
|
|
55
43
|
if ("offset" in pos) {
|
|
@@ -70,8 +58,7 @@ var resolvePosition = (pos, nameStack, nodeDistance = DEFAULT_NODE_DISTANCE, sco
|
|
|
70
58
|
if (!resolved) return null;
|
|
71
59
|
origin = resolved;
|
|
72
60
|
}
|
|
73
|
-
|
|
74
|
-
return [origin[0] + Math.cos(rad) * pos.radius, origin[1] + Math.sin(rad) * pos.radius];
|
|
61
|
+
return arcEndPoint(origin, pos.radius, pos.angle);
|
|
75
62
|
};
|
|
76
63
|
//#endregion
|
|
77
64
|
export { resolvePosition };
|
|
@@ -6,5 +6,5 @@ export declare const DEFAULT_PRECISION = 2;
|
|
|
6
6
|
* 而 `JSON.stringify(-0) === '0'` 会让 Scene round-trip 在 `Object.is` 层失真(`-0 !== 0` 于 Object.is)。
|
|
7
7
|
* 归一让序列化往返稳定;数值上 `-0 === 0`,渲染 / 计算无影响。
|
|
8
8
|
*/
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const createRound: (precision: number) => (n: number) => number;
|
|
10
10
|
//# sourceMappingURL=precision.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"precision.d.ts","sourceRoot":"","sources":["../../../src/compile/precision.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"precision.d.ts","sourceRoot":"","sources":["../../../src/compile/precision.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,WAAW,MAAM,MAEnC,GAAG,MAAM,WAIlB,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* 而 `JSON.stringify(-0) === '0'` 会让 Scene round-trip 在 `Object.is` 层失真(`-0 !== 0` 于 Object.is)。
|
|
6
6
|
* 归一让序列化往返稳定;数值上 `-0 === 0`,渲染 / 计算无影响。
|
|
7
7
|
*/
|
|
8
|
-
var
|
|
8
|
+
var createRound = (precision) => {
|
|
9
9
|
const factor = 10 ** precision;
|
|
10
10
|
return (n) => {
|
|
11
11
|
const r = Math.round(n * factor) / factor;
|
|
@@ -13,4 +13,4 @@ var makeRound = (precision) => {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
//#endregion
|
|
16
|
-
export {
|
|
16
|
+
export { createRound };
|