@retikz/core 0.0.1-rc.2 → 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/dist/es/compile/compile.d.ts +27 -0
- package/dist/es/compile/compile.d.ts.map +1 -0
- package/dist/es/compile/compile.js +43 -0
- package/dist/es/compile/index.d.ts +8 -0
- package/dist/es/compile/index.d.ts.map +1 -0
- package/dist/es/compile/node.d.ts +51 -0
- package/dist/es/compile/node.d.ts.map +1 -0
- package/dist/es/compile/node.js +100 -0
- package/dist/es/compile/path.d.ts +19 -0
- package/dist/es/compile/path.d.ts.map +1 -0
- package/dist/es/compile/path.js +55 -0
- package/dist/es/compile/position.d.ts +9 -0
- package/dist/es/compile/position.d.ts.map +1 -0
- package/dist/es/compile/position.js +24 -0
- package/dist/es/compile/precision.d.ts +5 -0
- package/dist/es/compile/precision.d.ts.map +1 -0
- package/dist/es/compile/precision.js +8 -0
- package/dist/es/compile/text-metrics.d.ts +32 -0
- package/dist/es/compile/text-metrics.d.ts.map +1 -0
- package/dist/es/compile/text-metrics.js +8 -0
- package/dist/es/compile/view-box.d.ts +8 -0
- package/dist/es/compile/view-box.d.ts.map +1 -0
- package/dist/es/compile/view-box.js +31 -0
- package/dist/es/geometry/index.d.ts +4 -0
- package/dist/es/geometry/index.d.ts.map +1 -0
- package/dist/es/geometry/point.d.ts +25 -0
- package/dist/es/geometry/point.d.ts.map +1 -0
- package/dist/es/geometry/point.js +34 -0
- package/dist/es/geometry/polar.d.ts +44 -0
- package/dist/es/geometry/polar.d.ts.map +1 -0
- package/dist/es/geometry/polar.js +45 -0
- package/dist/es/geometry/rect.d.ts +59 -0
- package/dist/es/geometry/rect.d.ts.map +1 -0
- package/dist/es/geometry/rect.js +120 -0
- package/dist/es/index.d.ts +18 -10
- package/dist/es/index.d.ts.map +1 -0
- package/dist/es/index.js +14 -12
- package/dist/es/ir/index.d.ts +5 -0
- package/dist/es/ir/index.d.ts.map +1 -0
- package/dist/es/ir/node.d.ts +41 -0
- package/dist/es/ir/node.d.ts.map +1 -0
- package/dist/es/ir/node.js +19 -0
- package/dist/es/ir/path/index.d.ts +4 -0
- package/dist/es/ir/path/index.d.ts.map +1 -0
- package/dist/es/ir/path/path.d.ts +63 -0
- package/dist/es/ir/path/path.d.ts.map +1 -0
- package/dist/es/ir/path/path.js +12 -0
- package/dist/es/ir/path/step.d.ts +62 -0
- package/dist/es/ir/path/step.d.ts.map +1 -0
- package/dist/es/ir/path/step.js +16 -0
- package/dist/es/ir/path/target.d.ts +5 -0
- package/dist/es/ir/path/target.d.ts.map +1 -0
- package/dist/es/ir/path/target.js +11 -0
- package/dist/es/ir/position/index.d.ts +3 -0
- package/dist/es/ir/position/index.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.d.ts +9 -0
- package/dist/es/ir/position/polar-position.d.ts.map +1 -0
- package/dist/es/ir/position/polar-position.js +18 -0
- package/dist/es/ir/position/position.d.ts +5 -0
- package/dist/es/ir/position/position.d.ts.map +1 -0
- package/dist/es/ir/position/position.js +5 -0
- package/dist/es/ir/scene.d.ts +262 -0
- package/dist/es/ir/scene.d.ts.map +1 -0
- package/dist/es/ir/scene.js +14 -0
- package/dist/es/parsers/index.d.ts +2 -0
- package/dist/es/parsers/index.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.d.ts +25 -0
- package/dist/es/parsers/parseWay.d.ts.map +1 -0
- package/dist/es/parsers/parseWay.js +30 -0
- package/dist/es/primitive/group.d.ts +11 -0
- package/dist/es/primitive/group.d.ts.map +1 -0
- package/dist/es/primitive/index.d.ts +7 -0
- package/dist/es/primitive/index.d.ts.map +1 -0
- package/dist/es/primitive/path.d.ts +22 -0
- package/dist/es/primitive/path.d.ts.map +1 -0
- package/dist/es/primitive/rect.d.ts +28 -0
- package/dist/es/primitive/rect.d.ts.map +1 -0
- package/dist/es/primitive/scene.d.ts +20 -0
- package/dist/es/primitive/scene.d.ts.map +1 -0
- package/dist/es/primitive/text.d.ts +32 -0
- package/dist/es/primitive/text.d.ts.map +1 -0
- package/dist/es/primitive/view-box.d.ts +12 -0
- package/dist/es/primitive/view-box.d.ts.map +1 -0
- package/dist/lib/compile/compile.cjs +43 -0
- package/dist/lib/compile/compile.d.ts +27 -0
- package/dist/lib/compile/compile.d.ts.map +1 -0
- package/dist/lib/compile/index.d.ts +8 -0
- package/dist/lib/compile/index.d.ts.map +1 -0
- package/dist/lib/compile/node.cjs +102 -0
- package/dist/lib/compile/node.d.ts +51 -0
- package/dist/lib/compile/node.d.ts.map +1 -0
- package/dist/lib/compile/path.cjs +55 -0
- package/dist/lib/compile/path.d.ts +19 -0
- package/dist/lib/compile/path.d.ts.map +1 -0
- package/dist/lib/compile/position.cjs +24 -0
- package/dist/lib/compile/position.d.ts +9 -0
- package/dist/lib/compile/position.d.ts.map +1 -0
- package/dist/lib/compile/precision.cjs +8 -0
- package/dist/lib/compile/precision.d.ts +5 -0
- package/dist/lib/compile/precision.d.ts.map +1 -0
- package/dist/lib/compile/text-metrics.cjs +8 -0
- package/dist/lib/compile/text-metrics.d.ts +32 -0
- package/dist/lib/compile/text-metrics.d.ts.map +1 -0
- package/dist/lib/compile/view-box.cjs +31 -0
- package/dist/lib/compile/view-box.d.ts +8 -0
- package/dist/lib/compile/view-box.d.ts.map +1 -0
- package/dist/lib/geometry/index.d.ts +4 -0
- package/dist/lib/geometry/index.d.ts.map +1 -0
- package/dist/lib/geometry/point.cjs +34 -0
- package/dist/lib/geometry/point.d.ts +25 -0
- package/dist/lib/geometry/point.d.ts.map +1 -0
- package/dist/lib/geometry/polar.cjs +45 -0
- package/dist/lib/geometry/polar.d.ts +44 -0
- package/dist/lib/geometry/polar.d.ts.map +1 -0
- package/dist/lib/geometry/rect.cjs +121 -0
- package/dist/lib/geometry/rect.d.ts +59 -0
- package/dist/lib/geometry/rect.d.ts.map +1 -0
- package/dist/lib/index.cjs +31 -11
- package/dist/lib/index.d.ts +18 -10
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/ir/index.d.ts +5 -0
- package/dist/lib/ir/index.d.ts.map +1 -0
- package/dist/lib/ir/node.cjs +19 -0
- package/dist/lib/ir/node.d.ts +41 -0
- package/dist/lib/ir/node.d.ts.map +1 -0
- package/dist/lib/ir/path/index.d.ts +4 -0
- package/dist/lib/ir/path/index.d.ts.map +1 -0
- package/dist/lib/ir/path/path.cjs +12 -0
- package/dist/lib/ir/path/path.d.ts +63 -0
- package/dist/lib/ir/path/path.d.ts.map +1 -0
- package/dist/lib/ir/path/step.cjs +18 -0
- package/dist/lib/ir/path/step.d.ts +62 -0
- package/dist/lib/ir/path/step.d.ts.map +1 -0
- package/dist/lib/ir/path/target.cjs +11 -0
- package/dist/lib/ir/path/target.d.ts +5 -0
- package/dist/lib/ir/path/target.d.ts.map +1 -0
- package/dist/lib/ir/position/index.d.ts +3 -0
- package/dist/lib/ir/position/index.d.ts.map +1 -0
- package/dist/lib/ir/position/polar-position.cjs +18 -0
- package/dist/lib/ir/position/polar-position.d.ts +9 -0
- package/dist/lib/ir/position/polar-position.d.ts.map +1 -0
- package/dist/lib/ir/position/position.cjs +5 -0
- package/dist/lib/ir/position/position.d.ts +5 -0
- package/dist/lib/ir/position/position.d.ts.map +1 -0
- package/dist/lib/ir/scene.cjs +16 -0
- package/dist/lib/ir/scene.d.ts +262 -0
- package/dist/lib/ir/scene.d.ts.map +1 -0
- package/dist/lib/parsers/index.d.ts +2 -0
- package/dist/lib/parsers/index.d.ts.map +1 -0
- package/dist/lib/parsers/parseWay.cjs +30 -0
- package/dist/lib/parsers/parseWay.d.ts +25 -0
- package/dist/lib/parsers/parseWay.d.ts.map +1 -0
- package/dist/lib/primitive/group.d.ts +11 -0
- package/dist/lib/primitive/group.d.ts.map +1 -0
- package/dist/lib/primitive/index.d.ts +7 -0
- package/dist/lib/primitive/index.d.ts.map +1 -0
- package/dist/lib/primitive/path.d.ts +22 -0
- package/dist/lib/primitive/path.d.ts.map +1 -0
- package/dist/lib/primitive/rect.d.ts +28 -0
- package/dist/lib/primitive/rect.d.ts.map +1 -0
- package/dist/lib/primitive/scene.d.ts +20 -0
- package/dist/lib/primitive/scene.d.ts.map +1 -0
- package/dist/lib/primitive/text.d.ts +32 -0
- package/dist/lib/primitive/text.d.ts.map +1 -0
- package/dist/lib/primitive/view-box.d.ts +12 -0
- package/dist/lib/primitive/view-box.d.ts.map +1 -0
- package/package.json +21 -29
- package/README.md +0 -2
- package/dist/es/components/Scope.d.ts +0 -6
- package/dist/es/components/Scope.js +0 -12
- package/dist/es/components/TikZ.d.ts +0 -9
- package/dist/es/components/TikZ.js +0 -12
- package/dist/es/components/draw/Draw.d.ts +0 -26
- package/dist/es/components/draw/Draw.js +0 -59
- package/dist/es/components/draw/InnerDraw.d.ts +0 -17
- package/dist/es/components/draw/InnerDraw.js +0 -52
- package/dist/es/components/draw/arrow/circle.d.ts +0 -7
- package/dist/es/components/draw/arrow/circle.js +0 -20
- package/dist/es/components/draw/arrow/index.d.ts +0 -9
- package/dist/es/components/draw/arrow/index.js +0 -13
- package/dist/es/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/es/components/draw/arrow/stealth.js +0 -29
- package/dist/es/components/draw/arrow/types.d.ts +0 -21
- package/dist/es/components/draw/common.d.ts +0 -4
- package/dist/es/components/draw/common.js +0 -12
- package/dist/es/components/draw/index.d.ts +0 -3
- package/dist/es/components/draw/index.js +0 -4
- package/dist/es/components/draw/segment/Segment.d.ts +0 -12
- package/dist/es/components/draw/segment/Segment.js +0 -41
- package/dist/es/components/draw/segment/index.d.ts +0 -15
- package/dist/es/components/draw/segment/index.js +0 -41
- package/dist/es/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/es/components/draw/segment/useArrow.js +0 -52
- package/dist/es/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/es/components/draw/segment/useConvertWay.js +0 -110
- package/dist/es/components/draw/types.d.ts +0 -29
- package/dist/es/components/node/InnerNode.d.ts +0 -33
- package/dist/es/components/node/InnerNode.js +0 -88
- package/dist/es/components/node/Node.d.ts +0 -93
- package/dist/es/components/node/Node.js +0 -88
- package/dist/es/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/es/components/node/_hooks/useNodeConfig.js +0 -13
- package/dist/es/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeContent.js +0 -30
- package/dist/es/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/es/components/node/_hooks/useNodeShape.js +0 -34
- package/dist/es/components/node/index.d.ts +0 -3
- package/dist/es/components/node/index.js +0 -4
- package/dist/es/components/path-node/PathNode.d.ts +0 -48
- package/dist/es/components/path-node/PathNode.js +0 -76
- package/dist/es/components/path-node/index.d.ts +0 -3
- package/dist/es/components/path-node/index.js +0 -4
- package/dist/es/components/path-node/useAnchor.d.ts +0 -6
- package/dist/es/components/path-node/useAnchor.js +0 -49
- package/dist/es/container/Group.d.ts +0 -6
- package/dist/es/container/Group.js +0 -8
- package/dist/es/container/Surface.d.ts +0 -19
- package/dist/es/container/Surface.js +0 -23
- package/dist/es/elements/Path.d.ts +0 -4
- package/dist/es/elements/Path.js +0 -14
- package/dist/es/elements/Rect.d.ts +0 -4
- package/dist/es/elements/Rect.js +0 -9
- package/dist/es/elements/Text.d.ts +0 -18
- package/dist/es/elements/Text.js +0 -35
- package/dist/es/hooks/context/useCalculate.d.ts +0 -7
- package/dist/es/hooks/context/useCalculate.js +0 -9
- package/dist/es/hooks/context/useNodes.d.ts +0 -9
- package/dist/es/hooks/context/useNodes.js +0 -33
- package/dist/es/hooks/context/usePath.d.ts +0 -13
- package/dist/es/hooks/context/usePath.js +0 -20
- package/dist/es/hooks/context/useScope.d.ts +0 -11
- package/dist/es/hooks/context/useScope.js +0 -7
- package/dist/es/hooks/useForceUpdate.d.ts +0 -2
- package/dist/es/hooks/useForceUpdate.js +0 -8
- package/dist/es/model/component/node.d.ts +0 -45
- package/dist/es/model/component/node.js +0 -164
- package/dist/es/model/component/path.d.ts +0 -19
- package/dist/es/model/component/path.js +0 -47
- package/dist/es/model/equation/line.d.ts +0 -21
- package/dist/es/model/equation/line.js +0 -76
- package/dist/es/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/es/model/geometry/point/DescartesPoint.js +0 -50
- package/dist/es/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/es/model/geometry/point/PolarPoint.js +0 -27
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.js +0 -338
- package/dist/es/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.js +0 -13
- package/dist/es/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.js +0 -88
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.js +0 -6
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.js +0 -8
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.js +0 -39
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.js +0 -41
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.js +0 -19
- package/dist/es/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.js +0 -10
- package/dist/es/test.d.ts +0 -1
- package/dist/es/types/coordinate/descartes.d.ts +0 -23
- package/dist/es/types/coordinate/index.d.ts +0 -5
- package/dist/es/types/coordinate/polar.d.ts +0 -5
- package/dist/es/types/distance/index.d.ts +0 -8
- package/dist/es/types/distance/sep.d.ts +0 -9
- package/dist/es/types/shape/index.d.ts +0 -8
- package/dist/es/types/shape/index.js +0 -9
- package/dist/es/types/shape/rect.d.ts +0 -25
- package/dist/es/types/shape/rect.js +0 -30
- package/dist/es/types/svg/font.d.ts +0 -10
- package/dist/es/types/svg/stroke.d.ts +0 -10
- package/dist/es/types/tikz/index.d.ts +0 -6
- package/dist/es/utils/compare.d.ts +0 -4
- package/dist/es/utils/compare.js +0 -20
- package/dist/es/utils/css.d.ts +0 -6
- package/dist/es/utils/css.js +0 -26
- package/dist/es/utils/math.d.ts +0 -9
- package/dist/es/utils/math.js +0 -26
- package/dist/es/utils/string.d.ts +0 -7
- package/dist/es/utils/string.js +0 -7
- package/dist/es/utils/style/font.d.ts +0 -17
- package/dist/es/utils/style/font.js +0 -34
- package/dist/es/utils/style/stroke.d.ts +0 -20
- package/dist/es/utils/style/stroke.js +0 -42
- package/dist/lib/components/Scope.cjs +0 -12
- package/dist/lib/components/Scope.d.ts +0 -6
- package/dist/lib/components/TikZ.cjs +0 -12
- package/dist/lib/components/TikZ.d.ts +0 -9
- package/dist/lib/components/draw/Draw.cjs +0 -59
- package/dist/lib/components/draw/Draw.d.ts +0 -26
- package/dist/lib/components/draw/InnerDraw.cjs +0 -52
- package/dist/lib/components/draw/InnerDraw.d.ts +0 -17
- package/dist/lib/components/draw/arrow/circle.cjs +0 -20
- package/dist/lib/components/draw/arrow/circle.d.ts +0 -7
- package/dist/lib/components/draw/arrow/index.cjs +0 -13
- package/dist/lib/components/draw/arrow/index.d.ts +0 -9
- package/dist/lib/components/draw/arrow/stealth.cjs +0 -29
- package/dist/lib/components/draw/arrow/stealth.d.ts +0 -7
- package/dist/lib/components/draw/arrow/types.d.ts +0 -21
- package/dist/lib/components/draw/common.cjs +0 -12
- package/dist/lib/components/draw/common.d.ts +0 -4
- package/dist/lib/components/draw/index.cjs +0 -4
- package/dist/lib/components/draw/index.d.ts +0 -3
- package/dist/lib/components/draw/segment/Segment.cjs +0 -41
- package/dist/lib/components/draw/segment/Segment.d.ts +0 -12
- package/dist/lib/components/draw/segment/index.cjs +0 -41
- package/dist/lib/components/draw/segment/index.d.ts +0 -15
- package/dist/lib/components/draw/segment/useArrow.cjs +0 -52
- package/dist/lib/components/draw/segment/useArrow.d.ts +0 -12
- package/dist/lib/components/draw/segment/useConvertWay.cjs +0 -110
- package/dist/lib/components/draw/segment/useConvertWay.d.ts +0 -14
- package/dist/lib/components/draw/types.d.ts +0 -29
- package/dist/lib/components/node/InnerNode.cjs +0 -88
- package/dist/lib/components/node/InnerNode.d.ts +0 -33
- package/dist/lib/components/node/Node.cjs +0 -88
- package/dist/lib/components/node/Node.d.ts +0 -93
- package/dist/lib/components/node/_hooks/useNodeConfig.cjs +0 -13
- package/dist/lib/components/node/_hooks/useNodeConfig.d.ts +0 -3
- package/dist/lib/components/node/_hooks/useNodeContent.cjs +0 -30
- package/dist/lib/components/node/_hooks/useNodeContent.d.ts +0 -4
- package/dist/lib/components/node/_hooks/useNodeShape.cjs +0 -34
- package/dist/lib/components/node/_hooks/useNodeShape.d.ts +0 -4
- package/dist/lib/components/node/index.cjs +0 -4
- package/dist/lib/components/node/index.d.ts +0 -3
- package/dist/lib/components/path-node/PathNode.cjs +0 -76
- package/dist/lib/components/path-node/PathNode.d.ts +0 -48
- package/dist/lib/components/path-node/index.cjs +0 -4
- package/dist/lib/components/path-node/index.d.ts +0 -3
- package/dist/lib/components/path-node/useAnchor.cjs +0 -49
- package/dist/lib/components/path-node/useAnchor.d.ts +0 -6
- package/dist/lib/container/Group.cjs +0 -8
- package/dist/lib/container/Group.d.ts +0 -6
- package/dist/lib/container/Surface.cjs +0 -23
- package/dist/lib/container/Surface.d.ts +0 -19
- package/dist/lib/elements/Path.cjs +0 -14
- package/dist/lib/elements/Path.d.ts +0 -4
- package/dist/lib/elements/Rect.cjs +0 -9
- package/dist/lib/elements/Rect.d.ts +0 -4
- package/dist/lib/elements/Text.cjs +0 -35
- package/dist/lib/elements/Text.d.ts +0 -18
- package/dist/lib/hooks/context/useCalculate.cjs +0 -9
- package/dist/lib/hooks/context/useCalculate.d.ts +0 -7
- package/dist/lib/hooks/context/useNodes.cjs +0 -33
- package/dist/lib/hooks/context/useNodes.d.ts +0 -9
- package/dist/lib/hooks/context/usePath.cjs +0 -20
- package/dist/lib/hooks/context/usePath.d.ts +0 -13
- package/dist/lib/hooks/context/useScope.cjs +0 -7
- package/dist/lib/hooks/context/useScope.d.ts +0 -11
- package/dist/lib/hooks/useForceUpdate.cjs +0 -8
- package/dist/lib/hooks/useForceUpdate.d.ts +0 -2
- package/dist/lib/model/component/node.cjs +0 -164
- package/dist/lib/model/component/node.d.ts +0 -45
- package/dist/lib/model/component/path.cjs +0 -47
- package/dist/lib/model/component/path.d.ts +0 -19
- package/dist/lib/model/equation/line.cjs +0 -76
- package/dist/lib/model/equation/line.d.ts +0 -21
- package/dist/lib/model/geometry/point/DescartesPoint.cjs +0 -50
- package/dist/lib/model/geometry/point/DescartesPoint.d.ts +0 -21
- package/dist/lib/model/geometry/point/PolarPoint.cjs +0 -27
- package/dist/lib/model/geometry/point/PolarPoint.d.ts +0 -14
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/color.cjs +0 -338
- package/dist/lib/node_modules/.pnpm/d3-color@3.1.0/node_modules/d3-color/src/define.cjs +0 -13
- package/dist/lib/node_modules/.pnpm/d3-path@3.1.0/node_modules/d3-path/src/path.cjs +0 -88
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/array.cjs +0 -6
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/constant.cjs +0 -8
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/curve/linear.cjs +0 -39
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/line.cjs +0 -41
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/path.cjs +0 -19
- package/dist/lib/node_modules/.pnpm/d3-shape@3.2.0/node_modules/d3-shape/src/point.cjs +0 -10
- package/dist/lib/test.d.ts +0 -1
- package/dist/lib/types/coordinate/descartes.d.ts +0 -23
- package/dist/lib/types/coordinate/index.d.ts +0 -5
- package/dist/lib/types/coordinate/polar.d.ts +0 -5
- package/dist/lib/types/distance/index.d.ts +0 -8
- package/dist/lib/types/distance/sep.d.ts +0 -9
- package/dist/lib/types/shape/index.cjs +0 -9
- package/dist/lib/types/shape/index.d.ts +0 -8
- package/dist/lib/types/shape/rect.cjs +0 -30
- package/dist/lib/types/shape/rect.d.ts +0 -25
- package/dist/lib/types/svg/font.d.ts +0 -10
- package/dist/lib/types/svg/stroke.d.ts +0 -10
- package/dist/lib/types/tikz/index.d.ts +0 -6
- package/dist/lib/utils/compare.cjs +0 -20
- package/dist/lib/utils/compare.d.ts +0 -4
- package/dist/lib/utils/css.cjs +0 -26
- package/dist/lib/utils/css.d.ts +0 -6
- package/dist/lib/utils/math.cjs +0 -26
- package/dist/lib/utils/math.d.ts +0 -9
- package/dist/lib/utils/string.cjs +0 -7
- package/dist/lib/utils/string.d.ts +0 -7
- package/dist/lib/utils/style/font.cjs +0 -34
- package/dist/lib/utils/style/font.d.ts +0 -17
- package/dist/lib/utils/style/stroke.cjs +0 -42
- package/dist/lib/utils/style/stroke.d.ts +0 -20
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import PolarPoint from "./PolarPoint.js";
|
|
5
|
-
const _DescartesPoint = class _DescartesPoint {
|
|
6
|
-
constructor(point) {
|
|
7
|
-
__publicField(this, "position");
|
|
8
|
-
this.position = Array.isArray(point) ? [...point] : [point.x, point.y];
|
|
9
|
-
}
|
|
10
|
-
/** 获取极坐标 */
|
|
11
|
-
getPolarPosition() {
|
|
12
|
-
return _DescartesPoint.convertPolarToDescartesPosition(this.position);
|
|
13
|
-
}
|
|
14
|
-
/** 获取极点 */
|
|
15
|
-
getPolarPoint() {
|
|
16
|
-
return new PolarPoint(this.getPolarPosition());
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
/** 将笛卡尔坐标点转换为极坐标点 */
|
|
20
|
-
__publicField(_DescartesPoint, "convertPolarToDescartesPosition", (position) => {
|
|
21
|
-
const [x, y] = position;
|
|
22
|
-
return { radius: Math.sqrt(x * x + y * y), angle: Math.atan2(y, x) };
|
|
23
|
-
});
|
|
24
|
-
/** 对象形式转换为数组形式 */
|
|
25
|
-
__publicField(_DescartesPoint, "covertToPosition", (position) => {
|
|
26
|
-
return [position.x, position.y];
|
|
27
|
-
});
|
|
28
|
-
/** 将坐标格式转换为笛卡尔坐标数组形式 */
|
|
29
|
-
__publicField(_DescartesPoint, "formatPosition", (point) => {
|
|
30
|
-
if (Array.isArray(point)) return point;
|
|
31
|
-
if (point.hasOwnProperty("x") && point.hasOwnProperty("y")) {
|
|
32
|
-
const p = point;
|
|
33
|
-
return [p.x, p.y];
|
|
34
|
-
}
|
|
35
|
-
return PolarPoint.convertPolarToDescartesPosition(point);
|
|
36
|
-
});
|
|
37
|
-
/** 多个点相加 */
|
|
38
|
-
__publicField(_DescartesPoint, "plus", (...positions) => {
|
|
39
|
-
return positions.reduce(
|
|
40
|
-
(acc, cur) => {
|
|
41
|
-
const formatCur = _DescartesPoint.formatPosition(cur);
|
|
42
|
-
return [acc[0] + formatCur[0], acc[1] + formatCur[1]];
|
|
43
|
-
},
|
|
44
|
-
[0, 0]
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
let DescartesPoint = _DescartesPoint;
|
|
48
|
-
export {
|
|
49
|
-
DescartesPoint as default
|
|
50
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Position } from '../../../types/coordinate/descartes';
|
|
2
|
-
import { PolarPosition } from '../../../types/coordinate/polar';
|
|
3
|
-
import { default as DescartesPoint } from './DescartesPoint';
|
|
4
|
-
/** 笛卡尔坐标点 */
|
|
5
|
-
export default class PolarPoint {
|
|
6
|
-
readonly position: PolarPosition;
|
|
7
|
-
constructor(point: PolarPosition);
|
|
8
|
-
/** 获取笛卡尔坐标 */
|
|
9
|
-
getDescartesPosition(): Position;
|
|
10
|
-
/** 获取笛卡尔点 */
|
|
11
|
-
getDescartesPoint(): DescartesPoint;
|
|
12
|
-
/** 将极坐标点转换为笛卡尔坐标点 */
|
|
13
|
-
static convertPolarToDescartesPosition: (position: PolarPosition) => Position;
|
|
14
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import DescartesPoint from "./DescartesPoint.js";
|
|
5
|
-
const _PolarPoint = class _PolarPoint {
|
|
6
|
-
constructor(point) {
|
|
7
|
-
__publicField(this, "position");
|
|
8
|
-
this.position = { radius: point.radius, angle: point.angle };
|
|
9
|
-
}
|
|
10
|
-
/** 获取笛卡尔坐标 */
|
|
11
|
-
getDescartesPosition() {
|
|
12
|
-
return _PolarPoint.convertPolarToDescartesPosition(this.position);
|
|
13
|
-
}
|
|
14
|
-
/** 获取笛卡尔点 */
|
|
15
|
-
getDescartesPoint() {
|
|
16
|
-
return new DescartesPoint(this.getDescartesPosition());
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
/** 将极坐标点转换为笛卡尔坐标点 */
|
|
20
|
-
__publicField(_PolarPoint, "convertPolarToDescartesPosition", (position) => {
|
|
21
|
-
const { radius, angle } = position;
|
|
22
|
-
return [radius * Math.cos(angle), radius * Math.sin(angle)];
|
|
23
|
-
});
|
|
24
|
-
let PolarPoint = _PolarPoint;
|
|
25
|
-
export {
|
|
26
|
-
PolarPoint as default
|
|
27
|
-
};
|
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import define, { extend } from "./define.js";
|
|
2
|
-
function Color() {
|
|
3
|
-
}
|
|
4
|
-
var darker = 0.7;
|
|
5
|
-
var brighter = 1 / darker;
|
|
6
|
-
var reI = "\\s*([+-]?\\d+)\\s*", reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*", reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*", reHex = /^#([0-9a-f]{3,8})$/, reRgbInteger = new RegExp(`^rgb\\(${reI},${reI},${reI}\\)$`), reRgbPercent = new RegExp(`^rgb\\(${reP},${reP},${reP}\\)$`), reRgbaInteger = new RegExp(`^rgba\\(${reI},${reI},${reI},${reN}\\)$`), reRgbaPercent = new RegExp(`^rgba\\(${reP},${reP},${reP},${reN}\\)$`), reHslPercent = new RegExp(`^hsl\\(${reN},${reP},${reP}\\)$`), reHslaPercent = new RegExp(`^hsla\\(${reN},${reP},${reP},${reN}\\)$`);
|
|
7
|
-
var named = {
|
|
8
|
-
aliceblue: 15792383,
|
|
9
|
-
antiquewhite: 16444375,
|
|
10
|
-
aqua: 65535,
|
|
11
|
-
aquamarine: 8388564,
|
|
12
|
-
azure: 15794175,
|
|
13
|
-
beige: 16119260,
|
|
14
|
-
bisque: 16770244,
|
|
15
|
-
black: 0,
|
|
16
|
-
blanchedalmond: 16772045,
|
|
17
|
-
blue: 255,
|
|
18
|
-
blueviolet: 9055202,
|
|
19
|
-
brown: 10824234,
|
|
20
|
-
burlywood: 14596231,
|
|
21
|
-
cadetblue: 6266528,
|
|
22
|
-
chartreuse: 8388352,
|
|
23
|
-
chocolate: 13789470,
|
|
24
|
-
coral: 16744272,
|
|
25
|
-
cornflowerblue: 6591981,
|
|
26
|
-
cornsilk: 16775388,
|
|
27
|
-
crimson: 14423100,
|
|
28
|
-
cyan: 65535,
|
|
29
|
-
darkblue: 139,
|
|
30
|
-
darkcyan: 35723,
|
|
31
|
-
darkgoldenrod: 12092939,
|
|
32
|
-
darkgray: 11119017,
|
|
33
|
-
darkgreen: 25600,
|
|
34
|
-
darkgrey: 11119017,
|
|
35
|
-
darkkhaki: 12433259,
|
|
36
|
-
darkmagenta: 9109643,
|
|
37
|
-
darkolivegreen: 5597999,
|
|
38
|
-
darkorange: 16747520,
|
|
39
|
-
darkorchid: 10040012,
|
|
40
|
-
darkred: 9109504,
|
|
41
|
-
darksalmon: 15308410,
|
|
42
|
-
darkseagreen: 9419919,
|
|
43
|
-
darkslateblue: 4734347,
|
|
44
|
-
darkslategray: 3100495,
|
|
45
|
-
darkslategrey: 3100495,
|
|
46
|
-
darkturquoise: 52945,
|
|
47
|
-
darkviolet: 9699539,
|
|
48
|
-
deeppink: 16716947,
|
|
49
|
-
deepskyblue: 49151,
|
|
50
|
-
dimgray: 6908265,
|
|
51
|
-
dimgrey: 6908265,
|
|
52
|
-
dodgerblue: 2003199,
|
|
53
|
-
firebrick: 11674146,
|
|
54
|
-
floralwhite: 16775920,
|
|
55
|
-
forestgreen: 2263842,
|
|
56
|
-
fuchsia: 16711935,
|
|
57
|
-
gainsboro: 14474460,
|
|
58
|
-
ghostwhite: 16316671,
|
|
59
|
-
gold: 16766720,
|
|
60
|
-
goldenrod: 14329120,
|
|
61
|
-
gray: 8421504,
|
|
62
|
-
green: 32768,
|
|
63
|
-
greenyellow: 11403055,
|
|
64
|
-
grey: 8421504,
|
|
65
|
-
honeydew: 15794160,
|
|
66
|
-
hotpink: 16738740,
|
|
67
|
-
indianred: 13458524,
|
|
68
|
-
indigo: 4915330,
|
|
69
|
-
ivory: 16777200,
|
|
70
|
-
khaki: 15787660,
|
|
71
|
-
lavender: 15132410,
|
|
72
|
-
lavenderblush: 16773365,
|
|
73
|
-
lawngreen: 8190976,
|
|
74
|
-
lemonchiffon: 16775885,
|
|
75
|
-
lightblue: 11393254,
|
|
76
|
-
lightcoral: 15761536,
|
|
77
|
-
lightcyan: 14745599,
|
|
78
|
-
lightgoldenrodyellow: 16448210,
|
|
79
|
-
lightgray: 13882323,
|
|
80
|
-
lightgreen: 9498256,
|
|
81
|
-
lightgrey: 13882323,
|
|
82
|
-
lightpink: 16758465,
|
|
83
|
-
lightsalmon: 16752762,
|
|
84
|
-
lightseagreen: 2142890,
|
|
85
|
-
lightskyblue: 8900346,
|
|
86
|
-
lightslategray: 7833753,
|
|
87
|
-
lightslategrey: 7833753,
|
|
88
|
-
lightsteelblue: 11584734,
|
|
89
|
-
lightyellow: 16777184,
|
|
90
|
-
lime: 65280,
|
|
91
|
-
limegreen: 3329330,
|
|
92
|
-
linen: 16445670,
|
|
93
|
-
magenta: 16711935,
|
|
94
|
-
maroon: 8388608,
|
|
95
|
-
mediumaquamarine: 6737322,
|
|
96
|
-
mediumblue: 205,
|
|
97
|
-
mediumorchid: 12211667,
|
|
98
|
-
mediumpurple: 9662683,
|
|
99
|
-
mediumseagreen: 3978097,
|
|
100
|
-
mediumslateblue: 8087790,
|
|
101
|
-
mediumspringgreen: 64154,
|
|
102
|
-
mediumturquoise: 4772300,
|
|
103
|
-
mediumvioletred: 13047173,
|
|
104
|
-
midnightblue: 1644912,
|
|
105
|
-
mintcream: 16121850,
|
|
106
|
-
mistyrose: 16770273,
|
|
107
|
-
moccasin: 16770229,
|
|
108
|
-
navajowhite: 16768685,
|
|
109
|
-
navy: 128,
|
|
110
|
-
oldlace: 16643558,
|
|
111
|
-
olive: 8421376,
|
|
112
|
-
olivedrab: 7048739,
|
|
113
|
-
orange: 16753920,
|
|
114
|
-
orangered: 16729344,
|
|
115
|
-
orchid: 14315734,
|
|
116
|
-
palegoldenrod: 15657130,
|
|
117
|
-
palegreen: 10025880,
|
|
118
|
-
paleturquoise: 11529966,
|
|
119
|
-
palevioletred: 14381203,
|
|
120
|
-
papayawhip: 16773077,
|
|
121
|
-
peachpuff: 16767673,
|
|
122
|
-
peru: 13468991,
|
|
123
|
-
pink: 16761035,
|
|
124
|
-
plum: 14524637,
|
|
125
|
-
powderblue: 11591910,
|
|
126
|
-
purple: 8388736,
|
|
127
|
-
rebeccapurple: 6697881,
|
|
128
|
-
red: 16711680,
|
|
129
|
-
rosybrown: 12357519,
|
|
130
|
-
royalblue: 4286945,
|
|
131
|
-
saddlebrown: 9127187,
|
|
132
|
-
salmon: 16416882,
|
|
133
|
-
sandybrown: 16032864,
|
|
134
|
-
seagreen: 3050327,
|
|
135
|
-
seashell: 16774638,
|
|
136
|
-
sienna: 10506797,
|
|
137
|
-
silver: 12632256,
|
|
138
|
-
skyblue: 8900331,
|
|
139
|
-
slateblue: 6970061,
|
|
140
|
-
slategray: 7372944,
|
|
141
|
-
slategrey: 7372944,
|
|
142
|
-
snow: 16775930,
|
|
143
|
-
springgreen: 65407,
|
|
144
|
-
steelblue: 4620980,
|
|
145
|
-
tan: 13808780,
|
|
146
|
-
teal: 32896,
|
|
147
|
-
thistle: 14204888,
|
|
148
|
-
tomato: 16737095,
|
|
149
|
-
turquoise: 4251856,
|
|
150
|
-
violet: 15631086,
|
|
151
|
-
wheat: 16113331,
|
|
152
|
-
white: 16777215,
|
|
153
|
-
whitesmoke: 16119285,
|
|
154
|
-
yellow: 16776960,
|
|
155
|
-
yellowgreen: 10145074
|
|
156
|
-
};
|
|
157
|
-
define(Color, color, {
|
|
158
|
-
copy(channels) {
|
|
159
|
-
return Object.assign(new this.constructor(), this, channels);
|
|
160
|
-
},
|
|
161
|
-
displayable() {
|
|
162
|
-
return this.rgb().displayable();
|
|
163
|
-
},
|
|
164
|
-
hex: color_formatHex,
|
|
165
|
-
// Deprecated! Use color.formatHex.
|
|
166
|
-
formatHex: color_formatHex,
|
|
167
|
-
formatHex8: color_formatHex8,
|
|
168
|
-
formatHsl: color_formatHsl,
|
|
169
|
-
formatRgb: color_formatRgb,
|
|
170
|
-
toString: color_formatRgb
|
|
171
|
-
});
|
|
172
|
-
function color_formatHex() {
|
|
173
|
-
return this.rgb().formatHex();
|
|
174
|
-
}
|
|
175
|
-
function color_formatHex8() {
|
|
176
|
-
return this.rgb().formatHex8();
|
|
177
|
-
}
|
|
178
|
-
function color_formatHsl() {
|
|
179
|
-
return hslConvert(this).formatHsl();
|
|
180
|
-
}
|
|
181
|
-
function color_formatRgb() {
|
|
182
|
-
return this.rgb().formatRgb();
|
|
183
|
-
}
|
|
184
|
-
function color(format) {
|
|
185
|
-
var m, l;
|
|
186
|
-
format = (format + "").trim().toLowerCase();
|
|
187
|
-
return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) : l === 3 ? new Rgb(m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, (m & 15) << 4 | m & 15, 1) : l === 8 ? rgba(m >> 24 & 255, m >> 16 & 255, m >> 8 & 255, (m & 255) / 255) : l === 4 ? rgba(m >> 12 & 15 | m >> 8 & 240, m >> 8 & 15 | m >> 4 & 240, m >> 4 & 15 | m & 240, ((m & 15) << 4 | m & 15) / 255) : null) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) : named.hasOwnProperty(format) ? rgbn(named[format]) : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null;
|
|
188
|
-
}
|
|
189
|
-
function rgbn(n) {
|
|
190
|
-
return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1);
|
|
191
|
-
}
|
|
192
|
-
function rgba(r, g, b, a) {
|
|
193
|
-
if (a <= 0) r = g = b = NaN;
|
|
194
|
-
return new Rgb(r, g, b, a);
|
|
195
|
-
}
|
|
196
|
-
function rgbConvert(o) {
|
|
197
|
-
if (!(o instanceof Color)) o = color(o);
|
|
198
|
-
if (!o) return new Rgb();
|
|
199
|
-
o = o.rgb();
|
|
200
|
-
return new Rgb(o.r, o.g, o.b, o.opacity);
|
|
201
|
-
}
|
|
202
|
-
function rgb(r, g, b, opacity) {
|
|
203
|
-
return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity);
|
|
204
|
-
}
|
|
205
|
-
function Rgb(r, g, b, opacity) {
|
|
206
|
-
this.r = +r;
|
|
207
|
-
this.g = +g;
|
|
208
|
-
this.b = +b;
|
|
209
|
-
this.opacity = +opacity;
|
|
210
|
-
}
|
|
211
|
-
define(Rgb, rgb, extend(Color, {
|
|
212
|
-
brighter(k) {
|
|
213
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
214
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
215
|
-
},
|
|
216
|
-
darker(k) {
|
|
217
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
218
|
-
return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
|
|
219
|
-
},
|
|
220
|
-
rgb() {
|
|
221
|
-
return this;
|
|
222
|
-
},
|
|
223
|
-
clamp() {
|
|
224
|
-
return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
|
|
225
|
-
},
|
|
226
|
-
displayable() {
|
|
227
|
-
return -0.5 <= this.r && this.r < 255.5 && (-0.5 <= this.g && this.g < 255.5) && (-0.5 <= this.b && this.b < 255.5) && (0 <= this.opacity && this.opacity <= 1);
|
|
228
|
-
},
|
|
229
|
-
hex: rgb_formatHex,
|
|
230
|
-
// Deprecated! Use color.formatHex.
|
|
231
|
-
formatHex: rgb_formatHex,
|
|
232
|
-
formatHex8: rgb_formatHex8,
|
|
233
|
-
formatRgb: rgb_formatRgb,
|
|
234
|
-
toString: rgb_formatRgb
|
|
235
|
-
}));
|
|
236
|
-
function rgb_formatHex() {
|
|
237
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
|
|
238
|
-
}
|
|
239
|
-
function rgb_formatHex8() {
|
|
240
|
-
return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
|
|
241
|
-
}
|
|
242
|
-
function rgb_formatRgb() {
|
|
243
|
-
const a = clampa(this.opacity);
|
|
244
|
-
return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
|
|
245
|
-
}
|
|
246
|
-
function clampa(opacity) {
|
|
247
|
-
return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
|
|
248
|
-
}
|
|
249
|
-
function clampi(value) {
|
|
250
|
-
return Math.max(0, Math.min(255, Math.round(value) || 0));
|
|
251
|
-
}
|
|
252
|
-
function hex(value) {
|
|
253
|
-
value = clampi(value);
|
|
254
|
-
return (value < 16 ? "0" : "") + value.toString(16);
|
|
255
|
-
}
|
|
256
|
-
function hsla(h, s, l, a) {
|
|
257
|
-
if (a <= 0) h = s = l = NaN;
|
|
258
|
-
else if (l <= 0 || l >= 1) h = s = NaN;
|
|
259
|
-
else if (s <= 0) h = NaN;
|
|
260
|
-
return new Hsl(h, s, l, a);
|
|
261
|
-
}
|
|
262
|
-
function hslConvert(o) {
|
|
263
|
-
if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity);
|
|
264
|
-
if (!(o instanceof Color)) o = color(o);
|
|
265
|
-
if (!o) return new Hsl();
|
|
266
|
-
if (o instanceof Hsl) return o;
|
|
267
|
-
o = o.rgb();
|
|
268
|
-
var r = o.r / 255, g = o.g / 255, b = o.b / 255, min = Math.min(r, g, b), max = Math.max(r, g, b), h = NaN, s = max - min, l = (max + min) / 2;
|
|
269
|
-
if (s) {
|
|
270
|
-
if (r === max) h = (g - b) / s + (g < b) * 6;
|
|
271
|
-
else if (g === max) h = (b - r) / s + 2;
|
|
272
|
-
else h = (r - g) / s + 4;
|
|
273
|
-
s /= l < 0.5 ? max + min : 2 - max - min;
|
|
274
|
-
h *= 60;
|
|
275
|
-
} else {
|
|
276
|
-
s = l > 0 && l < 1 ? 0 : h;
|
|
277
|
-
}
|
|
278
|
-
return new Hsl(h, s, l, o.opacity);
|
|
279
|
-
}
|
|
280
|
-
function hsl(h, s, l, opacity) {
|
|
281
|
-
return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity);
|
|
282
|
-
}
|
|
283
|
-
function Hsl(h, s, l, opacity) {
|
|
284
|
-
this.h = +h;
|
|
285
|
-
this.s = +s;
|
|
286
|
-
this.l = +l;
|
|
287
|
-
this.opacity = +opacity;
|
|
288
|
-
}
|
|
289
|
-
define(Hsl, hsl, extend(Color, {
|
|
290
|
-
brighter(k) {
|
|
291
|
-
k = k == null ? brighter : Math.pow(brighter, k);
|
|
292
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
293
|
-
},
|
|
294
|
-
darker(k) {
|
|
295
|
-
k = k == null ? darker : Math.pow(darker, k);
|
|
296
|
-
return new Hsl(this.h, this.s, this.l * k, this.opacity);
|
|
297
|
-
},
|
|
298
|
-
rgb() {
|
|
299
|
-
var h = this.h % 360 + (this.h < 0) * 360, s = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s, m1 = 2 * l - m2;
|
|
300
|
-
return new Rgb(
|
|
301
|
-
hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2),
|
|
302
|
-
hsl2rgb(h, m1, m2),
|
|
303
|
-
hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2),
|
|
304
|
-
this.opacity
|
|
305
|
-
);
|
|
306
|
-
},
|
|
307
|
-
clamp() {
|
|
308
|
-
return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
|
|
309
|
-
},
|
|
310
|
-
displayable() {
|
|
311
|
-
return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && (0 <= this.l && this.l <= 1) && (0 <= this.opacity && this.opacity <= 1);
|
|
312
|
-
},
|
|
313
|
-
formatHsl() {
|
|
314
|
-
const a = clampa(this.opacity);
|
|
315
|
-
return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
|
|
316
|
-
}
|
|
317
|
-
}));
|
|
318
|
-
function clamph(value) {
|
|
319
|
-
value = (value || 0) % 360;
|
|
320
|
-
return value < 0 ? value + 360 : value;
|
|
321
|
-
}
|
|
322
|
-
function clampt(value) {
|
|
323
|
-
return Math.max(0, Math.min(1, value || 0));
|
|
324
|
-
}
|
|
325
|
-
function hsl2rgb(h, m1, m2) {
|
|
326
|
-
return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
|
|
327
|
-
}
|
|
328
|
-
export {
|
|
329
|
-
Color,
|
|
330
|
-
Rgb,
|
|
331
|
-
brighter,
|
|
332
|
-
darker,
|
|
333
|
-
color as default,
|
|
334
|
-
hsl,
|
|
335
|
-
hslConvert,
|
|
336
|
-
rgb,
|
|
337
|
-
rgbConvert
|
|
338
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function define(constructor, factory, prototype) {
|
|
2
|
-
constructor.prototype = factory.prototype = prototype;
|
|
3
|
-
prototype.constructor = constructor;
|
|
4
|
-
}
|
|
5
|
-
function extend(parent, definition) {
|
|
6
|
-
var prototype = Object.create(parent.prototype);
|
|
7
|
-
for (var key in definition) prototype[key] = definition[key];
|
|
8
|
-
return prototype;
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
define as default,
|
|
12
|
-
extend
|
|
13
|
-
};
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
const pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;
|
|
2
|
-
function append(strings) {
|
|
3
|
-
this._ += strings[0];
|
|
4
|
-
for (let i = 1, n = strings.length; i < n; ++i) {
|
|
5
|
-
this._ += arguments[i] + strings[i];
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
function appendRound(digits) {
|
|
9
|
-
let d = Math.floor(digits);
|
|
10
|
-
if (!(d >= 0)) throw new Error(`invalid digits: ${digits}`);
|
|
11
|
-
if (d > 15) return append;
|
|
12
|
-
const k = 10 ** d;
|
|
13
|
-
return function(strings) {
|
|
14
|
-
this._ += strings[0];
|
|
15
|
-
for (let i = 1, n = strings.length; i < n; ++i) {
|
|
16
|
-
this._ += Math.round(arguments[i] * k) / k + strings[i];
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
class Path {
|
|
21
|
-
constructor(digits) {
|
|
22
|
-
this._x0 = this._y0 = // start of current subpath
|
|
23
|
-
this._x1 = this._y1 = null;
|
|
24
|
-
this._ = "";
|
|
25
|
-
this._append = digits == null ? append : appendRound(digits);
|
|
26
|
-
}
|
|
27
|
-
moveTo(x, y) {
|
|
28
|
-
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}`;
|
|
29
|
-
}
|
|
30
|
-
closePath() {
|
|
31
|
-
if (this._x1 !== null) {
|
|
32
|
-
this._x1 = this._x0, this._y1 = this._y0;
|
|
33
|
-
this._append`Z`;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
lineTo(x, y) {
|
|
37
|
-
this._append`L${this._x1 = +x},${this._y1 = +y}`;
|
|
38
|
-
}
|
|
39
|
-
quadraticCurveTo(x1, y1, x, y) {
|
|
40
|
-
this._append`Q${+x1},${+y1},${this._x1 = +x},${this._y1 = +y}`;
|
|
41
|
-
}
|
|
42
|
-
bezierCurveTo(x1, y1, x2, y2, x, y) {
|
|
43
|
-
this._append`C${+x1},${+y1},${+x2},${+y2},${this._x1 = +x},${this._y1 = +y}`;
|
|
44
|
-
}
|
|
45
|
-
arcTo(x1, y1, x2, y2, r) {
|
|
46
|
-
x1 = +x1, y1 = +y1, x2 = +x2, y2 = +y2, r = +r;
|
|
47
|
-
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
48
|
-
let x0 = this._x1, y0 = this._y1, x21 = x2 - x1, y21 = y2 - y1, x01 = x0 - x1, y01 = y0 - y1, l01_2 = x01 * x01 + y01 * y01;
|
|
49
|
-
if (this._x1 === null) {
|
|
50
|
-
this._append`M${this._x1 = x1},${this._y1 = y1}`;
|
|
51
|
-
} else if (!(l01_2 > epsilon)) ;
|
|
52
|
-
else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon) || !r) {
|
|
53
|
-
this._append`L${this._x1 = x1},${this._y1 = y1}`;
|
|
54
|
-
} else {
|
|
55
|
-
let x20 = x2 - x0, y20 = y2 - y0, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21;
|
|
56
|
-
if (Math.abs(t01 - 1) > epsilon) {
|
|
57
|
-
this._append`L${x1 + t01 * x01},${y1 + t01 * y01}`;
|
|
58
|
-
}
|
|
59
|
-
this._append`A${r},${r},0,0,${+(y01 * x20 > x01 * y20)},${this._x1 = x1 + t21 * x21},${this._y1 = y1 + t21 * y21}`;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
arc(x, y, r, a0, a1, ccw) {
|
|
63
|
-
x = +x, y = +y, r = +r, ccw = !!ccw;
|
|
64
|
-
if (r < 0) throw new Error(`negative radius: ${r}`);
|
|
65
|
-
let dx = r * Math.cos(a0), dy = r * Math.sin(a0), x0 = x + dx, y0 = y + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0;
|
|
66
|
-
if (this._x1 === null) {
|
|
67
|
-
this._append`M${x0},${y0}`;
|
|
68
|
-
} else if (Math.abs(this._x1 - x0) > epsilon || Math.abs(this._y1 - y0) > epsilon) {
|
|
69
|
-
this._append`L${x0},${y0}`;
|
|
70
|
-
}
|
|
71
|
-
if (!r) return;
|
|
72
|
-
if (da < 0) da = da % tau + tau;
|
|
73
|
-
if (da > tauEpsilon) {
|
|
74
|
-
this._append`A${r},${r},0,1,${cw},${x - dx},${y - dy}A${r},${r},0,1,${cw},${this._x1 = x0},${this._y1 = y0}`;
|
|
75
|
-
} else if (da > epsilon) {
|
|
76
|
-
this._append`A${r},${r},0,${+(da >= pi)},${cw},${this._x1 = x + r * Math.cos(a1)},${this._y1 = y + r * Math.sin(a1)}`;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
rect(x, y, w, h) {
|
|
80
|
-
this._append`M${this._x0 = this._x1 = +x},${this._y0 = this._y1 = +y}h${w = +w}v${+h}h${-w}Z`;
|
|
81
|
-
}
|
|
82
|
-
toString() {
|
|
83
|
-
return this._;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
export {
|
|
87
|
-
Path
|
|
88
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
function Linear(context) {
|
|
2
|
-
this._context = context;
|
|
3
|
-
}
|
|
4
|
-
Linear.prototype = {
|
|
5
|
-
areaStart: function() {
|
|
6
|
-
this._line = 0;
|
|
7
|
-
},
|
|
8
|
-
areaEnd: function() {
|
|
9
|
-
this._line = NaN;
|
|
10
|
-
},
|
|
11
|
-
lineStart: function() {
|
|
12
|
-
this._point = 0;
|
|
13
|
-
},
|
|
14
|
-
lineEnd: function() {
|
|
15
|
-
if (this._line || this._line !== 0 && this._point === 1) this._context.closePath();
|
|
16
|
-
this._line = 1 - this._line;
|
|
17
|
-
},
|
|
18
|
-
point: function(x, y) {
|
|
19
|
-
x = +x, y = +y;
|
|
20
|
-
switch (this._point) {
|
|
21
|
-
case 0:
|
|
22
|
-
this._point = 1;
|
|
23
|
-
this._line ? this._context.lineTo(x, y) : this._context.moveTo(x, y);
|
|
24
|
-
break;
|
|
25
|
-
case 1:
|
|
26
|
-
this._point = 2;
|
|
27
|
-
// falls through
|
|
28
|
-
default:
|
|
29
|
-
this._context.lineTo(x, y);
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
function curveLinear(context) {
|
|
35
|
-
return new Linear(context);
|
|
36
|
-
}
|
|
37
|
-
export {
|
|
38
|
-
curveLinear as default
|
|
39
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import array from "./array.js";
|
|
2
|
-
import constant from "./constant.js";
|
|
3
|
-
import curveLinear from "./curve/linear.js";
|
|
4
|
-
import { withPath } from "./path.js";
|
|
5
|
-
import { x, y } from "./point.js";
|
|
6
|
-
function line(x$1, y$1) {
|
|
7
|
-
var defined = constant(true), context = null, curve = curveLinear, output = null, path = withPath(line2);
|
|
8
|
-
x$1 = typeof x$1 === "function" ? x$1 : x$1 === void 0 ? x : constant(x$1);
|
|
9
|
-
y$1 = typeof y$1 === "function" ? y$1 : y$1 === void 0 ? y : constant(y$1);
|
|
10
|
-
function line2(data) {
|
|
11
|
-
var i, n = (data = array(data)).length, d, defined0 = false, buffer;
|
|
12
|
-
if (context == null) output = curve(buffer = path());
|
|
13
|
-
for (i = 0; i <= n; ++i) {
|
|
14
|
-
if (!(i < n && defined(d = data[i], i, data)) === defined0) {
|
|
15
|
-
if (defined0 = !defined0) output.lineStart();
|
|
16
|
-
else output.lineEnd();
|
|
17
|
-
}
|
|
18
|
-
if (defined0) output.point(+x$1(d, i, data), +y$1(d, i, data));
|
|
19
|
-
}
|
|
20
|
-
if (buffer) return output = null, buffer + "" || null;
|
|
21
|
-
}
|
|
22
|
-
line2.x = function(_) {
|
|
23
|
-
return arguments.length ? (x$1 = typeof _ === "function" ? _ : constant(+_), line2) : x$1;
|
|
24
|
-
};
|
|
25
|
-
line2.y = function(_) {
|
|
26
|
-
return arguments.length ? (y$1 = typeof _ === "function" ? _ : constant(+_), line2) : y$1;
|
|
27
|
-
};
|
|
28
|
-
line2.defined = function(_) {
|
|
29
|
-
return arguments.length ? (defined = typeof _ === "function" ? _ : constant(!!_), line2) : defined;
|
|
30
|
-
};
|
|
31
|
-
line2.curve = function(_) {
|
|
32
|
-
return arguments.length ? (curve = _, context != null && (output = curve(context)), line2) : curve;
|
|
33
|
-
};
|
|
34
|
-
line2.context = function(_) {
|
|
35
|
-
return arguments.length ? (_ == null ? context = output = null : output = curve(context = _), line2) : context;
|
|
36
|
-
};
|
|
37
|
-
return line2;
|
|
38
|
-
}
|
|
39
|
-
export {
|
|
40
|
-
line as default
|
|
41
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Path } from "../../../../d3-path@3.1.0/node_modules/d3-path/src/path.js";
|
|
2
|
-
function withPath(shape) {
|
|
3
|
-
let digits = 3;
|
|
4
|
-
shape.digits = function(_) {
|
|
5
|
-
if (!arguments.length) return digits;
|
|
6
|
-
if (_ == null) {
|
|
7
|
-
digits = null;
|
|
8
|
-
} else {
|
|
9
|
-
const d = Math.floor(_);
|
|
10
|
-
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|
11
|
-
digits = d;
|
|
12
|
-
}
|
|
13
|
-
return shape;
|
|
14
|
-
};
|
|
15
|
-
return () => new Path(digits);
|
|
16
|
-
}
|
|
17
|
-
export {
|
|
18
|
-
withPath
|
|
19
|
-
};
|
package/dist/es/test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/** 笛卡尔象限 */
|
|
2
|
-
export declare enum Quadrant {
|
|
3
|
-
TR = "top_right",// 第一象限
|
|
4
|
-
TL = "top_left",// 第二象限
|
|
5
|
-
BL = "bottom_left",// 第三象限
|
|
6
|
-
BR = "bottom_right"
|
|
7
|
-
}
|
|
8
|
-
/** 笛卡尔坐标轴 */
|
|
9
|
-
export declare enum Axis {
|
|
10
|
-
X_POS = "x-positive",// 正x轴
|
|
11
|
-
Y_POS = "y-positive",// 正y轴
|
|
12
|
-
X_NEG = "x-negative",// 负x轴
|
|
13
|
-
Y_NEG = "y-negative"
|
|
14
|
-
}
|
|
15
|
-
/** 笛卡尔坐标系位置 */
|
|
16
|
-
export type DescartesLocation = Quadrant | Axis | 'center';
|
|
17
|
-
/** 笛卡尔坐标 */
|
|
18
|
-
export type Position = [number, number];
|
|
19
|
-
/** 笛卡尔坐标(对象形式) */
|
|
20
|
-
export type DescartesPosition = {
|
|
21
|
-
x: number;
|
|
22
|
-
y: number;
|
|
23
|
-
};
|