svg-path-commander 2.3.5 → 2.4.1

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