@remotion/shapes 3.3.45 → 3.3.51

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.
@@ -1,8 +1,5 @@
1
1
  import type { Instruction } from '@remotion/paths';
2
- export declare const joinPoints: (points: [
3
- number,
4
- number
5
- ][], { edgeRoundness, cornerRadius, roundCornerStrategy, }: {
2
+ export declare const joinPoints: (points: [number, number][], { edgeRoundness, cornerRadius, roundCornerStrategy, }: {
6
3
  edgeRoundness: number | null;
7
4
  cornerRadius: number;
8
5
  roundCornerStrategy: 'arc' | 'bezier';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/shapes",
3
- "version": "3.3.45",
3
+ "version": "3.3.51",
4
4
  "description": "Utility functions and components for SVG shapes",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -45,7 +45,7 @@
45
45
  "react-dom": ">=16.8.0"
46
46
  },
47
47
  "dependencies": {
48
- "@remotion/paths": "3.3.45"
48
+ "@remotion/paths": "3.3.51"
49
49
  },
50
- "gitHead": "75c028236b43ff2fd0f3f3772f9f79cfde069e36"
50
+ "gitHead": "be64134aece51abd6c63e644702517c868d6c8d0"
51
51
  }
package/dist/Ellipse.d.ts DELETED
@@ -1,10 +0,0 @@
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 DELETED
@@ -1,12 +0,0 @@
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 DELETED
@@ -1,10 +0,0 @@
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 DELETED
@@ -1,13 +0,0 @@
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;
@@ -1,5 +0,0 @@
1
- export declare type ShapeInfo = {
2
- path: string;
3
- width: string;
4
- height: string;
5
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +0,0 @@
1
- export declare type ShapeInfo = {
2
- path: string;
3
- width: number;
4
- height: number;
5
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +0,0 @@
1
- export declare type MakeCircleProps = {
2
- radius: number;
3
- };
4
- export declare const makeCircle: ({ radius }: MakeCircleProps) => string;
@@ -1,9 +0,0 @@
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;
@@ -1,5 +0,0 @@
1
- export declare type MakeEllipseOptions = {
2
- rx: number;
3
- ry: number;
4
- };
5
- export declare const makeEllipse: ({ rx, ry }: MakeEllipseOptions) => string;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeEllipse = void 0;
4
- const makeEllipse = ({ rx = 50, ry = 50 }) => {
5
- return `M ${rx} ${0} a ${rx} ${ry} 0 1 0 1 0`;
6
- };
7
- exports.makeEllipse = makeEllipse;
@@ -1,5 +0,0 @@
1
- export declare type MakeRectOptions = {
2
- width: number;
3
- height: number;
4
- };
5
- export declare const makeRect: ({ width, height }: MakeRectOptions) => string;
package/dist/make-rect.js DELETED
@@ -1,9 +0,0 @@
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;
@@ -1,6 +0,0 @@
1
- export declare type MakeTriangleProps = {
2
- width: number;
3
- height: number;
4
- direction: 'right' | 'left' | 'top' | 'bottom';
5
- };
6
- export declare const makeTriangle: ({ width, height, direction, }: MakeTriangleProps) => string;
@@ -1,14 +0,0 @@
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 DELETED
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- export declare type SquareProps = {
3
- width: number;
4
- height: number;
5
- fill?: string;
6
- style?: React.CSSProperties;
7
- };
8
- export declare const Rect: React.FC<SquareProps>;
package/dist/rect.js DELETED
@@ -1,12 +0,0 @@
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;
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- export declare type TriangleProps = {
3
- width: number;
4
- height: number;
5
- fill?: string;
6
- direction: 'right' | 'left' | 'top' | 'bottom';
7
- style?: React.CSSProperties;
8
- };
9
- export declare const Triangle: React.FC<TriangleProps>;
package/dist/triangle.js DELETED
@@ -1,13 +0,0 @@
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;
@@ -1,39 +0,0 @@
1
- export declare type Instruction = {
2
- type: 'M';
3
- x: number;
4
- y: number;
5
- } | {
6
- type: 'L';
7
- x: number;
8
- y: number;
9
- } | {
10
- type: 'C';
11
- cp1x: number;
12
- cp1y: number;
13
- cp2x: number;
14
- cp2y: number;
15
- x: number;
16
- y: number;
17
- } | {
18
- type: 'a';
19
- rx: number;
20
- ry: number;
21
- xAxisRotation: number;
22
- largeArcFlag: boolean;
23
- sweepFlag: boolean;
24
- x: number;
25
- y: number;
26
- } | {
27
- type: 'A';
28
- rx: number;
29
- ry: number;
30
- xAxisRotation: number;
31
- largeArcFlag: boolean;
32
- sweepFlag: boolean;
33
- x: number;
34
- y: number;
35
- } | {
36
- type: 'z';
37
- };
38
- export declare const serializeInstructions: (instructions: Instruction[]) => string;
39
- export declare const serializeInstruction: (instruction: Instruction) => string;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeInstruction = exports.serializeInstructions = void 0;
4
- const serializeInstructions = (instructions) => {
5
- return instructions.map((i) => (0, exports.serializeInstruction)(i)).join(' ');
6
- };
7
- exports.serializeInstructions = serializeInstructions;
8
- const serializeInstruction = (instruction) => {
9
- if (instruction.type === 'M') {
10
- return `M ${instruction.x} ${instruction.y}`;
11
- }
12
- if (instruction.type === 'L') {
13
- return `L ${instruction.x} ${instruction.y}`;
14
- }
15
- if (instruction.type === 'C') {
16
- return `C ${instruction.cp1x} ${instruction.cp1y} ${instruction.cp2x} ${instruction.cp2y} ${instruction.x} ${instruction.y}`;
17
- }
18
- if (instruction.type === 'a') {
19
- return `a ${instruction.rx} ${instruction.ry} ${instruction.xAxisRotation} ${Number(instruction.largeArcFlag)} ${Number(instruction.sweepFlag ? 1 : 0)} ${instruction.x} ${instruction.y}`;
20
- }
21
- if (instruction.type === 'A') {
22
- return `A ${instruction.rx} ${instruction.ry} ${instruction.xAxisRotation} ${Number(instruction.largeArcFlag)} ${Number(instruction.sweepFlag ? 1 : 0)} ${instruction.x} ${instruction.y}`;
23
- }
24
- if (instruction.type === 'z') {
25
- return 'z';
26
- }
27
- throw new Error('not implemented');
28
- };
29
- exports.serializeInstruction = serializeInstruction;
@@ -1,10 +0,0 @@
1
- export declare type StarProps = {
2
- centerX: number;
3
- centerY: number;
4
- points: number;
5
- innerRadius: number;
6
- outerRadius: number;
7
- edgeRoundness: number | null;
8
- cornerRadius: number;
9
- };
10
- export declare const star: ({ centerX, centerY, points, innerRadius, outerRadius, cornerRadius, edgeRoundness, }: StarProps) => string;
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.star = void 0;
4
- const instructions_1 = require("./instructions");
5
- const join_points_1 = require("./join-points");
6
- const polarToCartesian = ({ centerX, centerY, radius, angleInDegrees, }) => {
7
- const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180.0;
8
- return {
9
- x: centerX + radius * Math.cos(angleInRadians),
10
- y: centerY + radius * Math.sin(angleInRadians),
11
- };
12
- };
13
- const star = ({ centerX, centerY, points, innerRadius, outerRadius, cornerRadius, edgeRoundness, }) => {
14
- const degreeIncrement = 360 / (points * 2);
15
- const d = new Array(points * 2)
16
- .fill('true')
17
- .map((_p, i) => {
18
- const radius = i % 2 === 0 ? outerRadius : innerRadius;
19
- const degrees = degreeIncrement * i;
20
- const point = polarToCartesian({
21
- centerX,
22
- centerY,
23
- radius,
24
- angleInDegrees: degrees,
25
- });
26
- return [point.x, point.y];
27
- });
28
- return (0, instructions_1.serializeInstructions)((0, join_points_1.joinPoints)([...d, d[0]], {
29
- edgeRoundness,
30
- cornerRadius,
31
- roundCornerStrategy: 'arc',
32
- }));
33
- };
34
- exports.star = star;