svg-path-commander 2.3.5 → 2.4.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.
package/dist/util.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SVGPathCommander UTIL v2.3.5 (http://thednp.github.io/svg-path-commander)
2
+ * SVGPathCommander UTIL v2.4.0 (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
  */
@@ -14,6 +14,54 @@ type SegmentProperties = {
14
14
  length: number;
15
15
  /** The distance from the start of the path to the end of the segment. */
16
16
  lengthAtSegment: number;
17
+ /** The point at the given length. */
18
+ point: Point;
19
+ /** The unit tangent vector at the given length. */
20
+ tangent: Point;
21
+ /** The unit normal vector at the given length, the left normal of the tangent. */
22
+ normal: Point;
23
+ /** The angle of the tangent at the given length, in degrees. */
24
+ angle: number;
25
+ };
26
+ /** The options of the path simplification. */
27
+ type SimplifyOptions = {
28
+ /** The target geometric error of the sampled fitting. @default 1 */
29
+ tolerance?: number;
30
+ };
31
+ /** The side of a path an offset is created on. */
32
+ type OffsetSide = "left" | "right" | "both";
33
+ /** The join type used at a corner of an offset path. */
34
+ type OffsetJoin = "round" | "miter" | "bevel";
35
+ /** The cap type used at the end of an open offset path. */
36
+ type OffsetCap = "butt" | "square" | "round";
37
+ /** The options of the path offsetting. */
38
+ type OffsetOptions = {
39
+ /** The side of the path to offset, the left normal of the direction of travel. @default "left" */
40
+ side?: OffsetSide;
41
+ /** The join type at a corner of the path. @default "miter" */
42
+ join?: OffsetJoin;
43
+ /** The ratio of the miter length to the offset distance. @default 4 */
44
+ miterLimit?: number;
45
+ /** The cap type at the end of an open path. @default "butt" */
46
+ cap?: OffsetCap;
47
+ /** The number of the intervals a curve is sampled with. @default 16 */
48
+ steps?: number;
49
+ /** The number of the decimals of the result. @default 4 */
50
+ precision?: number;
51
+ };
52
+ /** The rule that decides if a point is inside a path. */
53
+ type FillRule = "nonzero" | "evenodd";
54
+ /** The options of the point in path test. */
55
+ type PointInPathOptions = {
56
+ /** The fill rule of the path, the SVG `fill-rule` attribute. @default "nonzero" */
57
+ fillRule?: FillRule;
58
+ /** The maximum distance between the path and its polygon approximation. @default 0.1 */
59
+ tolerance?: number;
60
+ };
61
+ /** The options of the point in stroke test. */
62
+ type StrokeOptions = {
63
+ /** The width of the stroke, the band painted around the path. @default 0 */
64
+ width?: number;
17
65
  };
18
66
  /** The closest point on the path to a given point, with the distance and optional segment. */
19
67
  type PointProperties = {
@@ -306,11 +354,6 @@ type MorphPathArray = PolygonArray | PolylineArray | CurveArray | ClosedCurveArr
306
354
  type ShapeTypes = SVGPolylineElement | SVGPolygonElement | SVGLineElement | SVGEllipseElement | SVGCircleElement | SVGRectElement;
307
355
  /** The shape attributes mapped to each supported SVG element type. */
308
356
  type ShapeOps = LineAttr | PolyAttr | EllipseAttr | CircleAttr | RectAttr | GlyphAttr;
309
- /** A `TransformObject` with a required 3D origin. */
310
- type TransformObjectValues = Partial<TransformObject> & {
311
- /** The transform origin. */
312
- origin: [number, number, number];
313
- };
314
357
  /** A 2D point with `x` and `y` coordinates. */
315
358
  type Point = {
316
359
  /** The X coordinate. */
@@ -357,18 +400,41 @@ type IntersectionPoint = {
357
400
  /** Options for equalizing two paths for morphing. */
358
401
  interface EqualizationOptions {
359
402
  /** The equalization mode. @default "auto" */
360
- mode?: "curve" | "auto";
403
+ mode?: "auto" | "line" | "curve";
404
+ /** The strategy used to place the points of the equalized paths. @default "segment" */
405
+ strategy?: "segment" | "arcLength";
406
+ /** Whether the paths are aligned by rotation. @default true */
407
+ align?: boolean;
361
408
  /** The number of sample points for the line mode. */
362
409
  sampleSize?: number;
363
410
  /** The amount of decimals to round values to. */
364
411
  roundValues?: number;
365
- /** Whether to reverse the second path before equalization. */
366
- reverse?: boolean;
367
- /** Whether to close the path before equalization. */
412
+ /** Whether to reverse the second path before equalization. @default true */
413
+ reverse?: boolean | "auto";
414
+ /** Whether to close the path after equalization. By default, both paths are closed when either input is closed. */
368
415
  close?: boolean;
369
416
  /** The target segment count for both paths. */
370
417
  target?: number;
371
418
  }
419
+ /** The options of the multi-subpath equalization. */
420
+ type PathsEqualizationOptions = EqualizationOptions;
421
+ /** Options for equalizing two paths for morphing with the `equalize` facade. */
422
+ interface EqualizeOptions {
423
+ /** The number of points of the equalized paths. @default "auto" */
424
+ points?: number | "auto";
425
+ /** The strategy used to place the points of the equalized paths. @default "segment" */
426
+ strategy?: "segment" | "arcLength";
427
+ /** Whether the paths are aligned by rotation. @default true */
428
+ align?: boolean;
429
+ /** Whether a path is reversed to match the winding of the other one. @default "auto" */
430
+ reverse?: boolean | "auto";
431
+ /** The equalization mode. @default "auto" */
432
+ mode?: "auto" | "line" | "curve";
433
+ /** The amount of decimals to round values to. @default 4 */
434
+ roundValues?: number;
435
+ /** Whether to close the paths after equalization. By default, both paths are closed when either input is closed. */
436
+ close?: boolean;
437
+ }
372
438
  /**
373
439
  * Returns the signed arc length of an ellipse segment from angle `0` up to
374
440
  * the given `theta` angle, by integrating the curve speed
@@ -886,7 +952,7 @@ export declare const pathToRelative: <T extends PathArray>(pathInput: string | T
886
952
  * @example
887
953
  * ```ts
888
954
  * pathToCurve('M10 50q15 -25 30 0')
889
- * // => [['M', 10, 50], ['C', 25, 25, 40, 50, 40, 50]]
955
+ * // => [['M', 10, 50], ['C', 20, 33.3333, 30, 33.3333, 40, 50]]
890
956
  * ```
891
957
  */
892
958
  export declare const pathToCurve: <T extends PathArray>(pathInput: string | T) => CurveArray;
@@ -911,7 +977,11 @@ export declare const pathToString: <T extends PathArray>(path: T, roundOption?:
911
977
  *
912
978
  * If parameter value is already a `PathArray`,
913
979
  * return a clone of it.
914
-
980
+ *
981
+ * A path must begin with a moveto command, so a path that starts with another
982
+ * command is in error. A leading relative moveto is a pair of absolute
983
+ * coordinates, so it is rewritten as an absolute one.
984
+ *
915
985
  * @example
916
986
  * parsePathString("M 0 0L50 50")
917
987
  * // => [["M",0,0],["L",50,50]]
@@ -1063,12 +1133,12 @@ export declare const getPathBBox: <T extends PathArray>(pathInput: T | string) =
1063
1133
  * Returns the total length of a path, equivalent to `shape.getTotalLength()`.
1064
1134
  *
1065
1135
  * @param pathInput - The target path string or PathArray
1066
- * @returns The total length of the path
1136
+ * @returns the total length of the path
1067
1137
  *
1068
1138
  * @example
1069
1139
  * ```ts
1070
1140
  * getTotalLength('M0 0L100 0L100 100L0 100Z')
1071
- * // => 300
1141
+ * // => 400
1072
1142
  * ```
1073
1143
  */
1074
1144
  export declare const getTotalLength: <T extends PathArray>(pathInput: string | T) => number;
@@ -1109,7 +1179,7 @@ export declare const getDrawDirection: (path: string | PathArray) => boolean;
1109
1179
  * @example
1110
1180
  * ```ts
1111
1181
  * getPathArea([['M', 0, 0], ['L', 100, 0], ['L', 100, 100], ['L', 0, 100], ['Z']])
1112
- * // => -10000 (counter-clockwise square)
1182
+ * // => 10000 (clockwise square)
1113
1183
  * ```
1114
1184
  */
1115
1185
  export declare const getPathArea: <T extends PathArray | string>(path: T) => number;
@@ -1134,6 +1204,10 @@ export declare const getPointAtLength: <T extends PathArray>(pathInput: string |
1134
1204
  * Returns the segment, its index and length as well as
1135
1205
  * the length to that segment at a given length in a path.
1136
1206
  *
1207
+ * The point at the given length is returned with the frame of the path at
1208
+ * that point: the unit tangent vector, the unit normal vector and the angle
1209
+ * of the tangent in degrees.
1210
+ *
1137
1211
  * @param pathInput target `pathArray`
1138
1212
  * @param distance the given length
1139
1213
  * @returns the requested properties
@@ -1204,14 +1278,51 @@ export declare const isPathArray: (path: unknown) => path is PathArray;
1204
1278
  /**
1205
1279
  * Checks if a given point is in the stroke of a path.
1206
1280
  *
1281
+ * Without a width the point has to be on the path itself, within the
1282
+ * distance epsilon of it. With a width the stroke is the band around the
1283
+ * path: the point is in the stroke when it is at most half the width away
1284
+ * from the path. The ends of an open path are treated as if the stroke had
1285
+ * round caps, so a point beyond the end of the path is in the stroke too.
1286
+ *
1207
1287
  * @param pathInput target path
1208
1288
  * @param point the given `{x,y}` point
1289
+ * @param options the options of the test
1209
1290
  * @returns the query result
1291
+ *
1292
+ * @example
1293
+ * ```ts
1294
+ * isPointInStroke('M0 0L100 0', { x: 50, y: 0 });
1295
+ * // => true
1296
+ * isPointInStroke('M0 0L100 0', { x: 50, y: 5 }, { width: 10 });
1297
+ * // => true
1298
+ * ```
1210
1299
  */
1211
- export declare const isPointInStroke: <T extends PathArray>(pathInput: string | T, point: {
1212
- x: number;
1213
- y: number;
1214
- }) => boolean;
1300
+ export declare const isPointInStroke: <T extends PathArray>(pathInput: string | T, point: Point, options?: StrokeOptions) => boolean;
1301
+ /**
1302
+ * Checks if a given point is inside a path.
1303
+ *
1304
+ * The path is flattened into polygons and the point is tested against them
1305
+ * with the fill rule of the path: the `nonzero` rule counts the windings of
1306
+ * the polygons around the point, the `evenodd` rule counts the crossings of
1307
+ * the polygons with a ray from the point. A point on the boundary of the
1308
+ * shape is inside of it, the way the browser answers it.
1309
+ *
1310
+ * The curves of the path are approximated with chords that stay within the
1311
+ * tolerance of the curve, so the answer is exact except for the points that
1312
+ * are within the tolerance of the boundary of a curve.
1313
+ *
1314
+ * @param pathInput target path
1315
+ * @param point the given `{x,y}` point
1316
+ * @param options the options of the test
1317
+ * @returns the query result
1318
+ *
1319
+ * @example
1320
+ * ```ts
1321
+ * isPointInPath('M0 0L100 0L100 100L0 100Z', { x: 50, y: 50 });
1322
+ * // => true
1323
+ * ```
1324
+ */
1325
+ export declare const isPointInPath: <T extends PathArray>(pathInput: string | T, point: Point, options?: PointInPathOptions) => boolean;
1215
1326
  /**
1216
1327
  * Checks if a path is a polygon (only M, L, H, V, Z commands).
1217
1328
  * @param pathArray PathArray (pre-normalize if needed)
@@ -1309,10 +1420,38 @@ export declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false
1309
1420
  * @example
1310
1421
  * ```ts
1311
1422
  * normalizePath('M10 90s20 -80 40 -80s20 80 40 80')
1312
- * // => [['M', 10, 90], ['C', 30, 90, 25, 10, 50, 10], ['C', 75, 10, 70, 90, 90, 90]]
1423
+ * // => [['M', 10, 90], ['C', 10, 90, 30, 10, 50, 10], ['C', 70, 10, 70, 90, 90, 90]]
1313
1424
  * ```
1314
1425
  */
1315
1426
  export declare const normalizePath: <T extends string | PathArray>(pathInput: T) => NormalArray;
1427
+ /**
1428
+ * Offsets a path along its normals.
1429
+ *
1430
+ * The path is sampled along its length, every sample is shifted along the
1431
+ * normal of the path and the result is a path of straight lines. The
1432
+ * corners of the path are joined with the `join` option, and the ends of an
1433
+ * open path are capped with the `cap` option.
1434
+ *
1435
+ * The `side` option is literal: the left side is the left normal of the
1436
+ * direction of travel, the same normal `getPropertiesAtLength()` returns.
1437
+ * The `both` side is the outline of the stroke, the band between the two
1438
+ * sides of the path.
1439
+ *
1440
+ * The offset is not cleaned up: an offset distance larger than the local
1441
+ * radius of curvature of the path produces a self-crossing curve.
1442
+ *
1443
+ * @param pathInput - the path string or `PathArray`
1444
+ * @param distance - the offset distance
1445
+ * @param options - the options of the offset
1446
+ * @returns the offset path
1447
+ *
1448
+ * @example
1449
+ * ```ts
1450
+ * offsetPath('M0 0L100 0', 10)
1451
+ * // => [['M', 0, 10], ['L', 100, 10]]
1452
+ * ```
1453
+ */
1454
+ export declare const offsetPath: <T extends PathArray>(pathInput: string | T, distance: number, options?: OffsetOptions) => PathArray;
1316
1455
  /**
1317
1456
  * Optimizes a PathArray:
1318
1457
  * * converts segments to shorthand if possible
@@ -1325,10 +1464,30 @@ export declare const normalizePath: <T extends string | PathArray>(pathInput: T)
1325
1464
  * @example
1326
1465
  * ```ts
1327
1466
  * optimizePath('M10 10L10 10L90 90', 2)
1328
- * // => [['M', 10, 10], ['l', 0, 0], ['l', 80, 80]]
1467
+ * // => [['M', 10, 10], ['v', 0], ['l', 80, 80]]
1329
1468
  * ```
1330
1469
  */
1331
1470
  export declare const optimizePath: <T extends string | PathArray>(pathInput: T, roundOption?: number) => PathArray;
1471
+ /**
1472
+ * Joins two paths into a single path with two sub-paths.
1473
+ *
1474
+ * Both paths have to be valid paths, so they begin with a moveto command,
1475
+ * and the result holds absolute values.
1476
+ *
1477
+ * @param pathA - the first path string or `PathArray`
1478
+ * @param pathB - the second path string or `PathArray`
1479
+ * @returns the joined path
1480
+ *
1481
+ * @example
1482
+ * ```ts
1483
+ * joinPath('M0 0L100 0', 'M0 100L100 100')
1484
+ * // => [
1485
+ * // ['M', 0, 0], ['L', 100, 0],
1486
+ * // ['M', 0, 100], ['L', 100, 100]
1487
+ * // ]
1488
+ * ```
1489
+ */
1490
+ export declare const joinPath: (pathA: string | PathArray, pathB: string | PathArray) => PathArray;
1332
1491
  /**
1333
1492
  * Reverses all segments of a PathArray and returns a new PathArray
1334
1493
  * with absolute values.
@@ -1343,16 +1502,39 @@ export declare const optimizePath: <T extends string | PathArray>(pathInput: T,
1343
1502
  * @example
1344
1503
  * ```ts
1345
1504
  * reversePath([['M', 0, 0], ['L', 100, 0], ['L', 100, 100], ['L', 0, 100], ['Z']])
1346
- * // => [['M', 0, 100], ['L', 0, 0], ['L', 100, 0], ['L', 100, 100], ['Z']]
1505
+ * // => [['M', 0, 100], ['L', 100, 100], ['L', 100, 0], ['L', 0, 0], ['Z']]
1347
1506
  * ```
1348
1507
  */
1349
1508
  export declare const reversePath: <T extends PathArray>(pathInput: T | string) => T;
1509
+ /**
1510
+ * Reverses the sub-path at a given index of a path.
1511
+ *
1512
+ * The other sub-paths are left untouched, and the result holds absolute
1513
+ * values.
1514
+ *
1515
+ * @param pathInput - the path string or `PathArray`
1516
+ * @param index - the zero-based index of the sub-path to reverse
1517
+ * @returns the path with the sub-path reversed
1518
+ *
1519
+ * @example
1520
+ * ```ts
1521
+ * reverseSubPath('M0 0L100 0ZM0 100L100 100', 1)
1522
+ * // => [
1523
+ * // ['M', 0, 0], ['L', 100, 0], ['Z'],
1524
+ * // ['M', 100, 100], ['L', 0, 100]
1525
+ * // ]
1526
+ * ```
1527
+ */
1528
+ export declare const reverseSubPath: (pathInput: string | PathArray, index: number) => PathArray;
1350
1529
  /**
1351
1530
  * Split a path string or PathArray into an array of sub-paths.
1352
1531
  *
1353
1532
  * In the process, values are converted to absolute
1354
1533
  * for visual consistency.
1355
1534
  *
1535
+ * A path must begin with a moveto command, so a path that does not is
1536
+ * rejected by the parser.
1537
+ *
1356
1538
  * @param pathInput - The source path string or PathArray
1357
1539
  * @returns An array of sub-path PathArrays
1358
1540
  *
@@ -1379,20 +1561,24 @@ export declare const splitPath: <T extends PathArray>(pathInput: T | string) =>
1379
1561
  * @example
1380
1562
  * ```ts
1381
1563
  * transformPath('M0 0L100 0L100 100L0 100Z', { translate: [10, 20], scale: 2 })
1382
- * // => [['M', 10, 20], ['L', 210, 20], ['L', 210, 220], ['L', 10, 220], ['Z']]
1564
+ * // => [['M', 10, 20], ['H', 210], ['V', 220], ['H', 10], ['Z']]
1383
1565
  * ```
1384
1566
  */
1385
1567
  export declare const transformPath: <T extends PathArray>(pathInput: T | string, transform?: Partial<TransformObject>) => T | AbsoluteArray;
1386
1568
  /**
1387
1569
  * Returns an absolute segment of a `PathArray` object.
1388
1570
  *
1571
+ * The current point of a path starts at the origin, so the first segment
1572
+ * of a path is absolutized against `[0, 0]`: a relative moveto at the
1573
+ * start of a path is an absolute one, as the SVG spec requires.
1574
+ *
1389
1575
  * @param segment the segment object
1390
- * @param index the segment index
1576
+ * @param _index the segment index
1391
1577
  * @param lastX the last known X value
1392
1578
  * @param lastY the last known Y value
1393
1579
  * @returns the absolute segment
1394
1580
  */
1395
- export declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
1581
+ export declare const absolutizeSegment: (segment: PathSegment, _index: number, lastX: number, lastY: number) => AbsoluteSegment;
1396
1582
  /**
1397
1583
  * Converts A (arc-to) segments to C (cubic-bezier-to).
1398
1584
  *
@@ -1415,12 +1601,12 @@ export declare const arcToCubic: (X1: number, Y1: number, RX: number, RY: number
1415
1601
  /**
1416
1602
  * Returns a transformation matrix to apply to `<path>` elements.
1417
1603
  *
1418
- * @see TransformObjectValues
1604
+ * @see TransformObject
1419
1605
  *
1420
1606
  * @param transform the `transformObject`
1421
1607
  * @returns a new transformation matrix
1422
1608
  */
1423
- export declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
1609
+ export declare const getSVGMatrix: (transform: Partial<TransformObject>) => CSSMatrix;
1424
1610
  /**
1425
1611
  * Iterates over a `PathArray`, executing a callback for each segment.
1426
1612
  * The callback can:
@@ -1533,11 +1719,14 @@ export declare const roundSegment: <T extends PathSegment>(segment: T, roundOpti
1533
1719
  /**
1534
1720
  * Converts any segment to C (cubic-bezier).
1535
1721
  *
1722
+ * A segment that is already a cubic, or a command the converter does not
1723
+ * handle, is returned unchanged.
1724
+ *
1536
1725
  * @param segment the source segment
1537
1726
  * @param params the source segment parameters
1538
1727
  * @returns the cubic-bezier segment
1539
1728
  */
1540
- export declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
1729
+ export declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => PathSegment;
1541
1730
  /**
1542
1731
  * Shorten a single segment of a `pathArray` object.
1543
1732
  *
@@ -1548,9 +1737,31 @@ export declare const segmentToCubic: (segment: PathSegment, params: ParserParams
1548
1737
  * @returns the shortened segment
1549
1738
  */
1550
1739
  export declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
1740
+ /**
1741
+ * Simplifies a path within a geometric tolerance.
1742
+ *
1743
+ * Straight-line runs are reduced with Douglas-Peucker. Curve runs are fitted
1744
+ * with cubic Béziers, while arcs and original curves are preserved whenever
1745
+ * fitting would not reduce the segment count. Every source sub-path and its
1746
+ * closure are retained.
1747
+ *
1748
+ * The tolerance is the target geometric error of the sampled fitting. A
1749
+ * smaller tolerance keeps more detail, a bigger one removes more.
1750
+ *
1751
+ * @param pathInput - the target path string or PathArray
1752
+ * @param options - the tolerance of the simplification, or the options
1753
+ * @returns the simplified path
1754
+ *
1755
+ * @example
1756
+ * ```ts
1757
+ * simplifyPath("M0 0L10 0L20 0L30 0", 1)
1758
+ * // => [['M', 0, 0], ['L', 30, 0]]
1759
+ * ```
1760
+ */
1761
+ export declare const simplifyPath: (pathInput: string | PathArray, options?: number | SimplifyOptions) => PathArray;
1551
1762
  /**
1552
1763
  * Checks a `PathArray` for an unnecessary `Z` segment
1553
- * and removes it. The `PathArray` is modified in place.
1764
+ * and returns a copy without it. The input is not modified.
1554
1765
  * In short, if the segment before `Z` extends to `M`,
1555
1766
  * the `Z` segment must be removed.
1556
1767
  *
@@ -1560,9 +1771,9 @@ export declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: N
1560
1771
  * sub-path separately.
1561
1772
  *
1562
1773
  * @param pathInput the `pathArray` source
1563
- * @returns void
1774
+ * @returns the fixed path
1564
1775
  */
1565
- export declare const fixPath: <T extends PathArray>(pathInput: T | string) => void;
1776
+ export declare const fixPath: <T extends PathArray>(pathInput: T | string) => PathArray;
1566
1777
  /**
1567
1778
  * Split a cubic Bézier into two cubics at parameter t [0–1].
1568
1779
  *
@@ -1578,6 +1789,51 @@ export declare const fixPath: <T extends PathArray>(pathInput: T | string) => vo
1578
1789
  * @returns Array of two cubic segments, each as [x1,y1, x2,y2, x3,y3, x4,y4]
1579
1790
  */
1580
1791
  export declare function splitCubicSegment(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, t: number): [CubicCoordinates, CubicCoordinates];
1792
+ /**
1793
+ * Equalizes two paths for morphing.
1794
+ *
1795
+ * The two paths are brought to the same shape, so they can be morphed into
1796
+ * each other: they hold the same number of segments of the same type, their
1797
+ * winding is the same and their points are aligned.
1798
+ *
1799
+ * A path with a single sub-path is equalized on its own, a path with more
1800
+ * sub-paths is split into sub-paths, the sub-paths are matched by their
1801
+ * shape and every pair is equalized on its own. Multi-subpath paths are
1802
+ * reversed as whole paths, so an outer contour keeps its relationship with
1803
+ * its holes. Outer contours only match outer contours and holes only match
1804
+ * holes: an unmatched contour collapses at its own centroid instead of
1805
+ * taking the opposite fill role.
1806
+ *
1807
+ * The `strategy` option decides how the points of the paths are placed:
1808
+ * - `segment` splits the segments of the paths, so the points of the result
1809
+ * are the points of the paths;
1810
+ * - `arcLength` distributes the points of the result along the length of
1811
+ * the paths. The source segment boundaries and corners are points of the
1812
+ * result too when the requested count allows it, so the shape of the paths
1813
+ * keeps its vertices.
1814
+ *
1815
+ * The `points` option is the number of points of the result. The automatic
1816
+ * mode uses the number of points of the bigger path.
1817
+ *
1818
+ * The `reverse` option decides what happens when the two paths draw in
1819
+ * opposite directions: `true` reverses the second path, `false` leaves the
1820
+ * paths as they are and `auto` reverses the path that leaves the two paths
1821
+ * closest to each other.
1822
+ *
1823
+ * @see https://minus-ze.ro/posts/morphing-arbitrary-paths-in-svg/
1824
+ *
1825
+ * @param pathInput1 - First path string or PathArray
1826
+ * @param pathInput2 - Second path string or PathArray
1827
+ * @param initialCfg - Configuration options for equalization
1828
+ * @returns Tuple of two equalized PathArrays
1829
+ *
1830
+ * @example
1831
+ * ```ts
1832
+ * const [eq1, eq2] = equalize('M0 0L100 0L50 100Z', 'M0 0L100 0L100 100L0 100Z')
1833
+ * // eq1.length === eq2.length — ready for morphing
1834
+ * ```
1835
+ */
1836
+ export declare const equalize: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: EqualizeOptions) => [PathArray, PathArray];
1581
1837
  /**
1582
1838
  * Equalizes two paths for morphing (single subpath only).
1583
1839
  *
@@ -1597,11 +1853,16 @@ export declare const equalizeSegments: (path1: PathArray | string, path2: PathAr
1597
1853
  /**
1598
1854
  * Equalizes two paths for morphing (single/multi subpath).
1599
1855
  *
1856
+ * Multi-subpath paths are reversed as whole paths, so an outer contour keeps
1857
+ * its relationship with its holes. Outer contours only match outer contours
1858
+ * and holes only match holes: an unmatched contour collapses at its own
1859
+ * centroid instead of taking the opposite fill role.
1860
+ *
1600
1861
  * @see https://minus-ze.ro/posts/morphing-arbitrary-paths-in-svg/
1601
1862
  * @param pathInput1 - First path string or PathArray
1602
1863
  * @param pathInput2 - Second path string or PathArray
1603
1864
  * @param initialCfg - Configuration options for equalization
1604
- * @returns Tuple of two equalized MorphPathArrays
1865
+ * @returns Tuple of two equalized PathArrays
1605
1866
  *
1606
1867
  * @example
1607
1868
  * ```ts
@@ -1609,7 +1870,35 @@ export declare const equalizeSegments: (path1: PathArray | string, path2: PathAr
1609
1870
  * // eq1.length === eq2.length — ready for morphing
1610
1871
  * ```
1611
1872
  */
1612
- export declare const equalizePaths: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: {}) => [MorphPathArray, MorphPathArray];
1873
+ export declare const equalizePaths: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: PathsEqualizationOptions) => [PathArray, PathArray];
1874
+ /**
1875
+ * Resamples a path to a given number of points, spread evenly by length.
1876
+ *
1877
+ * The path is measured along its length and the points of the result are
1878
+ * spread evenly over it, so the distance between two points of the result
1879
+ * is the same over the whole path. The source segment boundaries are points
1880
+ * of the result too, so the shape of the path keeps its vertices.
1881
+ *
1882
+ * Every sub-path of the path is resampled on its own, so the sub-paths of
1883
+ * the result are the sub-paths of the source: a path with several sub-paths
1884
+ * keeps its shape, the points of a sub-path are not shared with the others.
1885
+ *
1886
+ * The result is a polyline, or a path of cubic Bezier segments when the
1887
+ * curve mode is used. Every cubic of the result is the exact piece of the
1888
+ * source curve between two knots.
1889
+ *
1890
+ * @param pathInput - the target path string or PathArray
1891
+ * @param count - the number of points of every sub-path of the result
1892
+ * @param mode - the type of the segments of the result
1893
+ * @returns the resampled path
1894
+ *
1895
+ * @example
1896
+ * ```ts
1897
+ * resamplePath("M0 0L100 0L100 100", 3)
1898
+ * // => [['M', 0, 0], ['L', 100, 0], ['L', 100, 100]]
1899
+ * ```
1900
+ */
1901
+ export declare const resamplePath: (pathInput: string | PathArray, count: number, mode?: "line" | "curve") => PathArray;
1613
1902
  /**
1614
1903
  * Finds intersection points between two paths.
1615
1904
  *
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","names":[],"sources":["../src/interface.ts","../src/types.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/lineTools.ts","../src/math/quadTools.ts","../src/math/polygonTools.ts","../src/math/distanceSquareRoot.ts","../src/math/midPoint.ts","../src/math/rotateVector.ts","../src/math/roundTo.ts","../src/convert/pathToAbsolute.ts","../src/convert/pathToRelative.ts","../src/convert/pathToCurve.ts","../src/convert/pathToString.ts","../src/parser/parsePathString.ts","../src/parser/pathParser.ts","../src/parser/finalizeSegment.ts","../src/parser/invalidPathValue.ts","../src/parser/isArcCommand.ts","../src/parser/isDigit.ts","../src/parser/isDigitStart.ts","../src/parser/isMoveCommand.ts","../src/parser/isPathCommand.ts","../src/parser/isSpace.ts","../src/parser/paramsCount.ts","../src/parser/paramsParser.ts","../src/parser/scanFlag.ts","../src/parser/scanParam.ts","../src/parser/scanSegment.ts","../src/parser/skipSpaces.ts","../src/util/getPathBBox.ts","../src/util/getTotalLength.ts","../src/util/distanceEpsilon.ts","../src/util/getClosestPoint.ts","../src/util/getDrawDirection.ts","../src/util/getPathArea.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isAbsoluteArray.ts","../src/util/isCurveArray.ts","../src/util/isNormalizedArray.ts","../src/util/isPathArray.ts","../src/util/isPointInStroke.ts","../src/util/isPolygonArray.ts","../src/util/isPolylineArray.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/util/isMultiPath.ts","../src/util/isClosedPath.ts","../src/util/shapeParams.ts","../src/util/shapeToPath.ts","../src/util/shapeToPathArray.ts","../src/process/normalizePath.ts","../src/process/optimizePath.ts","../src/process/reversePath.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/process/absolutizeSegment.ts","../src/process/arcToCubic.ts","../src/process/getSVGMatrix.ts","../src/process/iterate.ts","../src/process/lineToCubic.ts","../src/process/normalizeSegment.ts","../src/process/projection2d.ts","../src/process/quadToCubic.ts","../src/process/relativizeSegment.ts","../src/process/reverseCurve.ts","../src/process/roundPath.ts","../src/process/roundSegment.ts","../src/process/segmentToCubic.ts","../src/process/shortenSegment.ts","../src/morph/fixPath.ts","../src/morph/splitCubicSegment.ts","../src/morph/equalizeSegments.ts","../src/morph/equalizePaths.ts","../src/intersect/pathIntersection.ts","../src/intersect/boundingBoxIntersect.ts","../src/intersect/isPointInsideBBox.ts"],"mappings":";;;;;;;KAGY;;EAEV,SAAS;;EAET;;EAEA;;EAEA;;;KAIU;;EAEV;;IAEE;;IAEA;;;EAGF;;EAEA,UAAU;;;KAIA;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;GACC;;;KAIS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;KA2CU;;EAEV;;EAEA;;EAEA;;EAEA;;;;;EAKA;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;;KAmDU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;;KC7OU;;KA6BA;;KAGA;;KAIA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA;;KAGQ,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA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C,oBAAiB,MAAU,aAAU,GAAA,IAAU"}
1
+ {"version":3,"file":"util.d.ts","names":[],"sources":["../src/interface.ts","../src/types.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/lineTools.ts","../src/math/quadTools.ts","../src/math/polygonTools.ts","../src/math/distanceSquareRoot.ts","../src/math/midPoint.ts","../src/math/rotateVector.ts","../src/math/roundTo.ts","../src/convert/pathToAbsolute.ts","../src/convert/pathToRelative.ts","../src/convert/pathToCurve.ts","../src/convert/pathToString.ts","../src/parser/parsePathString.ts","../src/parser/pathParser.ts","../src/parser/finalizeSegment.ts","../src/parser/invalidPathValue.ts","../src/parser/isArcCommand.ts","../src/parser/isDigit.ts","../src/parser/isDigitStart.ts","../src/parser/isMoveCommand.ts","../src/parser/isPathCommand.ts","../src/parser/isSpace.ts","../src/parser/paramsCount.ts","../src/parser/paramsParser.ts","../src/parser/scanFlag.ts","../src/parser/scanParam.ts","../src/parser/scanSegment.ts","../src/parser/skipSpaces.ts","../src/util/getPathBBox.ts","../src/util/getTotalLength.ts","../src/util/distanceEpsilon.ts","../src/util/getClosestPoint.ts","../src/util/getDrawDirection.ts","../src/util/getPathArea.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isAbsoluteArray.ts","../src/util/isCurveArray.ts","../src/util/isNormalizedArray.ts","../src/util/isPathArray.ts","../src/util/isPointInStroke.ts","../src/util/isPointInPath.ts","../src/util/isPolygonArray.ts","../src/util/isPolylineArray.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/util/isMultiPath.ts","../src/util/isClosedPath.ts","../src/util/shapeParams.ts","../src/util/shapeToPath.ts","../src/util/shapeToPathArray.ts","../src/process/normalizePath.ts","../src/process/offsetPath.ts","../src/process/optimizePath.ts","../src/process/joinPath.ts","../src/process/reversePath.ts","../src/process/reverseSubPath.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/process/absolutizeSegment.ts","../src/process/arcToCubic.ts","../src/process/getSVGMatrix.ts","../src/process/iterate.ts","../src/process/lineToCubic.ts","../src/process/normalizeSegment.ts","../src/process/projection2d.ts","../src/process/quadToCubic.ts","../src/process/relativizeSegment.ts","../src/process/reverseCurve.ts","../src/process/roundPath.ts","../src/process/roundSegment.ts","../src/process/segmentToCubic.ts","../src/process/shortenSegment.ts","../src/process/simplifyPath.ts","../src/morph/fixPath.ts","../src/morph/splitCubicSegment.ts","../src/morph/equalize.ts","../src/morph/equalizeSegments.ts","../src/morph/equalizePaths.ts","../src/morph/resamplePath.ts","../src/intersect/pathIntersection.ts","../src/intersect/boundingBoxIntersect.ts","../src/intersect/isPointInsideBBox.ts"],"mappings":";;;;;;;KAGY;;EAEV,SAAS;;EAET;;EAEA;;EAEA;;EAEA,OAAO;;EAEP,SAAS;;EAET,QAAQ;;EAER;;;KAIU;;EAEV;;;KAIU;;KAGA;;KAGA;;KAGA;;EAEV,OAAO;;EAEP,OAAO;;EAEP;;EAEA,MAAM;;EAEN;;EAEA;;;KAIU;;KAGA;;EAEV,WAAW;;EAEX;;;KAIU;;EAEV;;;KAIU;;EAEV;;IAEE;;IAEA;;;EAGF;;EAEA,UAAU;;;KAIA;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;GACC;;;KAIS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;KA2CU;;EAEV;;EAEA;;EAEA;;EAEA;;;;;EAKA;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;;KAmDU;;EAEV;;EAEA;;E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