@remotion/paths 4.0.0-webhook.27 → 4.1.0-alpha2

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.
Files changed (69) hide show
  1. package/LICENSE.md +1 -1
  2. package/README.md +1 -2
  3. package/dist/evolve-path.d.ts +2 -2
  4. package/dist/evolve-path.js +2 -2
  5. package/dist/extend-viewbox.d.ts +2 -2
  6. package/dist/extend-viewbox.js +2 -2
  7. package/dist/get-bounding-box.d.ts +8 -0
  8. package/dist/get-bounding-box.js +185 -0
  9. package/dist/get-length.d.ts +2 -2
  10. package/dist/get-length.js +2 -2
  11. package/dist/get-point-at-length.d.ts +2 -2
  12. package/dist/get-point-at-length.js +2 -2
  13. package/dist/get-subpaths.d.ts +6 -0
  14. package/dist/get-subpaths.js +19 -0
  15. package/dist/get-tangent-at-length.d.ts +2 -2
  16. package/dist/get-tangent-at-length.js +2 -2
  17. package/dist/helpers/arc.d.ts +0 -0
  18. package/dist/helpers/arc.js +0 -0
  19. package/dist/helpers/bezier-functions.d.ts +0 -0
  20. package/dist/helpers/bezier-functions.js +0 -0
  21. package/dist/helpers/bezier-values.d.ts +0 -0
  22. package/dist/helpers/bezier-values.js +0 -0
  23. package/dist/helpers/bezier.d.ts +0 -0
  24. package/dist/helpers/bezier.js +0 -0
  25. package/dist/helpers/construct.d.ts +9 -1
  26. package/dist/helpers/construct.js +218 -128
  27. package/dist/helpers/get-part-at-length.d.ts +0 -0
  28. package/dist/helpers/get-part-at-length.js +0 -0
  29. package/dist/helpers/iterate.d.ts +14 -0
  30. package/dist/helpers/iterate.js +95 -0
  31. package/dist/helpers/linear.d.ts +6 -1
  32. package/dist/helpers/linear.js +1 -1
  33. package/dist/helpers/remove-a-s-t-curves.d.ts +2 -0
  34. package/dist/helpers/remove-a-s-t-curves.js +271 -0
  35. package/dist/helpers/split-curve.d.ts +1 -1
  36. package/dist/helpers/split-curve.js +0 -0
  37. package/dist/helpers/types.d.ts +109 -2
  38. package/dist/helpers/types.js +0 -0
  39. package/dist/index.d.ts +10 -2
  40. package/dist/index.js +19 -3
  41. package/dist/interpolate-path.d.ts +2 -2
  42. package/dist/interpolate-path.js +2 -2
  43. package/dist/normalize-path.d.ts +4 -2
  44. package/dist/normalize-path.js +141 -277
  45. package/dist/parse-path.d.ts +8 -0
  46. package/dist/parse-path.js +265 -0
  47. package/dist/reduce-instructions.d.ts +7 -0
  48. package/dist/reduce-instructions.js +15 -0
  49. package/dist/reset-path.d.ts +6 -0
  50. package/dist/reset-path.js +15 -0
  51. package/dist/reverse-path.d.ts +2 -2
  52. package/dist/reverse-path.js +73 -118
  53. package/dist/scale-path.d.ts +10 -0
  54. package/dist/scale-path.js +180 -0
  55. package/dist/serialize-instructions.d.ts +2 -0
  56. package/dist/serialize-instructions.js +78 -0
  57. package/dist/translate-path.d.ts +11 -0
  58. package/dist/translate-path.js +116 -0
  59. package/dist/warp-path/index.d.ts +10 -0
  60. package/dist/warp-path/index.js +26 -0
  61. package/dist/warp-path/warp-helpers.d.ts +14 -0
  62. package/dist/warp-path/warp-helpers.js +229 -0
  63. package/package.json +38 -38
  64. package/.prettierrc.js +0 -14
  65. package/dist/get-parts.d.ts +0 -7
  66. package/dist/get-parts.js +0 -31
  67. package/dist/helpers/parse.d.ts +0 -2
  68. package/dist/helpers/parse.js +0 -49
  69. package/tsconfig.json +0 -9
package/package.json CHANGED
@@ -1,39 +1,39 @@
1
1
  {
2
- "name": "@remotion/paths",
3
- "version": "4.0.0-webhook.27+eb81308ee",
4
- "description": "Utility functions for SVG paths",
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": "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
- "@types/node": "^16.7.5",
24
- "eslint": "8.13.0",
25
- "prettier": "^2.0.5",
26
- "prettier-plugin-organize-imports": "^2.3.4",
27
- "typescript": "^4.7.0",
28
- "vitest": "^0.18.0"
29
- },
30
- "keywords": [
31
- "svg",
32
- "path",
33
- "utilities"
34
- ],
35
- "publishConfig": {
36
- "access": "public"
37
- },
38
- "gitHead": "eb81308ee07a402f4a8dd9ff24306bb07dd78175"
39
- }
2
+ "name": "@remotion/paths",
3
+ "version": "4.1.0-alpha2",
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
@@ -1,14 +0,0 @@
1
- module.exports = {
2
- singleQuote: true,
3
- bracketSpacing: false,
4
- useTabs: true,
5
- overrides: [
6
- {
7
- files: ['*.yml'],
8
- options: {
9
- singleQuote: false,
10
- },
11
- },
12
- ],
13
- plugins: [require.resolve('prettier-plugin-organize-imports')],
14
- };
@@ -1,7 +0,0 @@
1
- import type { Part } from './helpers/types';
2
- /**
3
- * Splits a valid SVG path into it's parts.
4
- * @param {string} path A valid SVG path
5
- * @link https://remotion.dev/docs/paths/get-parts
6
- */
7
- export declare const getParts: (path: string) => Part[];
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;
@@ -1,2 +0,0 @@
1
- declare const _default: (path: string) => [string, ...number[]][];
2
- export default _default;
@@ -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
- };
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../tsconfig.settings.json",
3
- "compilerOptions": {
4
- "composite": true,
5
- "rootDir": "src",
6
- "outDir": "dist"
7
- },
8
- "include": ["src"]
9
- }