@retikz/core 0.0.1-rc.3 → 0.1.0-alpha.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/LICENSE +21 -21
- package/dist/es/compile/compile.d.ts +27 -0
- package/dist/es/compile/compile.d.ts.map +1 -0
- package/dist/es/compile/compile.js +43 -0
- package/dist/es/compile/index.d.ts +9 -0
- package/dist/es/compile/index.d.ts.map +1 -0
- package/dist/es/compile/node.d.ts +76 -0
- package/dist/es/compile/node.d.ts.map +1 -0
- package/dist/es/compile/node.js +240 -0
- package/dist/es/compile/parseTarget.d.ts +25 -0
- package/dist/es/compile/parseTarget.d.ts.map +1 -0
- package/dist/es/compile/parseTarget.js +48 -0
- package/dist/es/compile/path.d.ts +29 -0
- package/dist/es/compile/path.d.ts.map +1 -0
- package/dist/es/compile/path.js +298 -0
- package/dist/es/compile/position.d.ts +9 -0
- package/dist/es/compile/position.d.ts.map +1 -0
- package/dist/es/compile/position.js +24 -0
- package/dist/es/compile/precision.d.ts +5 -0
- package/dist/es/compile/precision.d.ts.map +1 -0
- package/dist/es/compile/precision.js +8 -0
- package/dist/es/compile/text-metrics.d.ts +32 -0
- package/dist/es/compile/text-metrics.d.ts.map +1 -0
- package/dist/es/compile/text-metrics.js +8 -0
- package/dist/es/compile/view-box.d.ts +8 -0
- package/dist/es/compile/view-box.d.ts.map +1 -0
- package/dist/es/compile/view-box.js +31 -0
- package/dist/es/geometry/circle.d.ts +32 -0
- package/dist/es/geometry/circle.d.ts.map +1 -0
- package/dist/es/geometry/circle.js +79 -0
- package/dist/es/geometry/diamond.d.ts +44 -0
- package/dist/es/geometry/diamond.d.ts.map +1 -0
- package/dist/es/geometry/diamond.js +87 -0
- package/dist/es/geometry/ellipse.d.ts +38 -0
- package/dist/es/geometry/ellipse.d.ts.map +1 -0
- package/dist/es/geometry/ellipse.js +86 -0
- package/dist/es/geometry/index.d.ts +7 -0
- package/dist/es/geometry/index.d.ts.map +1 -0
- package/dist/es/geometry/point.d.ts +25 -0
- package/dist/es/geometry/point.d.ts.map +1 -0
- package/dist/es/geometry/point.js +34 -0
- package/dist/es/geometry/polar.d.ts +44 -0
- package/dist/es/geometry/polar.d.ts.map +1 -0
- package/dist/es/geometry/polar.js +45 -0
- package/dist/es/geometry/rect.d.ts +59 -0
- package/dist/es/geometry/rect.d.ts.map +1 -0
- package/dist/es/geometry/rect.js +120 -0
- package/dist/es/index.d.ts +20 -10
- package/dist/es/index.d.ts.map +1 -0
- package/dist/es/index.js +18 -12
- package/dist/es/ir/index.d.ts +5 -0
- package/dist/es/ir/index.d.ts.map +1 -0
- package/dist/es/ir/node.d.ts +73 -0
- package/dist/es/ir/node.d.ts.map +1 -0
- package/dist/es/ir/node.js +41 -0
- package/dist/es/ir/path/arrow.d.ts +26 -0
- package/dist/es/ir/path/arrow.d.ts.map +1 -0
- package/dist/es/ir/path/arrow.js +25 -0
- package/dist/es/ir/path/index.d.ts +5 -0
- package/dist/es/ir/path/index.d.ts.map +1 -0
- package/dist/es/ir/path/path.d.ts +123 -0
- package/dist/es/ir/path/path.d.ts.map +1 -0
- package/dist/es/ir/path/path.js +22 -0
- package/dist/es/ir/path/step.d.ts +116 -0
- package/dist/es/ir/path/step.d.ts.map +1 -0
- package/dist/es/ir/path/step.js +31 -0
- package/dist/es/ir/path/target.d.ts +5 -0
- package/dist/es/ir/path/target.d.ts.map +1 -0
- package/dist/es/ir/path/target.js +11 -0
- package/dist/es/ir/position/index.d.ts +3 -0
- package/dist/es/ir/position/index.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.d.ts +9 -0
- package/dist/es/ir/position/polar-position.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.js +18 -0
- package/dist/es/ir/position/position.d.ts +5 -0
- package/dist/es/ir/position/position.d.ts.map +1 -0
- package/dist/es/ir/position/position.js +5 -0
- package/dist/es/ir/scene.d.ts +424 -0
- package/dist/es/ir/scene.d.ts.map +1 -0
- package/dist/es/ir/scene.js +14 -0
- package/dist/es/parsers/index.d.ts +2 -0
- package/dist/es/parsers/index.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.d.ts +71 -0
- package/dist/es/parsers/parseWay.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.js +92 -0
- package/dist/es/primitive/ellipse.d.ts +32 -0
- package/dist/es/primitive/ellipse.d.ts.map +1 -0
- package/dist/es/primitive/group.d.ts +11 -0
- package/dist/es/primitive/group.d.ts.map +1 -0
- package/dist/es/primitive/index.d.ts +8 -0
- package/dist/es/primitive/index.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +29 -0
- package/dist/es/primitive/path.d.ts.map +1 -0
- package/dist/es/primitive/rect.d.ts +28 -0
- package/dist/es/primitive/rect.d.ts.map +1 -0
- package/dist/es/primitive/scene.d.ts +21 -0
- package/dist/es/primitive/scene.d.ts.map +1 -0
- package/dist/es/primitive/text.d.ts +32 -0
- package/dist/es/primitive/text.d.ts.map +1 -0
- package/dist/es/primitive/view-box.d.ts +12 -0
- package/dist/es/primitive/view-box.d.ts.map +1 -0
- package/dist/es/types.d.ts +3 -0
- package/dist/es/types.d.ts.map +1 -0
- package/dist/lib/compile/compile.cjs +43 -0
- package/dist/lib/compile/compile.d.ts +27 -0
- package/dist/lib/compile/compile.d.ts.map +1 -0
- package/dist/lib/compile/index.d.ts +9 -0
- package/dist/lib/compile/index.d.ts.map +1 -0
- package/dist/lib/compile/node.cjs +244 -0
- package/dist/lib/compile/node.d.ts +76 -0
- package/dist/lib/compile/node.d.ts.map +1 -0
- package/dist/lib/compile/parseTarget.cjs +48 -0
- package/dist/lib/compile/parseTarget.d.ts +25 -0
- package/dist/lib/compile/parseTarget.d.ts.map +1 -0
- package/dist/lib/compile/path.cjs +298 -0
- package/dist/lib/compile/path.d.ts +29 -0
- package/dist/lib/compile/path.d.ts.map +1 -0
- package/dist/lib/compile/position.cjs +24 -0
- package/dist/lib/compile/position.d.ts +9 -0
- package/dist/lib/compile/position.d.ts.map +1 -0
- package/dist/lib/compile/precision.cjs +8 -0
- package/dist/lib/compile/precision.d.ts +5 -0
- package/dist/lib/compile/precision.d.ts.map +1 -0
- package/dist/lib/compile/text-metrics.cjs +8 -0
- package/dist/lib/compile/text-metrics.d.ts +32 -0
- package/dist/lib/compile/text-metrics.d.ts.map +1 -0
- package/dist/lib/compile/view-box.cjs +31 -0
- package/dist/lib/compile/view-box.d.ts +8 -0
- package/dist/lib/compile/view-box.d.ts.map +1 -0
- package/dist/lib/geometry/circle.cjs +79 -0
- package/dist/lib/geometry/circle.d.ts +32 -0
- package/dist/lib/geometry/circle.d.ts.map +1 -0
- package/dist/lib/geometry/diamond.cjs +87 -0
- package/dist/lib/geometry/diamond.d.ts +44 -0
- package/dist/lib/geometry/diamond.d.ts.map +1 -0
- package/dist/lib/geometry/ellipse.cjs +86 -0
- package/dist/lib/geometry/ellipse.d.ts +38 -0
- package/dist/lib/geometry/ellipse.d.ts.map +1 -0
- package/dist/lib/geometry/index.d.ts +7 -0
- package/dist/lib/geometry/index.d.ts.map +1 -0
- package/dist/lib/geometry/point.cjs +34 -0
- package/dist/lib/geometry/point.d.ts +25 -0
- package/dist/lib/geometry/point.d.ts.map +1 -0
- package/dist/lib/geometry/polar.cjs +45 -0
- package/dist/lib/geometry/polar.d.ts +44 -0
- package/dist/lib/geometry/polar.d.ts.map +1 -0
- package/dist/lib/geometry/rect.cjs +121 -0
- package/dist/lib/geometry/rect.d.ts +59 -0
- package/dist/lib/geometry/rect.d.ts.map +1 -0
- package/dist/lib/index.cjs +43 -11
- package/dist/lib/index.d.ts +20 -10
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/ir/index.d.ts +5 -0
- package/dist/lib/ir/index.d.ts.map +1 -0
- package/dist/lib/ir/node.cjs +42 -0
- package/dist/lib/ir/node.d.ts +73 -0
- package/dist/lib/ir/node.d.ts.map +1 -0
- package/dist/lib/ir/path/arrow.cjs +25 -0
- package/dist/lib/ir/path/arrow.d.ts +26 -0
- package/dist/lib/ir/path/arrow.d.ts.map +1 -0
- package/dist/lib/ir/path/index.d.ts +5 -0
- package/dist/lib/ir/path/index.d.ts.map +1 -0
- package/dist/lib/ir/path/path.cjs +22 -0
- package/dist/lib/ir/path/path.d.ts +123 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -0
- package/dist/lib/ir/path/step.cjs +35 -0
- package/dist/lib/ir/path/step.d.ts +116 -0
- package/dist/lib/ir/path/step.d.ts.map +1 -0
- package/dist/lib/ir/path/target.cjs +11 -0
- package/dist/lib/ir/path/target.d.ts +5 -0
- package/dist/lib/ir/path/target.d.ts.map +1 -0
- package/dist/lib/ir/position/index.d.ts +3 -0
- package/dist/lib/ir/position/index.d.ts.map +1 -0
- package/dist/lib/ir/position/polar-position.cjs +18 -0
- package/dist/lib/ir/position/polar-position.d.ts +9 -0
- package/dist/lib/ir/position/polar-position.d.ts.map +1 -0
- package/dist/lib/ir/position/position.cjs +5 -0
- package/dist/lib/ir/position/position.d.ts +5 -0
- package/dist/lib/ir/position/position.d.ts.map +1 -0
- package/dist/lib/ir/scene.cjs +16 -0
- package/dist/lib/ir/scene.d.ts +424 -0
- package/dist/lib/ir/scene.d.ts.map +1 -0
- package/dist/lib/parsers/index.d.ts +2 -0
- package/dist/lib/parsers/index.d.ts.map +1 -0
- package/dist/lib/parsers/parseWay.cjs +93 -0
- package/dist/lib/parsers/parseWay.d.ts +71 -0
- package/dist/lib/parsers/parseWay.d.ts.map +1 -0
- package/dist/lib/primitive/ellipse.d.ts +32 -0
- package/dist/lib/primitive/ellipse.d.ts.map +1 -0
- package/dist/lib/primitive/group.d.ts +11 -0
- package/dist/lib/primitive/group.d.ts.map +1 -0
- package/dist/lib/primitive/index.d.ts +8 -0
- package/dist/lib/primitive/index.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +29 -0
- package/dist/lib/primitive/path.d.ts.map +1 -0
- package/dist/lib/primitive/rect.d.ts +28 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -0
- package/dist/lib/primitive/scene.d.ts +21 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -0
- package/dist/lib/primitive/text.d.ts +32 -0
- package/dist/lib/primitive/text.d.ts.map +1 -0
- package/dist/lib/primitive/view-box.d.ts +12 -0
- package/dist/lib/primitive/view-box.d.ts.map +1 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/package.json +26 -34
- package/README.md +0 -2
- package/dist/es/components/Scope.d.ts +0 -6
- package/dist/es/components/Scope.js +0 -12
- package/dist/es/components/TikZ.d.ts +0 -9
- package/dist/es/components/TikZ.js +0 -12
- package/dist/es/components/draw/Draw.d.ts +0 -26
- package/dist/es/components/draw/Draw.js +0 -59
- package/dist/es/components/draw/InnerDraw.d.ts +0 -17
- package/dist/es/components/draw/InnerDraw.js +0 -52
- package/dist/es/components/draw/arrow/circle.d.ts +0 -7
- package/dist/es/components/draw/arrow/circle.js +0 -20
- package/dist/es/components/draw/arrow/index.d.ts +0 -9
- package/dist/es/components/draw/arrow/index.js +0 -13
- package/dist/es/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/es/components/draw/arrow/stealth.js +0 -29
- package/dist/es/components/draw/arrow/types.d.ts +0 -21
- package/dist/es/components/draw/common.d.ts +0 -4
- package/dist/es/components/draw/common.js +0 -12
- package/dist/es/components/draw/index.d.ts +0 -3
- package/dist/es/components/draw/index.js +0 -4
- package/dist/es/components/draw/segment/Segment.d.ts +0 -12
- package/dist/es/components/draw/segment/Segment.js +0 -41
- package/dist/es/components/draw/segment/index.d.ts +0 -15
- package/dist/es/components/draw/segment/index.js +0 -41
- package/dist/es/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/es/components/draw/segment/useArrow.js +0 -52
- package/dist/es/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/es/components/draw/segment/useConvertWay.js +0 -117
- package/dist/es/components/draw/types.d.ts +0 -29
- package/dist/es/components/node/InnerNode.d.ts +0 -33
- package/dist/es/components/node/InnerNode.js +0 -88
- package/dist/es/components/node/Node.d.ts +0 -93
- package/dist/es/components/node/Node.js +0 -88
- package/dist/es/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/es/components/node/_hooks/useNodeConfig.js +0 -13
- package/dist/es/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeContent.js +0 -30
- package/dist/es/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeShape.js +0 -34
- package/dist/es/components/node/index.d.ts +0 -3
- package/dist/es/components/node/index.js +0 -4
- package/dist/es/components/path-node/PathNode.d.ts +0 -48
- package/dist/es/components/path-node/PathNode.js +0 -76
- package/dist/es/components/path-node/index.d.ts +0 -3
- package/dist/es/components/path-node/index.js +0 -4
- package/dist/es/components/path-node/useAnchor.d.ts +0 -6
- package/dist/es/components/path-node/useAnchor.js +0 -49
- package/dist/es/container/Group.d.ts +0 -6
- package/dist/es/container/Group.js +0 -8
- package/dist/es/container/Surface.d.ts +0 -19
- package/dist/es/container/Surface.js +0 -23
- package/dist/es/elements/Path.d.ts +0 -4
- package/dist/es/elements/Path.js +0 -14
- package/dist/es/elements/Rect.d.ts +0 -4
- package/dist/es/elements/Rect.js +0 -9
- package/dist/es/elements/Text.d.ts +0 -18
- package/dist/es/elements/Text.js +0 -35
- package/dist/es/hooks/context/useCalculate.d.ts +0 -7
- package/dist/es/hooks/context/useCalculate.js +0 -9
- package/dist/es/hooks/context/useNodes.d.ts +0 -9
- package/dist/es/hooks/context/useNodes.js +0 -33
- package/dist/es/hooks/context/usePath.d.ts +0 -13
- package/dist/es/hooks/context/usePath.js +0 -20
- package/dist/es/hooks/context/useScope.d.ts +0 -11
- package/dist/es/hooks/context/useScope.js +0 -7
- package/dist/es/hooks/useForceUpdate.d.ts +0 -2
- package/dist/es/hooks/useForceUpdate.js +0 -8
- package/dist/es/model/component/node.d.ts +0 -45
- package/dist/es/model/component/node.js +0 -164
- package/dist/es/model/component/path.d.ts +0 -19
- package/dist/es/model/component/path.js +0 -47
- package/dist/es/model/equation/line.d.ts +0 -21
- package/dist/es/model/equation/line.js +0 -76
- package/dist/es/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/es/model/geometry/point/DescartesPoint.js +0 -50
- package/dist/es/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/es/model/geometry/point/PolarPoint.js +0 -27
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +0 -338
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +0 -13
- package/dist/es/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js +0 -88
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js +0 -6
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js +0 -8
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js +0 -39
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js +0 -41
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js +0 -19
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js +0 -10
- package/dist/es/test.d.ts +0 -3
- package/dist/es/types/coordinate/descartes.d.ts +0 -23
- package/dist/es/types/coordinate/index.d.ts +0 -5
- package/dist/es/types/coordinate/polar.d.ts +0 -5
- package/dist/es/types/distance/index.d.ts +0 -8
- package/dist/es/types/distance/sep.d.ts +0 -9
- package/dist/es/types/shape/index.d.ts +0 -8
- package/dist/es/types/shape/index.js +0 -9
- package/dist/es/types/shape/rect.d.ts +0 -25
- package/dist/es/types/shape/rect.js +0 -30
- package/dist/es/types/svg/font.d.ts +0 -10
- package/dist/es/types/svg/stroke.d.ts +0 -10
- package/dist/es/types/tikz/index.d.ts +0 -6
- package/dist/es/utils/compare.d.ts +0 -4
- package/dist/es/utils/compare.js +0 -20
- package/dist/es/utils/css.d.ts +0 -6
- package/dist/es/utils/css.js +0 -26
- package/dist/es/utils/math.d.ts +0 -9
- package/dist/es/utils/math.js +0 -26
- package/dist/es/utils/string.d.ts +0 -7
- package/dist/es/utils/string.js +0 -7
- package/dist/es/utils/style/font.d.ts +0 -17
- package/dist/es/utils/style/font.js +0 -34
- package/dist/es/utils/style/stroke.d.ts +0 -20
- package/dist/es/utils/style/stroke.js +0 -42
- package/dist/lib/components/Scope.cjs +0 -12
- package/dist/lib/components/Scope.d.ts +0 -6
- package/dist/lib/components/TikZ.cjs +0 -12
- package/dist/lib/components/TikZ.d.ts +0 -9
- package/dist/lib/components/draw/Draw.cjs +0 -59
- package/dist/lib/components/draw/Draw.d.ts +0 -26
- package/dist/lib/components/draw/InnerDraw.cjs +0 -52
- package/dist/lib/components/draw/InnerDraw.d.ts +0 -17
- package/dist/lib/components/draw/arrow/circle.cjs +0 -20
- package/dist/lib/components/draw/arrow/circle.d.ts +0 -7
- package/dist/lib/components/draw/arrow/index.cjs +0 -13
- package/dist/lib/components/draw/arrow/index.d.ts +0 -9
- package/dist/lib/components/draw/arrow/stealth.cjs +0 -29
- package/dist/lib/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/lib/components/draw/arrow/types.d.ts +0 -21
- package/dist/lib/components/draw/common.cjs +0 -12
- package/dist/lib/components/draw/common.d.ts +0 -4
- package/dist/lib/components/draw/index.cjs +0 -4
- package/dist/lib/components/draw/index.d.ts +0 -3
- package/dist/lib/components/draw/segment/Segment.cjs +0 -41
- package/dist/lib/components/draw/segment/Segment.d.ts +0 -12
- package/dist/lib/components/draw/segment/index.cjs +0 -41
- package/dist/lib/components/draw/segment/index.d.ts +0 -15
- package/dist/lib/components/draw/segment/useArrow.cjs +0 -52
- package/dist/lib/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/lib/components/draw/segment/useConvertWay.cjs +0 -117
- package/dist/lib/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/lib/components/draw/types.d.ts +0 -29
- package/dist/lib/components/node/InnerNode.cjs +0 -88
- package/dist/lib/components/node/InnerNode.d.ts +0 -33
- package/dist/lib/components/node/Node.cjs +0 -88
- package/dist/lib/components/node/Node.d.ts +0 -93
- package/dist/lib/components/node/_hooks/useNodeConfig.cjs +0 -13
- package/dist/lib/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/lib/components/node/_hooks/useNodeContent.cjs +0 -30
- package/dist/lib/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/lib/components/node/_hooks/useNodeShape.cjs +0 -34
- package/dist/lib/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/lib/components/node/index.cjs +0 -4
- package/dist/lib/components/node/index.d.ts +0 -3
- package/dist/lib/components/path-node/PathNode.cjs +0 -76
- package/dist/lib/components/path-node/PathNode.d.ts +0 -48
- package/dist/lib/components/path-node/index.cjs +0 -4
- package/dist/lib/components/path-node/index.d.ts +0 -3
- package/dist/lib/components/path-node/useAnchor.cjs +0 -49
- package/dist/lib/components/path-node/useAnchor.d.ts +0 -6
- package/dist/lib/container/Group.cjs +0 -8
- package/dist/lib/container/Group.d.ts +0 -6
- package/dist/lib/container/Surface.cjs +0 -23
- package/dist/lib/container/Surface.d.ts +0 -19
- package/dist/lib/elements/Path.cjs +0 -14
- package/dist/lib/elements/Path.d.ts +0 -4
- package/dist/lib/elements/Rect.cjs +0 -9
- package/dist/lib/elements/Rect.d.ts +0 -4
- package/dist/lib/elements/Text.cjs +0 -35
- package/dist/lib/elements/Text.d.ts +0 -18
- package/dist/lib/hooks/context/useCalculate.cjs +0 -9
- package/dist/lib/hooks/context/useCalculate.d.ts +0 -7
- package/dist/lib/hooks/context/useNodes.cjs +0 -33
- package/dist/lib/hooks/context/useNodes.d.ts +0 -9
- package/dist/lib/hooks/context/usePath.cjs +0 -20
- package/dist/lib/hooks/context/usePath.d.ts +0 -13
- package/dist/lib/hooks/context/useScope.cjs +0 -7
- package/dist/lib/hooks/context/useScope.d.ts +0 -11
- package/dist/lib/hooks/useForceUpdate.cjs +0 -8
- package/dist/lib/hooks/useForceUpdate.d.ts +0 -2
- package/dist/lib/model/component/node.cjs +0 -164
- package/dist/lib/model/component/node.d.ts +0 -45
- package/dist/lib/model/component/path.cjs +0 -47
- package/dist/lib/model/component/path.d.ts +0 -19
- package/dist/lib/model/equation/line.cjs +0 -76
- package/dist/lib/model/equation/line.d.ts +0 -21
- package/dist/lib/model/geometry/point/DescartesPoint.cjs +0 -50
- package/dist/lib/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/lib/model/geometry/point/PolarPoint.cjs +0 -27
- package/dist/lib/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.cjs +0 -338
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.cjs +0 -13
- package/dist/lib/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.cjs +0 -88
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.cjs +0 -6
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.cjs +0 -8
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.cjs +0 -39
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.cjs +0 -41
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.cjs +0 -19
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.cjs +0 -10
- package/dist/lib/test.d.ts +0 -3
- package/dist/lib/types/coordinate/descartes.d.ts +0 -23
- package/dist/lib/types/coordinate/index.d.ts +0 -5
- package/dist/lib/types/coordinate/polar.d.ts +0 -5
- package/dist/lib/types/distance/index.d.ts +0 -8
- package/dist/lib/types/distance/sep.d.ts +0 -9
- package/dist/lib/types/shape/index.cjs +0 -9
- package/dist/lib/types/shape/index.d.ts +0 -8
- package/dist/lib/types/shape/rect.cjs +0 -30
- package/dist/lib/types/shape/rect.d.ts +0 -25
- package/dist/lib/types/svg/font.d.ts +0 -10
- package/dist/lib/types/svg/stroke.d.ts +0 -10
- package/dist/lib/types/tikz/index.d.ts +0 -6
- package/dist/lib/utils/compare.cjs +0 -20
- package/dist/lib/utils/compare.d.ts +0 -4
- package/dist/lib/utils/css.cjs +0 -26
- package/dist/lib/utils/css.d.ts +0 -6
- package/dist/lib/utils/math.cjs +0 -26
- package/dist/lib/utils/math.d.ts +0 -9
- package/dist/lib/utils/string.cjs +0 -7
- package/dist/lib/utils/string.d.ts +0 -7
- package/dist/lib/utils/style/font.cjs +0 -34
- package/dist/lib/utils/style/font.d.ts +0 -17
- package/dist/lib/utils/style/stroke.cjs +0 -42
- package/dist/lib/utils/style/stroke.d.ts +0 -20
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const require_position = require("./position.cjs");
|
|
2
|
+
let zod = require("zod");
|
|
3
|
+
//#region src/ir/position/polar-position.ts
|
|
4
|
+
/**
|
|
5
|
+
* 极坐标点 schema(递归——origin 可嵌套)。
|
|
6
|
+
* 用 z.lazy 处理自引用;TS 类型从 geometry/polar 导入并 cast 到 schema。
|
|
7
|
+
*/
|
|
8
|
+
var PolarPositionSchema = zod.z.lazy(() => zod.z.object({
|
|
9
|
+
origin: zod.z.union([
|
|
10
|
+
zod.z.string().min(1),
|
|
11
|
+
require_position.PositionSchema,
|
|
12
|
+
PolarPositionSchema
|
|
13
|
+
]).optional().describe("Origin reference: node id string, Cartesian [x, y], or nested PolarPosition (chained); defaults to [0, 0] when omitted"),
|
|
14
|
+
angle: zod.z.number().describe("Angle in degrees, counter-clockwise positive (TikZ convention)"),
|
|
15
|
+
radius: zod.z.number().describe("Radius / distance in user units")
|
|
16
|
+
}).describe("Polar coordinate position; resolved to Cartesian at Scene compile time"));
|
|
17
|
+
//#endregion
|
|
18
|
+
exports.PolarPositionSchema = PolarPositionSchema;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { PolarPosition } from '../../geometry/polar';
|
|
3
|
+
/**
|
|
4
|
+
* 极坐标点 schema(递归——origin 可嵌套)。
|
|
5
|
+
* 用 z.lazy 处理自引用;TS 类型从 geometry/polar 导入并 cast 到 schema。
|
|
6
|
+
*/
|
|
7
|
+
export declare const PolarPositionSchema: z.ZodType<PolarPosition>;
|
|
8
|
+
export type { PolarPosition } from '../../geometry/polar';
|
|
9
|
+
//# sourceMappingURL=polar-position.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polar-position.d.ts","sourceRoot":"","sources":["../../../../src/ir/position/polar-position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAmBxD,CAAC;AAGF,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../src/ir/position/position.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc,8CAEa,CAAC;AAEzC,mBAAmB;AACnB,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const require_path = require("./path/path.cjs");
|
|
2
|
+
const require_node = require("./node.cjs");
|
|
3
|
+
let zod = require("zod");
|
|
4
|
+
//#region src/ir/scene.ts
|
|
5
|
+
var ChildSchema = zod.z.discriminatedUnion("type", [require_node.NodeSchema, require_path.PathSchema]).describe("Top-level scene child: either a node or a path; discriminator field is `type`");
|
|
6
|
+
var SceneSchema = zod.z.object({
|
|
7
|
+
version: zod.z.literal(1).describe("IR major version number; bump only on breaking schema changes"),
|
|
8
|
+
type: zod.z.literal("scene").describe("Discriminator marking this object as the root scene"),
|
|
9
|
+
children: zod.z.array(ChildSchema).describe("Top-level children of the scene; nodes register ids that paths can reference")
|
|
10
|
+
}).describe("Top-level retikz IR scene — the canonical, JSON-serializable representation of a drawing");
|
|
11
|
+
/** IR 当前主版本号;只在 schema 出现破坏性变更时递增 */
|
|
12
|
+
var CURRENT_IR_VERSION = 1;
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.CURRENT_IR_VERSION = CURRENT_IR_VERSION;
|
|
15
|
+
exports.ChildSchema = ChildSchema;
|
|
16
|
+
exports.SceneSchema = SceneSchema;
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ChildSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"node">;
|
|
4
|
+
id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
shape: z.ZodOptional<z.ZodNativeEnum<{
|
|
6
|
+
readonly rectangle: "rectangle";
|
|
7
|
+
readonly circle: "circle";
|
|
8
|
+
readonly ellipse: "ellipse";
|
|
9
|
+
readonly diamond: "diamond";
|
|
10
|
+
}>>;
|
|
11
|
+
position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>]>;
|
|
12
|
+
rotate: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
text: z.ZodOptional<z.ZodString>;
|
|
14
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
15
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
16
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
17
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
}, "strip", z.ZodTypeAny, {
|
|
21
|
+
type: "node";
|
|
22
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
23
|
+
fill?: string | undefined;
|
|
24
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
25
|
+
stroke?: string | undefined;
|
|
26
|
+
strokeWidth?: number | undefined;
|
|
27
|
+
id?: string | undefined;
|
|
28
|
+
rotate?: number | undefined;
|
|
29
|
+
text?: string | undefined;
|
|
30
|
+
padding?: number | undefined;
|
|
31
|
+
margin?: number | undefined;
|
|
32
|
+
fontSize?: number | undefined;
|
|
33
|
+
}, {
|
|
34
|
+
type: "node";
|
|
35
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
36
|
+
fill?: string | undefined;
|
|
37
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
38
|
+
stroke?: string | undefined;
|
|
39
|
+
strokeWidth?: number | undefined;
|
|
40
|
+
id?: string | undefined;
|
|
41
|
+
rotate?: number | undefined;
|
|
42
|
+
text?: string | undefined;
|
|
43
|
+
padding?: number | undefined;
|
|
44
|
+
margin?: number | undefined;
|
|
45
|
+
fontSize?: number | undefined;
|
|
46
|
+
}>, z.ZodObject<{
|
|
47
|
+
type: z.ZodLiteral<"path">;
|
|
48
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
49
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
50
|
+
strokeDasharray: z.ZodOptional<z.ZodString>;
|
|
51
|
+
arrow: z.ZodOptional<z.ZodEnum<["none", "->", "<-", "<->"]>>;
|
|
52
|
+
arrowShape: z.ZodOptional<z.ZodNativeEnum<{
|
|
53
|
+
readonly normal: "normal";
|
|
54
|
+
readonly open: "open";
|
|
55
|
+
readonly stealth: "stealth";
|
|
56
|
+
readonly diamond: "diamond";
|
|
57
|
+
readonly openDiamond: "openDiamond";
|
|
58
|
+
readonly circle: "circle";
|
|
59
|
+
readonly openCircle: "openCircle";
|
|
60
|
+
}>>;
|
|
61
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
62
|
+
fillRule: z.ZodOptional<z.ZodEnum<["nonzero", "evenodd"]>>;
|
|
63
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
64
|
+
type: z.ZodLiteral<"step">;
|
|
65
|
+
kind: z.ZodLiteral<"move">;
|
|
66
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
type: "step";
|
|
69
|
+
kind: "move";
|
|
70
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
71
|
+
}, {
|
|
72
|
+
type: "step";
|
|
73
|
+
kind: "move";
|
|
74
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
75
|
+
}>, z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<"step">;
|
|
77
|
+
kind: z.ZodLiteral<"line">;
|
|
78
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
type: "step";
|
|
81
|
+
kind: "line";
|
|
82
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
83
|
+
}, {
|
|
84
|
+
type: "step";
|
|
85
|
+
kind: "line";
|
|
86
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
87
|
+
}>, z.ZodObject<{
|
|
88
|
+
type: z.ZodLiteral<"step">;
|
|
89
|
+
kind: z.ZodLiteral<"step">;
|
|
90
|
+
via: z.ZodEnum<["-|", "|-"]>;
|
|
91
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
92
|
+
}, "strip", z.ZodTypeAny, {
|
|
93
|
+
type: "step";
|
|
94
|
+
kind: "step";
|
|
95
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
96
|
+
via: "-|" | "|-";
|
|
97
|
+
}, {
|
|
98
|
+
type: "step";
|
|
99
|
+
kind: "step";
|
|
100
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
101
|
+
via: "-|" | "|-";
|
|
102
|
+
}>, z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"step">;
|
|
104
|
+
kind: z.ZodLiteral<"cycle">;
|
|
105
|
+
}, "strip", z.ZodTypeAny, {
|
|
106
|
+
type: "step";
|
|
107
|
+
kind: "cycle";
|
|
108
|
+
}, {
|
|
109
|
+
type: "step";
|
|
110
|
+
kind: "cycle";
|
|
111
|
+
}>]>, "many">;
|
|
112
|
+
}, "strip", z.ZodTypeAny, {
|
|
113
|
+
type: "path";
|
|
114
|
+
children: ({
|
|
115
|
+
type: "step";
|
|
116
|
+
kind: "move";
|
|
117
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
118
|
+
} | {
|
|
119
|
+
type: "step";
|
|
120
|
+
kind: "line";
|
|
121
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
122
|
+
} | {
|
|
123
|
+
type: "step";
|
|
124
|
+
kind: "step";
|
|
125
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
126
|
+
via: "-|" | "|-";
|
|
127
|
+
} | {
|
|
128
|
+
type: "step";
|
|
129
|
+
kind: "cycle";
|
|
130
|
+
})[];
|
|
131
|
+
fill?: string | undefined;
|
|
132
|
+
stroke?: string | undefined;
|
|
133
|
+
strokeWidth?: number | undefined;
|
|
134
|
+
strokeDasharray?: string | undefined;
|
|
135
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
136
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
137
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
138
|
+
}, {
|
|
139
|
+
type: "path";
|
|
140
|
+
children: ({
|
|
141
|
+
type: "step";
|
|
142
|
+
kind: "move";
|
|
143
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
144
|
+
} | {
|
|
145
|
+
type: "step";
|
|
146
|
+
kind: "line";
|
|
147
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
148
|
+
} | {
|
|
149
|
+
type: "step";
|
|
150
|
+
kind: "step";
|
|
151
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
152
|
+
via: "-|" | "|-";
|
|
153
|
+
} | {
|
|
154
|
+
type: "step";
|
|
155
|
+
kind: "cycle";
|
|
156
|
+
})[];
|
|
157
|
+
fill?: string | undefined;
|
|
158
|
+
stroke?: string | undefined;
|
|
159
|
+
strokeWidth?: number | undefined;
|
|
160
|
+
strokeDasharray?: string | undefined;
|
|
161
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
162
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
163
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
164
|
+
}>]>;
|
|
165
|
+
/** 顶层 Scene 的子节点:node 或 path */
|
|
166
|
+
export type IRChild = z.infer<typeof ChildSchema>;
|
|
167
|
+
export declare const SceneSchema: z.ZodObject<{
|
|
168
|
+
version: z.ZodLiteral<1>;
|
|
169
|
+
type: z.ZodLiteral<"scene">;
|
|
170
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"node">;
|
|
172
|
+
id: z.ZodOptional<z.ZodString>;
|
|
173
|
+
shape: z.ZodOptional<z.ZodNativeEnum<{
|
|
174
|
+
readonly rectangle: "rectangle";
|
|
175
|
+
readonly circle: "circle";
|
|
176
|
+
readonly ellipse: "ellipse";
|
|
177
|
+
readonly diamond: "diamond";
|
|
178
|
+
}>>;
|
|
179
|
+
position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>]>;
|
|
180
|
+
rotate: z.ZodOptional<z.ZodNumber>;
|
|
181
|
+
text: z.ZodOptional<z.ZodString>;
|
|
182
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
183
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
184
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
185
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
186
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
187
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
188
|
+
}, "strip", z.ZodTypeAny, {
|
|
189
|
+
type: "node";
|
|
190
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
191
|
+
fill?: string | undefined;
|
|
192
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
193
|
+
stroke?: string | undefined;
|
|
194
|
+
strokeWidth?: number | undefined;
|
|
195
|
+
id?: string | undefined;
|
|
196
|
+
rotate?: number | undefined;
|
|
197
|
+
text?: string | undefined;
|
|
198
|
+
padding?: number | undefined;
|
|
199
|
+
margin?: number | undefined;
|
|
200
|
+
fontSize?: number | undefined;
|
|
201
|
+
}, {
|
|
202
|
+
type: "node";
|
|
203
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
204
|
+
fill?: string | undefined;
|
|
205
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
206
|
+
stroke?: string | undefined;
|
|
207
|
+
strokeWidth?: number | undefined;
|
|
208
|
+
id?: string | undefined;
|
|
209
|
+
rotate?: number | undefined;
|
|
210
|
+
text?: string | undefined;
|
|
211
|
+
padding?: number | undefined;
|
|
212
|
+
margin?: number | undefined;
|
|
213
|
+
fontSize?: number | undefined;
|
|
214
|
+
}>, z.ZodObject<{
|
|
215
|
+
type: z.ZodLiteral<"path">;
|
|
216
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
217
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
218
|
+
strokeDasharray: z.ZodOptional<z.ZodString>;
|
|
219
|
+
arrow: z.ZodOptional<z.ZodEnum<["none", "->", "<-", "<->"]>>;
|
|
220
|
+
arrowShape: z.ZodOptional<z.ZodNativeEnum<{
|
|
221
|
+
readonly normal: "normal";
|
|
222
|
+
readonly open: "open";
|
|
223
|
+
readonly stealth: "stealth";
|
|
224
|
+
readonly diamond: "diamond";
|
|
225
|
+
readonly openDiamond: "openDiamond";
|
|
226
|
+
readonly circle: "circle";
|
|
227
|
+
readonly openCircle: "openCircle";
|
|
228
|
+
}>>;
|
|
229
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
230
|
+
fillRule: z.ZodOptional<z.ZodEnum<["nonzero", "evenodd"]>>;
|
|
231
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
232
|
+
type: z.ZodLiteral<"step">;
|
|
233
|
+
kind: z.ZodLiteral<"move">;
|
|
234
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
type: "step";
|
|
237
|
+
kind: "move";
|
|
238
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
239
|
+
}, {
|
|
240
|
+
type: "step";
|
|
241
|
+
kind: "move";
|
|
242
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
243
|
+
}>, z.ZodObject<{
|
|
244
|
+
type: z.ZodLiteral<"step">;
|
|
245
|
+
kind: z.ZodLiteral<"line">;
|
|
246
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
247
|
+
}, "strip", z.ZodTypeAny, {
|
|
248
|
+
type: "step";
|
|
249
|
+
kind: "line";
|
|
250
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
251
|
+
}, {
|
|
252
|
+
type: "step";
|
|
253
|
+
kind: "line";
|
|
254
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
255
|
+
}>, z.ZodObject<{
|
|
256
|
+
type: z.ZodLiteral<"step">;
|
|
257
|
+
kind: z.ZodLiteral<"step">;
|
|
258
|
+
via: z.ZodEnum<["-|", "|-"]>;
|
|
259
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
260
|
+
}, "strip", z.ZodTypeAny, {
|
|
261
|
+
type: "step";
|
|
262
|
+
kind: "step";
|
|
263
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
264
|
+
via: "-|" | "|-";
|
|
265
|
+
}, {
|
|
266
|
+
type: "step";
|
|
267
|
+
kind: "step";
|
|
268
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
269
|
+
via: "-|" | "|-";
|
|
270
|
+
}>, z.ZodObject<{
|
|
271
|
+
type: z.ZodLiteral<"step">;
|
|
272
|
+
kind: z.ZodLiteral<"cycle">;
|
|
273
|
+
}, "strip", z.ZodTypeAny, {
|
|
274
|
+
type: "step";
|
|
275
|
+
kind: "cycle";
|
|
276
|
+
}, {
|
|
277
|
+
type: "step";
|
|
278
|
+
kind: "cycle";
|
|
279
|
+
}>]>, "many">;
|
|
280
|
+
}, "strip", z.ZodTypeAny, {
|
|
281
|
+
type: "path";
|
|
282
|
+
children: ({
|
|
283
|
+
type: "step";
|
|
284
|
+
kind: "move";
|
|
285
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
286
|
+
} | {
|
|
287
|
+
type: "step";
|
|
288
|
+
kind: "line";
|
|
289
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
290
|
+
} | {
|
|
291
|
+
type: "step";
|
|
292
|
+
kind: "step";
|
|
293
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
294
|
+
via: "-|" | "|-";
|
|
295
|
+
} | {
|
|
296
|
+
type: "step";
|
|
297
|
+
kind: "cycle";
|
|
298
|
+
})[];
|
|
299
|
+
fill?: string | undefined;
|
|
300
|
+
stroke?: string | undefined;
|
|
301
|
+
strokeWidth?: number | undefined;
|
|
302
|
+
strokeDasharray?: string | undefined;
|
|
303
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
304
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
305
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
306
|
+
}, {
|
|
307
|
+
type: "path";
|
|
308
|
+
children: ({
|
|
309
|
+
type: "step";
|
|
310
|
+
kind: "move";
|
|
311
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
312
|
+
} | {
|
|
313
|
+
type: "step";
|
|
314
|
+
kind: "line";
|
|
315
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
316
|
+
} | {
|
|
317
|
+
type: "step";
|
|
318
|
+
kind: "step";
|
|
319
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
320
|
+
via: "-|" | "|-";
|
|
321
|
+
} | {
|
|
322
|
+
type: "step";
|
|
323
|
+
kind: "cycle";
|
|
324
|
+
})[];
|
|
325
|
+
fill?: string | undefined;
|
|
326
|
+
stroke?: string | undefined;
|
|
327
|
+
strokeWidth?: number | undefined;
|
|
328
|
+
strokeDasharray?: string | undefined;
|
|
329
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
330
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
331
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
332
|
+
}>]>, "many">;
|
|
333
|
+
}, "strip", z.ZodTypeAny, {
|
|
334
|
+
type: "scene";
|
|
335
|
+
children: ({
|
|
336
|
+
type: "path";
|
|
337
|
+
children: ({
|
|
338
|
+
type: "step";
|
|
339
|
+
kind: "move";
|
|
340
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
341
|
+
} | {
|
|
342
|
+
type: "step";
|
|
343
|
+
kind: "line";
|
|
344
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
345
|
+
} | {
|
|
346
|
+
type: "step";
|
|
347
|
+
kind: "step";
|
|
348
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
349
|
+
via: "-|" | "|-";
|
|
350
|
+
} | {
|
|
351
|
+
type: "step";
|
|
352
|
+
kind: "cycle";
|
|
353
|
+
})[];
|
|
354
|
+
fill?: string | undefined;
|
|
355
|
+
stroke?: string | undefined;
|
|
356
|
+
strokeWidth?: number | undefined;
|
|
357
|
+
strokeDasharray?: string | undefined;
|
|
358
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
359
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
360
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
361
|
+
} | {
|
|
362
|
+
type: "node";
|
|
363
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
364
|
+
fill?: string | undefined;
|
|
365
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
366
|
+
stroke?: string | undefined;
|
|
367
|
+
strokeWidth?: number | undefined;
|
|
368
|
+
id?: string | undefined;
|
|
369
|
+
rotate?: number | undefined;
|
|
370
|
+
text?: string | undefined;
|
|
371
|
+
padding?: number | undefined;
|
|
372
|
+
margin?: number | undefined;
|
|
373
|
+
fontSize?: number | undefined;
|
|
374
|
+
})[];
|
|
375
|
+
version: 1;
|
|
376
|
+
}, {
|
|
377
|
+
type: "scene";
|
|
378
|
+
children: ({
|
|
379
|
+
type: "path";
|
|
380
|
+
children: ({
|
|
381
|
+
type: "step";
|
|
382
|
+
kind: "move";
|
|
383
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
384
|
+
} | {
|
|
385
|
+
type: "step";
|
|
386
|
+
kind: "line";
|
|
387
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
388
|
+
} | {
|
|
389
|
+
type: "step";
|
|
390
|
+
kind: "step";
|
|
391
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
392
|
+
via: "-|" | "|-";
|
|
393
|
+
} | {
|
|
394
|
+
type: "step";
|
|
395
|
+
kind: "cycle";
|
|
396
|
+
})[];
|
|
397
|
+
fill?: string | undefined;
|
|
398
|
+
stroke?: string | undefined;
|
|
399
|
+
strokeWidth?: number | undefined;
|
|
400
|
+
strokeDasharray?: string | undefined;
|
|
401
|
+
arrow?: "none" | "->" | "<-" | "<->" | undefined;
|
|
402
|
+
arrowShape?: "normal" | "open" | "stealth" | "diamond" | "openDiamond" | "circle" | "openCircle" | undefined;
|
|
403
|
+
fillRule?: "nonzero" | "evenodd" | undefined;
|
|
404
|
+
} | {
|
|
405
|
+
type: "node";
|
|
406
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
407
|
+
fill?: string | undefined;
|
|
408
|
+
shape?: "diamond" | "circle" | "rectangle" | "ellipse" | undefined;
|
|
409
|
+
stroke?: string | undefined;
|
|
410
|
+
strokeWidth?: number | undefined;
|
|
411
|
+
id?: string | undefined;
|
|
412
|
+
rotate?: number | undefined;
|
|
413
|
+
text?: string | undefined;
|
|
414
|
+
padding?: number | undefined;
|
|
415
|
+
margin?: number | undefined;
|
|
416
|
+
fontSize?: number | undefined;
|
|
417
|
+
})[];
|
|
418
|
+
version: 1;
|
|
419
|
+
}>;
|
|
420
|
+
/** retikz IR 顶层 Scene——可序列化 JSON 形式的绘制描述 */
|
|
421
|
+
export type IR = z.infer<typeof SceneSchema>;
|
|
422
|
+
/** IR 当前主版本号;只在 schema 出现破坏性变更时递增 */
|
|
423
|
+
export declare const CURRENT_IR_VERSION: 1;
|
|
424
|
+
//# sourceMappingURL=scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/ir/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIrB,CAAC;AAEJ,gCAAgC;AAChC,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAElD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBrB,CAAC;AAEJ,4CAA4C;AAC5C,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7C,qCAAqC;AACrC,eAAO,MAAM,kBAAkB,EAAG,CAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parsers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/parsers/parseWay.ts
|
|
2
|
+
/**
|
|
3
|
+
* Sugar 层 way 数组的"关键字常量"。
|
|
4
|
+
*
|
|
5
|
+
* - `DrawWay.cycle`:闭合到 way 起点(way 元素位置)。**底层字符串故意取得很丑**
|
|
6
|
+
* (`'retikz-keyword_cycle'`),保证不会与任何合理的节点 id 冲突;用户应当
|
|
7
|
+
* 只通过 `DrawWay.cycle` 引用,不要直接写裸字面量。
|
|
8
|
+
* - `DrawWay.hv`:折角算子,先水平后垂直(裸字面量 `'-|'`)。
|
|
9
|
+
* - `DrawWay.vh`:折角算子,先垂直后水平(裸字面量 `'|-'`)。
|
|
10
|
+
*
|
|
11
|
+
* 折角值(`-|` / `|-`)含特殊字符,与节点 id 不会冲突,因此**保留字面量与
|
|
12
|
+
* 常量两种写法都合法**。way 数组里直接放 `'-|'` 或 `'|-'`(infix 算子)
|
|
13
|
+
* 即把"上一项 → 下一项"那一段改成折角。
|
|
14
|
+
*
|
|
15
|
+
* 这里**故意不用 TS enum**——enum 在数值场景下生成 reverse-mapping 表、
|
|
16
|
+
* 在 string 场景下与字面量类型不互通,而 const + `as const` 的字面量联合
|
|
17
|
+
* 既可枚举也可与字面量字符串无缝混用。
|
|
18
|
+
*/
|
|
19
|
+
var DrawWay = {
|
|
20
|
+
/**
|
|
21
|
+
* 闭合 way 到起点,等价于 `<Step kind="cycle" />`(TikZ 同名保留字 / SVG `Z`)。
|
|
22
|
+
* 底层字符串值刻意写丑以避开节点 id 冲突;不要硬编码这个字符串。
|
|
23
|
+
*/
|
|
24
|
+
cycle: "retikz-keyword_cycle",
|
|
25
|
+
/** 折角:先水平后垂直(TikZ `-|`) */
|
|
26
|
+
hv: "-|",
|
|
27
|
+
/** 折角:先垂直后水平(TikZ `|-`) */
|
|
28
|
+
vh: "|-"
|
|
29
|
+
};
|
|
30
|
+
var isWayCycle = (item) => item === DrawWay.cycle;
|
|
31
|
+
var isWayVia = (item) => item === DrawWay.hv || item === DrawWay.vh;
|
|
32
|
+
/** 把 WayItem 归约为它的"目标点"——target 直接返回;算子/关键字返回 null */
|
|
33
|
+
var targetOf = (item) => {
|
|
34
|
+
if (isWayCycle(item) || isWayVia(item)) return null;
|
|
35
|
+
return item;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* 把 way 数组翻译为 IRStep 序列。
|
|
39
|
+
*
|
|
40
|
+
* - 第一个元素始终是 move:取 way[0] 的目标点;若 way[0] 是 cycle / via 算子等
|
|
41
|
+
* 非 target 项,则降级到原点 `[0, 0]`(容错)。
|
|
42
|
+
* - 后续元素:
|
|
43
|
+
* - 普通 target → line
|
|
44
|
+
* - `DrawWay.cycle` → cycle 步
|
|
45
|
+
* - `'-|'` / `'|-'` → 与**下一项**合并成 fold 步;操作符在 way 末尾或后
|
|
46
|
+
* 接非 target 项时抛错
|
|
47
|
+
*
|
|
48
|
+
* 这是纯函数,住在 core,被各框架 adapter 的 Sugar 组件复用。
|
|
49
|
+
*/
|
|
50
|
+
var parseWay = (way) => {
|
|
51
|
+
if (way.length < 2) throw new Error("parseWay: way must contain at least 2 items");
|
|
52
|
+
const out = [];
|
|
53
|
+
const moveStep = {
|
|
54
|
+
type: "step",
|
|
55
|
+
kind: "move",
|
|
56
|
+
to: targetOf(way[0]) ?? [0, 0]
|
|
57
|
+
};
|
|
58
|
+
out.push(moveStep);
|
|
59
|
+
for (let i = 1; i < way.length; i++) {
|
|
60
|
+
const item = way[i];
|
|
61
|
+
if (isWayCycle(item)) {
|
|
62
|
+
out.push({
|
|
63
|
+
type: "step",
|
|
64
|
+
kind: "cycle"
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (isWayVia(item)) {
|
|
69
|
+
if (i + 1 >= way.length) throw new Error(`parseWay: via operator '${item}' at end of way must be followed by a target`);
|
|
70
|
+
const next = way[i + 1];
|
|
71
|
+
if (isWayCycle(next) || isWayVia(next)) throw new Error(`parseWay: via operator '${item}' must be followed by a target, got '${String(next)}'`);
|
|
72
|
+
const fold = {
|
|
73
|
+
type: "step",
|
|
74
|
+
kind: "step",
|
|
75
|
+
via: item,
|
|
76
|
+
to: next
|
|
77
|
+
};
|
|
78
|
+
out.push(fold);
|
|
79
|
+
i++;
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const lineStep = {
|
|
83
|
+
type: "step",
|
|
84
|
+
kind: "line",
|
|
85
|
+
to: item
|
|
86
|
+
};
|
|
87
|
+
out.push(lineStep);
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
};
|
|
91
|
+
//#endregion
|
|
92
|
+
exports.DrawWay = DrawWay;
|
|
93
|
+
exports.parseWay = parseWay;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { IRStep, IRTarget } from '../ir';
|
|
2
|
+
/**
|
|
3
|
+
* Sugar 层 way 数组的"关键字常量"。
|
|
4
|
+
*
|
|
5
|
+
* - `DrawWay.cycle`:闭合到 way 起点(way 元素位置)。**底层字符串故意取得很丑**
|
|
6
|
+
* (`'retikz-keyword_cycle'`),保证不会与任何合理的节点 id 冲突;用户应当
|
|
7
|
+
* 只通过 `DrawWay.cycle` 引用,不要直接写裸字面量。
|
|
8
|
+
* - `DrawWay.hv`:折角算子,先水平后垂直(裸字面量 `'-|'`)。
|
|
9
|
+
* - `DrawWay.vh`:折角算子,先垂直后水平(裸字面量 `'|-'`)。
|
|
10
|
+
*
|
|
11
|
+
* 折角值(`-|` / `|-`)含特殊字符,与节点 id 不会冲突,因此**保留字面量与
|
|
12
|
+
* 常量两种写法都合法**。way 数组里直接放 `'-|'` 或 `'|-'`(infix 算子)
|
|
13
|
+
* 即把"上一项 → 下一项"那一段改成折角。
|
|
14
|
+
*
|
|
15
|
+
* 这里**故意不用 TS enum**——enum 在数值场景下生成 reverse-mapping 表、
|
|
16
|
+
* 在 string 场景下与字面量类型不互通,而 const + `as const` 的字面量联合
|
|
17
|
+
* 既可枚举也可与字面量字符串无缝混用。
|
|
18
|
+
*/
|
|
19
|
+
export declare const DrawWay: {
|
|
20
|
+
/**
|
|
21
|
+
* 闭合 way 到起点,等价于 `<Step kind="cycle" />`(TikZ 同名保留字 / SVG `Z`)。
|
|
22
|
+
* 底层字符串值刻意写丑以避开节点 id 冲突;不要硬编码这个字符串。
|
|
23
|
+
*/
|
|
24
|
+
readonly cycle: "retikz-keyword_cycle";
|
|
25
|
+
/** 折角:先水平后垂直(TikZ `-|`) */
|
|
26
|
+
readonly hv: "-|";
|
|
27
|
+
/** 折角:先垂直后水平(TikZ `|-`) */
|
|
28
|
+
readonly vh: "|-";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* way 折角算子的字面量类型。`DrawWay.hv` / `DrawWay.vh` 与裸字面量等价。
|
|
32
|
+
*/
|
|
33
|
+
export type WayVia = typeof DrawWay.hv | typeof DrawWay.vh;
|
|
34
|
+
/**
|
|
35
|
+
* way 闭合关键字的字面量类型,由 `DrawWay.cycle` 派生。
|
|
36
|
+
*/
|
|
37
|
+
export type WayCycle = typeof DrawWay.cycle;
|
|
38
|
+
/**
|
|
39
|
+
* Sugar 层的 way 数组 DSL 元素。
|
|
40
|
+
*
|
|
41
|
+
* v0.1.0-alpha.1 接受五种形态:
|
|
42
|
+
* - 节点 id 字符串:`'A'` → line(首项时为 move)
|
|
43
|
+
* - 笛卡尔坐标:`[x, y]` → line
|
|
44
|
+
* - 极坐标:`{ origin?, angle, radius }` → line
|
|
45
|
+
* - 折角算子:`'-|'` / `'|-'`(或 `DrawWay.hv` / `DrawWay.vh`)→ 当前项 +
|
|
46
|
+
* **下一项**合并成一个折角 step(与 TikZ 的 `(A) -| (B)` infix 写法对齐)
|
|
47
|
+
* - 闭合关键字:`DrawWay.cycle` → cycle(闭合到起点)
|
|
48
|
+
*
|
|
49
|
+
* 后续会加:相对位移(`{ rel: [x, y] }`)、curve / cubic 等。
|
|
50
|
+
*
|
|
51
|
+
* 注意:闭合刻意只走 `DrawWay.cycle`(底层字符串是 `'retikz-keyword_cycle'`),
|
|
52
|
+
* 这样裸字符串 `'cycle'` 仍可作为正常节点 id 使用。
|
|
53
|
+
*/
|
|
54
|
+
export type WayItem = IRTarget | WayVia | WayCycle;
|
|
55
|
+
/** way DSL 数组:sugar `<Draw way={...}>` 接受的输入形态 */
|
|
56
|
+
export type WayDSL = Array<WayItem>;
|
|
57
|
+
/**
|
|
58
|
+
* 把 way 数组翻译为 IRStep 序列。
|
|
59
|
+
*
|
|
60
|
+
* - 第一个元素始终是 move:取 way[0] 的目标点;若 way[0] 是 cycle / via 算子等
|
|
61
|
+
* 非 target 项,则降级到原点 `[0, 0]`(容错)。
|
|
62
|
+
* - 后续元素:
|
|
63
|
+
* - 普通 target → line
|
|
64
|
+
* - `DrawWay.cycle` → cycle 步
|
|
65
|
+
* - `'-|'` / `'|-'` → 与**下一项**合并成 fold 步;操作符在 way 末尾或后
|
|
66
|
+
* 接非 target 项时抛错
|
|
67
|
+
*
|
|
68
|
+
* 这是纯函数,住在 core,被各框架 adapter 的 Sugar 组件复用。
|
|
69
|
+
*/
|
|
70
|
+
export declare const parseWay: (way: WayDSL) => Array<IRStep>;
|
|
71
|
+
//# sourceMappingURL=parseWay.d.ts.map
|