@retikz/core 0.0.1-rc.2 → 0.1.0-alpha.0
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 +8 -0
- package/dist/es/compile/index.d.ts.map +1 -0
- package/dist/es/compile/node.d.ts +51 -0
- package/dist/es/compile/node.d.ts.map +1 -0
- package/dist/es/compile/node.js +100 -0
- package/dist/es/compile/path.d.ts +19 -0
- package/dist/es/compile/path.d.ts.map +1 -0
- package/dist/es/compile/path.js +55 -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/index.d.ts +4 -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 +18 -10
- package/dist/es/index.d.ts.map +1 -0
- package/dist/es/index.js +14 -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 +41 -0
- package/dist/es/ir/node.d.ts.map +1 -0
- package/dist/es/ir/node.js +19 -0
- package/dist/es/ir/path/index.d.ts +4 -0
- package/dist/es/ir/path/index.d.ts.map +1 -0
- package/dist/es/ir/path/path.d.ts +63 -0
- package/dist/es/ir/path/path.d.ts.map +1 -0
- package/dist/es/ir/path/path.js +12 -0
- package/dist/es/ir/path/step.d.ts +62 -0
- package/dist/es/ir/path/step.d.ts.map +1 -0
- package/dist/es/ir/path/step.js +16 -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 +262 -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 +25 -0
- package/dist/es/parsers/parseWay.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.js +30 -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 +7 -0
- package/dist/es/primitive/index.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +22 -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 +20 -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/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 +8 -0
- package/dist/lib/compile/index.d.ts.map +1 -0
- package/dist/lib/compile/node.cjs +102 -0
- package/dist/lib/compile/node.d.ts +51 -0
- package/dist/lib/compile/node.d.ts.map +1 -0
- package/dist/lib/compile/path.cjs +55 -0
- package/dist/lib/compile/path.d.ts +19 -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/index.d.ts +4 -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 +31 -11
- package/dist/lib/index.d.ts +18 -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 +19 -0
- package/dist/lib/ir/node.d.ts +41 -0
- package/dist/lib/ir/node.d.ts.map +1 -0
- package/dist/lib/ir/path/index.d.ts +4 -0
- package/dist/lib/ir/path/index.d.ts.map +1 -0
- package/dist/lib/ir/path/path.cjs +12 -0
- package/dist/lib/ir/path/path.d.ts +63 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -0
- package/dist/lib/ir/path/step.cjs +18 -0
- package/dist/lib/ir/path/step.d.ts +62 -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 +262 -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 +30 -0
- package/dist/lib/parsers/parseWay.d.ts +25 -0
- package/dist/lib/parsers/parseWay.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 +7 -0
- package/dist/lib/primitive/index.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +22 -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 +20 -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/package.json +21 -29
- 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 -110
- 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 -1
- 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 -110
- 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 -1
- 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,45 @@
|
|
|
1
|
+
import { point } from "./point.js";
|
|
2
|
+
//#region src/geometry/polar.ts
|
|
3
|
+
var DEG_TO_RAD = Math.PI / 180;
|
|
4
|
+
var RAD_TO_DEG = 180 / Math.PI;
|
|
5
|
+
/**
|
|
6
|
+
* 极坐标 ↔ 笛卡尔坐标 转换工具集。
|
|
7
|
+
*
|
|
8
|
+
* 注意 polar 不参与几何计算——参与计算时一律先用 `polar.toPosition` 转成 Position。
|
|
9
|
+
* 详见本文件顶部的整体说明。
|
|
10
|
+
*/
|
|
11
|
+
var polar = {
|
|
12
|
+
/**
|
|
13
|
+
* 极坐标 → 笛卡尔位置(递归处理 origin)。
|
|
14
|
+
* **限制**:origin 为字符串(节点 id)时本方法无法解析,会抛错——
|
|
15
|
+
* 字符串解析依赖 Scene 编译器的 nodeIndex 上下文。
|
|
16
|
+
*/
|
|
17
|
+
toPosition: (p) => {
|
|
18
|
+
let origin;
|
|
19
|
+
if (!p.origin) origin = [0, 0];
|
|
20
|
+
else if (typeof p.origin === "string") throw new Error("polar.toPosition: cannot resolve string origin (node id) without node context; use the Scene compiler");
|
|
21
|
+
else if (Array.isArray(p.origin)) origin = p.origin;
|
|
22
|
+
else origin = polar.toPosition(p.origin);
|
|
23
|
+
const rad = p.angle * DEG_TO_RAD;
|
|
24
|
+
return [origin[0] + Math.cos(rad) * p.radius, origin[1] + Math.sin(rad) * p.radius];
|
|
25
|
+
},
|
|
26
|
+
/** 笛卡尔位置 → 极坐标(angle 落在 (-180, 180],origin 取默认 [0, 0]) */
|
|
27
|
+
fromPosition: (p) => ({
|
|
28
|
+
angle: Math.atan2(p[1], p[0]) * RAD_TO_DEG,
|
|
29
|
+
radius: Math.hypot(p[0], p[1])
|
|
30
|
+
}),
|
|
31
|
+
/** 在某个原点附近按极坐标偏移;返回结果点的世界笛卡尔坐标 */
|
|
32
|
+
offsetFrom: (origin, offset) => {
|
|
33
|
+
const rad = offset.angle * DEG_TO_RAD;
|
|
34
|
+
return [origin[0] + Math.cos(rad) * offset.radius, origin[1] + Math.sin(rad) * offset.radius];
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* 判断两个点是否相同(跨坐标系)。每个参数可以是笛卡尔 [x, y] 或 PolarPosition;
|
|
38
|
+
* 极坐标先转为笛卡尔,再按 precision 指定的小数位数四舍五入比较。
|
|
39
|
+
* 实际是 `point.equalPolar` 的别名(同一份实现,两处可发现)。
|
|
40
|
+
* @param precision 小数点后位数;默认 2
|
|
41
|
+
*/
|
|
42
|
+
equal: (a, b, precision = 2) => point.equalPolar(a, b, precision)
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { polar };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Position } from './point';
|
|
2
|
+
/** 轴对齐矩形:几何中心 (x, y) + 宽高 + 可选绕中心旋转 */
|
|
3
|
+
export type Rect = {
|
|
4
|
+
/** 矩形几何中心横坐标 */
|
|
5
|
+
x: number;
|
|
6
|
+
/** 矩形几何中心纵坐标 */
|
|
7
|
+
y: number;
|
|
8
|
+
/** 矩形宽度(user units) */
|
|
9
|
+
width: number;
|
|
10
|
+
/** 矩形高度(user units) */
|
|
11
|
+
height: number;
|
|
12
|
+
/** 绕几何中心的旋转角(弧度);省略或 0 表示不旋转 */
|
|
13
|
+
rotate?: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 矩形 9 个标准 anchor 名常量集合,对应 TikZ 节点的 9 个标准 anchor。
|
|
17
|
+
* 与 `RectAnchor` 类型配对使用——值用 `RECT_ANCHORS.NORTH` 避免拼错,
|
|
18
|
+
* 类型位置用 `RectAnchor`。
|
|
19
|
+
*/
|
|
20
|
+
export declare const RECT_ANCHORS: {
|
|
21
|
+
/** 几何中心 */
|
|
22
|
+
readonly CENTER: "center";
|
|
23
|
+
/** 上边中点 */
|
|
24
|
+
readonly NORTH: "north";
|
|
25
|
+
/** 下边中点 */
|
|
26
|
+
readonly SOUTH: "south";
|
|
27
|
+
/** 右边中点 */
|
|
28
|
+
readonly EAST: "east";
|
|
29
|
+
/** 左边中点 */
|
|
30
|
+
readonly WEST: "west";
|
|
31
|
+
/** 右上角 */
|
|
32
|
+
readonly NORTH_EAST: "north-east";
|
|
33
|
+
/** 左上角 */
|
|
34
|
+
readonly NORTH_WEST: "north-west";
|
|
35
|
+
/** 右下角 */
|
|
36
|
+
readonly SOUTH_EAST: "south-east";
|
|
37
|
+
/** 左下角 */
|
|
38
|
+
readonly SOUTH_WEST: "south-west";
|
|
39
|
+
};
|
|
40
|
+
/** 矩形 anchor 名(与 TikZ 命名约定一致),由 `RECT_ANCHORS` 常量集合派生 */
|
|
41
|
+
export type RectAnchor = (typeof RECT_ANCHORS)[keyof typeof RECT_ANCHORS];
|
|
42
|
+
/** 矩形相关基础工具 */
|
|
43
|
+
export declare const rect: {
|
|
44
|
+
/** 矩形几何中心点 */
|
|
45
|
+
center: (r: Rect) => Position;
|
|
46
|
+
/** 判断点是否落在矩形范围内(含边界,考虑旋转) */
|
|
47
|
+
contains: (r: Rect, p: Position) => boolean;
|
|
48
|
+
/**
|
|
49
|
+
* 取矩形 9 个标准 anchor 之一的世界坐标,考虑旋转。
|
|
50
|
+
* 名字与 TikZ 节点 anchor 一致(north / south / east / west / north-east / ... / center)。
|
|
51
|
+
*/
|
|
52
|
+
anchor: (r: Rect, name: RectAnchor) => Position;
|
|
53
|
+
/**
|
|
54
|
+
* 从矩形中心向 toward 方向画射线,求与矩形边界的交点(考虑旋转)。
|
|
55
|
+
* 用于把 Path 端点贴到 Node 边界(避免线段穿过节点内部)。
|
|
56
|
+
*/
|
|
57
|
+
boundaryPoint: (r: Rect, toward: Position) => Position;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=rect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/geometry/rect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,uCAAuC;AACvC,MAAM,MAAM,IAAI,GAAG;IACjB,gBAAgB;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,gBAAgB;IAChB,CAAC,EAAE,MAAM,CAAC;IACV,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,YAAY;IACvB,WAAW;;IAEX,WAAW;;IAEX,WAAW;;IAEX,WAAW;;IAEX,WAAW;;IAEX,UAAU;;IAEV,UAAU;;IAEV,UAAU;;IAEV,UAAU;;CAEF,CAAC;AAEX,yDAAyD;AACzD,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAgC1E,eAAe;AACf,eAAO,MAAM,IAAI;IACf,cAAc;gBACF,IAAI,KAAG,QAAQ;IAC3B,6BAA6B;kBACf,IAAI,KAAK,QAAQ,KAAG,OAAO;IAMzC;;;OAGG;gBACS,IAAI,QAAQ,UAAU,KAAG,QAAQ;IAuC7C;;;OAGG;uBACgB,IAAI,UAAU,QAAQ,KAAG,QAAQ;CAUrD,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
//#region src/geometry/rect.ts
|
|
2
|
+
/**
|
|
3
|
+
* 矩形 9 个标准 anchor 名常量集合,对应 TikZ 节点的 9 个标准 anchor。
|
|
4
|
+
* 与 `RectAnchor` 类型配对使用——值用 `RECT_ANCHORS.NORTH` 避免拼错,
|
|
5
|
+
* 类型位置用 `RectAnchor`。
|
|
6
|
+
*/
|
|
7
|
+
var RECT_ANCHORS = {
|
|
8
|
+
/** 几何中心 */
|
|
9
|
+
CENTER: "center",
|
|
10
|
+
/** 上边中点 */
|
|
11
|
+
NORTH: "north",
|
|
12
|
+
/** 下边中点 */
|
|
13
|
+
SOUTH: "south",
|
|
14
|
+
/** 右边中点 */
|
|
15
|
+
EAST: "east",
|
|
16
|
+
/** 左边中点 */
|
|
17
|
+
WEST: "west",
|
|
18
|
+
/** 右上角 */
|
|
19
|
+
NORTH_EAST: "north-east",
|
|
20
|
+
/** 左上角 */
|
|
21
|
+
NORTH_WEST: "north-west",
|
|
22
|
+
/** 右下角 */
|
|
23
|
+
SOUTH_EAST: "south-east",
|
|
24
|
+
/** 左下角 */
|
|
25
|
+
SOUTH_WEST: "south-west"
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* 把"以矩形中心为原点的本地坐标"转换为世界坐标。
|
|
29
|
+
* 考虑 rect.rotate(弧度)的旋转。
|
|
30
|
+
*/
|
|
31
|
+
var localToWorld = (r, local) => {
|
|
32
|
+
const angle = r.rotate ?? 0;
|
|
33
|
+
if (angle === 0) return [r.x + local[0], r.y + local[1]];
|
|
34
|
+
const cos = Math.cos(angle);
|
|
35
|
+
const sin = Math.sin(angle);
|
|
36
|
+
return [r.x + local[0] * cos - local[1] * sin, r.y + local[0] * sin + local[1] * cos];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 把世界坐标转换为"以矩形中心为原点的本地坐标"。
|
|
40
|
+
* 与 localToWorld 互为逆变换。
|
|
41
|
+
*/
|
|
42
|
+
var worldToLocal = (r, world) => {
|
|
43
|
+
const tx = world[0] - r.x;
|
|
44
|
+
const ty = world[1] - r.y;
|
|
45
|
+
const angle = r.rotate ?? 0;
|
|
46
|
+
if (angle === 0) return [tx, ty];
|
|
47
|
+
const cos = Math.cos(angle);
|
|
48
|
+
const sin = Math.sin(angle);
|
|
49
|
+
return [tx * cos + ty * sin, -tx * sin + ty * cos];
|
|
50
|
+
};
|
|
51
|
+
/** 矩形相关基础工具 */
|
|
52
|
+
var rect = {
|
|
53
|
+
/** 矩形几何中心点 */
|
|
54
|
+
center: (r) => [r.x, r.y],
|
|
55
|
+
/** 判断点是否落在矩形范围内(含边界,考虑旋转) */
|
|
56
|
+
contains: (r, p) => {
|
|
57
|
+
const [lx, ly] = worldToLocal(r, p);
|
|
58
|
+
const halfW = r.width / 2;
|
|
59
|
+
const halfH = r.height / 2;
|
|
60
|
+
return lx >= -halfW && lx <= halfW && ly >= -halfH && ly <= halfH;
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* 取矩形 9 个标准 anchor 之一的世界坐标,考虑旋转。
|
|
64
|
+
* 名字与 TikZ 节点 anchor 一致(north / south / east / west / north-east / ... / center)。
|
|
65
|
+
*/
|
|
66
|
+
anchor: (r, name) => {
|
|
67
|
+
const halfW = r.width / 2;
|
|
68
|
+
const halfH = r.height / 2;
|
|
69
|
+
let lx = 0;
|
|
70
|
+
let ly = 0;
|
|
71
|
+
switch (name) {
|
|
72
|
+
case "center": break;
|
|
73
|
+
case "north":
|
|
74
|
+
ly = -halfH;
|
|
75
|
+
break;
|
|
76
|
+
case "south":
|
|
77
|
+
ly = halfH;
|
|
78
|
+
break;
|
|
79
|
+
case "east":
|
|
80
|
+
lx = halfW;
|
|
81
|
+
break;
|
|
82
|
+
case "west":
|
|
83
|
+
lx = -halfW;
|
|
84
|
+
break;
|
|
85
|
+
case "north-east":
|
|
86
|
+
lx = halfW;
|
|
87
|
+
ly = -halfH;
|
|
88
|
+
break;
|
|
89
|
+
case "north-west":
|
|
90
|
+
lx = -halfW;
|
|
91
|
+
ly = -halfH;
|
|
92
|
+
break;
|
|
93
|
+
case "south-east":
|
|
94
|
+
lx = halfW;
|
|
95
|
+
ly = halfH;
|
|
96
|
+
break;
|
|
97
|
+
case "south-west":
|
|
98
|
+
lx = -halfW;
|
|
99
|
+
ly = halfH;
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
return localToWorld(r, [lx, ly]);
|
|
103
|
+
},
|
|
104
|
+
/**
|
|
105
|
+
* 从矩形中心向 toward 方向画射线,求与矩形边界的交点(考虑旋转)。
|
|
106
|
+
* 用于把 Path 端点贴到 Node 边界(避免线段穿过节点内部)。
|
|
107
|
+
*/
|
|
108
|
+
boundaryPoint: (r, toward) => {
|
|
109
|
+
const [localX, localY] = worldToLocal(r, toward);
|
|
110
|
+
if (localX === 0 && localY === 0) return [r.x, r.y];
|
|
111
|
+
const halfW = r.width / 2;
|
|
112
|
+
const halfH = r.height / 2;
|
|
113
|
+
const tx = localX === 0 ? Infinity : halfW / Math.abs(localX);
|
|
114
|
+
const ty = localY === 0 ? Infinity : halfH / Math.abs(localY);
|
|
115
|
+
const t = Math.min(tx, ty);
|
|
116
|
+
return localToWorld(r, [localX * t, localY * t]);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
//#endregion
|
|
120
|
+
export { RECT_ANCHORS, rect };
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export {
|
|
10
|
-
export type {
|
|
1
|
+
/**
|
|
2
|
+
* @retikz/core 公开 API
|
|
3
|
+
*
|
|
4
|
+
* 任何 framework adapter(@retikz/react、@retikz/vue、@retikz/canvas、@retikz/ssr)
|
|
5
|
+
* 只能 import 本文件导出的内容,不准走子路径。
|
|
6
|
+
*
|
|
7
|
+
* 本包零 React、零 DOM 依赖。
|
|
8
|
+
*/
|
|
9
|
+
export { PositionSchema, PolarPositionSchema, TargetSchema, MoveStepSchema, LineStepSchema, StepSchema, NodeSchema, PathSchema, ChildSchema, SceneSchema, CURRENT_IR_VERSION, } from './ir';
|
|
10
|
+
export type { IRPosition, IRTarget, IRMoveStep, IRLineStep, IRStep, IRNode, IRPath, IRChild, IR, } from './ir';
|
|
11
|
+
export type { ScenePrimitive, RectPrim, TextPrim, PathPrim, GroupPrim, ViewBox, Scene, } from './primitive';
|
|
12
|
+
export type { FontSpec, TextMetrics, TextMeasurer, CompileOptions, } from './compile';
|
|
13
|
+
export { fallbackMeasurer, compileToScene } from './compile';
|
|
14
|
+
export type { WayItem, WayDSL } from './parsers';
|
|
15
|
+
export { parseWay } from './parsers';
|
|
16
|
+
export type { Position, Rect, RectAnchor, PolarPosition } from './geometry';
|
|
17
|
+
export { point, rect, RECT_ANCHORS, polar } from './geometry';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,WAAW,EACX,WAAW,EACX,kBAAkB,GACnB,MAAM,MAAM,CAAC;AACd,YAAY,EACV,UAAU,EACV,QAAQ,EACR,UAAU,EACV,UAAU,EACV,MAAM,EACN,MAAM,EACN,MAAM,EACN,OAAO,EACP,EAAE,GACH,MAAM,MAAM,CAAC;AAGd,YAAY,EACV,cAAc,EACd,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,KAAK,GACN,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,cAAc,GACf,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG7D,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAIrC,YAAY,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/es/index.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
1
|
+
import { PositionSchema } from "./ir/position/position.js";
|
|
2
|
+
import { PolarPositionSchema } from "./ir/position/polar-position.js";
|
|
3
|
+
import { TargetSchema } from "./ir/path/target.js";
|
|
4
|
+
import { LineStepSchema, MoveStepSchema, StepSchema } from "./ir/path/step.js";
|
|
5
|
+
import { PathSchema } from "./ir/path/path.js";
|
|
6
|
+
import { NodeSchema } from "./ir/node.js";
|
|
7
|
+
import { CURRENT_IR_VERSION, ChildSchema, SceneSchema } from "./ir/scene.js";
|
|
8
|
+
import { RECT_ANCHORS, rect } from "./geometry/rect.js";
|
|
9
|
+
import { fallbackMeasurer } from "./compile/text-metrics.js";
|
|
10
|
+
import { compileToScene } from "./compile/compile.js";
|
|
11
|
+
import { parseWay } from "./parsers/parseWay.js";
|
|
12
|
+
import { polar } from "./geometry/polar.js";
|
|
13
|
+
import { point } from "./geometry/point.js";
|
|
14
|
+
export { CURRENT_IR_VERSION, ChildSchema, LineStepSchema, MoveStepSchema, NodeSchema, PathSchema, PolarPositionSchema, PositionSchema, RECT_ANCHORS, SceneSchema, StepSchema, TargetSchema, compileToScene, fallbackMeasurer, parseWay, point, polar, rect };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ir/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const NodeSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"node">;
|
|
4
|
+
id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>]>;
|
|
6
|
+
rotate: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
text: z.ZodOptional<z.ZodString>;
|
|
8
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
9
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
10
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
type: "node";
|
|
16
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
17
|
+
fill?: string | undefined;
|
|
18
|
+
stroke?: string | undefined;
|
|
19
|
+
strokeWidth?: number | undefined;
|
|
20
|
+
id?: string | undefined;
|
|
21
|
+
rotate?: number | undefined;
|
|
22
|
+
text?: string | undefined;
|
|
23
|
+
padding?: number | undefined;
|
|
24
|
+
margin?: number | undefined;
|
|
25
|
+
fontSize?: number | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
type: "node";
|
|
28
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
29
|
+
fill?: string | undefined;
|
|
30
|
+
stroke?: string | undefined;
|
|
31
|
+
strokeWidth?: number | undefined;
|
|
32
|
+
id?: string | undefined;
|
|
33
|
+
rotate?: number | undefined;
|
|
34
|
+
text?: string | undefined;
|
|
35
|
+
padding?: number | undefined;
|
|
36
|
+
margin?: number | undefined;
|
|
37
|
+
fontSize?: number | undefined;
|
|
38
|
+
}>;
|
|
39
|
+
/** 节点:矩形 + 可选文本标签,是最基础的有定位图元 */
|
|
40
|
+
export type IRNode = z.infer<typeof NodeSchema>;
|
|
41
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../../src/ir/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiEpB,CAAC;AAEJ,gCAAgC;AAChC,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { PositionSchema } from "./position/position.js";
|
|
2
|
+
import { PolarPositionSchema } from "./position/polar-position.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/ir/node.ts
|
|
5
|
+
var NodeSchema = z.object({
|
|
6
|
+
type: z.literal("node").describe("Discriminator marking this child as a node"),
|
|
7
|
+
id: z.string().min(1).optional().describe("Optional unique id; required if any path needs to reference this node by string"),
|
|
8
|
+
position: z.union([PositionSchema, PolarPositionSchema]).describe("Center point of the node content box; Cartesian [x, y] or polar (resolved at compile time)"),
|
|
9
|
+
rotate: z.number().optional().describe("Rotation in degrees around the node center; positive = clockwise (matches TikZ rotate=...)"),
|
|
10
|
+
text: z.string().optional().describe("Text label rendered inside the node; omit for an empty node"),
|
|
11
|
+
fill: z.string().optional().describe("Background color of the node rectangle; any CSS color (e.g. \"lightblue\", \"#fafafa\", \"rgba(...)\")"),
|
|
12
|
+
stroke: z.string().optional().describe("Border color of the node rectangle; any CSS color. Defaults to currentColor when omitted"),
|
|
13
|
+
strokeWidth: z.number().optional().describe("Border width in user units; defaults to 1 when omitted"),
|
|
14
|
+
padding: z.number().optional().describe("Inner padding in user units between the text content and the node border"),
|
|
15
|
+
margin: z.number().nonnegative().optional().describe("Outer margin in user units: distance between the visual border and where paths attach. Lines stop this far from the border. Defaults to 0."),
|
|
16
|
+
fontSize: z.number().optional().describe("Text font size in user units; defaults to a fixed size for now (TikZ font sizes will be supported later)")
|
|
17
|
+
}).describe("Rectangle node with optional text label; the basic positional drawing primitive");
|
|
18
|
+
//#endregion
|
|
19
|
+
export { NodeSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const PathSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"path">;
|
|
4
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
5
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
6
|
+
strokeDasharray: z.ZodOptional<z.ZodString>;
|
|
7
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"step">;
|
|
9
|
+
kind: z.ZodLiteral<"move">;
|
|
10
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
type: "step";
|
|
13
|
+
kind: "move";
|
|
14
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
15
|
+
}, {
|
|
16
|
+
type: "step";
|
|
17
|
+
kind: "move";
|
|
18
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
19
|
+
}>, z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"step">;
|
|
21
|
+
kind: z.ZodLiteral<"line">;
|
|
22
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
type: "step";
|
|
25
|
+
kind: "line";
|
|
26
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
27
|
+
}, {
|
|
28
|
+
type: "step";
|
|
29
|
+
kind: "line";
|
|
30
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
31
|
+
}>]>, "many">;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: "path";
|
|
34
|
+
children: ({
|
|
35
|
+
type: "step";
|
|
36
|
+
kind: "move";
|
|
37
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
38
|
+
} | {
|
|
39
|
+
type: "step";
|
|
40
|
+
kind: "line";
|
|
41
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
42
|
+
})[];
|
|
43
|
+
stroke?: string | undefined;
|
|
44
|
+
strokeWidth?: number | undefined;
|
|
45
|
+
strokeDasharray?: string | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
type: "path";
|
|
48
|
+
children: ({
|
|
49
|
+
type: "step";
|
|
50
|
+
kind: "move";
|
|
51
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
52
|
+
} | {
|
|
53
|
+
type: "step";
|
|
54
|
+
kind: "line";
|
|
55
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
56
|
+
})[];
|
|
57
|
+
stroke?: string | undefined;
|
|
58
|
+
strokeWidth?: number | undefined;
|
|
59
|
+
strokeDasharray?: string | undefined;
|
|
60
|
+
}>;
|
|
61
|
+
/** 路径:由若干 step 动作(move / line / ...)组成的绘制路径 */
|
|
62
|
+
export type IRPath = z.infer<typeof PathSchema>;
|
|
63
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BpB,CAAC;AAEJ,+CAA+C;AAC/C,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StepSchema } from "./step.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/ir/path/path.ts
|
|
4
|
+
var PathSchema = z.object({
|
|
5
|
+
type: z.literal("path").describe("Discriminator marking this child as a path"),
|
|
6
|
+
stroke: z.string().optional().describe("Stroke color of the path; any CSS color. Defaults to currentColor when omitted"),
|
|
7
|
+
strokeWidth: z.number().optional().describe("Stroke width in user units; defaults to 1 when omitted"),
|
|
8
|
+
strokeDasharray: z.string().optional().describe("SVG stroke-dasharray pattern (e.g. \"4 2\"); leave empty for solid line"),
|
|
9
|
+
children: z.array(StepSchema).min(2).describe("Sequence of step actions defining the path; the first should usually be a `move`")
|
|
10
|
+
}).describe("A drawn path composed of a sequence of step actions (move / line / ...)");
|
|
11
|
+
//#endregion
|
|
12
|
+
export { PathSchema };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const MoveStepSchema: z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"step">;
|
|
4
|
+
kind: z.ZodLiteral<"move">;
|
|
5
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
type: "step";
|
|
8
|
+
kind: "move";
|
|
9
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
10
|
+
}, {
|
|
11
|
+
type: "step";
|
|
12
|
+
kind: "move";
|
|
13
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const LineStepSchema: z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"step">;
|
|
17
|
+
kind: z.ZodLiteral<"line">;
|
|
18
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
type: "step";
|
|
21
|
+
kind: "line";
|
|
22
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
23
|
+
}, {
|
|
24
|
+
type: "step";
|
|
25
|
+
kind: "line";
|
|
26
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const StepSchema: z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
29
|
+
type: z.ZodLiteral<"step">;
|
|
30
|
+
kind: z.ZodLiteral<"move">;
|
|
31
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
33
|
+
type: "step";
|
|
34
|
+
kind: "move";
|
|
35
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
36
|
+
}, {
|
|
37
|
+
type: "step";
|
|
38
|
+
kind: "move";
|
|
39
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
40
|
+
}>, z.ZodObject<{
|
|
41
|
+
type: z.ZodLiteral<"step">;
|
|
42
|
+
kind: z.ZodLiteral<"line">;
|
|
43
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
type: "step";
|
|
46
|
+
kind: "line";
|
|
47
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
48
|
+
}, {
|
|
49
|
+
type: "step";
|
|
50
|
+
kind: "line";
|
|
51
|
+
to: string | [number, number] | import('..').PolarPosition;
|
|
52
|
+
}>]>;
|
|
53
|
+
/** Move step:移动游标但不绘制 */
|
|
54
|
+
export type IRMoveStep = z.infer<typeof MoveStepSchema>;
|
|
55
|
+
/** Line step:从游标到目标画直线 */
|
|
56
|
+
export type IRLineStep = z.infer<typeof LineStepSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* 路径上的一个动作。v0.1.0-alpha 仅支持 'move' 与 'line'。
|
|
59
|
+
* 后续会加 'step'(折角)、'curve'、'cubic'、'rel'、'close' 等。
|
|
60
|
+
*/
|
|
61
|
+
export type IRStep = z.infer<typeof StepSchema>;
|
|
62
|
+
//# sourceMappingURL=step.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/step.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,cAAc;;;;;;;;;;;;EAQyC,CAAC;AAErE,eAAO,MAAM,cAAc;;;;;;;;;;;;EAQ4C,CAAC;AAExE,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;IAE+C,CAAC;AAEvE,yBAAyB;AACzB,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD,0BAA0B;AAC1B,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAExD;;;GAGG;AACH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TargetSchema } from "./target.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/ir/path/step.ts
|
|
4
|
+
var MoveStepSchema = z.object({
|
|
5
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
6
|
+
kind: z.literal("move").describe("Move the cursor to the target without drawing (like SVG path \"M\")"),
|
|
7
|
+
to: TargetSchema.describe("Destination point of the move")
|
|
8
|
+
}).describe("Move action: relocate the path cursor without drawing");
|
|
9
|
+
var LineStepSchema = z.object({
|
|
10
|
+
type: z.literal("step").describe("Discriminator marking this as a path step node"),
|
|
11
|
+
kind: z.literal("line").describe("Draw a straight line from the current cursor to the target (like SVG path \"L\")"),
|
|
12
|
+
to: TargetSchema.describe("Destination point of the line segment")
|
|
13
|
+
}).describe("Line action: straight-line segment from cursor to target");
|
|
14
|
+
var StepSchema = z.discriminatedUnion("kind", [MoveStepSchema, LineStepSchema]).describe("A single path action; the discriminator field is `kind`");
|
|
15
|
+
//#endregion
|
|
16
|
+
export { LineStepSchema, MoveStepSchema, StepSchema };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TargetSchema: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('..').PolarPosition, z.ZodTypeDef, import('..').PolarPosition>, z.ZodString]>;
|
|
3
|
+
/** 路径端点:直接坐标 [x, y]、极坐标,或节点 id 字符串 */
|
|
4
|
+
export type IRTarget = z.infer<typeof TargetSchema>;
|
|
5
|
+
//# sourceMappingURL=target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../../../src/ir/path/target.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,YAAY,0JAItB,CAAC;AAEJ,sCAAsC;AACtC,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PositionSchema } from "../position/position.js";
|
|
2
|
+
import { PolarPositionSchema } from "../position/polar-position.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/ir/path/target.ts
|
|
5
|
+
var TargetSchema = z.union([
|
|
6
|
+
PositionSchema,
|
|
7
|
+
PolarPositionSchema,
|
|
8
|
+
z.string().min(1)
|
|
9
|
+
]).describe("Path endpoint: Cartesian [x, y], polar position (resolved at compile time), or node id reference");
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TargetSchema };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ir/position/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -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,18 @@
|
|
|
1
|
+
import { PositionSchema } from "./position.js";
|
|
2
|
+
import { z } from "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 = z.lazy(() => z.object({
|
|
9
|
+
origin: z.union([
|
|
10
|
+
z.string().min(1),
|
|
11
|
+
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: z.number().describe("Angle in degrees, counter-clockwise positive (TikZ convention)"),
|
|
15
|
+
radius: z.number().describe("Radius / distance in user units")
|
|
16
|
+
}).describe("Polar coordinate position; resolved to Cartesian at Scene compile time"));
|
|
17
|
+
//#endregion
|
|
18
|
+
export { PolarPositionSchema };
|
|
@@ -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"}
|