@retikz/core 0.0.1-rc.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 -0
- package/README.md +2 -0
- package/dist/es/_virtual/jsx-runtime.js +5 -0
- package/dist/es/_virtual/jsx-runtime2.js +4 -0
- package/dist/es/_virtual/react-jsx-runtime.development.js +4 -0
- package/dist/es/_virtual/react-jsx-runtime.production.js +4 -0
- package/dist/es/components/Scope.d.ts +6 -0
- package/dist/es/components/Scope.js +10 -0
- package/dist/es/components/TikZ.d.ts +9 -0
- package/dist/es/components/TikZ.js +12 -0
- package/dist/es/components/draw/Draw.d.ts +18 -0
- package/dist/es/components/draw/Draw.js +34 -0
- package/dist/es/components/draw/InnerDraw.d.ts +13 -0
- package/dist/es/components/draw/InnerDraw.js +47 -0
- package/dist/es/components/draw/arrow/index.d.ts +9 -0
- package/dist/es/components/draw/arrow/index.js +10 -0
- package/dist/es/components/draw/arrow/stealth.d.ts +7 -0
- package/dist/es/components/draw/arrow/stealth.js +29 -0
- package/dist/es/components/draw/arrow/types.d.ts +21 -0
- package/dist/es/components/draw/common.d.ts +4 -0
- package/dist/es/components/draw/common.js +12 -0
- package/dist/es/components/draw/index.d.ts +3 -0
- package/dist/es/components/draw/segment/Segment.d.ts +12 -0
- package/dist/es/components/draw/segment/Segment.js +41 -0
- package/dist/es/components/draw/segment/index.d.ts +19 -0
- package/dist/es/components/draw/segment/index.js +41 -0
- package/dist/es/components/draw/segment/useArrow.d.ts +12 -0
- package/dist/es/components/draw/segment/useArrow.js +52 -0
- package/dist/es/components/draw/segment/useConvertWay.d.ts +14 -0
- package/dist/es/components/draw/segment/useConvertWay.js +95 -0
- package/dist/es/components/draw/types.d.ts +29 -0
- package/dist/es/components/node/InnerNode.d.ts +33 -0
- package/dist/es/components/node/InnerNode.js +88 -0
- package/dist/es/components/node/Node.d.ts +54 -0
- package/dist/es/components/node/Node.js +87 -0
- package/dist/es/components/node/_hooks/useNodeConfig.d.ts +3 -0
- package/dist/es/components/node/_hooks/useNodeConfig.js +13 -0
- package/dist/es/components/node/_hooks/useNodeContent.d.ts +4 -0
- package/dist/es/components/node/_hooks/useNodeContent.js +27 -0
- package/dist/es/components/node/_hooks/useNodeShape.d.ts +4 -0
- package/dist/es/components/node/_hooks/useNodeShape.js +34 -0
- package/dist/es/components/node/index.d.ts +3 -0
- package/dist/es/components/node/index.js +4 -0
- package/dist/es/components/pathNode/PathNode.d.ts +39 -0
- package/dist/es/components/pathNode/PathNode.js +76 -0
- package/dist/es/components/pathNode/index.d.ts +3 -0
- package/dist/es/components/pathNode/index.js +4 -0
- package/dist/es/components/pathNode/useAnchor.d.ts +6 -0
- package/dist/es/components/pathNode/useAnchor.js +49 -0
- package/dist/es/container/Group.d.ts +6 -0
- package/dist/es/container/Group.js +7 -0
- package/dist/es/container/Surface.d.ts +17 -0
- package/dist/es/container/Surface.js +23 -0
- package/dist/es/elements/Path.d.ts +4 -0
- package/dist/es/elements/Path.js +13 -0
- package/dist/es/elements/Rect.d.ts +6 -0
- package/dist/es/elements/Rect.js +8 -0
- package/dist/es/elements/Text.d.ts +19 -0
- package/dist/es/elements/Text.js +35 -0
- package/dist/es/hooks/context/useCalculate.d.ts +7 -0
- package/dist/es/hooks/context/useCalculate.js +9 -0
- package/dist/es/hooks/context/useNodes.d.ts +9 -0
- package/dist/es/hooks/context/useNodes.js +33 -0
- package/dist/es/hooks/context/usePath.d.ts +13 -0
- package/dist/es/hooks/context/usePath.js +20 -0
- package/dist/es/hooks/context/useScope.d.ts +11 -0
- package/dist/es/hooks/context/useScope.js +7 -0
- package/dist/es/hooks/useForceUpdate.d.ts +2 -0
- package/dist/es/hooks/useForceUpdate.js +8 -0
- package/dist/es/index.d.ts +10 -0
- package/dist/es/index.js +12 -0
- package/dist/es/model/component/node.d.ts +45 -0
- package/dist/es/model/component/node.js +164 -0
- package/dist/es/model/component/path.d.ts +19 -0
- package/dist/es/model/component/path.js +47 -0
- package/dist/es/model/equation/line.d.ts +21 -0
- package/dist/es/model/equation/line.js +75 -0
- package/dist/es/model/geometry/point/DescartesPoint.d.ts +21 -0
- package/dist/es/model/geometry/point/DescartesPoint.js +50 -0
- package/dist/es/model/geometry/point/PolarPoint.d.ts +14 -0
- package/dist/es/model/geometry/point/PolarPoint.js +27 -0
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +338 -0
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +13 -0
- package/dist/es/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js +88 -0
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js +6 -0
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js +8 -0
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js +39 -0
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js +41 -0
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js +19 -0
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js +10 -0
- package/dist/es/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.development.js +20 -0
- package/dist/es/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.production.js +41 -0
- package/dist/es/node_modules/.pnpm/react@19.0.0/node_modules/react/jsx-runtime.js +17 -0
- package/dist/es/types/coordinate/descartes.d.ts +23 -0
- package/dist/es/types/coordinate/index.d.ts +5 -0
- package/dist/es/types/coordinate/polar.d.ts +5 -0
- package/dist/es/types/distance/index.d.ts +8 -0
- package/dist/es/types/distance/sep.d.ts +9 -0
- package/dist/es/types/shape/index.d.ts +8 -0
- package/dist/es/types/shape/index.js +9 -0
- package/dist/es/types/shape/rect.d.ts +25 -0
- package/dist/es/types/shape/rect.js +30 -0
- package/dist/es/types/svg/font.d.ts +10 -0
- package/dist/es/types/svg/stroke.d.ts +10 -0
- package/dist/es/types/tikz/index.d.ts +6 -0
- package/dist/es/utils/compare.d.ts +4 -0
- package/dist/es/utils/compare.js +20 -0
- package/dist/es/utils/css.d.ts +6 -0
- package/dist/es/utils/css.js +26 -0
- package/dist/es/utils/math.d.ts +9 -0
- package/dist/es/utils/math.js +26 -0
- package/dist/es/utils/string.d.ts +7 -0
- package/dist/es/utils/string.js +7 -0
- package/dist/es/utils/style/font.d.ts +17 -0
- package/dist/es/utils/style/font.js +34 -0
- package/dist/es/utils/style/stroke.d.ts +19 -0
- package/dist/es/utils/style/stroke.js +40 -0
- package/dist/lib/_virtual/jsx-runtime.cjs +5 -0
- package/dist/lib/_virtual/jsx-runtime2.cjs +4 -0
- package/dist/lib/_virtual/react-jsx-runtime.development.cjs +4 -0
- package/dist/lib/_virtual/react-jsx-runtime.production.cjs +4 -0
- package/dist/lib/components/Scope.cjs +10 -0
- package/dist/lib/components/Scope.d.ts +6 -0
- package/dist/lib/components/TikZ.cjs +12 -0
- package/dist/lib/components/TikZ.d.ts +9 -0
- package/dist/lib/components/draw/Draw.cjs +34 -0
- package/dist/lib/components/draw/Draw.d.ts +18 -0
- package/dist/lib/components/draw/InnerDraw.cjs +47 -0
- package/dist/lib/components/draw/InnerDraw.d.ts +13 -0
- package/dist/lib/components/draw/arrow/index.cjs +10 -0
- package/dist/lib/components/draw/arrow/index.d.ts +9 -0
- package/dist/lib/components/draw/arrow/stealth.cjs +29 -0
- package/dist/lib/components/draw/arrow/stealth.d.ts +7 -0
- package/dist/lib/components/draw/arrow/types.d.ts +21 -0
- package/dist/lib/components/draw/common.cjs +12 -0
- package/dist/lib/components/draw/common.d.ts +4 -0
- package/dist/lib/components/draw/index.d.ts +3 -0
- package/dist/lib/components/draw/segment/Segment.cjs +41 -0
- package/dist/lib/components/draw/segment/Segment.d.ts +12 -0
- package/dist/lib/components/draw/segment/index.cjs +41 -0
- package/dist/lib/components/draw/segment/index.d.ts +19 -0
- package/dist/lib/components/draw/segment/useArrow.cjs +52 -0
- package/dist/lib/components/draw/segment/useArrow.d.ts +12 -0
- package/dist/lib/components/draw/segment/useConvertWay.cjs +95 -0
- package/dist/lib/components/draw/segment/useConvertWay.d.ts +14 -0
- package/dist/lib/components/draw/types.d.ts +29 -0
- package/dist/lib/components/node/InnerNode.cjs +88 -0
- package/dist/lib/components/node/InnerNode.d.ts +33 -0
- package/dist/lib/components/node/Node.cjs +87 -0
- package/dist/lib/components/node/Node.d.ts +54 -0
- package/dist/lib/components/node/_hooks/useNodeConfig.cjs +13 -0
- package/dist/lib/components/node/_hooks/useNodeConfig.d.ts +3 -0
- package/dist/lib/components/node/_hooks/useNodeContent.cjs +27 -0
- package/dist/lib/components/node/_hooks/useNodeContent.d.ts +4 -0
- package/dist/lib/components/node/_hooks/useNodeShape.cjs +34 -0
- package/dist/lib/components/node/_hooks/useNodeShape.d.ts +4 -0
- package/dist/lib/components/node/index.cjs +4 -0
- package/dist/lib/components/node/index.d.ts +3 -0
- package/dist/lib/components/pathNode/PathNode.cjs +76 -0
- package/dist/lib/components/pathNode/PathNode.d.ts +39 -0
- package/dist/lib/components/pathNode/index.cjs +4 -0
- package/dist/lib/components/pathNode/index.d.ts +3 -0
- package/dist/lib/components/pathNode/useAnchor.cjs +49 -0
- package/dist/lib/components/pathNode/useAnchor.d.ts +6 -0
- package/dist/lib/container/Group.cjs +7 -0
- package/dist/lib/container/Group.d.ts +6 -0
- package/dist/lib/container/Surface.cjs +23 -0
- package/dist/lib/container/Surface.d.ts +17 -0
- package/dist/lib/elements/Path.cjs +13 -0
- package/dist/lib/elements/Path.d.ts +4 -0
- package/dist/lib/elements/Rect.cjs +8 -0
- package/dist/lib/elements/Rect.d.ts +6 -0
- package/dist/lib/elements/Text.cjs +35 -0
- package/dist/lib/elements/Text.d.ts +19 -0
- package/dist/lib/hooks/context/useCalculate.cjs +9 -0
- package/dist/lib/hooks/context/useCalculate.d.ts +7 -0
- package/dist/lib/hooks/context/useNodes.cjs +33 -0
- package/dist/lib/hooks/context/useNodes.d.ts +9 -0
- package/dist/lib/hooks/context/usePath.cjs +20 -0
- package/dist/lib/hooks/context/usePath.d.ts +13 -0
- package/dist/lib/hooks/context/useScope.cjs +7 -0
- package/dist/lib/hooks/context/useScope.d.ts +11 -0
- package/dist/lib/hooks/useForceUpdate.cjs +8 -0
- package/dist/lib/hooks/useForceUpdate.d.ts +2 -0
- package/dist/lib/index.cjs +12 -0
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/model/component/node.cjs +164 -0
- package/dist/lib/model/component/node.d.ts +45 -0
- package/dist/lib/model/component/path.cjs +47 -0
- package/dist/lib/model/component/path.d.ts +19 -0
- package/dist/lib/model/equation/line.cjs +75 -0
- package/dist/lib/model/equation/line.d.ts +21 -0
- package/dist/lib/model/geometry/point/DescartesPoint.cjs +50 -0
- package/dist/lib/model/geometry/point/DescartesPoint.d.ts +21 -0
- package/dist/lib/model/geometry/point/PolarPoint.cjs +27 -0
- package/dist/lib/model/geometry/point/PolarPoint.d.ts +14 -0
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.cjs +338 -0
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.cjs +13 -0
- package/dist/lib/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.cjs +88 -0
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.cjs +6 -0
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.cjs +8 -0
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.cjs +39 -0
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.cjs +41 -0
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.cjs +19 -0
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.cjs +10 -0
- package/dist/lib/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.development.cjs +20 -0
- package/dist/lib/node_modules/.pnpm/react@19.0.0/node_modules/react/cjs/react-jsx-runtime.production.cjs +41 -0
- package/dist/lib/node_modules/.pnpm/react@19.0.0/node_modules/react/jsx-runtime.cjs +17 -0
- package/dist/lib/types/coordinate/descartes.d.ts +23 -0
- package/dist/lib/types/coordinate/index.d.ts +5 -0
- package/dist/lib/types/coordinate/polar.d.ts +5 -0
- package/dist/lib/types/distance/index.d.ts +8 -0
- package/dist/lib/types/distance/sep.d.ts +9 -0
- package/dist/lib/types/shape/index.cjs +9 -0
- package/dist/lib/types/shape/index.d.ts +8 -0
- package/dist/lib/types/shape/rect.cjs +30 -0
- package/dist/lib/types/shape/rect.d.ts +25 -0
- package/dist/lib/types/svg/font.d.ts +10 -0
- package/dist/lib/types/svg/stroke.d.ts +10 -0
- package/dist/lib/types/tikz/index.d.ts +6 -0
- package/dist/lib/utils/compare.cjs +20 -0
- package/dist/lib/utils/compare.d.ts +4 -0
- package/dist/lib/utils/css.cjs +26 -0
- package/dist/lib/utils/css.d.ts +6 -0
- package/dist/lib/utils/math.cjs +26 -0
- package/dist/lib/utils/math.d.ts +9 -0
- package/dist/lib/utils/string.cjs +7 -0
- package/dist/lib/utils/string.d.ts +7 -0
- package/dist/lib/utils/style/font.cjs +34 -0
- package/dist/lib/utils/style/font.d.ts +17 -0
- package/dist/lib/utils/style/stroke.cjs +40 -0
- package/dist/lib/utils/style/stroke.d.ts +19 -0
- package/package.json +57 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __module as jsxRuntime } from "../../../../../_virtual/jsx-runtime2.js";
|
|
2
|
+
import { __require as requireReactJsxRuntime_production } from "./cjs/react-jsx-runtime.production.js";
|
|
3
|
+
import { __require as requireReactJsxRuntime_development } from "./cjs/react-jsx-runtime.development.js";
|
|
4
|
+
var hasRequiredJsxRuntime;
|
|
5
|
+
function requireJsxRuntime() {
|
|
6
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
7
|
+
hasRequiredJsxRuntime = 1;
|
|
8
|
+
if (true) {
|
|
9
|
+
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
10
|
+
} else {
|
|
11
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
12
|
+
}
|
|
13
|
+
return jsxRuntime.exports;
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
requireJsxRuntime as __require
|
|
17
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** 笛卡尔象限 */
|
|
2
|
+
export declare enum Quadrant {
|
|
3
|
+
TR = "top_right",// 第一象限
|
|
4
|
+
TL = "top_left",// 第二象限
|
|
5
|
+
BL = "bottom_left",// 第三象限
|
|
6
|
+
BR = "bottom_right"
|
|
7
|
+
}
|
|
8
|
+
/** 笛卡尔坐标轴 */
|
|
9
|
+
export declare enum Axis {
|
|
10
|
+
X_POS = "x-positive",// 正x轴
|
|
11
|
+
Y_POS = "y-positive",// 正y轴
|
|
12
|
+
X_NEG = "x-negative",// 负x轴
|
|
13
|
+
Y_NEG = "y-negative"
|
|
14
|
+
}
|
|
15
|
+
/** 笛卡尔坐标系位置 */
|
|
16
|
+
export type DescartesLocation = Quadrant | Axis | 'center';
|
|
17
|
+
/** 笛卡尔坐标 */
|
|
18
|
+
export type Position = [number, number];
|
|
19
|
+
/** 笛卡尔坐标(对象形式) */
|
|
20
|
+
export type DescartesPosition = {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CssDistanceType, DirectionDistance } from '.';
|
|
2
|
+
/** 快捷属性 */
|
|
3
|
+
export type SepShortcutProps<T = CssDistanceType> = {
|
|
4
|
+
defaultVal: T;
|
|
5
|
+
x: T;
|
|
6
|
+
y: T;
|
|
7
|
+
} & DirectionDistance<T>;
|
|
8
|
+
/** 距离的全部属性 */
|
|
9
|
+
export type SepProps<T = CssDistanceType> = T | SepShortcutProps<T>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** 矩形四个顶点 */
|
|
2
|
+
export declare enum RectVertexPoint {
|
|
3
|
+
TL = "top_left",
|
|
4
|
+
TR = "top_right",
|
|
5
|
+
BL = "bottom_left",
|
|
6
|
+
BR = "bottom_right"
|
|
7
|
+
}
|
|
8
|
+
/** 矩形四个边的中点 */
|
|
9
|
+
export declare enum RectMidPoint {
|
|
10
|
+
T = "top_mid",
|
|
11
|
+
B = "bottom_mid",
|
|
12
|
+
L = "left_mid",
|
|
13
|
+
R = "right_mid"
|
|
14
|
+
}
|
|
15
|
+
/** 矩形四边的三等分点 */
|
|
16
|
+
export declare enum RectThirdPoint {
|
|
17
|
+
TL = "third_top_left",
|
|
18
|
+
TR = "third_top_right",
|
|
19
|
+
BL = "third_bottom_left",
|
|
20
|
+
BR = "third_bottom_right",
|
|
21
|
+
LT = "third_left_top",
|
|
22
|
+
LB = "third_left_bottom",
|
|
23
|
+
RT = "third_right_top",
|
|
24
|
+
RB = "third_right_bottom"
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var RectVertexPoint = /* @__PURE__ */ ((RectVertexPoint2) => {
|
|
2
|
+
RectVertexPoint2["TL"] = "top_left";
|
|
3
|
+
RectVertexPoint2["TR"] = "top_right";
|
|
4
|
+
RectVertexPoint2["BL"] = "bottom_left";
|
|
5
|
+
RectVertexPoint2["BR"] = "bottom_right";
|
|
6
|
+
return RectVertexPoint2;
|
|
7
|
+
})(RectVertexPoint || {});
|
|
8
|
+
var RectMidPoint = /* @__PURE__ */ ((RectMidPoint2) => {
|
|
9
|
+
RectMidPoint2["T"] = "top_mid";
|
|
10
|
+
RectMidPoint2["B"] = "bottom_mid";
|
|
11
|
+
RectMidPoint2["L"] = "left_mid";
|
|
12
|
+
RectMidPoint2["R"] = "right_mid";
|
|
13
|
+
return RectMidPoint2;
|
|
14
|
+
})(RectMidPoint || {});
|
|
15
|
+
var RectThirdPoint = /* @__PURE__ */ ((RectThirdPoint2) => {
|
|
16
|
+
RectThirdPoint2["TL"] = "third_top_left";
|
|
17
|
+
RectThirdPoint2["TR"] = "third_top_right";
|
|
18
|
+
RectThirdPoint2["BL"] = "third_bottom_left";
|
|
19
|
+
RectThirdPoint2["BR"] = "third_bottom_right";
|
|
20
|
+
RectThirdPoint2["LT"] = "third_left_top";
|
|
21
|
+
RectThirdPoint2["LB"] = "third_left_bottom";
|
|
22
|
+
RectThirdPoint2["RT"] = "third_right_top";
|
|
23
|
+
RectThirdPoint2["RB"] = "third_right_bottom";
|
|
24
|
+
return RectThirdPoint2;
|
|
25
|
+
})(RectThirdPoint || {});
|
|
26
|
+
export {
|
|
27
|
+
RectMidPoint,
|
|
28
|
+
RectThirdPoint,
|
|
29
|
+
RectVertexPoint
|
|
30
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type FontWeight = 'normal' | 'bold' | 'bolder' | 'lighter';
|
|
2
|
+
export type FontProps = {
|
|
3
|
+
fill?: 'currentColor' | string;
|
|
4
|
+
fillOpacity?: number;
|
|
5
|
+
fontSize?: string | number;
|
|
6
|
+
fontWeight?: FontWeight | number;
|
|
7
|
+
fontStyle?: 'normal' | 'italic' | 'oblique';
|
|
8
|
+
fontFamily?: string;
|
|
9
|
+
fontStretch?: 'normal' | 'condensed' | 'semi-condensed' | 'ultra-condensed' | 'extra-condensed' | 'expanded' | 'semi-expanded' | 'extra-expanded' | 'ultra-expanded' | 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset' | string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type StrokeProps = {
|
|
2
|
+
stroke?: string;
|
|
3
|
+
strokeWidth?: number;
|
|
4
|
+
strokeDasharray?: string;
|
|
5
|
+
strokeDashoffset?: string;
|
|
6
|
+
strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';
|
|
7
|
+
strokeLinejoin?: "round" | "inherit" | "bevel" | "miter";
|
|
8
|
+
strokeMiterlimit?: number;
|
|
9
|
+
strokeOpacity?: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const isSameArray = (arr1, arr2) => {
|
|
2
|
+
if (arr1.length !== arr2.length) return false;
|
|
3
|
+
const length = arr1.length;
|
|
4
|
+
for (let i = 0; i < length; i++) {
|
|
5
|
+
if (arr1[i] !== arr2[i]) return false;
|
|
6
|
+
}
|
|
7
|
+
return true;
|
|
8
|
+
};
|
|
9
|
+
const isSameObj = (obj1, obj2) => {
|
|
10
|
+
if (Object.keys(obj1).length !== Object.keys(obj2).length) return false;
|
|
11
|
+
const keys = Object.keys(obj1);
|
|
12
|
+
for (let i = 0; i < keys.length; i++) {
|
|
13
|
+
if (obj1[keys[i]] !== obj2[keys[i]]) return false;
|
|
14
|
+
}
|
|
15
|
+
return true;
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
isSameArray,
|
|
19
|
+
isSameObj
|
|
20
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const convertCssToPx = (dimension, sizeConfig) => {
|
|
2
|
+
if (dimension === void 0) return 0;
|
|
3
|
+
if (typeof dimension === "number") return dimension;
|
|
4
|
+
const match = dimension.match(/^(\d+(?:\.\d+)?)(px|em|rem|%)$/);
|
|
5
|
+
const { remPx: remSize = 16, emPx: emSize = 16, parentPx: elementSize = 100 } = sizeConfig || {};
|
|
6
|
+
if (match) {
|
|
7
|
+
const value = parseFloat(match[1]);
|
|
8
|
+
const unit = match[2];
|
|
9
|
+
switch (unit) {
|
|
10
|
+
case "px":
|
|
11
|
+
return value;
|
|
12
|
+
case "em":
|
|
13
|
+
return value * (emSize || remSize || 16);
|
|
14
|
+
case "rem":
|
|
15
|
+
return value * (remSize || 16);
|
|
16
|
+
case "%":
|
|
17
|
+
return elementSize ? value / 100 * elementSize : value;
|
|
18
|
+
default:
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return parseInt(dimension);
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
convertCssToPx
|
|
26
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** 判断值是否在范围内 */
|
|
2
|
+
export declare const between: (value: number, range: [number, number], equal?: boolean) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* 将数值进行精度调整(主要是为了内存优化)
|
|
5
|
+
* @value 要调整的值
|
|
6
|
+
* @precision 要调整的精度
|
|
7
|
+
* @deep 是否进行深度调整
|
|
8
|
+
* */
|
|
9
|
+
export declare const convertPrecision: <T>(value: T, precision: number | false, deep?: boolean) => T;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const between = (value, range, equal) => {
|
|
2
|
+
return equal ? value >= range[0] && value <= range[1] : value > range[0] && value < range[1];
|
|
3
|
+
};
|
|
4
|
+
const convertPrecision = (value, precision, deep = true) => {
|
|
5
|
+
if (precision === false) return value;
|
|
6
|
+
const innerConvert = (value2) => {
|
|
7
|
+
if (precision === 0) return Math.round(value2);
|
|
8
|
+
const realPrecision = 10 ** precision;
|
|
9
|
+
return Math.round(value2 * realPrecision) / realPrecision;
|
|
10
|
+
};
|
|
11
|
+
if (typeof value === "number") return innerConvert(value);
|
|
12
|
+
if (Array.isArray(value))
|
|
13
|
+
return value.map((item) => deep ? innerConvert(item) : typeof item === "number" ? innerConvert(item) : item);
|
|
14
|
+
if (typeof value === "object" && value !== null) {
|
|
15
|
+
const result = {};
|
|
16
|
+
for (const [key, item] of Object.entries(value)) {
|
|
17
|
+
result[key] = deep ? convertPrecision(item, precision) : typeof item === "number" ? innerConvert(item) : item;
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
return value;
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
between,
|
|
25
|
+
convertPrecision
|
|
26
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FontProps } from '../../types/svg/font';
|
|
2
|
+
export declare const TikZFontSizeMap: {
|
|
3
|
+
tiny: string;
|
|
4
|
+
script: string;
|
|
5
|
+
footnote: string;
|
|
6
|
+
small: string;
|
|
7
|
+
normal: string;
|
|
8
|
+
large: string;
|
|
9
|
+
Large: string;
|
|
10
|
+
LARGE: string;
|
|
11
|
+
huge: string;
|
|
12
|
+
Huge: string;
|
|
13
|
+
};
|
|
14
|
+
export type TikZFontSize = keyof typeof TikZFontSizeMap;
|
|
15
|
+
export declare const convertFontSize: (fontSize?: string | TikZFontSize | number) => string | number | undefined;
|
|
16
|
+
export type FontStyle = 'bold' | 'italic' | 'serif' | 'sans-serif';
|
|
17
|
+
export declare const convertFontStyle: (fontStyle?: FontStyle) => Partial<FontProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const TikZFontSizeMap = {
|
|
2
|
+
tiny: "5px",
|
|
3
|
+
script: "8px",
|
|
4
|
+
footnote: "10px",
|
|
5
|
+
small: "12px",
|
|
6
|
+
normal: "16px",
|
|
7
|
+
large: "18px",
|
|
8
|
+
Large: "22px",
|
|
9
|
+
LARGE: "26px",
|
|
10
|
+
huge: "30px",
|
|
11
|
+
Huge: "36px"
|
|
12
|
+
};
|
|
13
|
+
const convertFontSize = (fontSize) => {
|
|
14
|
+
return typeof fontSize === "string" && TikZFontSizeMap.hasOwnProperty(fontSize) ? TikZFontSizeMap[fontSize] : fontSize;
|
|
15
|
+
};
|
|
16
|
+
const convertFontStyle = (fontStyle) => {
|
|
17
|
+
switch (fontStyle) {
|
|
18
|
+
case "bold":
|
|
19
|
+
return { fontWeight: "bold" };
|
|
20
|
+
case "italic":
|
|
21
|
+
return { fontStyle: "italic" };
|
|
22
|
+
case "serif":
|
|
23
|
+
return { fontFamily: "serif" };
|
|
24
|
+
case "sans-serif":
|
|
25
|
+
return { fontFamily: "sans-serif" };
|
|
26
|
+
default:
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
TikZFontSizeMap,
|
|
32
|
+
convertFontSize,
|
|
33
|
+
convertFontStyle
|
|
34
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { StrokeProps } from '../../types/svg/stroke';
|
|
2
|
+
export type StrokeType = 'solid' | 'dashed' | 'denselyDashed' | 'looselyDashed' | 'dotted' | 'denselyDotted' | 'looselyDotted' | 'dashDot' | 'denselyDashDot' | 'looselyDashDot' | 'dashDashDot' | 'denselyDashDashDot' | 'looselyDashDashDot';
|
|
3
|
+
export type StrokeShortcutProps = {
|
|
4
|
+
dashed?: boolean;
|
|
5
|
+
denselyDashed?: boolean;
|
|
6
|
+
looselyDashed?: boolean;
|
|
7
|
+
dotted?: boolean;
|
|
8
|
+
denselyDotted?: boolean;
|
|
9
|
+
looselyDotted?: boolean;
|
|
10
|
+
dashDot?: boolean;
|
|
11
|
+
denselyDashDot?: boolean;
|
|
12
|
+
looselyDashDot?: boolean;
|
|
13
|
+
dashDashDot?: boolean;
|
|
14
|
+
denselyDashDashDot?: boolean;
|
|
15
|
+
looselyDashDashDot?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/** 将 StrokeType 转换为 svg 原生的属性 */
|
|
18
|
+
export declare const convertStrokeType: (strokeType: StrokeType, strokeWidth?: number) => Partial<StrokeProps>;
|
|
19
|
+
export declare const convertStrokeShortcut: (shortcutProps: StrokeShortcutProps, strokeWidth?: number) => Partial<StrokeProps>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const convertStrokeType = (strokeType, strokeWidth = 1) => {
|
|
2
|
+
switch (strokeType) {
|
|
3
|
+
case "solid":
|
|
4
|
+
return {};
|
|
5
|
+
case "dashed":
|
|
6
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 4}` };
|
|
7
|
+
case "denselyDashed":
|
|
8
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 2}` };
|
|
9
|
+
case "looselyDashed":
|
|
10
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 6}` };
|
|
11
|
+
case "dotted":
|
|
12
|
+
return { strokeDasharray: `1 ${strokeWidth * 4}` };
|
|
13
|
+
case "denselyDotted":
|
|
14
|
+
return { strokeDasharray: `1 ${strokeWidth * 2}` };
|
|
15
|
+
case "looselyDotted":
|
|
16
|
+
return { strokeDasharray: `1 ${strokeWidth * 6}` };
|
|
17
|
+
case "dashDot":
|
|
18
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 4} 1 ${strokeWidth * 4}` };
|
|
19
|
+
case "denselyDashDot":
|
|
20
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 2} 1 ${strokeWidth * 2}` };
|
|
21
|
+
case "looselyDashDot":
|
|
22
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 6} 1 ${strokeWidth * 6}` };
|
|
23
|
+
case "dashDashDot":
|
|
24
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 4} 1 ${strokeWidth * 4} 1 ${strokeWidth * 4}` };
|
|
25
|
+
case "denselyDashDashDot":
|
|
26
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 2} 1 ${strokeWidth * 2} 1 ${strokeWidth * 2}` };
|
|
27
|
+
case "looselyDashDashDot":
|
|
28
|
+
return { strokeDasharray: `${strokeWidth * 4} ${strokeWidth * 6} 1 ${strokeWidth * 6} 1 ${strokeWidth * 6}` };
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const convertStrokeShortcut = (shortcutProps, strokeWidth = 1) => {
|
|
32
|
+
return convertStrokeType(
|
|
33
|
+
shortcutProps.dashed ? "dashed" : shortcutProps.denselyDashed ? "denselyDashed" : shortcutProps.looselyDashed ? "looselyDashed" : shortcutProps.dotted ? "dotted" : shortcutProps.denselyDotted ? "denselyDotted" : shortcutProps.looselyDotted ? "looselyDotted" : shortcutProps.dashDot ? "dashDot" : shortcutProps.denselyDashDot ? "denselyDashDot" : shortcutProps.looselyDashDot ? "looselyDashDot" : shortcutProps.dashDashDot ? "dashDashDot" : shortcutProps.denselyDashDashDot ? "denselyDashDashDot" : shortcutProps.looselyDashDashDot ? "looselyDashDashDot" : "solid",
|
|
34
|
+
strokeWidth || 1
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
convertStrokeShortcut,
|
|
39
|
+
convertStrokeType
|
|
40
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("../node_modules/.pnpm/react@19.0.0/node_modules/react/jsx-runtime.cjs");
|
|
4
|
+
var jsxRuntimeExports = jsxRuntime.__require();
|
|
5
|
+
exports.jsxRuntimeExports = jsxRuntimeExports;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("../_virtual/jsx-runtime.cjs");
|
|
4
|
+
const useScope = require("../hooks/context/useScope.cjs");
|
|
5
|
+
const Group = require("../container/Group.cjs");
|
|
6
|
+
const Scope = (props) => {
|
|
7
|
+
const { children, ref, ...resProps } = props;
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(useScope.ScopeContext, { value: resProps, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Group.default, { ref, children }) });
|
|
9
|
+
};
|
|
10
|
+
exports.default = Scope;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import { ScopeProps as ScopeContextProps } from '../hooks/context/useScope';
|
|
3
|
+
import { GroupProps } from '../container/Group';
|
|
4
|
+
export type ScopeProps = ScopeContextProps & Omit<GroupProps, 'offset'>;
|
|
5
|
+
declare const Scope: FC<PropsWithChildren<ScopeProps>>;
|
|
6
|
+
export default Scope;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("../_virtual/jsx-runtime.cjs");
|
|
4
|
+
const Surface = require("../container/Surface.cjs");
|
|
5
|
+
const useCalculate = require("../hooks/context/useCalculate.cjs");
|
|
6
|
+
const useNodes = require("../hooks/context/useNodes.cjs");
|
|
7
|
+
const useScope = require("../hooks/context/useScope.cjs");
|
|
8
|
+
const TikZ = (props) => {
|
|
9
|
+
const { precision = 2, offset, node, draw, ...resProps } = props;
|
|
10
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(useNodes.NodesContext, { value: /* @__PURE__ */ new Map(), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(useCalculate.CalculateContext, { value: { precision }, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(useScope.ScopeContext, { value: { offset, node, draw }, children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(Surface.default, { ...resProps }) }) }) });
|
|
11
|
+
};
|
|
12
|
+
exports.default = TikZ;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
import { SurfaceProps } from '../container/Surface';
|
|
3
|
+
import { CalculateProps } from '../hooks/context/useCalculate';
|
|
4
|
+
import { ScopeProps } from '../hooks/context/useScope';
|
|
5
|
+
export type TikZProps = {
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
} & Partial<CalculateProps> & ScopeProps & SurfaceProps;
|
|
8
|
+
declare const TikZ: FC<TikZProps>;
|
|
9
|
+
export default TikZ;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("../../_virtual/jsx-runtime.cjs");
|
|
4
|
+
const useScope = require("../../hooks/context/useScope.cjs");
|
|
5
|
+
const DescartesPoint = require("../../model/geometry/point/DescartesPoint.cjs");
|
|
6
|
+
const stroke = require("../../utils/style/stroke.cjs");
|
|
7
|
+
const InnerDraw = require("./InnerDraw.cjs");
|
|
8
|
+
const Draw = (props) => {
|
|
9
|
+
const { draw: scopeProps } = useScope.default();
|
|
10
|
+
const realProps = { ...scopeProps, ...props };
|
|
11
|
+
const { offset, color, stroke: stroke$1, strokeWidth, startArrow, startArrows, endArrow, endArrows, ...drawProps } = realProps;
|
|
12
|
+
const realStroke = stroke$1 || color;
|
|
13
|
+
const realStartArrow = typeof startArrow === "string" ? { type: startArrow } : startArrow;
|
|
14
|
+
const realStartArrows = typeof startArrows === "string" ? { type: startArrows } : startArrows;
|
|
15
|
+
const realEndArrow = typeof endArrow === "string" ? { type: endArrow } : endArrow;
|
|
16
|
+
const realEndArrows = typeof endArrows === "string" ? { type: endArrows } : endArrows;
|
|
17
|
+
const convertOffset = offset ? DescartesPoint.default.formatPosition(offset) : [0, 0];
|
|
18
|
+
const getStrokeTypes = () => drawProps.strokeType ? stroke.convertStrokeType(drawProps.strokeType, strokeWidth || 1) : stroke.convertStrokeShortcut(drawProps, strokeWidth || 1);
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
20
|
+
InnerDraw.default,
|
|
21
|
+
{
|
|
22
|
+
...getStrokeTypes(),
|
|
23
|
+
offset: convertOffset,
|
|
24
|
+
stroke: realStroke,
|
|
25
|
+
strokeWidth: strokeWidth || 1,
|
|
26
|
+
startArrow: realStartArrow,
|
|
27
|
+
startArrows: realStartArrows,
|
|
28
|
+
endArrow: realEndArrow,
|
|
29
|
+
endArrows: realEndArrows,
|
|
30
|
+
...drawProps
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
exports.default = Draw;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC, ReactElement, Ref } from 'react';
|
|
2
|
+
import { PointPosition } from '../../types/coordinate';
|
|
3
|
+
import { StrokeProps } from '../../types/svg/stroke';
|
|
4
|
+
import { StrokeShortcutProps, StrokeType } from '../../utils/style/stroke';
|
|
5
|
+
import { ArrowProps, DrawWayType } from './types';
|
|
6
|
+
export type DrawProps = {
|
|
7
|
+
ref?: Ref<SVGPathElement>;
|
|
8
|
+
way: DrawWayType[];
|
|
9
|
+
/** 位置偏移 */
|
|
10
|
+
offset?: PointPosition;
|
|
11
|
+
/** 同 stroke */
|
|
12
|
+
color?: string;
|
|
13
|
+
/** 线段样式快捷属性 */
|
|
14
|
+
strokeType?: StrokeType;
|
|
15
|
+
children?: ReactElement | ReactElement[] | null;
|
|
16
|
+
} & StrokeProps & StrokeShortcutProps & ArrowProps;
|
|
17
|
+
declare const Draw: FC<DrawProps>;
|
|
18
|
+
export default Draw;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const jsxRuntime = require("../../_virtual/jsx-runtime.cjs");
|
|
4
|
+
const require$$0 = require("react");
|
|
5
|
+
const Group = require("../../container/Group.cjs");
|
|
6
|
+
const usePath = require("../../hooks/context/usePath.cjs");
|
|
7
|
+
const path = require("../../model/component/path.cjs");
|
|
8
|
+
const common = require("./common.cjs");
|
|
9
|
+
const index = require("./segment/index.cjs");
|
|
10
|
+
const InnerDraw = (props) => {
|
|
11
|
+
const { way, ref, offset, startArrow, startArrows, endArrow, endArrows, children, ...strokeProps } = props;
|
|
12
|
+
const waySegments = require$$0.useMemo(() => {
|
|
13
|
+
let preNodeType = "coordinate";
|
|
14
|
+
const waySegments2 = [];
|
|
15
|
+
let waySegment = [];
|
|
16
|
+
for (let i = 0; i < way.length; i++) {
|
|
17
|
+
const point = way[i];
|
|
18
|
+
const currentNodeType = common.getDrawPointType(point);
|
|
19
|
+
waySegment.push(point);
|
|
20
|
+
if (currentNodeType === "node" && preNodeType === "node" && waySegment.length >= 2) {
|
|
21
|
+
waySegments2.push(waySegment);
|
|
22
|
+
waySegment = [waySegment[waySegment.length - 1]];
|
|
23
|
+
}
|
|
24
|
+
if (i === way.length - 1 && waySegment.length > 1) {
|
|
25
|
+
waySegments2.push(waySegment);
|
|
26
|
+
}
|
|
27
|
+
preNodeType = currentNodeType;
|
|
28
|
+
}
|
|
29
|
+
return waySegments2;
|
|
30
|
+
}, [way]);
|
|
31
|
+
return /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(usePath.PathContext, { value: new path.default(new Array(waySegments.length).fill([]), strokeProps.strokeWidth || 1, false), children: /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsxs(Group.default, { ref, transform: `translate(${offset[0]}, ${offset[1]})`, children: [
|
|
32
|
+
waySegments.map((segment, index$1) => /* @__PURE__ */ jsxRuntime.jsxRuntimeExports.jsx(
|
|
33
|
+
index.default,
|
|
34
|
+
{
|
|
35
|
+
index: index$1,
|
|
36
|
+
isLastSegment: index$1 === waySegments.length - 1,
|
|
37
|
+
way: segment,
|
|
38
|
+
...strokeProps,
|
|
39
|
+
endArrow: index$1 === waySegments.length - 1 ? endArrow || endArrows : endArrows,
|
|
40
|
+
startArrow: index$1 === waySegments.length - 1 ? startArrow || startArrows : startArrows
|
|
41
|
+
},
|
|
42
|
+
JSON.stringify(segment)
|
|
43
|
+
)),
|
|
44
|
+
children
|
|
45
|
+
] }) });
|
|
46
|
+
};
|
|
47
|
+
exports.default = InnerDraw;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactNode, Ref } from 'react';
|
|
2
|
+
import { Position } from '../../types/coordinate/descartes';
|
|
3
|
+
import { StrokeProps } from '../../types/svg/stroke';
|
|
4
|
+
import { ArrowConfig, ArrowProps, DrawWayType } from './types';
|
|
5
|
+
export type InnerDrawProps = {
|
|
6
|
+
ref?: Ref<SVGPathElement>;
|
|
7
|
+
/** 位置偏移 */
|
|
8
|
+
offset: Position;
|
|
9
|
+
way: DrawWayType[];
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
} & StrokeProps & ArrowProps<ArrowConfig>;
|
|
12
|
+
declare const InnerDraw: FC<InnerDrawProps>;
|
|
13
|
+
export default InnerDraw;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
+
const stealth = require("./stealth.cjs");
|
|
4
|
+
const getArrowPath = (type, attributes) => {
|
|
5
|
+
switch (type) {
|
|
6
|
+
case "Stealth":
|
|
7
|
+
return stealth.default(attributes);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
exports.default = getArrowPath;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ArrowAttributes, ArrowPathConfig } from './types';
|
|
2
|
+
export type { ArrowAttributes as ArrowPositionAttributes, ArrowPathConfig };
|
|
3
|
+
export type ArrowType = 'Stealth';
|
|
4
|
+
declare const getArrowPath: (type: ArrowType, attributes: ArrowAttributes) => {
|
|
5
|
+
d: string;
|
|
6
|
+
offsetDistance: number;
|
|
7
|
+
insertDistance: number;
|
|
8
|
+
};
|
|
9
|
+
export default getArrowPath;
|