@remotion/paths 4.0.0-webhook.27 → 4.1.0-alpha1
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 +1 -1
- package/README.md +1 -2
- package/dist/evolve-path.d.ts +2 -2
- package/dist/evolve-path.js +2 -2
- package/dist/extend-viewbox.d.ts +2 -2
- package/dist/extend-viewbox.js +2 -2
- package/dist/get-bounding-box.d.ts +8 -0
- package/dist/get-bounding-box.js +185 -0
- package/dist/get-length.d.ts +2 -2
- package/dist/get-length.js +2 -2
- package/dist/get-point-at-length.d.ts +2 -2
- package/dist/get-point-at-length.js +2 -2
- package/dist/get-subpaths.d.ts +6 -0
- package/dist/get-subpaths.js +19 -0
- package/dist/get-tangent-at-length.d.ts +2 -2
- package/dist/get-tangent-at-length.js +2 -2
- package/dist/helpers/arc.d.ts +0 -0
- package/dist/helpers/arc.js +0 -0
- package/dist/helpers/bezier-functions.d.ts +0 -0
- package/dist/helpers/bezier-functions.js +0 -0
- package/dist/helpers/bezier-values.d.ts +0 -0
- package/dist/helpers/bezier-values.js +0 -0
- package/dist/helpers/bezier.d.ts +0 -0
- package/dist/helpers/bezier.js +0 -0
- package/dist/helpers/construct.d.ts +9 -1
- package/dist/helpers/construct.js +218 -128
- package/dist/helpers/get-part-at-length.d.ts +0 -0
- package/dist/helpers/get-part-at-length.js +0 -0
- package/dist/helpers/iterate.d.ts +14 -0
- package/dist/helpers/iterate.js +95 -0
- package/dist/helpers/linear.d.ts +6 -1
- package/dist/helpers/linear.js +1 -1
- package/dist/helpers/remove-a-s-t-curves.d.ts +2 -0
- package/dist/helpers/remove-a-s-t-curves.js +271 -0
- package/dist/helpers/split-curve.d.ts +1 -1
- package/dist/helpers/split-curve.js +0 -0
- package/dist/helpers/types.d.ts +109 -2
- package/dist/helpers/types.js +0 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +19 -3
- package/dist/interpolate-path.d.ts +2 -2
- package/dist/interpolate-path.js +2 -2
- package/dist/normalize-path.d.ts +4 -2
- package/dist/normalize-path.js +141 -277
- package/dist/parse-path.d.ts +8 -0
- package/dist/parse-path.js +265 -0
- package/dist/reduce-instructions.d.ts +7 -0
- package/dist/reduce-instructions.js +15 -0
- package/dist/reset-path.d.ts +6 -0
- package/dist/reset-path.js +15 -0
- package/dist/reverse-path.d.ts +2 -2
- package/dist/reverse-path.js +73 -118
- package/dist/scale-path.d.ts +10 -0
- package/dist/scale-path.js +180 -0
- package/dist/serialize-instructions.d.ts +2 -0
- package/dist/serialize-instructions.js +78 -0
- package/dist/translate-path.d.ts +11 -0
- package/dist/translate-path.js +116 -0
- package/dist/warp-path/index.d.ts +10 -0
- package/dist/warp-path/index.js +26 -0
- package/dist/warp-path/warp-helpers.d.ts +14 -0
- package/dist/warp-path/warp-helpers.js +229 -0
- package/package.json +38 -38
- package/.prettierrc.js +0 -14
- package/dist/get-parts.d.ts +0 -7
- package/dist/get-parts.js +0 -31
- package/dist/helpers/parse.d.ts +0 -2
- package/dist/helpers/parse.js +0 -49
- package/tsconfig.json +0 -9
package/package.json
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
2
|
+
"name": "@remotion/paths",
|
|
3
|
+
"version": "4.1.0-alpha1",
|
|
4
|
+
"description": "Utility functions for SVG paths",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"author": "Jonny Burger <jonny@remotion.dev>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"url": "https://github.com/remotion-dev/remotion"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/remotion-dev/remotion/issues"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@jonny/eslint-config": "3.0.266",
|
|
17
|
+
"@types/node": "18.14.6",
|
|
18
|
+
"eslint": "8.42.0",
|
|
19
|
+
"prettier": "^2.7.1",
|
|
20
|
+
"prettier-plugin-organize-imports": "^2.3.4",
|
|
21
|
+
"typescript": "4.9.5",
|
|
22
|
+
"vitest": "0.31.1"
|
|
23
|
+
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"svg",
|
|
26
|
+
"path",
|
|
27
|
+
"utilities"
|
|
28
|
+
],
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"formatting": "prettier src --check",
|
|
34
|
+
"lint": "eslint src --ext ts,tsx",
|
|
35
|
+
"watch": "tsc -w",
|
|
36
|
+
"build": "tsc -d",
|
|
37
|
+
"test": "vitest --run"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/.prettierrc.js
DELETED
package/dist/get-parts.d.ts
DELETED
package/dist/get-parts.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getParts = void 0;
|
|
4
|
-
const construct_1 = require("./helpers/construct");
|
|
5
|
-
/**
|
|
6
|
-
* Splits a valid SVG path into it's parts.
|
|
7
|
-
* @param {string} path A valid SVG path
|
|
8
|
-
* @link https://remotion.dev/docs/paths/get-parts
|
|
9
|
-
*/
|
|
10
|
-
const getParts = (path) => {
|
|
11
|
-
const parts = [];
|
|
12
|
-
const constructed = (0, construct_1.construct)(path);
|
|
13
|
-
let i = 0;
|
|
14
|
-
for (const fn of constructed.functions) {
|
|
15
|
-
if (!fn) {
|
|
16
|
-
i++;
|
|
17
|
-
continue;
|
|
18
|
-
}
|
|
19
|
-
const properties = {
|
|
20
|
-
start: fn.getPointAtLength(0),
|
|
21
|
-
end: fn.getPointAtLength(constructed.partial_lengths[i] - constructed.partial_lengths[i - 1]),
|
|
22
|
-
length: constructed.partial_lengths[i] - constructed.partial_lengths[i - 1],
|
|
23
|
-
getPointAtLength: fn.getPointAtLength,
|
|
24
|
-
getTangentAtLength: fn.getTangentAtLength,
|
|
25
|
-
};
|
|
26
|
-
i++;
|
|
27
|
-
parts.push(properties);
|
|
28
|
-
}
|
|
29
|
-
return parts;
|
|
30
|
-
};
|
|
31
|
-
exports.getParts = getParts;
|
package/dist/helpers/parse.d.ts
DELETED
package/dist/helpers/parse.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// Copied from: https://github.com/rveciana/svg-path-properties
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
const length = {
|
|
5
|
-
a: 7,
|
|
6
|
-
c: 6,
|
|
7
|
-
h: 1,
|
|
8
|
-
l: 2,
|
|
9
|
-
m: 2,
|
|
10
|
-
q: 4,
|
|
11
|
-
s: 4,
|
|
12
|
-
t: 2,
|
|
13
|
-
v: 1,
|
|
14
|
-
z: 0,
|
|
15
|
-
};
|
|
16
|
-
const segmentRegExp = /([astvzqmhlc])([^astvzqmhlc]*)/gi;
|
|
17
|
-
const numberRegExp = /-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/gi;
|
|
18
|
-
exports.default = (path) => {
|
|
19
|
-
const segments = (path && path.length > 0 ? path : 'M0,0').match(segmentRegExp);
|
|
20
|
-
if (!segments) {
|
|
21
|
-
throw new Error(`No path elements found in string ${path}`);
|
|
22
|
-
}
|
|
23
|
-
return segments.reduce((segmentsArray, segmentString) => {
|
|
24
|
-
let command = segmentString.charAt(0);
|
|
25
|
-
let type = command.toLowerCase();
|
|
26
|
-
const args = parseValues(segmentString.substr(1));
|
|
27
|
-
// overloaded moveTo
|
|
28
|
-
if (type === 'm' && args.length > 2) {
|
|
29
|
-
segmentsArray.push([command, ...args.splice(0, 2)]);
|
|
30
|
-
type = 'l';
|
|
31
|
-
command = command === 'm' ? 'l' : 'L';
|
|
32
|
-
}
|
|
33
|
-
while (args.length >= 0) {
|
|
34
|
-
if (args.length === length[type]) {
|
|
35
|
-
segmentsArray.push([command, ...args.splice(0, length[type])]);
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
if (args.length < length[type]) {
|
|
39
|
-
throw new Error(`Malformed path data: "${command}" must have ${length[type]} elements and has ${args.length}: ${segmentString}`);
|
|
40
|
-
}
|
|
41
|
-
segmentsArray.push([command, ...args.splice(0, length[type])]);
|
|
42
|
-
}
|
|
43
|
-
return segmentsArray;
|
|
44
|
-
}, []);
|
|
45
|
-
};
|
|
46
|
-
const parseValues = (args) => {
|
|
47
|
-
const numbers = args.match(numberRegExp);
|
|
48
|
-
return numbers ? numbers.map(Number) : [];
|
|
49
|
-
};
|