svg-path-commander 2.2.1 → 2.2.2

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.
package/dist/index.d.ts CHANGED
@@ -1,10 +1,9 @@
1
1
  /*!
2
- * SVGPathCommander v2.2.1 (http://thednp.github.io/svg-path-commander)
2
+ * SVGPathCommander v2.2.2 (http://thednp.github.io/svg-path-commander)
3
3
  * Copyright 2026 © thednp
4
4
  * Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
5
5
  */
6
6
  import CSSMatrix from "@thednp/dommatrix";
7
-
8
7
  //#region src/interface.d.ts
9
8
  type SegmentProperties = {
10
9
  segment: PathSegment;
@@ -277,6 +276,135 @@ interface PathFeature {
277
276
  bbox: PathBBox;
278
277
  }
279
278
  //#endregion
279
+ //#region src/math/distanceSquareRoot.d.ts
280
+ /**
281
+ * Returns the square root of the distance
282
+ * between two given points.
283
+ *
284
+ * @param a the first point coordinates
285
+ * @param b the second point coordinates
286
+ * @returns the distance value
287
+ */
288
+ declare const distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
289
+ //#endregion
290
+ //#region src/math/midPoint.d.ts
291
+ /**
292
+ * Returns the coordinates of a specified distance
293
+ * ratio between two points.
294
+ *
295
+ * @param a the first point coordinates
296
+ * @param b the second point coordinates
297
+ * @param t the ratio
298
+ * @returns the midpoint coordinates
299
+ */
300
+ declare const midPoint: ([ax, ay]: PointTuple, [bx, by]: PointTuple, t: number) => PointTuple;
301
+ //#endregion
302
+ //#region src/math/rotateVector.d.ts
303
+ /**
304
+ * Returns an {x,y} vector rotated by a given
305
+ * angle in radian.
306
+ *
307
+ * @param x the initial vector x
308
+ * @param y the initial vector y
309
+ * @param rad the radian vector angle
310
+ * @returns the rotated vector
311
+ */
312
+ declare const rotateVector: (x: number, y: number, rad: number) => {
313
+ x: number;
314
+ y: number;
315
+ };
316
+ //#endregion
317
+ //#region src/math/roundTo.d.ts
318
+ /**
319
+ * Rounds a number to the specified number of decimal places.
320
+ *
321
+ * @param n - The number to round
322
+ * @param round - Number of decimal places
323
+ * @returns The rounded number
324
+ */
325
+ declare const roundTo: (n: number, round: number) => number;
326
+ //#endregion
327
+ //#region src/convert/pathToAbsolute.d.ts
328
+ /**
329
+ * Parses a path string value or object and returns an array
330
+ * of segments, all converted to absolute values.
331
+ *
332
+ * @param pathInput - The path string or PathArray
333
+ * @returns The resulted PathArray with absolute values
334
+ *
335
+ * @example
336
+ * ```ts
337
+ * pathToAbsolute('M10 10l80 80')
338
+ * // => [['M', 10, 10], ['L', 90, 90]]
339
+ * ```
340
+ */
341
+ declare const pathToAbsolute: <T extends PathArray>(pathInput: string | T) => AbsoluteArray;
342
+ //#endregion
343
+ //#region src/convert/pathToRelative.d.ts
344
+ /**
345
+ * Parses a path string value or object and returns an array
346
+ * of segments, all converted to relative values.
347
+ *
348
+ * @param pathInput - The path string or PathArray
349
+ * @returns The resulted PathArray with relative values
350
+ *
351
+ * @example
352
+ * ```ts
353
+ * pathToRelative('M10 10L90 90')
354
+ * // => [['M', 10, 10], ['l', 80, 80]]
355
+ * ```
356
+ */
357
+ declare const pathToRelative: <T extends PathArray>(pathInput: string | T) => RelativeArray;
358
+ //#endregion
359
+ //#region src/convert/pathToCurve.d.ts
360
+ /**
361
+ * Parses a path string or PathArray and returns a new one
362
+ * in which all segments are converted to cubic-bezier.
363
+ *
364
+ * @param pathInput - The path string or PathArray
365
+ * @returns The resulted CurveArray with all segments as cubic beziers
366
+ *
367
+ * @example
368
+ * ```ts
369
+ * pathToCurve('M10 50q15 -25 30 0')
370
+ * // => [['M', 10, 50], ['C', 25, 25, 40, 50, 40, 50]]
371
+ * ```
372
+ */
373
+ declare const pathToCurve: <T extends PathArray>(pathInput: string | T) => CurveArray;
374
+ //#endregion
375
+ //#region src/convert/pathToString.d.ts
376
+ /**
377
+ * Returns a valid `d` attribute string value created
378
+ * by rounding values and concatenating the PathArray segments.
379
+ *
380
+ * @param path - The PathArray object
381
+ * @param roundOption - Amount of decimals to round values to, or "off"
382
+ * @returns The concatenated path string
383
+ *
384
+ * @example
385
+ * ```ts
386
+ * pathToString([['M', 10, 10], ['L', 90, 90]], 2)
387
+ * // => 'M10 10L90 90'
388
+ * ```
389
+ */
390
+ declare const pathToString: <T extends PathArray>(path: T, roundOption?: number | "off") => string;
391
+ //#endregion
392
+ //#region src/parser/parsePathString.d.ts
393
+ /**
394
+ * Parses a path string value and returns an array
395
+ * of segments we like to call `PathArray`.
396
+ *
397
+ * If parameter value is already a `PathArray`,
398
+ * return a clone of it.
399
+ * @example
400
+ * parsePathString("M 0 0L50 50")
401
+ * // => [["M",0,0],["L",50,50]]
402
+ *
403
+ * @param pathInput the string to be parsed
404
+ * @returns the resulted `pathArray` or error string
405
+ */
406
+ declare const parsePathString: <T extends PathArray>(pathInput: string | T) => PathArray;
407
+ //#endregion
280
408
  //#region src/parser/pathParser.d.ts
281
409
  /**
282
410
  * The `PathParser` is used by the `parsePathString` static method
@@ -296,6 +424,338 @@ declare class PathParser {
296
424
  constructor(pathString: string);
297
425
  }
298
426
  //#endregion
427
+ //#region src/parser/finalizeSegment.d.ts
428
+ /**
429
+ * Breaks the parsing of a pathString once a segment is finalized.
430
+ *
431
+ * @param path - The PathParser instance
432
+ */
433
+ declare const finalizeSegment: (path: PathParser) => void;
434
+ //#endregion
435
+ //#region src/parser/isArcCommand.d.ts
436
+ /**
437
+ * Checks if the character is an A (arc-to) path command.
438
+ *
439
+ * @param code the character to check
440
+ * @returns check result
441
+ */
442
+ declare const isArcCommand: (code: number) => code is 97;
443
+ //#endregion
444
+ //#region src/parser/isDigit.d.ts
445
+ /**
446
+ * Checks if a character is a digit.
447
+ *
448
+ * @param code the character to check
449
+ * @returns check result
450
+ */
451
+ declare const isDigit: (code: number) => code is DigitNumber;
452
+ //#endregion
453
+ //#region src/parser/isDigitStart.d.ts
454
+ /**
455
+ * Checks if the character is or belongs to a number.
456
+ * [0-9]|+|-|.
457
+ *
458
+ * @param code the character to check
459
+ * @returns check result
460
+ */
461
+ declare const isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46;
462
+ //#endregion
463
+ //#region src/parser/isMoveCommand.d.ts
464
+ /**
465
+ * Checks if the character is a MoveTo command.
466
+ *
467
+ * @param code the character to check
468
+ * @returns check result
469
+ */
470
+ declare const isMoveCommand: (code: number) => code is 109 | 77;
471
+ //#endregion
472
+ //#region src/parser/isPathCommand.d.ts
473
+ /**
474
+ * Checks if the character is a path command.
475
+ *
476
+ * @param code the character to check
477
+ * @returns check result
478
+ */
479
+ declare const isPathCommand: (code: number) => code is PathCommandNumber;
480
+ //#endregion
481
+ //#region src/parser/isSpace.d.ts
482
+ /**
483
+ * Checks if the character is a space.
484
+ *
485
+ * @param ch the character to check
486
+ * @returns check result
487
+ */
488
+ declare const isSpace: (ch: number) => ch is SpaceNumber;
489
+ //#endregion
490
+ //#region src/parser/scanFlag.d.ts
491
+ /**
492
+ * Validates an A (arc-to) specific path command value.
493
+ * Usually a `large-arc-flag` or `sweep-flag`.
494
+ *
495
+ * @param path - The PathParser instance
496
+ */
497
+ declare const scanFlag: (path: PathParser) => void;
498
+ //#endregion
499
+ //#region src/parser/scanParam.d.ts
500
+ /**
501
+ * Validates every character of the path string,
502
+ * every path command, negative numbers or floating point numbers.
503
+ *
504
+ * @param path - The PathParser instance
505
+ */
506
+ declare const scanParam: (path: PathParser) => void;
507
+ //#endregion
508
+ //#region src/parser/scanSegment.d.ts
509
+ /**
510
+ * Scans every character in the path string to determine
511
+ * where a segment starts and where it ends.
512
+ *
513
+ * @param path - The PathParser instance
514
+ */
515
+ declare const scanSegment: (path: PathParser) => void;
516
+ //#endregion
517
+ //#region src/parser/skipSpaces.d.ts
518
+ /**
519
+ * Points the parser to the next character in the
520
+ * path string every time it encounters any kind of
521
+ * space character.
522
+ *
523
+ * @param path - The PathParser instance
524
+ */
525
+ declare const skipSpaces: (path: PathParser) => void;
526
+ //#endregion
527
+ //#region src/util/getPathBBox.d.ts
528
+ /**
529
+ * Calculates the bounding box of a path.
530
+ *
531
+ * @param pathInput - The path string or PathArray
532
+ * @returns An object with width, height, x, y, x2, y2, cx, cy, cz properties
533
+ *
534
+ * @example
535
+ * ```ts
536
+ * getPathBBox('M0 0L100 0L100 100L0 100Z')
537
+ * // => { x: 0, y: 0, width: 100, height: 100, x2: 100, y2: 100, cx: 50, cy: 50, cz: 150 }
538
+ * ```
539
+ */
540
+ declare const getPathBBox: <T extends PathArray>(pathInput: T | string) => {
541
+ x: number;
542
+ y: number;
543
+ width: number;
544
+ height: number;
545
+ x2: number;
546
+ y2: number;
547
+ cx: number;
548
+ cy: number;
549
+ cz: number;
550
+ };
551
+ //#endregion
552
+ //#region src/util/getTotalLength.d.ts
553
+ /**
554
+ * Returns the total length of a path, equivalent to `shape.getTotalLength()`.
555
+ *
556
+ * @param pathInput - The target path string or PathArray
557
+ * @returns The total length of the path
558
+ *
559
+ * @example
560
+ * ```ts
561
+ * getTotalLength('M0 0L100 0L100 100L0 100Z')
562
+ * // => 300
563
+ * ```
564
+ */
565
+ declare const getTotalLength: <T extends PathArray>(pathInput: string | T) => number;
566
+ //#endregion
567
+ //#region src/util/getClosestPoint.d.ts
568
+ /**
569
+ * Returns the point in path closest to a given point.
570
+ *
571
+ * @param pathInput target `pathArray`
572
+ * @param point the given point
573
+ * @returns the best match
574
+ */
575
+ declare const getClosestPoint: (pathInput: string | PathArray, point: {
576
+ x: number;
577
+ y: number;
578
+ }) => {
579
+ x: number;
580
+ y: number;
581
+ };
582
+ //#endregion
583
+ //#region src/util/getDrawDirection.d.ts
584
+ /**
585
+ * Check if a path is drawn clockwise and returns true if so,
586
+ * false otherwise.
587
+ *
588
+ * @param path the path string or `pathArray`
589
+ * @returns true when clockwise or false if not
590
+ */
591
+ declare const getDrawDirection: (path: string | PathArray) => boolean;
592
+ //#endregion
593
+ //#region src/util/getPathArea.d.ts
594
+ /**
595
+ * Returns the signed area of a shape.
596
+ *
597
+ * @author Jürg Lehni & Jonathan Puckey
598
+ *
599
+ * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js
600
+ *
601
+ * @param path - The shape PathArray
602
+ * @returns The signed area of the shape (positive for clockwise, negative for counter-clockwise)
603
+ *
604
+ * @example
605
+ * ```ts
606
+ * getPathArea([['M', 0, 0], ['L', 100, 0], ['L', 100, 100], ['L', 0, 100], ['Z']])
607
+ * // => -10000 (counter-clockwise square)
608
+ * ```
609
+ */
610
+ declare const getPathArea: <T extends PathArray | string>(path: T) => number;
611
+ //#endregion
612
+ //#region src/util/getPointAtLength.d.ts
613
+ /**
614
+ * Returns [x,y] coordinates of a point at a given length along a path.
615
+ *
616
+ * @param pathInput - The PathArray or path string to look into
617
+ * @param distance - The distance along the path
618
+ * @returns The requested {x, y} point coordinates
619
+ *
620
+ * @example
621
+ * ```ts
622
+ * getPointAtLength('M0 0L100 0L100 100Z', 50)
623
+ * // => { x: 50, y: 0 }
624
+ * ```
625
+ */
626
+ declare const getPointAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => {
627
+ x: number;
628
+ y: number;
629
+ };
630
+ //#endregion
631
+ //#region src/util/getPropertiesAtLength.d.ts
632
+ /**
633
+ * Returns the segment, its index and length as well as
634
+ * the length to that segment at a given length in a path.
635
+ *
636
+ * @param pathInput target `pathArray`
637
+ * @param distance the given length
638
+ * @returns the requested properties
639
+ */
640
+ declare const getPropertiesAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => SegmentProperties;
641
+ //#endregion
642
+ //#region src/util/getPropertiesAtPoint.d.ts
643
+ /**
644
+ * Returns the point and segment in path closest to a given point as well as
645
+ * the distance to the path stroke.
646
+ *
647
+ * @see https://bl.ocks.org/mbostock/8027637
648
+ *
649
+ * @param pathInput target `pathArray`
650
+ * @param point the given point
651
+ * @returns the requested properties
652
+ */
653
+ declare const getPropertiesAtPoint: <T extends PathArray>(pathInput: string | T, point: Point) => PointProperties;
654
+ //#endregion
655
+ //#region src/util/getSegmentAtLength.d.ts
656
+ /**
657
+ * Returns the segment at a given length.
658
+ *
659
+ * @param pathInput the target `pathArray`
660
+ * @param distance the distance in path to look at
661
+ * @returns the requested segment
662
+ */
663
+ declare const getSegmentAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => PathSegment | undefined;
664
+ //#endregion
665
+ //#region src/util/getSegmentOfPoint.d.ts
666
+ /**
667
+ * Returns the path segment which contains a given point.
668
+ *
669
+ * @param path the `pathArray` to look into
670
+ * @param point the point of the shape to look for
671
+ * @returns the requested segment
672
+ */
673
+ declare const getSegmentOfPoint: <T extends PathArray>(path: string | T, point: {
674
+ x: number;
675
+ y: number;
676
+ }) => SegmentProperties | undefined;
677
+ //#endregion
678
+ //#region src/util/isAbsoluteArray.d.ts
679
+ /**
680
+ * Iterates an array to check if it's a `pathArray`
681
+ * with all absolute values.
682
+ *
683
+ * @param path the `pathArray` to be checked
684
+ * @returns iteration result
685
+ */
686
+ declare const isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
687
+ //#endregion
688
+ //#region src/util/isPolygonArray.d.ts
689
+ /**
690
+ * Checks if a path is a polygon (only M, L, H, V, Z commands).
691
+ * @param pathArray PathArray (pre-normalize if needed)
692
+ * @returns boolean
693
+ */
694
+ declare const isPolygonArray: (path: PathArray) => path is PolygonArray;
695
+ //#endregion
696
+ //#region src/util/isCurveArray.d.ts
697
+ /**
698
+ * Iterates an array to check if it's a `pathArray`
699
+ * with all C (cubic bezier) segments.
700
+ *
701
+ * @param path the `Array` to be checked
702
+ * @returns iteration result
703
+ */
704
+ declare const isCurveArray: (path: unknown) => path is CurveArray;
705
+ //#endregion
706
+ //#region src/util/isNormalizedArray.d.ts
707
+ /**
708
+ * Iterates an array to check if it's a `pathArray`
709
+ * with all segments in non-shorthand notation
710
+ * with absolute values.
711
+ *
712
+ * @param path - the array to be checked
713
+ * @returns true if the array is a normalized path array
714
+ */
715
+ declare const isNormalizedArray: (path: unknown) => path is NormalArray;
716
+ //#endregion
717
+ //#region src/util/isPathArray.d.ts
718
+ /**
719
+ * Iterates an array to check if it's an actual `pathArray`.
720
+ *
721
+ * @param path the `pathArray` to be checked
722
+ * @returns iteration result
723
+ */
724
+ declare const isPathArray: (path: unknown) => path is PathArray;
725
+ //#endregion
726
+ //#region src/util/isPointInStroke.d.ts
727
+ /**
728
+ * Checks if a given point is in the stroke of a path.
729
+ *
730
+ * @param pathInput target path
731
+ * @param point the given `{x,y}` point
732
+ * @returns the query result
733
+ */
734
+ declare const isPointInStroke: <T extends PathArray>(pathInput: string | T, point: {
735
+ x: number;
736
+ y: number;
737
+ }) => boolean;
738
+ //#endregion
739
+ //#region src/util/isRelativeArray.d.ts
740
+ /**
741
+ * Iterates an array to check if it's a `pathArray`
742
+ * with relative values.
743
+ *
744
+ * @param path the `pathArray` to be checked
745
+ * @returns iteration result
746
+ */
747
+ declare const isRelativeArray: (path: unknown) => path is RelativeArray;
748
+ //#endregion
749
+ //#region src/util/isValidPath.d.ts
750
+ /**
751
+ * Parses a path string value to determine its validity
752
+ * then returns true if it's valid or false otherwise.
753
+ *
754
+ * @param pathString the path string to be parsed
755
+ * @returns the path string validity
756
+ */
757
+ declare const isValidPath: (pathString: string) => boolean;
758
+ //#endregion
299
759
  //#region src/morph/samplePolygon.d.ts
300
760
  /**
301
761
  * Samples points from a path to form a polygon approximation.
@@ -308,6 +768,60 @@ declare class PathParser {
308
768
  */
309
769
  declare function samplePolygon<T extends NormalArray>(path: T): PointTuple[];
310
770
  //#endregion
771
+ //#region src/util/shapeToPath.d.ts
772
+ /**
773
+ * Returns a new `<path>` element created from attributes of a `<line>`, `<polyline>`,
774
+ * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>` or `<glyph>`. If `replace` parameter
775
+ * is `true`, it will replace the target. The default `ownerDocument` is your current
776
+ * `document` browser page, if you want to use in server-side using `jsdom`, you can
777
+ * pass the `jsdom` `document` to `ownDocument`.
778
+ *
779
+ * It can also work with an options object, see the type below
780
+ * @see ShapeOps
781
+ *
782
+ * The newly created `<path>` element keeps all non-specific
783
+ * attributes like `class`, `fill`, etc.
784
+ *
785
+ * @param element - Target shape element or shape options object
786
+ * @param replace - Option to replace target element
787
+ * @param ownerDocument - Document for creating the element
788
+ * @returns The newly created `<path>` element, or false if the path is invalid
789
+ *
790
+ * @example
791
+ * ```ts
792
+ * const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle')
793
+ * circle.setAttribute('cx', '50')
794
+ * circle.setAttribute('cy', '50')
795
+ * circle.setAttribute('r', '25')
796
+ * const path = shapeToPath(circle)
797
+ * path.getAttribute('d')
798
+ * // => 'M50 25A25 25 0 1 1 50 75A25 25 0 1 1 50 25Z'
799
+ * ```
800
+ */
801
+ declare const shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
802
+ //#endregion
803
+ //#region src/util/shapeToPathArray.d.ts
804
+ /**
805
+ * Returns a new `pathArray` created from attributes of a `<line>`, `<polyline>`,
806
+ * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>`, <path> or `<glyph>`.
807
+ *
808
+ * It can also work with an options object, see the type below
809
+ * @see ShapeOps
810
+ *
811
+ * @param element target shape
812
+ * @returns the newly created `<path>` element
813
+ */
814
+ declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | PathArray;
815
+ //#endregion
816
+ //#region src/util/isMultiPath.d.ts
817
+ /**
818
+ * Determines if an SVG path contains multiple subpaths.
819
+ * Accepts path string or PathArray.
820
+ * @param path - 'M10,10 L20,20 Z M30,30 L40,40' → true
821
+ * @returns boolean
822
+ */
823
+ declare const isMultiPath: <T extends PathArray>(path: string | T) => boolean;
824
+ //#endregion
311
825
  //#region src/util/isPolylineArray.d.ts
312
826
  /**
313
827
  * Checks if a path is a polyline (only M, L, H, V commands).
@@ -316,6 +830,314 @@ declare function samplePolygon<T extends NormalArray>(path: T): PointTuple[];
316
830
  */
317
831
  declare function isPolylineArray(path: PathArray): path is PolylineArray;
318
832
  //#endregion
833
+ //#region src/util/isClosedPath.d.ts
834
+ /**
835
+ * Check if a PathArray is closed, which means its last segment is a Z.
836
+ * @param path
837
+ * @returns true if the path is closed
838
+ */
839
+ declare const isClosedPath: <T extends PathArray>(path: T) => boolean;
840
+ //#endregion
841
+ //#region src/process/normalizePath.d.ts
842
+ /**
843
+ * Parses a path string or PathArray, then iterates the result for:
844
+ * * converting segments to absolute values
845
+ * * converting shorthand commands to their non-shorthand notation
846
+ *
847
+ * @param pathInput - The path string or PathArray
848
+ * @returns The normalized PathArray
849
+ *
850
+ * @example
851
+ * ```ts
852
+ * normalizePath('M10 90s20 -80 40 -80s20 80 40 80')
853
+ * // => [['M', 10, 90], ['C', 30, 90, 25, 10, 50, 10], ['C', 75, 10, 70, 90, 90, 90]]
854
+ * ```
855
+ */
856
+ declare const normalizePath: <T extends string | PathArray>(pathInput: T) => NormalArray;
857
+ //#endregion
858
+ //#region src/process/optimizePath.d.ts
859
+ /**
860
+ * Optimizes a PathArray:
861
+ * * converts segments to shorthand if possible
862
+ * * selects shortest representation from absolute and relative forms
863
+ *
864
+ * @param pathInput - A path string or PathArray
865
+ * @param roundOption - Number of decimal places for rounding
866
+ * @returns The optimized PathArray
867
+ *
868
+ * @example
869
+ * ```ts
870
+ * optimizePath('M10 10L10 10L90 90', 2)
871
+ * // => [['M', 10, 10], ['l', 0, 0], ['l', 80, 80]]
872
+ * ```
873
+ */
874
+ declare const optimizePath: <T extends string | PathArray>(pathInput: T, roundOption?: number) => PathArray;
875
+ //#endregion
876
+ //#region src/process/reversePath.d.ts
877
+ /**
878
+ * Reverses all segments of a PathArray and returns a new PathArray
879
+ * with absolute values.
880
+ *
881
+ * @param pathInput - The source PathArray
882
+ * @returns The reversed PathArray
883
+ *
884
+ * @example
885
+ * ```ts
886
+ * reversePath([['M', 0, 0], ['L', 100, 0], ['L', 100, 100], ['L', 0, 100], ['Z']])
887
+ * // => [['M', 0, 100], ['L', 0, 0], ['L', 100, 0], ['L', 100, 100], ['Z']]
888
+ * ```
889
+ */
890
+ declare const reversePath: <T extends PathArray>(pathInput: T) => T;
891
+ //#endregion
892
+ //#region src/process/splitPath.d.ts
893
+ /**
894
+ * Split a path string or PathArray into an array of sub-paths.
895
+ *
896
+ * In the process, values are converted to absolute
897
+ * for visual consistency.
898
+ *
899
+ * @param pathInput - The source path string or PathArray
900
+ * @returns An array of sub-path PathArrays
901
+ *
902
+ * @example
903
+ * ```ts
904
+ * splitPath('M0 0L100 0ZM200 0L300 0Z')
905
+ * // => [
906
+ * // [['M', 0, 0], ['L', 100, 0], ['Z']],
907
+ * // [['M', 200, 0], ['L', 300, 0], ['Z']]
908
+ * // ]
909
+ * ```
910
+ */
911
+ declare const splitPath: <T extends PathArray>(pathInput: T | string) => T[];
912
+ //#endregion
913
+ //#region src/process/transformPath.d.ts
914
+ /**
915
+ * Apply a 2D / 3D transformation to a PathArray.
916
+ *
917
+ * Since SVGElement doesn't support 3D transformation, this function
918
+ * creates a 2D projection of the path element.
919
+ *
920
+ * @param pathInput - The PathArray or path string to transform
921
+ * @param transform - The transform functions object (translate, rotate, skew, scale, origin)
922
+ * @returns The transformed PathArray
923
+ *
924
+ * @example
925
+ * ```ts
926
+ * transformPath('M0 0L100 0L100 100L0 100Z', { translate: [10, 20], scale: 2 })
927
+ * // => [['M', 10, 20], ['L', 210, 20], ['L', 210, 220], ['L', 10, 220], ['Z']]
928
+ * ```
929
+ */
930
+ declare const transformPath: <T extends PathArray>(pathInput: T | string, transform?: Partial<TransformObject>) => T | AbsoluteArray;
931
+ //#endregion
932
+ //#region src/process/absolutizeSegment.d.ts
933
+ /**
934
+ * Returns an absolute segment of a `PathArray` object.
935
+ *
936
+ * @param segment the segment object
937
+ * @param index the segment index
938
+ * @param lastX the last known X value
939
+ * @param lastY the last known Y value
940
+ * @returns the absolute segment
941
+ */
942
+ declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
943
+ //#endregion
944
+ //#region src/process/arcToCubic.d.ts
945
+ /**
946
+ * Converts A (arc-to) segments to C (cubic-bezier-to).
947
+ *
948
+ * For more information of where this math came from visit:
949
+ * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
950
+ *
951
+ * @param X1 the starting x position
952
+ * @param Y1 the starting y position
953
+ * @param RX x-radius of the arc
954
+ * @param RY y-radius of the arc
955
+ * @param angle x-axis-rotation of the arc
956
+ * @param LAF large-arc-flag of the arc
957
+ * @param SF sweep-flag of the arc
958
+ * @param X2 the ending x position
959
+ * @param Y2 the ending y position
960
+ * @param recursive the parameters needed to split arc into 2 segments
961
+ * @returns the resulting cubic-bezier segment(s)
962
+ */
963
+ 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[];
964
+ //#endregion
965
+ //#region src/process/getSVGMatrix.d.ts
966
+ /**
967
+ * Returns a transformation matrix to apply to `<path>` elements.
968
+ *
969
+ * @see TransformObjectValues
970
+ *
971
+ * @param transform the `transformObject`
972
+ * @returns a new transformation matrix
973
+ */
974
+ declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
975
+ //#endregion
976
+ //#region src/process/iterate.d.ts
977
+ /**
978
+ * Iterates over a `PathArray`, executing a callback for each segment.
979
+ * The callback can:
980
+ * - Read current position (`x`, `y`)
981
+ * - Modify the segment (return new segment)
982
+ * - Stop early (return `false`)
983
+ *
984
+ * The iterator maintains accurate current point (`x`, `y`) and subpath start (`mx`, `my`)
985
+ * while correctly handling relative/absolute commands, including H/V and Z.
986
+ *
987
+ * **Important**: If the callback returns a new segment with more coordinates (e.g., Q → C),
988
+ * the path length may increase, and iteration will continue over new segments.
989
+ *
990
+ * @template T - Specific PathArray type (e.g., CurveArray, PolylineArray)
991
+ * @param path - The source `PathArray` to iterate over
992
+ * @param iterator - Callback function for each segment
993
+ * @param iterator.segment - Current path segment
994
+ * @param iterator.index - Index of current segment
995
+ * @param iterator.x - Current X position (after applying relative offset)
996
+ * @param iterator.y - Current Y position (after applying relative offset)
997
+ * @returns The modified `path` (or original if no changes)
998
+ *
999
+ * @example
1000
+ * iterate(path, (seg, i, x, y) => {
1001
+ * if (seg[0] === 'L') return ['C', x, y, seg[1], seg[2], seg[1], seg[2]];
1002
+ * });
1003
+ */
1004
+ declare const iterate: <T extends PathArray>(path: T, iterator: IteratorCallback<T>) => T;
1005
+ //#endregion
1006
+ //#region src/process/lineToCubic.d.ts
1007
+ /**
1008
+ * Converts an L (line-to) segment to C (cubic-bezier).
1009
+ *
1010
+ * @param x1 line start x
1011
+ * @param y1 line start y
1012
+ * @param x2 line end x
1013
+ * @param y2 line end y
1014
+ * @returns the cubic-bezier segment
1015
+ */
1016
+ declare const lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[];
1017
+ //#endregion
1018
+ //#region src/process/normalizeSegment.d.ts
1019
+ /**
1020
+ * Normalizes a single segment of a `pathArray` object.
1021
+ *
1022
+ * @param segment the segment object
1023
+ * @param params the normalization parameters
1024
+ * @returns the normalized segment
1025
+ */
1026
+ declare const normalizeSegment: (segment: PathSegment, params: ParserParams) => NormalSegment;
1027
+ //#endregion
1028
+ //#region src/process/projection2d.d.ts
1029
+ /**
1030
+ * Returns the [x,y] projected coordinates for a given an [x,y] point
1031
+ * and an [x,y,z] perspective origin point.
1032
+ *
1033
+ * Equation found here =>
1034
+ * http://en.wikipedia.org/wiki/3D_projection#Diagram
1035
+ * Details =>
1036
+ * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel
1037
+ *
1038
+ * @param m the transformation matrix
1039
+ * @param point2D the initial [x,y] coordinates
1040
+ * @param origin the [x,y,z] transform origin
1041
+ * @returns the projected [x,y] coordinates
1042
+ */
1043
+ declare const projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
1044
+ //#endregion
1045
+ //#region src/process/quadToCubic.d.ts
1046
+ /**
1047
+ * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).
1048
+ *
1049
+ * @param x1 curve start x
1050
+ * @param y1 curve start y
1051
+ * @param qx control point x
1052
+ * @param qy control point y
1053
+ * @param x2 curve end x
1054
+ * @param y2 curve end y
1055
+ * @returns the cubic-bezier segment
1056
+ */
1057
+ declare const quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
1058
+ //#endregion
1059
+ //#region src/process/relativizeSegment.d.ts
1060
+ /**
1061
+ * Returns a relative segment of a `PathArray` object.
1062
+ *
1063
+ * @param segment the segment object
1064
+ * @param index the segment index
1065
+ * @param lastX the last known X value
1066
+ * @param lastY the last known Y value
1067
+ * @returns the relative segment
1068
+ */
1069
+ declare const relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
1070
+ //#endregion
1071
+ //#region src/process/reverseCurve.d.ts
1072
+ /**
1073
+ * Reverses all segments of a `pathArray`
1074
+ * which consists of only C (cubic-bezier) path commands.
1075
+ *
1076
+ * @param path the source `pathArray`
1077
+ * @returns the reversed `pathArray`
1078
+ */
1079
+ declare const reverseCurve: (path: CurveArray) => CurveArray;
1080
+ //#endregion
1081
+ //#region src/process/roundPath.d.ts
1082
+ /**
1083
+ * Rounds the values of a `pathArray` instance to
1084
+ * a specified amount of decimals and returns it.
1085
+ *
1086
+ * @param path the source `pathArray`
1087
+ * @param roundOption the amount of decimals to round numbers to
1088
+ * @returns the resulted `pathArray` with rounded values
1089
+ */
1090
+ declare const roundPath: <T extends PathArray>(path: T, roundOption?: number | "off") => T;
1091
+ //#endregion
1092
+ //#region src/process/roundSegment.d.ts
1093
+ /**
1094
+ * Rounds the numeric values of a path segment to the specified precision.
1095
+ *
1096
+ * @param segment - The path segment to round
1097
+ * @param roundOption - Number of decimal places
1098
+ * @returns The rounded segment
1099
+ */
1100
+ declare const roundSegment: <T extends PathSegment>(segment: T, roundOption: number) => T;
1101
+ //#endregion
1102
+ //#region src/process/segmentToCubic.d.ts
1103
+ /**
1104
+ * Converts any segment to C (cubic-bezier).
1105
+ *
1106
+ * @param segment the source segment
1107
+ * @param params the source segment parameters
1108
+ * @returns the cubic-bezier segment
1109
+ */
1110
+ declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
1111
+ //#endregion
1112
+ //#region src/process/shortenSegment.d.ts
1113
+ /**
1114
+ * Shorten a single segment of a `pathArray` object.
1115
+ *
1116
+ * @param segment the `absoluteSegment` object
1117
+ * @param normalSegment the `normalSegment` object
1118
+ * @param params the coordinates of the previous segment
1119
+ * @param prevCommand the path command of the previous segment
1120
+ * @returns the shortened segment
1121
+ */
1122
+ declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
1123
+ //#endregion
1124
+ //#region src/morph/fixPath.d.ts
1125
+ /**
1126
+ * Checks a `PathArray` for an unnecessary `Z` segment
1127
+ * and removes it. The `PathArray` is modified in place.
1128
+ * In short, if the segment before `Z` extends to `M`,
1129
+ * the `Z` segment must be removed.
1130
+ *
1131
+ * The `pathInput` must be a single path, without
1132
+ * sub-paths. For multi-path `<path>` elements,
1133
+ * use `splitPath` first and apply this utility on each
1134
+ * sub-path separately.
1135
+ *
1136
+ * @param pathInput the `pathArray` source
1137
+ * @returns void
1138
+ */
1139
+ declare const fixPath: <T extends PathArray>(pathInput: T | string) => void;
1140
+ //#endregion
319
1141
  //#region src/morph/splitCubicSegment.d.ts
320
1142
  /**
321
1143
  * Split a cubic Bézier into two cubics at parameter t [0–1].
@@ -333,6 +1155,81 @@ declare function isPolylineArray(path: PathArray): path is PolylineArray;
333
1155
  */
334
1156
  declare function splitCubicSegment(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, t: number): [CubicCoordinates, CubicCoordinates];
335
1157
  //#endregion
1158
+ //#region src/morph/equalizeSegments.d.ts
1159
+ /**
1160
+ * Equalizes two paths for morphing (single subpath only).
1161
+ *
1162
+ * @see https://minus-ze.ro/posts/morphing-arbitrary-paths-in-svg/
1163
+ * @param path1 - First path string or PathArray
1164
+ * @param path2 - Second path string or PathArray
1165
+ * @param initialCfg - Equalization options
1166
+ * @returns Tuple of two equalized MorphPathArrays
1167
+ *
1168
+ * @example
1169
+ * ```ts
1170
+ * const [eq1, eq2] = equalizeSegments('M0 0L100 0L50 100Z', 'M0 0L100 0L100 100L0 100Z')
1171
+ * // eq1.length === eq2.length
1172
+ * ```
1173
+ */
1174
+ declare const equalizeSegments: (path1: PathArray | string, path2: PathArray | string, initialCfg?: EqualizationOptions) => [MorphPathArray, MorphPathArray];
1175
+ //#endregion
1176
+ //#region src/morph/equalizePaths.d.ts
1177
+ /**
1178
+ * Equalizes two paths for morphing (single/multi subpath).
1179
+ *
1180
+ * @see https://minus-ze.ro/posts/morphing-arbitrary-paths-in-svg/
1181
+ * @param pathInput1 - First path string or PathArray
1182
+ * @param pathInput2 - Second path string or PathArray
1183
+ * @param initialCfg - Configuration options for equalization
1184
+ * @returns Tuple of two equalized MorphPathArrays
1185
+ *
1186
+ * @example
1187
+ * ```ts
1188
+ * const [eq1, eq2] = equalizePaths('M0 0L100 0L50 100Z', 'M0 0L100 0L100 100L0 100Z')
1189
+ * // eq1.length === eq2.length — ready for morphing
1190
+ * ```
1191
+ */
1192
+ declare const equalizePaths: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: {}) => [MorphPathArray, MorphPathArray];
1193
+ //#endregion
1194
+ //#region src/intersect/pathIntersection.d.ts
1195
+ /**
1196
+ * Finds intersection points between two paths.
1197
+ *
1198
+ * @param pathInput1 - First path string or PathArray
1199
+ * @param pathInput2 - Second path string or PathArray
1200
+ * @param justCount - If true, returns the count of intersections; if false, returns the intersection points
1201
+ * @returns The number of intersections (when justCount is true) or an array of IntersectionPoint objects
1202
+ *
1203
+ * @example
1204
+ * ```ts
1205
+ * pathsIntersection('M0 50C0 0,100 0,100 50', 'M50 0C100 0,100 100,50 100', true)
1206
+ * // => 1
1207
+ * pathsIntersection('M0 50C0 0,100 0,100 50', 'M50 0C100 0,100 100,50 100', false)
1208
+ * // => [{ x: 50, y: 25, t1: 0.5, t2: 0.5 }]
1209
+ * ```
1210
+ */
1211
+ declare const pathsIntersection: <T extends string | PathArray>(pathInput1: T, pathInput2: T, justCount?: boolean) => number | IntersectionPoint[];
1212
+ //#endregion
1213
+ //#region src/intersect/boundingBoxIntersect.d.ts
1214
+ /**
1215
+ * Checks if two bounding boxes intersect.
1216
+ *
1217
+ * @param a - First bounding box as [minX, minY, maxX, maxY]
1218
+ * @param b - Second bounding box as [minX, minY, maxX, maxY]
1219
+ * @returns True if the bounding boxes overlap
1220
+ */
1221
+ declare const boundingBoxIntersect: (a: BBoxMaxima, b: BBoxMaxima) => boolean;
1222
+ //#endregion
1223
+ //#region src/intersect/isPointInsideBBox.d.ts
1224
+ /**
1225
+ * Checks if a point is inside a bounding box.
1226
+ *
1227
+ * @param bbox - The bounding box as [minX, minY, maxX, maxY]
1228
+ * @param point - The point as [x, y]
1229
+ * @returns True if the point is inside or on the edge of the bounding box
1230
+ */
1231
+ declare const isPointInsideBBox: (bbox: BBoxMaxima, [x, y]: PointTuple) => boolean;
1232
+ //#endregion
336
1233
  //#region src/main.d.ts
337
1234
  /**
338
1235
  * Creates a new SVGPathCommander instance with the following properties:
@@ -543,6 +1440,8 @@ declare class SVGPathCommander {
543
1440
  static arcTools: {
544
1441
  angleBetween: (v0: Point, v1: Point) => number;
545
1442
  arcLength: (rx: number, ry: number, theta: number) => number;
1443
+ arcLengthAtAngle: (rx: number, ry: number, theta: number) => number;
1444
+ arcLengthBetween: (rx: number, ry: number, from: number, to: number) => number;
546
1445
  arcPoint: (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => PointTuple;
547
1446
  getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => [number, number, number, number];
548
1447
  getArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => number;
@@ -563,12 +1462,16 @@ declare class SVGPathCommander {
563
1462
  };
564
1463
  static bezierTools: {
565
1464
  bezierLength: (derivativeFn: DeriveCallback) => number;
1465
+ bezierLengthAtT: (derivativeFn: DeriveCallback, t: number) => number;
566
1466
  calculateBezier: (derivativeFn: DeriveCallback, t: number) => number;
567
1467
  CBEZIER_MINMAX_EPSILON: number;
568
1468
  computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint;
569
1469
  Cvalues: number[];
570
1470
  deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPoints | DerivedCubicPoints)[];
571
1471
  getBezierLength: (curve: CubicCoordinates | QuadCoordinates) => number;
1472
+ getBezierLengthAtT: (curve: CubicCoordinates | QuadCoordinates, t: number) => number;
1473
+ getBezierPoints: (curve: CubicCoordinates | QuadCoordinates) => CubicPoints | QuadPoints;
1474
+ getTAtBezierLength: (curve: CubicCoordinates | QuadCoordinates, distance: number) => number;
572
1475
  minmaxC: ([v1, cp1, cp2, v2]: [number, number, number, number]) => PointTuple;
573
1476
  minmaxQ: ([v1, cp, v2]: [number, number, number]) => PointTuple;
574
1477
  Tvalues: number[];
@@ -610,26 +1513,23 @@ declare class SVGPathCommander {
610
1513
  getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => [number, number, number, number];
611
1514
  getQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => number;
612
1515
  };
613
- static pathToAbsolute: <T extends PathArray>(pathInput: string | T) => AbsoluteArray;
614
- static pathToRelative: <T extends PathArray>(pathInput: string | T) => RelativeArray;
615
- static pathToCurve: <T extends PathArray>(pathInput: string | T) => CurveArray;
616
- static pathToString: <T extends PathArray>(path: T, roundOption?: number | "off") => string;
617
- static distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
618
- static midPoint: ([ax, ay]: PointTuple, [bx, by]: PointTuple, t: number) => PointTuple;
619
- static rotateVector: (x: number, y: number, rad: number) => {
620
- x: number;
621
- y: number;
622
- };
623
- static roundTo: (n: number, round: number) => number;
624
- static parsePathString: <T extends PathArray>(pathInput: string | T) => PathArray;
625
- static finalizeSegment: (path: PathParser) => void;
1516
+ static pathToAbsolute: typeof pathToAbsolute;
1517
+ static pathToRelative: typeof pathToRelative;
1518
+ static pathToCurve: typeof pathToCurve;
1519
+ static pathToString: typeof pathToString;
1520
+ static distanceSquareRoot: typeof distanceSquareRoot;
1521
+ static midPoint: typeof midPoint;
1522
+ static rotateVector: typeof rotateVector;
1523
+ static roundTo: typeof roundTo;
1524
+ static parsePathString: typeof parsePathString;
1525
+ static finalizeSegment: typeof finalizeSegment;
626
1526
  static invalidPathValue: string;
627
- static isArcCommand: (code: number) => code is 97;
628
- static isDigit: (code: number) => code is DigitNumber;
629
- static isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46;
630
- static isMoveCommand: (code: number) => code is 109 | 77;
631
- static isPathCommand: (code: number) => code is PathCommandNumber;
632
- static isSpace: (ch: number) => ch is SpaceNumber;
1527
+ static isArcCommand: typeof isArcCommand;
1528
+ static isDigit: typeof isDigit;
1529
+ static isDigitStart: typeof isDigitStart;
1530
+ static isMoveCommand: typeof isMoveCommand;
1531
+ static isPathCommand: typeof isPathCommand;
1532
+ static isSpace: typeof isSpace;
633
1533
  static paramsCount: {
634
1534
  a: number;
635
1535
  c: number;
@@ -645,86 +1545,61 @@ declare class SVGPathCommander {
645
1545
  };
646
1546
  static paramsParser: ParserParams;
647
1547
  static PathParser: typeof PathParser;
648
- static scanFlag: (path: PathParser) => void;
649
- static scanParam: (path: PathParser) => void;
650
- static scanSegment: (path: PathParser) => void;
651
- static skipSpaces: (path: PathParser) => void;
1548
+ static scanFlag: typeof scanFlag;
1549
+ static scanParam: typeof scanParam;
1550
+ static scanSegment: typeof scanSegment;
1551
+ static skipSpaces: typeof skipSpaces;
652
1552
  static distanceEpsilon: number;
653
- static fixPath: <T extends PathArray>(pathInput: T | string) => void;
654
- static getClosestPoint: (pathInput: string | PathArray, point: {
655
- x: number;
656
- y: number;
657
- }) => {
658
- x: number;
659
- y: number;
660
- };
661
- static getDrawDirection: (path: string | PathArray) => boolean;
662
- static getPathArea: <T extends PathArray>(path: T) => number;
663
- static getPathBBox: <T extends PathArray>(pathInput: T | string) => {
664
- x: number;
665
- y: number;
666
- width: number;
667
- height: number;
668
- x2: number;
669
- y2: number;
670
- cx: number;
671
- cy: number;
672
- cz: number;
673
- };
674
- static getPointAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => {
675
- x: number;
676
- y: number;
677
- };
678
- static getPropertiesAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => SegmentProperties;
679
- static getPropertiesAtPoint: <T extends PathArray>(pathInput: string | T, point: Point) => PointProperties;
680
- static getSegmentAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => PathSegment | undefined;
681
- static getSegmentOfPoint: <T extends PathArray>(path: string | T, point: {
682
- x: number;
683
- y: number;
684
- }) => SegmentProperties | undefined;
685
- static getTotalLength: <T extends PathArray>(pathInput: string | T) => number;
686
- static isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
687
- static isCurveArray: (path: unknown) => path is CurveArray;
688
- static isPolygonArray: (path: PathArray) => path is PolygonArray;
689
- static isNormalizedArray: (path: unknown) => path is NormalArray;
690
- static isPathArray: (path: unknown) => path is PathArray;
691
- static isPointInStroke: <T extends PathArray>(pathInput: string | T, point: {
692
- x: number;
693
- y: number;
694
- }) => boolean;
695
- static isRelativeArray: (path: unknown) => path is RelativeArray;
696
- static isValidPath: (pathString: string) => boolean;
1553
+ static fixPath: typeof fixPath;
1554
+ static getClosestPoint: typeof getClosestPoint;
1555
+ static getDrawDirection: typeof getDrawDirection;
1556
+ static getPathArea: typeof getPathArea;
1557
+ static getPathBBox: typeof getPathBBox;
1558
+ static getPointAtLength: typeof getPointAtLength;
1559
+ static getPropertiesAtLength: typeof getPropertiesAtLength;
1560
+ static getPropertiesAtPoint: typeof getPropertiesAtPoint;
1561
+ static getSegmentAtLength: typeof getSegmentAtLength;
1562
+ static getSegmentOfPoint: typeof getSegmentOfPoint;
1563
+ static getTotalLength: typeof getTotalLength;
1564
+ static isAbsoluteArray: typeof isAbsoluteArray;
1565
+ static isCurveArray: typeof isCurveArray;
1566
+ static isPolygonArray: typeof isPolygonArray;
1567
+ static isNormalizedArray: typeof isNormalizedArray;
1568
+ static isPathArray: typeof isPathArray;
1569
+ static isPointInStroke: typeof isPointInStroke;
1570
+ static isRelativeArray: typeof isRelativeArray;
1571
+ static isValidPath: typeof isValidPath;
697
1572
  static samplePolygon: typeof samplePolygon;
698
1573
  static shapeParams: ShapeParams;
699
- static shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
700
- static shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | PathArray;
701
- static absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
702
- static 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[];
703
- static getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
704
- static iterate: <T extends PathArray>(path: T, iterator: IteratorCallback<T>) => T;
705
- static lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[];
706
- static normalizePath: (pathInput: string | PathArray) => NormalArray;
707
- static normalizeSegment: (segment: PathSegment, params: ParserParams) => NormalSegment;
708
- static optimizePath: <T extends PathArray>(pathInput: T, roundOption?: number) => PathArray;
709
- static projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
710
- static quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
711
- static relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
712
- static reverseCurve: (path: CurveArray) => CurveArray;
713
- static reversePath: <T extends PathArray>(pathInput: T) => T;
714
- static roundPath: <T extends PathArray>(path: T, roundOption?: number | "off") => T;
715
- static roundSegment: <T extends PathSegment>(segment: T, roundOption: number) => T;
716
- static segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
717
- static shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
718
- static splitPath: <T extends PathArray>(pathInput: T | string) => T[];
719
- static equalizePaths: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: {}) => [MorphPathArray, MorphPathArray];
720
- static equalizeSegments: (path1: PathArray | string, path2: PathArray | string, initialCfg?: EqualizationOptions) => [MorphPathArray, MorphPathArray];
1574
+ static shapeToPath: typeof shapeToPath;
1575
+ static shapeToPathArray: typeof shapeToPathArray;
1576
+ static absolutizeSegment: typeof absolutizeSegment;
1577
+ static arcToCubic: typeof arcToCubic;
1578
+ static getSVGMatrix: typeof getSVGMatrix;
1579
+ static iterate: typeof iterate;
1580
+ static lineToCubic: typeof lineToCubic;
1581
+ static normalizePath: typeof normalizePath;
1582
+ static normalizeSegment: typeof normalizeSegment;
1583
+ static optimizePath: typeof optimizePath;
1584
+ static projection2d: typeof projection2d;
1585
+ static quadToCubic: typeof quadToCubic;
1586
+ static relativizeSegment: typeof relativizeSegment;
1587
+ static reverseCurve: typeof reverseCurve;
1588
+ static reversePath: typeof reversePath;
1589
+ static roundPath: typeof roundPath;
1590
+ static roundSegment: typeof roundSegment;
1591
+ static segmentToCubic: typeof segmentToCubic;
1592
+ static shortenSegment: typeof shortenSegment;
1593
+ static splitPath: typeof splitPath;
1594
+ static equalizePaths: typeof equalizePaths;
1595
+ static equalizeSegments: typeof equalizeSegments;
721
1596
  static splitCubicSegment: typeof splitCubicSegment;
722
- static transformPath: <T extends PathArray>(pathInput: T | string, transform?: Partial<TransformObject>) => T | AbsoluteArray;
723
- static isPointInsideBBox: (bbox: BBoxMaxima, [x, y]: PointTuple) => boolean;
724
- static pathsIntersection: <T extends string | PathArray>(pathInput1: T, pathInput2: T, justCount?: boolean) => number | IntersectionPoint[];
725
- static boundingBoxIntersect: (a: BBoxMaxima, b: BBoxMaxima) => boolean;
726
- static isMultiPath: <T extends PathArray>(path: string | T) => boolean;
727
- static isClosedPath: <T extends PathArray>(path: T) => boolean;
1597
+ static transformPath: typeof transformPath;
1598
+ static isPointInsideBBox: typeof isPointInsideBBox;
1599
+ static pathsIntersection: typeof pathsIntersection;
1600
+ static boundingBoxIntersect: typeof boundingBoxIntersect;
1601
+ static isMultiPath: typeof isMultiPath;
1602
+ static isClosedPath: typeof isClosedPath;
728
1603
  static isPolylineArray: typeof isPolylineArray;
729
1604
  static version: string;
730
1605
  }