svg-path-commander 2.1.2 → 2.1.5

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 (97) hide show
  1. package/README.md +4 -4
  2. package/dist/svg-path-commander.cjs +1 -1
  3. package/dist/svg-path-commander.cjs.map +1 -1
  4. package/dist/svg-path-commander.d.ts +755 -849
  5. package/dist/svg-path-commander.js +1 -1
  6. package/dist/svg-path-commander.js.map +1 -1
  7. package/dist/svg-path-commander.mjs +947 -611
  8. package/dist/svg-path-commander.mjs.map +1 -1
  9. package/package.json +14 -22
  10. package/.eslintrc.cjs +0 -225
  11. package/.prettierrc.json +0 -15
  12. package/dts.config.ts +0 -15
  13. package/src/convert/pathToAbsolute.ts +0 -18
  14. package/src/convert/pathToCurve.ts +0 -43
  15. package/src/convert/pathToRelative.ts +0 -18
  16. package/src/convert/pathToString.ts +0 -50
  17. package/src/index.ts +0 -454
  18. package/src/interface.ts +0 -130
  19. package/src/math/arcTools.ts +0 -396
  20. package/src/math/bezier.ts +0 -261
  21. package/src/math/cubicTools.ts +0 -124
  22. package/src/math/distanceSquareRoot.ts +0 -15
  23. package/src/math/lineTools.ts +0 -69
  24. package/src/math/midPoint.ts +0 -18
  25. package/src/math/polygonTools.ts +0 -48
  26. package/src/math/quadTools.ts +0 -100
  27. package/src/math/rotateVector.ts +0 -17
  28. package/src/math/roundTo.ts +0 -7
  29. package/src/options/options.ts +0 -9
  30. package/src/parser/error.ts +0 -2
  31. package/src/parser/finalizeSegment.ts +0 -35
  32. package/src/parser/invalidPathValue.ts +0 -2
  33. package/src/parser/isArcCommand.ts +0 -11
  34. package/src/parser/isDigit.ts +0 -12
  35. package/src/parser/isDigitStart.ts +0 -14
  36. package/src/parser/isMoveCommand.ts +0 -17
  37. package/src/parser/isPathCommand.ts +0 -28
  38. package/src/parser/isSpace.ts +0 -23
  39. package/src/parser/paramsCount.ts +0 -16
  40. package/src/parser/paramsParser.ts +0 -14
  41. package/src/parser/parsePathString.ts +0 -33
  42. package/src/parser/pathParser.ts +0 -29
  43. package/src/parser/scanFlag.ts +0 -29
  44. package/src/parser/scanParam.ts +0 -102
  45. package/src/parser/scanSegment.ts +0 -84
  46. package/src/parser/skipSpaces.ts +0 -17
  47. package/src/process/absolutizeSegment.ts +0 -63
  48. package/src/process/arcToCubic.ts +0 -128
  49. package/src/process/getSVGMatrix.ts +0 -70
  50. package/src/process/iterate.ts +0 -58
  51. package/src/process/lineToCubic.ts +0 -17
  52. package/src/process/normalizePath.ts +0 -33
  53. package/src/process/normalizeSegment.ts +0 -84
  54. package/src/process/optimizePath.ts +0 -63
  55. package/src/process/projection2d.ts +0 -52
  56. package/src/process/quadToCubic.ts +0 -31
  57. package/src/process/relativizeSegment.ts +0 -59
  58. package/src/process/reverseCurve.ts +0 -24
  59. package/src/process/reversePath.ts +0 -114
  60. package/src/process/roundPath.ts +0 -33
  61. package/src/process/roundSegment.ts +0 -9
  62. package/src/process/segmentToCubic.ts +0 -48
  63. package/src/process/shortenSegment.ts +0 -71
  64. package/src/process/splitCubic.ts +0 -29
  65. package/src/process/splitPath.ts +0 -63
  66. package/src/process/transformPath.ts +0 -110
  67. package/src/types.ts +0 -228
  68. package/src/util/distanceEpsilon.ts +0 -3
  69. package/src/util/getClosestPoint.ts +0 -15
  70. package/src/util/getDrawDirection.ts +0 -16
  71. package/src/util/getPathArea.ts +0 -70
  72. package/src/util/getPathBBox.ts +0 -98
  73. package/src/util/getPointAtLength.ts +0 -110
  74. package/src/util/getPropertiesAtLength.ts +0 -67
  75. package/src/util/getPropertiesAtPoint.ts +0 -84
  76. package/src/util/getSegmentAtLength.ts +0 -15
  77. package/src/util/getSegmentOfPoint.ts +0 -18
  78. package/src/util/getTotalLength.ts +0 -68
  79. package/src/util/isAbsoluteArray.ts +0 -18
  80. package/src/util/isCurveArray.ts +0 -15
  81. package/src/util/isNormalizedArray.ts +0 -16
  82. package/src/util/isPathArray.ts +0 -24
  83. package/src/util/isPointInStroke.ts +0 -16
  84. package/src/util/isRelativeArray.ts +0 -18
  85. package/src/util/isValidPath.ts +0 -27
  86. package/src/util/shapeParams.ts +0 -16
  87. package/src/util/shapeToPath.ts +0 -86
  88. package/src/util/shapeToPathArray.ts +0 -183
  89. package/test/class.test.ts +0 -504
  90. package/test/fixtures/getMarkup.ts +0 -17
  91. package/test/fixtures/shapeObjects.ts +0 -11
  92. package/test/fixtures/shapes.js +0 -104
  93. package/test/fixtures/simpleShapes.js +0 -75
  94. package/test/static.test.ts +0 -330
  95. package/vite.config.mts +0 -41
  96. package/vitest.config-ui.mts +0 -26
  97. package/vitest.config.mts +0 -26
package/src/index.ts DELETED
@@ -1,454 +0,0 @@
1
- 'use strict';
2
- import CSSMatrix from '@thednp/dommatrix';
3
- import { PointTuple, PathArray, TransformObjectValues } from './types';
4
- import type { Options, TransformEntries, TransformObject } from './interface';
5
- export * from './types';
6
- export * from './interface';
7
- import defaultOptions from './options/options';
8
-
9
- import pathToAbsolute from './convert/pathToAbsolute';
10
- import pathToRelative from './convert/pathToRelative';
11
- import pathToCurve from './convert/pathToCurve';
12
- import pathToString from './convert/pathToString';
13
- import * as arcTools from './math/arcTools';
14
- import {
15
- Cvalues,
16
- Tvalues,
17
- minmaxC,
18
- minmaxQ,
19
- getBezierLength,
20
- bezierLength,
21
- calculateBezier,
22
- computeBezier,
23
- deriveBezier,
24
- CBEZIER_MINMAX_EPSILON,
25
- } from './math/bezier';
26
- import { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength } from './math/cubicTools';
27
- import { getPointAtLineLength, getLineBBox, getLineLength } from './math/lineTools';
28
- import { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength } from './math/quadTools';
29
- import { polygonArea, polygonLength } from './math/polygonTools';
30
-
31
- import distanceSquareRoot from './math/distanceSquareRoot';
32
- import midPoint from './math/midPoint';
33
- import rotateVector from './math/rotateVector';
34
- import roundTo from './math/roundTo';
35
-
36
- import error from './parser/error';
37
- import parsePathString from './parser/parsePathString';
38
- import finalizeSegment from './parser/finalizeSegment';
39
- import invalidPathValue from './parser/invalidPathValue';
40
- import isArcCommand from './parser/isArcCommand';
41
- import isDigit from './parser/isDigit';
42
- import isDigitStart from './parser/isDigitStart';
43
- import isMoveCommand from './parser/isMoveCommand';
44
- import isPathCommand from './parser/isPathCommand';
45
- import isSpace from './parser/isSpace';
46
- import paramsCount from './parser/paramsCount';
47
- import paramsParser from './parser/paramsParser';
48
- import pathParser from './parser/pathParser';
49
- import scanFlag from './parser/scanFlag';
50
- import scanParam from './parser/scanParam';
51
- import scanSegment from './parser/scanSegment';
52
- import skipSpaces from './parser/skipSpaces';
53
-
54
- import distanceEpsilon from './util/distanceEpsilon';
55
- import getClosestPoint from './util/getClosestPoint';
56
- import getDrawDirection from './util/getDrawDirection';
57
- import getPathArea from './util/getPathArea';
58
- import getPathBBox from './util/getPathBBox';
59
- import getPointAtLength from './util/getPointAtLength';
60
- import getPropertiesAtLength from './util/getPropertiesAtLength';
61
- import getPropertiesAtPoint from './util/getPropertiesAtPoint';
62
- import getSegmentAtLength from './util/getSegmentAtLength';
63
- import getSegmentOfPoint from './util/getSegmentOfPoint';
64
- import getTotalLength from './util/getTotalLength';
65
-
66
- import isAbsoluteArray from './util/isAbsoluteArray';
67
- import isCurveArray from './util/isCurveArray';
68
- import isNormalizedArray from './util/isNormalizedArray';
69
- import isPathArray from './util/isPathArray';
70
- import isPointInStroke from './util/isPointInStroke';
71
- import isRelativeArray from './util/isRelativeArray';
72
- import isValidPath from './util/isValidPath';
73
- import shapeParams from './util/shapeParams';
74
- import shapeToPath from './util/shapeToPath';
75
- import shapeToPathArray from './util/shapeToPathArray';
76
-
77
- import absolutizeSegment from './process/absolutizeSegment';
78
- import arcToCubic from './process/arcToCubic';
79
- import getSVGMatrix from './process/getSVGMatrix';
80
- import iterate from './process/iterate';
81
- import lineToCubic from './process/lineToCubic';
82
- import normalizePath from './process/normalizePath';
83
- import normalizeSegment from './process/normalizeSegment';
84
- import optimizePath from './process/optimizePath';
85
- import projection2d from './process/projection2d';
86
- import quadToCubic from './process/quadToCubic';
87
- import relativizeSegment from './process/relativizeSegment';
88
- import reverseCurve from './process/reverseCurve';
89
- import reversePath from './process/reversePath';
90
- import roundPath from './process/roundPath';
91
- import roundSegment from './process/roundSegment';
92
- import segmentToCubic from './process/segmentToCubic';
93
- import shortenSegment from './process/shortenSegment';
94
- import splitCubic from './process/splitCubic';
95
- import splitPath from './process/splitPath';
96
- import transformPath from './process/transformPath';
97
-
98
- /**
99
- * Creates a new SVGPathCommander instance with the following properties:
100
- * * segments: `pathArray`
101
- * * round: number
102
- * * origin: [number, number, number?]
103
- *
104
- * @class
105
- * @author thednp <https://github.com/thednp/svg-path-commander>
106
- * @returns a new SVGPathCommander instance
107
- */
108
- class SVGPathCommander {
109
- public static CSSMatrix = CSSMatrix;
110
- public static pathToAbsolute = pathToAbsolute;
111
- public static pathToRelative = pathToRelative;
112
- public static pathToCurve = pathToCurve;
113
- public static pathToString = pathToString;
114
- public static arcTools = arcTools;
115
- public static bezierTools = {
116
- Cvalues,
117
- Tvalues,
118
- minmaxC,
119
- minmaxQ,
120
- getBezierLength,
121
- bezierLength,
122
- calculateBezier,
123
- computeBezier,
124
- deriveBezier,
125
- CBEZIER_MINMAX_EPSILON,
126
- };
127
- public static cubicTools = { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };
128
- public static lineTools = { getPointAtLineLength, getLineBBox, getLineLength };
129
- public static quadTools = { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };
130
- public static polygonTools = { polygonArea, polygonLength };
131
- public static distanceSquareRoot = distanceSquareRoot;
132
- public static distanceEpsilon = distanceEpsilon;
133
- public static midPoint = midPoint;
134
- public static rotateVector = rotateVector;
135
- public static roundTo = roundTo;
136
- public static finalizeSegment = finalizeSegment;
137
- public static invalidPathValue = invalidPathValue;
138
- public static isArcCommand = isArcCommand;
139
- public static isDigit = isDigit;
140
- public static isDigitStart = isDigitStart;
141
- public static isMoveCommand = isMoveCommand;
142
- public static isPathCommand = isPathCommand;
143
- public static isSpace = isSpace;
144
- public static paramsCount = paramsCount;
145
- public static paramsParser = paramsParser;
146
- public static pathParser = pathParser;
147
- public static scanFlag = scanFlag;
148
- public static scanParam = scanParam;
149
- public static scanSegment = scanSegment;
150
- public static skipSpaces = skipSpaces;
151
- public static getPathBBox = getPathBBox;
152
- public static getPathArea = getPathArea;
153
- public static getTotalLength = getTotalLength;
154
- public static getDrawDirection = getDrawDirection;
155
- public static getPointAtLength = getPointAtLength;
156
- public static getPropertiesAtLength = getPropertiesAtLength;
157
- public static getPropertiesAtPoint = getPropertiesAtPoint;
158
- public static getClosestPoint = getClosestPoint;
159
- public static getSegmentOfPoint = getSegmentOfPoint;
160
- public static getSegmentAtLength = getSegmentAtLength;
161
- public static isPointInStroke = isPointInStroke;
162
- public static isValidPath = isValidPath;
163
- public static isPathArray = isPathArray;
164
- public static isAbsoluteArray = isAbsoluteArray;
165
- public static isRelativeArray = isRelativeArray;
166
- public static isCurveArray = isCurveArray;
167
- public static isNormalizedArray = isNormalizedArray;
168
- public static shapeToPath = shapeToPath;
169
- public static shapeToPathArray = shapeToPathArray;
170
- public static shapeParams = shapeParams;
171
- public static parsePathString = parsePathString;
172
- public static absolutizeSegment = absolutizeSegment;
173
- public static arcToCubic = arcToCubic;
174
- public static getSVGMatrix = getSVGMatrix;
175
- public static iterate = iterate;
176
- public static lineToCubic = lineToCubic;
177
- public static normalizePath = normalizePath;
178
- public static normalizeSegment = normalizeSegment;
179
- public static optimizePath = optimizePath;
180
- public static projection2d = projection2d;
181
- public static quadToCubic = quadToCubic;
182
- public static relativizeSegment = relativizeSegment;
183
- public static reverseCurve = reverseCurve;
184
- public static reversePath = reversePath;
185
- public static roundPath = roundPath;
186
- public static roundSegment = roundSegment;
187
- public static segmentToCubic = segmentToCubic;
188
- public static shortenSegment = shortenSegment;
189
- public static splitCubic = splitCubic;
190
- public static splitPath = splitPath;
191
- public static transformPath = transformPath;
192
- // declare class properties
193
- declare segments: PathArray;
194
- declare round: number | 'off';
195
- declare origin: [number, number, number];
196
-
197
- /**
198
- * @constructor
199
- * @param pathValue the path string
200
- * @param config instance options
201
- */
202
- constructor(pathValue: string, config?: Partial<Options>) {
203
- const instanceOptions = config || {};
204
- const undefPath = typeof pathValue === 'undefined';
205
-
206
- if (undefPath || !pathValue.length) {
207
- throw TypeError(`${error}: "pathValue" is ${undefPath ? 'undefined' : 'empty'}`);
208
- }
209
-
210
- this.segments = parsePathString(pathValue);
211
-
212
- // // set instance options.round
213
- const { round: roundOption, origin: originOption } = instanceOptions;
214
- let round: number | 'off';
215
-
216
- if (Number.isInteger(roundOption) || roundOption === 'off') {
217
- round = roundOption as number | 'off';
218
- } else {
219
- round = defaultOptions.round as number;
220
- }
221
-
222
- // set instance options.origin
223
- // the SVGPathCommander class will always override the default origin
224
- let origin = defaultOptions.origin as [number, number, number];
225
- /* istanbul ignore else @preserve */
226
- if (Array.isArray(originOption) && originOption.length >= 2) {
227
- const [originX, originY, originZ] = originOption.map(Number);
228
- origin = [
229
- !Number.isNaN(originX) ? originX : 0,
230
- !Number.isNaN(originY) ? originY : 0,
231
- !Number.isNaN(originZ) ? originZ : 0,
232
- ];
233
- }
234
-
235
- this.round = round;
236
- this.origin = origin;
237
-
238
- return this;
239
- }
240
- get bbox() {
241
- return getPathBBox(this.segments);
242
- }
243
- get length() {
244
- return getTotalLength(this.segments);
245
- }
246
-
247
- /**
248
- * Returns the path bounding box, equivalent to native `path.getBBox()`.
249
- *
250
- * @public
251
- * @returns the pathBBox
252
- */
253
- getBBox() {
254
- return this.bbox;
255
- }
256
-
257
- /**
258
- * Returns the total path length, equivalent to native `path.getTotalLength()`.
259
- *
260
- * @public
261
- * @returns the path total length
262
- */
263
- getTotalLength() {
264
- return this.length;
265
- }
266
-
267
- /**
268
- * Returns an `{x,y}` point in the path stroke at a given length,
269
- * equivalent to the native `path.getPointAtLength()`.
270
- *
271
- * @public
272
- * @param length the length
273
- * @returns the requested point
274
- */
275
- getPointAtLength(length: number) {
276
- return getPointAtLength(this.segments, length);
277
- }
278
-
279
- /**
280
- * Convert path to absolute values
281
- *
282
- * @public
283
- */
284
- toAbsolute() {
285
- const { segments } = this;
286
- this.segments = pathToAbsolute(segments);
287
- return this;
288
- }
289
-
290
- /**
291
- * Convert path to relative values
292
- *
293
- * @public
294
- */
295
- toRelative() {
296
- const { segments } = this;
297
- this.segments = pathToRelative(segments);
298
- return this;
299
- }
300
-
301
- /**
302
- * Convert path to cubic-bezier values. In addition, un-necessary `Z`
303
- * segment is removed if previous segment extends to the `M` segment.
304
- *
305
- * @public
306
- */
307
- toCurve() {
308
- const { segments } = this;
309
- this.segments = pathToCurve(segments);
310
- return this;
311
- }
312
-
313
- /**
314
- * Reverse the order of the segments and their values.
315
- *
316
- * @param onlySubpath option to reverse all sub-paths except first
317
- * @public
318
- */
319
- reverse(onlySubpath?: boolean) {
320
- this.toAbsolute();
321
-
322
- const { segments } = this;
323
- const split = splitPath(segments);
324
- const subPath = split.length > 1 ? split : false;
325
-
326
- const absoluteMultiPath = subPath
327
- ? subPath.map((x, i) => {
328
- if (onlySubpath) {
329
- return i ? reversePath(x) : x.slice(0);
330
- }
331
- return reversePath(x);
332
- })
333
- : segments.slice(0);
334
-
335
- let path = [] as unknown as PathArray;
336
- if (subPath) {
337
- path = absoluteMultiPath.flat(1) as PathArray;
338
- } else {
339
- path = onlySubpath ? segments : reversePath(segments);
340
- }
341
-
342
- this.segments = path.slice(0) as PathArray;
343
- return this;
344
- }
345
-
346
- /**
347
- * Normalize path in 2 steps:
348
- * * convert `pathArray`(s) to absolute values
349
- * * convert shorthand notation to standard notation
350
- *
351
- * @public
352
- */
353
- normalize() {
354
- const { segments } = this;
355
- this.segments = normalizePath(segments);
356
- return this;
357
- }
358
-
359
- /**
360
- * Optimize `pathArray` values:
361
- * * convert segments to absolute and/or relative values
362
- * * select segments with shortest resulted string
363
- * * round values to the specified `decimals` option value
364
- *
365
- * @public
366
- */
367
- optimize() {
368
- const { segments } = this;
369
- const round = this.round === 'off' ? 2 : this.round;
370
-
371
- this.segments = optimizePath(segments, round);
372
- return this;
373
- }
374
-
375
- /**
376
- * Transform path using values from an `Object` defined as `transformObject`.
377
- *
378
- * @see TransformObject for a quick refference
379
- *
380
- * @param source a `transformObject`as described above
381
- * @public
382
- */
383
- transform(source?: Partial<TransformObject>) {
384
- if (
385
- !source ||
386
- typeof source !== 'object' ||
387
- (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))
388
- )
389
- return this;
390
-
391
- const {
392
- segments,
393
- origin: [cx, cy, cz],
394
- } = this;
395
- const transform = {} as TransformObjectValues;
396
- for (const [k, v] of Object.entries(source) as TransformEntries) {
397
- // istanbul ignore else @preserve
398
- if (k === 'skew' && Array.isArray(v)) {
399
- transform[k] = v.map(Number) as PointTuple;
400
- } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {
401
- transform[k] = v.map(Number) as [number, number, number];
402
- } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);
403
- }
404
-
405
- // if origin is not specified
406
- // it's important that we have one
407
- const { origin } = transform;
408
-
409
- if (Array.isArray(origin) && origin.length >= 2) {
410
- const [originX, originY, originZ] = origin.map(Number);
411
- transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];
412
- } else {
413
- transform.origin = [cx, cy, cz];
414
- }
415
-
416
- this.segments = transformPath(segments, transform);
417
- return this;
418
- }
419
-
420
- /**
421
- * Rotate path 180deg vertically
422
- *
423
- * @public
424
- */
425
- flipX() {
426
- const { cx, cy } = this.bbox;
427
- this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });
428
- return this;
429
- }
430
-
431
- /**
432
- * Rotate path 180deg horizontally
433
- *
434
- * @public
435
- */
436
- flipY() {
437
- const { cx, cy } = this.bbox;
438
- this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });
439
- return this;
440
- }
441
-
442
- /**
443
- * Export the current path to be used
444
- * for the `d` (description) attribute.
445
- *
446
- * @public
447
- * @return the path string
448
- */
449
- toString() {
450
- return pathToString(this.segments, this.round);
451
- }
452
- }
453
-
454
- export default SVGPathCommander;
package/src/interface.ts DELETED
@@ -1,130 +0,0 @@
1
- import type { PathSegment } from './types';
2
-
3
- export type SegmentProperties = {
4
- segment: PathSegment;
5
- index: number;
6
- length: number;
7
- lengthAtSegment: number;
8
- // point: Point;
9
- // [key: string]: any;
10
- };
11
-
12
- export type PointProperties = {
13
- closest: {
14
- x: number;
15
- y: number;
16
- };
17
- distance: number;
18
- segment?: SegmentProperties;
19
- };
20
-
21
- export type LineAttr = {
22
- type: 'line';
23
- x1: number;
24
- y1: number;
25
- x2: number;
26
- y2: number;
27
- [key: string]: string | number;
28
- };
29
- export type PolyAttr = {
30
- type: 'polygon' | 'polyline';
31
- points: string;
32
- [key: string]: string | number;
33
- };
34
- export type CircleAttr = {
35
- type: 'circle';
36
- cx: number;
37
- cy: number;
38
- r: number;
39
- [key: string]: string | number;
40
- };
41
- export type EllipseAttr = {
42
- type: 'ellipse';
43
- cx: number;
44
- cy: number;
45
- rx: number;
46
- ry?: number;
47
- [key: string]: string | number | undefined;
48
- };
49
- export type RectAttr = {
50
- type: 'rect';
51
- width: number;
52
- height: number;
53
- x: number;
54
- y: number;
55
- rx?: number;
56
- ry?: number;
57
- [key: string]: string | number | undefined;
58
- };
59
- export type GlyphAttr = {
60
- type: 'glyph';
61
- d: string;
62
- [key: string]: string | number;
63
- };
64
-
65
- export type ShapeParams = {
66
- line: ['x1', 'y1', 'x2', 'y2'];
67
- circle: ['cx', 'cy', 'r'];
68
- ellipse: ['cx', 'cy', 'rx', 'ry'];
69
- rect: ['width', 'height', 'x', 'y', 'rx', 'ry'];
70
- polygon: ['points'];
71
- polyline: ['points'];
72
- glyph: ['d'];
73
- };
74
-
75
- export type PathBBox = {
76
- width: number;
77
- height: number;
78
- x: number;
79
- y: number;
80
- x2: number;
81
- y2: number;
82
- cx: number;
83
- cy: number;
84
- cz: number;
85
- };
86
- export type SegmentLimits = {
87
- min: { x: number; y: number };
88
- max: { x: number; y: number };
89
- };
90
-
91
- export type ParserParams = {
92
- x1: number;
93
- y1: number;
94
- x2: number;
95
- y2: number;
96
- x: number;
97
- y: number;
98
- qx: number | null;
99
- qy: number | null;
100
- };
101
-
102
- export type LengthFactory = {
103
- length: number;
104
- point: { x: number; y: number };
105
- min: { x: number; y: number };
106
- max: { x: number; y: number };
107
- };
108
-
109
- export type Options = {
110
- round: 'off' | number;
111
- origin: number[];
112
- };
113
-
114
- export type PathTransform = {
115
- s: PathSegment;
116
- c: string;
117
- x: number;
118
- y: number;
119
- };
120
-
121
- export type TransformObject = {
122
- translate: number | number[];
123
- rotate: number | number[];
124
- scale: number | number[];
125
- skew: number | number[];
126
- origin: number[];
127
- };
128
-
129
- export type TransformProps = keyof TransformObject;
130
- export type TransformEntries = [TransformProps, TransformObject[TransformProps]][];