@remotion/shapes 3.3.32
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.md +7 -0
- package/README.md +22 -0
- package/dist/Ellipse.d.ts +10 -0
- package/dist/Ellipse.js +12 -0
- package/dist/circle.d.ts +10 -0
- package/dist/circle.js +13 -0
- package/dist/components/circle.d.ts +5 -0
- package/dist/components/circle.js +10 -0
- package/dist/components/ellipse.d.ts +5 -0
- package/dist/components/ellipse.js +10 -0
- package/dist/components/rect.d.ts +5 -0
- package/dist/components/rect.js +10 -0
- package/dist/components/render-svg.d.ts +12 -0
- package/dist/components/render-svg.js +21 -0
- package/dist/components/return-type.d.ts +5 -0
- package/dist/components/return-type.js +2 -0
- package/dist/components/shape-info.d.ts +5 -0
- package/dist/components/shape-info.js +2 -0
- package/dist/components/triangle.d.ts +5 -0
- package/dist/components/triangle.js +10 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +19 -0
- package/dist/make-circle.d.ts +4 -0
- package/dist/make-circle.js +9 -0
- package/dist/make-ellipse.d.ts +5 -0
- package/dist/make-ellipse.js +7 -0
- package/dist/make-rect.d.ts +5 -0
- package/dist/make-rect.js +9 -0
- package/dist/make-triangle.d.ts +6 -0
- package/dist/make-triangle.js +14 -0
- package/dist/rect.d.ts +8 -0
- package/dist/rect.js +12 -0
- package/dist/triangle.d.ts +9 -0
- package/dist/triangle.js +13 -0
- package/dist/utils/make-circle.d.ts +5 -0
- package/dist/utils/make-circle.js +12 -0
- package/dist/utils/make-ellipse.d.ts +6 -0
- package/dist/utils/make-ellipse.js +12 -0
- package/dist/utils/make-rect.d.ts +6 -0
- package/dist/utils/make-rect.js +12 -0
- package/dist/utils/make-triangle.d.ts +6 -0
- package/dist/utils/make-triangle.js +57 -0
- package/dist/utils/shape-info.d.ts +6 -0
- package/dist/utils/shape-info.js +2 -0
- package/package/dist/Ellipse.d.ts +10 -0
- package/package/dist/Ellipse.js +12 -0
- package/package/dist/circle.d.ts +10 -0
- package/package/dist/circle.js +13 -0
- package/package/dist/components/circle.d.ts +5 -0
- package/package/dist/components/circle.js +10 -0
- package/package/dist/components/ellipse.d.ts +5 -0
- package/package/dist/components/ellipse.js +10 -0
- package/package/dist/components/rect.d.ts +5 -0
- package/package/dist/components/rect.js +10 -0
- package/package/dist/components/render-svg.d.ts +12 -0
- package/package/dist/components/render-svg.js +21 -0
- package/package/dist/components/return-type.d.ts +5 -0
- package/package/dist/components/return-type.js +2 -0
- package/package/dist/components/shape-info.d.ts +5 -0
- package/package/dist/components/shape-info.js +2 -0
- package/package/dist/components/triangle.d.ts +5 -0
- package/package/dist/components/triangle.js +10 -0
- package/package/dist/index.d.ts +8 -0
- package/package/dist/index.js +19 -0
- package/package/dist/make-circle.d.ts +4 -0
- package/package/dist/make-circle.js +9 -0
- package/package/dist/make-ellipse.d.ts +5 -0
- package/package/dist/make-ellipse.js +7 -0
- package/package/dist/make-rect.d.ts +5 -0
- package/package/dist/make-rect.js +9 -0
- package/package/dist/make-triangle.d.ts +6 -0
- package/package/dist/make-triangle.js +14 -0
- package/package/dist/rect.d.ts +8 -0
- package/package/dist/rect.js +12 -0
- package/package/dist/triangle.d.ts +9 -0
- package/package/dist/triangle.js +13 -0
- package/package/dist/utils/make-circle.d.ts +5 -0
- package/package/dist/utils/make-circle.js +12 -0
- package/package/dist/utils/make-ellipse.d.ts +6 -0
- package/package/dist/utils/make-ellipse.js +12 -0
- package/package/dist/utils/make-rect.d.ts +6 -0
- package/package/dist/utils/make-rect.js +12 -0
- package/package/dist/utils/make-triangle.d.ts +6 -0
- package/package/dist/utils/make-triangle.js +57 -0
- package/package/dist/utils/shape-info.d.ts +6 -0
- package/package/dist/utils/shape-info.js +2 -0
- package/package.json +48 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2023 JonnyBurger
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## @remotion/shapes
|
|
2
|
+
|
|
3
|
+
A package providing utility functions for creating shapes with SVG.
|
|
4
|
+
|
|
5
|
+
Documentation: https://remotion.dev/shapes
|
|
6
|
+
|
|
7
|
+
No dependencies are needed, meaning this package can be used independently of Remotion.
|
|
8
|
+
|
|
9
|
+
## API
|
|
10
|
+
|
|
11
|
+
- [`makeRect()`](https://remotion.dev/docs/shapes/make-rect)
|
|
12
|
+
- [`makeCircle()`](https://remotion.dev/docs/shapes/make-circle)
|
|
13
|
+
- [`makeTriangle()`](https://remotion.dev/docs/shapes/make-triangle)
|
|
14
|
+
- [`makeEllipse()`](https://remotion.dev/docs/shapes/make-ellipse)
|
|
15
|
+
- [`<Circle />`](https://remotion.dev/docs/shapes/circle)
|
|
16
|
+
- [`<Rect />`](https://remotion.dev/shapes/shapes/rect)
|
|
17
|
+
- [`<Triangle />`](https://remotion.dev/shapes/shapes/triangle)
|
|
18
|
+
- [`<Ellipse />`](https://remotion.dev/shapes/shapes/ellipse)
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
MIT
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type EllipseProps = React.SVGProps<SVGPathElement> & {
|
|
3
|
+
rx: number;
|
|
4
|
+
ry: number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export declare const Ellipse: React.FC<EllipseProps>;
|
package/dist/Ellipse.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ellipse = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_ellipse_1 = require("./make-ellipse");
|
|
6
|
+
const Ellipse = ({ fill, stroke, strokeWidth, rx, ry, style, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: rx * 2, height: ry * 2, viewBox: `0 0 ${rx * 2} ${ry * 2}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "ellipse", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_ellipse_1.makeEllipse)({
|
|
8
|
+
rx,
|
|
9
|
+
ry,
|
|
10
|
+
}), fill: fill, stroke: stroke, strokeWidth: strokeWidth }) }));
|
|
11
|
+
};
|
|
12
|
+
exports.Ellipse = Ellipse;
|
package/dist/circle.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type CircleProps = React.SVGProps<SVGPathElement> & {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export declare const Circle: React.FC<CircleProps>;
|
package/dist/circle.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Circle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_circle_1 = require("./make-circle");
|
|
6
|
+
const Circle = ({ width, height, fill, stroke, strokeWidth, style, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "circle", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_circle_1.makeCircle)({
|
|
8
|
+
cx: 50,
|
|
9
|
+
cy: 50,
|
|
10
|
+
radius: 50,
|
|
11
|
+
}), fill: fill, stroke: stroke, strokeWidth: strokeWidth }) }));
|
|
12
|
+
};
|
|
13
|
+
exports.Circle = Circle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Circle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_circle_1 = require("../utils/make-circle");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Circle = ({ radius, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_circle_1.makeCircle)({ radius }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Circle = Circle;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MakeEllipseOptions } from '../utils/make-ellipse';
|
|
3
|
+
import type { AllShapesProps } from './render-svg';
|
|
4
|
+
export declare type EllipseProps = MakeEllipseOptions & AllShapesProps;
|
|
5
|
+
export declare const Ellipse: React.FC<EllipseProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ellipse = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_ellipse_1 = require("../utils/make-ellipse");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Ellipse = ({ rx, ry, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_ellipse_1.makeEllipse)({ rx, ry }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Ellipse = Ellipse;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rect = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_rect_1 = require("../utils/make-rect");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Rect = ({ width, height, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_rect_1.makeRect)({ height, width }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Rect = Rect;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type AllShapesProps = Omit<React.SVGProps<SVGPathElement>, 'width' | 'height' | 'd'> & {
|
|
3
|
+
pathStyle?: React.CSSProperties;
|
|
4
|
+
};
|
|
5
|
+
export declare const RenderSvg: ({ width, height, path, style, pathStyle, transformOrigin, ...props }: {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
path: string;
|
|
9
|
+
transformOrigin: string;
|
|
10
|
+
} & Omit<React.SVGProps<SVGPathElement>, "width" | "height" | "d"> & {
|
|
11
|
+
pathStyle?: React.CSSProperties | undefined;
|
|
12
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderSvg = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const RenderSvg = ({ width, height, path, style, pathStyle, transformOrigin, ...props }) => {
|
|
7
|
+
const actualStyle = (0, react_1.useMemo)(() => {
|
|
8
|
+
return {
|
|
9
|
+
overflow: 'visible',
|
|
10
|
+
...(style !== null && style !== void 0 ? style : {}),
|
|
11
|
+
};
|
|
12
|
+
}, [style]);
|
|
13
|
+
const actualPathStyle = (0, react_1.useMemo)(() => {
|
|
14
|
+
return {
|
|
15
|
+
transformBox: 'fill-box',
|
|
16
|
+
...(pathStyle !== null && pathStyle !== void 0 ? pathStyle : {}),
|
|
17
|
+
};
|
|
18
|
+
}, [pathStyle]);
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: actualStyle, children: (0, jsx_runtime_1.jsx)("path", { "transform-origin": transformOrigin, d: path, style: actualPathStyle, ...props }) }));
|
|
20
|
+
};
|
|
21
|
+
exports.RenderSvg = RenderSvg;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MakeTriangleProps } from '../utils/make-triangle';
|
|
3
|
+
import type { AllShapesProps } from './render-svg';
|
|
4
|
+
export declare type TriangleProps = MakeTriangleProps & AllShapesProps;
|
|
5
|
+
export declare const Triangle: React.FC<TriangleProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Triangle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_triangle_1 = require("../utils/make-triangle");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Triangle = ({ length, direction, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_triangle_1.makeTriangle)({ length, direction }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Triangle = Triangle;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Circle, CircleProps } from './components/circle';
|
|
2
|
+
export { Ellipse, EllipseProps } from './components/ellipse';
|
|
3
|
+
export { Rect, RectProps } from './components/rect';
|
|
4
|
+
export { Triangle, TriangleProps } from './components/triangle';
|
|
5
|
+
export { makeCircle, MakeCircleProps } from './utils/make-circle';
|
|
6
|
+
export { makeEllipse, MakeEllipseOptions } from './utils/make-ellipse';
|
|
7
|
+
export { makeRect, MakeRectOptions } from './utils/make-rect';
|
|
8
|
+
export { makeTriangle, MakeTriangleProps } from './utils/make-triangle';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeTriangle = exports.makeRect = exports.makeEllipse = exports.makeCircle = exports.Triangle = exports.Rect = exports.Ellipse = exports.Circle = void 0;
|
|
4
|
+
var circle_1 = require("./components/circle");
|
|
5
|
+
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.Circle; } });
|
|
6
|
+
var ellipse_1 = require("./components/ellipse");
|
|
7
|
+
Object.defineProperty(exports, "Ellipse", { enumerable: true, get: function () { return ellipse_1.Ellipse; } });
|
|
8
|
+
var rect_1 = require("./components/rect");
|
|
9
|
+
Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return rect_1.Rect; } });
|
|
10
|
+
var triangle_1 = require("./components/triangle");
|
|
11
|
+
Object.defineProperty(exports, "Triangle", { enumerable: true, get: function () { return triangle_1.Triangle; } });
|
|
12
|
+
var make_circle_1 = require("./utils/make-circle");
|
|
13
|
+
Object.defineProperty(exports, "makeCircle", { enumerable: true, get: function () { return make_circle_1.makeCircle; } });
|
|
14
|
+
var make_ellipse_1 = require("./utils/make-ellipse");
|
|
15
|
+
Object.defineProperty(exports, "makeEllipse", { enumerable: true, get: function () { return make_ellipse_1.makeEllipse; } });
|
|
16
|
+
var make_rect_1 = require("./utils/make-rect");
|
|
17
|
+
Object.defineProperty(exports, "makeRect", { enumerable: true, get: function () { return make_rect_1.makeRect; } });
|
|
18
|
+
var make_triangle_1 = require("./utils/make-triangle");
|
|
19
|
+
Object.defineProperty(exports, "makeTriangle", { enumerable: true, get: function () { return make_triangle_1.makeTriangle; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCircle = void 0;
|
|
4
|
+
const makeCircle = ({ radius }) => {
|
|
5
|
+
const cx = radius;
|
|
6
|
+
const cy = radius;
|
|
7
|
+
return `M ${cx} ${cy} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${radius * 2} 0 ${radius} ${radius} 0 1 0 ${-radius * 2} 0`;
|
|
8
|
+
};
|
|
9
|
+
exports.makeCircle = makeCircle;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRect = void 0;
|
|
4
|
+
const makeRect = ({ width, height }) => {
|
|
5
|
+
const x = 0;
|
|
6
|
+
const y = 0;
|
|
7
|
+
return `M ${x} ${y} l ${width} 0 l 0 ${height} l ${-width} 0 Z`;
|
|
8
|
+
};
|
|
9
|
+
exports.makeRect = makeRect;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copied from https://stackblitz.com/edit/react-triangle-svg?file=index.js
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.makeTriangle = void 0;
|
|
5
|
+
const makeTriangle = ({ width, height, direction = 'right', }) => {
|
|
6
|
+
const points = {
|
|
7
|
+
top: [`${width / 2} 0`, 'L', `0 ${height}`, 'L', `${width} ${height}`],
|
|
8
|
+
right: [`0 0`, 'L', `0 ${height}`, 'L', `${width} ${height / 2}`],
|
|
9
|
+
bottom: [`0 0`, 'L', `${width} 0`, 'L', `${width / 2} ${height}`],
|
|
10
|
+
left: [`${width} 0`, 'L', `${width} ${height}`, 'L', `0 ${height / 2}`],
|
|
11
|
+
};
|
|
12
|
+
return `M ${points[direction].join(' ')} z`;
|
|
13
|
+
};
|
|
14
|
+
exports.makeTriangle = makeTriangle;
|
package/dist/rect.d.ts
ADDED
package/dist/rect.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rect = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_rect_1 = require("./make-rect");
|
|
6
|
+
const Rect = ({ width, height, fill, style }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "rect", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_rect_1.makeRect)({
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
}), fill: fill }) }));
|
|
11
|
+
};
|
|
12
|
+
exports.Rect = Rect;
|
package/dist/triangle.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Triangle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_triangle_1 = require("./make-triangle");
|
|
6
|
+
const Triangle = ({ width, height, fill, direction, style, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "triangle", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_triangle_1.makeTriangle)({
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
direction,
|
|
11
|
+
}), fill: fill }) }));
|
|
12
|
+
};
|
|
13
|
+
exports.Triangle = Triangle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCircle = void 0;
|
|
4
|
+
const makeCircle = ({ radius }) => {
|
|
5
|
+
return {
|
|
6
|
+
height: radius * 2,
|
|
7
|
+
width: radius * 2,
|
|
8
|
+
path: `M ${radius} ${radius} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${radius * 2} 0 ${radius} ${radius} 0 1 0 ${-radius * 2} 0`,
|
|
9
|
+
transformOrigin: `${radius} ${radius}`,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.makeCircle = makeCircle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeEllipse = void 0;
|
|
4
|
+
const makeEllipse = ({ rx, ry }) => {
|
|
5
|
+
return {
|
|
6
|
+
width: rx * 2,
|
|
7
|
+
height: ry * 2,
|
|
8
|
+
path: `M ${rx} ${0} a ${rx} ${ry} 0 1 0 1 0`,
|
|
9
|
+
transformOrigin: `${rx} ${ry}`,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.makeEllipse = makeEllipse;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRect = void 0;
|
|
4
|
+
const makeRect = ({ width, height }) => {
|
|
5
|
+
return {
|
|
6
|
+
width,
|
|
7
|
+
height,
|
|
8
|
+
path: `M 0 0 l ${width} 0 l 0 ${height} l ${-width} 0 Z`,
|
|
9
|
+
transformOrigin: `${width / 2} ${height / 2}`,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.makeRect = makeRect;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copied from https://stackblitz.com/edit/react-triangle-svg?file=index.js
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.makeTriangle = void 0;
|
|
5
|
+
const makeTriangle = ({ length, direction = 'right', }) => {
|
|
6
|
+
const longerDimension = length;
|
|
7
|
+
const shorterSize = Math.sqrt(length ** 2 * 0.75); // Calculated on paper;
|
|
8
|
+
const points = {
|
|
9
|
+
top: [
|
|
10
|
+
`${longerDimension / 2} 0`,
|
|
11
|
+
'L',
|
|
12
|
+
`0 ${shorterSize}`,
|
|
13
|
+
'L',
|
|
14
|
+
`${longerDimension} ${shorterSize}`,
|
|
15
|
+
],
|
|
16
|
+
right: [
|
|
17
|
+
`0 0`,
|
|
18
|
+
'L',
|
|
19
|
+
`0 ${longerDimension}`,
|
|
20
|
+
'L',
|
|
21
|
+
`${shorterSize} ${longerDimension / 2}`,
|
|
22
|
+
],
|
|
23
|
+
bottom: [
|
|
24
|
+
`0 0`,
|
|
25
|
+
'L',
|
|
26
|
+
`${longerDimension} 0`,
|
|
27
|
+
'L',
|
|
28
|
+
`${longerDimension / 2} ${shorterSize}`,
|
|
29
|
+
],
|
|
30
|
+
left: [
|
|
31
|
+
`${shorterSize} 0`,
|
|
32
|
+
'L',
|
|
33
|
+
`${shorterSize} ${longerDimension}`,
|
|
34
|
+
'L',
|
|
35
|
+
`0 ${longerDimension / 2}`,
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
const transformOriginX = {
|
|
39
|
+
left: (shorterSize / 3) * 2,
|
|
40
|
+
right: shorterSize / 3,
|
|
41
|
+
top: longerDimension / 2,
|
|
42
|
+
bottom: longerDimension / 2,
|
|
43
|
+
}[direction];
|
|
44
|
+
const transformOriginY = {
|
|
45
|
+
top: (shorterSize / 3) * 2,
|
|
46
|
+
bottom: shorterSize / 3,
|
|
47
|
+
left: longerDimension / 2,
|
|
48
|
+
right: longerDimension / 2,
|
|
49
|
+
}[direction];
|
|
50
|
+
return {
|
|
51
|
+
path: `M ${points[direction].join(' ')} z`,
|
|
52
|
+
width: direction === 'top' || direction === 'bottom' ? length : shorterSize,
|
|
53
|
+
height: direction === 'top' || direction === 'bottom' ? shorterSize : length,
|
|
54
|
+
transformOrigin: `${transformOriginX} ${transformOriginY}`,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
exports.makeTriangle = makeTriangle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type EllipseProps = React.SVGProps<SVGPathElement> & {
|
|
3
|
+
rx: number;
|
|
4
|
+
ry: number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export declare const Ellipse: React.FC<EllipseProps>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ellipse = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_ellipse_1 = require("./make-ellipse");
|
|
6
|
+
const Ellipse = ({ fill, stroke, strokeWidth, rx, ry, style, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: rx * 2, height: ry * 2, viewBox: `0 0 ${rx * 2} ${ry * 2}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "ellipse", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_ellipse_1.makeEllipse)({
|
|
8
|
+
rx,
|
|
9
|
+
ry,
|
|
10
|
+
}), fill: fill, stroke: stroke, strokeWidth: strokeWidth }) }));
|
|
11
|
+
};
|
|
12
|
+
exports.Ellipse = Ellipse;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type CircleProps = React.SVGProps<SVGPathElement> & {
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
fill?: string;
|
|
6
|
+
stroke?: string;
|
|
7
|
+
strokeWidth?: number;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
};
|
|
10
|
+
export declare const Circle: React.FC<CircleProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Circle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_circle_1 = require("./make-circle");
|
|
6
|
+
const Circle = ({ width, height, fill, stroke, strokeWidth, style, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "circle", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_circle_1.makeCircle)({
|
|
8
|
+
cx: 50,
|
|
9
|
+
cy: 50,
|
|
10
|
+
radius: 50,
|
|
11
|
+
}), fill: fill, stroke: stroke, strokeWidth: strokeWidth }) }));
|
|
12
|
+
};
|
|
13
|
+
exports.Circle = Circle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Circle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_circle_1 = require("../utils/make-circle");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Circle = ({ radius, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_circle_1.makeCircle)({ radius }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Circle = Circle;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MakeEllipseOptions } from '../utils/make-ellipse';
|
|
3
|
+
import type { AllShapesProps } from './render-svg';
|
|
4
|
+
export declare type EllipseProps = MakeEllipseOptions & AllShapesProps;
|
|
5
|
+
export declare const Ellipse: React.FC<EllipseProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ellipse = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_ellipse_1 = require("../utils/make-ellipse");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Ellipse = ({ rx, ry, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_ellipse_1.makeEllipse)({ rx, ry }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Ellipse = Ellipse;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rect = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_rect_1 = require("../utils/make-rect");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Rect = ({ width, height, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_rect_1.makeRect)({ height, width }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Rect = Rect;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare type AllShapesProps = Omit<React.SVGProps<SVGPathElement>, 'width' | 'height' | 'd'> & {
|
|
3
|
+
pathStyle?: React.CSSProperties;
|
|
4
|
+
};
|
|
5
|
+
export declare const RenderSvg: ({ width, height, path, style, pathStyle, transformOrigin, ...props }: {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
path: string;
|
|
9
|
+
transformOrigin: string;
|
|
10
|
+
} & Omit<React.SVGProps<SVGPathElement>, "width" | "height" | "d"> & {
|
|
11
|
+
pathStyle?: React.CSSProperties | undefined;
|
|
12
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RenderSvg = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const RenderSvg = ({ width, height, path, style, pathStyle, transformOrigin, ...props }) => {
|
|
7
|
+
const actualStyle = (0, react_1.useMemo)(() => {
|
|
8
|
+
return {
|
|
9
|
+
overflow: 'visible',
|
|
10
|
+
...(style !== null && style !== void 0 ? style : {}),
|
|
11
|
+
};
|
|
12
|
+
}, [style]);
|
|
13
|
+
const actualPathStyle = (0, react_1.useMemo)(() => {
|
|
14
|
+
return {
|
|
15
|
+
transformBox: 'fill-box',
|
|
16
|
+
...(pathStyle !== null && pathStyle !== void 0 ? pathStyle : {}),
|
|
17
|
+
};
|
|
18
|
+
}, [pathStyle]);
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: actualStyle, children: (0, jsx_runtime_1.jsx)("path", { "transform-origin": transformOrigin, d: path, style: actualPathStyle, ...props }) }));
|
|
20
|
+
};
|
|
21
|
+
exports.RenderSvg = RenderSvg;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MakeTriangleProps } from '../utils/make-triangle';
|
|
3
|
+
import type { AllShapesProps } from './render-svg';
|
|
4
|
+
export declare type TriangleProps = MakeTriangleProps & AllShapesProps;
|
|
5
|
+
export declare const Triangle: React.FC<TriangleProps>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Triangle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_triangle_1 = require("../utils/make-triangle");
|
|
6
|
+
const render_svg_1 = require("./render-svg");
|
|
7
|
+
const Triangle = ({ length, direction, ...props }) => {
|
|
8
|
+
return (0, jsx_runtime_1.jsx)(render_svg_1.RenderSvg, { ...(0, make_triangle_1.makeTriangle)({ length, direction }), ...props });
|
|
9
|
+
};
|
|
10
|
+
exports.Triangle = Triangle;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { Circle, CircleProps } from './components/circle';
|
|
2
|
+
export { Ellipse, EllipseProps } from './components/ellipse';
|
|
3
|
+
export { Rect, RectProps } from './components/rect';
|
|
4
|
+
export { Triangle, TriangleProps } from './components/triangle';
|
|
5
|
+
export { makeCircle, MakeCircleProps } from './utils/make-circle';
|
|
6
|
+
export { makeEllipse, MakeEllipseOptions } from './utils/make-ellipse';
|
|
7
|
+
export { makeRect, MakeRectOptions } from './utils/make-rect';
|
|
8
|
+
export { makeTriangle, MakeTriangleProps } from './utils/make-triangle';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeTriangle = exports.makeRect = exports.makeEllipse = exports.makeCircle = exports.Triangle = exports.Rect = exports.Ellipse = exports.Circle = void 0;
|
|
4
|
+
var circle_1 = require("./components/circle");
|
|
5
|
+
Object.defineProperty(exports, "Circle", { enumerable: true, get: function () { return circle_1.Circle; } });
|
|
6
|
+
var ellipse_1 = require("./components/ellipse");
|
|
7
|
+
Object.defineProperty(exports, "Ellipse", { enumerable: true, get: function () { return ellipse_1.Ellipse; } });
|
|
8
|
+
var rect_1 = require("./components/rect");
|
|
9
|
+
Object.defineProperty(exports, "Rect", { enumerable: true, get: function () { return rect_1.Rect; } });
|
|
10
|
+
var triangle_1 = require("./components/triangle");
|
|
11
|
+
Object.defineProperty(exports, "Triangle", { enumerable: true, get: function () { return triangle_1.Triangle; } });
|
|
12
|
+
var make_circle_1 = require("./utils/make-circle");
|
|
13
|
+
Object.defineProperty(exports, "makeCircle", { enumerable: true, get: function () { return make_circle_1.makeCircle; } });
|
|
14
|
+
var make_ellipse_1 = require("./utils/make-ellipse");
|
|
15
|
+
Object.defineProperty(exports, "makeEllipse", { enumerable: true, get: function () { return make_ellipse_1.makeEllipse; } });
|
|
16
|
+
var make_rect_1 = require("./utils/make-rect");
|
|
17
|
+
Object.defineProperty(exports, "makeRect", { enumerable: true, get: function () { return make_rect_1.makeRect; } });
|
|
18
|
+
var make_triangle_1 = require("./utils/make-triangle");
|
|
19
|
+
Object.defineProperty(exports, "makeTriangle", { enumerable: true, get: function () { return make_triangle_1.makeTriangle; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCircle = void 0;
|
|
4
|
+
const makeCircle = ({ radius }) => {
|
|
5
|
+
const cx = radius;
|
|
6
|
+
const cy = radius;
|
|
7
|
+
return `M ${cx} ${cy} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${radius * 2} 0 ${radius} ${radius} 0 1 0 ${-radius * 2} 0`;
|
|
8
|
+
};
|
|
9
|
+
exports.makeCircle = makeCircle;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRect = void 0;
|
|
4
|
+
const makeRect = ({ width, height }) => {
|
|
5
|
+
const x = 0;
|
|
6
|
+
const y = 0;
|
|
7
|
+
return `M ${x} ${y} l ${width} 0 l 0 ${height} l ${-width} 0 Z`;
|
|
8
|
+
};
|
|
9
|
+
exports.makeRect = makeRect;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copied from https://stackblitz.com/edit/react-triangle-svg?file=index.js
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.makeTriangle = void 0;
|
|
5
|
+
const makeTriangle = ({ width, height, direction = 'right', }) => {
|
|
6
|
+
const points = {
|
|
7
|
+
top: [`${width / 2} 0`, 'L', `0 ${height}`, 'L', `${width} ${height}`],
|
|
8
|
+
right: [`0 0`, 'L', `0 ${height}`, 'L', `${width} ${height / 2}`],
|
|
9
|
+
bottom: [`0 0`, 'L', `${width} 0`, 'L', `${width / 2} ${height}`],
|
|
10
|
+
left: [`${width} 0`, 'L', `${width} ${height}`, 'L', `0 ${height / 2}`],
|
|
11
|
+
};
|
|
12
|
+
return `M ${points[direction].join(' ')} z`;
|
|
13
|
+
};
|
|
14
|
+
exports.makeTriangle = makeTriangle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Rect = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_rect_1 = require("./make-rect");
|
|
6
|
+
const Rect = ({ width, height, fill, style }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "rect", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_rect_1.makeRect)({
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
}), fill: fill }) }));
|
|
11
|
+
};
|
|
12
|
+
exports.Rect = Rect;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Triangle = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const make_triangle_1 = require("./make-triangle");
|
|
6
|
+
const Triangle = ({ width, height, fill, direction, style, }) => {
|
|
7
|
+
return ((0, jsx_runtime_1.jsx)("svg", { width: width, height: height, viewBox: `0 0 ${width} ${height}`, xmlns: "http://www.w3.org/2000/svg", style: style, "data-shape-type": "triangle", children: (0, jsx_runtime_1.jsx)("path", { d: (0, make_triangle_1.makeTriangle)({
|
|
8
|
+
width,
|
|
9
|
+
height,
|
|
10
|
+
direction,
|
|
11
|
+
}), fill: fill }) }));
|
|
12
|
+
};
|
|
13
|
+
exports.Triangle = Triangle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeCircle = void 0;
|
|
4
|
+
const makeCircle = ({ radius }) => {
|
|
5
|
+
return {
|
|
6
|
+
height: radius * 2,
|
|
7
|
+
width: radius * 2,
|
|
8
|
+
path: `M ${radius} ${radius} m -${radius} 0 a ${radius} ${radius} 0 1 0 ${radius * 2} 0 ${radius} ${radius} 0 1 0 ${-radius * 2} 0`,
|
|
9
|
+
transformOrigin: `${radius} ${radius}`,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.makeCircle = makeCircle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeEllipse = void 0;
|
|
4
|
+
const makeEllipse = ({ rx, ry }) => {
|
|
5
|
+
return {
|
|
6
|
+
width: rx * 2,
|
|
7
|
+
height: ry * 2,
|
|
8
|
+
path: `M ${rx} ${0} a ${rx} ${ry} 0 1 0 1 0`,
|
|
9
|
+
transformOrigin: `${rx} ${ry}`,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.makeEllipse = makeEllipse;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.makeRect = void 0;
|
|
4
|
+
const makeRect = ({ width, height }) => {
|
|
5
|
+
return {
|
|
6
|
+
width,
|
|
7
|
+
height,
|
|
8
|
+
path: `M 0 0 l ${width} 0 l 0 ${height} l ${-width} 0 Z`,
|
|
9
|
+
transformOrigin: `${width / 2} ${height / 2}`,
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.makeRect = makeRect;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copied from https://stackblitz.com/edit/react-triangle-svg?file=index.js
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.makeTriangle = void 0;
|
|
5
|
+
const makeTriangle = ({ length, direction = 'right', }) => {
|
|
6
|
+
const longerDimension = length;
|
|
7
|
+
const shorterSize = Math.sqrt(length ** 2 * 0.75); // Calculated on paper;
|
|
8
|
+
const points = {
|
|
9
|
+
top: [
|
|
10
|
+
`${longerDimension / 2} 0`,
|
|
11
|
+
'L',
|
|
12
|
+
`0 ${shorterSize}`,
|
|
13
|
+
'L',
|
|
14
|
+
`${longerDimension} ${shorterSize}`,
|
|
15
|
+
],
|
|
16
|
+
right: [
|
|
17
|
+
`0 0`,
|
|
18
|
+
'L',
|
|
19
|
+
`0 ${longerDimension}`,
|
|
20
|
+
'L',
|
|
21
|
+
`${shorterSize} ${longerDimension / 2}`,
|
|
22
|
+
],
|
|
23
|
+
bottom: [
|
|
24
|
+
`0 0`,
|
|
25
|
+
'L',
|
|
26
|
+
`${longerDimension} 0`,
|
|
27
|
+
'L',
|
|
28
|
+
`${longerDimension / 2} ${shorterSize}`,
|
|
29
|
+
],
|
|
30
|
+
left: [
|
|
31
|
+
`${shorterSize} 0`,
|
|
32
|
+
'L',
|
|
33
|
+
`${shorterSize} ${longerDimension}`,
|
|
34
|
+
'L',
|
|
35
|
+
`0 ${longerDimension / 2}`,
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
const transformOriginX = {
|
|
39
|
+
left: (shorterSize / 3) * 2,
|
|
40
|
+
right: shorterSize / 3,
|
|
41
|
+
top: longerDimension / 2,
|
|
42
|
+
bottom: longerDimension / 2,
|
|
43
|
+
}[direction];
|
|
44
|
+
const transformOriginY = {
|
|
45
|
+
top: (shorterSize / 3) * 2,
|
|
46
|
+
bottom: shorterSize / 3,
|
|
47
|
+
left: longerDimension / 2,
|
|
48
|
+
right: longerDimension / 2,
|
|
49
|
+
}[direction];
|
|
50
|
+
return {
|
|
51
|
+
path: `M ${points[direction].join(' ')} z`,
|
|
52
|
+
width: direction === 'top' || direction === 'bottom' ? length : shorterSize,
|
|
53
|
+
height: direction === 'top' || direction === 'bottom' ? shorterSize : length,
|
|
54
|
+
transformOrigin: `${transformOriginX} ${transformOriginY}`,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
exports.makeTriangle = makeTriangle;
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@remotion/shapes",
|
|
3
|
+
"version": "3.3.32",
|
|
4
|
+
"description": "Utility functions and components for SVG shapes",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"scripts": {
|
|
8
|
+
"lint": "eslint src --ext ts,tsx",
|
|
9
|
+
"watch": "tsc -w",
|
|
10
|
+
"build": "tsc -d",
|
|
11
|
+
"test": "vitest --run"
|
|
12
|
+
},
|
|
13
|
+
"author": "Alex Fernandez, Jonny Burger <jonny@remotion.dev>",
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"repository": {
|
|
16
|
+
"url": "https://github.com/remotion-dev/remotion"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@jonny/eslint-config": "3.0.266",
|
|
23
|
+
"@testing-library/react": "^13.4.0",
|
|
24
|
+
"@types/node": "^16.7.5",
|
|
25
|
+
"@types/react": "18.0.26",
|
|
26
|
+
"@vitejs/plugin-react": "^2.0.0",
|
|
27
|
+
"eslint": "8.25.0",
|
|
28
|
+
"prettier": "^2.7.1",
|
|
29
|
+
"prettier-plugin-organize-imports": "^2.3.4",
|
|
30
|
+
"react": "18.0.0",
|
|
31
|
+
"react-dom": "18.0.0",
|
|
32
|
+
"typescript": "^4.7.0",
|
|
33
|
+
"vitest": "0.24.3"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"svg",
|
|
37
|
+
"path",
|
|
38
|
+
"utilities"
|
|
39
|
+
],
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"react": ">=16.8.0",
|
|
45
|
+
"react-dom": ">=16.8.0"
|
|
46
|
+
},
|
|
47
|
+
"gitHead": "6b4f3514c801ddf2e7f957dd2e633271fbbc75f6"
|
|
48
|
+
}
|