svg-path-commander 2.2.1 → 2.2.3

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,17 +1,18 @@
1
1
  /*!
2
- * SVGPathCommander v2.2.1 (http://thednp.github.io/svg-path-commander)
2
+ * SVGPathCommander v2.2.3 (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
8
+ /** The properties of a path segment found by segment lookup utilities. */
9
9
  type SegmentProperties = {
10
10
  segment: PathSegment;
11
11
  index: number;
12
12
  length: number;
13
13
  lengthAtSegment: number;
14
14
  };
15
+ /** The closest point on the path to a given point, with the distance and optional segment. */
15
16
  type PointProperties = {
16
17
  closest: {
17
18
  x: number;
@@ -20,6 +21,7 @@ type PointProperties = {
20
21
  distance: number;
21
22
  segment?: SegmentProperties;
22
23
  };
24
+ /** The attributes of a `<line>` element read by `shapeToPath`. */
23
25
  type LineAttr = {
24
26
  type: "line";
25
27
  x1: number;
@@ -28,11 +30,13 @@ type LineAttr = {
28
30
  y2: number;
29
31
  [key: string]: string | number;
30
32
  };
33
+ /** The attributes of a `<polygon>` or `<polyline>` element read by `shapeToPath`. */
31
34
  type PolyAttr = {
32
35
  type: "polygon" | "polyline";
33
36
  points: string;
34
37
  [key: string]: string | number;
35
38
  };
39
+ /** The attributes of a `<circle>` element read by `shapeToPath`. */
36
40
  type CircleAttr = {
37
41
  type: "circle";
38
42
  cx: number;
@@ -40,6 +44,7 @@ type CircleAttr = {
40
44
  r: number;
41
45
  [key: string]: string | number;
42
46
  };
47
+ /** The attributes of an `<ellipse>` element read by `shapeToPath`. */
43
48
  type EllipseAttr = {
44
49
  type: "ellipse";
45
50
  cx: number;
@@ -48,6 +53,7 @@ type EllipseAttr = {
48
53
  ry?: number;
49
54
  [key: string]: string | number | undefined;
50
55
  };
56
+ /** The attributes of a `<rect>` element read by `shapeToPath`. */
51
57
  type RectAttr = {
52
58
  type: "rect";
53
59
  width: number;
@@ -58,11 +64,13 @@ type RectAttr = {
58
64
  ry?: number;
59
65
  [key: string]: string | number | undefined;
60
66
  };
67
+ /** The attributes of a `<glyph>` element read by `shapeToPath`. */
61
68
  type GlyphAttr = {
62
69
  type: "glyph";
63
70
  d: string;
64
71
  [key: string]: string | number;
65
72
  };
73
+ /** The parameter names read from each SVG shape element by `shapeToPath`. */
66
74
  type ShapeParams = {
67
75
  line: ["x1", "y1", "x2", "y2"];
68
76
  circle: ["cx", "cy", "r"];
@@ -72,6 +80,7 @@ type ShapeParams = {
72
80
  polyline: ["points"];
73
81
  glyph: ["d"];
74
82
  };
83
+ /** The bounding box of a path, equivalent to the native `getBBox()` result. */
75
84
  type PathBBox = {
76
85
  width: number;
77
86
  height: number;
@@ -83,6 +92,7 @@ type PathBBox = {
83
92
  cy: number;
84
93
  cz: number;
85
94
  };
95
+ /** The minimum and maximum points of a segment bounding box. */
86
96
  type SegmentLimits = {
87
97
  min: {
88
98
  x: number;
@@ -93,6 +103,7 @@ type SegmentLimits = {
93
103
  y: number;
94
104
  };
95
105
  };
106
+ /** The current state tracked by the SVG path string parser. */
96
107
  type ParserParams = {
97
108
  mx: number;
98
109
  my: number;
@@ -105,6 +116,7 @@ type ParserParams = {
105
116
  qx: number | null;
106
117
  qy: number | null;
107
118
  };
119
+ /** The result of a length computation factory: length, point and segment limits. */
108
120
  type LengthFactory = {
109
121
  length: number;
110
122
  point: {
@@ -120,16 +132,19 @@ type LengthFactory = {
120
132
  y: number;
121
133
  };
122
134
  };
135
+ /** The `SVGPathCommander` instance options. */
123
136
  type Options = {
124
137
  round: "off" | number;
125
138
  origin: number[];
126
139
  };
140
+ /** A path segment and its transformation context (command letter and coordinates). */
127
141
  type PathTransform = {
128
142
  s: PathSegment;
129
143
  c: string;
130
144
  x: number;
131
145
  y: number;
132
146
  };
147
+ /** A transform function object with translate, rotate, scale, skew and origin. */
133
148
  type TransformObject = {
134
149
  translate: number | number[];
135
150
  rotate: number | number[];
@@ -137,120 +152,214 @@ type TransformObject = {
137
152
  skew: number | number[];
138
153
  origin: number[];
139
154
  };
155
+ /** The keys of a `TransformObject`. */
140
156
  type TransformProps = keyof TransformObject;
157
+ /** The entries of a `TransformObject` (key-value pairs). */
141
158
  type TransformEntries = [TransformProps, TransformObject[TransformProps]][];
142
159
  //#endregion
143
160
  //#region src/types.d.ts
161
+ /** Whitespace character codes recognized by the SVG path string tokenizer. */
144
162
  type SpaceNumber = 0x1680 | 0x180e | 0x2000 | 0x2001 | 0x2002 | 0x2003 | 0x2004 | 0x2005 | 0x2006 | 0x2007 | 0x2008 | 0x2009 | 0x200a | 0x202f | 0x205f | 0x3000 | 0xfeff | 0x0a | 0x0d | 0x2028 | 0x2029 | 0x20 | 0x09 | 0x0b | 0x0c | 0xa0 | 0x1680;
163
+ /** Character codes of all SVG path command letters. */
145
164
  type PathCommandNumber = 0x6d | 0x7a | 0x6c | 0x68 | 0x76 | 0x63 | 0x73 | 0x71 | 0x74 | 0x61;
165
+ /** Character codes of the decimal digits 0-9. */
146
166
  type DigitNumber = 0x30 | 0x31 | 0x32 | 0x33 | 0x34 | 0x35 | 0x36 | 0x37 | 0x38 | 0x39;
167
+ /** The absolute moveto command letter. */
147
168
  type MCommand = "M";
169
+ /** The relative moveto command letter. */
148
170
  type mCommand = "m";
171
+ /** The absolute lineto command letter. */
149
172
  type LCommand = "L";
173
+ /** The relative lineto command letter. */
150
174
  type lCommand = "l";
175
+ /** The absolute vertical lineto command letter. */
151
176
  type VCommand = "V";
177
+ /** The relative vertical lineto command letter. */
152
178
  type vCommand = "v";
179
+ /** The absolute horizontal lineto command letter. */
153
180
  type HCommand = "H";
181
+ /** The relative horizontal lineto command letter. */
154
182
  type hCommand = "h";
183
+ /** The absolute closepath command letter. */
155
184
  type ZCommand = "Z";
185
+ /** The relative closepath command letter. */
156
186
  type zCommand = "z";
187
+ /** The absolute cubic Bezier command letter. */
157
188
  type CCommand = "C";
189
+ /** The relative cubic Bezier command letter. */
158
190
  type cCommand = "c";
191
+ /** The absolute smooth cubic Bezier command letter. */
159
192
  type SCommand = "S";
193
+ /** The relative smooth cubic Bezier command letter. */
160
194
  type sCommand = "s";
195
+ /** The absolute quadratic Bezier command letter. */
161
196
  type QCommand = "Q";
197
+ /** The relative quadratic Bezier command letter. */
162
198
  type qCommand = "q";
199
+ /** The absolute smooth quadratic Bezier command letter. */
163
200
  type TCommand = "T";
201
+ /** The relative smooth quadratic Bezier command letter. */
164
202
  type tCommand = "t";
203
+ /** The absolute elliptical arc command letter. */
165
204
  type ACommand = "A";
205
+ /** The relative elliptical arc command letter. */
166
206
  type aCommand = "a";
207
+ /** The union of all absolute path command letters. */
167
208
  type AbsoluteCommand = MCommand | LCommand | VCommand | HCommand | ZCommand | CCommand | SCommand | QCommand | TCommand | ACommand;
209
+ /** The union of all relative path command letters. */
168
210
  type RelativeCommand = mCommand | lCommand | vCommand | hCommand | zCommand | cCommand | sCommand | qCommand | tCommand | aCommand;
211
+ /** Any SVG path command letter, absolute or relative. */
169
212
  type PathCommand = AbsoluteCommand | RelativeCommand;
213
+ /** The absolute moveto segment tuple `[M, x, y]`. */
170
214
  type MSegment = [MCommand, number, number];
215
+ /** The relative moveto segment tuple `[m, dx, dy]`. */
171
216
  type mSegment = [mCommand, number, number];
217
+ /** The moveto segment, absolute or relative. */
172
218
  type MoveSegment = MSegment | mSegment;
219
+ /** The absolute lineto segment tuple `[L, x, y]`. */
173
220
  type LSegment = [LCommand, number, number];
221
+ /** The relative lineto segment tuple `[l, dx, dy]`. */
174
222
  type lSegment = [lCommand, number, number];
223
+ /** The lineto segment, absolute or relative. */
175
224
  type LineSegment = LSegment | lSegment;
225
+ /** The absolute vertical lineto segment tuple `[V, y]`. */
176
226
  type VSegment = [VCommand, number];
227
+ /** The relative vertical lineto segment tuple `[v, dy]`. */
177
228
  type vSegment = [vCommand, number];
229
+ /** The vertical lineto segment, absolute or relative. */
178
230
  type VertLineSegment = vSegment | VSegment;
231
+ /** The absolute horizontal lineto segment tuple `[H, x]`. */
179
232
  type HSegment = [HCommand, number];
233
+ /** The relative horizontal lineto segment tuple `[h, dx]`. */
180
234
  type hSegment = [hCommand, number];
235
+ /** The horizontal lineto segment, absolute or relative. */
181
236
  type HorLineSegment = HSegment | hSegment;
237
+ /** The absolute closepath segment tuple `[Z]`. */
182
238
  type ZSegment = [ZCommand];
239
+ /** The relative closepath segment tuple `[z]`. */
183
240
  type zSegment = [zCommand];
241
+ /** The closepath segment, absolute or relative. */
184
242
  type CloseSegment = ZSegment | zSegment;
243
+ /** The absolute cubic Bezier segment tuple `[C, x1, y1, x2, y2, x, y]`. */
185
244
  type CSegment = [CCommand, number, number, number, number, number, number];
245
+ /** The relative cubic Bezier segment tuple `[c, dx1, dy1, dx2, dy2, dx, dy]`. */
186
246
  type cSegment = [cCommand, number, number, number, number, number, number];
247
+ /** The cubic Bezier segment, absolute or relative. */
187
248
  type CubicSegment = CSegment | cSegment;
249
+ /** The absolute smooth cubic Bezier segment tuple `[S, x2, y2, x, y]`. */
188
250
  type SSegment = [SCommand, number, number, number, number];
251
+ /** The relative smooth cubic Bezier segment tuple `[s, dx2, dy2, dx, dy]`. */
189
252
  type sSegment = [sCommand, number, number, number, number];
253
+ /** The smooth cubic Bezier segment, absolute or relative. */
190
254
  type ShortCubicSegment = SSegment | sSegment;
255
+ /** The absolute quadratic Bezier segment tuple `[Q, x1, y1, x, y]`. */
191
256
  type QSegment = [QCommand, number, number, number, number];
257
+ /** The relative quadratic Bezier segment tuple `[q, dx1, dy1, dx, dy]`. */
192
258
  type qSegment = [qCommand, number, number, number, number];
259
+ /** The quadratic Bezier segment, absolute or relative. */
193
260
  type QuadSegment = QSegment | qSegment;
261
+ /** The absolute smooth quadratic Bezier segment tuple `[T, x, y]`. */
194
262
  type TSegment = [TCommand, number, number];
263
+ /** The relative smooth quadratic Bezier segment tuple `[t, dx, dy]`. */
195
264
  type tSegment = [tCommand, number, number];
265
+ /** The smooth quadratic Bezier segment, absolute or relative. */
196
266
  type ShortQuadSegment = TSegment | tSegment;
267
+ /** The absolute elliptical arc segment tuple `[A, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y]`. */
197
268
  type ASegment = [ACommand, number, number, number, number, number, number, number];
269
+ /** The relative elliptical arc segment tuple `[a, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, dx, dy]`. */
198
270
  type aSegment = [aCommand, number, number, number, number, number, number, number];
271
+ /** The elliptical arc segment, absolute or relative. */
199
272
  type ArcSegment = ASegment | aSegment;
273
+ /** Any SVG path command segment. */
200
274
  type PathSegment = MoveSegment | LineSegment | VertLineSegment | HorLineSegment | CloseSegment | CubicSegment | ShortCubicSegment | QuadSegment | ShortQuadSegment | ArcSegment;
275
+ /** Any shorthand or single-coordinate path segment. */
201
276
  type ShortSegment = VertLineSegment | HorLineSegment | ShortCubicSegment | ShortQuadSegment | CloseSegment;
277
+ /** Any absolute path command segment. */
202
278
  type AbsoluteSegment = MSegment | LSegment | VSegment | HSegment | CSegment | SSegment | QSegment | TSegment | ASegment | ZSegment;
279
+ /** Any relative path command segment. */
203
280
  type RelativeSegment = mSegment | lSegment | vSegment | hSegment | cSegment | sSegment | qSegment | tSegment | aSegment | zSegment;
281
+ /** The path segments used by the normalized form (no shorthand commands). */
204
282
  type NormalSegment = MSegment | LSegment | CSegment | QSegment | ASegment | ZSegment;
283
+ /** A parsed SVG path string as an array of path segments. */
205
284
  type PathArray = [MSegment | mSegment, ...PathSegment[]];
285
+ /** A `PathArray` with only absolute path segments. */
206
286
  type AbsoluteArray = [MSegment, ...AbsoluteSegment[]];
287
+ /** A `PathArray` with only relative path segments. */
207
288
  type RelativeArray = [MSegment, ...RelativeSegment[]];
289
+ /** A `PathArray` with only normalized segments (no shorthand commands). */
208
290
  type NormalArray = [MSegment, ...NormalSegment[]];
291
+ /** A `PathArray` with only moveto and cubic Bezier segments. */
209
292
  type CurveArray = [MSegment, ...CSegment[]];
293
+ /** A `CurveArray` ending with a closepath segment. */
210
294
  type ClosedCurveArray = [MSegment, ...CSegment[], ZSegment];
295
+ /** A `PathArray` describing a closed polygon (moveto, lineto and closepath). */
211
296
  type PolygonArray = [MSegment, ...LSegment[], ZSegment];
297
+ /** A `PathArray` describing an open polyline (moveto and lineto). */
212
298
  type PolylineArray = [MSegment, ...LSegment[]];
299
+ /** The `PathArray` shapes supported by path morphing. */
213
300
  type MorphPathArray = PolygonArray | PolylineArray | CurveArray | ClosedCurveArray;
301
+ /** The SVG element types that can be converted to a path. */
214
302
  type ShapeTypes = SVGPolylineElement | SVGPolygonElement | SVGLineElement | SVGEllipseElement | SVGCircleElement | SVGRectElement;
303
+ /** The tag names of the SVG elements that can be converted to a path. */
215
304
  type ShapeTags = "line" | "polyline" | "polygon" | "ellipse" | "circle" | "rect" | "glyph";
305
+ /** The shape attributes mapped to each supported SVG element type. */
216
306
  type ShapeOps = LineAttr | PolyAttr | PolyAttr | EllipseAttr | CircleAttr | RectAttr | GlyphAttr;
307
+ /** A `TransformObject` with a required 3D origin. */
217
308
  type TransformObjectValues = Partial<TransformObject> & {
218
309
  origin: [number, number, number];
219
310
  };
311
+ /** A 2D point with `x` and `y` coordinates. */
220
312
  type Point = {
221
313
  x: number;
222
314
  y: number;
223
315
  };
316
+ /** A 2D point as a tuple `[x, y]`. */
224
317
  type PointTuple = [number, number];
318
+ /** A `Point` with a `t` parameter (a point on a curve at ratio `t`). */
225
319
  type DerivedPoint = Point & {
226
320
  t: number;
227
321
  };
322
+ /** The six points of a quadratic Bezier curve (on-curve and off-curve control points). */
228
323
  type QuadPoints = [Point, Point, Point, Point, Point, Point];
324
+ /** The eight points of a cubic Bezier curve (on-curve and off-curve control points). */
229
325
  type CubicPoints = [Point, Point, Point, Point, Point, Point, Point, Point];
326
+ /** The six derived points of a quadratic Bezier curve, each with a `t` parameter. */
230
327
  type DerivedQuadPoints = [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];
328
+ /** The eight derived points of a cubic Bezier curve, each with a `t` parameter. */
231
329
  type DerivedCubicPoints = [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];
330
+ /** The six coordinates of a quadratic Bezier segment `[x1, y1, cx, cy, x, y]`. */
232
331
  type QuadCoordinates = [number, number, number, number, number, number];
332
+ /** The eight coordinates of a cubic Bezier segment. */
233
333
  type CubicCoordinates = [number, number, number, number, number, number, number, number];
334
+ /** The coordinates of an arc segment (the eight numbers after the command letter). */
234
335
  type ArcCoordinates = [number, number, number, number, number, number, number, number, number];
336
+ /** The four coordinates of a line segment `[x1, y1, x2, y2]`. */
235
337
  type LineCoordinates = [number, number, number, number];
338
+ /** A function that derives a point on a curve at a given `t` ratio. */
236
339
  type DeriveCallback = (t: number) => Point;
340
+ /** A callback invoked for each segment while iterating over a `PathArray`. */
237
341
  type IteratorCallback<T extends PathArray, K extends keyof T = number> = (segment: PathSegment & T[K], index: number, lastX: number, lastY: number) => PathSegment | T[K] | false | void | undefined;
342
+ /** The bounding box extremes `[minX, minY, maxX, maxY]`. */
238
343
  type BBoxMaxima = [minX: number, minY: number, maxX: number, maxY: number];
344
+ /** A point on the path at a given length, including the `t` ratio. */
239
345
  type PointAtLength = {
240
346
  x: number;
241
347
  y: number;
242
348
  t: number;
243
349
  };
350
+ /** An intersection point between two curves, including both `t` ratios. */
244
351
  type IntersectionPoint = {
245
352
  x: number;
246
353
  y: number;
247
354
  t1: number;
248
355
  t2: number;
249
356
  };
357
+ /** Options for computing intersections between two curves. */
250
358
  interface IntersectionOptions {
251
359
  justCount?: boolean;
252
360
  epsilon?: number;
253
361
  }
362
+ /** Options for equalizing a single path to a given segment count. */
254
363
  interface PathEqualizationOptions {
255
364
  /** @default "auto" */
256
365
  mode?: "line" | "curve" | "auto";
@@ -258,6 +367,7 @@ interface PathEqualizationOptions {
258
367
  roundValues?: number;
259
368
  close?: boolean;
260
369
  }
370
+ /** Options for equalizing two paths for morphing. */
261
371
  interface EqualizationOptions {
262
372
  /** @default "auto" */
263
373
  mode?: "curve" | "auto";
@@ -267,7 +377,9 @@ interface EqualizationOptions {
267
377
  close?: boolean;
268
378
  target?: number;
269
379
  }
380
+ /** `EqualizationOptions` without `reverse` and `target`, used for path pairs. */
270
381
  type PathsEqualizationOptions = Omit<EqualizationOptions, "reverse" | "target">;
382
+ /** The geometric features of a path used for matching during morphing. */
271
383
  interface PathFeature {
272
384
  isPoly: boolean;
273
385
  path: NormalArray;
@@ -277,6 +389,135 @@ interface PathFeature {
277
389
  bbox: PathBBox;
278
390
  }
279
391
  //#endregion
392
+ //#region src/math/distanceSquareRoot.d.ts
393
+ /**
394
+ * Returns the square root of the distance
395
+ * between two given points.
396
+ *
397
+ * @param a the first point coordinates
398
+ * @param b the second point coordinates
399
+ * @returns the distance value
400
+ */
401
+ declare const distanceSquareRoot: (a: PointTuple, b: PointTuple) => number;
402
+ //#endregion
403
+ //#region src/math/midPoint.d.ts
404
+ /**
405
+ * Returns the coordinates of a specified distance
406
+ * ratio between two points.
407
+ *
408
+ * @param a the first point coordinates
409
+ * @param b the second point coordinates
410
+ * @param t the ratio
411
+ * @returns the midpoint coordinates
412
+ */
413
+ declare const midPoint: ([ax, ay]: PointTuple, [bx, by]: PointTuple, t: number) => PointTuple;
414
+ //#endregion
415
+ //#region src/math/rotateVector.d.ts
416
+ /**
417
+ * Returns an {x,y} vector rotated by a given
418
+ * angle in radian.
419
+ *
420
+ * @param x the initial vector x
421
+ * @param y the initial vector y
422
+ * @param rad the radian vector angle
423
+ * @returns the rotated vector
424
+ */
425
+ declare const rotateVector: (x: number, y: number, rad: number) => {
426
+ x: number;
427
+ y: number;
428
+ };
429
+ //#endregion
430
+ //#region src/math/roundTo.d.ts
431
+ /**
432
+ * Rounds a number to the specified number of decimal places.
433
+ *
434
+ * @param n - The number to round
435
+ * @param round - Number of decimal places
436
+ * @returns The rounded number
437
+ */
438
+ declare const roundTo: (n: number, round: number) => number;
439
+ //#endregion
440
+ //#region src/convert/pathToAbsolute.d.ts
441
+ /**
442
+ * Parses a path string value or object and returns an array
443
+ * of segments, all converted to absolute values.
444
+ *
445
+ * @param pathInput - The path string or PathArray
446
+ * @returns The resulted PathArray with absolute values
447
+ *
448
+ * @example
449
+ * ```ts
450
+ * pathToAbsolute('M10 10l80 80')
451
+ * // => [['M', 10, 10], ['L', 90, 90]]
452
+ * ```
453
+ */
454
+ declare const pathToAbsolute: <T extends PathArray>(pathInput: string | T) => AbsoluteArray;
455
+ //#endregion
456
+ //#region src/convert/pathToRelative.d.ts
457
+ /**
458
+ * Parses a path string value or object and returns an array
459
+ * of segments, all converted to relative values.
460
+ *
461
+ * @param pathInput - The path string or PathArray
462
+ * @returns The resulted PathArray with relative values
463
+ *
464
+ * @example
465
+ * ```ts
466
+ * pathToRelative('M10 10L90 90')
467
+ * // => [['M', 10, 10], ['l', 80, 80]]
468
+ * ```
469
+ */
470
+ declare const pathToRelative: <T extends PathArray>(pathInput: string | T) => RelativeArray;
471
+ //#endregion
472
+ //#region src/convert/pathToCurve.d.ts
473
+ /**
474
+ * Parses a path string or PathArray and returns a new one
475
+ * in which all segments are converted to cubic-bezier.
476
+ *
477
+ * @param pathInput - The path string or PathArray
478
+ * @returns The resulted CurveArray with all segments as cubic beziers
479
+ *
480
+ * @example
481
+ * ```ts
482
+ * pathToCurve('M10 50q15 -25 30 0')
483
+ * // => [['M', 10, 50], ['C', 25, 25, 40, 50, 40, 50]]
484
+ * ```
485
+ */
486
+ declare const pathToCurve: <T extends PathArray>(pathInput: string | T) => CurveArray;
487
+ //#endregion
488
+ //#region src/convert/pathToString.d.ts
489
+ /**
490
+ * Returns a valid `d` attribute string value created
491
+ * by rounding values and concatenating the PathArray segments.
492
+ *
493
+ * @param path - The PathArray object
494
+ * @param roundOption - Amount of decimals to round values to, or "off"
495
+ * @returns The concatenated path string
496
+ *
497
+ * @example
498
+ * ```ts
499
+ * pathToString([['M', 10, 10], ['L', 90, 90]], 2)
500
+ * // => 'M10 10L90 90'
501
+ * ```
502
+ */
503
+ declare const pathToString: <T extends PathArray>(path: T, roundOption?: number | "off") => string;
504
+ //#endregion
505
+ //#region src/parser/parsePathString.d.ts
506
+ /**
507
+ * Parses a path string value and returns an array
508
+ * of segments we like to call `PathArray`.
509
+ *
510
+ * If parameter value is already a `PathArray`,
511
+ * return a clone of it.
512
+ * @example
513
+ * parsePathString("M 0 0L50 50")
514
+ * // => [["M",0,0],["L",50,50]]
515
+ *
516
+ * @param pathInput the string to be parsed
517
+ * @returns the resulted `pathArray` or error string
518
+ */
519
+ declare const parsePathString: <T extends PathArray>(pathInput: string | T) => PathArray;
520
+ //#endregion
280
521
  //#region src/parser/pathParser.d.ts
281
522
  /**
282
523
  * The `PathParser` is used by the `parsePathString` static method
@@ -296,6 +537,338 @@ declare class PathParser {
296
537
  constructor(pathString: string);
297
538
  }
298
539
  //#endregion
540
+ //#region src/parser/finalizeSegment.d.ts
541
+ /**
542
+ * Breaks the parsing of a pathString once a segment is finalized.
543
+ *
544
+ * @param path - The PathParser instance
545
+ */
546
+ declare const finalizeSegment: (path: PathParser) => void;
547
+ //#endregion
548
+ //#region src/parser/isArcCommand.d.ts
549
+ /**
550
+ * Checks if the character is an A (arc-to) path command.
551
+ *
552
+ * @param code the character to check
553
+ * @returns check result
554
+ */
555
+ declare const isArcCommand: (code: number) => code is 97;
556
+ //#endregion
557
+ //#region src/parser/isDigit.d.ts
558
+ /**
559
+ * Checks if a character is a digit.
560
+ *
561
+ * @param code the character to check
562
+ * @returns check result
563
+ */
564
+ declare const isDigit: (code: number) => code is DigitNumber;
565
+ //#endregion
566
+ //#region src/parser/isDigitStart.d.ts
567
+ /**
568
+ * Checks if the character is or belongs to a number.
569
+ * [0-9]|+|-|.
570
+ *
571
+ * @param code the character to check
572
+ * @returns check result
573
+ */
574
+ declare const isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46;
575
+ //#endregion
576
+ //#region src/parser/isMoveCommand.d.ts
577
+ /**
578
+ * Checks if the character is a MoveTo command.
579
+ *
580
+ * @param code the character to check
581
+ * @returns check result
582
+ */
583
+ declare const isMoveCommand: (code: number) => code is 109 | 77;
584
+ //#endregion
585
+ //#region src/parser/isPathCommand.d.ts
586
+ /**
587
+ * Checks if the character is a path command.
588
+ *
589
+ * @param code the character to check
590
+ * @returns check result
591
+ */
592
+ declare const isPathCommand: (code: number) => code is PathCommandNumber;
593
+ //#endregion
594
+ //#region src/parser/isSpace.d.ts
595
+ /**
596
+ * Checks if the character is a space.
597
+ *
598
+ * @param ch the character to check
599
+ * @returns check result
600
+ */
601
+ declare const isSpace: (ch: number) => ch is SpaceNumber;
602
+ //#endregion
603
+ //#region src/parser/scanFlag.d.ts
604
+ /**
605
+ * Validates an A (arc-to) specific path command value.
606
+ * Usually a `large-arc-flag` or `sweep-flag`.
607
+ *
608
+ * @param path - The PathParser instance
609
+ */
610
+ declare const scanFlag: (path: PathParser) => void;
611
+ //#endregion
612
+ //#region src/parser/scanParam.d.ts
613
+ /**
614
+ * Validates every character of the path string,
615
+ * every path command, negative numbers or floating point numbers.
616
+ *
617
+ * @param path - The PathParser instance
618
+ */
619
+ declare const scanParam: (path: PathParser) => void;
620
+ //#endregion
621
+ //#region src/parser/scanSegment.d.ts
622
+ /**
623
+ * Scans every character in the path string to determine
624
+ * where a segment starts and where it ends.
625
+ *
626
+ * @param path - The PathParser instance
627
+ */
628
+ declare const scanSegment: (path: PathParser) => void;
629
+ //#endregion
630
+ //#region src/parser/skipSpaces.d.ts
631
+ /**
632
+ * Points the parser to the next character in the
633
+ * path string every time it encounters any kind of
634
+ * space character.
635
+ *
636
+ * @param path - The PathParser instance
637
+ */
638
+ declare const skipSpaces: (path: PathParser) => void;
639
+ //#endregion
640
+ //#region src/util/getPathBBox.d.ts
641
+ /**
642
+ * Calculates the bounding box of a path.
643
+ *
644
+ * @param pathInput - The path string or PathArray
645
+ * @returns An object with width, height, x, y, x2, y2, cx, cy, cz properties
646
+ *
647
+ * @example
648
+ * ```ts
649
+ * getPathBBox('M0 0L100 0L100 100L0 100Z')
650
+ * // => { x: 0, y: 0, width: 100, height: 100, x2: 100, y2: 100, cx: 50, cy: 50, cz: 150 }
651
+ * ```
652
+ */
653
+ declare const getPathBBox: <T extends PathArray>(pathInput: T | string) => {
654
+ x: number;
655
+ y: number;
656
+ width: number;
657
+ height: number;
658
+ x2: number;
659
+ y2: number;
660
+ cx: number;
661
+ cy: number;
662
+ cz: number;
663
+ };
664
+ //#endregion
665
+ //#region src/util/getTotalLength.d.ts
666
+ /**
667
+ * Returns the total length of a path, equivalent to `shape.getTotalLength()`.
668
+ *
669
+ * @param pathInput - The target path string or PathArray
670
+ * @returns The total length of the path
671
+ *
672
+ * @example
673
+ * ```ts
674
+ * getTotalLength('M0 0L100 0L100 100L0 100Z')
675
+ * // => 300
676
+ * ```
677
+ */
678
+ declare const getTotalLength: <T extends PathArray>(pathInput: string | T) => number;
679
+ //#endregion
680
+ //#region src/util/getClosestPoint.d.ts
681
+ /**
682
+ * Returns the point in path closest to a given point.
683
+ *
684
+ * @param pathInput target `pathArray`
685
+ * @param point the given point
686
+ * @returns the best match
687
+ */
688
+ declare const getClosestPoint: (pathInput: string | PathArray, point: {
689
+ x: number;
690
+ y: number;
691
+ }) => {
692
+ x: number;
693
+ y: number;
694
+ };
695
+ //#endregion
696
+ //#region src/util/getDrawDirection.d.ts
697
+ /**
698
+ * Check if a path is drawn clockwise and returns true if so,
699
+ * false otherwise.
700
+ *
701
+ * @param path the path string or `pathArray`
702
+ * @returns true when clockwise or false if not
703
+ */
704
+ declare const getDrawDirection: (path: string | PathArray) => boolean;
705
+ //#endregion
706
+ //#region src/util/getPathArea.d.ts
707
+ /**
708
+ * Returns the signed area of a shape.
709
+ *
710
+ * @author Jürg Lehni & Jonathan Puckey
711
+ *
712
+ * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js
713
+ *
714
+ * @param path - The shape PathArray
715
+ * @returns The signed area of the shape (positive for clockwise, negative for counter-clockwise)
716
+ *
717
+ * @example
718
+ * ```ts
719
+ * getPathArea([['M', 0, 0], ['L', 100, 0], ['L', 100, 100], ['L', 0, 100], ['Z']])
720
+ * // => -10000 (counter-clockwise square)
721
+ * ```
722
+ */
723
+ declare const getPathArea: <T extends PathArray | string>(path: T) => number;
724
+ //#endregion
725
+ //#region src/util/getPointAtLength.d.ts
726
+ /**
727
+ * Returns [x,y] coordinates of a point at a given length along a path.
728
+ *
729
+ * @param pathInput - The PathArray or path string to look into
730
+ * @param distance - The distance along the path
731
+ * @returns The requested {x, y} point coordinates
732
+ *
733
+ * @example
734
+ * ```ts
735
+ * getPointAtLength('M0 0L100 0L100 100Z', 50)
736
+ * // => { x: 50, y: 0 }
737
+ * ```
738
+ */
739
+ declare const getPointAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => {
740
+ x: number;
741
+ y: number;
742
+ };
743
+ //#endregion
744
+ //#region src/util/getPropertiesAtLength.d.ts
745
+ /**
746
+ * Returns the segment, its index and length as well as
747
+ * the length to that segment at a given length in a path.
748
+ *
749
+ * @param pathInput target `pathArray`
750
+ * @param distance the given length
751
+ * @returns the requested properties
752
+ */
753
+ declare const getPropertiesAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => SegmentProperties;
754
+ //#endregion
755
+ //#region src/util/getPropertiesAtPoint.d.ts
756
+ /**
757
+ * Returns the point and segment in path closest to a given point as well as
758
+ * the distance to the path stroke.
759
+ *
760
+ * @see https://bl.ocks.org/mbostock/8027637
761
+ *
762
+ * @param pathInput target `pathArray`
763
+ * @param point the given point
764
+ * @returns the requested properties
765
+ */
766
+ declare const getPropertiesAtPoint: <T extends PathArray>(pathInput: string | T, point: Point) => PointProperties;
767
+ //#endregion
768
+ //#region src/util/getSegmentAtLength.d.ts
769
+ /**
770
+ * Returns the segment at a given length.
771
+ *
772
+ * @param pathInput the target `pathArray`
773
+ * @param distance the distance in path to look at
774
+ * @returns the requested segment
775
+ */
776
+ declare const getSegmentAtLength: <T extends PathArray>(pathInput: string | T, distance?: number) => PathSegment | undefined;
777
+ //#endregion
778
+ //#region src/util/getSegmentOfPoint.d.ts
779
+ /**
780
+ * Returns the path segment which contains a given point.
781
+ *
782
+ * @param path the `pathArray` to look into
783
+ * @param point the point of the shape to look for
784
+ * @returns the requested segment
785
+ */
786
+ declare const getSegmentOfPoint: <T extends PathArray>(path: string | T, point: {
787
+ x: number;
788
+ y: number;
789
+ }) => SegmentProperties | undefined;
790
+ //#endregion
791
+ //#region src/util/isAbsoluteArray.d.ts
792
+ /**
793
+ * Iterates an array to check if it's a `pathArray`
794
+ * with all absolute values.
795
+ *
796
+ * @param path the `pathArray` to be checked
797
+ * @returns iteration result
798
+ */
799
+ declare const isAbsoluteArray: (path: unknown) => path is AbsoluteArray;
800
+ //#endregion
801
+ //#region src/util/isPolygonArray.d.ts
802
+ /**
803
+ * Checks if a path is a polygon (only M, L, H, V, Z commands).
804
+ * @param pathArray PathArray (pre-normalize if needed)
805
+ * @returns boolean
806
+ */
807
+ declare const isPolygonArray: (path: PathArray) => path is PolygonArray;
808
+ //#endregion
809
+ //#region src/util/isCurveArray.d.ts
810
+ /**
811
+ * Iterates an array to check if it's a `pathArray`
812
+ * with all C (cubic bezier) segments.
813
+ *
814
+ * @param path the `Array` to be checked
815
+ * @returns iteration result
816
+ */
817
+ declare const isCurveArray: (path: unknown) => path is CurveArray;
818
+ //#endregion
819
+ //#region src/util/isNormalizedArray.d.ts
820
+ /**
821
+ * Iterates an array to check if it's a `pathArray`
822
+ * with all segments in non-shorthand notation
823
+ * with absolute values.
824
+ *
825
+ * @param path - the array to be checked
826
+ * @returns true if the array is a normalized path array
827
+ */
828
+ declare const isNormalizedArray: (path: unknown) => path is NormalArray;
829
+ //#endregion
830
+ //#region src/util/isPathArray.d.ts
831
+ /**
832
+ * Iterates an array to check if it's an actual `pathArray`.
833
+ *
834
+ * @param path the `pathArray` to be checked
835
+ * @returns iteration result
836
+ */
837
+ declare const isPathArray: (path: unknown) => path is PathArray;
838
+ //#endregion
839
+ //#region src/util/isPointInStroke.d.ts
840
+ /**
841
+ * Checks if a given point is in the stroke of a path.
842
+ *
843
+ * @param pathInput target path
844
+ * @param point the given `{x,y}` point
845
+ * @returns the query result
846
+ */
847
+ declare const isPointInStroke: <T extends PathArray>(pathInput: string | T, point: {
848
+ x: number;
849
+ y: number;
850
+ }) => boolean;
851
+ //#endregion
852
+ //#region src/util/isRelativeArray.d.ts
853
+ /**
854
+ * Iterates an array to check if it's a `pathArray`
855
+ * with relative values.
856
+ *
857
+ * @param path the `pathArray` to be checked
858
+ * @returns iteration result
859
+ */
860
+ declare const isRelativeArray: (path: unknown) => path is RelativeArray;
861
+ //#endregion
862
+ //#region src/util/isValidPath.d.ts
863
+ /**
864
+ * Parses a path string value to determine its validity
865
+ * then returns true if it's valid or false otherwise.
866
+ *
867
+ * @param pathString the path string to be parsed
868
+ * @returns the path string validity
869
+ */
870
+ declare const isValidPath: (pathString: string) => boolean;
871
+ //#endregion
299
872
  //#region src/morph/samplePolygon.d.ts
300
873
  /**
301
874
  * Samples points from a path to form a polygon approximation.
@@ -308,6 +881,60 @@ declare class PathParser {
308
881
  */
309
882
  declare function samplePolygon<T extends NormalArray>(path: T): PointTuple[];
310
883
  //#endregion
884
+ //#region src/util/shapeToPath.d.ts
885
+ /**
886
+ * Returns a new `<path>` element created from attributes of a `<line>`, `<polyline>`,
887
+ * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>` or `<glyph>`. If `replace` parameter
888
+ * is `true`, it will replace the target. The default `ownerDocument` is your current
889
+ * `document` browser page, if you want to use in server-side using `jsdom`, you can
890
+ * pass the `jsdom` `document` to `ownDocument`.
891
+ *
892
+ * It can also work with an options object, see the type below
893
+ * @see ShapeOps
894
+ *
895
+ * The newly created `<path>` element keeps all non-specific
896
+ * attributes like `class`, `fill`, etc.
897
+ *
898
+ * @param element - Target shape element or shape options object
899
+ * @param replace - Option to replace target element
900
+ * @param ownerDocument - Document for creating the element
901
+ * @returns The newly created `<path>` element, or false if the path is invalid
902
+ *
903
+ * @example
904
+ * ```ts
905
+ * const circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle')
906
+ * circle.setAttribute('cx', '50')
907
+ * circle.setAttribute('cy', '50')
908
+ * circle.setAttribute('r', '25')
909
+ * const path = shapeToPath(circle)
910
+ * path.getAttribute('d')
911
+ * // => 'M50 25A25 25 0 1 1 50 75A25 25 0 1 1 50 25Z'
912
+ * ```
913
+ */
914
+ declare const shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false;
915
+ //#endregion
916
+ //#region src/util/shapeToPathArray.d.ts
917
+ /**
918
+ * Returns a new `pathArray` created from attributes of a `<line>`, `<polyline>`,
919
+ * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>`, <path> or `<glyph>`.
920
+ *
921
+ * It can also work with an options object, see the type below
922
+ * @see ShapeOps
923
+ *
924
+ * @param element target shape
925
+ * @returns the newly created `<path>` element
926
+ */
927
+ declare const shapeToPathArray: (element: ShapeTypes | ShapeOps) => false | PathArray;
928
+ //#endregion
929
+ //#region src/util/isMultiPath.d.ts
930
+ /**
931
+ * Determines if an SVG path contains multiple subpaths.
932
+ * Accepts path string or PathArray.
933
+ * @param path - 'M10,10 L20,20 Z M30,30 L40,40' → true
934
+ * @returns boolean
935
+ */
936
+ declare const isMultiPath: <T extends PathArray>(path: string | T) => boolean;
937
+ //#endregion
311
938
  //#region src/util/isPolylineArray.d.ts
312
939
  /**
313
940
  * Checks if a path is a polyline (only M, L, H, V commands).
@@ -316,6 +943,314 @@ declare function samplePolygon<T extends NormalArray>(path: T): PointTuple[];
316
943
  */
317
944
  declare function isPolylineArray(path: PathArray): path is PolylineArray;
318
945
  //#endregion
946
+ //#region src/util/isClosedPath.d.ts
947
+ /**
948
+ * Check if a PathArray is closed, which means its last segment is a Z.
949
+ * @param path
950
+ * @returns true if the path is closed
951
+ */
952
+ declare const isClosedPath: <T extends PathArray>(path: T) => boolean;
953
+ //#endregion
954
+ //#region src/process/normalizePath.d.ts
955
+ /**
956
+ * Parses a path string or PathArray, then iterates the result for:
957
+ * * converting segments to absolute values
958
+ * * converting shorthand commands to their non-shorthand notation
959
+ *
960
+ * @param pathInput - The path string or PathArray
961
+ * @returns The normalized PathArray
962
+ *
963
+ * @example
964
+ * ```ts
965
+ * normalizePath('M10 90s20 -80 40 -80s20 80 40 80')
966
+ * // => [['M', 10, 90], ['C', 30, 90, 25, 10, 50, 10], ['C', 75, 10, 70, 90, 90, 90]]
967
+ * ```
968
+ */
969
+ declare const normalizePath: <T extends string | PathArray>(pathInput: T) => NormalArray;
970
+ //#endregion
971
+ //#region src/process/optimizePath.d.ts
972
+ /**
973
+ * Optimizes a PathArray:
974
+ * * converts segments to shorthand if possible
975
+ * * selects shortest representation from absolute and relative forms
976
+ *
977
+ * @param pathInput - A path string or PathArray
978
+ * @param roundOption - Number of decimal places for rounding
979
+ * @returns The optimized PathArray
980
+ *
981
+ * @example
982
+ * ```ts
983
+ * optimizePath('M10 10L10 10L90 90', 2)
984
+ * // => [['M', 10, 10], ['l', 0, 0], ['l', 80, 80]]
985
+ * ```
986
+ */
987
+ declare const optimizePath: <T extends string | PathArray>(pathInput: T, roundOption?: number) => PathArray;
988
+ //#endregion
989
+ //#region src/process/reversePath.d.ts
990
+ /**
991
+ * Reverses all segments of a PathArray and returns a new PathArray
992
+ * with absolute values.
993
+ *
994
+ * @param pathInput - The source PathArray
995
+ * @returns The reversed PathArray
996
+ *
997
+ * @example
998
+ * ```ts
999
+ * reversePath([['M', 0, 0], ['L', 100, 0], ['L', 100, 100], ['L', 0, 100], ['Z']])
1000
+ * // => [['M', 0, 100], ['L', 0, 0], ['L', 100, 0], ['L', 100, 100], ['Z']]
1001
+ * ```
1002
+ */
1003
+ declare const reversePath: <T extends PathArray>(pathInput: T) => T;
1004
+ //#endregion
1005
+ //#region src/process/splitPath.d.ts
1006
+ /**
1007
+ * Split a path string or PathArray into an array of sub-paths.
1008
+ *
1009
+ * In the process, values are converted to absolute
1010
+ * for visual consistency.
1011
+ *
1012
+ * @param pathInput - The source path string or PathArray
1013
+ * @returns An array of sub-path PathArrays
1014
+ *
1015
+ * @example
1016
+ * ```ts
1017
+ * splitPath('M0 0L100 0ZM200 0L300 0Z')
1018
+ * // => [
1019
+ * // [['M', 0, 0], ['L', 100, 0], ['Z']],
1020
+ * // [['M', 200, 0], ['L', 300, 0], ['Z']]
1021
+ * // ]
1022
+ * ```
1023
+ */
1024
+ declare const splitPath: <T extends PathArray>(pathInput: T | string) => T[];
1025
+ //#endregion
1026
+ //#region src/process/transformPath.d.ts
1027
+ /**
1028
+ * Apply a 2D / 3D transformation to a PathArray.
1029
+ *
1030
+ * Since SVGElement doesn't support 3D transformation, this function
1031
+ * creates a 2D projection of the path element.
1032
+ *
1033
+ * @param pathInput - The PathArray or path string to transform
1034
+ * @param transform - The transform functions object (translate, rotate, skew, scale, origin)
1035
+ * @returns The transformed PathArray
1036
+ *
1037
+ * @example
1038
+ * ```ts
1039
+ * transformPath('M0 0L100 0L100 100L0 100Z', { translate: [10, 20], scale: 2 })
1040
+ * // => [['M', 10, 20], ['L', 210, 20], ['L', 210, 220], ['L', 10, 220], ['Z']]
1041
+ * ```
1042
+ */
1043
+ declare const transformPath: <T extends PathArray>(pathInput: T | string, transform?: Partial<TransformObject>) => T | AbsoluteArray;
1044
+ //#endregion
1045
+ //#region src/process/absolutizeSegment.d.ts
1046
+ /**
1047
+ * Returns an absolute segment of a `PathArray` object.
1048
+ *
1049
+ * @param segment the segment object
1050
+ * @param index the segment index
1051
+ * @param lastX the last known X value
1052
+ * @param lastY the last known Y value
1053
+ * @returns the absolute segment
1054
+ */
1055
+ declare const absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment;
1056
+ //#endregion
1057
+ //#region src/process/arcToCubic.d.ts
1058
+ /**
1059
+ * Converts A (arc-to) segments to C (cubic-bezier-to).
1060
+ *
1061
+ * For more information of where this math came from visit:
1062
+ * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
1063
+ *
1064
+ * @param X1 the starting x position
1065
+ * @param Y1 the starting y position
1066
+ * @param RX x-radius of the arc
1067
+ * @param RY y-radius of the arc
1068
+ * @param angle x-axis-rotation of the arc
1069
+ * @param LAF large-arc-flag of the arc
1070
+ * @param SF sweep-flag of the arc
1071
+ * @param X2 the ending x position
1072
+ * @param Y2 the ending y position
1073
+ * @param recursive the parameters needed to split arc into 2 segments
1074
+ * @returns the resulting cubic-bezier segment(s)
1075
+ */
1076
+ 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[];
1077
+ //#endregion
1078
+ //#region src/process/getSVGMatrix.d.ts
1079
+ /**
1080
+ * Returns a transformation matrix to apply to `<path>` elements.
1081
+ *
1082
+ * @see TransformObjectValues
1083
+ *
1084
+ * @param transform the `transformObject`
1085
+ * @returns a new transformation matrix
1086
+ */
1087
+ declare const getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix;
1088
+ //#endregion
1089
+ //#region src/process/iterate.d.ts
1090
+ /**
1091
+ * Iterates over a `PathArray`, executing a callback for each segment.
1092
+ * The callback can:
1093
+ * - Read current position (`x`, `y`)
1094
+ * - Modify the segment (return new segment)
1095
+ * - Stop early (return `false`)
1096
+ *
1097
+ * The iterator maintains accurate current point (`x`, `y`) and subpath start (`mx`, `my`)
1098
+ * while correctly handling relative/absolute commands, including H/V and Z.
1099
+ *
1100
+ * **Important**: If the callback returns a new segment with more coordinates (e.g., Q → C),
1101
+ * the path length may increase, and iteration will continue over new segments.
1102
+ *
1103
+ * @template T - Specific PathArray type (e.g., CurveArray, PolylineArray)
1104
+ * @param path - The source `PathArray` to iterate over
1105
+ * @param iterator - Callback function for each segment
1106
+ * @param iterator.segment - Current path segment
1107
+ * @param iterator.index - Index of current segment
1108
+ * @param iterator.x - Current X position (after applying relative offset)
1109
+ * @param iterator.y - Current Y position (after applying relative offset)
1110
+ * @returns The modified `path` (or original if no changes)
1111
+ *
1112
+ * @example
1113
+ * iterate(path, (seg, i, x, y) => {
1114
+ * if (seg[0] === 'L') return ['C', x, y, seg[1], seg[2], seg[1], seg[2]];
1115
+ * });
1116
+ */
1117
+ declare const iterate: <T extends PathArray>(path: T, iterator: IteratorCallback<T>) => T;
1118
+ //#endregion
1119
+ //#region src/process/lineToCubic.d.ts
1120
+ /**
1121
+ * Converts an L (line-to) segment to C (cubic-bezier).
1122
+ *
1123
+ * @param x1 line start x
1124
+ * @param y1 line start y
1125
+ * @param x2 line end x
1126
+ * @param y2 line end y
1127
+ * @returns the cubic-bezier segment
1128
+ */
1129
+ declare const lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[];
1130
+ //#endregion
1131
+ //#region src/process/normalizeSegment.d.ts
1132
+ /**
1133
+ * Normalizes a single segment of a `pathArray` object.
1134
+ *
1135
+ * @param segment the segment object
1136
+ * @param params the normalization parameters
1137
+ * @returns the normalized segment
1138
+ */
1139
+ declare const normalizeSegment: (segment: PathSegment, params: ParserParams) => NormalSegment;
1140
+ //#endregion
1141
+ //#region src/process/projection2d.d.ts
1142
+ /**
1143
+ * Returns the [x,y] projected coordinates for a given an [x,y] point
1144
+ * and an [x,y,z] perspective origin point.
1145
+ *
1146
+ * Equation found here =>
1147
+ * http://en.wikipedia.org/wiki/3D_projection#Diagram
1148
+ * Details =>
1149
+ * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel
1150
+ *
1151
+ * @param m the transformation matrix
1152
+ * @param point2D the initial [x,y] coordinates
1153
+ * @param origin the [x,y,z] transform origin
1154
+ * @returns the projected [x,y] coordinates
1155
+ */
1156
+ declare const projection2d: (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]) => PointTuple;
1157
+ //#endregion
1158
+ //#region src/process/quadToCubic.d.ts
1159
+ /**
1160
+ * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).
1161
+ *
1162
+ * @param x1 curve start x
1163
+ * @param y1 curve start y
1164
+ * @param qx control point x
1165
+ * @param qy control point y
1166
+ * @param x2 curve end x
1167
+ * @param y2 curve end y
1168
+ * @returns the cubic-bezier segment
1169
+ */
1170
+ declare const quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [number, number, number, number, number, number];
1171
+ //#endregion
1172
+ //#region src/process/relativizeSegment.d.ts
1173
+ /**
1174
+ * Returns a relative segment of a `PathArray` object.
1175
+ *
1176
+ * @param segment the segment object
1177
+ * @param index the segment index
1178
+ * @param lastX the last known X value
1179
+ * @param lastY the last known Y value
1180
+ * @returns the relative segment
1181
+ */
1182
+ declare const relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment;
1183
+ //#endregion
1184
+ //#region src/process/reverseCurve.d.ts
1185
+ /**
1186
+ * Reverses all segments of a `pathArray`
1187
+ * which consists of only C (cubic-bezier) path commands.
1188
+ *
1189
+ * @param path the source `pathArray`
1190
+ * @returns the reversed `pathArray`
1191
+ */
1192
+ declare const reverseCurve: (path: CurveArray) => CurveArray;
1193
+ //#endregion
1194
+ //#region src/process/roundPath.d.ts
1195
+ /**
1196
+ * Rounds the values of a `pathArray` instance to
1197
+ * a specified amount of decimals and returns it.
1198
+ *
1199
+ * @param path the source `pathArray`
1200
+ * @param roundOption the amount of decimals to round numbers to
1201
+ * @returns the resulted `pathArray` with rounded values
1202
+ */
1203
+ declare const roundPath: <T extends PathArray>(path: T, roundOption?: number | "off") => T;
1204
+ //#endregion
1205
+ //#region src/process/roundSegment.d.ts
1206
+ /**
1207
+ * Rounds the numeric values of a path segment to the specified precision.
1208
+ *
1209
+ * @param segment - The path segment to round
1210
+ * @param roundOption - Number of decimal places
1211
+ * @returns The rounded segment
1212
+ */
1213
+ declare const roundSegment: <T extends PathSegment>(segment: T, roundOption: number) => T;
1214
+ //#endregion
1215
+ //#region src/process/segmentToCubic.d.ts
1216
+ /**
1217
+ * Converts any segment to C (cubic-bezier).
1218
+ *
1219
+ * @param segment the source segment
1220
+ * @param params the source segment parameters
1221
+ * @returns the cubic-bezier segment
1222
+ */
1223
+ declare const segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment;
1224
+ //#endregion
1225
+ //#region src/process/shortenSegment.d.ts
1226
+ /**
1227
+ * Shorten a single segment of a `pathArray` object.
1228
+ *
1229
+ * @param segment the `absoluteSegment` object
1230
+ * @param normalSegment the `normalSegment` object
1231
+ * @param params the coordinates of the previous segment
1232
+ * @param prevCommand the path command of the previous segment
1233
+ * @returns the shortened segment
1234
+ */
1235
+ declare const shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment;
1236
+ //#endregion
1237
+ //#region src/morph/fixPath.d.ts
1238
+ /**
1239
+ * Checks a `PathArray` for an unnecessary `Z` segment
1240
+ * and removes it. The `PathArray` is modified in place.
1241
+ * In short, if the segment before `Z` extends to `M`,
1242
+ * the `Z` segment must be removed.
1243
+ *
1244
+ * The `pathInput` must be a single path, without
1245
+ * sub-paths. For multi-path `<path>` elements,
1246
+ * use `splitPath` first and apply this utility on each
1247
+ * sub-path separately.
1248
+ *
1249
+ * @param pathInput the `pathArray` source
1250
+ * @returns void
1251
+ */
1252
+ declare const fixPath: <T extends PathArray>(pathInput: T | string) => void;
1253
+ //#endregion
319
1254
  //#region src/morph/splitCubicSegment.d.ts
320
1255
  /**
321
1256
  * Split a cubic Bézier into two cubics at parameter t [0–1].
@@ -333,6 +1268,81 @@ declare function isPolylineArray(path: PathArray): path is PolylineArray;
333
1268
  */
334
1269
  declare function splitCubicSegment(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, x4: number, y4: number, t: number): [CubicCoordinates, CubicCoordinates];
335
1270
  //#endregion
1271
+ //#region src/morph/equalizeSegments.d.ts
1272
+ /**
1273
+ * Equalizes two paths for morphing (single subpath only).
1274
+ *
1275
+ * @see https://minus-ze.ro/posts/morphing-arbitrary-paths-in-svg/
1276
+ * @param path1 - First path string or PathArray
1277
+ * @param path2 - Second path string or PathArray
1278
+ * @param initialCfg - Equalization options
1279
+ * @returns Tuple of two equalized MorphPathArrays
1280
+ *
1281
+ * @example
1282
+ * ```ts
1283
+ * const [eq1, eq2] = equalizeSegments('M0 0L100 0L50 100Z', 'M0 0L100 0L100 100L0 100Z')
1284
+ * // eq1.length === eq2.length
1285
+ * ```
1286
+ */
1287
+ declare const equalizeSegments: (path1: PathArray | string, path2: PathArray | string, initialCfg?: EqualizationOptions) => [MorphPathArray, MorphPathArray];
1288
+ //#endregion
1289
+ //#region src/morph/equalizePaths.d.ts
1290
+ /**
1291
+ * Equalizes two paths for morphing (single/multi subpath).
1292
+ *
1293
+ * @see https://minus-ze.ro/posts/morphing-arbitrary-paths-in-svg/
1294
+ * @param pathInput1 - First path string or PathArray
1295
+ * @param pathInput2 - Second path string or PathArray
1296
+ * @param initialCfg - Configuration options for equalization
1297
+ * @returns Tuple of two equalized MorphPathArrays
1298
+ *
1299
+ * @example
1300
+ * ```ts
1301
+ * const [eq1, eq2] = equalizePaths('M0 0L100 0L50 100Z', 'M0 0L100 0L100 100L0 100Z')
1302
+ * // eq1.length === eq2.length — ready for morphing
1303
+ * ```
1304
+ */
1305
+ declare const equalizePaths: (pathInput1: string | PathArray, pathInput2: string | PathArray, initialCfg?: {}) => [MorphPathArray, MorphPathArray];
1306
+ //#endregion
1307
+ //#region src/intersect/pathIntersection.d.ts
1308
+ /**
1309
+ * Finds intersection points between two paths.
1310
+ *
1311
+ * @param pathInput1 - First path string or PathArray
1312
+ * @param pathInput2 - Second path string or PathArray
1313
+ * @param justCount - If true, returns the count of intersections; if false, returns the intersection points
1314
+ * @returns The number of intersections (when justCount is true) or an array of IntersectionPoint objects
1315
+ *
1316
+ * @example
1317
+ * ```ts
1318
+ * pathsIntersection('M0 50C0 0,100 0,100 50', 'M50 0C100 0,100 100,50 100', true)
1319
+ * // => 1
1320
+ * pathsIntersection('M0 50C0 0,100 0,100 50', 'M50 0C100 0,100 100,50 100', false)
1321
+ * // => [{ x: 50, y: 25, t1: 0.5, t2: 0.5 }]
1322
+ * ```
1323
+ */
1324
+ declare const pathsIntersection: <T extends string | PathArray>(pathInput1: T, pathInput2: T, justCount?: boolean) => number | IntersectionPoint[];
1325
+ //#endregion
1326
+ //#region src/intersect/boundingBoxIntersect.d.ts
1327
+ /**
1328
+ * Checks if two bounding boxes intersect.
1329
+ *
1330
+ * @param a - First bounding box as [minX, minY, maxX, maxY]
1331
+ * @param b - Second bounding box as [minX, minY, maxX, maxY]
1332
+ * @returns True if the bounding boxes overlap
1333
+ */
1334
+ declare const boundingBoxIntersect: (a: BBoxMaxima, b: BBoxMaxima) => boolean;
1335
+ //#endregion
1336
+ //#region src/intersect/isPointInsideBBox.d.ts
1337
+ /**
1338
+ * Checks if a point is inside a bounding box.
1339
+ *
1340
+ * @param bbox - The bounding box as [minX, minY, maxX, maxY]
1341
+ * @param point - The point as [x, y]
1342
+ * @returns True if the point is inside or on the edge of the bounding box
1343
+ */
1344
+ declare const isPointInsideBBox: (bbox: BBoxMaxima, [x, y]: PointTuple) => boolean;
1345
+ //#endregion
336
1346
  //#region src/main.d.ts
337
1347
  /**
338
1348
  * Creates a new SVGPathCommander instance with the following properties:
@@ -543,6 +1553,8 @@ declare class SVGPathCommander {
543
1553
  static arcTools: {
544
1554
  angleBetween: (v0: Point, v1: Point) => number;
545
1555
  arcLength: (rx: number, ry: number, theta: number) => number;
1556
+ arcLengthAtAngle: (rx: number, ry: number, theta: number) => number;
1557
+ arcLengthBetween: (rx: number, ry: number, from: number, to: number) => number;
546
1558
  arcPoint: (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => PointTuple;
547
1559
  getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => [number, number, number, number];
548
1560
  getArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => number;
@@ -563,12 +1575,16 @@ declare class SVGPathCommander {
563
1575
  };
564
1576
  static bezierTools: {
565
1577
  bezierLength: (derivativeFn: DeriveCallback) => number;
1578
+ bezierLengthAtT: (derivativeFn: DeriveCallback, t: number) => number;
566
1579
  calculateBezier: (derivativeFn: DeriveCallback, t: number) => number;
567
1580
  CBEZIER_MINMAX_EPSILON: number;
568
1581
  computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint;
569
1582
  Cvalues: number[];
570
1583
  deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPoints | DerivedCubicPoints)[];
571
1584
  getBezierLength: (curve: CubicCoordinates | QuadCoordinates) => number;
1585
+ getBezierLengthAtT: (curve: CubicCoordinates | QuadCoordinates, t: number) => number;
1586
+ getBezierPoints: (curve: CubicCoordinates | QuadCoordinates) => CubicPoints | QuadPoints;
1587
+ getTAtBezierLength: (curve: CubicCoordinates | QuadCoordinates, distance: number) => number;
572
1588
  minmaxC: ([v1, cp1, cp2, v2]: [number, number, number, number]) => PointTuple;
573
1589
  minmaxQ: ([v1, cp, v2]: [number, number, number]) => PointTuple;
574
1590
  Tvalues: number[];
@@ -610,26 +1626,23 @@ declare class SVGPathCommander {
610
1626
  getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => [number, number, number, number];
611
1627
  getQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => number;
612
1628
  };
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;
1629
+ static pathToAbsolute: typeof pathToAbsolute;
1630
+ static pathToRelative: typeof pathToRelative;
1631
+ static pathToCurve: typeof pathToCurve;
1632
+ static pathToString: typeof pathToString;
1633
+ static distanceSquareRoot: typeof distanceSquareRoot;
1634
+ static midPoint: typeof midPoint;
1635
+ static rotateVector: typeof rotateVector;
1636
+ static roundTo: typeof roundTo;
1637
+ static parsePathString: typeof parsePathString;
1638
+ static finalizeSegment: typeof finalizeSegment;
626
1639
  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;
1640
+ static isArcCommand: typeof isArcCommand;
1641
+ static isDigit: typeof isDigit;
1642
+ static isDigitStart: typeof isDigitStart;
1643
+ static isMoveCommand: typeof isMoveCommand;
1644
+ static isPathCommand: typeof isPathCommand;
1645
+ static isSpace: typeof isSpace;
633
1646
  static paramsCount: {
634
1647
  a: number;
635
1648
  c: number;
@@ -645,86 +1658,61 @@ declare class SVGPathCommander {
645
1658
  };
646
1659
  static paramsParser: ParserParams;
647
1660
  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;
1661
+ static scanFlag: typeof scanFlag;
1662
+ static scanParam: typeof scanParam;
1663
+ static scanSegment: typeof scanSegment;
1664
+ static skipSpaces: typeof skipSpaces;
652
1665
  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;
1666
+ static fixPath: typeof fixPath;
1667
+ static getClosestPoint: typeof getClosestPoint;
1668
+ static getDrawDirection: typeof getDrawDirection;
1669
+ static getPathArea: typeof getPathArea;
1670
+ static getPathBBox: typeof getPathBBox;
1671
+ static getPointAtLength: typeof getPointAtLength;
1672
+ static getPropertiesAtLength: typeof getPropertiesAtLength;
1673
+ static getPropertiesAtPoint: typeof getPropertiesAtPoint;
1674
+ static getSegmentAtLength: typeof getSegmentAtLength;
1675
+ static getSegmentOfPoint: typeof getSegmentOfPoint;
1676
+ static getTotalLength: typeof getTotalLength;
1677
+ static isAbsoluteArray: typeof isAbsoluteArray;
1678
+ static isCurveArray: typeof isCurveArray;
1679
+ static isPolygonArray: typeof isPolygonArray;
1680
+ static isNormalizedArray: typeof isNormalizedArray;
1681
+ static isPathArray: typeof isPathArray;
1682
+ static isPointInStroke: typeof isPointInStroke;
1683
+ static isRelativeArray: typeof isRelativeArray;
1684
+ static isValidPath: typeof isValidPath;
697
1685
  static samplePolygon: typeof samplePolygon;
698
1686
  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];
1687
+ static shapeToPath: typeof shapeToPath;
1688
+ static shapeToPathArray: typeof shapeToPathArray;
1689
+ static absolutizeSegment: typeof absolutizeSegment;
1690
+ static arcToCubic: typeof arcToCubic;
1691
+ static getSVGMatrix: typeof getSVGMatrix;
1692
+ static iterate: typeof iterate;
1693
+ static lineToCubic: typeof lineToCubic;
1694
+ static normalizePath: typeof normalizePath;
1695
+ static normalizeSegment: typeof normalizeSegment;
1696
+ static optimizePath: typeof optimizePath;
1697
+ static projection2d: typeof projection2d;
1698
+ static quadToCubic: typeof quadToCubic;
1699
+ static relativizeSegment: typeof relativizeSegment;
1700
+ static reverseCurve: typeof reverseCurve;
1701
+ static reversePath: typeof reversePath;
1702
+ static roundPath: typeof roundPath;
1703
+ static roundSegment: typeof roundSegment;
1704
+ static segmentToCubic: typeof segmentToCubic;
1705
+ static shortenSegment: typeof shortenSegment;
1706
+ static splitPath: typeof splitPath;
1707
+ static equalizePaths: typeof equalizePaths;
1708
+ static equalizeSegments: typeof equalizeSegments;
721
1709
  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;
1710
+ static transformPath: typeof transformPath;
1711
+ static isPointInsideBBox: typeof isPointInsideBBox;
1712
+ static pathsIntersection: typeof pathsIntersection;
1713
+ static boundingBoxIntersect: typeof boundingBoxIntersect;
1714
+ static isMultiPath: typeof isMultiPath;
1715
+ static isClosedPath: typeof isClosedPath;
728
1716
  static isPolylineArray: typeof isPolylineArray;
729
1717
  static version: string;
730
1718
  }