svg-path-commander 2.1.8 → 2.1.9

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,1343 @@
1
+ import CSSMatrix from '@thednp/dommatrix';
2
+ export { default as CSSMatrix } from '@thednp/dommatrix';
3
+
4
+ type SpaceNumber = 0x1680 | 0x180e | 0x2000 | 0x2001 | 0x2002 | 0x2003 | 0x2004 | 0x2005 | 0x2006 | 0x2007 | 0x2008 | 0x2009 | 0x200a | 0x202f | 0x205f | 0x3000 | 0xfeff | 0x0a | 0x0d | 0x2028 | 0x2029 | 0x20 | 0x09 | 0x0b | 0x0c | 0xa0 | 0x1680;
5
+ type PathCommandNumber = 0x6d | 0x7a | 0x6c | 0x68 | 0x76 | 0x63 | 0x73 | 0x71 | 0x74 | 0x61;
6
+ type DigitNumber = 0x30 | 0x31 | 0x32 | 0x33 | 0x34 | 0x35 | 0x36 | 0x37 | 0x38 | 0x39;
7
+ type MCommand = "M";
8
+ type mCommand = "m";
9
+ type LCommand = "L";
10
+ type lCommand = "l";
11
+ type VCommand = "V";
12
+ type vCommand = "v";
13
+ type HCommand = "H";
14
+ type hCommand = "h";
15
+ type ZCommand = "Z";
16
+ type zCommand = "z";
17
+ type CCommand = "C";
18
+ type cCommand = "c";
19
+ type SCommand = "S";
20
+ type sCommand = "s";
21
+ type QCommand = "Q";
22
+ type qCommand = "q";
23
+ type TCommand = "T";
24
+ type tCommand = "t";
25
+ type ACommand = "A";
26
+ type aCommand = "a";
27
+ type AbsoluteCommand = MCommand | LCommand | VCommand | HCommand | ZCommand | CCommand | SCommand | QCommand | TCommand | ACommand;
28
+ type RelativeCommand = mCommand | lCommand | vCommand | hCommand | zCommand | cCommand | sCommand | qCommand | tCommand | aCommand;
29
+ type PathCommand = AbsoluteCommand | RelativeCommand;
30
+ type MSegment = [MCommand, number, number];
31
+ type mSegment = [mCommand, number, number];
32
+ type MoveSegment = MSegment | mSegment;
33
+ type LSegment = [LCommand, number, number];
34
+ type lSegment = [lCommand, number, number];
35
+ type LineSegment = LSegment | lSegment;
36
+ type VSegment = [VCommand, number];
37
+ type vSegment = [vCommand, number];
38
+ type VertLineSegment = vSegment | VSegment;
39
+ type HSegment = [HCommand, number];
40
+ type hSegment = [hCommand, number];
41
+ type HorLineSegment = HSegment | hSegment;
42
+ type ZSegment = [ZCommand];
43
+ type zSegment = [zCommand];
44
+ type CloseSegment = ZSegment | zSegment;
45
+ type CSegment = [
46
+ CCommand,
47
+ number,
48
+ number,
49
+ number,
50
+ number,
51
+ number,
52
+ number
53
+ ];
54
+ type cSegment = [
55
+ cCommand,
56
+ number,
57
+ number,
58
+ number,
59
+ number,
60
+ number,
61
+ number
62
+ ];
63
+ type CubicSegment = CSegment | cSegment;
64
+ type SSegment = [SCommand, number, number, number, number];
65
+ type sSegment = [sCommand, number, number, number, number];
66
+ type ShortCubicSegment = SSegment | sSegment;
67
+ type QSegment = [QCommand, number, number, number, number];
68
+ type qSegment = [qCommand, number, number, number, number];
69
+ type QuadSegment = QSegment | qSegment;
70
+ type TSegment = [TCommand, number, number];
71
+ type tSegment = [tCommand, number, number];
72
+ type ShortQuadSegment = TSegment | tSegment;
73
+ type ASegment = [
74
+ ACommand,
75
+ number,
76
+ number,
77
+ number,
78
+ number,
79
+ number,
80
+ number,
81
+ number
82
+ ];
83
+ type aSegment = [
84
+ aCommand,
85
+ number,
86
+ number,
87
+ number,
88
+ number,
89
+ number,
90
+ number,
91
+ number
92
+ ];
93
+ type ArcSegment = ASegment | aSegment;
94
+ type PathSegment = MoveSegment | LineSegment | VertLineSegment | HorLineSegment | CloseSegment | CubicSegment | ShortCubicSegment | QuadSegment | ShortQuadSegment | ArcSegment;
95
+ type ShortSegment = VertLineSegment | HorLineSegment | ShortCubicSegment | ShortQuadSegment | CloseSegment;
96
+ type AbsoluteSegment = MSegment | LSegment | VSegment | HSegment | CSegment | SSegment | QSegment | TSegment | ASegment | ZSegment;
97
+ type RelativeSegment = mSegment | lSegment | vSegment | hSegment | cSegment | sSegment | qSegment | tSegment | aSegment | zSegment;
98
+ type NormalSegment = MSegment | LSegment | CSegment | QSegment | ASegment | ZSegment;
99
+ type PathArray = [MSegment | mSegment, ...PathSegment[]];
100
+ type AbsoluteArray = [MSegment, ...AbsoluteSegment[]];
101
+ type RelativeArray = [MSegment, ...RelativeSegment[]];
102
+ type NormalArray = [MSegment, ...NormalSegment[]];
103
+ type CurveArray = [MSegment, ...CSegment[]];
104
+ type PolygonArray = [MSegment, ...LSegment[], ZSegment];
105
+ type PolylineArray = [MSegment, ...LSegment[]];
106
+ type ShapeTypes = SVGPolylineElement | SVGPolygonElement | SVGLineElement | SVGEllipseElement | SVGCircleElement | SVGRectElement;
107
+ type ShapeTags = "line" | "polyline" | "polygon" | "ellipse" | "circle" | "rect" | "glyph";
108
+ type ShapeOps = LineAttr | PolyAttr | PolyAttr | EllipseAttr | CircleAttr | RectAttr | GlyphAttr;
109
+ type TransformObjectValues = Partial<TransformObject> & {
110
+ origin: [number, number, number];
111
+ };
112
+ type Point = {
113
+ x: number;
114
+ y: number;
115
+ };
116
+ type PointTuple = [number, number];
117
+ type DerivedPoint = Point & {
118
+ t: number;
119
+ };
120
+ type QuadPoints = [Point, Point, Point, Point, Point, Point];
121
+ type CubicPoints = [
122
+ Point,
123
+ Point,
124
+ Point,
125
+ Point,
126
+ Point,
127
+ Point,
128
+ Point,
129
+ Point
130
+ ];
131
+ type DerivedQuadPoints = [
132
+ DerivedPoint,
133
+ DerivedPoint,
134
+ DerivedPoint,
135
+ DerivedPoint,
136
+ DerivedPoint,
137
+ DerivedPoint
138
+ ];
139
+ type DerivedCubicPoints = [
140
+ DerivedPoint,
141
+ DerivedPoint,
142
+ DerivedPoint,
143
+ DerivedPoint,
144
+ DerivedPoint,
145
+ DerivedPoint,
146
+ DerivedPoint,
147
+ DerivedPoint
148
+ ];
149
+ type QuadCoordinates = [number, number, number, number, number, number];
150
+ type CubicCoordinates = [
151
+ number,
152
+ number,
153
+ number,
154
+ number,
155
+ number,
156
+ number,
157
+ number,
158
+ number
159
+ ];
160
+ type ArcCoordinates = [
161
+ number,
162
+ number,
163
+ number,
164
+ number,
165
+ number,
166
+ number,
167
+ number,
168
+ number,
169
+ number
170
+ ];
171
+ type LineCoordinates = [number, number, number, number];
172
+ type DeriveCallback = (t: number) => Point;
173
+ type IteratorCallback = (segment: PathSegment, index: number, lastX: number, lastY: number) => PathSegment | false | void | undefined;
174
+
175
+ type SegmentProperties = {
176
+ segment: PathSegment;
177
+ index: number;
178
+ length: number;
179
+ lengthAtSegment: number;
180
+ };
181
+ type PointProperties = {
182
+ closest: {
183
+ x: number;
184
+ y: number;
185
+ };
186
+ distance: number;
187
+ segment?: SegmentProperties;
188
+ };
189
+ type LineAttr = {
190
+ type: "line";
191
+ x1: number;
192
+ y1: number;
193
+ x2: number;
194
+ y2: number;
195
+ [key: string]: string | number;
196
+ };
197
+ type PolyAttr = {
198
+ type: "polygon" | "polyline";
199
+ points: string;
200
+ [key: string]: string | number;
201
+ };
202
+ type CircleAttr = {
203
+ type: "circle";
204
+ cx: number;
205
+ cy: number;
206
+ r: number;
207
+ [key: string]: string | number;
208
+ };
209
+ type EllipseAttr = {
210
+ type: "ellipse";
211
+ cx: number;
212
+ cy: number;
213
+ rx: number;
214
+ ry?: number;
215
+ [key: string]: string | number | undefined;
216
+ };
217
+ type RectAttr = {
218
+ type: "rect";
219
+ width: number;
220
+ height: number;
221
+ x: number;
222
+ y: number;
223
+ rx?: number;
224
+ ry?: number;
225
+ [key: string]: string | number | undefined;
226
+ };
227
+ type GlyphAttr = {
228
+ type: "glyph";
229
+ d: string;
230
+ [key: string]: string | number;
231
+ };
232
+ type ShapeParams = {
233
+ line: ["x1", "y1", "x2", "y2"];
234
+ circle: ["cx", "cy", "r"];
235
+ ellipse: ["cx", "cy", "rx", "ry"];
236
+ rect: ["width", "height", "x", "y", "rx", "ry"];
237
+ polygon: ["points"];
238
+ polyline: ["points"];
239
+ glyph: ["d"];
240
+ };
241
+ type PathBBox = {
242
+ width: number;
243
+ height: number;
244
+ x: number;
245
+ y: number;
246
+ x2: number;
247
+ y2: number;
248
+ cx: number;
249
+ cy: number;
250
+ cz: number;
251
+ };
252
+ type SegmentLimits = {
253
+ min: {
254
+ x: number;
255
+ y: number;
256
+ };
257
+ max: {
258
+ x: number;
259
+ y: number;
260
+ };
261
+ };
262
+ type ParserParams = {
263
+ x1: number;
264
+ y1: number;
265
+ x2: number;
266
+ y2: number;
267
+ x: number;
268
+ y: number;
269
+ qx: number | null;
270
+ qy: number | null;
271
+ };
272
+ type LengthFactory = {
273
+ length: number;
274
+ point: {
275
+ x: number;
276
+ y: number;
277
+ };
278
+ min: {
279
+ x: number;
280
+ y: number;
281
+ };
282
+ max: {
283
+ x: number;
284
+ y: number;
285
+ };
286
+ };
287
+ type Options = {
288
+ round: "off" | number;
289
+ origin: number[];
290
+ };
291
+ type PathTransform = {
292
+ s: PathSegment;
293
+ c: string;
294
+ x: number;
295
+ y: number;
296
+ };
297
+ type TransformObject = {
298
+ translate: number | number[];
299
+ rotate: number | number[];
300
+ scale: number | number[];
301
+ skew: number | number[];
302
+ origin: number[];
303
+ };
304
+ type TransformProps = keyof TransformObject;
305
+ type TransformEntries = [
306
+ TransformProps,
307
+ TransformObject[TransformProps]
308
+ ][];
309
+
310
+ /**
311
+ * The `PathParser` is used by the `parsePathString` static method
312
+ * to generate a `pathArray`.
313
+ *
314
+ * @param pathString
315
+ */
316
+ declare class PathParser {
317
+ segments: PathArray | PathSegment[];
318
+ pathValue: string;
319
+ max: number;
320
+ index: number;
321
+ param: number;
322
+ segmentStart: number;
323
+ data: (string | number)[];
324
+ err: string;
325
+ constructor(pathString: string);
326
+ }
327
+
328
+ /**
329
+ * Creates a new SVGPathCommander instance with the following properties:
330
+ * * segments: `pathArray`
331
+ * * round: number
332
+ * * origin: [number, number, number?]
333
+ *
334
+ * @class
335
+ * @author thednp <https://github.com/thednp/svg-path-commander>
336
+ * @returns a new SVGPathCommander instance
337
+ */
338
+ declare class SVGPathCommander {
339
+ segments: PathArray;
340
+ round: number | "off";
341
+ origin: [number, number, number];
342
+ /**
343
+ * @constructor
344
+ * @param pathValue the path string
345
+ * @param config instance options
346
+ */
347
+ constructor(pathValue: string, config?: Partial<Options>);
348
+ get bbox(): {
349
+ x: number;
350
+ y: number;
351
+ width: number;
352
+ height: number;
353
+ x2: number;
354
+ y2: number;
355
+ cx: number;
356
+ cy: number;
357
+ cz: number;
358
+ };
359
+ get length(): number;
360
+ /**
361
+ * Returns the path bounding box, equivalent to native `path.getBBox()`.
362
+ *
363
+ * @public
364
+ * @returns the pathBBox
365
+ */
366
+ getBBox(): {
367
+ x: number;
368
+ y: number;
369
+ width: number;
370
+ height: number;
371
+ x2: number;
372
+ y2: number;
373
+ cx: number;
374
+ cy: number;
375
+ cz: number;
376
+ };
377
+ /**
378
+ * Returns the total path length, equivalent to native `path.getTotalLength()`.
379
+ *
380
+ * @public
381
+ * @returns the path total length
382
+ */
383
+ getTotalLength(): number;
384
+ /**
385
+ * Returns an `{x,y}` point in the path stroke at a given length,
386
+ * equivalent to the native `path.getPointAtLength()`.
387
+ *
388
+ * @public
389
+ * @param length the length
390
+ * @returns the requested point
391
+ */
392
+ getPointAtLength(length: number): {
393
+ x: number;
394
+ y: number;
395
+ };
396
+ /**
397
+ * Convert path to absolute values
398
+ *
399
+ * @public
400
+ */
401
+ toAbsolute(): this;
402
+ /**
403
+ * Convert path to relative values
404
+ *
405
+ * @public
406
+ */
407
+ toRelative(): this;
408
+ /**
409
+ * Convert path to cubic-bezier values. In addition, un-necessary `Z`
410
+ * segment is removed if previous segment extends to the `M` segment.
411
+ *
412
+ * @public
413
+ */
414
+ toCurve(): this;
415
+ /**
416
+ * Reverse the order of the segments and their values.
417
+ *
418
+ * @param onlySubpath option to reverse all sub-paths except first
419
+ * @public
420
+ */
421
+ reverse(onlySubpath?: boolean): this;
422
+ /**
423
+ * Normalize path in 2 steps:
424
+ * * convert `pathArray`(s) to absolute values
425
+ * * convert shorthand notation to standard notation
426
+ *
427
+ * @public
428
+ */
429
+ normalize(): this;
430
+ /**
431
+ * Optimize `pathArray` values:
432
+ * * convert segments to absolute and/or relative values
433
+ * * select segments with shortest resulted string
434
+ * * round values to the specified `decimals` option value
435
+ *
436
+ * @public
437
+ */
438
+ optimize(): this;
439
+ /**
440
+ * Transform path using values from an `Object` defined as `transformObject`.
441
+ *
442
+ * @see TransformObject for a quick refference
443
+ *
444
+ * @param source a `transformObject`as described above
445
+ * @public
446
+ */
447
+ transform(source?: Partial<TransformObject>): this;
448
+ /**
449
+ * Rotate path 180deg vertically
450
+ *
451
+ * @public
452
+ */
453
+ flipX(): this;
454
+ /**
455
+ * Rotate path 180deg horizontally
456
+ *
457
+ * @public
458
+ */
459
+ flipY(): this;
460
+ /**
461
+ * Export the current path to be used
462
+ * for the `d` (description) attribute.
463
+ *
464
+ * @public
465
+ * @return the path string
466
+ */
467
+ toString(): string;
468
+ /**
469
+ * Remove the instance.
470
+ *
471
+ * @public
472
+ * @return void
473
+ */
474
+ dispose(): void;
475
+ static get CSSMatrix(): typeof CSSMatrix;
476
+ static get arcTools(): {
477
+ angleBetween: (v0: Point, v1: Point) => number;
478
+ arcLength: (rx: number, ry: number, theta: number) => number;
479
+ arcPoint: (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => PointTuple;
480
+ getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => [number, number, number, number];
481
+ getArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => number;
482
+ getArcProps: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => {
483
+ rx: number;
484
+ ry: number;
485
+ startAngle: number;
486
+ endAngle: number;
487
+ center: {
488
+ x: number;
489
+ y: number;
490
+ };
491
+ };
492
+ getPointAtArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number, distance?: number) => {
493
+ x: number;
494
+ y: number;
495
+ };
496
+ };
497
+ static get bezierTools(): {
498
+ bezierLength: (derivativeFn: DeriveCallback) => number;
499
+ calculateBezier: (derivativeFn: DeriveCallback, t: number) => number;
500
+ CBEZIER_MINMAX_EPSILON: number;
501
+ computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint;
502
+ Cvalues: number[];
503
+ deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPoints | DerivedCubicPoints)[];
504
+ getBezierLength: (curve: CubicCoordinates | QuadCoordinates) => number;
505
+ minmaxC: ([v1, cp1, cp2, v2]: [number, number, number, number]) => PointTuple;
506
+ minmaxQ: ([v1, cp, v2]: [number, number, number]) => PointTuple;
507
+ Tvalues: number[];
508
+ };
509
+ static get cubicTools(): {
510
+ getCubicBBox: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => [number, number, number, number];
511
+ getCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => number;
512
+ getPointAtCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number, distance?: number) => {
513
+ x: number;
514
+ y: number;
515
+ };
516
+ getPointAtCubicSegmentLength: ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {
517
+ x: number;
518
+ y: number;
519
+ };
520
+ };
521
+ static get lineTools(): {
522
+ getLineBBox: (x1: number, y1: number, x2: number, y2: number) => [number, number, number, number];
523
+ getLineLength: (x1: number, y1: number, x2: number, y2: number) => number;
524
+ getPointAtLineLength: (x1: number, y1: number, x2: number, y2: number, distance?: number) => {
525
+ x: number;
526
+ y: number;
527
+ };
528
+ };
529
+ static get polygonTools(): {
530
+ polygonArea: (polygon: PointTuple[]) => number;
531
+ polygonLength: (polygon: PointTuple[]) => number;
532
+ };
533
+ static get quadTools(): {
534
+ getPointAtQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number, distance?: number) => {
535
+ x: number;
536
+ y: number;
537
+ };
538
+ getPointAtQuadSegmentLength: ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {
539
+ x: number;
540
+ y: number;
541
+ };
542
+ getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => [number, number, number, number];
543
+ getQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => number;
544
+ };
545
+ static get pathToAbsolute(): (pathInput: string | PathArray) => AbsoluteArray;
546
+ static get pathToRelative(): (pathInput: string | PathArray) => RelativeArray;
547
+ static get pathToCurve(): (pathInput: string | PathArray) => CurveArray;
548
+ static get pathToString(): (path: PathArray, roundOption?: number | "off") => string;
549
+ static get distanceSquareRoot(): (a: PointTuple, b: PointTuple) => number;
550
+ static get midPoint(): (a: PointTuple, b: PointTuple, t: number) => PointTuple;
551
+ static get rotateVector(): (x: number, y: number, rad: number) => {
552
+ x: number;
553
+ y: number;
554
+ };
555
+ static get roundTo(): (n: number, round: number) => number;
556
+ static get parsePathString(): <T extends PathArray>(pathInput: string | T) => PathArray;
557
+ static get finalizeSegment(): (path: PathParser) => void;
558
+ static get invalidPathValue(): string;
559
+ static get isArcCommand(): (code: number) => code is 97;
560
+ static get isDigit(): (code: number) => code is DigitNumber;
561
+ static get isDigitStart(): (code: number) => code is DigitNumber | 43 | 45 | 46;
562
+ static get isMoveCommand(): (code: number) => code is 109 | 77;
563
+ static get isPathCommand(): (code: number) => code is PathCommandNumber;
564
+ static get isSpace(): (ch: number) => ch is SpaceNumber;
565
+ static get paramsCount(): {
566
+ a: number;
567
+ c: number;
568
+ h: number;
569
+ l: number;
570
+ m: number;
571
+ r: number;
572
+ q: number;
573
+ s: number;
574
+ t: number;
575
+ v: number;
576
+ z: number;
577
+ };
578
+ static get paramsParser(): ParserParams;
579
+ static get pathParser(): typeof PathParser;
580
+ static get scanFlag(): (path: PathParser) => void;
581
+ static get scanParam(): (path: PathParser) => void;
582
+ static get scanSegment(): (path: PathParser) => void;
583
+ static get skipSpaces(): (path: PathParser) => void;
584
+ static get distanceEpsilon(): number;
585
+ static get getClosestPoint(): (pathInput: string | PathArray, point: {
586
+ x: number;
587
+ y: number;
588
+ }) => {
589
+ x: number;
590
+ y: number;
591
+ };
592
+ static get getDrawDirection(): (path: string | PathArray) => boolean;
593
+ static get getPathArea(): (path: PathArray) => number;
594
+ static get getPathBBox(): (pathInput: PathArray | string) => {
595
+ x: number;
596
+ y: number;
597
+ width: number;
598
+ height: number;
599
+ x2: number;
600
+ y2: number;
601
+ cx: number;
602
+ cy: number;
603
+ cz: number;
604
+ };
605
+ static get getPointAtLength(): (pathInput: string | PathArray, distance?: number) => {
606
+ x: number;
607
+ y: number;
608
+ };
609
+ static get getPropertiesAtLength(): (pathInput: string | PathArray, distance?: number) => SegmentProperties;
610
+ static get getPropertiesAtPoint(): (pathInput: string | PathArray, point: Point) => PointProperties;
611
+ static get getSegmentAtLength(): (pathInput: string | PathArray, distance?: number) => PathSegment | undefined;
612
+ static get getSegmentOfPoint(): (path: string | PathArray, point: {
613
+ x: number;
614
+ y: number;
615
+ }) => SegmentProperties | undefined;
616
+ static get getTotalLength(): (pathInput: string | PathArray) => number;
617
+ static get isAbsoluteArray(): (path: unknown) => path is AbsoluteArray;
618
+ static get isCurveArray(): (path: unknown) => path is CurveArray;
619
+ static get isNormalizedArray(): (path: unknown) => path is NormalArray;
620
+ static get isPathArray(): (path: unknown) => path is PathArray;
621
+ static get isPointInStroke(): (pathInput: string | PathArray, point: {
622
+ x: number;
623
+ y: number;
624
+ }) => boolean;
625
+ static get isRelativeArray(): (path: unknown) => path is RelativeArray;
626
+ static get isValidPath(): (pathString: string) => boolean;
627
+ static get shapeParams(): ShapeParams;
628
+ static get shapeToPath(): (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
629
+ static get shapeToPathArray(): (element: ShapeTypes | ShapeOps) => false | PathArray;
630
+ static get absolutizeSegment(): (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
631
+ static get arcToCubic(): (X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive?: [number, number, number, number]) => number[];
632
+ static get getSVGMatrix(): (transform: TransformObjectValues) => CSSMatrix;
633
+ static get iterate(): <T extends PathArray>(path: PathArray, iterator: IteratorCallback) => T;
634
+ static get lineToCubic(): (x1: number, y1: number, x2: number, y2: number) => number[];
635
+ static get normalizePath(): (pathInput: string | PathArray) => NormalArray;
636
+ static get normalizeSegment(): (segment: PathSegment, params: ParserParams) => NormalSegment;
637
+ static get optimizePath(): (pathInput: PathArray, roundOption?: number) => PathArray;
638
+ static get projection2d(): (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
639
+ static get quadToCubic(): (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
640
+ static get relativizeSegment(): (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
641
+ static get reverseCurve(): (path: CurveArray) => CurveArray;
642
+ static get reversePath(): (pathInput: PathArray) => PathArray;
643
+ static get roundPath(): (path: PathArray, roundOption?: number | "off") => PathArray;
644
+ static get roundSegment(): <T extends PathSegment>(segment: T, roundOption: number) => T;
645
+ static get segmentToCubic(): (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
646
+ static get shortenSegment(): (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
647
+ static get splitCubic(): (pts: number[], ratio?: number) => [CubicSegment, CubicSegment];
648
+ static get splitPath(): (pathInput: PathArray) => PathArray[];
649
+ static get transformPath(): (pathInput: PathArray | string, transform?: Partial<TransformObject>) => PathArray;
650
+ }
651
+
652
+ declare const arcTools: {
653
+ angleBetween: (v0: Point, v1: Point) => number;
654
+ arcLength: (rx: number, ry: number, theta: number) => number;
655
+ arcPoint: (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => PointTuple;
656
+ getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => [number, number, number, number];
657
+ getArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => number;
658
+ getArcProps: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => {
659
+ rx: number;
660
+ ry: number;
661
+ startAngle: number;
662
+ endAngle: number;
663
+ center: {
664
+ x: number;
665
+ y: number;
666
+ };
667
+ };
668
+ getPointAtArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number, distance?: number) => {
669
+ x: number;
670
+ y: number;
671
+ };
672
+ };
673
+
674
+ declare const bezierTools: {
675
+ bezierLength: (derivativeFn: DeriveCallback) => number;
676
+ calculateBezier: (derivativeFn: DeriveCallback, t: number) => number;
677
+ CBEZIER_MINMAX_EPSILON: number;
678
+ computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint;
679
+ Cvalues: number[];
680
+ deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPoints | DerivedCubicPoints)[];
681
+ getBezierLength: (curve: CubicCoordinates | QuadCoordinates) => number;
682
+ minmaxC: ([v1, cp1, cp2, v2]: [number, number, number, number]) => PointTuple;
683
+ minmaxQ: ([v1, cp, v2]: [number, number, number]) => PointTuple;
684
+ Tvalues: number[];
685
+ };
686
+
687
+ declare const cubicTools: {
688
+ getCubicBBox: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => [number, number, number, number];
689
+ getCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => number;
690
+ getPointAtCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number, distance?: number) => {
691
+ x: number;
692
+ y: number;
693
+ };
694
+ getPointAtCubicSegmentLength: ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {
695
+ x: number;
696
+ y: number;
697
+ };
698
+ };
699
+
700
+ declare const lineTools: {
701
+ getLineBBox: (x1: number, y1: number, x2: number, y2: number) => [number, number, number, number];
702
+ getLineLength: (x1: number, y1: number, x2: number, y2: number) => number;
703
+ getPointAtLineLength: (x1: number, y1: number, x2: number, y2: number, distance?: number) => {
704
+ x: number;
705
+ y: number;
706
+ };
707
+ };
708
+
709
+ declare const quadTools: {
710
+ getPointAtQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number, distance?: number) => {
711
+ x: number;
712
+ y: number;
713
+ };
714
+ getPointAtQuadSegmentLength: ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {
715
+ x: number;
716
+ y: number;
717
+ };
718
+ getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => [number, number, number, number];
719
+ getQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => number;
720
+ };
721
+
722
+ declare const polygonTools: {
723
+ polygonArea: (polygon: PointTuple[]) => number;
724
+ polygonLength: (polygon: PointTuple[]) => number;
725
+ };
726
+
727
+ /**
728
+ * Returns the square root of the distance
729
+ * between two given points.
730
+ *
731
+ * @param a the first point coordinates
732
+ * @param b the second point coordinates
733
+ * @returns the distance value
734
+ */
735
+ declare const distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
736
+
737
+ /**
738
+ * Returns the coordinates of a specified distance
739
+ * ratio between two points.
740
+ *
741
+ * @param a the first point coordinates
742
+ * @param b the second point coordinates
743
+ * @param t the ratio
744
+ * @returns the midpoint coordinates
745
+ */
746
+ declare const midPoint: (a: PointTuple, b: PointTuple, t: number) => PointTuple;
747
+
748
+ /**
749
+ * Returns an {x,y} vector rotated by a given
750
+ * angle in radian.
751
+ *
752
+ * @param x the initial vector x
753
+ * @param y the initial vector y
754
+ * @param rad the radian vector angle
755
+ * @returns the rotated vector
756
+ */
757
+ declare const rotateVector: (x: number, y: number, rad: number) => {
758
+ x: number;
759
+ y: number;
760
+ };
761
+
762
+ declare const roundTo: (n: number, round: number) => number;
763
+
764
+ /**
765
+ * Parses a path string value or object and returns an array
766
+ * of segments, all converted to absolute values.
767
+ *
768
+ * @param pathInput the path string | object
769
+ * @returns the resulted `pathArray` with absolute values
770
+ */
771
+ declare const pathToAbsolute: (pathInput: string | PathArray) => AbsoluteArray;
772
+
773
+ /**
774
+ * Parses a path string value or object and returns an array
775
+ * of segments, all converted to relative values.
776
+ *
777
+ * @param pathInput the path string | object
778
+ * @returns the resulted `pathArray` with relative values
779
+ */
780
+ declare const pathToRelative: (pathInput: string | PathArray) => RelativeArray;
781
+
782
+ /**
783
+ * Parses a path string value or 'pathArray' and returns a new one
784
+ * in which all segments are converted to cubic-bezier.
785
+ *
786
+ * In addition, un-necessary `Z` segment is removed if previous segment
787
+ * extends to the `M` segment.
788
+ *
789
+ * @param pathInput the string to be parsed or 'pathArray'
790
+ * @returns the resulted `pathArray` converted to cubic-bezier
791
+ */
792
+ declare const pathToCurve: (pathInput: string | PathArray) => CurveArray;
793
+
794
+ /**
795
+ * Returns a valid `d` attribute string value created
796
+ * by rounding values and concatenating the `pathArray` segments.
797
+ *
798
+ * @param path the `pathArray` object
799
+ * @param roundOption amount of decimals to round values to
800
+ * @returns the concatenated path string
801
+ */
802
+ declare const pathToString: (path: PathArray, roundOption?: number | "off") => string;
803
+
804
+ /**
805
+ * Parses a path string value and returns an array
806
+ * of segments we like to call `pathArray`.
807
+ *
808
+ * @param pathInput the string to be parsed
809
+ * @returns the resulted `pathArray` or error string
810
+ */
811
+ declare const parsePathString: <T extends PathArray>(pathInput: string | T) => PathArray;
812
+
813
+ /**
814
+ * Breaks the parsing of a pathString once a segment is finalized.
815
+ *
816
+ * @param path the `PathParser` instance
817
+ */
818
+ declare const finalizeSegment: (path: PathParser) => void;
819
+
820
+ declare const invalidPathValue = "Invalid path value";
821
+
822
+ /**
823
+ * Checks if the character is an A (arc-to) path command.
824
+ *
825
+ * @param code the character to check
826
+ * @returns check result
827
+ */
828
+ declare const isArcCommand: (code: number) => code is 97;
829
+
830
+ /**
831
+ * Checks if a character is a digit.
832
+ *
833
+ * @param code the character to check
834
+ * @returns check result
835
+ */
836
+ declare const isDigit: (code: number) => code is DigitNumber;
837
+
838
+ /**
839
+ * Checks if the character is or belongs to a number.
840
+ * [0-9]|+|-|.
841
+ *
842
+ * @param code the character to check
843
+ * @returns check result
844
+ */
845
+ declare const isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46;
846
+
847
+ /**
848
+ * Checks if the character is a MoveTo command.
849
+ *
850
+ * @param code the character to check
851
+ * @returns check result
852
+ */
853
+ declare const isMoveCommand: (code: number) => code is 109 | 77;
854
+
855
+ /**
856
+ * Checks if the character is a path command.
857
+ *
858
+ * @param code the character to check
859
+ * @returns check result
860
+ */
861
+ declare const isPathCommand: (code: number) => code is PathCommandNumber;
862
+
863
+ /**
864
+ * Checks if the character is a space.
865
+ *
866
+ * @param ch the character to check
867
+ * @returns check result
868
+ */
869
+ declare const isSpace: (ch: number) => ch is SpaceNumber;
870
+
871
+ /** Segment params length */
872
+ declare const paramsCount: {
873
+ a: number;
874
+ c: number;
875
+ h: number;
876
+ l: number;
877
+ m: number;
878
+ r: number;
879
+ q: number;
880
+ s: number;
881
+ t: number;
882
+ v: number;
883
+ z: number;
884
+ };
885
+
886
+ declare const paramsParser: ParserParams;
887
+
888
+ /**
889
+ * Validates an A (arc-to) specific path command value.
890
+ * Usually a `large-arc-flag` or `sweep-flag`.
891
+ *
892
+ * @param path the `PathParser` instance
893
+ */
894
+ declare const scanFlag: (path: PathParser) => void;
895
+
896
+ /**
897
+ * Validates every character of the path string,
898
+ * every path command, negative numbers or floating point numbers.
899
+ *
900
+ * @param path the `PathParser` instance
901
+ */
902
+ declare const scanParam: (path: PathParser) => void;
903
+
904
+ /**
905
+ * Scans every character in the path string to determine
906
+ * where a segment starts and where it ends.
907
+ *
908
+ * @param path the `PathParser` instance
909
+ */
910
+ declare const scanSegment: (path: PathParser) => void;
911
+
912
+ /**
913
+ * Points the parser to the next character in the
914
+ * path string every time it encounters any kind of
915
+ * space character.
916
+ *
917
+ * @param path the `PathParser` instance
918
+ */
919
+ declare const skipSpaces: (path: PathParser) => void;
920
+
921
+ declare const getPathBBox: (pathInput: PathArray | string) => {
922
+ x: number;
923
+ y: number;
924
+ width: number;
925
+ height: number;
926
+ x2: number;
927
+ y2: number;
928
+ cx: number;
929
+ cy: number;
930
+ cz: number;
931
+ };
932
+
933
+ /**
934
+ * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.
935
+ *
936
+ * @param pathInput the target `pathArray`
937
+ * @returns the shape total length
938
+ */
939
+ declare const getTotalLength: (pathInput: string | PathArray) => number;
940
+
941
+ declare const DISTANCE_EPSILON = 0.00001;
942
+
943
+ /**
944
+ * Returns the point in path closest to a given point.
945
+ *
946
+ * @param pathInput target `pathArray`
947
+ * @param point the given point
948
+ * @returns the best match
949
+ */
950
+ declare const getClosestPoint: (pathInput: string | PathArray, point: {
951
+ x: number;
952
+ y: number;
953
+ }) => {
954
+ x: number;
955
+ y: number;
956
+ };
957
+
958
+ /**
959
+ * Check if a path is drawn clockwise and returns true if so,
960
+ * false otherwise.
961
+ *
962
+ * @param path the path string or `pathArray`
963
+ * @returns true when clockwise or false if not
964
+ */
965
+ declare const getDrawDirection: (path: string | PathArray) => boolean;
966
+
967
+ /**
968
+ * Returns the area of a shape.
969
+ *
970
+ * @author Jürg Lehni & Jonathan Puckey
971
+ *
972
+ * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js
973
+ *
974
+ * @param path the shape `pathArray`
975
+ * @returns the length of the cubic-bezier segment
976
+ */
977
+ declare const getPathArea: (path: PathArray) => number;
978
+
979
+ /**
980
+ * Returns [x,y] coordinates of a point at a given length of a shape.
981
+ *
982
+ * @param pathInput the `pathArray` to look into
983
+ * @param distance the length of the shape to look at
984
+ * @returns the requested {x, y} point coordinates
985
+ */
986
+ declare const getPointAtLength: (pathInput: string | PathArray, distance?: number) => {
987
+ x: number;
988
+ y: number;
989
+ };
990
+
991
+ /**
992
+ * Returns the segment, its index and length as well as
993
+ * the length to that segment at a given length in a path.
994
+ *
995
+ * @param pathInput target `pathArray`
996
+ * @param distance the given length
997
+ * @returns the requested properties
998
+ */
999
+ declare const getPropertiesAtLength: (pathInput: string | PathArray, distance?: number) => SegmentProperties;
1000
+
1001
+ /**
1002
+ * Returns the point and segment in path closest to a given point as well as
1003
+ * the distance to the path stroke.
1004
+ *
1005
+ * @see https://bl.ocks.org/mbostock/8027637
1006
+ *
1007
+ * @param pathInput target `pathArray`
1008
+ * @param point the given point
1009
+ * @returns the requested properties
1010
+ */
1011
+ declare const getPropertiesAtPoint: (pathInput: string | PathArray, point: Point) => PointProperties;
1012
+
1013
+ /**
1014
+ * Returns the segment at a given length.
1015
+ *
1016
+ * @param pathInput the target `pathArray`
1017
+ * @param distance the distance in path to look at
1018
+ * @returns the requested segment
1019
+ */
1020
+ declare const getSegmentAtLength: (pathInput: string | PathArray, distance?: number) => PathSegment | undefined;
1021
+
1022
+ /**
1023
+ * Returns the path segment which contains a given point.
1024
+ *
1025
+ * @param path the `pathArray` to look into
1026
+ * @param point the point of the shape to look for
1027
+ * @returns the requested segment
1028
+ */
1029
+ declare const getSegmentOfPoint: (path: string | PathArray, point: {
1030
+ x: number;
1031
+ y: number;
1032
+ }) => SegmentProperties | undefined;
1033
+
1034
+ /**
1035
+ * Iterates an array to check if it's a `pathArray`
1036
+ * with all absolute values.
1037
+ *
1038
+ * @param path the `pathArray` to be checked
1039
+ * @returns iteration result
1040
+ */
1041
+ declare const isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
1042
+
1043
+ /**
1044
+ * Iterates an array to check if it's a `pathArray`
1045
+ * with all C (cubic bezier) segments.
1046
+ *
1047
+ * @param path the `Array` to be checked
1048
+ * @returns iteration result
1049
+ */
1050
+ declare const isCurveArray: (path: unknown) => path is CurveArray;
1051
+
1052
+ /**
1053
+ * Iterates an array to check if it's a `pathArray`
1054
+ * with all segments are in non-shorthand notation
1055
+ * with absolute values.
1056
+ *
1057
+ * @param {string | SVGPath.pathArray} path the `pathArray` to be checked
1058
+ * @returns {boolean} iteration result
1059
+ */
1060
+ declare const isNormalizedArray: (path: unknown) => path is NormalArray;
1061
+
1062
+ /**
1063
+ * Iterates an array to check if it's an actual `pathArray`.
1064
+ *
1065
+ * @param path the `pathArray` to be checked
1066
+ * @returns iteration result
1067
+ */
1068
+ declare const isPathArray: (path: unknown) => path is PathArray;
1069
+
1070
+ /**
1071
+ * Checks if a given point is in the stroke of a path.
1072
+ *
1073
+ * @param pathInput target path
1074
+ * @param point the given `{x,y}` point
1075
+ * @returns the query result
1076
+ */
1077
+ declare const isPointInStroke: (pathInput: string | PathArray, point: {
1078
+ x: number;
1079
+ y: number;
1080
+ }) => boolean;
1081
+
1082
+ /**
1083
+ * Iterates an array to check if it's a `pathArray`
1084
+ * with relative values.
1085
+ *
1086
+ * @param path the `pathArray` to be checked
1087
+ * @returns iteration result
1088
+ */
1089
+ declare const isRelativeArray: (path: unknown) => path is RelativeArray;
1090
+
1091
+ /**
1092
+ * Parses a path string value to determine its validity
1093
+ * then returns true if it's valid or false otherwise.
1094
+ *
1095
+ * @param pathString the path string to be parsed
1096
+ * @returns the path string validity
1097
+ */
1098
+ declare const isValidPath: (pathString: string) => boolean;
1099
+
1100
+ /**
1101
+ * Supported shapes and their specific parameters.
1102
+ */
1103
+ declare const shapeParams: ShapeParams;
1104
+
1105
+ /**
1106
+ * Returns a new `<path>` element created from attributes of a `<line>`, `<polyline>`,
1107
+ * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>` or `<glyph>`. If `replace` parameter
1108
+ * is `true`, it will replace the target. The default `ownerDocument` is your current
1109
+ * `document` browser page, if you want to use in server-side using `jsdom`, you can
1110
+ * pass the `jsdom` `document` to `ownDocument`.
1111
+ *
1112
+ * It can also work with an options object, see the type below
1113
+ * @see ShapeOps
1114
+ *
1115
+ * The newly created `<path>` element keeps all non-specific
1116
+ * attributes like `class`, `fill`, etc.
1117
+ *
1118
+ * @param element target shape
1119
+ * @param replace option to replace target
1120
+ * @param ownerDocument document for create element
1121
+ * @return the newly created `<path>` element
1122
+ */
1123
+ declare const shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
1124
+
1125
+ /**
1126
+ * Returns a new `pathArray` created from attributes of a `<line>`, `<polyline>`,
1127
+ * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>`, <path> or `<glyph>`.
1128
+ *
1129
+ * It can also work with an options object, see the type below
1130
+ * @see ShapeOps
1131
+ *
1132
+ * @param element target shape
1133
+ * @return the newly created `<path>` element
1134
+ */
1135
+ declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | PathArray;
1136
+
1137
+ /**
1138
+ * Normalizes a `pathArray` object for further processing:
1139
+ * * convert segments to absolute values
1140
+ * * convert shorthand path commands to their non-shorthand notation
1141
+ *
1142
+ * @param pathInput the string to be parsed or 'pathArray'
1143
+ * @returns the normalized `pathArray`
1144
+ */
1145
+ declare const normalizePath: (pathInput: string | PathArray) => NormalArray;
1146
+
1147
+ /**
1148
+ * Optimizes a `pathArray` object:
1149
+ * * convert segments to shorthand if possible
1150
+ * * select shortest segments from absolute and relative `pathArray`s
1151
+ *
1152
+ * @param pathInput a string or `pathArray`
1153
+ * @param roundOption the amount of decimals to round values to
1154
+ * @returns the optimized `pathArray`
1155
+ */
1156
+ declare const optimizePath: (pathInput: PathArray, roundOption?: number) => PathArray;
1157
+
1158
+ /**
1159
+ * Reverses all segments of a `pathArray` and returns a new `pathArray` instance
1160
+ * with absolute values.
1161
+ *
1162
+ * @param pathInput the source `pathArray`
1163
+ * @returns the reversed `pathArray`
1164
+ */
1165
+ declare const reversePath: (pathInput: PathArray) => PathArray;
1166
+
1167
+ /**
1168
+ * Split a path into an `Array` of sub-path strings.
1169
+ *
1170
+ * In the process, values are converted to absolute
1171
+ * for visual consistency.
1172
+ *
1173
+ * @param pathInput the source `pathArray`
1174
+ * @return an array with all sub-path strings
1175
+ */
1176
+ declare const splitPath: (pathInput: PathArray) => PathArray[];
1177
+
1178
+ /**
1179
+ * Apply a 2D / 3D transformation to a `pathArray` instance.
1180
+ *
1181
+ * Since *SVGElement* doesn't support 3D transformation, this function
1182
+ * creates a 2D projection of the <path> element.
1183
+ *
1184
+ * @param path the `pathArray` to apply transformation
1185
+ * @param transform the transform functions `Object`
1186
+ * @returns the resulted `pathArray`
1187
+ */
1188
+ declare const transformPath: (pathInput: PathArray | string, transform?: Partial<TransformObject>) => PathArray;
1189
+
1190
+ /**
1191
+ * Returns an absolute segment of a `PathArray` object.
1192
+ *
1193
+ * @param segment the segment object
1194
+ * @param index the segment index
1195
+ * @param lastX the last known X value
1196
+ * @param lastY the last known Y value
1197
+ * @returns the absolute segment
1198
+ */
1199
+ declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
1200
+
1201
+ /**
1202
+ * Converts A (arc-to) segments to C (cubic-bezier-to).
1203
+ *
1204
+ * For more information of where this math came from visit:
1205
+ * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
1206
+ *
1207
+ * @param X1 the starting x position
1208
+ * @param Y1 the starting y position
1209
+ * @param RX x-radius of the arc
1210
+ * @param RY y-radius of the arc
1211
+ * @param angle x-axis-rotation of the arc
1212
+ * @param LAF large-arc-flag of the arc
1213
+ * @param SF sweep-flag of the arc
1214
+ * @param X2 the ending x position
1215
+ * @param Y2 the ending y position
1216
+ * @param recursive the parameters needed to split arc into 2 segments
1217
+ * @return the resulting cubic-bezier segment(s)
1218
+ */
1219
+ declare const arcToCubic: (X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive?: [number, number, number, number]) => number[];
1220
+
1221
+ /**
1222
+ * Returns a transformation matrix to apply to `<path>` elements.
1223
+ *
1224
+ * @see TransformObjectValues
1225
+ *
1226
+ * @param transform the `transformObject`
1227
+ * @returns a new transformation matrix
1228
+ */
1229
+ declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
1230
+
1231
+ declare const iterate: <T extends PathArray>(path: PathArray, iterator: IteratorCallback) => T;
1232
+
1233
+ /**
1234
+ * Converts an L (line-to) segment to C (cubic-bezier).
1235
+ *
1236
+ * @param x1 line start x
1237
+ * @param y1 line start y
1238
+ * @param x2 line end x
1239
+ * @param y2 line end y
1240
+ * @returns the cubic-bezier segment
1241
+ */
1242
+ declare const lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[];
1243
+
1244
+ /**
1245
+ * Normalizes a single segment of a `pathArray` object.
1246
+ *
1247
+ * @param segment the segment object
1248
+ * @param params the normalization parameters
1249
+ * @returns the normalized segment
1250
+ */
1251
+ declare const normalizeSegment: (segment: PathSegment, params: ParserParams) => NormalSegment;
1252
+
1253
+ /**
1254
+ * Returns the [x,y] projected coordinates for a given an [x,y] point
1255
+ * and an [x,y,z] perspective origin point.
1256
+ *
1257
+ * Equation found here =>
1258
+ * http://en.wikipedia.org/wiki/3D_projection#Diagram
1259
+ * Details =>
1260
+ * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel
1261
+ *
1262
+ * @param m the transformation matrix
1263
+ * @param point2D the initial [x,y] coordinates
1264
+ * @param origin the [x,y,z] transform origin
1265
+ * @returns the projected [x,y] coordinates
1266
+ */
1267
+ declare const projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
1268
+
1269
+ /**
1270
+ * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).
1271
+ *
1272
+ * @param x1 curve start x
1273
+ * @param y1 curve start y
1274
+ * @param qx control point x
1275
+ * @param qy control point y
1276
+ * @param x2 curve end x
1277
+ * @param y2 curve end y
1278
+ * @returns the cubic-bezier segment
1279
+ */
1280
+ declare const quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
1281
+
1282
+ /**
1283
+ * Returns a relative segment of a `PathArray` object.
1284
+ *
1285
+ * @param segment the segment object
1286
+ * @param index the segment index
1287
+ * @param lastX the last known X value
1288
+ * @param lastY the last known Y value
1289
+ * @returns the relative segment
1290
+ */
1291
+ declare const relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
1292
+
1293
+ /**
1294
+ * Reverses all segments of a `pathArray`
1295
+ * which consists of only C (cubic-bezier) path commands.
1296
+ *
1297
+ * @param path the source `pathArray`
1298
+ * @returns the reversed `pathArray`
1299
+ */
1300
+ declare const reverseCurve: (path: CurveArray) => CurveArray;
1301
+
1302
+ /**
1303
+ * Rounds the values of a `pathArray` instance to
1304
+ * a specified amount of decimals and returns it.
1305
+ *
1306
+ * @param path the source `pathArray`
1307
+ * @param roundOption the amount of decimals to round numbers to
1308
+ * @returns the resulted `pathArray` with rounded values
1309
+ */
1310
+ declare const roundPath: (path: PathArray, roundOption?: number | "off") => PathArray;
1311
+
1312
+ declare const roundSegment: <T extends PathSegment>(segment: T, roundOption: number) => T;
1313
+
1314
+ /**
1315
+ * Converts any segment to C (cubic-bezier).
1316
+ *
1317
+ * @param segment the source segment
1318
+ * @param params the source segment parameters
1319
+ * @returns the cubic-bezier segment
1320
+ */
1321
+ declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
1322
+
1323
+ /**
1324
+ * Shorten a single segment of a `pathArray` object.
1325
+ *
1326
+ * @param segment the `absoluteSegment` object
1327
+ * @param normalSegment the `normalSegment` object
1328
+ * @param params the coordinates of the previous segment
1329
+ * @param prevCommand the path command of the previous segment
1330
+ * @returns the shortened segment
1331
+ */
1332
+ declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
1333
+
1334
+ /**
1335
+ * Split a cubic-bezier segment into two.
1336
+ *
1337
+ * @param pts the cubic-bezier parameters
1338
+ * @param ratio the cubic-bezier parameters
1339
+ * @return two new cubic-bezier segments
1340
+ */
1341
+ declare const splitCubic: (pts: number[], ratio?: number) => [CubicSegment, CubicSegment];
1342
+
1343
+ export { type ACommand, type ASegment, type AbsoluteArray, type AbsoluteCommand, type AbsoluteSegment, type ArcCoordinates, type ArcSegment, type CCommand, type CSegment, type CircleAttr, type CloseSegment, type CubicCoordinates, type CubicPoints, type CubicSegment, type CurveArray, type DeriveCallback, type DerivedCubicPoints, type DerivedPoint, type DerivedQuadPoints, type DigitNumber, type EllipseAttr, type GlyphAttr, type HCommand, type HSegment, type HorLineSegment, type IteratorCallback, type LCommand, type LSegment, type LengthFactory, type LineAttr, type LineCoordinates, type LineSegment, type MCommand, type MSegment, type MoveSegment, type NormalArray, type NormalSegment, type Options, type ParserParams, type PathArray, type PathBBox, type PathCommand, type PathCommandNumber, type PathSegment, type PathTransform, type Point, type PointProperties, type PointTuple, type PolyAttr, type PolygonArray, type PolylineArray, type QCommand, type QSegment, type QuadCoordinates, type QuadPoints, type QuadSegment, type RectAttr, type RelativeArray, type RelativeCommand, type RelativeSegment, type SCommand, type SSegment, type SegmentLimits, type SegmentProperties, type ShapeOps, type ShapeParams, type ShapeTags, type ShapeTypes, type ShortCubicSegment, type ShortQuadSegment, type ShortSegment, type SpaceNumber, type TCommand, type TSegment, type TransformEntries, type TransformObject, type TransformObjectValues, type TransformProps, type VCommand, type VSegment, type VertLineSegment, type ZCommand, type ZSegment, type aCommand, type aSegment, absolutizeSegment, arcToCubic, arcTools, bezierTools, type cCommand, type cSegment, cubicTools, SVGPathCommander as default, DISTANCE_EPSILON as distanceEpsilon, distanceSquareRoot, finalizeSegment, getClosestPoint, getDrawDirection, getPathArea, getPathBBox, getPointAtLength, getPropertiesAtLength, getPropertiesAtPoint, getSVGMatrix, getSegmentAtLength, getSegmentOfPoint, getTotalLength, type hCommand, type hSegment, invalidPathValue, isAbsoluteArray, isArcCommand, isCurveArray, isDigit, isDigitStart, isMoveCommand, isNormalizedArray, isPathArray, isPathCommand, isPointInStroke, isRelativeArray, isSpace, isValidPath, iterate, type lCommand, type lSegment, lineToCubic, lineTools, type mCommand, type mSegment, midPoint, normalizePath, normalizeSegment, optimizePath, paramsCount, paramsParser, parsePathString, PathParser as pathParser, pathToAbsolute, pathToCurve, pathToRelative, pathToString, polygonTools, projection2d, type qCommand, type qSegment, quadToCubic, quadTools, relativizeSegment, reverseCurve, reversePath, rotateVector, roundPath, roundSegment, roundTo, type sCommand, type sSegment, scanFlag, scanParam, scanSegment, segmentToCubic, shapeParams, shapeToPath, shapeToPathArray, shortenSegment, skipSpaces, splitCubic, splitPath, type tCommand, type tSegment, transformPath, type vCommand, type vSegment, type zCommand, type zSegment };