@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,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;
|
|
@@ -1,30 +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 Text = require("../../../elements/Text.cjs");
|
|
6
|
-
const useNodeContent = (props, ref) => {
|
|
7
|
-
const { color, size, opacity, fontWeight, fontStyle, fontFamily, fontStretch, children } = props;
|
|
8
|
-
const isTextNode = children !== null && !react.isValidElement(children);
|
|
9
|
-
return react.useMemo(
|
|
10
|
-
() => isTextNode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
11
|
-
Text.default,
|
|
12
|
-
{
|
|
13
|
-
fill: color,
|
|
14
|
-
fontSize: size,
|
|
15
|
-
fillOpacity: opacity,
|
|
16
|
-
fontWeight,
|
|
17
|
-
fontStyle,
|
|
18
|
-
fontFamily,
|
|
19
|
-
fontStretch,
|
|
20
|
-
ref,
|
|
21
|
-
children
|
|
22
|
-
}
|
|
23
|
-
) : react.isValidElement(children) ? (
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
react.cloneElement(children, { ref })
|
|
26
|
-
) : children,
|
|
27
|
-
isTextNode ? [color, size, children] : [children]
|
|
28
|
-
);
|
|
29
|
-
};
|
|
30
|
-
exports.default = useNodeContent;
|
|
@@ -1,34 +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 Rect = require("../../../elements/Rect.cjs");
|
|
6
|
-
const getShapeProps = (nodeProps) => {
|
|
7
|
-
const { rx, ry, fill, fillOpacity, stroke, strokeWidth, strokeOpacity } = nodeProps;
|
|
8
|
-
const { strokeDasharray, strokeDashoffset, strokeLinecap, strokeLinejoin, strokeMiterlimit } = nodeProps;
|
|
9
|
-
return {
|
|
10
|
-
rx,
|
|
11
|
-
ry,
|
|
12
|
-
fill,
|
|
13
|
-
fillOpacity,
|
|
14
|
-
stroke,
|
|
15
|
-
strokeWidth,
|
|
16
|
-
strokeOpacity,
|
|
17
|
-
strokeDasharray,
|
|
18
|
-
strokeDashoffset,
|
|
19
|
-
strokeLinecap,
|
|
20
|
-
strokeLinejoin,
|
|
21
|
-
strokeMiterlimit
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
const useNodeShape = (props, ref) => {
|
|
25
|
-
const shapeProps = getShapeProps(props);
|
|
26
|
-
const Shape = react.useMemo(() => {
|
|
27
|
-
switch (props.shape) {
|
|
28
|
-
case "rectangle":
|
|
29
|
-
return Rect.default;
|
|
30
|
-
}
|
|
31
|
-
}, [props.shape, ...Object.values(shapeProps)]);
|
|
32
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Shape, { ref, ...shapeProps });
|
|
33
|
-
};
|
|
34
|
-
exports.default = useNodeShape;
|
|
@@ -1,76 +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 useNodes = require("../../hooks/context/useNodes.cjs");
|
|
7
|
-
const useScope = require("../../hooks/context/useScope.cjs");
|
|
8
|
-
const DescartesPoint = require("../../model/geometry/point/DescartesPoint.cjs");
|
|
9
|
-
const css = require("../../utils/css.cjs");
|
|
10
|
-
const math = require("../../utils/math.cjs");
|
|
11
|
-
const Node = require("../node/Node.cjs");
|
|
12
|
-
const useAnchor = require("./useAnchor.cjs");
|
|
13
|
-
const PathNode = react.forwardRef((props, ref) => {
|
|
14
|
-
const { segmentIndex = -1, offset = [0, 0], anchor, left, right, above, below, name, ...resProps } = props;
|
|
15
|
-
const { pos, veryNearStart, veryNearEnd, start, nearStart, midway, nearEnd, end, sloped, ...nodeProps } = resProps;
|
|
16
|
-
const id = react.useId();
|
|
17
|
-
const realName = name ?? id;
|
|
18
|
-
const { precision } = useCalculate.default();
|
|
19
|
-
const posRadio = react.useMemo(() => {
|
|
20
|
-
if (pos !== void 0) return pos;
|
|
21
|
-
if (start) return 0;
|
|
22
|
-
if (veryNearStart) return 0.125;
|
|
23
|
-
if (nearStart) return 0.25;
|
|
24
|
-
if (midway) return 0.5;
|
|
25
|
-
if (nearEnd) return 0.75;
|
|
26
|
-
if (veryNearEnd) return 0.875;
|
|
27
|
-
return 1;
|
|
28
|
-
}, [pos, veryNearStart, veryNearEnd, start, nearStart, midway, nearEnd, end]);
|
|
29
|
-
const directionPos = react.useMemo(() => {
|
|
30
|
-
if (left) return { direction: "left", distance: typeof left === "boolean" ? 0 : css.convertCssToPx(left) };
|
|
31
|
-
if (right) return { direction: "right", distance: typeof right === "boolean" ? 0 : css.convertCssToPx(right) };
|
|
32
|
-
if (above) return { direction: "top", distance: typeof above === "boolean" ? 0 : css.convertCssToPx(above) };
|
|
33
|
-
if (below) return { direction: "bottom", distance: typeof below === "boolean" ? 0 : css.convertCssToPx(below) };
|
|
34
|
-
return { direction: anchor ?? "center", distance: 0 };
|
|
35
|
-
}, [anchor, left, right, above, below]);
|
|
36
|
-
const { position: anchorPosition, angle: anchorAngle } = useAnchor.default(posRadio, segmentIndex);
|
|
37
|
-
const [adjustOffset, setAdjustOffset] = react.useState(DescartesPoint.default.plus(anchorPosition, offset));
|
|
38
|
-
const { getModel } = useNodes.default();
|
|
39
|
-
const rotate = react.useMemo(() => {
|
|
40
|
-
if (!sloped) return 0;
|
|
41
|
-
return anchorAngle * (180 / Math.PI);
|
|
42
|
-
}, [sloped, anchorAngle]);
|
|
43
|
-
react.useLayoutEffect(() => {
|
|
44
|
-
const model = getModel(realName);
|
|
45
|
-
if (!model || !model.init) return;
|
|
46
|
-
const { direction, distance } = directionPos;
|
|
47
|
-
let directionPosition = [0, 0];
|
|
48
|
-
switch (direction) {
|
|
49
|
-
case "left":
|
|
50
|
-
directionPosition = [-(model == null ? void 0 : model.getOuterDistance("left")) - distance, 0];
|
|
51
|
-
break;
|
|
52
|
-
case "right":
|
|
53
|
-
directionPosition = [(model == null ? void 0 : model.getOuterDistance("right")) + distance, 0];
|
|
54
|
-
break;
|
|
55
|
-
case "top":
|
|
56
|
-
directionPosition = [0, -(model == null ? void 0 : model.getOuterDistance("top")) - distance];
|
|
57
|
-
break;
|
|
58
|
-
case "bottom":
|
|
59
|
-
directionPosition = [0, (model == null ? void 0 : model.getOuterDistance("bottom")) + distance];
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
setAdjustOffset(DescartesPoint.default.plus(anchorPosition, directionPosition, offset));
|
|
63
|
-
}, [anchorPosition, directionPos]);
|
|
64
|
-
const scope = useScope.default();
|
|
65
|
-
return /* @__PURE__ */ jsxRuntime.jsx(useScope.ScopeContext.Provider, { value: { ...scope, offset: [0, 0] }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
66
|
-
Node.default,
|
|
67
|
-
{
|
|
68
|
-
name: realName,
|
|
69
|
-
position: math.convertPrecision(adjustOffset, precision),
|
|
70
|
-
ref,
|
|
71
|
-
rotate,
|
|
72
|
-
...nodeProps
|
|
73
|
-
}
|
|
74
|
-
) });
|
|
75
|
-
});
|
|
76
|
-
exports.default = PathNode;
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Direction } from '../../types/coordinate';
|
|
2
|
-
import { Position } from '../../types/coordinate/descartes';
|
|
3
|
-
import { NodeProps } from '../node/Node';
|
|
4
|
-
type PathNodePositionProps = {
|
|
5
|
-
left?: boolean | number | string;
|
|
6
|
-
right?: boolean | number | string;
|
|
7
|
-
above?: boolean | number | string;
|
|
8
|
-
below?: boolean | number | string;
|
|
9
|
-
};
|
|
10
|
-
type PosShortcutProps = {
|
|
11
|
-
/** pos: 0 */
|
|
12
|
-
start?: boolean;
|
|
13
|
-
/** pos: 0.125 */
|
|
14
|
-
veryNearStart?: boolean;
|
|
15
|
-
/** pos: 0.25 */
|
|
16
|
-
nearStart?: boolean;
|
|
17
|
-
/** pos: 0.5 */
|
|
18
|
-
midway?: boolean;
|
|
19
|
-
/** pos: 0.75 */
|
|
20
|
-
nearEnd?: boolean;
|
|
21
|
-
/** pos: 0.875 */
|
|
22
|
-
veryNearEnd?: boolean;
|
|
23
|
-
/** pos: 1 */
|
|
24
|
-
end?: boolean;
|
|
25
|
-
};
|
|
26
|
-
export type PathNodeProps = {
|
|
27
|
-
segmentIndex?: number;
|
|
28
|
-
/** path 片段的下标 */
|
|
29
|
-
pos?: number;
|
|
30
|
-
/** 相对于路径的位置 */
|
|
31
|
-
anchor?: Direction | 'center';
|
|
32
|
-
/** 偏移位置 */
|
|
33
|
-
offset?: Position;
|
|
34
|
-
/** 跟随箭头位置 */
|
|
35
|
-
sloped?: boolean;
|
|
36
|
-
} & PathNodePositionProps & PosShortcutProps & Omit<NodeProps, 'position'>;
|
|
37
|
-
declare const PathNode: import('react').ForwardRefExoticComponent<{
|
|
38
|
-
segmentIndex?: number;
|
|
39
|
-
/** path 片段的下标 */
|
|
40
|
-
pos?: number;
|
|
41
|
-
/** 相对于路径的位置 */
|
|
42
|
-
anchor?: Direction | "center";
|
|
43
|
-
/** 偏移位置 */
|
|
44
|
-
offset?: Position;
|
|
45
|
-
/** 跟随箭头位置 */
|
|
46
|
-
sloped?: boolean;
|
|
47
|
-
} & PathNodePositionProps & PosShortcutProps & Omit<NodeProps, "position"> & import('react').RefAttributes<SVGGElement>>;
|
|
48
|
-
export default PathNode;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const useCalculate = require("../../hooks/context/useCalculate.cjs");
|
|
5
|
-
const usePath = require("../../hooks/context/usePath.cjs");
|
|
6
|
-
const useForceUpdate = require("../../hooks/useForceUpdate.cjs");
|
|
7
|
-
const line = require("../../model/equation/line.cjs");
|
|
8
|
-
const math = require("../../utils/math.cjs");
|
|
9
|
-
const useAnchor = (pos, segmentIndex) => {
|
|
10
|
-
const pathUpdateCount = react.useRef(0);
|
|
11
|
-
const forceUpdate = useForceUpdate.default();
|
|
12
|
-
const { model, subscribeModel } = usePath.default();
|
|
13
|
-
const { precision } = useCalculate.default();
|
|
14
|
-
const subscribeCb = subscribeModel((model2) => {
|
|
15
|
-
if (!(model2 == null ? void 0 : model2.init)) return;
|
|
16
|
-
pathUpdateCount.current += 1;
|
|
17
|
-
queueMicrotask(forceUpdate);
|
|
18
|
-
});
|
|
19
|
-
react.useLayoutEffect(() => () => {
|
|
20
|
-
subscribeCb == null ? void 0 : subscribeCb();
|
|
21
|
-
});
|
|
22
|
-
const adjustIndex = segmentIndex >= 0 ? segmentIndex : model.ways.length + segmentIndex;
|
|
23
|
-
if (!math.between(adjustIndex, [0, model.ways.length - 1], true)) throw new Error("segmentIndex is out of range");
|
|
24
|
-
return react.useMemo(() => {
|
|
25
|
-
if (!model.init)
|
|
26
|
-
return {
|
|
27
|
-
position: [Number.MAX_SAFE_INTEGER / 2, Number.MAX_SAFE_INTEGER / 2],
|
|
28
|
-
angle: 0
|
|
29
|
-
};
|
|
30
|
-
const way = model.ways[adjustIndex];
|
|
31
|
-
const waySegments = way.length - 1;
|
|
32
|
-
const segmentPercent = 1 / waySegments;
|
|
33
|
-
let segmentSum = 0;
|
|
34
|
-
let index = 0;
|
|
35
|
-
while (pos >= segmentSum) {
|
|
36
|
-
segmentSum += segmentPercent;
|
|
37
|
-
index++;
|
|
38
|
-
}
|
|
39
|
-
const startPoint = way[index - 1];
|
|
40
|
-
const endPoint = way[index];
|
|
41
|
-
const percent = pos % segmentPercent / segmentPercent;
|
|
42
|
-
const position = index === way.length ? startPoint : line.default.getPositionByPercent(startPoint, endPoint, percent);
|
|
43
|
-
return {
|
|
44
|
-
position: math.convertPrecision(position, precision),
|
|
45
|
-
angle: index === way.length ? line.default.getDegree(way[way.length - 2], way[way.length - 1]) : line.default.getDegree(startPoint, endPoint)
|
|
46
|
-
};
|
|
47
|
-
}, [pos, segmentIndex, pathUpdateCount.current]);
|
|
48
|
-
};
|
|
49
|
-
exports.default = useAnchor;
|
|
@@ -1,8 +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 = react.forwardRef((props, ref) => {
|
|
6
|
-
return /* @__PURE__ */ jsxRuntime.jsx("g", { ref, ...props });
|
|
7
|
-
});
|
|
8
|
-
exports.default = Group;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, Ref, SVGProps } from 'react';
|
|
2
|
-
export type GroupProps = {
|
|
3
|
-
ref?: Ref<SVGGElement>;
|
|
4
|
-
} & SVGProps<SVGGElement>;
|
|
5
|
-
declare const Group: import('react').ForwardRefExoticComponent<Omit<PropsWithChildren<SVGProps<SVGGElement>>, "ref"> & import('react').RefAttributes<SVGGElement>>;
|
|
6
|
-
export default Group;
|
|
@@ -1,23 +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 Surface = react.forwardRef((props, ref) => {
|
|
6
|
-
const { title, desc, viewBox, children, width, height, ...otherProps } = props;
|
|
7
|
-
const svgViewBox = react.useMemo(() => {
|
|
8
|
-
if (!(viewBox == null ? void 0 : viewBox.x) && !(viewBox == null ? void 0 : viewBox.y)) {
|
|
9
|
-
return void 0;
|
|
10
|
-
}
|
|
11
|
-
const viewX = (viewBox == null ? void 0 : viewBox.x) || 0;
|
|
12
|
-
const viewY = (viewBox == null ? void 0 : viewBox.y) || 0;
|
|
13
|
-
const viewWidth = (viewBox == null ? void 0 : viewBox.width) || width;
|
|
14
|
-
const viewHeight = (viewBox == null ? void 0 : viewBox.height) || height;
|
|
15
|
-
return viewWidth === void 0 || viewHeight === void 0 ? [viewX, viewY].join(" ") : [viewX, viewY, viewWidth, viewHeight].join(" ");
|
|
16
|
-
}, [width, height, viewBox]);
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { ref, viewBox: svgViewBox, width, height, ...otherProps, children: [
|
|
18
|
-
title ? /* @__PURE__ */ jsxRuntime.jsx("title", { children: title }) : null,
|
|
19
|
-
desc ? /* @__PURE__ */ jsxRuntime.jsx("desc", { children: desc }) : null,
|
|
20
|
-
children
|
|
21
|
-
] });
|
|
22
|
-
});
|
|
23
|
-
exports.default = Surface;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CSSProperties } from 'react';
|
|
2
|
-
export type SurfaceProps = {
|
|
3
|
-
title?: string;
|
|
4
|
-
desc?: string;
|
|
5
|
-
width?: string | number;
|
|
6
|
-
height?: string | number;
|
|
7
|
-
viewBox?: {
|
|
8
|
-
x?: number;
|
|
9
|
-
y?: number;
|
|
10
|
-
width?: number;
|
|
11
|
-
height?: number;
|
|
12
|
-
};
|
|
13
|
-
className?: string;
|
|
14
|
-
style?: CSSProperties;
|
|
15
|
-
};
|
|
16
|
-
declare const Surface: import('react').ForwardRefExoticComponent<SurfaceProps & {
|
|
17
|
-
children?: import('react').ReactNode | undefined;
|
|
18
|
-
} & import('react').RefAttributes<SVGSVGElement>>;
|
|
19
|
-
export default Surface;
|
|
@@ -1,14 +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 = react.forwardRef((props, ref) => {
|
|
6
|
-
const { fill: propFill, strokeWidth: propStrokeWidth, stroke: propStroke, ...otherProps } = props;
|
|
7
|
-
const defaultProps = {
|
|
8
|
-
fill: propFill || "transparent",
|
|
9
|
-
strokeWidth: propStrokeWidth ?? 1,
|
|
10
|
-
stroke: propStroke || "currentColor"
|
|
11
|
-
};
|
|
12
|
-
return /* @__PURE__ */ jsxRuntime.jsx("path", { ref, ...defaultProps, ...otherProps });
|
|
13
|
-
});
|
|
14
|
-
exports.default = Path;
|
|
@@ -1,9 +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 Rect = react.forwardRef((props, ref) => {
|
|
6
|
-
const { ...otherProps } = props;
|
|
7
|
-
return /* @__PURE__ */ jsxRuntime.jsx("rect", { ref, ...otherProps });
|
|
8
|
-
});
|
|
9
|
-
exports.default = Rect;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, SVGProps } from 'react';
|
|
2
|
-
export type RectProps = SVGProps<SVGRectElement>;
|
|
3
|
-
declare const Rect: import('react').ForwardRefExoticComponent<Omit<PropsWithChildren<RectProps>, "ref"> & import('react').RefAttributes<SVGRectElement>>;
|
|
4
|
-
export default Rect;
|
|
@@ -1,35 +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 string = require("../utils/string.cjs");
|
|
6
|
-
const Text = react.forwardRef((props, ref) => {
|
|
7
|
-
const { children, align, verticalAlign, fontSize, fill, ...otherProps } = props;
|
|
8
|
-
const dominantBaseline = react.useMemo(() => {
|
|
9
|
-
switch (verticalAlign) {
|
|
10
|
-
case "top":
|
|
11
|
-
return "text-top";
|
|
12
|
-
case "bottom":
|
|
13
|
-
return "text-bottom";
|
|
14
|
-
case "center":
|
|
15
|
-
return "central";
|
|
16
|
-
default:
|
|
17
|
-
return verticalAlign;
|
|
18
|
-
}
|
|
19
|
-
}, [verticalAlign]);
|
|
20
|
-
const textProps = {
|
|
21
|
-
textAnchor: align || "middle",
|
|
22
|
-
dominantBaseline: dominantBaseline || "central",
|
|
23
|
-
fontSize: fontSize || "1em",
|
|
24
|
-
fill: fill || "currentColor",
|
|
25
|
-
...otherProps
|
|
26
|
-
};
|
|
27
|
-
const parseChildren = (children2) => {
|
|
28
|
-
if (typeof children2 === "string") {
|
|
29
|
-
return string.textWrapParse(children2).map((child, index) => /* @__PURE__ */ jsxRuntime.jsx("tspan", { children: child }, index));
|
|
30
|
-
}
|
|
31
|
-
return children2;
|
|
32
|
-
};
|
|
33
|
-
return /* @__PURE__ */ jsxRuntime.jsx("text", { ref, ...textProps, children: parseChildren(children) });
|
|
34
|
-
});
|
|
35
|
-
exports.default = Text;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren, SVGProps } from 'react';
|
|
2
|
-
import { FontProps } from '../types/svg/font';
|
|
3
|
-
type TextVerticalAlign = 'top' | 'center' | 'bottom';
|
|
4
|
-
export type DominantBaseline = 'auto' | 'text-bottom' | 'alphabetic' | 'ideographic' | 'middle' | 'central' | 'mathematical' | 'hanging' | 'text-top';
|
|
5
|
-
export type TextProps = {
|
|
6
|
-
x?: SVGProps<SVGTextElement>['x'];
|
|
7
|
-
y?: SVGProps<SVGTextElement>['y'];
|
|
8
|
-
align?: 'start' | 'middle' | 'end' | 'inherit';
|
|
9
|
-
verticalAlign?: TextVerticalAlign | DominantBaseline;
|
|
10
|
-
fontSize?: SVGProps<SVGTextElement>['fontSize'];
|
|
11
|
-
fill?: SVGProps<SVGTextElement>['fill'];
|
|
12
|
-
} & FontProps & SVGProps<SVGTextElement>;
|
|
13
|
-
/**
|
|
14
|
-
* 文本节点
|
|
15
|
-
* @tikz node
|
|
16
|
-
*/
|
|
17
|
-
declare const Text: import('react').ForwardRefExoticComponent<Omit<PropsWithChildren<TextProps>, "ref"> & import('react').RefAttributes<SVGTextElement>>;
|
|
18
|
-
export default Text;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const CalculateContext = react.createContext({ precision: 2 });
|
|
5
|
-
const useCalculate = () => {
|
|
6
|
-
return react.useContext(CalculateContext);
|
|
7
|
-
};
|
|
8
|
-
exports.CalculateContext = CalculateContext;
|
|
9
|
-
exports.default = useCalculate;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type CalculateProps = {
|
|
2
|
-
precision: number | false;
|
|
3
|
-
};
|
|
4
|
-
export declare const CalculateContext: import('react').Context<CalculateProps>;
|
|
5
|
-
declare const useCalculate: () => CalculateProps;
|
|
6
|
-
export declare const useCalculateValue: (value: number, deep?: boolean) => number;
|
|
7
|
-
export default useCalculate;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const node = require("../../model/component/node.cjs");
|
|
5
|
-
const NodesContext = react.createContext(/* @__PURE__ */ new Map());
|
|
6
|
-
const useNodes = () => {
|
|
7
|
-
const nodes = react.useContext(NodesContext);
|
|
8
|
-
return {
|
|
9
|
-
subscribeModel: (name, listener) => {
|
|
10
|
-
const model = nodes.get(name);
|
|
11
|
-
if (!model) return false;
|
|
12
|
-
return model.subscribe(listener);
|
|
13
|
-
},
|
|
14
|
-
getModel: (name) => nodes.get(name),
|
|
15
|
-
updateModel: (name, config, init = true) => {
|
|
16
|
-
const model = nodes.get(name);
|
|
17
|
-
if (model) {
|
|
18
|
-
model.update(config, init);
|
|
19
|
-
} else {
|
|
20
|
-
nodes.set(name, new node.default(config, init));
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
deleteModel: (name) => {
|
|
24
|
-
const model = nodes.get(name);
|
|
25
|
-
if (!model) return;
|
|
26
|
-
model.dispose();
|
|
27
|
-
model.notify();
|
|
28
|
-
nodes.delete(name);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
exports.NodesContext = NodesContext;
|
|
33
|
-
exports.default = useNodes;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { default as NodeModel, NodeConfig, StateListener } from '../../model/component/node';
|
|
2
|
-
export declare const NodesContext: import('react').Context<Map<string, NodeModel>>;
|
|
3
|
-
declare const useNodes: () => {
|
|
4
|
-
subscribeModel: (name: string, listener: StateListener) => false | (() => boolean);
|
|
5
|
-
getModel: (name: string) => NodeModel | undefined;
|
|
6
|
-
updateModel: (name: string, config: NodeConfig, init?: boolean) => void;
|
|
7
|
-
deleteModel: (name: string) => void;
|
|
8
|
-
};
|
|
9
|
-
export default useNodes;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const react = require("react");
|
|
4
|
-
const PathContext = react.createContext(null);
|
|
5
|
-
const usePath = () => {
|
|
6
|
-
const pathModel = react.useContext(PathContext);
|
|
7
|
-
if (!pathModel) throw new Error("usePath must be used within a PathProvider");
|
|
8
|
-
return {
|
|
9
|
-
model: pathModel,
|
|
10
|
-
subscribeModel: (listener) => {
|
|
11
|
-
if (!pathModel) return;
|
|
12
|
-
return pathModel.subscribe(listener);
|
|
13
|
-
},
|
|
14
|
-
updateModel: (config) => {
|
|
15
|
-
pathModel == null ? void 0 : pathModel.update(config);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
exports.PathContext = PathContext;
|
|
20
|
-
exports.default = usePath;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { default as PathModel, StateListener } from '../../model/component/path';
|
|
2
|
-
import { Position } from '../../types/coordinate/descartes';
|
|
3
|
-
export declare const PathContext: import('react').Context<PathModel | null>;
|
|
4
|
-
declare const usePath: () => {
|
|
5
|
-
model: PathModel;
|
|
6
|
-
subscribeModel: (listener: StateListener) => (() => boolean) | undefined;
|
|
7
|
-
updateModel: (config: {
|
|
8
|
-
ways?: Array<Position[]>;
|
|
9
|
-
lineWidth?: number;
|
|
10
|
-
init?: boolean;
|
|
11
|
-
}) => void;
|
|
12
|
-
};
|
|
13
|
-
export default usePath;
|