@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
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { CssDistanceType, DirectionDistance } from '.';
|
|
2
|
-
/** 快捷属性 */
|
|
3
|
-
export type SepShortcutProps<T = CssDistanceType> = {
|
|
4
|
-
defaultVal: T;
|
|
5
|
-
x: T;
|
|
6
|
-
y: T;
|
|
7
|
-
} & DirectionDistance<T>;
|
|
8
|
-
/** 距离的全部属性 */
|
|
9
|
-
export type SepProps<T = CssDistanceType> = T | SepShortcutProps<T>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/** 矩形四个顶点 */
|
|
2
|
-
export declare enum RectVertexPoint {
|
|
3
|
-
TL = "top_left",
|
|
4
|
-
TR = "top_right",
|
|
5
|
-
BL = "bottom_left",
|
|
6
|
-
BR = "bottom_right"
|
|
7
|
-
}
|
|
8
|
-
/** 矩形四个边的中点 */
|
|
9
|
-
export declare enum RectMidPoint {
|
|
10
|
-
T = "top_mid",
|
|
11
|
-
B = "bottom_mid",
|
|
12
|
-
L = "left_mid",
|
|
13
|
-
R = "right_mid"
|
|
14
|
-
}
|
|
15
|
-
/** 矩形四边的三等分点 */
|
|
16
|
-
export declare enum RectThirdPoint {
|
|
17
|
-
TL = "third_top_left",
|
|
18
|
-
TR = "third_top_right",
|
|
19
|
-
BL = "third_bottom_left",
|
|
20
|
-
BR = "third_bottom_right",
|
|
21
|
-
LT = "third_left_top",
|
|
22
|
-
LB = "third_left_bottom",
|
|
23
|
-
RT = "third_right_top",
|
|
24
|
-
RB = "third_right_bottom"
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var RectVertexPoint = /* @__PURE__ */ ((RectVertexPoint2) => {
|
|
2
|
-
RectVertexPoint2["TL"] = "top_left";
|
|
3
|
-
RectVertexPoint2["TR"] = "top_right";
|
|
4
|
-
RectVertexPoint2["BL"] = "bottom_left";
|
|
5
|
-
RectVertexPoint2["BR"] = "bottom_right";
|
|
6
|
-
return RectVertexPoint2;
|
|
7
|
-
})(RectVertexPoint || {});
|
|
8
|
-
var RectMidPoint = /* @__PURE__ */ ((RectMidPoint2) => {
|
|
9
|
-
RectMidPoint2["T"] = "top_mid";
|
|
10
|
-
RectMidPoint2["B"] = "bottom_mid";
|
|
11
|
-
RectMidPoint2["L"] = "left_mid";
|
|
12
|
-
RectMidPoint2["R"] = "right_mid";
|
|
13
|
-
return RectMidPoint2;
|
|
14
|
-
})(RectMidPoint || {});
|
|
15
|
-
var RectThirdPoint = /* @__PURE__ */ ((RectThirdPoint2) => {
|
|
16
|
-
RectThirdPoint2["TL"] = "third_top_left";
|
|
17
|
-
RectThirdPoint2["TR"] = "third_top_right";
|
|
18
|
-
RectThirdPoint2["BL"] = "third_bottom_left";
|
|
19
|
-
RectThirdPoint2["BR"] = "third_bottom_right";
|
|
20
|
-
RectThirdPoint2["LT"] = "third_left_top";
|
|
21
|
-
RectThirdPoint2["LB"] = "third_left_bottom";
|
|
22
|
-
RectThirdPoint2["RT"] = "third_right_top";
|
|
23
|
-
RectThirdPoint2["RB"] = "third_right_bottom";
|
|
24
|
-
return RectThirdPoint2;
|
|
25
|
-
})(RectThirdPoint || {});
|
|
26
|
-
export {
|
|
27
|
-
RectMidPoint,
|
|
28
|
-
RectThirdPoint,
|
|
29
|
-
RectVertexPoint
|
|
30
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter';
|
|
2
|
-
export type FontProps = {
|
|
3
|
-
fill?: 'currentColor' | string;
|
|
4
|
-
fillOpacity?: number;
|
|
5
|
-
fontSize?: string | number;
|
|
6
|
-
fontWeight?: FontWeight | number;
|
|
7
|
-
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
8
|
-
fontFamily?: string;
|
|
9
|
-
fontStretch?: 'normal' | 'condensed' | 'semi-condensed' | 'ultra-condensed' | 'extra-condensed' | 'expanded' | 'semi-expanded' | 'extra-expanded' | 'ultra-expanded' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset' | string;
|
|
10
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type StrokeProps = {
|
|
2
|
-
stroke?: string;
|
|
3
|
-
strokeWidth?: number | string;
|
|
4
|
-
strokeDasharray?: string;
|
|
5
|
-
strokeDashoffset?: string;
|
|
6
|
-
strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';
|
|
7
|
-
strokeLinejoin?: 'round' | 'inherit' | 'bevel' | 'miter';
|
|
8
|
-
strokeMiterlimit?: number;
|
|
9
|
-
strokeOpacity?: number;
|
|
10
|
-
};
|
package/dist/es/utils/compare.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const isSameArray = (arr1, arr2) => {
|
|
2
|
-
if (arr1.length !== arr2.length) return false;
|
|
3
|
-
const length = arr1.length;
|
|
4
|
-
for (let i = 0; i < length; i++) {
|
|
5
|
-
if (arr1[i] !== arr2[i]) return false;
|
|
6
|
-
}
|
|
7
|
-
return true;
|
|
8
|
-
};
|
|
9
|
-
const isSameObj = (obj1, obj2) => {
|
|
10
|
-
if (Object.keys(obj1).length !== Object.keys(obj2).length) return false;
|
|
11
|
-
const keys = Object.keys(obj1);
|
|
12
|
-
for (let i = 0; i < keys.length; i++) {
|
|
13
|
-
if (obj1[keys[i]] !== obj2[keys[i]]) return false;
|
|
14
|
-
}
|
|
15
|
-
return true;
|
|
16
|
-
};
|
|
17
|
-
export {
|
|
18
|
-
isSameArray,
|
|
19
|
-
isSameObj
|
|
20
|
-
};
|
package/dist/es/utils/css.d.ts
DELETED
package/dist/es/utils/css.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const convertCssToPx = (dimension, sizeConfig) => {
|
|
2
|
-
if (dimension === void 0) return 0;
|
|
3
|
-
if (typeof dimension === "number") return dimension;
|
|
4
|
-
const match = dimension.match(/^(\d+(?:\.\d+)?)(px|em|rem|%)$/);
|
|
5
|
-
const { remPx: remSize = 16, emPx: emSize = 16, parentPx: elementSize = 100 } = sizeConfig || {};
|
|
6
|
-
if (match) {
|
|
7
|
-
const value = parseFloat(match[1]);
|
|
8
|
-
const unit = match[2];
|
|
9
|
-
switch (unit) {
|
|
10
|
-
case "px":
|
|
11
|
-
return value;
|
|
12
|
-
case "em":
|
|
13
|
-
return value * (emSize || remSize || 16);
|
|
14
|
-
case "rem":
|
|
15
|
-
return value * (remSize || 16);
|
|
16
|
-
case "%":
|
|
17
|
-
return elementSize ? value / 100 * elementSize : value;
|
|
18
|
-
default:
|
|
19
|
-
return 0;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return parseInt(dimension);
|
|
23
|
-
};
|
|
24
|
-
export {
|
|
25
|
-
convertCssToPx
|
|
26
|
-
};
|
package/dist/es/utils/math.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** 判断值是否在范围内 */
|
|
2
|
-
export declare const between: (value: number, range: [number, number], equal?: boolean) => boolean;
|
|
3
|
-
/**
|
|
4
|
-
* 将数值进行精度调整(主要是为了内存优化)
|
|
5
|
-
* @value 要调整的值
|
|
6
|
-
* @precision 要调整的精度
|
|
7
|
-
* @deep 是否进行深度调整
|
|
8
|
-
* */
|
|
9
|
-
export declare const convertPrecision: <T>(value: T, precision: number | false, deep?: boolean) => T;
|
package/dist/es/utils/math.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
const between = (value, range, equal) => {
|
|
2
|
-
return equal ? value >= range[0] && value <= range[1] : value > range[0] && value < range[1];
|
|
3
|
-
};
|
|
4
|
-
const convertPrecision = (value, precision, deep = true) => {
|
|
5
|
-
if (precision === false) return value;
|
|
6
|
-
const innerConvert = (value2) => {
|
|
7
|
-
if (precision === 0) return Math.round(value2);
|
|
8
|
-
const realPrecision = 10 ** precision;
|
|
9
|
-
return Math.round(value2 * realPrecision) / realPrecision;
|
|
10
|
-
};
|
|
11
|
-
if (typeof value === "number") return innerConvert(value);
|
|
12
|
-
if (Array.isArray(value))
|
|
13
|
-
return value.map((item) => deep ? innerConvert(item) : typeof item === "number" ? innerConvert(item) : item);
|
|
14
|
-
if (typeof value === "object" && value !== null) {
|
|
15
|
-
const result = {};
|
|
16
|
-
for (const [key, item] of Object.entries(value)) {
|
|
17
|
-
result[key] = deep ? convertPrecision(item, precision) : typeof item === "number" ? innerConvert(item) : item;
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
}
|
|
21
|
-
return value;
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
between,
|
|
25
|
-
convertPrecision
|
|
26
|
-
};
|
package/dist/es/utils/string.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { FontProps } from '../../types/svg/font';
|
|
2
|
-
export declare const TikZFontSizeMap: {
|
|
3
|
-
tiny: string;
|
|
4
|
-
script: string;
|
|
5
|
-
footnote: string;
|
|
6
|
-
small: string;
|
|
7
|
-
normal: string;
|
|
8
|
-
large: string;
|
|
9
|
-
Large: string;
|
|
10
|
-
LARGE: string;
|
|
11
|
-
huge: string;
|
|
12
|
-
Huge: string;
|
|
13
|
-
};
|
|
14
|
-
export type TikZFontSize = keyof typeof TikZFontSizeMap;
|
|
15
|
-
export declare const convertFontSize: (fontSize?: string | TikZFontSize | number) => string | number | undefined;
|
|
16
|
-
export type FontStyle = 'bold' | 'italic' | 'serif' | 'sans-serif';
|
|
17
|
-
export declare const convertFontStyle: (fontStyle?: FontStyle) => Partial<FontProps>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const TikZFontSizeMap = {
|
|
2
|
-
tiny: "5px",
|
|
3
|
-
script: "8px",
|
|
4
|
-
footnote: "10px",
|
|
5
|
-
small: "12px",
|
|
6
|
-
normal: "16px",
|
|
7
|
-
large: "18px",
|
|
8
|
-
Large: "22px",
|
|
9
|
-
LARGE: "26px",
|
|
10
|
-
huge: "30px",
|
|
11
|
-
Huge: "36px"
|
|
12
|
-
};
|
|
13
|
-
const convertFontSize = (fontSize) => {
|
|
14
|
-
return typeof fontSize === "string" && TikZFontSizeMap.hasOwnProperty(fontSize) ? TikZFontSizeMap[fontSize] : fontSize;
|
|
15
|
-
};
|
|
16
|
-
const convertFontStyle = (fontStyle) => {
|
|
17
|
-
switch (fontStyle) {
|
|
18
|
-
case "bold":
|
|
19
|
-
return { fontWeight: "bold" };
|
|
20
|
-
case "italic":
|
|
21
|
-
return { fontStyle: "italic" };
|
|
22
|
-
case "serif":
|
|
23
|
-
return { fontFamily: "serif" };
|
|
24
|
-
case "sans-serif":
|
|
25
|
-
return { fontFamily: "sans-serif" };
|
|
26
|
-
default:
|
|
27
|
-
return {};
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
export {
|
|
31
|
-
TikZFontSizeMap,
|
|
32
|
-
convertFontSize,
|
|
33
|
-
convertFontStyle
|
|
34
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { StrokeProps } from '../../types/svg/stroke';
|
|
2
|
-
export declare const strokeTypes: readonly ["solid", "dashed", "denselyDashed", "looselyDashed", "dotted", "denselyDotted", "looselyDotted", "dashDot", "denselyDashDot", "looselyDashDot", "dashDashDot", "denselyDashDashDot", "looselyDashDashDot"];
|
|
3
|
-
export type StrokeType = typeof strokeTypes[number];
|
|
4
|
-
export type StrokeShortcutProps = {
|
|
5
|
-
dashed?: boolean;
|
|
6
|
-
denselyDashed?: boolean;
|
|
7
|
-
looselyDashed?: boolean;
|
|
8
|
-
dotted?: boolean;
|
|
9
|
-
denselyDotted?: boolean;
|
|
10
|
-
looselyDotted?: boolean;
|
|
11
|
-
dashDot?: boolean;
|
|
12
|
-
denselyDashDot?: boolean;
|
|
13
|
-
looselyDashDot?: boolean;
|
|
14
|
-
dashDashDot?: boolean;
|
|
15
|
-
denselyDashDashDot?: boolean;
|
|
16
|
-
looselyDashDashDot?: boolean;
|
|
17
|
-
};
|
|
18
|
-
/** 将 StrokeType 转换为 svg 原生的属性 */
|
|
19
|
-
export declare const convertStrokeType: (strokeType: StrokeType, oriStrokeWidth?: string | number) => Partial<StrokeProps>;
|
|
20
|
-
export declare const convertStrokeShortcut: (shortcutProps: StrokeShortcutProps, oriStrokeWidth?: string | number) => Partial<StrokeProps>;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const convertStrokeType = (strokeType, oriStrokeWidth = 1) => {
|
|
2
|
-
const strokeWidth = Number(oriStrokeWidth);
|
|
3
|
-
switch (strokeType) {
|
|
4
|
-
case "solid":
|
|
5
|
-
return {};
|
|
6
|
-
case "dashed":
|
|
7
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 4}` };
|
|
8
|
-
case "denselyDashed":
|
|
9
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 2}` };
|
|
10
|
-
case "looselyDashed":
|
|
11
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 6}` };
|
|
12
|
-
case "dotted":
|
|
13
|
-
return { strokeDasharray: `1 ${strokeWidth * 4}` };
|
|
14
|
-
case "denselyDotted":
|
|
15
|
-
return { strokeDasharray: `1 ${strokeWidth * 2}` };
|
|
16
|
-
case "looselyDotted":
|
|
17
|
-
return { strokeDasharray: `1 ${strokeWidth * 6}` };
|
|
18
|
-
case "dashDot":
|
|
19
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 4} 1 ${strokeWidth * 4}` };
|
|
20
|
-
case "denselyDashDot":
|
|
21
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 2} 1 ${strokeWidth * 2}` };
|
|
22
|
-
case "looselyDashDot":
|
|
23
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 6} 1 ${strokeWidth * 6}` };
|
|
24
|
-
case "dashDashDot":
|
|
25
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 4} 1 ${strokeWidth * 4} 1 ${strokeWidth * 4}` };
|
|
26
|
-
case "denselyDashDashDot":
|
|
27
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 2} 1 ${strokeWidth * 2} 1 ${strokeWidth * 2}` };
|
|
28
|
-
case "looselyDashDashDot":
|
|
29
|
-
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 6} 1 ${strokeWidth * 6} 1 ${strokeWidth * 6}` };
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const convertStrokeShortcut = (shortcutProps, oriStrokeWidth = 1) => {
|
|
33
|
-
const strokeWidth = Number(oriStrokeWidth);
|
|
34
|
-
return convertStrokeType(
|
|
35
|
-
shortcutProps.dashed ? "dashed" : shortcutProps.denselyDashed ? "denselyDashed" : shortcutProps.looselyDashed ? "looselyDashed" : shortcutProps.dotted ? "dotted" : shortcutProps.denselyDotted ? "denselyDotted" : shortcutProps.looselyDotted ? "looselyDotted" : shortcutProps.dashDot ? "dashDot" : shortcutProps.denselyDashDot ? "denselyDashDot" : shortcutProps.looselyDashDot ? "looselyDashDot" : shortcutProps.dashDashDot ? "dashDashDot" : shortcutProps.denselyDashDashDot ? "denselyDashDashDot" : shortcutProps.looselyDashDashDot ? "looselyDashDashDot" : "solid",
|
|
36
|
-
strokeWidth || 1
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
export {
|
|
40
|
-
convertStrokeShortcut,
|
|
41
|
-
convertStrokeType
|
|
42
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const react = require("react");
|
|
5
|
-
const useScope = require("../hooks/context/useScope.cjs");
|
|
6
|
-
const Group = require("../container/Group.cjs");
|
|
7
|
-
const Scope = react.forwardRef((props, ref) => {
|
|
8
|
-
const { children, ...resProps } = props;
|
|
9
|
-
const baseScopeValue = useScope.default();
|
|
10
|
-
return /* @__PURE__ */ jsxRuntime.jsx(useScope.ScopeContext.Provider, { value: { ...baseScopeValue, ...resProps }, children: /* @__PURE__ */ jsxRuntime.jsx(Group.default, { ref, children }) });
|
|
11
|
-
});
|
|
12
|
-
exports.default = Scope;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { ScopeProps as ScopeContextProps } from '../hooks/context/useScope';
|
|
3
|
-
import { GroupProps } from '../container/Group';
|
|
4
|
-
export type ScopeProps = ScopeContextProps & Omit<GroupProps, 'offset'>;
|
|
5
|
-
declare const Scope: import('react').ForwardRefExoticComponent<Omit<PropsWithChildren<ScopeProps>, "ref"> & import('react').RefAttributes<SVGGElement>>;
|
|
6
|
-
export default Scope;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const Surface = require("../container/Surface.cjs");
|
|
5
|
-
const useCalculate = require("../hooks/context/useCalculate.cjs");
|
|
6
|
-
const useNodes = require("../hooks/context/useNodes.cjs");
|
|
7
|
-
const useScope = require("../hooks/context/useScope.cjs");
|
|
8
|
-
const TikZ = (props) => {
|
|
9
|
-
const { precision = 2, offset, node, draw, ...resProps } = props;
|
|
10
|
-
return /* @__PURE__ */ jsxRuntime.jsx(useNodes.NodesContext.Provider, { value: /* @__PURE__ */ new Map(), children: /* @__PURE__ */ jsxRuntime.jsx(useCalculate.CalculateContext.Provider, { value: { precision }, children: /* @__PURE__ */ jsxRuntime.jsx(useScope.ScopeContext.Provider, { value: { offset, node, draw }, children: /* @__PURE__ */ jsxRuntime.jsx(Surface.default, { ...resProps }) }) }) });
|
|
11
|
-
};
|
|
12
|
-
exports.default = TikZ;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
-
import { SurfaceProps } from '../container/Surface';
|
|
3
|
-
import { CalculateProps } from '../hooks/context/useCalculate';
|
|
4
|
-
import { ScopeProps } from '../hooks/context/useScope';
|
|
5
|
-
export type TikZProps = {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
} & Partial<CalculateProps> & ScopeProps & SurfaceProps;
|
|
8
|
-
declare const TikZ: FC<TikZProps>;
|
|
9
|
-
export default TikZ;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const react = require("react");
|
|
5
|
-
const useScope = require("../../hooks/context/useScope.cjs");
|
|
6
|
-
const DescartesPoint = require("../../model/geometry/point/DescartesPoint.cjs");
|
|
7
|
-
const stroke = require("../../utils/style/stroke.cjs");
|
|
8
|
-
const InnerDraw = require("./InnerDraw.cjs");
|
|
9
|
-
const Draw = react.forwardRef((props, ref) => {
|
|
10
|
-
const { draw: scopeProps } = useScope.default();
|
|
11
|
-
const realProps = { ...scopeProps, ...props };
|
|
12
|
-
const { offset, color, stroke: stroke$1, strokeWidth, startArrow, startArrows, endArrow, endArrows, ...resProps } = realProps;
|
|
13
|
-
const realStroke = stroke$1 || color;
|
|
14
|
-
const realStartArrow = typeof startArrow === "string" ? { type: startArrow } : startArrow;
|
|
15
|
-
const realStartArrows = typeof startArrows === "string" ? { type: startArrows } : startArrows;
|
|
16
|
-
const realEndArrow = typeof endArrow === "string" ? { type: endArrow } : endArrow;
|
|
17
|
-
const realEndArrows = typeof endArrows === "string" ? { type: endArrows } : endArrows;
|
|
18
|
-
const convertOffset = offset ? DescartesPoint.default.formatPosition(offset) : [0, 0];
|
|
19
|
-
const getStrokeTypes = () => resProps.strokeType ? stroke.convertStrokeType(resProps.strokeType, strokeWidth ?? 1) : stroke.convertStrokeShortcut(resProps, strokeWidth ?? 1);
|
|
20
|
-
const drawProps = react.useMemo(() => {
|
|
21
|
-
const props2 = { ...resProps };
|
|
22
|
-
[
|
|
23
|
-
"solid",
|
|
24
|
-
"dashed",
|
|
25
|
-
"denselyDashed",
|
|
26
|
-
"looselyDashed",
|
|
27
|
-
"dotted",
|
|
28
|
-
"denselyDotted",
|
|
29
|
-
"looselyDotted",
|
|
30
|
-
"dashDot",
|
|
31
|
-
"denselyDashDot",
|
|
32
|
-
"looselyDashDot",
|
|
33
|
-
"dashDashDot",
|
|
34
|
-
"denselyDashDashDot",
|
|
35
|
-
"looselyDashDashDot"
|
|
36
|
-
].forEach((key) => {
|
|
37
|
-
if (key in props2) {
|
|
38
|
-
delete props2[key];
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return props2;
|
|
42
|
-
}, [props]);
|
|
43
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44
|
-
InnerDraw.default,
|
|
45
|
-
{
|
|
46
|
-
ref,
|
|
47
|
-
...getStrokeTypes(),
|
|
48
|
-
offset: convertOffset,
|
|
49
|
-
stroke: realStroke,
|
|
50
|
-
strokeWidth: strokeWidth || 1,
|
|
51
|
-
startArrow: realStartArrow,
|
|
52
|
-
startArrows: realStartArrows,
|
|
53
|
-
endArrow: realEndArrow,
|
|
54
|
-
endArrows: realEndArrows,
|
|
55
|
-
...drawProps
|
|
56
|
-
}
|
|
57
|
-
);
|
|
58
|
-
});
|
|
59
|
-
exports.default = Draw;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'react';
|
|
2
|
-
import { PointPosition } from '../../types/coordinate';
|
|
3
|
-
import { StrokeProps } from '../../types/svg/stroke';
|
|
4
|
-
import { StrokeShortcutProps, StrokeType } from '../../utils/style/stroke';
|
|
5
|
-
import { ArrowProps, DrawWayType } from './types';
|
|
6
|
-
export type DrawProps = {
|
|
7
|
-
way: DrawWayType[];
|
|
8
|
-
/** 位置偏移 */
|
|
9
|
-
offset?: PointPosition;
|
|
10
|
-
/** 同 stroke */
|
|
11
|
-
color?: string;
|
|
12
|
-
/** 线段样式快捷属性 */
|
|
13
|
-
strokeType?: StrokeType;
|
|
14
|
-
children?: ReactElement | ReactElement[] | null;
|
|
15
|
-
} & StrokeProps & StrokeShortcutProps & ArrowProps;
|
|
16
|
-
declare const Draw: import('react').ForwardRefExoticComponent<{
|
|
17
|
-
way: DrawWayType[];
|
|
18
|
-
/** 位置偏移 */
|
|
19
|
-
offset?: PointPosition;
|
|
20
|
-
/** 同 stroke */
|
|
21
|
-
color?: string;
|
|
22
|
-
/** 线段样式快捷属性 */
|
|
23
|
-
strokeType?: StrokeType;
|
|
24
|
-
children?: ReactElement | ReactElement[] | null;
|
|
25
|
-
} & StrokeProps & StrokeShortcutProps & ArrowProps & import('react').RefAttributes<SVGPathElement>>;
|
|
26
|
-
export default Draw;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const react = require("react");
|
|
5
|
-
const Group = require("../../container/Group.cjs");
|
|
6
|
-
const usePath = require("../../hooks/context/usePath.cjs");
|
|
7
|
-
const path = require("../../model/component/path.cjs");
|
|
8
|
-
const common = require("./common.cjs");
|
|
9
|
-
const index = require("./segment/index.cjs");
|
|
10
|
-
const InnerDraw = react.forwardRef((props, ref) => {
|
|
11
|
-
const { way, offset, startArrow, startArrows, endArrow, endArrows, children, ...strokeProps } = props;
|
|
12
|
-
const waySegments = react.useMemo(() => {
|
|
13
|
-
let preNodeType = "coordinate";
|
|
14
|
-
const waySegments2 = [];
|
|
15
|
-
let waySegment = [];
|
|
16
|
-
for (let i = 0; i < way.length; i++) {
|
|
17
|
-
const point = way[i];
|
|
18
|
-
const currentNodeType = common.getDrawPointType(point);
|
|
19
|
-
waySegment.push(point);
|
|
20
|
-
if (currentNodeType === "node" && preNodeType === "node" && waySegment.length >= 2) {
|
|
21
|
-
waySegments2.push(waySegment);
|
|
22
|
-
waySegment = [waySegment[waySegment.length - 1]];
|
|
23
|
-
}
|
|
24
|
-
if (i === way.length - 1 && waySegment.length > 1) {
|
|
25
|
-
waySegments2.push(waySegment);
|
|
26
|
-
}
|
|
27
|
-
preNodeType = currentNodeType;
|
|
28
|
-
}
|
|
29
|
-
return waySegments2;
|
|
30
|
-
}, [way]);
|
|
31
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
-
usePath.PathContext.Provider,
|
|
33
|
-
{
|
|
34
|
-
value: new path.default(new Array(waySegments.length).fill([]), Number(strokeProps.strokeWidth) || 1, false),
|
|
35
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(Group.default, { ref, transform: `translate(${offset[0]}, ${offset[1]})`, children: [
|
|
36
|
-
waySegments.map((segment, index$1) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
-
index.default,
|
|
38
|
-
{
|
|
39
|
-
index: index$1,
|
|
40
|
-
way: segment,
|
|
41
|
-
...strokeProps,
|
|
42
|
-
endArrow: index$1 === waySegments.length - 1 ? endArrow || endArrows : endArrows,
|
|
43
|
-
startArrow: index$1 === waySegments.length - 1 ? startArrow || startArrows : startArrows
|
|
44
|
-
},
|
|
45
|
-
JSON.stringify(segment)
|
|
46
|
-
)),
|
|
47
|
-
children
|
|
48
|
-
] })
|
|
49
|
-
}
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
exports.default = InnerDraw;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { Position } from '../../types/coordinate/descartes';
|
|
3
|
-
import { StrokeProps } from '../../types/svg/stroke';
|
|
4
|
-
import { ArrowConfig, ArrowProps, DrawWayType } from './types';
|
|
5
|
-
export type InnerDrawProps = {
|
|
6
|
-
/** 位置偏移 */
|
|
7
|
-
offset: Position;
|
|
8
|
-
way: DrawWayType[];
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
} & StrokeProps & ArrowProps<ArrowConfig>;
|
|
11
|
-
declare const InnerDraw: import('react').ForwardRefExoticComponent<{
|
|
12
|
-
/** 位置偏移 */
|
|
13
|
-
offset: Position;
|
|
14
|
-
way: DrawWayType[];
|
|
15
|
-
children?: ReactNode;
|
|
16
|
-
} & StrokeProps & ArrowProps<ArrowConfig> & import('react').RefAttributes<SVGPathElement>>;
|
|
17
|
-
export default InnerDraw;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const getCirclePath = (attributes) => {
|
|
4
|
-
const {
|
|
5
|
-
width = 5,
|
|
6
|
-
left = false,
|
|
7
|
-
right = false,
|
|
8
|
-
scale = 1
|
|
9
|
-
} = attributes;
|
|
10
|
-
const radius = width / 2 * scale;
|
|
11
|
-
const diameter = width * scale;
|
|
12
|
-
const startPoint = [0, 0];
|
|
13
|
-
const path = `M ${startPoint.join(",")} ` + (left ? `A ${radius},${radius} 0 1,0 ${-diameter},0 Z` : right ? `A ${radius},${radius} 0 1,1 ${-diameter},0 Z` : `A ${radius},${radius} 0 1,0 ${-diameter},0A ${radius},${radius} 0 1,0 ${startPoint.join(",")} Z`);
|
|
14
|
-
return {
|
|
15
|
-
d: path,
|
|
16
|
-
offsetDistance: radius,
|
|
17
|
-
insertDistance: radius
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
exports.default = getCirclePath;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const circle = require("./circle.cjs");
|
|
4
|
-
const stealth = require("./stealth.cjs");
|
|
5
|
-
const getArrowPath = (type, attributes) => {
|
|
6
|
-
switch (type) {
|
|
7
|
-
case "Stealth":
|
|
8
|
-
return stealth.default(attributes);
|
|
9
|
-
case "Circle":
|
|
10
|
-
return circle.default(attributes);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
exports.default = getArrowPath;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ArrowAttributes, ArrowPathConfig } from './types';
|
|
2
|
-
export type { ArrowAttributes as ArrowPositionAttributes, ArrowPathConfig };
|
|
3
|
-
export type ArrowType = 'Stealth' | 'Circle';
|
|
4
|
-
declare const getArrowPath: (type: ArrowType, attributes: ArrowAttributes) => {
|
|
5
|
-
d: string;
|
|
6
|
-
offsetDistance: number;
|
|
7
|
-
insertDistance: number;
|
|
8
|
-
};
|
|
9
|
-
export default getArrowPath;
|