svg-path-commander 2.1.11 → 2.2.0

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.
@@ -1,1347 +0,0 @@
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 options(): Options;
476
- static get CSSMatrix(): typeof CSSMatrix;
477
- static get arcTools(): {
478
- angleBetween: (v0: Point, v1: Point) => number;
479
- arcLength: (rx: number, ry: number, theta: number) => number;
480
- arcPoint: (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => PointTuple;
481
- getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => [number, number, number, number];
482
- getArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => number;
483
- getArcProps: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => {
484
- rx: number;
485
- ry: number;
486
- startAngle: number;
487
- endAngle: number;
488
- center: {
489
- x: number;
490
- y: number;
491
- };
492
- };
493
- getPointAtArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number, distance?: number) => {
494
- x: number;
495
- y: number;
496
- };
497
- };
498
- static get bezierTools(): {
499
- bezierLength: (derivativeFn: DeriveCallback) => number;
500
- calculateBezier: (derivativeFn: DeriveCallback, t: number) => number;
501
- CBEZIER_MINMAX_EPSILON: number;
502
- computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint;
503
- Cvalues: number[];
504
- deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPoints | DerivedCubicPoints)[];
505
- getBezierLength: (curve: CubicCoordinates | QuadCoordinates) => number;
506
- minmaxC: ([v1, cp1, cp2, v2]: [number, number, number, number]) => PointTuple;
507
- minmaxQ: ([v1, cp, v2]: [number, number, number]) => PointTuple;
508
- Tvalues: number[];
509
- };
510
- static get cubicTools(): {
511
- getCubicBBox: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => [number, number, number, number];
512
- getCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => number;
513
- getPointAtCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number, distance?: number) => {
514
- x: number;
515
- y: number;
516
- };
517
- getPointAtCubicSegmentLength: ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {
518
- x: number;
519
- y: number;
520
- };
521
- };
522
- static get lineTools(): {
523
- getLineBBox: (x1: number, y1: number, x2: number, y2: number) => [number, number, number, number];
524
- getLineLength: (x1: number, y1: number, x2: number, y2: number) => number;
525
- getPointAtLineLength: (x1: number, y1: number, x2: number, y2: number, distance?: number) => {
526
- x: number;
527
- y: number;
528
- };
529
- };
530
- static get polygonTools(): {
531
- polygonArea: (polygon: PointTuple[]) => number;
532
- polygonLength: (polygon: PointTuple[]) => number;
533
- };
534
- static get quadTools(): {
535
- getPointAtQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number, distance?: number) => {
536
- x: number;
537
- y: number;
538
- };
539
- getPointAtQuadSegmentLength: ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {
540
- x: number;
541
- y: number;
542
- };
543
- getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => [number, number, number, number];
544
- getQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => number;
545
- };
546
- static get pathToAbsolute(): (pathInput: string | PathArray) => AbsoluteArray;
547
- static get pathToRelative(): (pathInput: string | PathArray) => RelativeArray;
548
- static get pathToCurve(): (pathInput: string | PathArray) => CurveArray;
549
- static get pathToString(): (path: PathArray, roundOption?: number | "off") => string;
550
- static get distanceSquareRoot(): (a: PointTuple, b: PointTuple) => number;
551
- static get midPoint(): (a: PointTuple, b: PointTuple, t: number) => PointTuple;
552
- static get rotateVector(): (x: number, y: number, rad: number) => {
553
- x: number;
554
- y: number;
555
- };
556
- static get roundTo(): (n: number, round: number) => number;
557
- static get parsePathString(): <T extends PathArray>(pathInput: string | T) => PathArray;
558
- static get finalizeSegment(): (path: PathParser) => void;
559
- static get invalidPathValue(): string;
560
- static get isArcCommand(): (code: number) => code is 97;
561
- static get isDigit(): (code: number) => code is DigitNumber;
562
- static get isDigitStart(): (code: number) => code is DigitNumber | 43 | 45 | 46;
563
- static get isMoveCommand(): (code: number) => code is 109 | 77;
564
- static get isPathCommand(): (code: number) => code is PathCommandNumber;
565
- static get isSpace(): (ch: number) => ch is SpaceNumber;
566
- static get paramsCount(): {
567
- a: number;
568
- c: number;
569
- h: number;
570
- l: number;
571
- m: number;
572
- r: number;
573
- q: number;
574
- s: number;
575
- t: number;
576
- v: number;
577
- z: number;
578
- };
579
- static get paramsParser(): ParserParams;
580
- static get pathParser(): typeof PathParser;
581
- static get scanFlag(): (path: PathParser) => void;
582
- static get scanParam(): (path: PathParser) => void;
583
- static get scanSegment(): (path: PathParser) => void;
584
- static get skipSpaces(): (path: PathParser) => void;
585
- static get distanceEpsilon(): number;
586
- static get getClosestPoint(): (pathInput: string | PathArray, point: {
587
- x: number;
588
- y: number;
589
- }) => {
590
- x: number;
591
- y: number;
592
- };
593
- static get getDrawDirection(): (path: string | PathArray) => boolean;
594
- static get getPathArea(): (path: PathArray) => number;
595
- static get getPathBBox(): (pathInput: PathArray | string) => {
596
- x: number;
597
- y: number;
598
- width: number;
599
- height: number;
600
- x2: number;
601
- y2: number;
602
- cx: number;
603
- cy: number;
604
- cz: number;
605
- };
606
- static get getPointAtLength(): (pathInput: string | PathArray, distance?: number) => {
607
- x: number;
608
- y: number;
609
- };
610
- static get getPropertiesAtLength(): (pathInput: string | PathArray, distance?: number) => SegmentProperties;
611
- static get getPropertiesAtPoint(): (pathInput: string | PathArray, point: Point) => PointProperties;
612
- static get getSegmentAtLength(): (pathInput: string | PathArray, distance?: number) => PathSegment | undefined;
613
- static get getSegmentOfPoint(): (path: string | PathArray, point: {
614
- x: number;
615
- y: number;
616
- }) => SegmentProperties | undefined;
617
- static get getTotalLength(): (pathInput: string | PathArray) => number;
618
- static get isAbsoluteArray(): (path: unknown) => path is AbsoluteArray;
619
- static get isCurveArray(): (path: unknown) => path is CurveArray;
620
- static get isNormalizedArray(): (path: unknown) => path is NormalArray;
621
- static get isPathArray(): (path: unknown) => path is PathArray;
622
- static get isPointInStroke(): (pathInput: string | PathArray, point: {
623
- x: number;
624
- y: number;
625
- }) => boolean;
626
- static get isRelativeArray(): (path: unknown) => path is RelativeArray;
627
- static get isValidPath(): (pathString: string) => boolean;
628
- static get shapeParams(): ShapeParams;
629
- static get shapeToPath(): (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
630
- static get shapeToPathArray(): (element: ShapeTypes | ShapeOps) => false | PathArray;
631
- static get absolutizeSegment(): (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
632
- 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[];
633
- static get getSVGMatrix(): (transform: TransformObjectValues) => CSSMatrix;
634
- static get iterate(): <T extends PathArray>(path: PathArray, iterator: IteratorCallback) => T;
635
- static get lineToCubic(): (x1: number, y1: number, x2: number, y2: number) => number[];
636
- static get normalizePath(): (pathInput: string | PathArray) => NormalArray;
637
- static get normalizeSegment(): (segment: PathSegment, params: ParserParams) => NormalSegment;
638
- static get optimizePath(): (pathInput: PathArray, roundOption?: number) => PathArray;
639
- static get projection2d(): (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
640
- static get quadToCubic(): (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
641
- static get relativizeSegment(): (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
642
- static get reverseCurve(): (path: CurveArray) => CurveArray;
643
- static get reversePath(): (pathInput: PathArray) => PathArray;
644
- static get roundPath(): (path: PathArray, roundOption?: number | "off") => PathArray;
645
- static get roundSegment(): <T extends PathSegment>(segment: T, roundOption: number) => T;
646
- static get segmentToCubic(): (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
647
- static get shortenSegment(): (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
648
- static get splitCubic(): (pts: number[], ratio?: number) => [CubicSegment, CubicSegment];
649
- static get splitPath(): (pathInput: PathArray) => PathArray[];
650
- static get transformPath(): (pathInput: PathArray | string, transform?: Partial<TransformObject>) => PathArray;
651
- }
652
-
653
- /** SVGPathCommander default options */
654
- declare const defaultOptions: Options;
655
-
656
- declare const arcTools: {
657
- angleBetween: (v0: Point, v1: Point) => number;
658
- arcLength: (rx: number, ry: number, theta: number) => number;
659
- arcPoint: (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => PointTuple;
660
- getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => [number, number, number, number];
661
- getArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => number;
662
- getArcProps: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => {
663
- rx: number;
664
- ry: number;
665
- startAngle: number;
666
- endAngle: number;
667
- center: {
668
- x: number;
669
- y: number;
670
- };
671
- };
672
- getPointAtArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number, distance?: number) => {
673
- x: number;
674
- y: number;
675
- };
676
- };
677
-
678
- declare const bezierTools: {
679
- bezierLength: (derivativeFn: DeriveCallback) => number;
680
- calculateBezier: (derivativeFn: DeriveCallback, t: number) => number;
681
- CBEZIER_MINMAX_EPSILON: number;
682
- computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint;
683
- Cvalues: number[];
684
- deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPoints | DerivedCubicPoints)[];
685
- getBezierLength: (curve: CubicCoordinates | QuadCoordinates) => number;
686
- minmaxC: ([v1, cp1, cp2, v2]: [number, number, number, number]) => PointTuple;
687
- minmaxQ: ([v1, cp, v2]: [number, number, number]) => PointTuple;
688
- Tvalues: number[];
689
- };
690
-
691
- declare const cubicTools: {
692
- getCubicBBox: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => [number, number, number, number];
693
- getCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => number;
694
- getPointAtCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number, distance?: number) => {
695
- x: number;
696
- y: number;
697
- };
698
- getPointAtCubicSegmentLength: ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {
699
- x: number;
700
- y: number;
701
- };
702
- };
703
-
704
- declare const lineTools: {
705
- getLineBBox: (x1: number, y1: number, x2: number, y2: number) => [number, number, number, number];
706
- getLineLength: (x1: number, y1: number, x2: number, y2: number) => number;
707
- getPointAtLineLength: (x1: number, y1: number, x2: number, y2: number, distance?: number) => {
708
- x: number;
709
- y: number;
710
- };
711
- };
712
-
713
- declare const quadTools: {
714
- getPointAtQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number, distance?: number) => {
715
- x: number;
716
- y: number;
717
- };
718
- getPointAtQuadSegmentLength: ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {
719
- x: number;
720
- y: number;
721
- };
722
- getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => [number, number, number, number];
723
- getQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => number;
724
- };
725
-
726
- declare const polygonTools: {
727
- polygonArea: (polygon: PointTuple[]) => number;
728
- polygonLength: (polygon: PointTuple[]) => number;
729
- };
730
-
731
- /**
732
- * Returns the square root of the distance
733
- * between two given points.
734
- *
735
- * @param a the first point coordinates
736
- * @param b the second point coordinates
737
- * @returns the distance value
738
- */
739
- declare const distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
740
-
741
- /**
742
- * Returns the coordinates of a specified distance
743
- * ratio between two points.
744
- *
745
- * @param a the first point coordinates
746
- * @param b the second point coordinates
747
- * @param t the ratio
748
- * @returns the midpoint coordinates
749
- */
750
- declare const midPoint: (a: PointTuple, b: PointTuple, t: number) => PointTuple;
751
-
752
- /**
753
- * Returns an {x,y} vector rotated by a given
754
- * angle in radian.
755
- *
756
- * @param x the initial vector x
757
- * @param y the initial vector y
758
- * @param rad the radian vector angle
759
- * @returns the rotated vector
760
- */
761
- declare const rotateVector: (x: number, y: number, rad: number) => {
762
- x: number;
763
- y: number;
764
- };
765
-
766
- declare const roundTo: (n: number, round: number) => number;
767
-
768
- /**
769
- * Parses a path string value or object and returns an array
770
- * of segments, all converted to absolute values.
771
- *
772
- * @param pathInput the path string | object
773
- * @returns the resulted `pathArray` with absolute values
774
- */
775
- declare const pathToAbsolute: (pathInput: string | PathArray) => AbsoluteArray;
776
-
777
- /**
778
- * Parses a path string value or object and returns an array
779
- * of segments, all converted to relative values.
780
- *
781
- * @param pathInput the path string | object
782
- * @returns the resulted `pathArray` with relative values
783
- */
784
- declare const pathToRelative: (pathInput: string | PathArray) => RelativeArray;
785
-
786
- /**
787
- * Parses a path string value or 'pathArray' and returns a new one
788
- * in which all segments are converted to cubic-bezier.
789
- *
790
- * In addition, un-necessary `Z` segment is removed if previous segment
791
- * extends to the `M` segment.
792
- *
793
- * @param pathInput the string to be parsed or 'pathArray'
794
- * @returns the resulted `pathArray` converted to cubic-bezier
795
- */
796
- declare const pathToCurve: (pathInput: string | PathArray) => CurveArray;
797
-
798
- /**
799
- * Returns a valid `d` attribute string value created
800
- * by rounding values and concatenating the `pathArray` segments.
801
- *
802
- * @param path the `pathArray` object
803
- * @param roundOption amount of decimals to round values to
804
- * @returns the concatenated path string
805
- */
806
- declare const pathToString: (path: PathArray, roundOption?: number | "off") => string;
807
-
808
- /**
809
- * Parses a path string value and returns an array
810
- * of segments we like to call `pathArray`.
811
- *
812
- * @param pathInput the string to be parsed
813
- * @returns the resulted `pathArray` or error string
814
- */
815
- declare const parsePathString: <T extends PathArray>(pathInput: string | T) => PathArray;
816
-
817
- /**
818
- * Breaks the parsing of a pathString once a segment is finalized.
819
- *
820
- * @param path the `PathParser` instance
821
- */
822
- declare const finalizeSegment: (path: PathParser) => void;
823
-
824
- declare const invalidPathValue = "Invalid path value";
825
-
826
- /**
827
- * Checks if the character is an A (arc-to) path command.
828
- *
829
- * @param code the character to check
830
- * @returns check result
831
- */
832
- declare const isArcCommand: (code: number) => code is 97;
833
-
834
- /**
835
- * Checks if a character is a digit.
836
- *
837
- * @param code the character to check
838
- * @returns check result
839
- */
840
- declare const isDigit: (code: number) => code is DigitNumber;
841
-
842
- /**
843
- * Checks if the character is or belongs to a number.
844
- * [0-9]|+|-|.
845
- *
846
- * @param code the character to check
847
- * @returns check result
848
- */
849
- declare const isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46;
850
-
851
- /**
852
- * Checks if the character is a MoveTo command.
853
- *
854
- * @param code the character to check
855
- * @returns check result
856
- */
857
- declare const isMoveCommand: (code: number) => code is 109 | 77;
858
-
859
- /**
860
- * Checks if the character is a path command.
861
- *
862
- * @param code the character to check
863
- * @returns check result
864
- */
865
- declare const isPathCommand: (code: number) => code is PathCommandNumber;
866
-
867
- /**
868
- * Checks if the character is a space.
869
- *
870
- * @param ch the character to check
871
- * @returns check result
872
- */
873
- declare const isSpace: (ch: number) => ch is SpaceNumber;
874
-
875
- /** Segment params length */
876
- declare const paramsCount: {
877
- a: number;
878
- c: number;
879
- h: number;
880
- l: number;
881
- m: number;
882
- r: number;
883
- q: number;
884
- s: number;
885
- t: number;
886
- v: number;
887
- z: number;
888
- };
889
-
890
- declare const paramsParser: ParserParams;
891
-
892
- /**
893
- * Validates an A (arc-to) specific path command value.
894
- * Usually a `large-arc-flag` or `sweep-flag`.
895
- *
896
- * @param path the `PathParser` instance
897
- */
898
- declare const scanFlag: (path: PathParser) => void;
899
-
900
- /**
901
- * Validates every character of the path string,
902
- * every path command, negative numbers or floating point numbers.
903
- *
904
- * @param path the `PathParser` instance
905
- */
906
- declare const scanParam: (path: PathParser) => void;
907
-
908
- /**
909
- * Scans every character in the path string to determine
910
- * where a segment starts and where it ends.
911
- *
912
- * @param path the `PathParser` instance
913
- */
914
- declare const scanSegment: (path: PathParser) => void;
915
-
916
- /**
917
- * Points the parser to the next character in the
918
- * path string every time it encounters any kind of
919
- * space character.
920
- *
921
- * @param path the `PathParser` instance
922
- */
923
- declare const skipSpaces: (path: PathParser) => void;
924
-
925
- declare const getPathBBox: (pathInput: PathArray | string) => {
926
- x: number;
927
- y: number;
928
- width: number;
929
- height: number;
930
- x2: number;
931
- y2: number;
932
- cx: number;
933
- cy: number;
934
- cz: number;
935
- };
936
-
937
- /**
938
- * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.
939
- *
940
- * @param pathInput the target `pathArray`
941
- * @returns the shape total length
942
- */
943
- declare const getTotalLength: (pathInput: string | PathArray) => number;
944
-
945
- declare const DISTANCE_EPSILON = 0.00001;
946
-
947
- /**
948
- * Returns the point in path closest to a given point.
949
- *
950
- * @param pathInput target `pathArray`
951
- * @param point the given point
952
- * @returns the best match
953
- */
954
- declare const getClosestPoint: (pathInput: string | PathArray, point: {
955
- x: number;
956
- y: number;
957
- }) => {
958
- x: number;
959
- y: number;
960
- };
961
-
962
- /**
963
- * Check if a path is drawn clockwise and returns true if so,
964
- * false otherwise.
965
- *
966
- * @param path the path string or `pathArray`
967
- * @returns true when clockwise or false if not
968
- */
969
- declare const getDrawDirection: (path: string | PathArray) => boolean;
970
-
971
- /**
972
- * Returns the area of a shape.
973
- *
974
- * @author Jürg Lehni & Jonathan Puckey
975
- *
976
- * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js
977
- *
978
- * @param path the shape `pathArray`
979
- * @returns the length of the cubic-bezier segment
980
- */
981
- declare const getPathArea: (path: PathArray) => number;
982
-
983
- /**
984
- * Returns [x,y] coordinates of a point at a given length of a shape.
985
- *
986
- * @param pathInput the `pathArray` to look into
987
- * @param distance the length of the shape to look at
988
- * @returns the requested {x, y} point coordinates
989
- */
990
- declare const getPointAtLength: (pathInput: string | PathArray, distance?: number) => {
991
- x: number;
992
- y: number;
993
- };
994
-
995
- /**
996
- * Returns the segment, its index and length as well as
997
- * the length to that segment at a given length in a path.
998
- *
999
- * @param pathInput target `pathArray`
1000
- * @param distance the given length
1001
- * @returns the requested properties
1002
- */
1003
- declare const getPropertiesAtLength: (pathInput: string | PathArray, distance?: number) => SegmentProperties;
1004
-
1005
- /**
1006
- * Returns the point and segment in path closest to a given point as well as
1007
- * the distance to the path stroke.
1008
- *
1009
- * @see https://bl.ocks.org/mbostock/8027637
1010
- *
1011
- * @param pathInput target `pathArray`
1012
- * @param point the given point
1013
- * @returns the requested properties
1014
- */
1015
- declare const getPropertiesAtPoint: (pathInput: string | PathArray, point: Point) => PointProperties;
1016
-
1017
- /**
1018
- * Returns the segment at a given length.
1019
- *
1020
- * @param pathInput the target `pathArray`
1021
- * @param distance the distance in path to look at
1022
- * @returns the requested segment
1023
- */
1024
- declare const getSegmentAtLength: (pathInput: string | PathArray, distance?: number) => PathSegment | undefined;
1025
-
1026
- /**
1027
- * Returns the path segment which contains a given point.
1028
- *
1029
- * @param path the `pathArray` to look into
1030
- * @param point the point of the shape to look for
1031
- * @returns the requested segment
1032
- */
1033
- declare const getSegmentOfPoint: (path: string | PathArray, point: {
1034
- x: number;
1035
- y: number;
1036
- }) => SegmentProperties | undefined;
1037
-
1038
- /**
1039
- * Iterates an array to check if it's a `pathArray`
1040
- * with all absolute values.
1041
- *
1042
- * @param path the `pathArray` to be checked
1043
- * @returns iteration result
1044
- */
1045
- declare const isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
1046
-
1047
- /**
1048
- * Iterates an array to check if it's a `pathArray`
1049
- * with all C (cubic bezier) segments.
1050
- *
1051
- * @param path the `Array` to be checked
1052
- * @returns iteration result
1053
- */
1054
- declare const isCurveArray: (path: unknown) => path is CurveArray;
1055
-
1056
- /**
1057
- * Iterates an array to check if it's a `pathArray`
1058
- * with all segments are in non-shorthand notation
1059
- * with absolute values.
1060
- *
1061
- * @param {string | SVGPath.pathArray} path the `pathArray` to be checked
1062
- * @returns {boolean} iteration result
1063
- */
1064
- declare const isNormalizedArray: (path: unknown) => path is NormalArray;
1065
-
1066
- /**
1067
- * Iterates an array to check if it's an actual `pathArray`.
1068
- *
1069
- * @param path the `pathArray` to be checked
1070
- * @returns iteration result
1071
- */
1072
- declare const isPathArray: (path: unknown) => path is PathArray;
1073
-
1074
- /**
1075
- * Checks if a given point is in the stroke of a path.
1076
- *
1077
- * @param pathInput target path
1078
- * @param point the given `{x,y}` point
1079
- * @returns the query result
1080
- */
1081
- declare const isPointInStroke: (pathInput: string | PathArray, point: {
1082
- x: number;
1083
- y: number;
1084
- }) => boolean;
1085
-
1086
- /**
1087
- * Iterates an array to check if it's a `pathArray`
1088
- * with relative values.
1089
- *
1090
- * @param path the `pathArray` to be checked
1091
- * @returns iteration result
1092
- */
1093
- declare const isRelativeArray: (path: unknown) => path is RelativeArray;
1094
-
1095
- /**
1096
- * Parses a path string value to determine its validity
1097
- * then returns true if it's valid or false otherwise.
1098
- *
1099
- * @param pathString the path string to be parsed
1100
- * @returns the path string validity
1101
- */
1102
- declare const isValidPath: (pathString: string) => boolean;
1103
-
1104
- /**
1105
- * Supported shapes and their specific parameters.
1106
- */
1107
- declare const shapeParams: ShapeParams;
1108
-
1109
- /**
1110
- * Returns a new `<path>` element created from attributes of a `<line>`, `<polyline>`,
1111
- * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>` or `<glyph>`. If `replace` parameter
1112
- * is `true`, it will replace the target. The default `ownerDocument` is your current
1113
- * `document` browser page, if you want to use in server-side using `jsdom`, you can
1114
- * pass the `jsdom` `document` to `ownDocument`.
1115
- *
1116
- * It can also work with an options object, see the type below
1117
- * @see ShapeOps
1118
- *
1119
- * The newly created `<path>` element keeps all non-specific
1120
- * attributes like `class`, `fill`, etc.
1121
- *
1122
- * @param element target shape
1123
- * @param replace option to replace target
1124
- * @param ownerDocument document for create element
1125
- * @return the newly created `<path>` element
1126
- */
1127
- declare const shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
1128
-
1129
- /**
1130
- * Returns a new `pathArray` created from attributes of a `<line>`, `<polyline>`,
1131
- * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>`, <path> or `<glyph>`.
1132
- *
1133
- * It can also work with an options object, see the type below
1134
- * @see ShapeOps
1135
- *
1136
- * @param element target shape
1137
- * @return the newly created `<path>` element
1138
- */
1139
- declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | PathArray;
1140
-
1141
- /**
1142
- * Normalizes a `pathArray` object for further processing:
1143
- * * convert segments to absolute values
1144
- * * convert shorthand path commands to their non-shorthand notation
1145
- *
1146
- * @param pathInput the string to be parsed or 'pathArray'
1147
- * @returns the normalized `pathArray`
1148
- */
1149
- declare const normalizePath: (pathInput: string | PathArray) => NormalArray;
1150
-
1151
- /**
1152
- * Optimizes a `pathArray` object:
1153
- * * convert segments to shorthand if possible
1154
- * * select shortest segments from absolute and relative `pathArray`s
1155
- *
1156
- * @param pathInput a string or `pathArray`
1157
- * @param roundOption the amount of decimals to round values to
1158
- * @returns the optimized `pathArray`
1159
- */
1160
- declare const optimizePath: (pathInput: PathArray, roundOption?: number) => PathArray;
1161
-
1162
- /**
1163
- * Reverses all segments of a `pathArray` and returns a new `pathArray` instance
1164
- * with absolute values.
1165
- *
1166
- * @param pathInput the source `pathArray`
1167
- * @returns the reversed `pathArray`
1168
- */
1169
- declare const reversePath: (pathInput: PathArray) => PathArray;
1170
-
1171
- /**
1172
- * Split a path into an `Array` of sub-path strings.
1173
- *
1174
- * In the process, values are converted to absolute
1175
- * for visual consistency.
1176
- *
1177
- * @param pathInput the source `pathArray`
1178
- * @return an array with all sub-path strings
1179
- */
1180
- declare const splitPath: (pathInput: PathArray) => PathArray[];
1181
-
1182
- /**
1183
- * Apply a 2D / 3D transformation to a `pathArray` instance.
1184
- *
1185
- * Since *SVGElement* doesn't support 3D transformation, this function
1186
- * creates a 2D projection of the <path> element.
1187
- *
1188
- * @param path the `pathArray` to apply transformation
1189
- * @param transform the transform functions `Object`
1190
- * @returns the resulted `pathArray`
1191
- */
1192
- declare const transformPath: (pathInput: PathArray | string, transform?: Partial<TransformObject>) => PathArray;
1193
-
1194
- /**
1195
- * Returns an absolute segment of a `PathArray` object.
1196
- *
1197
- * @param segment the segment object
1198
- * @param index the segment index
1199
- * @param lastX the last known X value
1200
- * @param lastY the last known Y value
1201
- * @returns the absolute segment
1202
- */
1203
- declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
1204
-
1205
- /**
1206
- * Converts A (arc-to) segments to C (cubic-bezier-to).
1207
- *
1208
- * For more information of where this math came from visit:
1209
- * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
1210
- *
1211
- * @param X1 the starting x position
1212
- * @param Y1 the starting y position
1213
- * @param RX x-radius of the arc
1214
- * @param RY y-radius of the arc
1215
- * @param angle x-axis-rotation of the arc
1216
- * @param LAF large-arc-flag of the arc
1217
- * @param SF sweep-flag of the arc
1218
- * @param X2 the ending x position
1219
- * @param Y2 the ending y position
1220
- * @param recursive the parameters needed to split arc into 2 segments
1221
- * @return the resulting cubic-bezier segment(s)
1222
- */
1223
- 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[];
1224
-
1225
- /**
1226
- * Returns a transformation matrix to apply to `<path>` elements.
1227
- *
1228
- * @see TransformObjectValues
1229
- *
1230
- * @param transform the `transformObject`
1231
- * @returns a new transformation matrix
1232
- */
1233
- declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
1234
-
1235
- declare const iterate: <T extends PathArray>(path: PathArray, iterator: IteratorCallback) => T;
1236
-
1237
- /**
1238
- * Converts an L (line-to) segment to C (cubic-bezier).
1239
- *
1240
- * @param x1 line start x
1241
- * @param y1 line start y
1242
- * @param x2 line end x
1243
- * @param y2 line end y
1244
- * @returns the cubic-bezier segment
1245
- */
1246
- declare const lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[];
1247
-
1248
- /**
1249
- * Normalizes a single segment of a `pathArray` object.
1250
- *
1251
- * @param segment the segment object
1252
- * @param params the normalization parameters
1253
- * @returns the normalized segment
1254
- */
1255
- declare const normalizeSegment: (segment: PathSegment, params: ParserParams) => NormalSegment;
1256
-
1257
- /**
1258
- * Returns the [x,y] projected coordinates for a given an [x,y] point
1259
- * and an [x,y,z] perspective origin point.
1260
- *
1261
- * Equation found here =>
1262
- * http://en.wikipedia.org/wiki/3D_projection#Diagram
1263
- * Details =>
1264
- * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel
1265
- *
1266
- * @param m the transformation matrix
1267
- * @param point2D the initial [x,y] coordinates
1268
- * @param origin the [x,y,z] transform origin
1269
- * @returns the projected [x,y] coordinates
1270
- */
1271
- declare const projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
1272
-
1273
- /**
1274
- * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).
1275
- *
1276
- * @param x1 curve start x
1277
- * @param y1 curve start y
1278
- * @param qx control point x
1279
- * @param qy control point y
1280
- * @param x2 curve end x
1281
- * @param y2 curve end y
1282
- * @returns the cubic-bezier segment
1283
- */
1284
- declare const quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
1285
-
1286
- /**
1287
- * Returns a relative segment of a `PathArray` object.
1288
- *
1289
- * @param segment the segment object
1290
- * @param index the segment index
1291
- * @param lastX the last known X value
1292
- * @param lastY the last known Y value
1293
- * @returns the relative segment
1294
- */
1295
- declare const relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
1296
-
1297
- /**
1298
- * Reverses all segments of a `pathArray`
1299
- * which consists of only C (cubic-bezier) path commands.
1300
- *
1301
- * @param path the source `pathArray`
1302
- * @returns the reversed `pathArray`
1303
- */
1304
- declare const reverseCurve: (path: CurveArray) => CurveArray;
1305
-
1306
- /**
1307
- * Rounds the values of a `pathArray` instance to
1308
- * a specified amount of decimals and returns it.
1309
- *
1310
- * @param path the source `pathArray`
1311
- * @param roundOption the amount of decimals to round numbers to
1312
- * @returns the resulted `pathArray` with rounded values
1313
- */
1314
- declare const roundPath: (path: PathArray, roundOption?: number | "off") => PathArray;
1315
-
1316
- declare const roundSegment: <T extends PathSegment>(segment: T, roundOption: number) => T;
1317
-
1318
- /**
1319
- * Converts any segment to C (cubic-bezier).
1320
- *
1321
- * @param segment the source segment
1322
- * @param params the source segment parameters
1323
- * @returns the cubic-bezier segment
1324
- */
1325
- declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
1326
-
1327
- /**
1328
- * Shorten a single segment of a `pathArray` object.
1329
- *
1330
- * @param segment the `absoluteSegment` object
1331
- * @param normalSegment the `normalSegment` object
1332
- * @param params the coordinates of the previous segment
1333
- * @param prevCommand the path command of the previous segment
1334
- * @returns the shortened segment
1335
- */
1336
- declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
1337
-
1338
- /**
1339
- * Split a cubic-bezier segment into two.
1340
- *
1341
- * @param pts the cubic-bezier parameters
1342
- * @param ratio the cubic-bezier parameters
1343
- * @return two new cubic-bezier segments
1344
- */
1345
- declare const splitCubic: (pts: number[], ratio?: number) => [CubicSegment, CubicSegment];
1346
-
1347
- 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, defaultOptions as options, 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 };