@retikz/core 0.3.0-alpha.4 → 0.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/arrows/define.d.ts +9 -0
- package/dist/es/arrows/define.d.ts.map +1 -0
- package/dist/es/arrows/define.js +10 -0
- package/dist/es/arrows/index.d.ts +3 -1
- package/dist/es/arrows/index.d.ts.map +1 -1
- package/dist/es/arrows/index.js +14 -1
- package/dist/es/arrows/types.d.ts +4 -2
- package/dist/es/arrows/types.d.ts.map +1 -1
- package/dist/es/compile/anchor-cache.d.ts +3 -3
- package/dist/es/compile/anchor-cache.d.ts.map +1 -1
- package/dist/es/compile/anchor-cache.js +18 -5
- package/dist/es/compile/compile.d.ts +5 -14
- package/dist/es/compile/compile.d.ts.map +1 -1
- package/dist/es/compile/compile.js +73 -41
- package/dist/es/compile/{lowerComposites.d.ts → composite.d.ts} +9 -2
- package/dist/es/compile/composite.d.ts.map +1 -0
- package/dist/es/compile/{lowerComposites.js → composite.js} +9 -1
- package/dist/es/compile/constant.d.ts +32 -0
- package/dist/es/compile/constant.d.ts.map +1 -0
- package/dist/es/compile/constant.js +23 -0
- package/dist/es/compile/direction.d.ts +27 -0
- package/dist/es/compile/direction.d.ts.map +1 -0
- package/dist/es/compile/direction.js +30 -0
- package/dist/es/compile/index.d.ts +3 -1
- package/dist/es/compile/index.d.ts.map +1 -1
- package/dist/es/compile/name-stack.d.ts +3 -1
- package/dist/es/compile/name-stack.d.ts.map +1 -1
- package/dist/es/compile/name-stack.js +5 -1
- package/dist/es/compile/node.d.ts +20 -7
- package/dist/es/compile/node.d.ts.map +1 -1
- package/dist/es/compile/node.js +42 -63
- package/dist/es/compile/paint.js +1 -1
- package/dist/es/compile/path/anchor.d.ts +4 -3
- package/dist/es/compile/path/anchor.d.ts.map +1 -1
- package/dist/es/compile/path/anchor.js +9 -12
- package/dist/es/compile/path/index.d.ts +6 -8
- package/dist/es/compile/path/index.d.ts.map +1 -1
- package/dist/es/compile/path/index.js +59 -34
- package/dist/es/compile/path/relative.d.ts +1 -1
- package/dist/es/compile/path/relative.js +1 -1
- package/dist/es/compile/path/shrink.d.ts +3 -1
- package/dist/es/compile/path/shrink.d.ts.map +1 -1
- package/dist/es/compile/path/shrink.js +16 -11
- package/dist/es/compile/position.d.ts +2 -2
- package/dist/es/compile/position.d.ts.map +1 -1
- package/dist/es/compile/position.js +6 -19
- package/dist/es/compile/precision.d.ts +1 -1
- package/dist/es/compile/precision.d.ts.map +1 -1
- package/dist/es/compile/precision.js +2 -2
- package/dist/es/compile/scope.d.ts +7 -5
- package/dist/es/compile/scope.d.ts.map +1 -1
- package/dist/es/compile/scope.js +29 -13
- package/dist/es/compile/style.d.ts +2 -2
- package/dist/es/compile/style.d.ts.map +1 -1
- package/dist/es/compile/style.js +2 -2
- package/dist/es/composites/define.d.ts +8 -0
- package/dist/es/composites/define.d.ts.map +1 -0
- package/dist/es/composites/{types.js → define.js} +2 -2
- package/dist/es/composites/index.d.ts +1 -1
- package/dist/es/composites/index.d.ts.map +1 -1
- package/dist/es/composites/types.d.ts +0 -6
- package/dist/es/composites/types.d.ts.map +1 -1
- package/dist/es/geometry/anchor.d.ts +33 -0
- package/dist/es/geometry/anchor.d.ts.map +1 -0
- package/dist/es/geometry/anchor.js +45 -0
- package/dist/es/geometry/bend.d.ts +1 -1
- package/dist/es/geometry/bend.js +2 -2
- package/dist/es/geometry/circle.d.ts +4 -4
- package/dist/es/geometry/circle.d.ts.map +1 -1
- package/dist/es/geometry/circle.js +3 -3
- package/dist/es/geometry/{roundedContour.d.ts → contour.d.ts} +4 -5
- package/dist/es/geometry/contour.d.ts.map +1 -0
- package/dist/es/geometry/{roundedContour.js → contour.js} +22 -34
- package/dist/es/geometry/diamond.d.ts +3 -3
- package/dist/es/geometry/diamond.d.ts.map +1 -1
- package/dist/es/geometry/diamond.js +2 -2
- package/dist/{lib/geometry/_edge.d.ts → es/geometry/edge.d.ts} +1 -1
- package/dist/es/geometry/edge.d.ts.map +1 -0
- package/dist/es/geometry/{_edge.js → edge.js} +1 -1
- package/dist/es/geometry/ellipse.d.ts +3 -3
- package/dist/es/geometry/ellipse.d.ts.map +1 -1
- package/dist/es/geometry/ellipse.js +2 -2
- package/dist/es/geometry/index.d.ts +2 -1
- package/dist/es/geometry/index.d.ts.map +1 -1
- package/dist/es/geometry/point.d.ts +6 -0
- package/dist/es/geometry/point.d.ts.map +1 -1
- package/dist/es/geometry/point.js +17 -0
- package/dist/es/geometry/rect.d.ts +4 -17
- package/dist/es/geometry/rect.d.ts.map +1 -1
- package/dist/es/geometry/rect.js +4 -16
- package/dist/es/geometry/segment.d.ts.map +1 -1
- package/dist/es/geometry/segment.js +25 -47
- package/dist/{lib/geometry/_transform.d.ts → es/geometry/transform.d.ts} +1 -1
- package/dist/es/geometry/transform.d.ts.map +1 -0
- package/dist/es/geometry/{_transform.js → transform.js} +1 -1
- package/dist/es/index.d.ts +13 -10
- package/dist/es/index.d.ts.map +1 -1
- package/dist/es/index.js +19 -14
- package/dist/es/ir/animation.d.ts +219 -0
- package/dist/es/ir/animation.d.ts.map +1 -0
- package/dist/es/ir/animation.js +118 -0
- package/dist/es/ir/boundary.d.ts +1 -1
- package/dist/es/ir/boundary.d.ts.map +1 -1
- package/dist/es/ir/coordinate.d.ts +8 -8
- package/dist/es/ir/index.d.ts +1 -0
- package/dist/es/ir/index.d.ts.map +1 -1
- package/dist/es/ir/node.d.ts +249 -92
- package/dist/es/ir/node.d.ts.map +1 -1
- package/dist/es/ir/node.js +25 -23
- package/dist/es/ir/paint.d.ts +19 -18
- package/dist/es/ir/paint.d.ts.map +1 -1
- package/dist/es/ir/paint.js +10 -10
- package/dist/es/ir/path/arrow.d.ts +39 -38
- 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 +1106 -209
- package/dist/es/ir/path/path.d.ts.map +1 -1
- package/dist/es/ir/path/path.js +3 -1
- package/dist/es/ir/path/step.d.ts +932 -20
- package/dist/es/ir/path/step.d.ts.map +1 -1
- package/dist/es/ir/path/step.js +73 -22
- package/dist/es/ir/path/target.js +3 -3
- package/dist/es/ir/position/at-position.d.ts +18 -18
- package/dist/es/ir/position/at-position.d.ts.map +1 -1
- package/dist/es/ir/position/at-position.js +11 -11
- package/dist/es/ir/scene.d.ts +156 -0
- package/dist/es/ir/scene.d.ts.map +1 -1
- package/dist/es/ir/scene.js +3 -1
- package/dist/es/ir/scope.d.ts +3446 -1306
- package/dist/es/ir/scope.d.ts.map +1 -1
- package/dist/es/ir/scope.js +10 -6
- package/dist/es/ir/transform.d.ts +44 -17
- package/dist/es/ir/transform.d.ts.map +1 -1
- package/dist/es/ir/transform.js +10 -3
- package/dist/es/parsers/index.d.ts +3 -3
- package/dist/es/parsers/index.d.ts.map +1 -1
- package/dist/es/parsers/{parseNodeTarget.d.ts → node-target.d.ts} +1 -1
- package/dist/es/parsers/node-target.d.ts.map +1 -0
- package/dist/es/parsers/{parseNodeTarget.js → node-target.js} +10 -8
- package/dist/{lib/parsers/parseTargetSugar.d.ts → es/parsers/target-sugar.d.ts} +1 -1
- package/dist/es/parsers/target-sugar.d.ts.map +1 -0
- package/dist/es/parsers/{parseTargetSugar.js → target-sugar.js} +9 -4
- package/dist/{lib/parsers/parseWay.d.ts → es/parsers/way.d.ts} +1 -1
- package/dist/es/parsers/way.d.ts.map +1 -0
- package/dist/es/parsers/{parseWay.js → way.js} +9 -5
- package/dist/es/path-generators/define.d.ts.map +1 -0
- package/dist/es/{pathGenerators → path-generators}/define.js +1 -1
- package/dist/es/path-generators/index.d.ts.map +1 -0
- package/dist/es/path-generators/types.d.ts.map +1 -0
- package/dist/es/patterns/define.d.ts +9 -0
- package/dist/es/patterns/define.d.ts.map +1 -0
- package/dist/es/patterns/define.js +10 -0
- package/dist/es/patterns/index.d.ts +1 -0
- package/dist/es/patterns/index.d.ts.map +1 -1
- package/dist/es/patterns/index.js +42 -35
- package/dist/es/presets/animation.d.ts +123 -0
- package/dist/es/presets/animation.d.ts.map +1 -0
- package/dist/es/presets/animation.js +272 -0
- package/dist/es/presets/index.d.ts +3 -0
- package/dist/es/presets/index.d.ts.map +1 -0
- package/dist/es/primitive/ellipse.d.ts +3 -0
- package/dist/es/primitive/ellipse.d.ts.map +1 -1
- package/dist/es/primitive/group.d.ts +3 -0
- package/dist/es/primitive/group.d.ts.map +1 -1
- package/dist/es/primitive/marker.d.ts +1 -1
- package/dist/es/primitive/paint.d.ts +1 -1
- package/dist/es/primitive/path.d.ts +4 -1
- package/dist/es/primitive/path.d.ts.map +1 -1
- package/dist/es/primitive/rect.d.ts +3 -0
- package/dist/es/primitive/rect.d.ts.map +1 -1
- package/dist/es/primitive/scene.d.ts +3 -0
- package/dist/es/primitive/scene.d.ts.map +1 -1
- package/dist/es/primitive/text.d.ts +3 -0
- package/dist/es/primitive/text.d.ts.map +1 -1
- package/dist/es/shapes/arc.js +2 -2
- package/dist/{lib/shapes/_contour.d.ts → es/shapes/contour.d.ts} +6 -3
- package/dist/es/shapes/contour.d.ts.map +1 -0
- package/dist/es/shapes/{_contour.js → contour.js} +14 -2
- package/dist/es/shapes/ellipse.js +2 -2
- package/dist/es/shapes/index.d.ts +1 -1
- package/dist/es/shapes/index.d.ts.map +1 -1
- package/dist/es/shapes/index.js +1 -1
- package/dist/es/shapes/polygon.d.ts +1 -1
- package/dist/es/shapes/polygon.d.ts.map +1 -1
- package/dist/es/shapes/polygon.js +26 -21
- package/dist/es/shapes/rectangle.js +5 -5
- package/dist/es/shapes/sector.d.ts.map +1 -1
- package/dist/es/shapes/sector.js +30 -22
- package/dist/es/shapes/{_shared.d.ts → shared.d.ts} +4 -8
- package/dist/es/shapes/shared.d.ts.map +1 -0
- package/dist/es/shapes/{_shared.js → shared.js} +8 -12
- package/dist/es/shapes/star.d.ts.map +1 -1
- package/dist/es/shapes/star.js +4 -14
- package/dist/lib/arrows/define.cjs +10 -0
- package/dist/lib/arrows/define.d.ts +9 -0
- package/dist/lib/arrows/define.d.ts.map +1 -0
- package/dist/lib/arrows/index.cjs +14 -1
- package/dist/lib/arrows/index.d.ts +3 -1
- package/dist/lib/arrows/index.d.ts.map +1 -1
- package/dist/lib/arrows/types.d.ts +4 -2
- package/dist/lib/arrows/types.d.ts.map +1 -1
- package/dist/lib/compile/anchor-cache.cjs +17 -4
- package/dist/lib/compile/anchor-cache.d.ts +3 -3
- package/dist/lib/compile/anchor-cache.d.ts.map +1 -1
- package/dist/lib/compile/compile.cjs +71 -39
- package/dist/lib/compile/compile.d.ts +5 -14
- package/dist/lib/compile/compile.d.ts.map +1 -1
- package/dist/lib/compile/{lowerComposites.cjs → composite.cjs} +9 -1
- package/dist/lib/compile/{lowerComposites.d.ts → composite.d.ts} +9 -2
- package/dist/lib/compile/composite.d.ts.map +1 -0
- package/dist/lib/compile/constant.cjs +24 -0
- package/dist/lib/compile/constant.d.ts +32 -0
- package/dist/lib/compile/constant.d.ts.map +1 -0
- package/dist/lib/compile/direction.cjs +31 -0
- package/dist/lib/compile/direction.d.ts +27 -0
- package/dist/lib/compile/direction.d.ts.map +1 -0
- package/dist/lib/compile/index.d.ts +3 -1
- package/dist/lib/compile/index.d.ts.map +1 -1
- package/dist/lib/compile/name-stack.cjs +5 -1
- package/dist/lib/compile/name-stack.d.ts +3 -1
- package/dist/lib/compile/name-stack.d.ts.map +1 -1
- package/dist/lib/compile/node.cjs +42 -62
- package/dist/lib/compile/node.d.ts +20 -7
- package/dist/lib/compile/node.d.ts.map +1 -1
- package/dist/lib/compile/paint.cjs +1 -1
- package/dist/lib/compile/path/anchor.cjs +10 -12
- package/dist/lib/compile/path/anchor.d.ts +4 -3
- package/dist/lib/compile/path/anchor.d.ts.map +1 -1
- package/dist/lib/compile/path/index.cjs +58 -33
- package/dist/lib/compile/path/index.d.ts +6 -8
- package/dist/lib/compile/path/index.d.ts.map +1 -1
- package/dist/lib/compile/path/relative.cjs +1 -1
- package/dist/lib/compile/path/relative.d.ts +1 -1
- package/dist/lib/compile/path/shrink.cjs +16 -11
- package/dist/lib/compile/path/shrink.d.ts +3 -1
- package/dist/lib/compile/path/shrink.d.ts.map +1 -1
- package/dist/lib/compile/position.cjs +6 -19
- package/dist/lib/compile/position.d.ts +2 -2
- package/dist/lib/compile/position.d.ts.map +1 -1
- package/dist/lib/compile/precision.cjs +2 -2
- package/dist/lib/compile/precision.d.ts +1 -1
- package/dist/lib/compile/precision.d.ts.map +1 -1
- package/dist/lib/compile/scope.cjs +29 -13
- package/dist/lib/compile/scope.d.ts +7 -5
- package/dist/lib/compile/scope.d.ts.map +1 -1
- package/dist/lib/compile/style.cjs +2 -2
- package/dist/lib/compile/style.d.ts +2 -2
- package/dist/lib/compile/style.d.ts.map +1 -1
- package/dist/lib/composites/{types.cjs → define.cjs} +2 -2
- package/dist/lib/composites/define.d.ts +8 -0
- package/dist/lib/composites/define.d.ts.map +1 -0
- package/dist/lib/composites/index.d.ts +1 -1
- package/dist/lib/composites/index.d.ts.map +1 -1
- package/dist/lib/composites/types.d.ts +0 -6
- package/dist/lib/composites/types.d.ts.map +1 -1
- package/dist/lib/geometry/anchor.cjs +47 -0
- package/dist/lib/geometry/anchor.d.ts +33 -0
- package/dist/lib/geometry/anchor.d.ts.map +1 -0
- package/dist/lib/geometry/bend.cjs +2 -2
- package/dist/lib/geometry/bend.d.ts +1 -1
- package/dist/lib/geometry/circle.cjs +9 -9
- package/dist/lib/geometry/circle.d.ts +4 -4
- package/dist/lib/geometry/circle.d.ts.map +1 -1
- package/dist/lib/geometry/{roundedContour.cjs → contour.cjs} +21 -32
- package/dist/lib/geometry/{roundedContour.d.ts → contour.d.ts} +4 -5
- package/dist/lib/geometry/contour.d.ts.map +1 -0
- package/dist/lib/geometry/diamond.cjs +7 -7
- package/dist/lib/geometry/diamond.d.ts +3 -3
- package/dist/lib/geometry/diamond.d.ts.map +1 -1
- package/dist/lib/geometry/{_edge.cjs → edge.cjs} +1 -1
- package/dist/{es/geometry/_edge.d.ts → lib/geometry/edge.d.ts} +1 -1
- package/dist/lib/geometry/edge.d.ts.map +1 -0
- package/dist/lib/geometry/ellipse.cjs +8 -8
- package/dist/lib/geometry/ellipse.d.ts +3 -3
- package/dist/lib/geometry/ellipse.d.ts.map +1 -1
- package/dist/lib/geometry/index.d.ts +2 -1
- package/dist/lib/geometry/index.d.ts.map +1 -1
- package/dist/lib/geometry/point.cjs +17 -0
- package/dist/lib/geometry/point.d.ts +6 -0
- package/dist/lib/geometry/point.d.ts.map +1 -1
- package/dist/lib/geometry/rect.cjs +9 -22
- package/dist/lib/geometry/rect.d.ts +4 -17
- package/dist/lib/geometry/rect.d.ts.map +1 -1
- package/dist/lib/geometry/segment.cjs +25 -47
- package/dist/lib/geometry/segment.d.ts.map +1 -1
- package/dist/lib/geometry/{_transform.cjs → transform.cjs} +1 -1
- package/dist/{es/geometry/_transform.d.ts → lib/geometry/transform.d.ts} +1 -1
- package/dist/lib/geometry/transform.d.ts.map +1 -0
- package/dist/lib/index.cjs +56 -22
- package/dist/lib/index.d.ts +13 -10
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/ir/animation.cjs +127 -0
- package/dist/lib/ir/animation.d.ts +219 -0
- package/dist/lib/ir/animation.d.ts.map +1 -0
- package/dist/lib/ir/boundary.d.ts +1 -1
- package/dist/lib/ir/boundary.d.ts.map +1 -1
- package/dist/lib/ir/coordinate.d.ts +8 -8
- package/dist/lib/ir/index.d.ts +1 -0
- package/dist/lib/ir/index.d.ts.map +1 -1
- package/dist/lib/ir/node.cjs +25 -23
- package/dist/lib/ir/node.d.ts +249 -92
- package/dist/lib/ir/node.d.ts.map +1 -1
- package/dist/lib/ir/paint.cjs +10 -10
- package/dist/lib/ir/paint.d.ts +19 -18
- package/dist/lib/ir/paint.d.ts.map +1 -1
- package/dist/lib/ir/path/arrow.cjs +18 -16
- package/dist/lib/ir/path/arrow.d.ts +39 -38
- package/dist/lib/ir/path/arrow.d.ts.map +1 -1
- package/dist/lib/ir/path/path.cjs +3 -1
- package/dist/lib/ir/path/path.d.ts +1106 -209
- package/dist/lib/ir/path/path.d.ts.map +1 -1
- package/dist/lib/ir/path/step.cjs +73 -21
- package/dist/lib/ir/path/step.d.ts +932 -20
- package/dist/lib/ir/path/step.d.ts.map +1 -1
- package/dist/lib/ir/path/target.cjs +3 -3
- package/dist/lib/ir/position/at-position.cjs +11 -11
- package/dist/lib/ir/position/at-position.d.ts +18 -18
- package/dist/lib/ir/position/at-position.d.ts.map +1 -1
- package/dist/lib/ir/scene.cjs +3 -1
- package/dist/lib/ir/scene.d.ts +156 -0
- package/dist/lib/ir/scene.d.ts.map +1 -1
- package/dist/lib/ir/scope.cjs +10 -6
- package/dist/lib/ir/scope.d.ts +3446 -1306
- package/dist/lib/ir/scope.d.ts.map +1 -1
- package/dist/lib/ir/transform.cjs +9 -2
- package/dist/lib/ir/transform.d.ts +44 -17
- package/dist/lib/ir/transform.d.ts.map +1 -1
- package/dist/lib/parsers/index.d.ts +3 -3
- package/dist/lib/parsers/index.d.ts.map +1 -1
- package/dist/lib/parsers/{parseNodeTarget.cjs → node-target.cjs} +10 -8
- package/dist/lib/parsers/{parseNodeTarget.d.ts → node-target.d.ts} +1 -1
- package/dist/lib/parsers/node-target.d.ts.map +1 -0
- package/dist/lib/parsers/{parseTargetSugar.cjs → target-sugar.cjs} +9 -4
- package/dist/{es/parsers/parseTargetSugar.d.ts → lib/parsers/target-sugar.d.ts} +1 -1
- package/dist/lib/parsers/target-sugar.d.ts.map +1 -0
- package/dist/lib/parsers/{parseWay.cjs → way.cjs} +12 -8
- package/dist/{es/parsers/parseWay.d.ts → lib/parsers/way.d.ts} +1 -1
- package/dist/lib/parsers/way.d.ts.map +1 -0
- package/dist/lib/{pathGenerators → path-generators}/define.cjs +1 -1
- package/dist/lib/path-generators/define.d.ts.map +1 -0
- package/dist/lib/path-generators/index.d.ts.map +1 -0
- package/dist/lib/path-generators/types.d.ts.map +1 -0
- package/dist/lib/patterns/define.cjs +10 -0
- package/dist/lib/patterns/define.d.ts +9 -0
- package/dist/lib/patterns/define.d.ts.map +1 -0
- package/dist/lib/patterns/index.cjs +42 -35
- package/dist/lib/patterns/index.d.ts +1 -0
- package/dist/lib/patterns/index.d.ts.map +1 -1
- package/dist/lib/presets/animation.cjs +286 -0
- package/dist/lib/presets/animation.d.ts +123 -0
- package/dist/lib/presets/animation.d.ts.map +1 -0
- package/dist/lib/presets/index.d.ts +3 -0
- package/dist/lib/presets/index.d.ts.map +1 -0
- package/dist/lib/primitive/ellipse.d.ts +3 -0
- package/dist/lib/primitive/ellipse.d.ts.map +1 -1
- package/dist/lib/primitive/group.d.ts +3 -0
- package/dist/lib/primitive/group.d.ts.map +1 -1
- package/dist/lib/primitive/marker.d.ts +1 -1
- package/dist/lib/primitive/paint.d.ts +1 -1
- package/dist/lib/primitive/path.d.ts +4 -1
- package/dist/lib/primitive/path.d.ts.map +1 -1
- package/dist/lib/primitive/rect.d.ts +3 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -1
- package/dist/lib/primitive/scene.d.ts +3 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -1
- package/dist/lib/primitive/text.d.ts +3 -0
- package/dist/lib/primitive/text.d.ts.map +1 -1
- package/dist/lib/shapes/arc.cjs +4 -4
- package/dist/lib/shapes/{_contour.cjs → contour.cjs} +14 -1
- package/dist/{es/shapes/_contour.d.ts → lib/shapes/contour.d.ts} +6 -3
- package/dist/lib/shapes/contour.d.ts.map +1 -0
- package/dist/lib/shapes/ellipse.cjs +2 -2
- package/dist/lib/shapes/index.cjs +1 -1
- package/dist/lib/shapes/index.d.ts +1 -1
- package/dist/lib/shapes/index.d.ts.map +1 -1
- package/dist/lib/shapes/polygon.cjs +29 -24
- package/dist/lib/shapes/polygon.d.ts +1 -1
- package/dist/lib/shapes/polygon.d.ts.map +1 -1
- package/dist/lib/shapes/rectangle.cjs +11 -11
- package/dist/lib/shapes/sector.cjs +41 -33
- package/dist/lib/shapes/sector.d.ts.map +1 -1
- package/dist/lib/shapes/{_shared.cjs → shared.cjs} +7 -12
- package/dist/lib/shapes/{_shared.d.ts → shared.d.ts} +4 -8
- package/dist/lib/shapes/shared.d.ts.map +1 -0
- package/dist/lib/shapes/star.cjs +7 -17
- package/dist/lib/shapes/star.d.ts.map +1 -1
- package/package.json +2 -3
- package/dist/es/compile/lowerComposites.d.ts.map +0 -1
- package/dist/es/geometry/_edge.d.ts.map +0 -1
- package/dist/es/geometry/_transform.d.ts.map +0 -1
- package/dist/es/geometry/roundedContour.d.ts.map +0 -1
- package/dist/es/parsers/parseNodeTarget.d.ts.map +0 -1
- package/dist/es/parsers/parseTargetSugar.d.ts.map +0 -1
- package/dist/es/parsers/parseWay.d.ts.map +0 -1
- package/dist/es/pathGenerators/define.d.ts.map +0 -1
- package/dist/es/pathGenerators/index.d.ts.map +0 -1
- package/dist/es/pathGenerators/types.d.ts.map +0 -1
- package/dist/es/shapes/_contour.d.ts.map +0 -1
- package/dist/es/shapes/_shared.d.ts.map +0 -1
- package/dist/lib/compile/lowerComposites.d.ts.map +0 -1
- package/dist/lib/geometry/_edge.d.ts.map +0 -1
- package/dist/lib/geometry/_transform.d.ts.map +0 -1
- package/dist/lib/geometry/roundedContour.d.ts.map +0 -1
- package/dist/lib/parsers/parseNodeTarget.d.ts.map +0 -1
- package/dist/lib/parsers/parseTargetSugar.d.ts.map +0 -1
- package/dist/lib/parsers/parseWay.d.ts.map +0 -1
- package/dist/lib/pathGenerators/define.d.ts.map +0 -1
- package/dist/lib/pathGenerators/index.d.ts.map +0 -1
- package/dist/lib/pathGenerators/types.d.ts.map +0 -1
- package/dist/lib/shapes/_contour.d.ts.map +0 -1
- package/dist/lib/shapes/_shared.d.ts.map +0 -1
- /package/dist/es/{pathGenerators → path-generators}/define.d.ts +0 -0
- /package/dist/es/{pathGenerators → path-generators}/index.d.ts +0 -0
- /package/dist/es/{pathGenerators → path-generators}/types.d.ts +0 -0
- /package/dist/lib/{pathGenerators → path-generators}/define.d.ts +0 -0
- /package/dist/lib/{pathGenerators → path-generators}/index.d.ts +0 -0
- /package/dist/lib/{pathGenerators → path-generators}/types.d.ts +0 -0
|
@@ -2,7 +2,8 @@ const require_rect = require("../geometry/rect.cjs");
|
|
|
2
2
|
const require_index = require("../shapes/index.cjs");
|
|
3
3
|
const require_index$1 = require("../arrows/index.cjs");
|
|
4
4
|
const require_index$2 = require("../patterns/index.cjs");
|
|
5
|
-
const
|
|
5
|
+
const require_constant = require("./constant.cjs");
|
|
6
|
+
const require_composite = require("./composite.cjs");
|
|
6
7
|
const require_name_stack = require("./name-stack.cjs");
|
|
7
8
|
const require_scope = require("./scope.cjs");
|
|
8
9
|
const require_position = require("./position.cjs");
|
|
@@ -21,10 +22,10 @@ const require_layout = require("./layout.cjs");
|
|
|
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] : require_scope.applyTransformChain([0, 0], chain));
|
|
56
|
+
var scopePlaceholderLayout = (id, chain, shapes) => {
|
|
57
|
+
return zeroSizeRectAt(id, chain.length === 0 ? [0, 0] : require_scope.applyTransformChain([0, 0], chain), shapes);
|
|
57
58
|
};
|
|
58
59
|
/**
|
|
59
60
|
* 显式 viewBox → Scene.layout(finite 守卫 + round)
|
|
@@ -93,7 +94,27 @@ 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(require_constant.formatCompileWarning(warning));
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* 校验 animation tracks 的 viewBox⇔根 约束(schema 上下文无关、分不清元素 vs 根,故在此 compile 层做)
|
|
101
|
+
* @description `viewBox`(镜头)只在 scene 根合法、元素级非法;scene 根只接受 `viewBox`。违例 track → `warn(ANIMATION_INVALID_PROPERTY)` + drop(不丢图、不影响其余 track)。全空返回 undefined(不 stamp 空数组)。
|
|
102
|
+
*/
|
|
103
|
+
var filterAnimations = (tracks, context, onWarn, irPath) => {
|
|
104
|
+
if (tracks === void 0) return void 0;
|
|
105
|
+
const kept = tracks.filter((track, index) => {
|
|
106
|
+
const isViewBox = track.property === "viewBox";
|
|
107
|
+
if (!(context === "root" ? isViewBox : !isViewBox)) {
|
|
108
|
+
onWarn({
|
|
109
|
+
code: require_constant.CompileWarningCode.AnimationInvalidProperty,
|
|
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.`,
|
|
111
|
+
path: `${irPath}.animations[${index}]`
|
|
112
|
+
});
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
return true;
|
|
116
|
+
});
|
|
117
|
+
return kept.length > 0 ? kept : void 0;
|
|
97
118
|
};
|
|
98
119
|
var makePathPlaceholder = () => ({ type: "path-placeholder" });
|
|
99
120
|
/** 把内部 sink 收窄回公开 ScenePrimitive[]:占位已全部回填(compileToScene 末端 placeholderBalance 无条件校验兜底) */
|
|
@@ -110,11 +131,12 @@ var collectPlaceholderLocators = (prims, prefix = "primitives") => {
|
|
|
110
131
|
/** scope.transforms 解析失败时根据失败成因映射的 warn code */
|
|
111
132
|
var scopeTransformWarnCode = (scope) => {
|
|
112
133
|
for (const t of scope.transforms ?? []) {
|
|
113
|
-
if (t.kind === "offset-translate") return
|
|
114
|
-
if (t.kind === "at-translate") return
|
|
115
|
-
if (t.kind === "polar-translate") return
|
|
134
|
+
if (t.kind === "offset-translate") return require_constant.CompileWarningCode.OffsetBaseUnresolved;
|
|
135
|
+
if (t.kind === "at-translate") return require_constant.CompileWarningCode.AtTargetUnresolved;
|
|
136
|
+
if (t.kind === "polar-translate") return require_constant.CompileWarningCode.PolarOriginUnresolved;
|
|
137
|
+
if (t.kind === "between-translate") return require_constant.CompileWarningCode.UnresolvedNodeReference;
|
|
116
138
|
}
|
|
117
|
-
return
|
|
139
|
+
return require_constant.CompileWarningCode.UnresolvedNodeReference;
|
|
118
140
|
};
|
|
119
141
|
/** 把 DuplicateRegisterInfo 翻成 CompileWarning(含可读 message + 双 IR locator) */
|
|
120
142
|
var formatDuplicateWarning = (info) => {
|
|
@@ -122,22 +144,22 @@ var formatDuplicateWarning = (info) => {
|
|
|
122
144
|
const firstLoc = info.firstIrPath ?? "(unknown earlier location)";
|
|
123
145
|
const secondLoc = info.secondIrPath ?? "(unknown current location)";
|
|
124
146
|
return {
|
|
125
|
-
code:
|
|
147
|
+
code: require_constant.CompileWarningCode.DuplicateNodeId,
|
|
126
148
|
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).`,
|
|
127
149
|
path: secondLoc
|
|
128
150
|
};
|
|
129
151
|
};
|
|
130
152
|
/**
|
|
131
153
|
* IR → Scene 纯函数转换,所有 adapter 共享
|
|
132
|
-
* @description Pass 1 递归处理 node / coordinate / scope,把 scope 树下沉为嵌套 GroupPrim;scope.transforms 中的
|
|
154
|
+
* @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
|
|
133
155
|
*/
|
|
134
156
|
var compileToScene = (ir, options = {}) => {
|
|
135
157
|
const measureText = options.measureText ?? require_text_metrics.fallbackMeasurer;
|
|
136
158
|
const layoutPadding = options.padding ?? 10;
|
|
137
|
-
const round = require_precision.
|
|
159
|
+
const round = require_precision.createRound(options.precision ?? 2);
|
|
138
160
|
const nodeDistance = options.nodeDistance;
|
|
139
161
|
const onWarn = options.onWarn ?? defaultWarnDispatcher;
|
|
140
|
-
const loweredIr =
|
|
162
|
+
const loweredIr = require_composite.lowerComposites(ir, options.composites ?? [], {
|
|
141
163
|
onWarn,
|
|
142
164
|
maxDepth: options.maxCompositeDepth
|
|
143
165
|
});
|
|
@@ -147,7 +169,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
147
169
|
} : require_index.BUILTIN_SHAPES;
|
|
148
170
|
if (options.shapes) {
|
|
149
171
|
for (const name of Object.keys(options.shapes)) if (Object.prototype.hasOwnProperty.call(require_index.BUILTIN_SHAPES, name)) onWarn({
|
|
150
|
-
code:
|
|
172
|
+
code: require_constant.CompileWarningCode.ShapeOverridesBuiltin,
|
|
151
173
|
message: `Injected shape '${name}' overrides the built-in shape of the same name.`,
|
|
152
174
|
path: `options.shapes.${name}`
|
|
153
175
|
});
|
|
@@ -159,7 +181,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
159
181
|
} : require_index$1.BUILTIN_ARROWS;
|
|
160
182
|
if (options.arrows) {
|
|
161
183
|
for (const name of Object.keys(options.arrows)) if (Object.prototype.hasOwnProperty.call(require_index$1.BUILTIN_ARROWS, name)) onWarn({
|
|
162
|
-
code:
|
|
184
|
+
code: require_constant.CompileWarningCode.ArrowOverridesBuiltin,
|
|
163
185
|
message: `Injected arrow '${name}' overrides the built-in arrow of the same name.`,
|
|
164
186
|
path: `options.arrows.${name}`
|
|
165
187
|
});
|
|
@@ -170,7 +192,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
170
192
|
} : require_index$2.BUILTIN_PATTERNS;
|
|
171
193
|
if (options.patterns) {
|
|
172
194
|
for (const name of Object.keys(options.patterns)) if (Object.prototype.hasOwnProperty.call(require_index$2.BUILTIN_PATTERNS, name)) onWarn({
|
|
173
|
-
code:
|
|
195
|
+
code: require_constant.CompileWarningCode.PatternOverridesBuiltin,
|
|
174
196
|
message: `Injected pattern '${name}' overrides the built-in pattern of the same name.`,
|
|
175
197
|
path: `options.patterns.${name}`
|
|
176
198
|
});
|
|
@@ -239,7 +261,7 @@ var compileToScene = (ir, options = {}) => {
|
|
|
239
261
|
};
|
|
240
262
|
/**
|
|
241
263
|
* 递归处理一组 IR child,把 node / coordinate 发到 sink、把本层 path 收集到 pathsAccumulator、scope 下沉为 GroupPrim
|
|
242
|
-
* @description **不**在内部 resolve pathsAccumulator——调用方负责在合适时机(scope 入口:bbox replaceLayout 之后 / popFrame 之前;顶层:所有处理结束后)调用 resolvePendingPaths。这样 scope.id 的 placeholder→real bbox 替换在本层 path 端点 lookup 之前完成,避免 "scope 内 path 自引用本 scope.id 拿到 placeholder" 的 latent bug,同时保留
|
|
264
|
+
* @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 语义。
|
|
243
265
|
* @param children 当前层级的 IR child 数组
|
|
244
266
|
* @param chain 从根到当前层级累积的 Cartesian-only transform 链
|
|
245
267
|
* @param sink 当前层级 Scene primitive 落点(顶层 = primitives,scope 内 = GroupPrim.children)
|
|
@@ -253,41 +275,43 @@ var compileToScene = (ir, options = {}) => {
|
|
|
253
275
|
const child = children[i];
|
|
254
276
|
if ("namespace" in child) throw new Error(`Unexpected composite node '${child.namespace}.${child.type}' reached compile; composites must be lowered via lowerComposites first.`);
|
|
255
277
|
if (child.type === "node") {
|
|
256
|
-
const
|
|
278
|
+
const effectiveNode = require_style.resolveNodeStyle(child, styleStack);
|
|
279
|
+
const layout = require_node.layoutNode({
|
|
280
|
+
...effectiveNode,
|
|
281
|
+
animations: filterAnimations(effectiveNode.animations, "element", onWarn, `${locatorPrefix}children[${i}].node`)
|
|
282
|
+
}, measureText, nameStack, nodeDistance, chain, require_style.resolveLabelDefault(styleStack), effectiveShapes, require_anchor.refPointOfTarget);
|
|
257
283
|
const globalLayout = chain.length === 0 ? layout : require_scope.projectLayoutToGlobal(layout, chain);
|
|
258
284
|
if (child.id) nameStack.register(child.id, globalLayout, `${locatorPrefix}children[${i}].node.id`);
|
|
259
285
|
for (const prim of require_node.emitNodePrimitives(layout, round, paint.resolve)) {
|
|
260
286
|
sink.push(prim);
|
|
261
287
|
if (child.zIndex !== void 0) zIndexOf.set(prim, child.zIndex);
|
|
262
288
|
}
|
|
263
|
-
|
|
289
|
+
const outerRect = require_node.outerRectOf(globalLayout);
|
|
290
|
+
allPoints.push(require_rect.rect.anchor(outerRect, "north-west"), require_rect.rect.anchor(outerRect, "north-east"), require_rect.rect.anchor(outerRect, "south-west"), require_rect.rect.anchor(outerRect, "south-east"));
|
|
264
291
|
for (const p of require_node.labelExtentPoints(globalLayout)) allPoints.push(p);
|
|
265
292
|
layoutsAccumulator.push(globalLayout);
|
|
266
293
|
} else if (child.type === "coordinate") {
|
|
267
294
|
const localCenter = require_position.resolvePosition(child.position, nameStack, nodeDistance, chain, require_anchor.refPointOfTarget);
|
|
268
|
-
if (!localCenter) {
|
|
269
|
-
onWarn({
|
|
270
|
-
code: "POLAR_ORIGIN_UNRESOLVED",
|
|
271
|
-
message: `Cannot resolve position for coordinate '${child.id}'; polar.origin or at.of may reference an undefined node`,
|
|
272
|
-
path: `${locatorPrefix}children[${i}].coordinate.position`
|
|
273
|
-
});
|
|
274
|
-
throw new Error(`Cannot resolve position for coordinate ${child.id}; polar.origin or at.of may reference an undefined node`);
|
|
275
|
-
}
|
|
295
|
+
if (!localCenter) throw new Error(`Cannot resolve position for coordinate ${child.id}; polar.origin or at.of may reference an undefined node`);
|
|
276
296
|
const globalCenter = chain.length === 0 ? localCenter : require_scope.applyTransformChain(localCenter, chain);
|
|
277
|
-
const coordLayout = coordinateAsLayout(child.id, globalCenter);
|
|
297
|
+
const coordLayout = coordinateAsLayout(child.id, globalCenter, effectiveShapes);
|
|
278
298
|
nameStack.register(child.id, coordLayout, `${locatorPrefix}children[${i}].coordinate.id`);
|
|
279
299
|
layoutsAccumulator.push(coordLayout);
|
|
280
300
|
} else if (child.type === "scope") {
|
|
281
|
-
const loweredOwn = require_scope.lowerScopeTransforms(child.transforms ?? [], nameStack, nodeDistance);
|
|
301
|
+
const loweredOwn = require_scope.lowerScopeTransforms(child.transforms ?? [], nameStack, nodeDistance, require_anchor.refPointOfTarget);
|
|
282
302
|
if (loweredOwn === null) onWarn({
|
|
283
303
|
code: scopeTransformWarnCode(child),
|
|
284
|
-
message: `Cannot resolve one of scope.transforms; referent (at.of / offset.of / polar.origin) is undefined or defined later in the IR`,
|
|
304
|
+
message: `Cannot resolve one of scope.transforms; referent (at.of / offset.of / polar.origin / between endpoints) is undefined or defined later in the IR`,
|
|
285
305
|
path: `${locatorPrefix}children[${i}].scope.transforms`
|
|
286
306
|
});
|
|
287
307
|
const ownTransforms = loweredOwn ?? [];
|
|
288
308
|
const innerChain = [...chain, ...ownTransforms];
|
|
289
309
|
const parentFrameDepth = nameStack.depth - 1;
|
|
290
|
-
|
|
310
|
+
let placeholderLayout;
|
|
311
|
+
if (child.id) {
|
|
312
|
+
placeholderLayout = scopePlaceholderLayout(child.id, innerChain, effectiveShapes);
|
|
313
|
+
nameStack.register(child.id, placeholderLayout, `${locatorPrefix}children[${i}].scope.id`);
|
|
314
|
+
}
|
|
291
315
|
const pushedFrame = child.localNamespace === true;
|
|
292
316
|
if (pushedFrame) nameStack.pushFrame();
|
|
293
317
|
const innerSink = [];
|
|
@@ -297,12 +321,12 @@ var compileToScene = (ir, options = {}) => {
|
|
|
297
321
|
* 让 scope 内 path 自引用本 scope.id 端点取真 bbox 而非 placeholder */
|
|
298
322
|
const innerPaths = [];
|
|
299
323
|
try {
|
|
300
|
-
processChildren(child.children, innerChain, innerSink, `${locatorPrefix}children[${i}].scope.`, innerLayouts, innerPaths, [...styleStack, require_style.
|
|
324
|
+
processChildren(child.children, innerChain, innerSink, `${locatorPrefix}children[${i}].scope.`, innerLayouts, innerPaths, [...styleStack, require_style.createStyleFrame(child)]);
|
|
301
325
|
if (child.id) {
|
|
302
326
|
const bbox = require_scope.computeScopeBoundingBox(innerLayouts);
|
|
303
327
|
const fallbackOrigin = innerChain.length === 0 ? [0, 0] : require_scope.applyTransformChain([0, 0], innerChain);
|
|
304
|
-
const bboxLayout = require_scope.registerScopeAsLayout(child.id, bbox, fallbackOrigin);
|
|
305
|
-
nameStack.replaceLayout(child.id, bboxLayout, parentFrameDepth);
|
|
328
|
+
const bboxLayout = require_scope.registerScopeAsLayout(child.id, bbox, fallbackOrigin, effectiveShapes);
|
|
329
|
+
nameStack.replaceLayout(child.id, bboxLayout, parentFrameDepth, placeholderLayout);
|
|
306
330
|
layoutsAccumulator.push(bboxLayout);
|
|
307
331
|
} else for (const innerLayout of innerLayouts) layoutsAccumulator.push(innerLayout);
|
|
308
332
|
resolvePendingPaths(innerPaths);
|
|
@@ -317,13 +341,19 @@ var compileToScene = (ir, options = {}) => {
|
|
|
317
341
|
};
|
|
318
342
|
if (child.id !== void 0) group.id = child.id;
|
|
319
343
|
if (child.meta !== void 0) group.meta = child.meta;
|
|
344
|
+
const scopeAnimations = filterAnimations(child.animations, "element", onWarn, `${locatorPrefix}children[${i}].scope`);
|
|
345
|
+
if (scopeAnimations !== void 0) group.animations = scopeAnimations;
|
|
320
346
|
if (hasOwnTransforms) group.transforms = [...ownTransforms];
|
|
321
347
|
if (child.clip !== void 0) group.clipRef = clip.resolve(child.clip);
|
|
322
348
|
sink.push(group);
|
|
323
349
|
if (child.zIndex !== void 0) zIndexOf.set(group, child.zIndex);
|
|
324
350
|
} else {
|
|
351
|
+
const effectivePath = require_style.resolveEffectivePath(child, styleStack);
|
|
325
352
|
const pending = {
|
|
326
|
-
path:
|
|
353
|
+
path: {
|
|
354
|
+
...effectivePath,
|
|
355
|
+
animations: filterAnimations(effectivePath.animations, "element", onWarn, `${locatorPrefix}children[${i}].path`)
|
|
356
|
+
},
|
|
327
357
|
irPath: `${locatorPrefix}children[${i}].path`,
|
|
328
358
|
scopeChain: chain,
|
|
329
359
|
zIndex: child.zIndex
|
|
@@ -349,10 +379,12 @@ var compileToScene = (ir, options = {}) => {
|
|
|
349
379
|
throw new Error(`internal: ${placeholderBalance} unresolved path placeholder(s) leaked into Scene output${detail}`);
|
|
350
380
|
}
|
|
351
381
|
const resources = [...paint.resources(), ...clip.resources()];
|
|
382
|
+
const rootAnimations = filterAnimations(loweredIr.animations, "root", onWarn, "scene");
|
|
352
383
|
return {
|
|
353
384
|
primitives: stableSortByZIndex(sealSink(primitives)),
|
|
354
385
|
layout: loweredIr.viewBox !== void 0 ? viewBoxToLayout(loweredIr.viewBox, round) : assertFiniteLayout(require_layout.computeLayout(allPoints, layoutPadding, round)),
|
|
355
|
-
...resources.length > 0 ? { resources } : {}
|
|
386
|
+
...resources.length > 0 ? { resources } : {},
|
|
387
|
+
...rootAnimations !== void 0 ? { animations: rootAnimations } : {}
|
|
356
388
|
};
|
|
357
389
|
};
|
|
358
390
|
//#endregion
|
|
@@ -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' | (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,EAA0D,MAAM,OAAO,CAAC;AACxF,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,KAkXrE,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_constant = require("./constant.cjs");
|
|
1
2
|
let zod = require("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: require_constant.CompileWarningCode.CompositeNotRegistered,
|
|
42
50
|
message: `No composite registered for '${key}'; the node is skipped.`,
|
|
43
51
|
path
|
|
44
52
|
});
|
|
@@ -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"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/compile/constant.ts
|
|
2
|
+
/** 编译期 warning code(机器可读)。 */
|
|
3
|
+
var CompileWarningCode = {
|
|
4
|
+
UnresolvedNodeReference: "UNRESOLVED_NODE_REFERENCE",
|
|
5
|
+
PathTooShort: "PATH_TOO_SHORT",
|
|
6
|
+
AnchorResolutionFailed: "ANCHOR_RESOLUTION_FAILED",
|
|
7
|
+
OffsetBaseUnresolved: "OFFSET_BASE_UNRESOLVED",
|
|
8
|
+
PolarOriginUnresolved: "POLAR_ORIGIN_UNRESOLVED",
|
|
9
|
+
AtTargetUnresolved: "AT_TARGET_UNRESOLVED",
|
|
10
|
+
RelativeInitialNoPrevEnd: "RELATIVE_INITIAL_NO_PREV_END",
|
|
11
|
+
BboxExtremeInput: "BBOX_EXTREME_INPUT",
|
|
12
|
+
DuplicateNodeId: "DUPLICATE_NODE_ID",
|
|
13
|
+
ShapeOverridesBuiltin: "SHAPE_OVERRIDES_BUILTIN",
|
|
14
|
+
ArrowOverridesBuiltin: "ARROW_OVERRIDES_BUILTIN",
|
|
15
|
+
PatternOverridesBuiltin: "PATTERN_OVERRIDES_BUILTIN",
|
|
16
|
+
CompositeNotRegistered: "COMPOSITE_NOT_REGISTERED",
|
|
17
|
+
AnimationInvalidProperty: "ANIMATION_INVALID_PROPERTY",
|
|
18
|
+
ArcMissingRadius: "ARC_MISSING_RADIUS",
|
|
19
|
+
PartialArcNeedsBothAngles: "PARTIAL_ARC_NEEDS_BOTH_ANGLES"
|
|
20
|
+
};
|
|
21
|
+
var formatCompileWarning = (warning) => `[retikz] ${warning.code} at ${warning.path}: ${warning.message}`;
|
|
22
|
+
//#endregion
|
|
23
|
+
exports.CompileWarningCode = CompileWarningCode;
|
|
24
|
+
exports.formatCompileWarning = formatCompileWarning;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 AnchorResolutionFailed: "ANCHOR_RESOLUTION_FAILED";
|
|
7
|
+
readonly OffsetBaseUnresolved: "OFFSET_BASE_UNRESOLVED";
|
|
8
|
+
readonly PolarOriginUnresolved: "POLAR_ORIGIN_UNRESOLVED";
|
|
9
|
+
readonly AtTargetUnresolved: "AT_TARGET_UNRESOLVED";
|
|
10
|
+
readonly RelativeInitialNoPrevEnd: "RELATIVE_INITIAL_NO_PREV_END";
|
|
11
|
+
readonly BboxExtremeInput: "BBOX_EXTREME_INPUT";
|
|
12
|
+
readonly DuplicateNodeId: "DUPLICATE_NODE_ID";
|
|
13
|
+
readonly ShapeOverridesBuiltin: "SHAPE_OVERRIDES_BUILTIN";
|
|
14
|
+
readonly ArrowOverridesBuiltin: "ARROW_OVERRIDES_BUILTIN";
|
|
15
|
+
readonly PatternOverridesBuiltin: "PATTERN_OVERRIDES_BUILTIN";
|
|
16
|
+
readonly CompositeNotRegistered: "COMPOSITE_NOT_REGISTERED";
|
|
17
|
+
readonly AnimationInvalidProperty: "ANIMATION_INVALID_PROPERTY";
|
|
18
|
+
readonly ArcMissingRadius: "ARC_MISSING_RADIUS";
|
|
19
|
+
readonly PartialArcNeedsBothAngles: "PARTIAL_ARC_NEEDS_BOTH_ANGLES";
|
|
20
|
+
};
|
|
21
|
+
export type CompileWarningCodeValue = ValueOf<typeof CompileWarningCode> | (string & {});
|
|
22
|
+
/** 编译期 warning:不影响 Scene 产物,交给调用方收集或展示。 */
|
|
23
|
+
export type CompileWarning = {
|
|
24
|
+
/** 机器可读 warning code。 */
|
|
25
|
+
code: CompileWarningCodeValue;
|
|
26
|
+
/** 人类可读消息(英文)。 */
|
|
27
|
+
message: string;
|
|
28
|
+
/** IR locator 路径(jq-like),如 `children[3].path.children[1].to`。 */
|
|
29
|
+
path: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const formatCompileWarning: (warning: CompileWarning) => string;
|
|
32
|
+
//# 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;;;;;;;;;;;;;;;;;CAiBrB,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,31 @@
|
|
|
1
|
+
const require_at_position = require("../ir/position/at-position.cjs");
|
|
2
|
+
const require_anchor = require("../geometry/anchor.cjs");
|
|
3
|
+
//#region src/compile/direction.ts
|
|
4
|
+
/**
|
|
5
|
+
* 8 方向在屏幕坐标系(y 向下)里的单位向量。
|
|
6
|
+
* @description above=视觉上方(y 减小);对角分量用 1/√2,保证斜向 distance 与水平 / 垂直 distance 等长。
|
|
7
|
+
*/
|
|
8
|
+
var DirectionVectorByAtDirection = {
|
|
9
|
+
[require_at_position.AtDirection.Above]: [0, -1],
|
|
10
|
+
[require_at_position.AtDirection.Below]: [0, 1],
|
|
11
|
+
[require_at_position.AtDirection.Left]: [-1, 0],
|
|
12
|
+
[require_at_position.AtDirection.Right]: [1, 0],
|
|
13
|
+
[require_at_position.AtDirection.AboveLeft]: [-Math.SQRT1_2, -Math.SQRT1_2],
|
|
14
|
+
[require_at_position.AtDirection.AboveRight]: [Math.SQRT1_2, -Math.SQRT1_2],
|
|
15
|
+
[require_at_position.AtDirection.BelowLeft]: [-Math.SQRT1_2, Math.SQRT1_2],
|
|
16
|
+
[require_at_position.AtDirection.BelowRight]: [Math.SQRT1_2, Math.SQRT1_2]
|
|
17
|
+
};
|
|
18
|
+
/** 8 方向 label position 对应的节点边界 anchor。 */
|
|
19
|
+
var LabelAnchorByAtDirection = {
|
|
20
|
+
[require_at_position.AtDirection.Above]: require_anchor.CompassAnchor.North,
|
|
21
|
+
[require_at_position.AtDirection.Below]: require_anchor.CompassAnchor.South,
|
|
22
|
+
[require_at_position.AtDirection.Left]: require_anchor.CompassAnchor.West,
|
|
23
|
+
[require_at_position.AtDirection.Right]: require_anchor.CompassAnchor.East,
|
|
24
|
+
[require_at_position.AtDirection.AboveLeft]: require_anchor.CompassAnchor.NorthWest,
|
|
25
|
+
[require_at_position.AtDirection.AboveRight]: require_anchor.CompassAnchor.NorthEast,
|
|
26
|
+
[require_at_position.AtDirection.BelowLeft]: require_anchor.CompassAnchor.SouthWest,
|
|
27
|
+
[require_at_position.AtDirection.BelowRight]: require_anchor.CompassAnchor.SouthEast
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.DirectionVectorByAtDirection = DirectionVectorByAtDirection;
|
|
31
|
+
exports.LabelAnchorByAtDirection = LabelAnchorByAtDirection;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type DirectionVector = readonly [number, number];
|
|
2
|
+
/**
|
|
3
|
+
* 8 方向在屏幕坐标系(y 向下)里的单位向量。
|
|
4
|
+
* @description above=视觉上方(y 减小);对角分量用 1/√2,保证斜向 distance 与水平 / 垂直 distance 等长。
|
|
5
|
+
*/
|
|
6
|
+
export declare const DirectionVectorByAtDirection: {
|
|
7
|
+
readonly above: readonly [0, -1];
|
|
8
|
+
readonly below: readonly [0, 1];
|
|
9
|
+
readonly left: readonly [-1, 0];
|
|
10
|
+
readonly right: readonly [1, 0];
|
|
11
|
+
readonly "above-left": readonly [number, number];
|
|
12
|
+
readonly "above-right": readonly [number, number];
|
|
13
|
+
readonly "below-left": readonly [number, number];
|
|
14
|
+
readonly "below-right": readonly [number, number];
|
|
15
|
+
};
|
|
16
|
+
/** 8 方向 label position 对应的节点边界 anchor。 */
|
|
17
|
+
export declare const LabelAnchorByAtDirection: {
|
|
18
|
+
readonly above: "north";
|
|
19
|
+
readonly below: "south";
|
|
20
|
+
readonly left: "west";
|
|
21
|
+
readonly right: "east";
|
|
22
|
+
readonly "above-left": "north-west";
|
|
23
|
+
readonly "above-right": "north-east";
|
|
24
|
+
readonly "below-left": "south-west";
|
|
25
|
+
readonly "below-right": "south-east";
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=direction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"direction.d.ts","sourceRoot":"","sources":["../../../src/compile/direction.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,eAAe,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,4BAA4B;;;;;;;;;CASqB,CAAC;AAE/D,0CAA0C;AAC1C,eAAO,MAAM,wBAAwB;;;;;;;;;CAS4B,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export * from './compile';
|
|
2
|
+
export * from './constant';
|
|
2
3
|
export * from './node';
|
|
3
|
-
export * from './path
|
|
4
|
+
export * from './path';
|
|
4
5
|
export * from './position';
|
|
5
6
|
export * from './precision';
|
|
6
7
|
export * from './scope';
|
|
7
8
|
export * from './text-metrics';
|
|
8
9
|
export * from './layout';
|
|
10
|
+
export * from './composite';
|
|
9
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compile/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compile/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
|
|
@@ -81,13 +81,17 @@ var NameStack = class {
|
|
|
81
81
|
* @param id 要替换的 id(必须已在该 frame 注册过)
|
|
82
82
|
* @param layout 新的 NodeLayout(覆盖旧值)
|
|
83
83
|
* @param frameDepth 0 = 根 frame;通常传 scope 入场前的栈深 - 1
|
|
84
|
+
* @param expectedCurrent 可选的当前 layout 引用;传入后仅当 frame 中仍是该引用时才替换
|
|
85
|
+
* @returns true = 完成替换;false = 当前值已被后续 register 覆盖,未替换
|
|
84
86
|
*/
|
|
85
|
-
replaceLayout(id, layout, frameDepth) {
|
|
87
|
+
replaceLayout(id, layout, frameDepth, expectedCurrent) {
|
|
86
88
|
if (this.currentPhase !== "pass1") throw new Error(`NameStack.replaceLayout('${id}'): only allowed during pass1; current phase is '${this.currentPhase}'`);
|
|
87
89
|
if (frameDepth < 0 || frameDepth >= this.frames.length) throw new Error(`NameStack.replaceLayout('${id}'): frameDepth ${frameDepth} out of range (stack depth ${this.frames.length})`);
|
|
88
90
|
const targetFrame = this.frames[frameDepth];
|
|
89
91
|
if (!targetFrame.has(id)) throw new Error(`NameStack.replaceLayout('${id}'): id not previously registered in frame at depth ${frameDepth}`);
|
|
92
|
+
if (expectedCurrent !== void 0 && targetFrame.get(id) !== expectedCurrent) return false;
|
|
90
93
|
targetFrame.set(id, layout);
|
|
94
|
+
return true;
|
|
91
95
|
}
|
|
92
96
|
/**
|
|
93
97
|
* inside-out 查找 id 对应的 NodeLayout
|
|
@@ -70,8 +70,10 @@ export declare class NameStack {
|
|
|
70
70
|
* @param id 要替换的 id(必须已在该 frame 注册过)
|
|
71
71
|
* @param layout 新的 NodeLayout(覆盖旧值)
|
|
72
72
|
* @param frameDepth 0 = 根 frame;通常传 scope 入场前的栈深 - 1
|
|
73
|
+
* @param expectedCurrent 可选的当前 layout 引用;传入后仅当 frame 中仍是该引用时才替换
|
|
74
|
+
* @returns true = 完成替换;false = 当前值已被后续 register 覆盖,未替换
|
|
73
75
|
*/
|
|
74
|
-
replaceLayout(id: string, layout: NodeLayout, frameDepth: number):
|
|
76
|
+
replaceLayout(id: string, layout: NodeLayout, frameDepth: number, expectedCurrent?: NodeLayout): boolean;
|
|
75
77
|
/**
|
|
76
78
|
* inside-out 查找 id 对应的 NodeLayout
|
|
77
79
|
* @description 从栈顶向栈底依次查找;首个命中的 frame 返回;都没命中返回 undefined。内层可见外层(shadowing),外层不可见内层
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"name-stack.d.ts","sourceRoot":"","sources":["../../../src/compile/name-stack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,qBAAqB;AACrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,0DAA0D;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IACxD,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;IACtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAwC;IACrE,6EAA6E;IAC7E,OAAO,CAAC,YAAY,CAA8B;gBAEtC,OAAO,GAAE,gBAAqB;IAM1C,6BAA6B;IAC7B,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,8BAA8B;IAC9B,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO,CAE7B;IAED,iDAAiD;IACjD,SAAS,IAAI,IAAI;IAKjB;;;OAGG;IACH,QAAQ,IAAI,IAAI;IAQhB,kEAAkE;IAClE,gBAAgB,IAAI,IAAI;IAIxB,6EAA6E;IAC7E,eAAe,IAAI,IAAI;IAIvB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO;IAuBlE
|
|
1
|
+
{"version":3,"file":"name-stack.d.ts","sourceRoot":"","sources":["../../../src/compile/name-stack.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,4CAA4C;IAC5C,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,qBAAqB;AACrB,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,SAAS;IACpB,0DAA0D;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiC;IACxD,6EAA6E;IAC7E,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAyC;IACtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAwC;IACrE,6EAA6E;IAC7E,OAAO,CAAC,YAAY,CAA8B;gBAEtC,OAAO,GAAE,gBAAqB;IAM1C,6BAA6B;IAC7B,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,8BAA8B;IAC9B,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO,CAE7B;IAED,iDAAiD;IACjD,SAAS,IAAI,IAAI;IAKjB;;;OAGG;IACH,QAAQ,IAAI,IAAI;IAQhB,kEAAkE;IAClE,gBAAgB,IAAI,IAAI;IAIxB,6EAA6E;IAC7E,eAAe,IAAI,IAAI;IAIvB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO;IAuBlE;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,UAAU,GAAG,OAAO;IAsBxG;;;OAGG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;CAO3C"}
|