@retikz/core 0.0.1-rc.3 → 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 +26 -34
- package/README.md +0 -2
- package/dist/es/components/Scope.d.ts +0 -6
- package/dist/es/components/Scope.js +0 -12
- package/dist/es/components/TikZ.d.ts +0 -9
- package/dist/es/components/TikZ.js +0 -12
- package/dist/es/components/draw/Draw.d.ts +0 -26
- package/dist/es/components/draw/Draw.js +0 -59
- package/dist/es/components/draw/InnerDraw.d.ts +0 -17
- package/dist/es/components/draw/InnerDraw.js +0 -52
- package/dist/es/components/draw/arrow/circle.d.ts +0 -7
- package/dist/es/components/draw/arrow/circle.js +0 -20
- package/dist/es/components/draw/arrow/index.d.ts +0 -9
- package/dist/es/components/draw/arrow/index.js +0 -13
- package/dist/es/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/es/components/draw/arrow/stealth.js +0 -29
- package/dist/es/components/draw/arrow/types.d.ts +0 -21
- package/dist/es/components/draw/common.d.ts +0 -4
- package/dist/es/components/draw/common.js +0 -12
- package/dist/es/components/draw/index.d.ts +0 -3
- package/dist/es/components/draw/index.js +0 -4
- package/dist/es/components/draw/segment/Segment.d.ts +0 -12
- package/dist/es/components/draw/segment/Segment.js +0 -41
- package/dist/es/components/draw/segment/index.d.ts +0 -15
- package/dist/es/components/draw/segment/index.js +0 -41
- package/dist/es/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/es/components/draw/segment/useArrow.js +0 -52
- package/dist/es/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/es/components/draw/segment/useConvertWay.js +0 -117
- package/dist/es/components/draw/types.d.ts +0 -29
- package/dist/es/components/node/InnerNode.d.ts +0 -33
- package/dist/es/components/node/InnerNode.js +0 -88
- package/dist/es/components/node/Node.d.ts +0 -93
- package/dist/es/components/node/Node.js +0 -88
- package/dist/es/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/es/components/node/_hooks/useNodeConfig.js +0 -13
- package/dist/es/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeContent.js +0 -30
- package/dist/es/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeShape.js +0 -34
- package/dist/es/components/node/index.d.ts +0 -3
- package/dist/es/components/node/index.js +0 -4
- package/dist/es/components/path-node/PathNode.d.ts +0 -48
- package/dist/es/components/path-node/PathNode.js +0 -76
- package/dist/es/components/path-node/index.d.ts +0 -3
- package/dist/es/components/path-node/index.js +0 -4
- package/dist/es/components/path-node/useAnchor.d.ts +0 -6
- package/dist/es/components/path-node/useAnchor.js +0 -49
- package/dist/es/container/Group.d.ts +0 -6
- package/dist/es/container/Group.js +0 -8
- package/dist/es/container/Surface.d.ts +0 -19
- package/dist/es/container/Surface.js +0 -23
- package/dist/es/elements/Path.d.ts +0 -4
- package/dist/es/elements/Path.js +0 -14
- package/dist/es/elements/Rect.d.ts +0 -4
- package/dist/es/elements/Rect.js +0 -9
- package/dist/es/elements/Text.d.ts +0 -18
- package/dist/es/elements/Text.js +0 -35
- package/dist/es/hooks/context/useCalculate.d.ts +0 -7
- package/dist/es/hooks/context/useCalculate.js +0 -9
- package/dist/es/hooks/context/useNodes.d.ts +0 -9
- package/dist/es/hooks/context/useNodes.js +0 -33
- package/dist/es/hooks/context/usePath.d.ts +0 -13
- package/dist/es/hooks/context/usePath.js +0 -20
- package/dist/es/hooks/context/useScope.d.ts +0 -11
- package/dist/es/hooks/context/useScope.js +0 -7
- package/dist/es/hooks/useForceUpdate.d.ts +0 -2
- package/dist/es/hooks/useForceUpdate.js +0 -8
- package/dist/es/model/component/node.d.ts +0 -45
- package/dist/es/model/component/node.js +0 -164
- package/dist/es/model/component/path.d.ts +0 -19
- package/dist/es/model/component/path.js +0 -47
- package/dist/es/model/equation/line.d.ts +0 -21
- package/dist/es/model/equation/line.js +0 -76
- package/dist/es/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/es/model/geometry/point/DescartesPoint.js +0 -50
- package/dist/es/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/es/model/geometry/point/PolarPoint.js +0 -27
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +0 -338
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +0 -13
- package/dist/es/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js +0 -88
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js +0 -6
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js +0 -8
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js +0 -39
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js +0 -41
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js +0 -19
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js +0 -10
- package/dist/es/test.d.ts +0 -3
- package/dist/es/types/coordinate/descartes.d.ts +0 -23
- package/dist/es/types/coordinate/index.d.ts +0 -5
- package/dist/es/types/coordinate/polar.d.ts +0 -5
- package/dist/es/types/distance/index.d.ts +0 -8
- package/dist/es/types/distance/sep.d.ts +0 -9
- package/dist/es/types/shape/index.d.ts +0 -8
- package/dist/es/types/shape/index.js +0 -9
- package/dist/es/types/shape/rect.d.ts +0 -25
- package/dist/es/types/shape/rect.js +0 -30
- package/dist/es/types/svg/font.d.ts +0 -10
- package/dist/es/types/svg/stroke.d.ts +0 -10
- package/dist/es/types/tikz/index.d.ts +0 -6
- package/dist/es/utils/compare.d.ts +0 -4
- package/dist/es/utils/compare.js +0 -20
- package/dist/es/utils/css.d.ts +0 -6
- package/dist/es/utils/css.js +0 -26
- package/dist/es/utils/math.d.ts +0 -9
- package/dist/es/utils/math.js +0 -26
- package/dist/es/utils/string.d.ts +0 -7
- package/dist/es/utils/string.js +0 -7
- package/dist/es/utils/style/font.d.ts +0 -17
- package/dist/es/utils/style/font.js +0 -34
- package/dist/es/utils/style/stroke.d.ts +0 -20
- package/dist/es/utils/style/stroke.js +0 -42
- package/dist/lib/components/Scope.cjs +0 -12
- package/dist/lib/components/Scope.d.ts +0 -6
- package/dist/lib/components/TikZ.cjs +0 -12
- package/dist/lib/components/TikZ.d.ts +0 -9
- package/dist/lib/components/draw/Draw.cjs +0 -59
- package/dist/lib/components/draw/Draw.d.ts +0 -26
- package/dist/lib/components/draw/InnerDraw.cjs +0 -52
- package/dist/lib/components/draw/InnerDraw.d.ts +0 -17
- package/dist/lib/components/draw/arrow/circle.cjs +0 -20
- package/dist/lib/components/draw/arrow/circle.d.ts +0 -7
- package/dist/lib/components/draw/arrow/index.cjs +0 -13
- package/dist/lib/components/draw/arrow/index.d.ts +0 -9
- package/dist/lib/components/draw/arrow/stealth.cjs +0 -29
- package/dist/lib/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/lib/components/draw/arrow/types.d.ts +0 -21
- package/dist/lib/components/draw/common.cjs +0 -12
- package/dist/lib/components/draw/common.d.ts +0 -4
- package/dist/lib/components/draw/index.cjs +0 -4
- package/dist/lib/components/draw/index.d.ts +0 -3
- package/dist/lib/components/draw/segment/Segment.cjs +0 -41
- package/dist/lib/components/draw/segment/Segment.d.ts +0 -12
- package/dist/lib/components/draw/segment/index.cjs +0 -41
- package/dist/lib/components/draw/segment/index.d.ts +0 -15
- package/dist/lib/components/draw/segment/useArrow.cjs +0 -52
- package/dist/lib/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/lib/components/draw/segment/useConvertWay.cjs +0 -117
- package/dist/lib/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/lib/components/draw/types.d.ts +0 -29
- package/dist/lib/components/node/InnerNode.cjs +0 -88
- package/dist/lib/components/node/InnerNode.d.ts +0 -33
- package/dist/lib/components/node/Node.cjs +0 -88
- package/dist/lib/components/node/Node.d.ts +0 -93
- package/dist/lib/components/node/_hooks/useNodeConfig.cjs +0 -13
- package/dist/lib/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/lib/components/node/_hooks/useNodeContent.cjs +0 -30
- package/dist/lib/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/lib/components/node/_hooks/useNodeShape.cjs +0 -34
- package/dist/lib/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/lib/components/node/index.cjs +0 -4
- package/dist/lib/components/node/index.d.ts +0 -3
- package/dist/lib/components/path-node/PathNode.cjs +0 -76
- package/dist/lib/components/path-node/PathNode.d.ts +0 -48
- package/dist/lib/components/path-node/index.cjs +0 -4
- package/dist/lib/components/path-node/index.d.ts +0 -3
- package/dist/lib/components/path-node/useAnchor.cjs +0 -49
- package/dist/lib/components/path-node/useAnchor.d.ts +0 -6
- package/dist/lib/container/Group.cjs +0 -8
- package/dist/lib/container/Group.d.ts +0 -6
- package/dist/lib/container/Surface.cjs +0 -23
- package/dist/lib/container/Surface.d.ts +0 -19
- package/dist/lib/elements/Path.cjs +0 -14
- package/dist/lib/elements/Path.d.ts +0 -4
- package/dist/lib/elements/Rect.cjs +0 -9
- package/dist/lib/elements/Rect.d.ts +0 -4
- package/dist/lib/elements/Text.cjs +0 -35
- package/dist/lib/elements/Text.d.ts +0 -18
- package/dist/lib/hooks/context/useCalculate.cjs +0 -9
- package/dist/lib/hooks/context/useCalculate.d.ts +0 -7
- package/dist/lib/hooks/context/useNodes.cjs +0 -33
- package/dist/lib/hooks/context/useNodes.d.ts +0 -9
- package/dist/lib/hooks/context/usePath.cjs +0 -20
- package/dist/lib/hooks/context/usePath.d.ts +0 -13
- package/dist/lib/hooks/context/useScope.cjs +0 -7
- package/dist/lib/hooks/context/useScope.d.ts +0 -11
- package/dist/lib/hooks/useForceUpdate.cjs +0 -8
- package/dist/lib/hooks/useForceUpdate.d.ts +0 -2
- package/dist/lib/model/component/node.cjs +0 -164
- package/dist/lib/model/component/node.d.ts +0 -45
- package/dist/lib/model/component/path.cjs +0 -47
- package/dist/lib/model/component/path.d.ts +0 -19
- package/dist/lib/model/equation/line.cjs +0 -76
- package/dist/lib/model/equation/line.d.ts +0 -21
- package/dist/lib/model/geometry/point/DescartesPoint.cjs +0 -50
- package/dist/lib/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/lib/model/geometry/point/PolarPoint.cjs +0 -27
- package/dist/lib/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.cjs +0 -338
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.cjs +0 -13
- package/dist/lib/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.cjs +0 -88
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.cjs +0 -6
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.cjs +0 -8
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.cjs +0 -39
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.cjs +0 -41
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.cjs +0 -19
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.cjs +0 -10
- package/dist/lib/test.d.ts +0 -3
- package/dist/lib/types/coordinate/descartes.d.ts +0 -23
- package/dist/lib/types/coordinate/index.d.ts +0 -5
- package/dist/lib/types/coordinate/polar.d.ts +0 -5
- package/dist/lib/types/distance/index.d.ts +0 -8
- package/dist/lib/types/distance/sep.d.ts +0 -9
- package/dist/lib/types/shape/index.cjs +0 -9
- package/dist/lib/types/shape/index.d.ts +0 -8
- package/dist/lib/types/shape/rect.cjs +0 -30
- package/dist/lib/types/shape/rect.d.ts +0 -25
- package/dist/lib/types/svg/font.d.ts +0 -10
- package/dist/lib/types/svg/stroke.d.ts +0 -10
- package/dist/lib/types/tikz/index.d.ts +0 -6
- package/dist/lib/utils/compare.cjs +0 -20
- package/dist/lib/utils/compare.d.ts +0 -4
- package/dist/lib/utils/css.cjs +0 -26
- package/dist/lib/utils/css.d.ts +0 -6
- package/dist/lib/utils/math.cjs +0 -26
- package/dist/lib/utils/math.d.ts +0 -9
- package/dist/lib/utils/string.cjs +0 -7
- package/dist/lib/utils/string.d.ts +0 -7
- package/dist/lib/utils/style/font.cjs +0 -34
- package/dist/lib/utils/style/font.d.ts +0 -17
- package/dist/lib/utils/style/stroke.cjs +0 -42
- package/dist/lib/utils/style/stroke.d.ts +0 -20
|
@@ -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,14 @@
|
|
|
1
|
+
import { PathSchema } from "./path/path.js";
|
|
2
|
+
import { NodeSchema } from "./node.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/ir/scene.ts
|
|
5
|
+
var ChildSchema = z.discriminatedUnion("type", [NodeSchema, PathSchema]).describe("Top-level scene child: either a node or a path; discriminator field is `type`");
|
|
6
|
+
var SceneSchema = z.object({
|
|
7
|
+
version: z.literal(1).describe("IR major version number; bump only on breaking schema changes"),
|
|
8
|
+
type: z.literal("scene").describe("Discriminator marking this object as the root scene"),
|
|
9
|
+
children: z.array(ChildSchema).describe("Top-level children of the scene; nodes register ids that paths can reference")
|
|
10
|
+
}).describe("Top-level retikz IR scene — the canonical, JSON-serializable representation of a drawing");
|
|
11
|
+
/** IR 当前主版本号;只在 schema 出现破坏性变更时递增 */
|
|
12
|
+
var CURRENT_IR_VERSION = 1;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CURRENT_IR_VERSION, ChildSchema, SceneSchema };
|
|
@@ -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,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,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
|
+
export { parseWay };
|
|
@@ -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"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const require_rect = require("../geometry/rect.cjs");
|
|
2
|
+
const require_node = require("./node.cjs");
|
|
3
|
+
const require_path = require("./path.cjs");
|
|
4
|
+
const require_precision = require("./precision.cjs");
|
|
5
|
+
const require_text_metrics = require("./text-metrics.cjs");
|
|
6
|
+
const require_view_box = require("./view-box.cjs");
|
|
7
|
+
//#region src/compile/compile.ts
|
|
8
|
+
/**
|
|
9
|
+
* IR → Scene。纯函数。
|
|
10
|
+
* 这是所有 adapter 共享的最深层共享代码。
|
|
11
|
+
*
|
|
12
|
+
* 流程:
|
|
13
|
+
* 1. Pass 1:按 IR children 源码顺序处理 Node——计算 layout、注册 nodeIndex、发出 RectPrim/TextPrim、累积 bbox 角点
|
|
14
|
+
* 2. Pass 2:处理 Path——解析每个 step 端点(节点 ref 走 boundaryPoint,其他走 resolvePosition),写 d 字符串
|
|
15
|
+
* 3. 末端用 computeViewBox 折算最终 viewBox(按 precision 四舍五入)
|
|
16
|
+
*/
|
|
17
|
+
var compileToScene = (ir, options = {}) => {
|
|
18
|
+
const measureText = options.measureText ?? require_text_metrics.fallbackMeasurer;
|
|
19
|
+
const viewBoxPadding = options.padding ?? 10;
|
|
20
|
+
const round = require_precision.makeRound(options.precision ?? 2);
|
|
21
|
+
const primitives = [];
|
|
22
|
+
const nodeIndex = /* @__PURE__ */ new Map();
|
|
23
|
+
const allPoints = [];
|
|
24
|
+
for (const child of ir.children) if (child.type === "node") {
|
|
25
|
+
const layout = require_node.layoutNode(child, measureText, nodeIndex);
|
|
26
|
+
if (child.id) nodeIndex.set(child.id, layout);
|
|
27
|
+
for (const prim of require_node.emitNodePrimitives(layout, round)) primitives.push(prim);
|
|
28
|
+
allPoints.push(require_rect.rect.anchor(layout.rect, "north-west"), require_rect.rect.anchor(layout.rect, "north-east"), require_rect.rect.anchor(layout.rect, "south-west"), require_rect.rect.anchor(layout.rect, "south-east"));
|
|
29
|
+
}
|
|
30
|
+
for (const child of ir.children) if (child.type === "path") {
|
|
31
|
+
const result = require_path.emitPathPrimitive(child, nodeIndex, round);
|
|
32
|
+
if (result) {
|
|
33
|
+
primitives.push(result.primitive);
|
|
34
|
+
for (const p of result.points) allPoints.push(p);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
primitives,
|
|
39
|
+
viewBox: require_view_box.computeViewBox(allPoints, viewBoxPadding, round)
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
//#endregion
|
|
43
|
+
exports.compileToScene = compileToScene;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IR } from '../ir';
|
|
2
|
+
import { Scene } from '../primitive';
|
|
3
|
+
import { TextMeasurer } from './text-metrics';
|
|
4
|
+
/** compileToScene 的可选参数 */
|
|
5
|
+
export type CompileOptions = {
|
|
6
|
+
/** 注入文字度量函数;不传则用 fallback(不准但可跑) */
|
|
7
|
+
measureText?: TextMeasurer;
|
|
8
|
+
/** viewBox 周围的留白(user units),默认 10 */
|
|
9
|
+
padding?: number;
|
|
10
|
+
/**
|
|
11
|
+
* 输出坐标的小数位精度;默认 2(保留 2 位小数四舍五入)。
|
|
12
|
+
* 仅在写入 Scene primitive / path d 字符串 / viewBox 时生效;
|
|
13
|
+
* 内部几何计算保持完整 double 精度,避免误差累积。
|
|
14
|
+
*/
|
|
15
|
+
precision?: number;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* IR → Scene。纯函数。
|
|
19
|
+
* 这是所有 adapter 共享的最深层共享代码。
|
|
20
|
+
*
|
|
21
|
+
* 流程:
|
|
22
|
+
* 1. Pass 1:按 IR children 源码顺序处理 Node——计算 layout、注册 nodeIndex、发出 RectPrim/TextPrim、累积 bbox 角点
|
|
23
|
+
* 2. Pass 2:处理 Path——解析每个 step 端点(节点 ref 走 boundaryPoint,其他走 resolvePosition),写 d 字符串
|
|
24
|
+
* 3. 末端用 computeViewBox 折算最终 viewBox(按 precision 四舍五入)
|
|
25
|
+
*/
|
|
26
|
+
export declare const compileToScene: (ir: IR, options?: CompileOptions) => Scene;
|
|
27
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,KAAK,EAAkB,MAAM,cAAc,CAAC;AAI1D,OAAO,EAAE,KAAK,YAAY,EAAoB,MAAM,gBAAgB,CAAC;AAGrE,2BAA2B;AAC3B,MAAM,MAAM,cAAc,GAAG;IAC3B,oCAAoC;IACpC,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,IAAI,EAAE,EAAE,UAAS,cAAmB,KAAG,KA2CrE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compile/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|