@remotion/paths 4.0.0-alpha12 → 4.0.0-alpha14
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.
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Part } from './helpers/types';
|
|
2
|
+
/**
|
|
3
|
+
* @description Splits a valid SVG path into it's parts.
|
|
4
|
+
* @param {string} path A valid SVG path
|
|
5
|
+
* @see [Documentation](https://remotion.dev/docs/paths/get-parts)
|
|
6
|
+
* @deprecated In favor of getSubpaths()
|
|
7
|
+
*/
|
|
8
|
+
export declare const getParts: (path: string) => Part[];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getParts = void 0;
|
|
4
|
+
const construct_1 = require("./helpers/construct");
|
|
5
|
+
/**
|
|
6
|
+
* @description Splits a valid SVG path into it's parts.
|
|
7
|
+
* @param {string} path A valid SVG path
|
|
8
|
+
* @see [Documentation](https://remotion.dev/docs/paths/get-parts)
|
|
9
|
+
* @deprecated In favor of getSubpaths()
|
|
10
|
+
*/
|
|
11
|
+
const getParts = (path) => {
|
|
12
|
+
const parts = [];
|
|
13
|
+
const constructed = (0, construct_1.construct)(path);
|
|
14
|
+
let i = 0;
|
|
15
|
+
for (const fn of constructed.functions) {
|
|
16
|
+
if (!fn) {
|
|
17
|
+
i++;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
const properties = {
|
|
21
|
+
start: fn.getPointAtLength(0),
|
|
22
|
+
end: fn.getPointAtLength(constructed.partial_lengths[i] - constructed.partial_lengths[i - 1]),
|
|
23
|
+
length: constructed.partial_lengths[i] - constructed.partial_lengths[i - 1],
|
|
24
|
+
getPointAtLength: fn.getPointAtLength,
|
|
25
|
+
getTangentAtLength: fn.getTangentAtLength,
|
|
26
|
+
};
|
|
27
|
+
i++;
|
|
28
|
+
parts.push(properties);
|
|
29
|
+
}
|
|
30
|
+
return parts;
|
|
31
|
+
};
|
|
32
|
+
exports.getParts = getParts;
|
package/dist/helpers/types.d.ts
CHANGED
|
@@ -14,12 +14,12 @@ export interface Point {
|
|
|
14
14
|
x: number;
|
|
15
15
|
y: number;
|
|
16
16
|
}
|
|
17
|
-
export
|
|
17
|
+
export type PointArray = [number, number];
|
|
18
18
|
export interface PointProperties {
|
|
19
19
|
tangentX: number;
|
|
20
20
|
tangentY: number;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
22
|
+
export type BoundingBox = {
|
|
23
23
|
x1: number;
|
|
24
24
|
y1: number;
|
|
25
25
|
x2: number;
|
|
@@ -28,7 +28,7 @@ export declare type BoundingBox = {
|
|
|
28
28
|
width: number;
|
|
29
29
|
height: number;
|
|
30
30
|
};
|
|
31
|
-
export
|
|
31
|
+
export type ReducedInstruction = {
|
|
32
32
|
type: 'M';
|
|
33
33
|
x: number;
|
|
34
34
|
y: number;
|
|
@@ -53,7 +53,7 @@ export declare type ReducedInstruction = {
|
|
|
53
53
|
} | {
|
|
54
54
|
type: 'Z';
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type AbsoluteInstruction = ReducedInstruction | {
|
|
57
57
|
type: 'A';
|
|
58
58
|
rx: number;
|
|
59
59
|
ry: number;
|
|
@@ -79,7 +79,7 @@ export declare type AbsoluteInstruction = ReducedInstruction | {
|
|
|
79
79
|
type: 'V';
|
|
80
80
|
y: number;
|
|
81
81
|
};
|
|
82
|
-
export
|
|
82
|
+
export type Instruction = AbsoluteInstruction | {
|
|
83
83
|
type: 'm';
|
|
84
84
|
dx: number;
|
|
85
85
|
dy: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/paths",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-alpha14",
|
|
4
4
|
"description": "Utility functions for SVG paths",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@jonny/eslint-config": "3.0.266",
|
|
17
17
|
"@types/node": "18.14.6",
|
|
18
|
-
"eslint": "8.
|
|
18
|
+
"eslint": "8.42.0",
|
|
19
19
|
"prettier": "^2.7.1",
|
|
20
20
|
"prettier-plugin-organize-imports": "^2.3.4",
|
|
21
|
-
"typescript": "
|
|
21
|
+
"typescript": "4.9.5",
|
|
22
22
|
"vitest": "0.31.1"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|