@retikz/core 0.0.1-rc.2 → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/es/compile/compile.d.ts +27 -0
- package/dist/es/compile/compile.d.ts.map +1 -0
- package/dist/es/compile/compile.js +43 -0
- package/dist/es/compile/index.d.ts +8 -0
- package/dist/es/compile/index.d.ts.map +1 -0
- package/dist/es/compile/node.d.ts +51 -0
- package/dist/es/compile/node.d.ts.map +1 -0
- package/dist/es/compile/node.js +100 -0
- package/dist/es/compile/path.d.ts +19 -0
- package/dist/es/compile/path.d.ts.map +1 -0
- package/dist/es/compile/path.js +55 -0
- package/dist/es/compile/position.d.ts +9 -0
- package/dist/es/compile/position.d.ts.map +1 -0
- package/dist/es/compile/position.js +24 -0
- package/dist/es/compile/precision.d.ts +5 -0
- package/dist/es/compile/precision.d.ts.map +1 -0
- package/dist/es/compile/precision.js +8 -0
- package/dist/es/compile/text-metrics.d.ts +32 -0
- package/dist/es/compile/text-metrics.d.ts.map +1 -0
- package/dist/es/compile/text-metrics.js +8 -0
- package/dist/es/compile/view-box.d.ts +8 -0
- package/dist/es/compile/view-box.d.ts.map +1 -0
- package/dist/es/compile/view-box.js +31 -0
- package/dist/es/geometry/index.d.ts +4 -0
- package/dist/es/geometry/index.d.ts.map +1 -0
- package/dist/es/geometry/point.d.ts +25 -0
- package/dist/es/geometry/point.d.ts.map +1 -0
- package/dist/es/geometry/point.js +34 -0
- package/dist/es/geometry/polar.d.ts +44 -0
- package/dist/es/geometry/polar.d.ts.map +1 -0
- package/dist/es/geometry/polar.js +45 -0
- package/dist/es/geometry/rect.d.ts +59 -0
- package/dist/es/geometry/rect.d.ts.map +1 -0
- package/dist/es/geometry/rect.js +120 -0
- package/dist/es/index.d.ts +18 -10
- package/dist/es/index.d.ts.map +1 -0
- package/dist/es/index.js +14 -12
- package/dist/es/ir/index.d.ts +5 -0
- package/dist/es/ir/index.d.ts.map +1 -0
- package/dist/es/ir/node.d.ts +41 -0
- package/dist/es/ir/node.d.ts.map +1 -0
- package/dist/es/ir/node.js +19 -0
- package/dist/es/ir/path/index.d.ts +4 -0
- package/dist/es/ir/path/index.d.ts.map +1 -0
- package/dist/es/ir/path/path.d.ts +63 -0
- package/dist/es/ir/path/path.d.ts.map +1 -0
- package/dist/es/ir/path/path.js +12 -0
- package/dist/es/ir/path/step.d.ts +62 -0
- package/dist/es/ir/path/step.d.ts.map +1 -0
- package/dist/es/ir/path/step.js +16 -0
- package/dist/es/ir/path/target.d.ts +5 -0
- package/dist/es/ir/path/target.d.ts.map +1 -0
- package/dist/es/ir/path/target.js +11 -0
- package/dist/es/ir/position/index.d.ts +3 -0
- package/dist/es/ir/position/index.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.d.ts +9 -0
- package/dist/es/ir/position/polar-position.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.js +18 -0
- package/dist/es/ir/position/position.d.ts +5 -0
- package/dist/es/ir/position/position.d.ts.map +1 -0
- package/dist/es/ir/position/position.js +5 -0
- package/dist/es/ir/scene.d.ts +262 -0
- package/dist/es/ir/scene.d.ts.map +1 -0
- package/dist/es/ir/scene.js +14 -0
- package/dist/es/parsers/index.d.ts +2 -0
- package/dist/es/parsers/index.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.d.ts +25 -0
- package/dist/es/parsers/parseWay.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.js +30 -0
- package/dist/es/primitive/group.d.ts +11 -0
- package/dist/es/primitive/group.d.ts.map +1 -0
- package/dist/es/primitive/index.d.ts +7 -0
- package/dist/es/primitive/index.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +22 -0
- package/dist/es/primitive/path.d.ts.map +1 -0
- package/dist/es/primitive/rect.d.ts +28 -0
- package/dist/es/primitive/rect.d.ts.map +1 -0
- package/dist/es/primitive/scene.d.ts +20 -0
- package/dist/es/primitive/scene.d.ts.map +1 -0
- package/dist/es/primitive/text.d.ts +32 -0
- package/dist/es/primitive/text.d.ts.map +1 -0
- package/dist/es/primitive/view-box.d.ts +12 -0
- package/dist/es/primitive/view-box.d.ts.map +1 -0
- package/dist/lib/compile/compile.cjs +43 -0
- package/dist/lib/compile/compile.d.ts +27 -0
- package/dist/lib/compile/compile.d.ts.map +1 -0
- package/dist/lib/compile/index.d.ts +8 -0
- package/dist/lib/compile/index.d.ts.map +1 -0
- package/dist/lib/compile/node.cjs +102 -0
- package/dist/lib/compile/node.d.ts +51 -0
- package/dist/lib/compile/node.d.ts.map +1 -0
- package/dist/lib/compile/path.cjs +55 -0
- package/dist/lib/compile/path.d.ts +19 -0
- package/dist/lib/compile/path.d.ts.map +1 -0
- package/dist/lib/compile/position.cjs +24 -0
- package/dist/lib/compile/position.d.ts +9 -0
- package/dist/lib/compile/position.d.ts.map +1 -0
- package/dist/lib/compile/precision.cjs +8 -0
- package/dist/lib/compile/precision.d.ts +5 -0
- package/dist/lib/compile/precision.d.ts.map +1 -0
- package/dist/lib/compile/text-metrics.cjs +8 -0
- package/dist/lib/compile/text-metrics.d.ts +32 -0
- package/dist/lib/compile/text-metrics.d.ts.map +1 -0
- package/dist/lib/compile/view-box.cjs +31 -0
- package/dist/lib/compile/view-box.d.ts +8 -0
- package/dist/lib/compile/view-box.d.ts.map +1 -0
- package/dist/lib/geometry/index.d.ts +4 -0
- package/dist/lib/geometry/index.d.ts.map +1 -0
- package/dist/lib/geometry/point.cjs +34 -0
- package/dist/lib/geometry/point.d.ts +25 -0
- package/dist/lib/geometry/point.d.ts.map +1 -0
- package/dist/lib/geometry/polar.cjs +45 -0
- package/dist/lib/geometry/polar.d.ts +44 -0
- package/dist/lib/geometry/polar.d.ts.map +1 -0
- package/dist/lib/geometry/rect.cjs +121 -0
- package/dist/lib/geometry/rect.d.ts +59 -0
- package/dist/lib/geometry/rect.d.ts.map +1 -0
- package/dist/lib/index.cjs +31 -11
- package/dist/lib/index.d.ts +18 -10
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/ir/index.d.ts +5 -0
- package/dist/lib/ir/index.d.ts.map +1 -0
- package/dist/lib/ir/node.cjs +19 -0
- package/dist/lib/ir/node.d.ts +41 -0
- package/dist/lib/ir/node.d.ts.map +1 -0
- package/dist/lib/ir/path/index.d.ts +4 -0
- package/dist/lib/ir/path/index.d.ts.map +1 -0
- package/dist/lib/ir/path/path.cjs +12 -0
- package/dist/lib/ir/path/path.d.ts +63 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -0
- package/dist/lib/ir/path/step.cjs +18 -0
- package/dist/lib/ir/path/step.d.ts +62 -0
- package/dist/lib/ir/path/step.d.ts.map +1 -0
- package/dist/lib/ir/path/target.cjs +11 -0
- package/dist/lib/ir/path/target.d.ts +5 -0
- package/dist/lib/ir/path/target.d.ts.map +1 -0
- package/dist/lib/ir/position/index.d.ts +3 -0
- package/dist/lib/ir/position/index.d.ts.map +1 -0
- package/dist/lib/ir/position/polar-position.cjs +18 -0
- package/dist/lib/ir/position/polar-position.d.ts +9 -0
- package/dist/lib/ir/position/polar-position.d.ts.map +1 -0
- package/dist/lib/ir/position/position.cjs +5 -0
- package/dist/lib/ir/position/position.d.ts +5 -0
- package/dist/lib/ir/position/position.d.ts.map +1 -0
- package/dist/lib/ir/scene.cjs +16 -0
- package/dist/lib/ir/scene.d.ts +262 -0
- package/dist/lib/ir/scene.d.ts.map +1 -0
- package/dist/lib/parsers/index.d.ts +2 -0
- package/dist/lib/parsers/index.d.ts.map +1 -0
- package/dist/lib/parsers/parseWay.cjs +30 -0
- package/dist/lib/parsers/parseWay.d.ts +25 -0
- package/dist/lib/parsers/parseWay.d.ts.map +1 -0
- package/dist/lib/primitive/group.d.ts +11 -0
- package/dist/lib/primitive/group.d.ts.map +1 -0
- package/dist/lib/primitive/index.d.ts +7 -0
- package/dist/lib/primitive/index.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +22 -0
- package/dist/lib/primitive/path.d.ts.map +1 -0
- package/dist/lib/primitive/rect.d.ts +28 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -0
- package/dist/lib/primitive/scene.d.ts +20 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -0
- package/dist/lib/primitive/text.d.ts +32 -0
- package/dist/lib/primitive/text.d.ts.map +1 -0
- package/dist/lib/primitive/view-box.d.ts +12 -0
- package/dist/lib/primitive/view-box.d.ts.map +1 -0
- package/package.json +21 -29
- package/README.md +0 -2
- package/dist/es/components/Scope.d.ts +0 -6
- package/dist/es/components/Scope.js +0 -12
- package/dist/es/components/TikZ.d.ts +0 -9
- package/dist/es/components/TikZ.js +0 -12
- package/dist/es/components/draw/Draw.d.ts +0 -26
- package/dist/es/components/draw/Draw.js +0 -59
- package/dist/es/components/draw/InnerDraw.d.ts +0 -17
- package/dist/es/components/draw/InnerDraw.js +0 -52
- package/dist/es/components/draw/arrow/circle.d.ts +0 -7
- package/dist/es/components/draw/arrow/circle.js +0 -20
- package/dist/es/components/draw/arrow/index.d.ts +0 -9
- package/dist/es/components/draw/arrow/index.js +0 -13
- package/dist/es/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/es/components/draw/arrow/stealth.js +0 -29
- package/dist/es/components/draw/arrow/types.d.ts +0 -21
- package/dist/es/components/draw/common.d.ts +0 -4
- package/dist/es/components/draw/common.js +0 -12
- package/dist/es/components/draw/index.d.ts +0 -3
- package/dist/es/components/draw/index.js +0 -4
- package/dist/es/components/draw/segment/Segment.d.ts +0 -12
- package/dist/es/components/draw/segment/Segment.js +0 -41
- package/dist/es/components/draw/segment/index.d.ts +0 -15
- package/dist/es/components/draw/segment/index.js +0 -41
- package/dist/es/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/es/components/draw/segment/useArrow.js +0 -52
- package/dist/es/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/es/components/draw/segment/useConvertWay.js +0 -110
- package/dist/es/components/draw/types.d.ts +0 -29
- package/dist/es/components/node/InnerNode.d.ts +0 -33
- package/dist/es/components/node/InnerNode.js +0 -88
- package/dist/es/components/node/Node.d.ts +0 -93
- package/dist/es/components/node/Node.js +0 -88
- package/dist/es/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/es/components/node/_hooks/useNodeConfig.js +0 -13
- package/dist/es/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeContent.js +0 -30
- package/dist/es/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeShape.js +0 -34
- package/dist/es/components/node/index.d.ts +0 -3
- package/dist/es/components/node/index.js +0 -4
- package/dist/es/components/path-node/PathNode.d.ts +0 -48
- package/dist/es/components/path-node/PathNode.js +0 -76
- package/dist/es/components/path-node/index.d.ts +0 -3
- package/dist/es/components/path-node/index.js +0 -4
- package/dist/es/components/path-node/useAnchor.d.ts +0 -6
- package/dist/es/components/path-node/useAnchor.js +0 -49
- package/dist/es/container/Group.d.ts +0 -6
- package/dist/es/container/Group.js +0 -8
- package/dist/es/container/Surface.d.ts +0 -19
- package/dist/es/container/Surface.js +0 -23
- package/dist/es/elements/Path.d.ts +0 -4
- package/dist/es/elements/Path.js +0 -14
- package/dist/es/elements/Rect.d.ts +0 -4
- package/dist/es/elements/Rect.js +0 -9
- package/dist/es/elements/Text.d.ts +0 -18
- package/dist/es/elements/Text.js +0 -35
- package/dist/es/hooks/context/useCalculate.d.ts +0 -7
- package/dist/es/hooks/context/useCalculate.js +0 -9
- package/dist/es/hooks/context/useNodes.d.ts +0 -9
- package/dist/es/hooks/context/useNodes.js +0 -33
- package/dist/es/hooks/context/usePath.d.ts +0 -13
- package/dist/es/hooks/context/usePath.js +0 -20
- package/dist/es/hooks/context/useScope.d.ts +0 -11
- package/dist/es/hooks/context/useScope.js +0 -7
- package/dist/es/hooks/useForceUpdate.d.ts +0 -2
- package/dist/es/hooks/useForceUpdate.js +0 -8
- package/dist/es/model/component/node.d.ts +0 -45
- package/dist/es/model/component/node.js +0 -164
- package/dist/es/model/component/path.d.ts +0 -19
- package/dist/es/model/component/path.js +0 -47
- package/dist/es/model/equation/line.d.ts +0 -21
- package/dist/es/model/equation/line.js +0 -76
- package/dist/es/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/es/model/geometry/point/DescartesPoint.js +0 -50
- package/dist/es/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/es/model/geometry/point/PolarPoint.js +0 -27
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +0 -338
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +0 -13
- package/dist/es/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js +0 -88
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js +0 -6
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js +0 -8
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js +0 -39
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js +0 -41
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js +0 -19
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js +0 -10
- package/dist/es/test.d.ts +0 -1
- package/dist/es/types/coordinate/descartes.d.ts +0 -23
- package/dist/es/types/coordinate/index.d.ts +0 -5
- package/dist/es/types/coordinate/polar.d.ts +0 -5
- package/dist/es/types/distance/index.d.ts +0 -8
- package/dist/es/types/distance/sep.d.ts +0 -9
- package/dist/es/types/shape/index.d.ts +0 -8
- package/dist/es/types/shape/index.js +0 -9
- package/dist/es/types/shape/rect.d.ts +0 -25
- package/dist/es/types/shape/rect.js +0 -30
- package/dist/es/types/svg/font.d.ts +0 -10
- package/dist/es/types/svg/stroke.d.ts +0 -10
- package/dist/es/types/tikz/index.d.ts +0 -6
- package/dist/es/utils/compare.d.ts +0 -4
- package/dist/es/utils/compare.js +0 -20
- package/dist/es/utils/css.d.ts +0 -6
- package/dist/es/utils/css.js +0 -26
- package/dist/es/utils/math.d.ts +0 -9
- package/dist/es/utils/math.js +0 -26
- package/dist/es/utils/string.d.ts +0 -7
- package/dist/es/utils/string.js +0 -7
- package/dist/es/utils/style/font.d.ts +0 -17
- package/dist/es/utils/style/font.js +0 -34
- package/dist/es/utils/style/stroke.d.ts +0 -20
- package/dist/es/utils/style/stroke.js +0 -42
- package/dist/lib/components/Scope.cjs +0 -12
- package/dist/lib/components/Scope.d.ts +0 -6
- package/dist/lib/components/TikZ.cjs +0 -12
- package/dist/lib/components/TikZ.d.ts +0 -9
- package/dist/lib/components/draw/Draw.cjs +0 -59
- package/dist/lib/components/draw/Draw.d.ts +0 -26
- package/dist/lib/components/draw/InnerDraw.cjs +0 -52
- package/dist/lib/components/draw/InnerDraw.d.ts +0 -17
- package/dist/lib/components/draw/arrow/circle.cjs +0 -20
- package/dist/lib/components/draw/arrow/circle.d.ts +0 -7
- package/dist/lib/components/draw/arrow/index.cjs +0 -13
- package/dist/lib/components/draw/arrow/index.d.ts +0 -9
- package/dist/lib/components/draw/arrow/stealth.cjs +0 -29
- package/dist/lib/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/lib/components/draw/arrow/types.d.ts +0 -21
- package/dist/lib/components/draw/common.cjs +0 -12
- package/dist/lib/components/draw/common.d.ts +0 -4
- package/dist/lib/components/draw/index.cjs +0 -4
- package/dist/lib/components/draw/index.d.ts +0 -3
- package/dist/lib/components/draw/segment/Segment.cjs +0 -41
- package/dist/lib/components/draw/segment/Segment.d.ts +0 -12
- package/dist/lib/components/draw/segment/index.cjs +0 -41
- package/dist/lib/components/draw/segment/index.d.ts +0 -15
- package/dist/lib/components/draw/segment/useArrow.cjs +0 -52
- package/dist/lib/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/lib/components/draw/segment/useConvertWay.cjs +0 -110
- package/dist/lib/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/lib/components/draw/types.d.ts +0 -29
- package/dist/lib/components/node/InnerNode.cjs +0 -88
- package/dist/lib/components/node/InnerNode.d.ts +0 -33
- package/dist/lib/components/node/Node.cjs +0 -88
- package/dist/lib/components/node/Node.d.ts +0 -93
- package/dist/lib/components/node/_hooks/useNodeConfig.cjs +0 -13
- package/dist/lib/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/lib/components/node/_hooks/useNodeContent.cjs +0 -30
- package/dist/lib/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/lib/components/node/_hooks/useNodeShape.cjs +0 -34
- package/dist/lib/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/lib/components/node/index.cjs +0 -4
- package/dist/lib/components/node/index.d.ts +0 -3
- package/dist/lib/components/path-node/PathNode.cjs +0 -76
- package/dist/lib/components/path-node/PathNode.d.ts +0 -48
- package/dist/lib/components/path-node/index.cjs +0 -4
- package/dist/lib/components/path-node/index.d.ts +0 -3
- package/dist/lib/components/path-node/useAnchor.cjs +0 -49
- package/dist/lib/components/path-node/useAnchor.d.ts +0 -6
- package/dist/lib/container/Group.cjs +0 -8
- package/dist/lib/container/Group.d.ts +0 -6
- package/dist/lib/container/Surface.cjs +0 -23
- package/dist/lib/container/Surface.d.ts +0 -19
- package/dist/lib/elements/Path.cjs +0 -14
- package/dist/lib/elements/Path.d.ts +0 -4
- package/dist/lib/elements/Rect.cjs +0 -9
- package/dist/lib/elements/Rect.d.ts +0 -4
- package/dist/lib/elements/Text.cjs +0 -35
- package/dist/lib/elements/Text.d.ts +0 -18
- package/dist/lib/hooks/context/useCalculate.cjs +0 -9
- package/dist/lib/hooks/context/useCalculate.d.ts +0 -7
- package/dist/lib/hooks/context/useNodes.cjs +0 -33
- package/dist/lib/hooks/context/useNodes.d.ts +0 -9
- package/dist/lib/hooks/context/usePath.cjs +0 -20
- package/dist/lib/hooks/context/usePath.d.ts +0 -13
- package/dist/lib/hooks/context/useScope.cjs +0 -7
- package/dist/lib/hooks/context/useScope.d.ts +0 -11
- package/dist/lib/hooks/useForceUpdate.cjs +0 -8
- package/dist/lib/hooks/useForceUpdate.d.ts +0 -2
- package/dist/lib/model/component/node.cjs +0 -164
- package/dist/lib/model/component/node.d.ts +0 -45
- package/dist/lib/model/component/path.cjs +0 -47
- package/dist/lib/model/component/path.d.ts +0 -19
- package/dist/lib/model/equation/line.cjs +0 -76
- package/dist/lib/model/equation/line.d.ts +0 -21
- package/dist/lib/model/geometry/point/DescartesPoint.cjs +0 -50
- package/dist/lib/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/lib/model/geometry/point/PolarPoint.cjs +0 -27
- package/dist/lib/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.cjs +0 -338
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.cjs +0 -13
- package/dist/lib/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.cjs +0 -88
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.cjs +0 -6
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.cjs +0 -8
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.cjs +0 -39
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.cjs +0 -41
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.cjs +0 -19
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.cjs +0 -10
- package/dist/lib/test.d.ts +0 -1
- package/dist/lib/types/coordinate/descartes.d.ts +0 -23
- package/dist/lib/types/coordinate/index.d.ts +0 -5
- package/dist/lib/types/coordinate/polar.d.ts +0 -5
- package/dist/lib/types/distance/index.d.ts +0 -8
- package/dist/lib/types/distance/sep.d.ts +0 -9
- package/dist/lib/types/shape/index.cjs +0 -9
- package/dist/lib/types/shape/index.d.ts +0 -8
- package/dist/lib/types/shape/rect.cjs +0 -30
- package/dist/lib/types/shape/rect.d.ts +0 -25
- package/dist/lib/types/svg/font.d.ts +0 -10
- package/dist/lib/types/svg/stroke.d.ts +0 -10
- package/dist/lib/types/tikz/index.d.ts +0 -6
- package/dist/lib/utils/compare.cjs +0 -20
- package/dist/lib/utils/compare.d.ts +0 -4
- package/dist/lib/utils/css.cjs +0 -26
- package/dist/lib/utils/css.d.ts +0 -6
- package/dist/lib/utils/math.cjs +0 -26
- package/dist/lib/utils/math.d.ts +0 -9
- package/dist/lib/utils/string.cjs +0 -7
- package/dist/lib/utils/string.d.ts +0 -7
- package/dist/lib/utils/style/font.cjs +0 -34
- package/dist/lib/utils/style/font.d.ts +0 -17
- package/dist/lib/utils/style/stroke.cjs +0 -42
- package/dist/lib/utils/style/stroke.d.ts +0 -20
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ChildSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"node">;
|
|
4
|
+
id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>]>;
|
|
6
|
+
rotate: z.ZodOptional<z.ZodNumber>;
|
|
7
|
+
text: z.ZodOptional<z.ZodString>;
|
|
8
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
9
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
10
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
12
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
type: "node";
|
|
16
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
17
|
+
fill?: string | undefined;
|
|
18
|
+
stroke?: string | undefined;
|
|
19
|
+
strokeWidth?: number | undefined;
|
|
20
|
+
id?: string | undefined;
|
|
21
|
+
rotate?: number | undefined;
|
|
22
|
+
text?: string | undefined;
|
|
23
|
+
padding?: number | undefined;
|
|
24
|
+
margin?: number | undefined;
|
|
25
|
+
fontSize?: number | undefined;
|
|
26
|
+
}, {
|
|
27
|
+
type: "node";
|
|
28
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
29
|
+
fill?: string | undefined;
|
|
30
|
+
stroke?: string | undefined;
|
|
31
|
+
strokeWidth?: number | undefined;
|
|
32
|
+
id?: string | undefined;
|
|
33
|
+
rotate?: number | undefined;
|
|
34
|
+
text?: string | undefined;
|
|
35
|
+
padding?: number | undefined;
|
|
36
|
+
margin?: number | undefined;
|
|
37
|
+
fontSize?: number | undefined;
|
|
38
|
+
}>, z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"path">;
|
|
40
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
41
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
strokeDasharray: z.ZodOptional<z.ZodString>;
|
|
43
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
44
|
+
type: z.ZodLiteral<"step">;
|
|
45
|
+
kind: z.ZodLiteral<"move">;
|
|
46
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
type: "step";
|
|
49
|
+
kind: "move";
|
|
50
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
51
|
+
}, {
|
|
52
|
+
type: "step";
|
|
53
|
+
kind: "move";
|
|
54
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
55
|
+
}>, z.ZodObject<{
|
|
56
|
+
type: z.ZodLiteral<"step">;
|
|
57
|
+
kind: z.ZodLiteral<"line">;
|
|
58
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
59
|
+
}, "strip", z.ZodTypeAny, {
|
|
60
|
+
type: "step";
|
|
61
|
+
kind: "line";
|
|
62
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
63
|
+
}, {
|
|
64
|
+
type: "step";
|
|
65
|
+
kind: "line";
|
|
66
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
67
|
+
}>]>, "many">;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
type: "path";
|
|
70
|
+
children: ({
|
|
71
|
+
type: "step";
|
|
72
|
+
kind: "move";
|
|
73
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
74
|
+
} | {
|
|
75
|
+
type: "step";
|
|
76
|
+
kind: "line";
|
|
77
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
78
|
+
})[];
|
|
79
|
+
stroke?: string | undefined;
|
|
80
|
+
strokeWidth?: number | undefined;
|
|
81
|
+
strokeDasharray?: string | undefined;
|
|
82
|
+
}, {
|
|
83
|
+
type: "path";
|
|
84
|
+
children: ({
|
|
85
|
+
type: "step";
|
|
86
|
+
kind: "move";
|
|
87
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
88
|
+
} | {
|
|
89
|
+
type: "step";
|
|
90
|
+
kind: "line";
|
|
91
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
92
|
+
})[];
|
|
93
|
+
stroke?: string | undefined;
|
|
94
|
+
strokeWidth?: number | undefined;
|
|
95
|
+
strokeDasharray?: string | undefined;
|
|
96
|
+
}>]>;
|
|
97
|
+
/** 顶层 Scene 的子节点:node 或 path */
|
|
98
|
+
export type IRChild = z.infer<typeof ChildSchema>;
|
|
99
|
+
export declare const SceneSchema: z.ZodObject<{
|
|
100
|
+
version: z.ZodLiteral<1>;
|
|
101
|
+
type: z.ZodLiteral<"scene">;
|
|
102
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
103
|
+
type: z.ZodLiteral<"node">;
|
|
104
|
+
id: z.ZodOptional<z.ZodString>;
|
|
105
|
+
position: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>]>;
|
|
106
|
+
rotate: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
text: z.ZodOptional<z.ZodString>;
|
|
108
|
+
fill: z.ZodOptional<z.ZodString>;
|
|
109
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
110
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
padding: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
margin: z.ZodOptional<z.ZodNumber>;
|
|
113
|
+
fontSize: z.ZodOptional<z.ZodNumber>;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
type: "node";
|
|
116
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
117
|
+
fill?: string | undefined;
|
|
118
|
+
stroke?: string | undefined;
|
|
119
|
+
strokeWidth?: number | undefined;
|
|
120
|
+
id?: string | undefined;
|
|
121
|
+
rotate?: number | undefined;
|
|
122
|
+
text?: string | undefined;
|
|
123
|
+
padding?: number | undefined;
|
|
124
|
+
margin?: number | undefined;
|
|
125
|
+
fontSize?: number | undefined;
|
|
126
|
+
}, {
|
|
127
|
+
type: "node";
|
|
128
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
129
|
+
fill?: string | undefined;
|
|
130
|
+
stroke?: string | undefined;
|
|
131
|
+
strokeWidth?: number | undefined;
|
|
132
|
+
id?: string | undefined;
|
|
133
|
+
rotate?: number | undefined;
|
|
134
|
+
text?: string | undefined;
|
|
135
|
+
padding?: number | undefined;
|
|
136
|
+
margin?: number | undefined;
|
|
137
|
+
fontSize?: number | undefined;
|
|
138
|
+
}>, z.ZodObject<{
|
|
139
|
+
type: z.ZodLiteral<"path">;
|
|
140
|
+
stroke: z.ZodOptional<z.ZodString>;
|
|
141
|
+
strokeWidth: z.ZodOptional<z.ZodNumber>;
|
|
142
|
+
strokeDasharray: z.ZodOptional<z.ZodString>;
|
|
143
|
+
children: z.ZodArray<z.ZodDiscriminatedUnion<"kind", [z.ZodObject<{
|
|
144
|
+
type: z.ZodLiteral<"step">;
|
|
145
|
+
kind: z.ZodLiteral<"move">;
|
|
146
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
147
|
+
}, "strip", z.ZodTypeAny, {
|
|
148
|
+
type: "step";
|
|
149
|
+
kind: "move";
|
|
150
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
151
|
+
}, {
|
|
152
|
+
type: "step";
|
|
153
|
+
kind: "move";
|
|
154
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
155
|
+
}>, z.ZodObject<{
|
|
156
|
+
type: z.ZodLiteral<"step">;
|
|
157
|
+
kind: z.ZodLiteral<"line">;
|
|
158
|
+
to: z.ZodUnion<[z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>, z.ZodType<import('./position').PolarPosition, z.ZodTypeDef, import('./position').PolarPosition>, z.ZodString]>;
|
|
159
|
+
}, "strip", z.ZodTypeAny, {
|
|
160
|
+
type: "step";
|
|
161
|
+
kind: "line";
|
|
162
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
163
|
+
}, {
|
|
164
|
+
type: "step";
|
|
165
|
+
kind: "line";
|
|
166
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
167
|
+
}>]>, "many">;
|
|
168
|
+
}, "strip", z.ZodTypeAny, {
|
|
169
|
+
type: "path";
|
|
170
|
+
children: ({
|
|
171
|
+
type: "step";
|
|
172
|
+
kind: "move";
|
|
173
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
174
|
+
} | {
|
|
175
|
+
type: "step";
|
|
176
|
+
kind: "line";
|
|
177
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
178
|
+
})[];
|
|
179
|
+
stroke?: string | undefined;
|
|
180
|
+
strokeWidth?: number | undefined;
|
|
181
|
+
strokeDasharray?: string | undefined;
|
|
182
|
+
}, {
|
|
183
|
+
type: "path";
|
|
184
|
+
children: ({
|
|
185
|
+
type: "step";
|
|
186
|
+
kind: "move";
|
|
187
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
188
|
+
} | {
|
|
189
|
+
type: "step";
|
|
190
|
+
kind: "line";
|
|
191
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
192
|
+
})[];
|
|
193
|
+
stroke?: string | undefined;
|
|
194
|
+
strokeWidth?: number | undefined;
|
|
195
|
+
strokeDasharray?: string | undefined;
|
|
196
|
+
}>]>, "many">;
|
|
197
|
+
}, "strip", z.ZodTypeAny, {
|
|
198
|
+
type: "scene";
|
|
199
|
+
children: ({
|
|
200
|
+
type: "path";
|
|
201
|
+
children: ({
|
|
202
|
+
type: "step";
|
|
203
|
+
kind: "move";
|
|
204
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
205
|
+
} | {
|
|
206
|
+
type: "step";
|
|
207
|
+
kind: "line";
|
|
208
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
209
|
+
})[];
|
|
210
|
+
stroke?: string | undefined;
|
|
211
|
+
strokeWidth?: number | undefined;
|
|
212
|
+
strokeDasharray?: string | undefined;
|
|
213
|
+
} | {
|
|
214
|
+
type: "node";
|
|
215
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
216
|
+
fill?: string | undefined;
|
|
217
|
+
stroke?: string | undefined;
|
|
218
|
+
strokeWidth?: number | undefined;
|
|
219
|
+
id?: string | undefined;
|
|
220
|
+
rotate?: number | undefined;
|
|
221
|
+
text?: string | undefined;
|
|
222
|
+
padding?: number | undefined;
|
|
223
|
+
margin?: number | undefined;
|
|
224
|
+
fontSize?: number | undefined;
|
|
225
|
+
})[];
|
|
226
|
+
version: 1;
|
|
227
|
+
}, {
|
|
228
|
+
type: "scene";
|
|
229
|
+
children: ({
|
|
230
|
+
type: "path";
|
|
231
|
+
children: ({
|
|
232
|
+
type: "step";
|
|
233
|
+
kind: "move";
|
|
234
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
235
|
+
} | {
|
|
236
|
+
type: "step";
|
|
237
|
+
kind: "line";
|
|
238
|
+
to: string | [number, number] | import('./position').PolarPosition;
|
|
239
|
+
})[];
|
|
240
|
+
stroke?: string | undefined;
|
|
241
|
+
strokeWidth?: number | undefined;
|
|
242
|
+
strokeDasharray?: string | undefined;
|
|
243
|
+
} | {
|
|
244
|
+
type: "node";
|
|
245
|
+
position: [number, number] | import('./position').PolarPosition;
|
|
246
|
+
fill?: string | undefined;
|
|
247
|
+
stroke?: string | undefined;
|
|
248
|
+
strokeWidth?: number | undefined;
|
|
249
|
+
id?: string | undefined;
|
|
250
|
+
rotate?: number | undefined;
|
|
251
|
+
text?: string | undefined;
|
|
252
|
+
padding?: number | undefined;
|
|
253
|
+
margin?: number | undefined;
|
|
254
|
+
fontSize?: number | undefined;
|
|
255
|
+
})[];
|
|
256
|
+
version: 1;
|
|
257
|
+
}>;
|
|
258
|
+
/** retikz IR 顶层 Scene——可序列化 JSON 形式的绘制描述 */
|
|
259
|
+
export type IR = z.infer<typeof SceneSchema>;
|
|
260
|
+
/** IR 当前主版本号;只在 schema 出现破坏性变更时递增 */
|
|
261
|
+
export declare const CURRENT_IR_VERSION: 1;
|
|
262
|
+
//# sourceMappingURL=scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/ir/scene.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAIrB,CAAC;AAEJ,gCAAgC;AAChC,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAElD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkBrB,CAAC;AAEJ,4CAA4C;AAC5C,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE7C,qCAAqC;AACrC,eAAO,MAAM,kBAAkB,EAAG,CAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/parsers/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/parsers/parseWay.ts
|
|
2
|
+
/**
|
|
3
|
+
* 把 way 数组翻译为 IRStep 序列。
|
|
4
|
+
* 第一个元素永远是 move;之后的默认是 line。
|
|
5
|
+
*
|
|
6
|
+
* 这是纯函数,住在 core,被各框架 adapter 的 Sugar 组件复用。
|
|
7
|
+
*
|
|
8
|
+
* 类型校验由 TS 编译期完成;本函数不做运行时类型守卫。
|
|
9
|
+
*/
|
|
10
|
+
var parseWay = (way) => {
|
|
11
|
+
if (way.length < 2) throw new Error("parseWay: way must contain at least 2 items");
|
|
12
|
+
const out = [];
|
|
13
|
+
const moveStep = {
|
|
14
|
+
type: "step",
|
|
15
|
+
kind: "move",
|
|
16
|
+
to: way[0]
|
|
17
|
+
};
|
|
18
|
+
out.push(moveStep);
|
|
19
|
+
for (let i = 1; i < way.length; i++) {
|
|
20
|
+
const lineStep = {
|
|
21
|
+
type: "step",
|
|
22
|
+
kind: "line",
|
|
23
|
+
to: way[i]
|
|
24
|
+
};
|
|
25
|
+
out.push(lineStep);
|
|
26
|
+
}
|
|
27
|
+
return out;
|
|
28
|
+
};
|
|
29
|
+
//#endregion
|
|
30
|
+
exports.parseWay = parseWay;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { IRStep, IRTarget } from '../ir';
|
|
2
|
+
/**
|
|
3
|
+
* Sugar 层的 way 数组 DSL 元素。
|
|
4
|
+
*
|
|
5
|
+
* v0.1.0-alpha 接受三种形态(与 `IRTarget` 等价):
|
|
6
|
+
* - 节点 id 字符串:`'A'`
|
|
7
|
+
* - 直接笛卡尔坐标:`[x, y]`
|
|
8
|
+
* - 极坐标:`{ origin?, angle, radius }`
|
|
9
|
+
*
|
|
10
|
+
* 后续会加:折角对象(`{ via: '-|' }`)、相对位移(`{ rel: [x, y] }`)、
|
|
11
|
+
* curve / cubic / 'close' 等——届时 WayItem 与 IRTarget 才会出现真正分歧。
|
|
12
|
+
*/
|
|
13
|
+
export type WayItem = IRTarget;
|
|
14
|
+
/** way DSL 数组:sugar `<Draw way={...}>` 接受的输入形态 */
|
|
15
|
+
export type WayDSL = Array<WayItem>;
|
|
16
|
+
/**
|
|
17
|
+
* 把 way 数组翻译为 IRStep 序列。
|
|
18
|
+
* 第一个元素永远是 move;之后的默认是 line。
|
|
19
|
+
*
|
|
20
|
+
* 这是纯函数,住在 core,被各框架 adapter 的 Sugar 组件复用。
|
|
21
|
+
*
|
|
22
|
+
* 类型校验由 TS 编译期完成;本函数不做运行时类型守卫。
|
|
23
|
+
*/
|
|
24
|
+
export declare const parseWay: (way: WayDSL) => Array<IRStep>;
|
|
25
|
+
//# sourceMappingURL=parseWay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseWay.d.ts","sourceRoot":"","sources":["../../../src/parsers/parseWay.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA0B,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEtE;;;;;;;;;;GAUG;AACH,MAAM,MAAM,OAAO,GAAG,QAAQ,CAAC;AAE/B,kDAAkD;AAClD,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;AAEpC;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,KAAK,MAAM,KAAG,KAAK,CAAC,MAAM,CAYlD,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ScenePrimitive } from './scene';
|
|
2
|
+
/** 编组:把若干 primitive 用 transform 包起来 */
|
|
3
|
+
export type GroupPrim = {
|
|
4
|
+
/** 类型判别符 */
|
|
5
|
+
type: 'group';
|
|
6
|
+
/** SVG transform 字符串(translate / rotate / scale 等) */
|
|
7
|
+
transform?: string;
|
|
8
|
+
/** 组内子原语 */
|
|
9
|
+
children: Array<ScenePrimitive>;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=group.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group.d.ts","sourceRoot":"","sources":["../../../src/primitive/group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,uCAAuC;AACvC,MAAM,MAAM,SAAS,GAAG;IACtB,YAAY;IACZ,IAAI,EAAE,OAAO,CAAC;IACd,sDAAsD;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY;IACZ,QAAQ,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACjC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitive/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** 路径原语:SVG path d 字符串;Canvas/PDF renderer 自行解析 */
|
|
2
|
+
export type PathPrim = {
|
|
3
|
+
/** 类型判别符 */
|
|
4
|
+
type: 'path';
|
|
5
|
+
/** SVG path d 字符串 */
|
|
6
|
+
d: string;
|
|
7
|
+
/** 填充色;不填表示不填充 */
|
|
8
|
+
fill?: string;
|
|
9
|
+
/** 描边色 */
|
|
10
|
+
stroke?: string;
|
|
11
|
+
/** 描边宽度 */
|
|
12
|
+
strokeWidth?: number;
|
|
13
|
+
/** SVG stroke-dasharray 模式 */
|
|
14
|
+
strokeDasharray?: string;
|
|
15
|
+
/** 端点形状 */
|
|
16
|
+
strokeLinecap?: 'butt' | 'round' | 'square';
|
|
17
|
+
/** 拐点形状 */
|
|
18
|
+
strokeLinejoin?: 'miter' | 'round' | 'bevel';
|
|
19
|
+
/** 整体透明度 0~1 */
|
|
20
|
+
opacity?: number;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/primitive/path.ts"],"names":[],"mappings":"AAAA,mDAAmD;AACnD,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,CAAC,EAAE,MAAM,CAAC;IACV,kBAAkB;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW;IACX,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC5C,WAAW;IACX,cAAc,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAC7C,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** 矩形原语 */
|
|
2
|
+
export type RectPrim = {
|
|
3
|
+
/** 类型判别符 */
|
|
4
|
+
type: 'rect';
|
|
5
|
+
/** 左上角横坐标 */
|
|
6
|
+
x: number;
|
|
7
|
+
/** 左上角纵坐标 */
|
|
8
|
+
y: number;
|
|
9
|
+
/** 矩形宽度 */
|
|
10
|
+
width: number;
|
|
11
|
+
/** 矩形高度 */
|
|
12
|
+
height: number;
|
|
13
|
+
/** 填充色,CSS 颜色字符串 */
|
|
14
|
+
fill?: string;
|
|
15
|
+
/** 填充透明度 0~1 */
|
|
16
|
+
fillOpacity?: number;
|
|
17
|
+
/** 描边色 */
|
|
18
|
+
stroke?: string;
|
|
19
|
+
/** 描边宽度 */
|
|
20
|
+
strokeWidth?: number;
|
|
21
|
+
/** SVG stroke-dasharray 模式 */
|
|
22
|
+
strokeDasharray?: string;
|
|
23
|
+
/** 圆角半径(同时作用于 rx/ry) */
|
|
24
|
+
cornerRadius?: number;
|
|
25
|
+
/** 整体透明度 0~1 */
|
|
26
|
+
opacity?: number;
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=rect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../src/primitive/rect.ts"],"names":[],"mappings":"AAAA,WAAW;AACX,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,aAAa;IACb,CAAC,EAAE,MAAM,CAAC;IACV,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW;IACX,MAAM,EAAE,MAAM,CAAC;IACf,oBAAoB;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU;IACV,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,wBAAwB;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GroupPrim } from './group';
|
|
2
|
+
import { PathPrim } from './path';
|
|
3
|
+
import { RectPrim } from './rect';
|
|
4
|
+
import { TextPrim } from './text';
|
|
5
|
+
import { ViewBox } from './view-box';
|
|
6
|
+
/**
|
|
7
|
+
* Scene primitive:渲染目标无关的最大公约子集。
|
|
8
|
+
* 所有 adapter(SVG / Canvas / PDF / Skia)都应能消费这些原语。
|
|
9
|
+
*
|
|
10
|
+
* 不允许出现 SVG-only 或 Canvas-only 特性(filter、marker、imageData 等)。
|
|
11
|
+
*/
|
|
12
|
+
export type ScenePrimitive = RectPrim | TextPrim | PathPrim | GroupPrim;
|
|
13
|
+
/** 场景:渲染目标无关的"已布局好的图元集合 + viewBox" */
|
|
14
|
+
export type Scene = {
|
|
15
|
+
/** 已布局好的图元数组,按渲染顺序排列 */
|
|
16
|
+
primitives: Array<ScenePrimitive>;
|
|
17
|
+
/** 整个场景的视口范围 */
|
|
18
|
+
viewBox: ViewBox;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=scene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scene.d.ts","sourceRoot":"","sources":["../../../src/primitive/scene.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAExE,sCAAsC;AACtC,MAAM,MAAM,KAAK,GAAG;IAClB,wBAAwB;IACxB,UAAU,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAClC,gBAAgB;IAChB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** 文本原语;measuredWidth/Height 由 Scene 编译阶段算好,下游直接信任 */
|
|
2
|
+
export type TextPrim = {
|
|
3
|
+
/** 类型判别符 */
|
|
4
|
+
type: 'text';
|
|
5
|
+
/** 锚点横坐标(具体含义由 align 决定) */
|
|
6
|
+
x: number;
|
|
7
|
+
/** 锚点纵坐标(具体含义由 baseline 决定) */
|
|
8
|
+
y: number;
|
|
9
|
+
/** 文本内容 */
|
|
10
|
+
content: string;
|
|
11
|
+
/** 字号 */
|
|
12
|
+
fontSize: number;
|
|
13
|
+
/** 字体族 */
|
|
14
|
+
fontFamily?: string;
|
|
15
|
+
/** 字重 */
|
|
16
|
+
fontWeight?: string | number;
|
|
17
|
+
/** 字形 */
|
|
18
|
+
fontStyle?: 'normal' | 'italic';
|
|
19
|
+
/** 水平对齐:start / middle / end 锚点位置 */
|
|
20
|
+
align: 'start' | 'middle' | 'end';
|
|
21
|
+
/** 垂直基线对齐方式 */
|
|
22
|
+
baseline: 'top' | 'middle' | 'bottom' | 'alphabetic';
|
|
23
|
+
/** 编译期算好的文字宽度(user units) */
|
|
24
|
+
measuredWidth: number;
|
|
25
|
+
/** 编译期算好的文字高度(user units) */
|
|
26
|
+
measuredHeight: number;
|
|
27
|
+
/** 文字颜色 */
|
|
28
|
+
fill?: string;
|
|
29
|
+
/** 整体透明度 0~1 */
|
|
30
|
+
opacity?: number;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/primitive/text.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,MAAM,MAAM,QAAQ,GAAG;IACrB,YAAY;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,CAAC,EAAE,MAAM,CAAC;IACV,+BAA+B;IAC/B,CAAC,EAAE,MAAM,CAAC;IACV,WAAW;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS;IACT,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU;IACV,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS;IACT,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,SAAS;IACT,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAChC,qCAAqC;IACrC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClC,eAAe;IACf,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;IACrD,6BAA6B;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-box.d.ts","sourceRoot":"","sources":["../../../src/primitive/view-box.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,MAAM,MAAM,OAAO,GAAG;IACpB,eAAe;IACf,CAAC,EAAE,MAAM,CAAC;IACV,eAAe;IACf,CAAC,EAAE,MAAM,CAAC;IACV,WAAW;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW;IACX,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@retikz/core",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "retikz v0.1 core: framework-agnostic IR, scene compiler, and pure parsers.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"homepage": "https://pionpill.github.io/retikz
|
|
6
|
+
"homepage": "https://pionpill.github.io/retikz/",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"react",
|
|
9
9
|
"tikz",
|
|
@@ -11,48 +11,40 @@
|
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
13
|
"repository": "https://github.com/Pionpill/retikz",
|
|
14
|
+
"sideEffects": false,
|
|
14
15
|
"main": "dist/lib/index.cjs",
|
|
15
16
|
"module": "dist/es/index.js",
|
|
16
17
|
"types": "dist/lib/index.d.ts",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"types": "./dist/lib/index.d.ts",
|
|
21
|
+
"import": "./dist/es/index.js",
|
|
22
|
+
"require": "./dist/lib/index.cjs",
|
|
23
|
+
"default": "./dist/es/index.js"
|
|
24
|
+
}
|
|
19
25
|
},
|
|
20
26
|
"files": [
|
|
21
27
|
"LICENSE",
|
|
22
28
|
"README.md",
|
|
23
29
|
"dist/**/*"
|
|
24
30
|
],
|
|
25
|
-
"peerDependencies": {
|
|
26
|
-
"react": ">=18",
|
|
27
|
-
"react-dom": ">=18"
|
|
28
|
-
},
|
|
29
31
|
"dependencies": {
|
|
30
|
-
"
|
|
31
|
-
"d3-shape": "^3.2.0",
|
|
32
|
-
"react": "~18.3",
|
|
33
|
-
"react-dom": "~18.3"
|
|
32
|
+
"zod": "^3.23.8"
|
|
34
33
|
},
|
|
35
34
|
"devDependencies": {
|
|
36
|
-
"@
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"@vitejs/plugin-react": "^4.3.4",
|
|
43
|
-
"eslint": "^9.15.0",
|
|
44
|
-
"eslint-plugin-react-hooks": "^5.0.0",
|
|
45
|
-
"eslint-plugin-react-refresh": "^0.4.14",
|
|
46
|
-
"globals": "^15.12.0",
|
|
47
|
-
"typescript": "~5.6.2",
|
|
48
|
-
"typescript-eslint": "^8.15.0",
|
|
49
|
-
"vite": "^6.0.1",
|
|
50
|
-
"vite-plugin-dts": "^4.5.0"
|
|
35
|
+
"@types/node": "^25.6.0",
|
|
36
|
+
"typescript": "^6.0.3",
|
|
37
|
+
"vite": "^8.0.10",
|
|
38
|
+
"vite-plugin-dts": "^4.5.4",
|
|
39
|
+
"vite-tsconfig-paths": "^6.1.1",
|
|
40
|
+
"vitest": "^4.1.5"
|
|
51
41
|
},
|
|
52
42
|
"scripts": {
|
|
53
43
|
"dev": "vite",
|
|
54
44
|
"build": "vite build",
|
|
55
45
|
"lint": "eslint .",
|
|
56
|
-
"preview": "vite preview"
|
|
46
|
+
"preview": "vite preview",
|
|
47
|
+
"test": "vitest",
|
|
48
|
+
"test:run": "vitest run"
|
|
57
49
|
}
|
|
58
50
|
}
|
package/README.md
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { ScopeProps as ScopeContextProps } from '../hooks/context/useScope';
|
|
3
|
-
import { GroupProps } from '../container/Group';
|
|
4
|
-
export type ScopeProps = ScopeContextProps & Omit<GroupProps, 'offset'>;
|
|
5
|
-
declare const Scope: import('react').ForwardRefExoticComponent<Omit<PropsWithChildren<ScopeProps>, "ref"> & import('react').RefAttributes<SVGGElement>>;
|
|
6
|
-
export default Scope;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import useScope, { ScopeContext } from "../hooks/context/useScope.js";
|
|
4
|
-
import Group from "../container/Group.js";
|
|
5
|
-
const Scope = forwardRef((props, ref) => {
|
|
6
|
-
const { children, ...resProps } = props;
|
|
7
|
-
const baseScopeValue = useScope();
|
|
8
|
-
return /* @__PURE__ */ jsx(ScopeContext.Provider, { value: { ...baseScopeValue, ...resProps }, children: /* @__PURE__ */ jsx(Group, { ref, children }) });
|
|
9
|
-
});
|
|
10
|
-
export {
|
|
11
|
-
Scope as default
|
|
12
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode } from 'react';
|
|
2
|
-
import { SurfaceProps } from '../container/Surface';
|
|
3
|
-
import { CalculateProps } from '../hooks/context/useCalculate';
|
|
4
|
-
import { ScopeProps } from '../hooks/context/useScope';
|
|
5
|
-
export type TikZProps = {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
} & Partial<CalculateProps> & ScopeProps & SurfaceProps;
|
|
8
|
-
declare const TikZ: FC<TikZProps>;
|
|
9
|
-
export default TikZ;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import Surface from "../container/Surface.js";
|
|
3
|
-
import { CalculateContext } from "../hooks/context/useCalculate.js";
|
|
4
|
-
import { NodesContext } from "../hooks/context/useNodes.js";
|
|
5
|
-
import { ScopeContext } from "../hooks/context/useScope.js";
|
|
6
|
-
const TikZ = (props) => {
|
|
7
|
-
const { precision = 2, offset, node, draw, ...resProps } = props;
|
|
8
|
-
return /* @__PURE__ */ jsx(NodesContext.Provider, { value: /* @__PURE__ */ new Map(), children: /* @__PURE__ */ jsx(CalculateContext.Provider, { value: { precision }, children: /* @__PURE__ */ jsx(ScopeContext.Provider, { value: { offset, node, draw }, children: /* @__PURE__ */ jsx(Surface, { ...resProps }) }) }) });
|
|
9
|
-
};
|
|
10
|
-
export {
|
|
11
|
-
TikZ as default
|
|
12
|
-
};
|