@retikz/core 0.0.1-rc.3 → 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/es/compile/compile.d.ts +27 -0
- package/dist/es/compile/compile.d.ts.map +1 -0
- package/dist/es/compile/compile.js +43 -0
- package/dist/es/compile/index.d.ts +9 -0
- package/dist/es/compile/index.d.ts.map +1 -0
- package/dist/es/compile/node.d.ts +76 -0
- package/dist/es/compile/node.d.ts.map +1 -0
- package/dist/es/compile/node.js +240 -0
- package/dist/es/compile/parseTarget.d.ts +25 -0
- package/dist/es/compile/parseTarget.d.ts.map +1 -0
- package/dist/es/compile/parseTarget.js +48 -0
- package/dist/es/compile/path.d.ts +29 -0
- package/dist/es/compile/path.d.ts.map +1 -0
- package/dist/es/compile/path.js +298 -0
- package/dist/es/compile/position.d.ts +9 -0
- package/dist/es/compile/position.d.ts.map +1 -0
- package/dist/es/compile/position.js +24 -0
- package/dist/es/compile/precision.d.ts +5 -0
- package/dist/es/compile/precision.d.ts.map +1 -0
- package/dist/es/compile/precision.js +8 -0
- package/dist/es/compile/text-metrics.d.ts +32 -0
- package/dist/es/compile/text-metrics.d.ts.map +1 -0
- package/dist/es/compile/text-metrics.js +8 -0
- package/dist/es/compile/view-box.d.ts +8 -0
- package/dist/es/compile/view-box.d.ts.map +1 -0
- package/dist/es/compile/view-box.js +31 -0
- package/dist/es/geometry/circle.d.ts +32 -0
- package/dist/es/geometry/circle.d.ts.map +1 -0
- package/dist/es/geometry/circle.js +79 -0
- package/dist/es/geometry/diamond.d.ts +44 -0
- package/dist/es/geometry/diamond.d.ts.map +1 -0
- package/dist/es/geometry/diamond.js +87 -0
- package/dist/es/geometry/ellipse.d.ts +38 -0
- package/dist/es/geometry/ellipse.d.ts.map +1 -0
- package/dist/es/geometry/ellipse.js +86 -0
- package/dist/es/geometry/index.d.ts +7 -0
- package/dist/es/geometry/index.d.ts.map +1 -0
- package/dist/es/geometry/point.d.ts +25 -0
- package/dist/es/geometry/point.d.ts.map +1 -0
- package/dist/es/geometry/point.js +34 -0
- package/dist/es/geometry/polar.d.ts +44 -0
- package/dist/es/geometry/polar.d.ts.map +1 -0
- package/dist/es/geometry/polar.js +45 -0
- package/dist/es/geometry/rect.d.ts +59 -0
- package/dist/es/geometry/rect.d.ts.map +1 -0
- package/dist/es/geometry/rect.js +120 -0
- package/dist/es/index.d.ts +20 -10
- package/dist/es/index.d.ts.map +1 -0
- package/dist/es/index.js +18 -12
- package/dist/es/ir/index.d.ts +5 -0
- package/dist/es/ir/index.d.ts.map +1 -0
- package/dist/es/ir/node.d.ts +73 -0
- package/dist/es/ir/node.d.ts.map +1 -0
- package/dist/es/ir/node.js +41 -0
- package/dist/es/ir/path/arrow.d.ts +26 -0
- package/dist/es/ir/path/arrow.d.ts.map +1 -0
- package/dist/es/ir/path/arrow.js +25 -0
- package/dist/es/ir/path/index.d.ts +5 -0
- package/dist/es/ir/path/index.d.ts.map +1 -0
- package/dist/es/ir/path/path.d.ts +123 -0
- package/dist/es/ir/path/path.d.ts.map +1 -0
- package/dist/es/ir/path/path.js +22 -0
- package/dist/es/ir/path/step.d.ts +116 -0
- package/dist/es/ir/path/step.d.ts.map +1 -0
- package/dist/es/ir/path/step.js +31 -0
- package/dist/es/ir/path/target.d.ts +5 -0
- package/dist/es/ir/path/target.d.ts.map +1 -0
- package/dist/es/ir/path/target.js +11 -0
- package/dist/es/ir/position/index.d.ts +3 -0
- package/dist/es/ir/position/index.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.d.ts +9 -0
- package/dist/es/ir/position/polar-position.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.js +18 -0
- package/dist/es/ir/position/position.d.ts +5 -0
- package/dist/es/ir/position/position.d.ts.map +1 -0
- package/dist/es/ir/position/position.js +5 -0
- package/dist/es/ir/scene.d.ts +424 -0
- package/dist/es/ir/scene.d.ts.map +1 -0
- package/dist/es/ir/scene.js +14 -0
- package/dist/es/parsers/index.d.ts +2 -0
- package/dist/es/parsers/index.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.d.ts +71 -0
- package/dist/es/parsers/parseWay.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.js +92 -0
- package/dist/es/primitive/ellipse.d.ts +32 -0
- package/dist/es/primitive/ellipse.d.ts.map +1 -0
- package/dist/es/primitive/group.d.ts +11 -0
- package/dist/es/primitive/group.d.ts.map +1 -0
- package/dist/es/primitive/index.d.ts +8 -0
- package/dist/es/primitive/index.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +29 -0
- package/dist/es/primitive/path.d.ts.map +1 -0
- package/dist/es/primitive/rect.d.ts +28 -0
- package/dist/es/primitive/rect.d.ts.map +1 -0
- package/dist/es/primitive/scene.d.ts +21 -0
- package/dist/es/primitive/scene.d.ts.map +1 -0
- package/dist/es/primitive/text.d.ts +32 -0
- package/dist/es/primitive/text.d.ts.map +1 -0
- package/dist/es/primitive/view-box.d.ts +12 -0
- package/dist/es/primitive/view-box.d.ts.map +1 -0
- package/dist/es/types.d.ts +3 -0
- package/dist/es/types.d.ts.map +1 -0
- package/dist/lib/compile/compile.cjs +43 -0
- package/dist/lib/compile/compile.d.ts +27 -0
- package/dist/lib/compile/compile.d.ts.map +1 -0
- package/dist/lib/compile/index.d.ts +9 -0
- package/dist/lib/compile/index.d.ts.map +1 -0
- package/dist/lib/compile/node.cjs +244 -0
- package/dist/lib/compile/node.d.ts +76 -0
- package/dist/lib/compile/node.d.ts.map +1 -0
- package/dist/lib/compile/parseTarget.cjs +48 -0
- package/dist/lib/compile/parseTarget.d.ts +25 -0
- package/dist/lib/compile/parseTarget.d.ts.map +1 -0
- package/dist/lib/compile/path.cjs +298 -0
- package/dist/lib/compile/path.d.ts +29 -0
- package/dist/lib/compile/path.d.ts.map +1 -0
- package/dist/lib/compile/position.cjs +24 -0
- package/dist/lib/compile/position.d.ts +9 -0
- package/dist/lib/compile/position.d.ts.map +1 -0
- package/dist/lib/compile/precision.cjs +8 -0
- package/dist/lib/compile/precision.d.ts +5 -0
- package/dist/lib/compile/precision.d.ts.map +1 -0
- package/dist/lib/compile/text-metrics.cjs +8 -0
- package/dist/lib/compile/text-metrics.d.ts +32 -0
- package/dist/lib/compile/text-metrics.d.ts.map +1 -0
- package/dist/lib/compile/view-box.cjs +31 -0
- package/dist/lib/compile/view-box.d.ts +8 -0
- package/dist/lib/compile/view-box.d.ts.map +1 -0
- package/dist/lib/geometry/circle.cjs +79 -0
- package/dist/lib/geometry/circle.d.ts +32 -0
- package/dist/lib/geometry/circle.d.ts.map +1 -0
- package/dist/lib/geometry/diamond.cjs +87 -0
- package/dist/lib/geometry/diamond.d.ts +44 -0
- package/dist/lib/geometry/diamond.d.ts.map +1 -0
- package/dist/lib/geometry/ellipse.cjs +86 -0
- package/dist/lib/geometry/ellipse.d.ts +38 -0
- package/dist/lib/geometry/ellipse.d.ts.map +1 -0
- package/dist/lib/geometry/index.d.ts +7 -0
- package/dist/lib/geometry/index.d.ts.map +1 -0
- package/dist/lib/geometry/point.cjs +34 -0
- package/dist/lib/geometry/point.d.ts +25 -0
- package/dist/lib/geometry/point.d.ts.map +1 -0
- package/dist/lib/geometry/polar.cjs +45 -0
- package/dist/lib/geometry/polar.d.ts +44 -0
- package/dist/lib/geometry/polar.d.ts.map +1 -0
- package/dist/lib/geometry/rect.cjs +121 -0
- package/dist/lib/geometry/rect.d.ts +59 -0
- package/dist/lib/geometry/rect.d.ts.map +1 -0
- package/dist/lib/index.cjs +43 -11
- package/dist/lib/index.d.ts +20 -10
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/ir/index.d.ts +5 -0
- package/dist/lib/ir/index.d.ts.map +1 -0
- package/dist/lib/ir/node.cjs +42 -0
- package/dist/lib/ir/node.d.ts +73 -0
- package/dist/lib/ir/node.d.ts.map +1 -0
- package/dist/lib/ir/path/arrow.cjs +25 -0
- package/dist/lib/ir/path/arrow.d.ts +26 -0
- package/dist/lib/ir/path/arrow.d.ts.map +1 -0
- package/dist/lib/ir/path/index.d.ts +5 -0
- package/dist/lib/ir/path/index.d.ts.map +1 -0
- package/dist/lib/ir/path/path.cjs +22 -0
- package/dist/lib/ir/path/path.d.ts +123 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -0
- package/dist/lib/ir/path/step.cjs +35 -0
- package/dist/lib/ir/path/step.d.ts +116 -0
- package/dist/lib/ir/path/step.d.ts.map +1 -0
- package/dist/lib/ir/path/target.cjs +11 -0
- package/dist/lib/ir/path/target.d.ts +5 -0
- package/dist/lib/ir/path/target.d.ts.map +1 -0
- package/dist/lib/ir/position/index.d.ts +3 -0
- package/dist/lib/ir/position/index.d.ts.map +1 -0
- package/dist/lib/ir/position/polar-position.cjs +18 -0
- package/dist/lib/ir/position/polar-position.d.ts +9 -0
- package/dist/lib/ir/position/polar-position.d.ts.map +1 -0
- package/dist/lib/ir/position/position.cjs +5 -0
- package/dist/lib/ir/position/position.d.ts +5 -0
- package/dist/lib/ir/position/position.d.ts.map +1 -0
- package/dist/lib/ir/scene.cjs +16 -0
- package/dist/lib/ir/scene.d.ts +424 -0
- package/dist/lib/ir/scene.d.ts.map +1 -0
- package/dist/lib/parsers/index.d.ts +2 -0
- package/dist/lib/parsers/index.d.ts.map +1 -0
- package/dist/lib/parsers/parseWay.cjs +93 -0
- package/dist/lib/parsers/parseWay.d.ts +71 -0
- package/dist/lib/parsers/parseWay.d.ts.map +1 -0
- package/dist/lib/primitive/ellipse.d.ts +32 -0
- package/dist/lib/primitive/ellipse.d.ts.map +1 -0
- package/dist/lib/primitive/group.d.ts +11 -0
- package/dist/lib/primitive/group.d.ts.map +1 -0
- package/dist/lib/primitive/index.d.ts +8 -0
- package/dist/lib/primitive/index.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +29 -0
- package/dist/lib/primitive/path.d.ts.map +1 -0
- package/dist/lib/primitive/rect.d.ts +28 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -0
- package/dist/lib/primitive/scene.d.ts +21 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -0
- package/dist/lib/primitive/text.d.ts +32 -0
- package/dist/lib/primitive/text.d.ts.map +1 -0
- package/dist/lib/primitive/view-box.d.ts +12 -0
- package/dist/lib/primitive/view-box.d.ts.map +1 -0
- package/dist/lib/types.d.ts +3 -0
- package/dist/lib/types.d.ts.map +1 -0
- package/package.json +26 -34
- package/README.md +0 -2
- package/dist/es/components/Scope.d.ts +0 -6
- package/dist/es/components/Scope.js +0 -12
- package/dist/es/components/TikZ.d.ts +0 -9
- package/dist/es/components/TikZ.js +0 -12
- package/dist/es/components/draw/Draw.d.ts +0 -26
- package/dist/es/components/draw/Draw.js +0 -59
- package/dist/es/components/draw/InnerDraw.d.ts +0 -17
- package/dist/es/components/draw/InnerDraw.js +0 -52
- package/dist/es/components/draw/arrow/circle.d.ts +0 -7
- package/dist/es/components/draw/arrow/circle.js +0 -20
- package/dist/es/components/draw/arrow/index.d.ts +0 -9
- package/dist/es/components/draw/arrow/index.js +0 -13
- package/dist/es/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/es/components/draw/arrow/stealth.js +0 -29
- package/dist/es/components/draw/arrow/types.d.ts +0 -21
- package/dist/es/components/draw/common.d.ts +0 -4
- package/dist/es/components/draw/common.js +0 -12
- package/dist/es/components/draw/index.d.ts +0 -3
- package/dist/es/components/draw/index.js +0 -4
- package/dist/es/components/draw/segment/Segment.d.ts +0 -12
- package/dist/es/components/draw/segment/Segment.js +0 -41
- package/dist/es/components/draw/segment/index.d.ts +0 -15
- package/dist/es/components/draw/segment/index.js +0 -41
- package/dist/es/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/es/components/draw/segment/useArrow.js +0 -52
- package/dist/es/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/es/components/draw/segment/useConvertWay.js +0 -117
- package/dist/es/components/draw/types.d.ts +0 -29
- package/dist/es/components/node/InnerNode.d.ts +0 -33
- package/dist/es/components/node/InnerNode.js +0 -88
- package/dist/es/components/node/Node.d.ts +0 -93
- package/dist/es/components/node/Node.js +0 -88
- package/dist/es/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/es/components/node/_hooks/useNodeConfig.js +0 -13
- package/dist/es/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeContent.js +0 -30
- package/dist/es/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeShape.js +0 -34
- package/dist/es/components/node/index.d.ts +0 -3
- package/dist/es/components/node/index.js +0 -4
- package/dist/es/components/path-node/PathNode.d.ts +0 -48
- package/dist/es/components/path-node/PathNode.js +0 -76
- package/dist/es/components/path-node/index.d.ts +0 -3
- package/dist/es/components/path-node/index.js +0 -4
- package/dist/es/components/path-node/useAnchor.d.ts +0 -6
- package/dist/es/components/path-node/useAnchor.js +0 -49
- package/dist/es/container/Group.d.ts +0 -6
- package/dist/es/container/Group.js +0 -8
- package/dist/es/container/Surface.d.ts +0 -19
- package/dist/es/container/Surface.js +0 -23
- package/dist/es/elements/Path.d.ts +0 -4
- package/dist/es/elements/Path.js +0 -14
- package/dist/es/elements/Rect.d.ts +0 -4
- package/dist/es/elements/Rect.js +0 -9
- package/dist/es/elements/Text.d.ts +0 -18
- package/dist/es/elements/Text.js +0 -35
- package/dist/es/hooks/context/useCalculate.d.ts +0 -7
- package/dist/es/hooks/context/useCalculate.js +0 -9
- package/dist/es/hooks/context/useNodes.d.ts +0 -9
- package/dist/es/hooks/context/useNodes.js +0 -33
- package/dist/es/hooks/context/usePath.d.ts +0 -13
- package/dist/es/hooks/context/usePath.js +0 -20
- package/dist/es/hooks/context/useScope.d.ts +0 -11
- package/dist/es/hooks/context/useScope.js +0 -7
- package/dist/es/hooks/useForceUpdate.d.ts +0 -2
- package/dist/es/hooks/useForceUpdate.js +0 -8
- package/dist/es/model/component/node.d.ts +0 -45
- package/dist/es/model/component/node.js +0 -164
- package/dist/es/model/component/path.d.ts +0 -19
- package/dist/es/model/component/path.js +0 -47
- package/dist/es/model/equation/line.d.ts +0 -21
- package/dist/es/model/equation/line.js +0 -76
- package/dist/es/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/es/model/geometry/point/DescartesPoint.js +0 -50
- package/dist/es/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/es/model/geometry/point/PolarPoint.js +0 -27
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +0 -338
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +0 -13
- package/dist/es/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js +0 -88
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js +0 -6
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js +0 -8
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js +0 -39
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js +0 -41
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js +0 -19
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js +0 -10
- package/dist/es/test.d.ts +0 -3
- package/dist/es/types/coordinate/descartes.d.ts +0 -23
- package/dist/es/types/coordinate/index.d.ts +0 -5
- package/dist/es/types/coordinate/polar.d.ts +0 -5
- package/dist/es/types/distance/index.d.ts +0 -8
- package/dist/es/types/distance/sep.d.ts +0 -9
- package/dist/es/types/shape/index.d.ts +0 -8
- package/dist/es/types/shape/index.js +0 -9
- package/dist/es/types/shape/rect.d.ts +0 -25
- package/dist/es/types/shape/rect.js +0 -30
- package/dist/es/types/svg/font.d.ts +0 -10
- package/dist/es/types/svg/stroke.d.ts +0 -10
- package/dist/es/types/tikz/index.d.ts +0 -6
- package/dist/es/utils/compare.d.ts +0 -4
- package/dist/es/utils/compare.js +0 -20
- package/dist/es/utils/css.d.ts +0 -6
- package/dist/es/utils/css.js +0 -26
- package/dist/es/utils/math.d.ts +0 -9
- package/dist/es/utils/math.js +0 -26
- package/dist/es/utils/string.d.ts +0 -7
- package/dist/es/utils/string.js +0 -7
- package/dist/es/utils/style/font.d.ts +0 -17
- package/dist/es/utils/style/font.js +0 -34
- package/dist/es/utils/style/stroke.d.ts +0 -20
- package/dist/es/utils/style/stroke.js +0 -42
- package/dist/lib/components/Scope.cjs +0 -12
- package/dist/lib/components/Scope.d.ts +0 -6
- package/dist/lib/components/TikZ.cjs +0 -12
- package/dist/lib/components/TikZ.d.ts +0 -9
- package/dist/lib/components/draw/Draw.cjs +0 -59
- package/dist/lib/components/draw/Draw.d.ts +0 -26
- package/dist/lib/components/draw/InnerDraw.cjs +0 -52
- package/dist/lib/components/draw/InnerDraw.d.ts +0 -17
- package/dist/lib/components/draw/arrow/circle.cjs +0 -20
- package/dist/lib/components/draw/arrow/circle.d.ts +0 -7
- package/dist/lib/components/draw/arrow/index.cjs +0 -13
- package/dist/lib/components/draw/arrow/index.d.ts +0 -9
- package/dist/lib/components/draw/arrow/stealth.cjs +0 -29
- package/dist/lib/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/lib/components/draw/arrow/types.d.ts +0 -21
- package/dist/lib/components/draw/common.cjs +0 -12
- package/dist/lib/components/draw/common.d.ts +0 -4
- package/dist/lib/components/draw/index.cjs +0 -4
- package/dist/lib/components/draw/index.d.ts +0 -3
- package/dist/lib/components/draw/segment/Segment.cjs +0 -41
- package/dist/lib/components/draw/segment/Segment.d.ts +0 -12
- package/dist/lib/components/draw/segment/index.cjs +0 -41
- package/dist/lib/components/draw/segment/index.d.ts +0 -15
- package/dist/lib/components/draw/segment/useArrow.cjs +0 -52
- package/dist/lib/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/lib/components/draw/segment/useConvertWay.cjs +0 -117
- package/dist/lib/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/lib/components/draw/types.d.ts +0 -29
- package/dist/lib/components/node/InnerNode.cjs +0 -88
- package/dist/lib/components/node/InnerNode.d.ts +0 -33
- package/dist/lib/components/node/Node.cjs +0 -88
- package/dist/lib/components/node/Node.d.ts +0 -93
- package/dist/lib/components/node/_hooks/useNodeConfig.cjs +0 -13
- package/dist/lib/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/lib/components/node/_hooks/useNodeContent.cjs +0 -30
- package/dist/lib/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/lib/components/node/_hooks/useNodeShape.cjs +0 -34
- package/dist/lib/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/lib/components/node/index.cjs +0 -4
- package/dist/lib/components/node/index.d.ts +0 -3
- package/dist/lib/components/path-node/PathNode.cjs +0 -76
- package/dist/lib/components/path-node/PathNode.d.ts +0 -48
- package/dist/lib/components/path-node/index.cjs +0 -4
- package/dist/lib/components/path-node/index.d.ts +0 -3
- package/dist/lib/components/path-node/useAnchor.cjs +0 -49
- package/dist/lib/components/path-node/useAnchor.d.ts +0 -6
- package/dist/lib/container/Group.cjs +0 -8
- package/dist/lib/container/Group.d.ts +0 -6
- package/dist/lib/container/Surface.cjs +0 -23
- package/dist/lib/container/Surface.d.ts +0 -19
- package/dist/lib/elements/Path.cjs +0 -14
- package/dist/lib/elements/Path.d.ts +0 -4
- package/dist/lib/elements/Rect.cjs +0 -9
- package/dist/lib/elements/Rect.d.ts +0 -4
- package/dist/lib/elements/Text.cjs +0 -35
- package/dist/lib/elements/Text.d.ts +0 -18
- package/dist/lib/hooks/context/useCalculate.cjs +0 -9
- package/dist/lib/hooks/context/useCalculate.d.ts +0 -7
- package/dist/lib/hooks/context/useNodes.cjs +0 -33
- package/dist/lib/hooks/context/useNodes.d.ts +0 -9
- package/dist/lib/hooks/context/usePath.cjs +0 -20
- package/dist/lib/hooks/context/usePath.d.ts +0 -13
- package/dist/lib/hooks/context/useScope.cjs +0 -7
- package/dist/lib/hooks/context/useScope.d.ts +0 -11
- package/dist/lib/hooks/useForceUpdate.cjs +0 -8
- package/dist/lib/hooks/useForceUpdate.d.ts +0 -2
- package/dist/lib/model/component/node.cjs +0 -164
- package/dist/lib/model/component/node.d.ts +0 -45
- package/dist/lib/model/component/path.cjs +0 -47
- package/dist/lib/model/component/path.d.ts +0 -19
- package/dist/lib/model/equation/line.cjs +0 -76
- package/dist/lib/model/equation/line.d.ts +0 -21
- package/dist/lib/model/geometry/point/DescartesPoint.cjs +0 -50
- package/dist/lib/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/lib/model/geometry/point/PolarPoint.cjs +0 -27
- package/dist/lib/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.cjs +0 -338
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.cjs +0 -13
- package/dist/lib/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.cjs +0 -88
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.cjs +0 -6
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.cjs +0 -8
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.cjs +0 -39
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.cjs +0 -41
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.cjs +0 -19
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.cjs +0 -10
- package/dist/lib/test.d.ts +0 -3
- package/dist/lib/types/coordinate/descartes.d.ts +0 -23
- package/dist/lib/types/coordinate/index.d.ts +0 -5
- package/dist/lib/types/coordinate/polar.d.ts +0 -5
- package/dist/lib/types/distance/index.d.ts +0 -8
- package/dist/lib/types/distance/sep.d.ts +0 -9
- package/dist/lib/types/shape/index.cjs +0 -9
- package/dist/lib/types/shape/index.d.ts +0 -8
- package/dist/lib/types/shape/rect.cjs +0 -30
- package/dist/lib/types/shape/rect.d.ts +0 -25
- package/dist/lib/types/svg/font.d.ts +0 -10
- package/dist/lib/types/svg/stroke.d.ts +0 -10
- package/dist/lib/types/tikz/index.d.ts +0 -6
- package/dist/lib/utils/compare.cjs +0 -20
- package/dist/lib/utils/compare.d.ts +0 -4
- package/dist/lib/utils/css.cjs +0 -26
- package/dist/lib/utils/css.d.ts +0 -6
- package/dist/lib/utils/math.cjs +0 -26
- package/dist/lib/utils/math.d.ts +0 -9
- package/dist/lib/utils/string.cjs +0 -7
- package/dist/lib/utils/string.d.ts +0 -7
- package/dist/lib/utils/style/font.cjs +0 -34
- package/dist/lib/utils/style/font.d.ts +0 -17
- package/dist/lib/utils/style/stroke.cjs +0 -42
- package/dist/lib/utils/style/stroke.d.ts +0 -20
|
@@ -1,41 +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 Path = require("../../../elements/Path.cjs");
|
|
6
|
-
const Group = require("../../../container/Group.cjs");
|
|
7
|
-
const useArrow = require("./useArrow.cjs");
|
|
8
|
-
const line = require("../../../node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.cjs");
|
|
9
|
-
const InnerDrawSegment = (props) => {
|
|
10
|
-
const { way, startArrow, endArrow, ...strokeProps } = props;
|
|
11
|
-
const pickedArrowStrokeProps = {
|
|
12
|
-
stroke: strokeProps.stroke,
|
|
13
|
-
strokeWidth: Number(strokeProps.strokeWidth),
|
|
14
|
-
strokeOpacity: strokeProps.strokeOpacity
|
|
15
|
-
};
|
|
16
|
-
const startArrowPath = useArrow.default(
|
|
17
|
-
{ position: way[0], nearPosition: way[1], arrowType: "start" },
|
|
18
|
-
startArrow ? { ...pickedArrowStrokeProps, ...startArrow } : void 0
|
|
19
|
-
);
|
|
20
|
-
const endArrowPath = useArrow.default(
|
|
21
|
-
{ position: way[way.length - 1], nearPosition: way[way.length - 2], arrowType: "end" },
|
|
22
|
-
endArrow ? { ...pickedArrowStrokeProps, ...endArrow } : void 0
|
|
23
|
-
);
|
|
24
|
-
const d = react.useMemo(() => {
|
|
25
|
-
const realWay = [...way];
|
|
26
|
-
if (startArrowPath) {
|
|
27
|
-
realWay[0] = startArrowPath.linkPoint;
|
|
28
|
-
}
|
|
29
|
-
if (endArrowPath) {
|
|
30
|
-
realWay[realWay.length - 1] = endArrowPath.linkPoint;
|
|
31
|
-
}
|
|
32
|
-
const straightLine = line.default().x((d2) => d2[0]).y((d2) => d2[1]);
|
|
33
|
-
return straightLine(realWay);
|
|
34
|
-
}, [way]);
|
|
35
|
-
return endArrowPath || startArrowPath ? /* @__PURE__ */ jsxRuntime.jsxs(Group.default, { children: [
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx(Path.default, { d: d ?? "", ...strokeProps }),
|
|
37
|
-
startArrowPath ? startArrowPath.arrowPath : null,
|
|
38
|
-
endArrowPath ? endArrowPath.arrowPath : null
|
|
39
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsx(Path.default, { d: d ?? "", ...strokeProps });
|
|
40
|
-
};
|
|
41
|
-
exports.default = InnerDrawSegment;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { Position } from '../../../types/coordinate/descartes';
|
|
3
|
-
import { StrokeProps } from '../../../types/svg/stroke';
|
|
4
|
-
import { ArrowConfig } from '../types';
|
|
5
|
-
export type InnerDrawSegmentProps = {
|
|
6
|
-
/** 路径,始末节点为 undefined 表示临近点在 node 外边界内 */
|
|
7
|
-
way: Position[];
|
|
8
|
-
startArrow?: ArrowConfig;
|
|
9
|
-
endArrow?: ArrowConfig;
|
|
10
|
-
} & StrokeProps;
|
|
11
|
-
declare const InnerDrawSegment: FC<InnerDrawSegmentProps>;
|
|
12
|
-
export default InnerDrawSegment;
|
|
@@ -1,41 +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 node = require("../../../model/component/node.cjs");
|
|
6
|
-
const stroke = require("../../../utils/style/stroke.cjs");
|
|
7
|
-
const Segment = require("./Segment.cjs");
|
|
8
|
-
const useConvertWay = require("./useConvertWay.cjs");
|
|
9
|
-
const usePath = require("../../../hooks/context/usePath.cjs");
|
|
10
|
-
const DrawSegment = (props) => {
|
|
11
|
-
const { way, index, startArrow, endArrow, ...resProps } = props;
|
|
12
|
-
const { strokeType = "solid", strokeWidth = 1, ...strokeProps } = resProps;
|
|
13
|
-
const [convertedWay, nodesInit] = useConvertWay.default(way);
|
|
14
|
-
const { model, updateModel } = usePath.default();
|
|
15
|
-
const pointWay = react.useMemo(() => {
|
|
16
|
-
const realWay = convertedWay.map((wayPoint, index2) => {
|
|
17
|
-
if (wayPoint instanceof node.default) {
|
|
18
|
-
const neighborPoint = index2 === 0 ? convertedWay[1] : convertedWay[index2 - 1];
|
|
19
|
-
return wayPoint.getCrossPoint(neighborPoint instanceof node.default ? neighborPoint.center : neighborPoint);
|
|
20
|
-
}
|
|
21
|
-
return wayPoint;
|
|
22
|
-
});
|
|
23
|
-
const newWay = [...model.ways];
|
|
24
|
-
newWay[index] = realWay;
|
|
25
|
-
updateModel({ ways: newWay, init: nodesInit });
|
|
26
|
-
return realWay;
|
|
27
|
-
}, [convertedWay]);
|
|
28
|
-
if (!nodesInit) return null;
|
|
29
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
-
Segment.default,
|
|
31
|
-
{
|
|
32
|
-
way: pointWay,
|
|
33
|
-
startArrow,
|
|
34
|
-
endArrow,
|
|
35
|
-
strokeWidth,
|
|
36
|
-
...stroke.convertStrokeType(strokeType, strokeWidth),
|
|
37
|
-
...strokeProps
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
};
|
|
41
|
-
exports.default = DrawSegment;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FC } from 'react';
|
|
2
|
-
import { StrokeProps } from '../../../types/svg/stroke';
|
|
3
|
-
import { ArrowConfig, DrawWaySegmentType } from '../types';
|
|
4
|
-
export type DrawSegmentProps = {
|
|
5
|
-
/** 路径,首位可以是 Node,其他必须是坐标 */
|
|
6
|
-
way: DrawWaySegmentType;
|
|
7
|
-
index: number;
|
|
8
|
-
/** 线段样式 */
|
|
9
|
-
strokeType?: 'solid' | 'dashed' | 'dotted';
|
|
10
|
-
startArrow?: ArrowConfig;
|
|
11
|
-
endArrow?: ArrowConfig;
|
|
12
|
-
} & StrokeProps;
|
|
13
|
-
/** 单条连续的路径 */
|
|
14
|
-
declare const DrawSegment: FC<DrawSegmentProps>;
|
|
15
|
-
export default DrawSegment;
|
|
@@ -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 useCalculate = require("../../../hooks/context/useCalculate.cjs");
|
|
6
|
-
const index = require("../arrow/index.cjs");
|
|
7
|
-
const Path = require("../../../elements/Path.cjs");
|
|
8
|
-
const line = require("../../../model/equation/line.cjs");
|
|
9
|
-
const math = require("../../../utils/math.cjs");
|
|
10
|
-
const useArrow = (linkConfig, arrowConfig) => {
|
|
11
|
-
const { precision } = useCalculate.default();
|
|
12
|
-
return react.useMemo(() => {
|
|
13
|
-
if (!arrowConfig) return null;
|
|
14
|
-
const { position, nearPosition } = linkConfig;
|
|
15
|
-
const { type, stroke, linkType = "end", round, strokeLinejoin, strokeWidth, ...strokeProps } = arrowConfig;
|
|
16
|
-
const degree = line.default.getDegree(nearPosition, position);
|
|
17
|
-
const isRound = round || strokeLinejoin === "round";
|
|
18
|
-
const realStrokeWidth = strokeWidth ?? 1;
|
|
19
|
-
const { d, offsetDistance, insertDistance } = index.default(type, arrowConfig);
|
|
20
|
-
const endOffset = [
|
|
21
|
-
(isRound ? realStrokeWidth : offsetDistance) * Math.cos(degree),
|
|
22
|
-
(isRound ? realStrokeWidth : offsetDistance) * Math.sin(degree)
|
|
23
|
-
];
|
|
24
|
-
const translatePosition = linkType === "end" ? [position[0] - endOffset[0], position[1] - endOffset[1]] : [position[0] + insertDistance * Math.cos(degree), position[1] + insertDistance * Math.sin(degree)];
|
|
25
|
-
const linkPoint = linkType === "end" ? [
|
|
26
|
-
position[0] - insertDistance * Math.cos(degree) - endOffset[0],
|
|
27
|
-
position[1] - insertDistance * Math.sin(degree) - endOffset[1]
|
|
28
|
-
] : position;
|
|
29
|
-
const transform = `translate(
|
|
30
|
-
${math.convertPrecision(translatePosition[0], precision)}, ${math.convertPrecision(
|
|
31
|
-
translatePosition[1],
|
|
32
|
-
precision
|
|
33
|
-
)}) rotate(${math.convertPrecision(degree * (180 / Math.PI), precision)})`;
|
|
34
|
-
return {
|
|
35
|
-
linkPoint,
|
|
36
|
-
arrowPath: /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
-
Path.default,
|
|
38
|
-
{
|
|
39
|
-
d,
|
|
40
|
-
strokeWidth,
|
|
41
|
-
strokeLinejoin: round ? "round" : "miter",
|
|
42
|
-
strokeMiterlimit: 10,
|
|
43
|
-
fill: stroke || "currentColor",
|
|
44
|
-
stroke,
|
|
45
|
-
transform,
|
|
46
|
-
...strokeProps
|
|
47
|
-
}
|
|
48
|
-
)
|
|
49
|
-
};
|
|
50
|
-
}, [arrowConfig, linkConfig]);
|
|
51
|
-
};
|
|
52
|
-
exports.default = useArrow;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ArrowConfig } from '../types';
|
|
2
|
-
import { Position } from '../../../types/coordinate/descartes';
|
|
3
|
-
export type ArrowLinkConfig = {
|
|
4
|
-
nearPosition: Position;
|
|
5
|
-
position: Position;
|
|
6
|
-
arrowType: 'start' | 'end';
|
|
7
|
-
};
|
|
8
|
-
declare const useArrow: (linkConfig: ArrowLinkConfig, arrowConfig?: ArrowConfig) => {
|
|
9
|
-
linkPoint: Position;
|
|
10
|
-
arrowPath: import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
} | null;
|
|
12
|
-
export default useArrow;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const useNodes = require("../../../hooks/context/useNodes.cjs");
|
|
5
|
-
const useForceUpdate = require("../../../hooks/useForceUpdate.cjs");
|
|
6
|
-
const DescartesPoint = require("../../../model/geometry/point/DescartesPoint.cjs");
|
|
7
|
-
const PolarPoint = require("../../../model/geometry/point/PolarPoint.cjs");
|
|
8
|
-
const common = require("../common.cjs");
|
|
9
|
-
const formatPointPosition = (point) => {
|
|
10
|
-
if (Array.isArray(point)) return point;
|
|
11
|
-
if ("x" in point && "y" in point) {
|
|
12
|
-
const p = point;
|
|
13
|
-
return [p.x, p.y];
|
|
14
|
-
}
|
|
15
|
-
return PolarPoint.default.convertPolarToDescartesPosition(point);
|
|
16
|
-
};
|
|
17
|
-
const getVerticalPoint = (point1, point2, type) => {
|
|
18
|
-
const p1 = formatPointPosition(point1);
|
|
19
|
-
const p2 = formatPointPosition(point2);
|
|
20
|
-
if (["-|", "|-"].includes(type)) return type === "-|" ? [p2[0], p1[1]] : [p1[0], p2[1]];
|
|
21
|
-
if (type === "-|-") {
|
|
22
|
-
const centerX = (p1[0] + p2[0]) / 2;
|
|
23
|
-
return [[centerX, p1[1]], [centerX, p2[1]]];
|
|
24
|
-
}
|
|
25
|
-
const centerY = (p1[1] + p2[1]) / 2;
|
|
26
|
-
return [[p1[0], centerY], [p2[0], centerY]];
|
|
27
|
-
};
|
|
28
|
-
const convertOffsetAndMovePoint = (point) => {
|
|
29
|
-
const filterPoint = point.replace(/[+()[\]\s]/g, "");
|
|
30
|
-
return filterPoint.split(",").map((item) => parseFloat(item));
|
|
31
|
-
};
|
|
32
|
-
const useConvertWay = (way) => {
|
|
33
|
-
const { getModel, subscribeModel } = useNodes.default();
|
|
34
|
-
const forceUpdate = useForceUpdate.default();
|
|
35
|
-
const nodeUpdateCount = react.useRef(0);
|
|
36
|
-
let cursor = [0, 0];
|
|
37
|
-
const tryGetModel = (name) => {
|
|
38
|
-
const model = getModel(name);
|
|
39
|
-
if (!model) {
|
|
40
|
-
throw new Error(`Node ${name} is not defined`);
|
|
41
|
-
}
|
|
42
|
-
cursor = model.center;
|
|
43
|
-
return model;
|
|
44
|
-
};
|
|
45
|
-
const subscribeCbs = [];
|
|
46
|
-
let allNodeInit = true;
|
|
47
|
-
const result = react.useMemo(
|
|
48
|
-
() => way.reduce((acc, item, index) => {
|
|
49
|
-
const type = common.getDrawPointType(item);
|
|
50
|
-
switch (type) {
|
|
51
|
-
case "coordinate": {
|
|
52
|
-
const corPosition = formatPointPosition(item);
|
|
53
|
-
cursor = corPosition;
|
|
54
|
-
acc.push(corPosition);
|
|
55
|
-
return acc;
|
|
56
|
-
}
|
|
57
|
-
case "node": {
|
|
58
|
-
if (![0, way.length - 1].includes(index)) {
|
|
59
|
-
throw new Error(
|
|
60
|
-
"Node can only be the first or last point on DrawSegment component, this may be a retikz bug, please report it."
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
const nodeModel = tryGetModel(item);
|
|
64
|
-
if (!nodeModel.init) allNodeInit = false;
|
|
65
|
-
const cb = subscribeModel(item, () => {
|
|
66
|
-
nodeUpdateCount.current += 1;
|
|
67
|
-
forceUpdate();
|
|
68
|
-
});
|
|
69
|
-
if (cb) subscribeCbs.push(cb);
|
|
70
|
-
cursor = nodeModel.center;
|
|
71
|
-
acc.push(nodeModel);
|
|
72
|
-
return acc;
|
|
73
|
-
}
|
|
74
|
-
case "vertical": {
|
|
75
|
-
if ([0, way.length - 1].includes(index)) {
|
|
76
|
-
throw new Error("Vertical point can not be the first point on path.");
|
|
77
|
-
}
|
|
78
|
-
const beforePosition = cursor;
|
|
79
|
-
const afterPoint = way[index + 1];
|
|
80
|
-
const afterPointType = common.getDrawPointType(afterPoint);
|
|
81
|
-
if (["vertical", "offset", "move"].includes(afterPointType)) {
|
|
82
|
-
throw new Error("Vertical point can not be followed by these point type: vertical offset move.");
|
|
83
|
-
}
|
|
84
|
-
const afterPosition = afterPointType === "node" ? tryGetModel(afterPoint).center : formatPointPosition(afterPoint);
|
|
85
|
-
const verPosition = getVerticalPoint(beforePosition, afterPosition, item);
|
|
86
|
-
if (Array.isArray(verPosition[0])) {
|
|
87
|
-
const realVerPosition = verPosition;
|
|
88
|
-
cursor = realVerPosition[realVerPosition.length - 1];
|
|
89
|
-
for (const point of realVerPosition) {
|
|
90
|
-
acc.push(point);
|
|
91
|
-
}
|
|
92
|
-
return acc;
|
|
93
|
-
}
|
|
94
|
-
cursor = verPosition;
|
|
95
|
-
acc.push(verPosition);
|
|
96
|
-
return acc;
|
|
97
|
-
}
|
|
98
|
-
default: {
|
|
99
|
-
if (index === 0) throw new Error("offset/move point can not be the first point on path.");
|
|
100
|
-
const convertedPos = convertOffsetAndMovePoint(item);
|
|
101
|
-
const curPos = DescartesPoint.default.plus(convertedPos, cursor);
|
|
102
|
-
if (type === "move") cursor = curPos;
|
|
103
|
-
acc.push(curPos);
|
|
104
|
-
return acc;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}, []),
|
|
108
|
-
[way, nodeUpdateCount.current]
|
|
109
|
-
);
|
|
110
|
-
react.useLayoutEffect(() => () => {
|
|
111
|
-
subscribeCbs.forEach((cb) => cb && cb());
|
|
112
|
-
});
|
|
113
|
-
return [result, allNodeInit];
|
|
114
|
-
};
|
|
115
|
-
exports.default = useConvertWay;
|
|
116
|
-
exports.formatPointPosition = formatPointPosition;
|
|
117
|
-
exports.getVerticalPoint = getVerticalPoint;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { default as NodeModel } from '../../../model/component/node';
|
|
2
|
-
import { PointPosition } from '../../../types/coordinate';
|
|
3
|
-
import { Position } from '../../../types/coordinate/descartes';
|
|
4
|
-
import { DrawWaySegmentType } from '../types';
|
|
5
|
-
/** 将坐标格式转换为笛卡尔坐标数组形式 */
|
|
6
|
-
export declare const formatPointPosition: (point: PointPosition) => Position;
|
|
7
|
-
/** 获取两点间的垂直点 */
|
|
8
|
-
export declare const getVerticalPoint: (point1: PointPosition, point2: PointPosition, type: "-|" | "|-" | "-|-" | "|-|") => Position | Position[];
|
|
9
|
-
/**
|
|
10
|
-
* 将特殊路径点转换为坐标,Node 节点转换为对应的 Model
|
|
11
|
-
* 目前支持的节点类型:node,各种坐标,垂点,位移点
|
|
12
|
-
*/
|
|
13
|
-
declare const useConvertWay: (way: DrawWaySegmentType) => [Array<Position | NodeModel>, boolean];
|
|
14
|
-
export default useConvertWay;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { PointPosition } from '../../types/coordinate';
|
|
2
|
-
import { StrokeProps } from '../../types/svg/stroke';
|
|
3
|
-
import { TikZKey } from '../../types/tikz';
|
|
4
|
-
import { ArrowPositionAttributes, ArrowType } from './arrow';
|
|
5
|
-
export type ArrowConfig = {
|
|
6
|
-
type: ArrowType;
|
|
7
|
-
fill?: string;
|
|
8
|
-
} & ArrowPositionAttributes & StrokeProps;
|
|
9
|
-
/** 垂直路径点,临近的节点不能都是特殊路径点 */
|
|
10
|
-
export type VerticalDrawPosition = '-|' | '|-' | '-|-' | '|-|';
|
|
11
|
-
/** 偏移与移动点 */
|
|
12
|
-
export type OffSetOrMovePosition = string;
|
|
13
|
-
/** 路径点类型:节点,坐标,垂点,偏移点,移动点 */
|
|
14
|
-
export type DrawPointType = 'node' | 'coordinate' | 'vertical' | 'offset' | 'move';
|
|
15
|
-
/** 路径节点类型 */
|
|
16
|
-
export type DrawWayType = TikZKey | PointPosition | VerticalDrawPosition | OffSetOrMovePosition;
|
|
17
|
-
/** 路径片段节点类型 */
|
|
18
|
-
export type DrawWaySegmentType = [
|
|
19
|
-
TikZKey | PointPosition,
|
|
20
|
-
...Array<PointPosition | VerticalDrawPosition | OffSetOrMovePosition>,
|
|
21
|
-
TikZKey | PointPosition
|
|
22
|
-
];
|
|
23
|
-
/** 箭头属性 */
|
|
24
|
-
export type ArrowProps<T = ArrowType | ArrowConfig> = {
|
|
25
|
-
startArrow?: T;
|
|
26
|
-
startArrows?: T;
|
|
27
|
-
endArrow?: T;
|
|
28
|
-
endArrows?: T;
|
|
29
|
-
};
|
|
@@ -1,88 +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 useNodeShape = require("./_hooks/useNodeShape.cjs");
|
|
7
|
-
const useNodeContent = require("./_hooks/useNodeContent.cjs");
|
|
8
|
-
const useNodeConfig = require("./_hooks/useNodeConfig.cjs");
|
|
9
|
-
const css = require("../../utils/css.cjs");
|
|
10
|
-
const useNodes = require("../../hooks/context/useNodes.cjs");
|
|
11
|
-
const useCalculate = require("../../hooks/context/useCalculate.cjs");
|
|
12
|
-
const math = require("../../utils/math.cjs");
|
|
13
|
-
const InnerNode = react.forwardRef((props, ref) => {
|
|
14
|
-
const { name, position, width, height, innerSep, outerSep, rotate } = props;
|
|
15
|
-
const nodeRef = react.useRef(null);
|
|
16
|
-
const shapeRef = react.useRef(null);
|
|
17
|
-
const contentRef = react.useRef(null);
|
|
18
|
-
const { getModel, updateModel, deleteModel } = useNodes.default();
|
|
19
|
-
const { precision } = useCalculate.default();
|
|
20
|
-
const nodeConfig = useNodeConfig.default();
|
|
21
|
-
nodeConfig.current.position = position;
|
|
22
|
-
if (name && !getModel(name)) {
|
|
23
|
-
updateModel(name, nodeConfig.current, false);
|
|
24
|
-
}
|
|
25
|
-
const groupElement = ref && "current" in ref ? ref.current : nodeRef.current;
|
|
26
|
-
react.useLayoutEffect(() => {
|
|
27
|
-
const contentElement = contentRef.current;
|
|
28
|
-
if (!contentElement) return;
|
|
29
|
-
const { width: elementWidth, height: elementHeight } = contentElement.getBoundingClientRect();
|
|
30
|
-
nodeConfig.current.contentSize = [Math.max(elementWidth, width || 0), Math.max(elementHeight, height || 0)];
|
|
31
|
-
});
|
|
32
|
-
const getSep = (sep) => {
|
|
33
|
-
const { width: width2 = 100, height: height2 = 100 } = (groupElement == null ? void 0 : groupElement.getBoundingClientRect()) || {};
|
|
34
|
-
const remPx = parseFloat(getComputedStyle(document.documentElement).fontSize);
|
|
35
|
-
const emPx = groupElement ? parseFloat(getComputedStyle(groupElement).fontSize) : remPx;
|
|
36
|
-
return {
|
|
37
|
-
left: css.convertCssToPx(sep.left, { remPx, emPx, parentPx: width2 }),
|
|
38
|
-
right: css.convertCssToPx(sep.right, { remPx, emPx, parentPx: width2 }),
|
|
39
|
-
top: css.convertCssToPx(sep.top, { remPx, emPx, parentPx: height2 }),
|
|
40
|
-
bottom: css.convertCssToPx(sep.bottom, { remPx, emPx, parentPx: height2 })
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
react.useLayoutEffect(() => {
|
|
44
|
-
nodeConfig.current.innerSep = getSep(innerSep);
|
|
45
|
-
}, [innerSep]);
|
|
46
|
-
react.useLayoutEffect(() => {
|
|
47
|
-
nodeConfig.current.outerSep = getSep(outerSep);
|
|
48
|
-
}, [outerSep]);
|
|
49
|
-
react.useLayoutEffect(() => {
|
|
50
|
-
var _a, _b, _c, _d;
|
|
51
|
-
const {
|
|
52
|
-
contentSize: [width2, height2],
|
|
53
|
-
innerSep: innerSep2
|
|
54
|
-
} = nodeConfig.current;
|
|
55
|
-
const realX = -width2 / 2 - innerSep2.left;
|
|
56
|
-
(_a = shapeRef.current) == null ? void 0 : _a.setAttribute("x", math.convertPrecision(realX, precision).toString());
|
|
57
|
-
const realY = -height2 / 2 - innerSep2.top;
|
|
58
|
-
(_b = shapeRef.current) == null ? void 0 : _b.setAttribute("y", math.convertPrecision(realY, precision).toString());
|
|
59
|
-
const realWidth = width2 + innerSep2.left + innerSep2.right;
|
|
60
|
-
(_c = shapeRef.current) == null ? void 0 : _c.setAttribute("width", math.convertPrecision(realWidth, precision).toString());
|
|
61
|
-
const realHeight = height2 + innerSep2.top + innerSep2.bottom;
|
|
62
|
-
(_d = shapeRef.current) == null ? void 0 : _d.setAttribute("height", math.convertPrecision(realHeight, precision).toString());
|
|
63
|
-
}, [nodeConfig.current.position, nodeConfig.current.contentSize, nodeConfig.current.innerSep]);
|
|
64
|
-
react.useLayoutEffect(() => {
|
|
65
|
-
if (name) updateModel(name, nodeConfig.current);
|
|
66
|
-
});
|
|
67
|
-
react.useLayoutEffect(
|
|
68
|
-
() => () => {
|
|
69
|
-
if (name) {
|
|
70
|
-
deleteModel(name);
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
[name]
|
|
74
|
-
);
|
|
75
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
76
|
-
Group.default,
|
|
77
|
-
{
|
|
78
|
-
ref: ref || nodeRef,
|
|
79
|
-
id: name,
|
|
80
|
-
transform: `translate(${position[0]}, ${position[1]}) ${rotate ? `rotate(${rotate})` : ""}`,
|
|
81
|
-
children: [
|
|
82
|
-
useNodeShape.default(props, shapeRef),
|
|
83
|
-
useNodeContent.default(props, contentRef)
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
exports.default = InnerNode;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { Position } from '../../types/coordinate/descartes';
|
|
3
|
-
import { StrokeProps } from '../../types/svg/stroke';
|
|
4
|
-
import { TikZProps } from '../../types/tikz';
|
|
5
|
-
import { DirectionDistance } from '../../types/distance';
|
|
6
|
-
import { FontProps } from '../../types/svg/font';
|
|
7
|
-
/** 节点外边框形状 */
|
|
8
|
-
export type NodeShape = 'rectangle';
|
|
9
|
-
/** 外层形状相关属性 */
|
|
10
|
-
export type ShapeProps = {
|
|
11
|
-
shape: NodeShape;
|
|
12
|
-
rx?: number | string;
|
|
13
|
-
ry?: number | string;
|
|
14
|
-
fill?: string;
|
|
15
|
-
fillOpacity?: number;
|
|
16
|
-
} & StrokeProps;
|
|
17
|
-
/** 内容相关属性 */
|
|
18
|
-
export type ContentProps = {
|
|
19
|
-
color: string;
|
|
20
|
-
opacity?: number;
|
|
21
|
-
children?: ReactNode;
|
|
22
|
-
size?: string | number;
|
|
23
|
-
} & FontProps;
|
|
24
|
-
export type InnerNodeProps = {
|
|
25
|
-
position: Position;
|
|
26
|
-
width?: number;
|
|
27
|
-
height?: number;
|
|
28
|
-
innerSep: DirectionDistance<number | string>;
|
|
29
|
-
outerSep: DirectionDistance<number | string>;
|
|
30
|
-
rotate?: number;
|
|
31
|
-
} & TikZProps & ContentProps & ShapeProps;
|
|
32
|
-
declare const InnerNode: import('react').ForwardRefExoticComponent<Omit<InnerNodeProps, "ref"> & import('react').RefAttributes<SVGGElement>>;
|
|
33
|
-
export default InnerNode;
|
|
@@ -1,88 +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 InnerNode = require("./InnerNode.cjs");
|
|
6
|
-
const css = require("../../utils/css.cjs");
|
|
7
|
-
const stroke = require("../../utils/style/stroke.cjs");
|
|
8
|
-
const font = require("../../utils/style/font.cjs");
|
|
9
|
-
const DescartesPoint = require("../../model/geometry/point/DescartesPoint.cjs");
|
|
10
|
-
const useScope = require("../../hooks/context/useScope.cjs");
|
|
11
|
-
const color = require("../../node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.cjs");
|
|
12
|
-
const Node = react.forwardRef((props, ref) => {
|
|
13
|
-
const { offset: scopeOffset, node } = useScope.default();
|
|
14
|
-
const nodeScopeProps = { offset: scopeOffset, ...node };
|
|
15
|
-
const realProps = {
|
|
16
|
-
...nodeScopeProps,
|
|
17
|
-
...props,
|
|
18
|
-
offset: DescartesPoint.default.plus(scopeOffset || [0, 0], props.offset || [0, 0])
|
|
19
|
-
};
|
|
20
|
-
const { shape = "rectangle", width, height, position, offset, innerSep, outerSep, ...res1Props } = realProps;
|
|
21
|
-
const { r, rx, ry, fill, fillOpacity, stroke: stroke$1 = "transparent", strokeWidth = 1, strokeType, ...res2Props } = res1Props;
|
|
22
|
-
const { color: color$1 = "currentColor", size, fontSize, style, ...otherProps } = res2Props;
|
|
23
|
-
const realPosition = react.useMemo(() => {
|
|
24
|
-
const formatPosition = position ? DescartesPoint.default.formatPosition(position) : [0, 0];
|
|
25
|
-
const formatOffset = offset ? DescartesPoint.default.formatPosition(offset) : [0, 0];
|
|
26
|
-
return [formatPosition[0] + formatOffset[0], formatPosition[1] + formatOffset[1]];
|
|
27
|
-
}, [position]);
|
|
28
|
-
const realColor = react.useMemo(() => {
|
|
29
|
-
if (color$1 === "auto" && fill && fill !== "currentColor") {
|
|
30
|
-
const fillColor = color.default(fill);
|
|
31
|
-
if (!fillColor) return color$1 || "currentColor";
|
|
32
|
-
fillColor.opacity = fillOpacity || 1;
|
|
33
|
-
const lightness = color.hsl(fillColor).l;
|
|
34
|
-
return lightness < 0.5 ? "white" : "black";
|
|
35
|
-
}
|
|
36
|
-
return color$1 || "currentColor";
|
|
37
|
-
}, [color$1, fill, fillOpacity]);
|
|
38
|
-
const realRx = rx || r;
|
|
39
|
-
const realRy = ry || r;
|
|
40
|
-
const getStrokeAttributes = () => strokeType ? stroke.convertStrokeType(strokeType, strokeWidth) : stroke.convertStrokeShortcut(otherProps, strokeWidth);
|
|
41
|
-
const getSep = (sep, defaultVal) => {
|
|
42
|
-
if (typeof sep !== "object") {
|
|
43
|
-
return {
|
|
44
|
-
left: sep ?? defaultVal,
|
|
45
|
-
right: sep ?? defaultVal,
|
|
46
|
-
top: sep ?? defaultVal,
|
|
47
|
-
bottom: sep ?? defaultVal
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
left: sep.left ?? sep.x ?? defaultVal,
|
|
52
|
-
right: sep.right ?? sep.x ?? defaultVal,
|
|
53
|
-
top: sep.top ?? sep.y ?? defaultVal,
|
|
54
|
-
bottom: sep.bottom ?? sep.y ?? defaultVal
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
const getFontStyle = () => font.convertFontStyle(style);
|
|
58
|
-
const adjustFontSize = react.useMemo(() => font.convertFontSize(size || fontSize), [size, fontSize]);
|
|
59
|
-
const adjustedInnerSep = react.useMemo(
|
|
60
|
-
() => getSep(innerSep, css.convertCssToPx(adjustFontSize) / 3 || "0.3333em"),
|
|
61
|
-
[innerSep]
|
|
62
|
-
);
|
|
63
|
-
const adjustedOuterSep = react.useMemo(() => getSep(outerSep, 0), [outerSep]);
|
|
64
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
-
InnerNode.default,
|
|
66
|
-
{
|
|
67
|
-
ref,
|
|
68
|
-
width: css.convertCssToPx(width),
|
|
69
|
-
height: css.convertCssToPx(height),
|
|
70
|
-
shape,
|
|
71
|
-
position: realPosition,
|
|
72
|
-
color: realColor,
|
|
73
|
-
fill: fill || "transparent",
|
|
74
|
-
fillOpacity,
|
|
75
|
-
rx: realRx,
|
|
76
|
-
ry: realRy,
|
|
77
|
-
stroke: stroke$1,
|
|
78
|
-
strokeWidth,
|
|
79
|
-
innerSep: adjustedInnerSep,
|
|
80
|
-
outerSep: adjustedOuterSep,
|
|
81
|
-
size: adjustFontSize,
|
|
82
|
-
...getFontStyle(),
|
|
83
|
-
...getStrokeAttributes(),
|
|
84
|
-
...otherProps
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
exports.default = Node;
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { NodeShape } from './InnerNode';
|
|
3
|
-
import { CssDistanceType } from '../../types/distance';
|
|
4
|
-
import { SepProps } from '../../types/distance/sep';
|
|
5
|
-
import { StrokeProps } from '../../types/svg/stroke';
|
|
6
|
-
import { TikZKey } from '../../types/tikz';
|
|
7
|
-
import { StrokeShortcutProps, StrokeType } from '../../utils/style/stroke';
|
|
8
|
-
import { PointPosition } from '../../types/coordinate';
|
|
9
|
-
import { TikZFontSize } from '../../utils/style/font';
|
|
10
|
-
import { FontProps } from '../../types/svg/font';
|
|
11
|
-
export type NodeProps = {
|
|
12
|
-
name?: TikZKey;
|
|
13
|
-
/** 位置 */
|
|
14
|
-
position?: PointPosition;
|
|
15
|
-
/** 位置偏移 */
|
|
16
|
-
offset?: PointPosition;
|
|
17
|
-
/** 内容宽度 */
|
|
18
|
-
width?: CssDistanceType;
|
|
19
|
-
/** 内容高度 */
|
|
20
|
-
height?: CssDistanceType;
|
|
21
|
-
/** 内容(文本)颜色 */
|
|
22
|
-
color?: 'currentColor' | 'auto' | string;
|
|
23
|
-
/** 内容(文本)透明度 */
|
|
24
|
-
opacity?: number;
|
|
25
|
-
/** 内容(文本)字体大小 */
|
|
26
|
-
size?: string | TikZFontSize | number;
|
|
27
|
-
/** 内容 */
|
|
28
|
-
children?: ReactNode;
|
|
29
|
-
/** 边框形状 */
|
|
30
|
-
shape?: NodeShape;
|
|
31
|
-
/** 边框圆角 */
|
|
32
|
-
r?: CssDistanceType;
|
|
33
|
-
/** 边框圆角-x */
|
|
34
|
-
rx?: CssDistanceType;
|
|
35
|
-
/** 边框圆角-y */
|
|
36
|
-
ry?: CssDistanceType;
|
|
37
|
-
/** 背景填充色,默认为 auto */
|
|
38
|
-
fill?: string | 'auto';
|
|
39
|
-
/** 背景填充色透明度 */
|
|
40
|
-
fillOpacity?: number;
|
|
41
|
-
/** 边框样式 */
|
|
42
|
-
strokeType?: StrokeType;
|
|
43
|
-
/** 内边距 */
|
|
44
|
-
innerSep?: CssDistanceType | SepProps;
|
|
45
|
-
/** 外边距 */
|
|
46
|
-
outerSep?: CssDistanceType | SepProps;
|
|
47
|
-
/** 旋转 */
|
|
48
|
-
rotate?: number;
|
|
49
|
-
/** 样式 */
|
|
50
|
-
style?: 'bold' | 'italic' | 'serif' | 'sans-serif';
|
|
51
|
-
} & Partial<FontProps> & Partial<StrokeProps> & StrokeShortcutProps;
|
|
52
|
-
declare const Node: import('react').ForwardRefExoticComponent<{
|
|
53
|
-
name?: TikZKey;
|
|
54
|
-
/** 位置 */
|
|
55
|
-
position?: PointPosition;
|
|
56
|
-
/** 位置偏移 */
|
|
57
|
-
offset?: PointPosition;
|
|
58
|
-
/** 内容宽度 */
|
|
59
|
-
width?: CssDistanceType;
|
|
60
|
-
/** 内容高度 */
|
|
61
|
-
height?: CssDistanceType;
|
|
62
|
-
/** 内容(文本)颜色 */
|
|
63
|
-
color?: "currentColor" | "auto" | string;
|
|
64
|
-
/** 内容(文本)透明度 */
|
|
65
|
-
opacity?: number;
|
|
66
|
-
/** 内容(文本)字体大小 */
|
|
67
|
-
size?: string | TikZFontSize | number;
|
|
68
|
-
/** 内容 */
|
|
69
|
-
children?: ReactNode;
|
|
70
|
-
/** 边框形状 */
|
|
71
|
-
shape?: NodeShape;
|
|
72
|
-
/** 边框圆角 */
|
|
73
|
-
r?: CssDistanceType;
|
|
74
|
-
/** 边框圆角-x */
|
|
75
|
-
rx?: CssDistanceType;
|
|
76
|
-
/** 边框圆角-y */
|
|
77
|
-
ry?: CssDistanceType;
|
|
78
|
-
/** 背景填充色,默认为 auto */
|
|
79
|
-
fill?: string | "auto";
|
|
80
|
-
/** 背景填充色透明度 */
|
|
81
|
-
fillOpacity?: number;
|
|
82
|
-
/** 边框样式 */
|
|
83
|
-
strokeType?: StrokeType;
|
|
84
|
-
/** 内边距 */
|
|
85
|
-
innerSep?: CssDistanceType | SepProps;
|
|
86
|
-
/** 外边距 */
|
|
87
|
-
outerSep?: CssDistanceType | SepProps;
|
|
88
|
-
/** 旋转 */
|
|
89
|
-
rotate?: number;
|
|
90
|
-
/** 样式 */
|
|
91
|
-
style?: "bold" | "italic" | "serif" | "sans-serif";
|
|
92
|
-
} & Partial<FontProps> & Partial<StrokeProps> & StrokeShortcutProps & import('react').RefAttributes<SVGGElement>>;
|
|
93
|
-
export default Node;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const useNodeConfig = () => {
|
|
5
|
-
const configRef = react.useRef({
|
|
6
|
-
position: [0, 0],
|
|
7
|
-
contentSize: [0, 0],
|
|
8
|
-
innerSep: { left: 0, right: 0, top: 0, bottom: 0 },
|
|
9
|
-
outerSep: { left: 0, right: 0, top: 0, bottom: 0 }
|
|
10
|
-
});
|
|
11
|
-
return configRef;
|
|
12
|
-
};
|
|
13
|
-
exports.default = useNodeConfig;
|