@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
|
@@ -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"}
|
|
@@ -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
|
+
export { defineArrow };
|
|
@@ -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,CA6DpE,CAAC;AAEF,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/es/arrows/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./define.js";
|
|
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, [
|
|
@@ -109,7 +122,7 @@ var BUILTIN_ARROWS = {
|
|
|
109
122
|
cy: 5,
|
|
110
123
|
rx: 4.25,
|
|
111
124
|
ry: 4.25,
|
|
112
|
-
stroke: typeof ctx.stroke === "string" ? ctx.stroke : "
|
|
125
|
+
stroke: typeof ctx.stroke === "string" ? ctx.stroke : { kind: "contextStroke" },
|
|
113
126
|
strokeWidth: ctx.lineWidth
|
|
114
127
|
}]
|
|
115
128
|
}
|
|
@@ -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,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]`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anchor-cache.d.ts","sourceRoot":"","sources":["../../../src/compile/anchor-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"anchor-cache.d.ts","sourceRoot":"","sources":["../../../src/compile/anchor-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AA8CzC;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,UAAU,EAClB,YAAY,MAAM,EAClB,WAAU,UAAU,GAAG,SAAmB,KACzC,UAYF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,UAAU,EAClB,MAAM,IAAI,EACV,GAAG,MAAM,KACR,UAuBF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { normalizeCompassAnchor } from "../geometry/anchor.js";
|
|
1
2
|
import { boundaryKey } from "./boundary.js";
|
|
2
|
-
import { anchorOf, angleBoundaryOf } from "./node.js";
|
|
3
|
+
import { anchorOf, angleBoundaryOf, outerRectOf } from "./node.js";
|
|
3
4
|
//#region src/compile/anchor-cache.ts
|
|
4
5
|
/**
|
|
5
6
|
* (layout, anchorName) → IRPosition 缓存
|
|
@@ -8,19 +9,31 @@ import { anchorOf, angleBoundaryOf } from "./node.js";
|
|
|
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(compass / 数字角度)在其上解析 */
|
|
13
|
+
var withOuterRect = (layout) => ({
|
|
14
|
+
...layout,
|
|
15
|
+
rect: 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
|
+
* 形状专属命名 anchor(tip-N / apex 等)恒走视觉 rect、不外扩。`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(angleBoundaryOf(withOuterRect(layout), angle, boundary));
|
|
28
|
+
}
|
|
29
|
+
if (normalizeCompassAnchor(anchorName) !== void 0) return positionToIR(anchorOf(withOuterRect(layout), anchorName, boundary));
|
|
17
30
|
return positionToIR(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]`
|
|
@@ -3,21 +3,12 @@ import { Scene } from '../primitive';
|
|
|
3
3
|
import { ShapeDefinition } from '../shapes';
|
|
4
4
|
import { ArrowDefinition } from '../arrows';
|
|
5
5
|
import { PatternDefinition } from '../patterns';
|
|
6
|
-
import { PathGeneratorDefinition } from '../
|
|
6
|
+
import { PathGeneratorDefinition } from '../path-generators';
|
|
7
7
|
import { CompositeDefinition } from '../composites';
|
|
8
|
+
import { CompileWarning } from './constant';
|
|
8
9
|
import { TextMeasurer } from './text-metrics';
|
|
9
|
-
|
|
10
|
-
export
|
|
11
|
-
/**
|
|
12
|
-
* 警告类型代码(机器可读)
|
|
13
|
-
* @description 用户可按 code 分支处理;未来 alpha 加新 code 不破坏调用方
|
|
14
|
-
*/
|
|
15
|
-
code: 'UNRESOLVED_NODE_REFERENCE' | 'PATH_TOO_SHORT' | 'ANCHOR_RESOLUTION_FAILED' | 'OFFSET_BASE_UNRESOLVED' | 'POLAR_ORIGIN_UNRESOLVED' | 'AT_TARGET_UNRESOLVED' | 'RELATIVE_INITIAL_NO_PREV_END' | 'BBOX_EXTREME_INPUT' | 'DUPLICATE_NODE_ID' | 'SHAPE_OVERRIDES_BUILTIN' | 'ARROW_OVERRIDES_BUILTIN' | 'PATTERN_OVERRIDES_BUILTIN' | 'COMPOSITE_NOT_REGISTERED' | 'ANIMATION_INVALID_PROPERTY' | (string & {});
|
|
16
|
-
/** 人类可读消息(英文) */
|
|
17
|
-
message: string;
|
|
18
|
-
/** IR locator 路径(jq-like,如 `'children[3].path.children[1].to'`) */
|
|
19
|
-
path: string;
|
|
20
|
-
};
|
|
10
|
+
export type { CompileWarning } from './constant';
|
|
11
|
+
export { CompileWarningCode } from './constant';
|
|
21
12
|
/** compileToScene 的可选参数 */
|
|
22
13
|
export type CompileOptions = {
|
|
23
14
|
/** 注入文字度量函数;不传则用 fallback(不准但可跑) */
|
|
@@ -81,7 +72,7 @@ export type CompileOptions = {
|
|
|
81
72
|
};
|
|
82
73
|
/**
|
|
83
74
|
* IR → Scene 纯函数转换,所有 adapter 共享
|
|
84
|
-
* @description Pass 1 递归处理 node / coordinate / scope,把 scope 树下沉为嵌套 GroupPrim;scope.transforms 中的
|
|
75
|
+
* @description Pass 1 递归处理 node / coordinate / scope,把 scope 树下沉为嵌套 GroupPrim;scope.transforms 中的 5 种 translate 变体按 lowerScopeTransforms 展平为 Cartesian transform;node 在 Scene primitive 树里是局部坐标 + GroupPrim transform 链、在 NameStack 中存全局坐标供其他节点 / path 引用。NameStack 用栈式 frame 管理命名空间:默认全局扁平、`<Scope localNamespace>` 推入子 frame;scope.id 始终在父 frame 注册(外部句柄);id lookup 从栈顶向栈底 inside-out 搜索;同 frame 重复 id 触发 DUPLICATE_NODE_ID warn + 后定义覆盖前定义。Pass 2 解析 path 端点写 d 字符串,path primitive 发到 Pass 1 记录的对应容器;末端按 precision 折算 layout
|
|
85
76
|
*/
|
|
86
77
|
export declare const compileToScene: (ir: IR, options?: CompileOptions) => Scene;
|
|
87
78
|
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAA8D,MAAM,OAAO,CAAC;AAC5F,OAAO,KAAK,EAAa,KAAK,EAA6B,MAAM,cAAc,CAAC;AAEhF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,YAAY,CAAC;AAuBpB,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAGrE,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAoDhD,2BAA2B;AAC3B,MAAM,MAAM,cAAc,GAAG;IAC3B,oCAAoC;IACpC,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,qCAAqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC3C;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACzC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC7C;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACzD;;;;OAIG;IACH,UAAU,CAAC,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACxC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAuLF;;;GAGG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,EAAE,EAAE,UAAS,cAAmB,KAAG,KAqXrE,CAAC"}
|
|
@@ -2,18 +2,19 @@ import { rect } from "../geometry/rect.js";
|
|
|
2
2
|
import { BUILTIN_SHAPES } from "../shapes/index.js";
|
|
3
3
|
import { BUILTIN_ARROWS } from "../arrows/index.js";
|
|
4
4
|
import { BUILTIN_PATTERNS } from "../patterns/index.js";
|
|
5
|
-
import {
|
|
5
|
+
import { CompileWarningCode, formatCompileWarning } from "./constant.js";
|
|
6
|
+
import { lowerComposites } from "./composite.js";
|
|
6
7
|
import { NameStack } from "./name-stack.js";
|
|
7
8
|
import { applyTransformChain, computeScopeBoundingBox, lowerScopeTransforms, projectLayoutToGlobal, registerScopeAsLayout } from "./scope.js";
|
|
8
9
|
import { resolvePosition } from "./position.js";
|
|
9
|
-
import { emitNodePrimitives, labelExtentPoints, layoutNode } from "./node.js";
|
|
10
|
+
import { emitNodePrimitives, labelExtentPoints, layoutNode, outerRectOf } from "./node.js";
|
|
10
11
|
import { createPaintRegistry } from "./paint.js";
|
|
11
12
|
import { createClipRegistry } from "./clip.js";
|
|
12
13
|
import { fallbackMeasurer } from "./text-metrics.js";
|
|
13
14
|
import { refPointOfTarget } from "./path/anchor.js";
|
|
14
15
|
import { emitPathPrimitive } from "./path/index.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
16
|
+
import { createRound } from "./precision.js";
|
|
17
|
+
import { createStyleFrame, resolveEffectivePath, resolveLabelDefault, resolveNodeStyle } from "./style.js";
|
|
17
18
|
import { computeLayout } from "./layout.js";
|
|
18
19
|
//#region src/compile/compile.ts
|
|
19
20
|
/**
|
|
@@ -21,10 +22,10 @@ import { computeLayout } from "./layout.js";
|
|
|
21
22
|
* @description coordinate / scope.id 入场临时占位等"无形状只有位置"句柄共享此结构,
|
|
22
23
|
* 让后续 path target / `at.of` / `offset.of` / `polar.origin` 引用时 boundaryPoint 命中中心。
|
|
23
24
|
*/
|
|
24
|
-
var zeroSizeRectAt = (id, [cx, cy]) => ({
|
|
25
|
+
var zeroSizeRectAt = (id, [cx, cy], shapes) => ({
|
|
25
26
|
id,
|
|
26
27
|
shapeName: "rectangle",
|
|
27
|
-
shapeDef:
|
|
28
|
+
shapeDef: shapes.rectangle,
|
|
28
29
|
rect: {
|
|
29
30
|
x: cx,
|
|
30
31
|
y: cy,
|
|
@@ -39,21 +40,21 @@ var zeroSizeRectAt = (id, [cx, cy]) => ({
|
|
|
39
40
|
align: "middle",
|
|
40
41
|
lineHeight: 0,
|
|
41
42
|
fontSize: 0,
|
|
42
|
-
shapes
|
|
43
|
+
shapes
|
|
43
44
|
});
|
|
44
45
|
/**
|
|
45
46
|
* 把 coordinate 注册成 0×0 NodeLayout
|
|
46
47
|
* @description 让后续 path target / `at.of` 引用时 boundaryPoint 命中中心,符合"占位无形状边界"语义
|
|
47
48
|
*/
|
|
48
|
-
var coordinateAsLayout = (id, center) => zeroSizeRectAt(id, center);
|
|
49
|
+
var coordinateAsLayout = (id, center, shapes) => zeroSizeRectAt(id, center, shapes);
|
|
49
50
|
/**
|
|
50
51
|
* scope.id 入场时的临时占位 NodeLayout
|
|
51
52
|
* @description scope 子树尚未处理时先放 0×0 占位(落在 scope 局部原点经累积 chain 投到全局的位置),
|
|
52
53
|
* 让 scope 子树内任何 lookup 不返回 undefined(占位语义自洽)。
|
|
53
54
|
* 子树 Pass 1 处理完毕后由 `registerScopeAsLayout` 算出真 bbox layout 覆盖此占位(NameStack.replaceLayout 不发 duplicate warn)
|
|
54
55
|
*/
|
|
55
|
-
var scopePlaceholderLayout = (id, chain) => {
|
|
56
|
-
return zeroSizeRectAt(id, chain.length === 0 ? [0, 0] : applyTransformChain([0, 0], chain));
|
|
56
|
+
var scopePlaceholderLayout = (id, chain, shapes) => {
|
|
57
|
+
return zeroSizeRectAt(id, chain.length === 0 ? [0, 0] : applyTransformChain([0, 0], chain), shapes);
|
|
57
58
|
};
|
|
58
59
|
/**
|
|
59
60
|
* 显式 viewBox → Scene.layout(finite 守卫 + round)
|
|
@@ -93,7 +94,7 @@ var assertFiniteLayout = (layout) => {
|
|
|
93
94
|
*/
|
|
94
95
|
var defaultWarnDispatcher = (warning) => {
|
|
95
96
|
if (typeof process !== "undefined" && process.env.NODE_ENV === "production") return;
|
|
96
|
-
console.warn(
|
|
97
|
+
console.warn(formatCompileWarning(warning));
|
|
97
98
|
};
|
|
98
99
|
/**
|
|
99
100
|
* 校验 animation tracks 的 viewBox⇔根 约束(schema 上下文无关、分不清元素 vs 根,故在此 compile 层做)
|
|
@@ -105,7 +106,7 @@ var filterAnimations = (tracks, context, onWarn, irPath) => {
|
|
|
105
106
|
const isViewBox = track.property === "viewBox";
|
|
106
107
|
if (!(context === "root" ? isViewBox : !isViewBox)) {
|
|
107
108
|
onWarn({
|
|
108
|
-
code:
|
|
109
|
+
code: CompileWarningCode.AnimationInvalidProperty,
|
|
109
110
|
message: context === "root" ? `Scene-root animation must use the "viewBox" property (camera); got "${track.property}". Track dropped.` : `Animation property "viewBox" is camera-only (scene root), not valid on an element. Track dropped.`,
|
|
110
111
|
path: `${irPath}.animations[${index}]`
|
|
111
112
|
});
|
|
@@ -127,14 +128,14 @@ var collectPlaceholderLocators = (prims, prefix = "primitives") => {
|
|
|
127
128
|
});
|
|
128
129
|
return locators;
|
|
129
130
|
};
|
|
130
|
-
/**
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
/** 据**实际解析失败**的那个 transform 的成因映射 warn code(由 lowerScopeTransforms 的 onUnresolved 回调给出) */
|
|
132
|
+
var transformWarnCode = (failed) => {
|
|
133
|
+
switch (failed?.kind) {
|
|
134
|
+
case "offset-translate": return CompileWarningCode.OffsetBaseUnresolved;
|
|
135
|
+
case "at-translate": return CompileWarningCode.AtTargetUnresolved;
|
|
136
|
+
case "polar-translate": return CompileWarningCode.PolarOriginUnresolved;
|
|
137
|
+
default: return CompileWarningCode.UnresolvedNodeReference;
|
|
136
138
|
}
|
|
137
|
-
return "UNRESOLVED_NODE_REFERENCE";
|
|
138
139
|
};
|
|
139
140
|
/** 把 DuplicateRegisterInfo 翻成 CompileWarning(含可读 message + 双 IR locator) */
|
|
140
141
|
var formatDuplicateWarning = (info) => {
|
|
@@ -142,19 +143,19 @@ var formatDuplicateWarning = (info) => {
|
|
|
142
143
|
const firstLoc = info.firstIrPath ?? "(unknown earlier location)";
|
|
143
144
|
const secondLoc = info.secondIrPath ?? "(unknown current location)";
|
|
144
145
|
return {
|
|
145
|
-
code:
|
|
146
|
+
code: CompileWarningCode.DuplicateNodeId,
|
|
146
147
|
message: `Duplicate id '${info.id}' registered in the same namespace frame (${frameNote}); first defined at ${firstLoc}, redefined at ${secondLoc}. The later definition overrides the earlier one (last-wins).`,
|
|
147
148
|
path: secondLoc
|
|
148
149
|
};
|
|
149
150
|
};
|
|
150
151
|
/**
|
|
151
152
|
* IR → Scene 纯函数转换,所有 adapter 共享
|
|
152
|
-
* @description Pass 1 递归处理 node / coordinate / scope,把 scope 树下沉为嵌套 GroupPrim;scope.transforms 中的
|
|
153
|
+
* @description Pass 1 递归处理 node / coordinate / scope,把 scope 树下沉为嵌套 GroupPrim;scope.transforms 中的 5 种 translate 变体按 lowerScopeTransforms 展平为 Cartesian transform;node 在 Scene primitive 树里是局部坐标 + GroupPrim transform 链、在 NameStack 中存全局坐标供其他节点 / path 引用。NameStack 用栈式 frame 管理命名空间:默认全局扁平、`<Scope localNamespace>` 推入子 frame;scope.id 始终在父 frame 注册(外部句柄);id lookup 从栈顶向栈底 inside-out 搜索;同 frame 重复 id 触发 DUPLICATE_NODE_ID warn + 后定义覆盖前定义。Pass 2 解析 path 端点写 d 字符串,path primitive 发到 Pass 1 记录的对应容器;末端按 precision 折算 layout
|
|
153
154
|
*/
|
|
154
155
|
var compileToScene = (ir, options = {}) => {
|
|
155
156
|
const measureText = options.measureText ?? fallbackMeasurer;
|
|
156
157
|
const layoutPadding = options.padding ?? 10;
|
|
157
|
-
const round =
|
|
158
|
+
const round = createRound(options.precision ?? 2);
|
|
158
159
|
const nodeDistance = options.nodeDistance;
|
|
159
160
|
const onWarn = options.onWarn ?? defaultWarnDispatcher;
|
|
160
161
|
const loweredIr = lowerComposites(ir, options.composites ?? [], {
|
|
@@ -167,7 +168,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
167
168
|
} : BUILTIN_SHAPES;
|
|
168
169
|
if (options.shapes) {
|
|
169
170
|
for (const name of Object.keys(options.shapes)) if (Object.prototype.hasOwnProperty.call(BUILTIN_SHAPES, name)) onWarn({
|
|
170
|
-
code:
|
|
171
|
+
code: CompileWarningCode.ShapeOverridesBuiltin,
|
|
171
172
|
message: `Injected shape '${name}' overrides the built-in shape of the same name.`,
|
|
172
173
|
path: `options.shapes.${name}`
|
|
173
174
|
});
|
|
@@ -179,7 +180,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
179
180
|
} : BUILTIN_ARROWS;
|
|
180
181
|
if (options.arrows) {
|
|
181
182
|
for (const name of Object.keys(options.arrows)) if (Object.prototype.hasOwnProperty.call(BUILTIN_ARROWS, name)) onWarn({
|
|
182
|
-
code:
|
|
183
|
+
code: CompileWarningCode.ArrowOverridesBuiltin,
|
|
183
184
|
message: `Injected arrow '${name}' overrides the built-in arrow of the same name.`,
|
|
184
185
|
path: `options.arrows.${name}`
|
|
185
186
|
});
|
|
@@ -190,7 +191,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
190
191
|
} : BUILTIN_PATTERNS;
|
|
191
192
|
if (options.patterns) {
|
|
192
193
|
for (const name of Object.keys(options.patterns)) if (Object.prototype.hasOwnProperty.call(BUILTIN_PATTERNS, name)) onWarn({
|
|
193
|
-
code:
|
|
194
|
+
code: CompileWarningCode.PatternOverridesBuiltin,
|
|
194
195
|
message: `Injected pattern '${name}' overrides the built-in pattern of the same name.`,
|
|
195
196
|
path: `options.patterns.${name}`
|
|
196
197
|
});
|
|
@@ -259,7 +260,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
259
260
|
};
|
|
260
261
|
/**
|
|
261
262
|
* 递归处理一组 IR child,把 node / coordinate 发到 sink、把本层 path 收集到 pathsAccumulator、scope 下沉为 GroupPrim
|
|
262
|
-
* @description **不**在内部 resolve pathsAccumulator——调用方负责在合适时机(scope 入口:bbox replaceLayout 之后 / popFrame 之前;顶层:所有处理结束后)调用 resolvePendingPaths。这样 scope.id 的 placeholder→real bbox 替换在本层 path 端点 lookup 之前完成,避免 "scope 内 path 自引用本 scope.id 拿到 placeholder" 的 latent bug,同时保留
|
|
263
|
+
* @description **不**在内部 resolve pathsAccumulator——调用方负责在合适时机(scope 入口:bbox replaceLayout 之后 / popFrame 之前;顶层:所有处理结束后)调用 resolvePendingPaths。这样 scope.id 的 placeholder→real bbox 替换在本层 path 端点 lookup 之前完成,避免 "scope 内 path 自引用本 scope.id 拿到 placeholder" 的 latent bug,同时保留"本层 path 在本层 frame 还在栈顶时 resolve"的 inside-out lookup 语义。
|
|
263
264
|
* @param children 当前层级的 IR child 数组
|
|
264
265
|
* @param chain 从根到当前层级累积的 Cartesian-only transform 链
|
|
265
266
|
* @param sink 当前层级 Scene primitive 落点(顶层 = primitives,scope 内 = GroupPrim.children)
|
|
@@ -284,34 +285,36 @@ var compileToScene = (ir, options = {}) => {
|
|
|
284
285
|
sink.push(prim);
|
|
285
286
|
if (child.zIndex !== void 0) zIndexOf.set(prim, child.zIndex);
|
|
286
287
|
}
|
|
287
|
-
|
|
288
|
+
const outerRect = outerRectOf(globalLayout);
|
|
289
|
+
allPoints.push(rect.anchor(outerRect, "north-west"), rect.anchor(outerRect, "north-east"), rect.anchor(outerRect, "south-west"), rect.anchor(outerRect, "south-east"));
|
|
288
290
|
for (const p of labelExtentPoints(globalLayout)) allPoints.push(p);
|
|
289
291
|
layoutsAccumulator.push(globalLayout);
|
|
290
292
|
} else if (child.type === "coordinate") {
|
|
291
293
|
const localCenter = resolvePosition(child.position, nameStack, nodeDistance, chain, refPointOfTarget);
|
|
292
|
-
if (!localCenter) {
|
|
293
|
-
onWarn({
|
|
294
|
-
code: "POLAR_ORIGIN_UNRESOLVED",
|
|
295
|
-
message: `Cannot resolve position for coordinate '${child.id}'; polar.origin or at.of may reference an undefined node`,
|
|
296
|
-
path: `${locatorPrefix}children[${i}].coordinate.position`
|
|
297
|
-
});
|
|
298
|
-
throw new Error(`Cannot resolve position for coordinate ${child.id}; polar.origin or at.of may reference an undefined node`);
|
|
299
|
-
}
|
|
294
|
+
if (!localCenter) throw new Error(`Cannot resolve position for coordinate ${child.id}; polar.origin or at.of may reference an undefined node`);
|
|
300
295
|
const globalCenter = chain.length === 0 ? localCenter : applyTransformChain(localCenter, chain);
|
|
301
|
-
const coordLayout = coordinateAsLayout(child.id, globalCenter);
|
|
296
|
+
const coordLayout = coordinateAsLayout(child.id, globalCenter, effectiveShapes);
|
|
302
297
|
nameStack.register(child.id, coordLayout, `${locatorPrefix}children[${i}].coordinate.id`);
|
|
303
298
|
layoutsAccumulator.push(coordLayout);
|
|
304
299
|
} else if (child.type === "scope") {
|
|
305
|
-
const
|
|
300
|
+
const rawTransforms = child.transforms ?? [];
|
|
301
|
+
let failedTransform;
|
|
302
|
+
const loweredOwn = lowerScopeTransforms(rawTransforms, nameStack, nodeDistance, refPointOfTarget, (t) => {
|
|
303
|
+
failedTransform = t;
|
|
304
|
+
});
|
|
306
305
|
if (loweredOwn === null) onWarn({
|
|
307
|
-
code:
|
|
308
|
-
message: `Cannot resolve one of scope.transforms; referent (at.of / offset.of / polar.origin) is undefined or defined later in the IR`,
|
|
306
|
+
code: transformWarnCode(failedTransform),
|
|
307
|
+
message: `Cannot resolve one of scope.transforms; referent (at.of / offset.of / polar.origin / between endpoints) is undefined or defined later in the IR`,
|
|
309
308
|
path: `${locatorPrefix}children[${i}].scope.transforms`
|
|
310
309
|
});
|
|
311
310
|
const ownTransforms = loweredOwn ?? [];
|
|
312
311
|
const innerChain = [...chain, ...ownTransforms];
|
|
313
312
|
const parentFrameDepth = nameStack.depth - 1;
|
|
314
|
-
|
|
313
|
+
let placeholderLayout;
|
|
314
|
+
if (child.id) {
|
|
315
|
+
placeholderLayout = scopePlaceholderLayout(child.id, innerChain, effectiveShapes);
|
|
316
|
+
nameStack.register(child.id, placeholderLayout, `${locatorPrefix}children[${i}].scope.id`);
|
|
317
|
+
}
|
|
315
318
|
const pushedFrame = child.localNamespace === true;
|
|
316
319
|
if (pushedFrame) nameStack.pushFrame();
|
|
317
320
|
const innerSink = [];
|
|
@@ -321,12 +324,12 @@ var compileToScene = (ir, options = {}) => {
|
|
|
321
324
|
* 让 scope 内 path 自引用本 scope.id 端点取真 bbox 而非 placeholder */
|
|
322
325
|
const innerPaths = [];
|
|
323
326
|
try {
|
|
324
|
-
processChildren(child.children, innerChain, innerSink, `${locatorPrefix}children[${i}].scope.`, innerLayouts, innerPaths, [...styleStack,
|
|
327
|
+
processChildren(child.children, innerChain, innerSink, `${locatorPrefix}children[${i}].scope.`, innerLayouts, innerPaths, [...styleStack, createStyleFrame(child)]);
|
|
325
328
|
if (child.id) {
|
|
326
329
|
const bbox = computeScopeBoundingBox(innerLayouts);
|
|
327
330
|
const fallbackOrigin = innerChain.length === 0 ? [0, 0] : applyTransformChain([0, 0], innerChain);
|
|
328
|
-
const bboxLayout = registerScopeAsLayout(child.id, bbox, fallbackOrigin);
|
|
329
|
-
nameStack.replaceLayout(child.id, bboxLayout, parentFrameDepth);
|
|
331
|
+
const bboxLayout = registerScopeAsLayout(child.id, bbox, fallbackOrigin, effectiveShapes);
|
|
332
|
+
nameStack.replaceLayout(child.id, bboxLayout, parentFrameDepth, placeholderLayout);
|
|
330
333
|
layoutsAccumulator.push(bboxLayout);
|
|
331
334
|
} else for (const innerLayout of innerLayouts) layoutsAccumulator.push(innerLayout);
|
|
332
335
|
resolvePendingPaths(innerPaths);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompositeDefinition } from '../composites';
|
|
2
2
|
import { IR } from '../ir';
|
|
3
|
-
import { CompileWarning } from './
|
|
3
|
+
import { CompileWarning } from './constant';
|
|
4
4
|
/** composite 嵌套展开的默认最大深度(防环 / 防失控递归);可经 CompileOptions.maxCompositeDepth 覆盖 */
|
|
5
5
|
export declare const DEFAULT_MAX_COMPOSITE_DEPTH = 32;
|
|
6
6
|
type LowerOptions = {
|
|
@@ -13,7 +13,14 @@ type LowerOptions = {
|
|
|
13
13
|
* 查表 → `schema.parse(node)` 精确校验 + 强类型 → `expand` → 递归展开产物 fixpoint),否则 tier1(scope 递归
|
|
14
14
|
* children)。未注册 → `onWarn(COMPOSITE_NOT_REGISTERED)` + 跳过该节点(不进 Scene),继续编译其余;
|
|
15
15
|
* 环 / 超 `maxDepth` → throw(死循环防护)。无 tier2 节点时等价于原样返回。
|
|
16
|
+
*
|
|
17
|
+
* **注册表策略差异(有意,非疏漏)**:composite 以 `Array<CompositeDefinition>` 注入,可能重复,故重名
|
|
18
|
+
* **throw**(结构上无法天然去重,撞名是调用方错误);未注册走 **warn + skip**——composite 是高层节点,
|
|
19
|
+
* 缺对应包时跳过它仍能渲染其余图元,优雅降级优于整图崩。相对地,shape / arrow / pattern 以 `Record` 注入
|
|
20
|
+
* (key 天然去重,无重名可言),同名覆盖内置走 **warn + last-wins**(覆盖是合法定制);未注册名走 **throw**
|
|
21
|
+
* ——这些是"定位 / 布局类"基元,节点引用了不存在的 shape 根本无法布局,必须 fail-fast。两类策略按"数据结构
|
|
22
|
+
* + 语义分层"区分,不强行统一。
|
|
16
23
|
*/
|
|
17
24
|
export declare const lowerComposites: (ir: IR, composites: Array<CompositeDefinition>, options: LowerOptions) => IR;
|
|
18
25
|
export {};
|
|
19
|
-
//# sourceMappingURL=
|
|
26
|
+
//# sourceMappingURL=composite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composite.d.ts","sourceRoot":"","sources":["../../../src/compile/composite.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAE,EAAE,EAAW,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C,KAAK,YAAY,GAAG;IAClB,MAAM,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAoBF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,eAAe,GAC1B,IAAI,EAAE,EACN,YAAY,KAAK,CAAC,mBAAmB,CAAC,EACtC,SAAS,YAAY,KACpB,EA8CF,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CompileWarningCode } from "./constant.js";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
/**
|
|
3
4
|
* 从注册项的 schema 提取 `namespace` / `type` 的 literal 值(建表 key)
|
|
@@ -21,6 +22,13 @@ var extractKey = (schema) => {
|
|
|
21
22
|
* 查表 → `schema.parse(node)` 精确校验 + 强类型 → `expand` → 递归展开产物 fixpoint),否则 tier1(scope 递归
|
|
22
23
|
* children)。未注册 → `onWarn(COMPOSITE_NOT_REGISTERED)` + 跳过该节点(不进 Scene),继续编译其余;
|
|
23
24
|
* 环 / 超 `maxDepth` → throw(死循环防护)。无 tier2 节点时等价于原样返回。
|
|
25
|
+
*
|
|
26
|
+
* **注册表策略差异(有意,非疏漏)**:composite 以 `Array<CompositeDefinition>` 注入,可能重复,故重名
|
|
27
|
+
* **throw**(结构上无法天然去重,撞名是调用方错误);未注册走 **warn + skip**——composite 是高层节点,
|
|
28
|
+
* 缺对应包时跳过它仍能渲染其余图元,优雅降级优于整图崩。相对地,shape / arrow / pattern 以 `Record` 注入
|
|
29
|
+
* (key 天然去重,无重名可言),同名覆盖内置走 **warn + last-wins**(覆盖是合法定制);未注册名走 **throw**
|
|
30
|
+
* ——这些是"定位 / 布局类"基元,节点引用了不存在的 shape 根本无法布局,必须 fail-fast。两类策略按"数据结构
|
|
31
|
+
* + 语义分层"区分,不强行统一。
|
|
24
32
|
*/
|
|
25
33
|
var lowerComposites = (ir, composites, options) => {
|
|
26
34
|
const { onWarn, maxDepth = 32 } = options;
|
|
@@ -38,7 +46,7 @@ var lowerComposites = (ir, composites, options) => {
|
|
|
38
46
|
const definition = registry.get(key);
|
|
39
47
|
if (!definition) {
|
|
40
48
|
onWarn({
|
|
41
|
-
code:
|
|
49
|
+
code: CompileWarningCode.CompositeNotRegistered,
|
|
42
50
|
message: `No composite registered for '${key}'; the node is skipped.`,
|
|
43
51
|
path
|
|
44
52
|
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ValueOf } from '../types';
|
|
2
|
+
/** 编译期 warning code(机器可读)。 */
|
|
3
|
+
export declare const CompileWarningCode: {
|
|
4
|
+
readonly UnresolvedNodeReference: "UNRESOLVED_NODE_REFERENCE";
|
|
5
|
+
readonly PathTooShort: "PATH_TOO_SHORT";
|
|
6
|
+
readonly OffsetBaseUnresolved: "OFFSET_BASE_UNRESOLVED";
|
|
7
|
+
readonly PolarOriginUnresolved: "POLAR_ORIGIN_UNRESOLVED";
|
|
8
|
+
readonly AtTargetUnresolved: "AT_TARGET_UNRESOLVED";
|
|
9
|
+
readonly DuplicateNodeId: "DUPLICATE_NODE_ID";
|
|
10
|
+
readonly ShapeOverridesBuiltin: "SHAPE_OVERRIDES_BUILTIN";
|
|
11
|
+
readonly ArrowOverridesBuiltin: "ARROW_OVERRIDES_BUILTIN";
|
|
12
|
+
readonly PatternOverridesBuiltin: "PATTERN_OVERRIDES_BUILTIN";
|
|
13
|
+
readonly CompositeNotRegistered: "COMPOSITE_NOT_REGISTERED";
|
|
14
|
+
readonly AnimationInvalidProperty: "ANIMATION_INVALID_PROPERTY";
|
|
15
|
+
readonly ArcMissingRadius: "ARC_MISSING_RADIUS";
|
|
16
|
+
readonly PartialArcNeedsBothAngles: "PARTIAL_ARC_NEEDS_BOTH_ANGLES";
|
|
17
|
+
readonly PartialArcClosedInvalid: "PARTIAL_ARC_CLOSED_INVALID";
|
|
18
|
+
};
|
|
19
|
+
export type CompileWarningCodeValue = ValueOf<typeof CompileWarningCode> | (string & {});
|
|
20
|
+
/** 编译期 warning:不影响 Scene 产物,交给调用方收集或展示。 */
|
|
21
|
+
export type CompileWarning = {
|
|
22
|
+
/** 机器可读 warning code。 */
|
|
23
|
+
code: CompileWarningCodeValue;
|
|
24
|
+
/** 人类可读消息(英文)。 */
|
|
25
|
+
message: string;
|
|
26
|
+
/** IR locator 路径(jq-like),如 `children[3].path.children[1].to`。 */
|
|
27
|
+
path: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const formatCompileWarning: (warning: CompileWarning) => string;
|
|
30
|
+
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../src/compile/constant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAExC,8BAA8B;AAC9B,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;CAerB,CAAC;AAEX,MAAM,MAAM,uBAAuB,GAC/B,OAAO,CAAC,OAAO,kBAAkB,CAAC,GAClC,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB,2CAA2C;AAC3C,MAAM,MAAM,cAAc,GAAG;IAC3B,yBAAyB;IACzB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,cAAc,KAAG,MACI,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/compile/constant.ts
|
|
2
|
+
/** 编译期 warning code(机器可读)。 */
|
|
3
|
+
var CompileWarningCode = {
|
|
4
|
+
UnresolvedNodeReference: "UNRESOLVED_NODE_REFERENCE",
|
|
5
|
+
PathTooShort: "PATH_TOO_SHORT",
|
|
6
|
+
OffsetBaseUnresolved: "OFFSET_BASE_UNRESOLVED",
|
|
7
|
+
PolarOriginUnresolved: "POLAR_ORIGIN_UNRESOLVED",
|
|
8
|
+
AtTargetUnresolved: "AT_TARGET_UNRESOLVED",
|
|
9
|
+
DuplicateNodeId: "DUPLICATE_NODE_ID",
|
|
10
|
+
ShapeOverridesBuiltin: "SHAPE_OVERRIDES_BUILTIN",
|
|
11
|
+
ArrowOverridesBuiltin: "ARROW_OVERRIDES_BUILTIN",
|
|
12
|
+
PatternOverridesBuiltin: "PATTERN_OVERRIDES_BUILTIN",
|
|
13
|
+
CompositeNotRegistered: "COMPOSITE_NOT_REGISTERED",
|
|
14
|
+
AnimationInvalidProperty: "ANIMATION_INVALID_PROPERTY",
|
|
15
|
+
ArcMissingRadius: "ARC_MISSING_RADIUS",
|
|
16
|
+
PartialArcNeedsBothAngles: "PARTIAL_ARC_NEEDS_BOTH_ANGLES",
|
|
17
|
+
PartialArcClosedInvalid: "PARTIAL_ARC_CLOSED_INVALID"
|
|
18
|
+
};
|
|
19
|
+
var formatCompileWarning = (warning) => `[retikz] ${warning.code} at ${warning.path}: ${warning.message}`;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { CompileWarningCode, formatCompileWarning };
|