svg-path-commander 2.2.2 → 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/util.d.ts CHANGED
@@ -1,16 +1,18 @@
1
1
  /*!
2
- * SVGPathCommander v2.2.2 (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
7
  //#region src/interface.d.ts
8
+ /** The properties of a path segment found by segment lookup utilities. */
8
9
  type SegmentProperties = {
9
10
  segment: PathSegment;
10
11
  index: number;
11
12
  length: number;
12
13
  lengthAtSegment: number;
13
14
  };
15
+ /** The closest point on the path to a given point, with the distance and optional segment. */
14
16
  type PointProperties = {
15
17
  closest: {
16
18
  x: number;
@@ -19,6 +21,7 @@ type PointProperties = {
19
21
  distance: number;
20
22
  segment?: SegmentProperties;
21
23
  };
24
+ /** The attributes of a `<line>` element read by `shapeToPath`. */
22
25
  type LineAttr = {
23
26
  type: "line";
24
27
  x1: number;
@@ -27,11 +30,13 @@ type LineAttr = {
27
30
  y2: number;
28
31
  [key: string]: string | number;
29
32
  };
33
+ /** The attributes of a `<polygon>` or `<polyline>` element read by `shapeToPath`. */
30
34
  type PolyAttr = {
31
35
  type: "polygon" | "polyline";
32
36
  points: string;
33
37
  [key: string]: string | number;
34
38
  };
39
+ /** The attributes of a `<circle>` element read by `shapeToPath`. */
35
40
  type CircleAttr = {
36
41
  type: "circle";
37
42
  cx: number;
@@ -39,6 +44,7 @@ type CircleAttr = {
39
44
  r: number;
40
45
  [key: string]: string | number;
41
46
  };
47
+ /** The attributes of an `<ellipse>` element read by `shapeToPath`. */
42
48
  type EllipseAttr = {
43
49
  type: "ellipse";
44
50
  cx: number;
@@ -47,6 +53,7 @@ type EllipseAttr = {
47
53
  ry?: number;
48
54
  [key: string]: string | number | undefined;
49
55
  };
56
+ /** The attributes of a `<rect>` element read by `shapeToPath`. */
50
57
  type RectAttr = {
51
58
  type: "rect";
52
59
  width: number;
@@ -57,11 +64,13 @@ type RectAttr = {
57
64
  ry?: number;
58
65
  [key: string]: string | number | undefined;
59
66
  };
67
+ /** The attributes of a `<glyph>` element read by `shapeToPath`. */
60
68
  type GlyphAttr = {
61
69
  type: "glyph";
62
70
  d: string;
63
71
  [key: string]: string | number;
64
72
  };
73
+ /** The parameter names read from each SVG shape element by `shapeToPath`. */
65
74
  type ShapeParams = {
66
75
  line: ["x1", "y1", "x2", "y2"];
67
76
  circle: ["cx", "cy", "r"];
@@ -71,6 +80,7 @@ type ShapeParams = {
71
80
  polyline: ["points"];
72
81
  glyph: ["d"];
73
82
  };
83
+ /** The current state tracked by the SVG path string parser. */
74
84
  type ParserParams = {
75
85
  mx: number;
76
86
  my: number;
@@ -83,6 +93,7 @@ type ParserParams = {
83
93
  qx: number | null;
84
94
  qy: number | null;
85
95
  };
96
+ /** A transform function object with translate, rotate, scale, skew and origin. */
86
97
  type TransformObject = {
87
98
  translate: number | number[];
88
99
  rotate: number | number[];
@@ -92,104 +103,191 @@ type TransformObject = {
92
103
  };
93
104
  //#endregion
94
105
  //#region src/types.d.ts
106
+ /** Whitespace character codes recognized by the SVG path string tokenizer. */
95
107
  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;
108
+ /** Character codes of all SVG path command letters. */
96
109
  type PathCommandNumber = 0x6d | 0x7a | 0x6c | 0x68 | 0x76 | 0x63 | 0x73 | 0x71 | 0x74 | 0x61;
110
+ /** Character codes of the decimal digits 0-9. */
97
111
  type DigitNumber = 0x30 | 0x31 | 0x32 | 0x33 | 0x34 | 0x35 | 0x36 | 0x37 | 0x38 | 0x39;
112
+ /** The absolute moveto command letter. */
98
113
  type MCommand = "M";
114
+ /** The relative moveto command letter. */
99
115
  type mCommand = "m";
116
+ /** The absolute lineto command letter. */
100
117
  type LCommand = "L";
118
+ /** The relative lineto command letter. */
101
119
  type lCommand = "l";
120
+ /** The absolute vertical lineto command letter. */
102
121
  type VCommand = "V";
122
+ /** The relative vertical lineto command letter. */
103
123
  type vCommand = "v";
124
+ /** The absolute horizontal lineto command letter. */
104
125
  type HCommand = "H";
126
+ /** The relative horizontal lineto command letter. */
105
127
  type hCommand = "h";
128
+ /** The absolute closepath command letter. */
106
129
  type ZCommand = "Z";
130
+ /** The relative closepath command letter. */
107
131
  type zCommand = "z";
132
+ /** The absolute cubic Bezier command letter. */
108
133
  type CCommand = "C";
134
+ /** The relative cubic Bezier command letter. */
109
135
  type cCommand = "c";
136
+ /** The absolute smooth cubic Bezier command letter. */
110
137
  type SCommand = "S";
138
+ /** The relative smooth cubic Bezier command letter. */
111
139
  type sCommand = "s";
140
+ /** The absolute quadratic Bezier command letter. */
112
141
  type QCommand = "Q";
142
+ /** The relative quadratic Bezier command letter. */
113
143
  type qCommand = "q";
144
+ /** The absolute smooth quadratic Bezier command letter. */
114
145
  type TCommand = "T";
146
+ /** The relative smooth quadratic Bezier command letter. */
115
147
  type tCommand = "t";
148
+ /** The absolute elliptical arc command letter. */
116
149
  type ACommand = "A";
150
+ /** The relative elliptical arc command letter. */
117
151
  type aCommand = "a";
152
+ /** The union of all absolute path command letters. */
118
153
  type AbsoluteCommand = MCommand | LCommand | VCommand | HCommand | ZCommand | CCommand | SCommand | QCommand | TCommand | ACommand;
154
+ /** The union of all relative path command letters. */
119
155
  type RelativeCommand = mCommand | lCommand | vCommand | hCommand | zCommand | cCommand | sCommand | qCommand | tCommand | aCommand;
156
+ /** Any SVG path command letter, absolute or relative. */
120
157
  type PathCommand = AbsoluteCommand | RelativeCommand;
158
+ /** The absolute moveto segment tuple `[M, x, y]`. */
121
159
  type MSegment = [MCommand, number, number];
160
+ /** The relative moveto segment tuple `[m, dx, dy]`. */
122
161
  type mSegment = [mCommand, number, number];
162
+ /** The moveto segment, absolute or relative. */
123
163
  type MoveSegment = MSegment | mSegment;
164
+ /** The absolute lineto segment tuple `[L, x, y]`. */
124
165
  type LSegment = [LCommand, number, number];
166
+ /** The relative lineto segment tuple `[l, dx, dy]`. */
125
167
  type lSegment = [lCommand, number, number];
168
+ /** The lineto segment, absolute or relative. */
126
169
  type LineSegment = LSegment | lSegment;
170
+ /** The absolute vertical lineto segment tuple `[V, y]`. */
127
171
  type VSegment = [VCommand, number];
172
+ /** The relative vertical lineto segment tuple `[v, dy]`. */
128
173
  type vSegment = [vCommand, number];
174
+ /** The vertical lineto segment, absolute or relative. */
129
175
  type VertLineSegment = vSegment | VSegment;
176
+ /** The absolute horizontal lineto segment tuple `[H, x]`. */
130
177
  type HSegment = [HCommand, number];
178
+ /** The relative horizontal lineto segment tuple `[h, dx]`. */
131
179
  type hSegment = [hCommand, number];
180
+ /** The horizontal lineto segment, absolute or relative. */
132
181
  type HorLineSegment = HSegment | hSegment;
182
+ /** The absolute closepath segment tuple `[Z]`. */
133
183
  type ZSegment = [ZCommand];
184
+ /** The relative closepath segment tuple `[z]`. */
134
185
  type zSegment = [zCommand];
186
+ /** The closepath segment, absolute or relative. */
135
187
  type CloseSegment = ZSegment | zSegment;
188
+ /** The absolute cubic Bezier segment tuple `[C, x1, y1, x2, y2, x, y]`. */
136
189
  type CSegment = [CCommand, number, number, number, number, number, number];
190
+ /** The relative cubic Bezier segment tuple `[c, dx1, dy1, dx2, dy2, dx, dy]`. */
137
191
  type cSegment = [cCommand, number, number, number, number, number, number];
192
+ /** The cubic Bezier segment, absolute or relative. */
138
193
  type CubicSegment = CSegment | cSegment;
194
+ /** The absolute smooth cubic Bezier segment tuple `[S, x2, y2, x, y]`. */
139
195
  type SSegment = [SCommand, number, number, number, number];
196
+ /** The relative smooth cubic Bezier segment tuple `[s, dx2, dy2, dx, dy]`. */
140
197
  type sSegment = [sCommand, number, number, number, number];
198
+ /** The smooth cubic Bezier segment, absolute or relative. */
141
199
  type ShortCubicSegment = SSegment | sSegment;
200
+ /** The absolute quadratic Bezier segment tuple `[Q, x1, y1, x, y]`. */
142
201
  type QSegment = [QCommand, number, number, number, number];
202
+ /** The relative quadratic Bezier segment tuple `[q, dx1, dy1, dx, dy]`. */
143
203
  type qSegment = [qCommand, number, number, number, number];
204
+ /** The quadratic Bezier segment, absolute or relative. */
144
205
  type QuadSegment = QSegment | qSegment;
206
+ /** The absolute smooth quadratic Bezier segment tuple `[T, x, y]`. */
145
207
  type TSegment = [TCommand, number, number];
208
+ /** The relative smooth quadratic Bezier segment tuple `[t, dx, dy]`. */
146
209
  type tSegment = [tCommand, number, number];
210
+ /** The smooth quadratic Bezier segment, absolute or relative. */
147
211
  type ShortQuadSegment = TSegment | tSegment;
212
+ /** The absolute elliptical arc segment tuple `[A, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y]`. */
148
213
  type ASegment = [ACommand, number, number, number, number, number, number, number];
214
+ /** The relative elliptical arc segment tuple `[a, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, dx, dy]`. */
149
215
  type aSegment = [aCommand, number, number, number, number, number, number, number];
216
+ /** The elliptical arc segment, absolute or relative. */
150
217
  type ArcSegment = ASegment | aSegment;
218
+ /** Any SVG path command segment. */
151
219
  type PathSegment = MoveSegment | LineSegment | VertLineSegment | HorLineSegment | CloseSegment | CubicSegment | ShortCubicSegment | QuadSegment | ShortQuadSegment | ArcSegment;
220
+ /** Any shorthand or single-coordinate path segment. */
152
221
  type ShortSegment = VertLineSegment | HorLineSegment | ShortCubicSegment | ShortQuadSegment | CloseSegment;
222
+ /** Any absolute path command segment. */
153
223
  type AbsoluteSegment = MSegment | LSegment | VSegment | HSegment | CSegment | SSegment | QSegment | TSegment | ASegment | ZSegment;
224
+ /** Any relative path command segment. */
154
225
  type RelativeSegment = mSegment | lSegment | vSegment | hSegment | cSegment | sSegment | qSegment | tSegment | aSegment | zSegment;
226
+ /** The path segments used by the normalized form (no shorthand commands). */
155
227
  type NormalSegment = MSegment | LSegment | CSegment | QSegment | ASegment | ZSegment;
228
+ /** A parsed SVG path string as an array of path segments. */
156
229
  type PathArray = [MSegment | mSegment, ...PathSegment[]];
230
+ /** A `PathArray` with only absolute path segments. */
157
231
  type AbsoluteArray = [MSegment, ...AbsoluteSegment[]];
232
+ /** A `PathArray` with only relative path segments. */
158
233
  type RelativeArray = [MSegment, ...RelativeSegment[]];
234
+ /** A `PathArray` with only normalized segments (no shorthand commands). */
159
235
  type NormalArray = [MSegment, ...NormalSegment[]];
236
+ /** A `PathArray` with only moveto and cubic Bezier segments. */
160
237
  type CurveArray = [MSegment, ...CSegment[]];
238
+ /** A `CurveArray` ending with a closepath segment. */
161
239
  type ClosedCurveArray = [MSegment, ...CSegment[], ZSegment];
240
+ /** A `PathArray` describing a closed polygon (moveto, lineto and closepath). */
162
241
  type PolygonArray = [MSegment, ...LSegment[], ZSegment];
242
+ /** A `PathArray` describing an open polyline (moveto and lineto). */
163
243
  type PolylineArray = [MSegment, ...LSegment[]];
244
+ /** The `PathArray` shapes supported by path morphing. */
164
245
  type MorphPathArray = PolygonArray | PolylineArray | CurveArray | ClosedCurveArray;
246
+ /** The SVG element types that can be converted to a path. */
165
247
  type ShapeTypes = SVGPolylineElement | SVGPolygonElement | SVGLineElement | SVGEllipseElement | SVGCircleElement | SVGRectElement;
248
+ /** The shape attributes mapped to each supported SVG element type. */
166
249
  type ShapeOps = LineAttr | PolyAttr | PolyAttr | EllipseAttr | CircleAttr | RectAttr | GlyphAttr;
250
+ /** A `TransformObject` with a required 3D origin. */
167
251
  type TransformObjectValues = Partial<TransformObject> & {
168
252
  origin: [number, number, number];
169
253
  };
254
+ /** A 2D point with `x` and `y` coordinates. */
170
255
  type Point = {
171
256
  x: number;
172
257
  y: number;
173
258
  };
259
+ /** A 2D point as a tuple `[x, y]`. */
174
260
  type PointTuple = [number, number];
261
+ /** A `Point` with a `t` parameter (a point on a curve at ratio `t`). */
175
262
  type DerivedPoint = Point & {
176
263
  t: number;
177
264
  };
265
+ /** The six points of a quadratic Bezier curve (on-curve and off-curve control points). */
178
266
  type QuadPoints = [Point, Point, Point, Point, Point, Point];
267
+ /** The eight points of a cubic Bezier curve (on-curve and off-curve control points). */
179
268
  type CubicPoints = [Point, Point, Point, Point, Point, Point, Point, Point];
269
+ /** The six derived points of a quadratic Bezier curve, each with a `t` parameter. */
180
270
  type DerivedQuadPoints = [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];
271
+ /** The eight derived points of a cubic Bezier curve, each with a `t` parameter. */
181
272
  type DerivedCubicPoints = [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];
273
+ /** The six coordinates of a quadratic Bezier segment `[x1, y1, cx, cy, x, y]`. */
182
274
  type QuadCoordinates = [number, number, number, number, number, number];
275
+ /** The eight coordinates of a cubic Bezier segment. */
183
276
  type CubicCoordinates = [number, number, number, number, number, number, number, number];
277
+ /** A function that derives a point on a curve at a given `t` ratio. */
184
278
  type DeriveCallback = (t: number) => Point;
279
+ /** A callback invoked for each segment while iterating over a `PathArray`. */
185
280
  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;
281
+ /** The bounding box extremes `[minX, minY, maxX, maxY]`. */
186
282
  type BBoxMaxima = [minX: number, minY: number, maxX: number, maxY: number];
283
+ /** An intersection point between two curves, including both `t` ratios. */
187
284
  type IntersectionPoint = {
188
285
  x: number;
189
286
  y: number;
190
287
  t1: number;
191
288
  t2: number;
192
289
  };
290
+ /** Options for equalizing two paths for morphing. */
193
291
  interface EqualizationOptions {
194
292
  /** @default "auto" */
195
293
  mode?: "curve" | "auto";
@@ -324,6 +422,7 @@ declare const getPointAtArcLength: (x1: number, y1: number, RX: number, RY: numb
324
422
  * @returns the extrema of the Arc segment
325
423
  */
326
424
  declare const getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => [number, number, number, number];
425
+ /** The tools for elliptical arc computation. */
327
426
  declare const arcTools: {
328
427
  angleBetween: typeof angleBetween;
329
428
  arcLength: typeof arcLength;
@@ -347,7 +446,20 @@ declare const deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPo
347
446
  * @param t
348
447
  */
349
448
  declare const computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint;
449
+ /**
450
+ * Calculates the speed (derivative magnitude) of a Bezier curve at parameter `t`.
451
+ *
452
+ * @param derivativeFn the curve derivative function
453
+ * @param t the sampled point ratio in `[0-1]`
454
+ * @returns the curve speed at parameter `t`
455
+ */
350
456
  declare const calculateBezier: (derivativeFn: DeriveCallback, t: number) => number;
457
+ /**
458
+ * Returns the total arc length of a Bezier segment.
459
+ *
460
+ * @param derivativeFn the curve derivative function
461
+ * @returns the total arc length
462
+ */
351
463
  declare const bezierLength: (derivativeFn: DeriveCallback) => number;
352
464
  /**
353
465
  * Returns the arc length of a Bezier segment from its start point
@@ -398,6 +510,7 @@ declare const minmaxQ: ([v1, cp, v2]: [number, number, number]) => PointTuple;
398
510
  * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127
399
511
  */
400
512
  declare const minmaxC: ([v1, cp1, cp2, v2]: [number, number, number, number]) => PointTuple;
513
+ /** The tools for Bezier curve computation. */
401
514
  declare const bezierTools: {
402
515
  bezierLength: typeof bezierLength;
403
516
  bezierLengthAtT: typeof bezierLengthAtT;
@@ -481,6 +594,7 @@ declare const getPointAtCubicLength: (x1: number, y1: number, c1x: number, c1y:
481
594
  * @returns the extrema of the CubicBezier segment
482
595
  */
483
596
  declare const getCubicBBox: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => BBoxMaxima;
597
+ /** The tools for cubic Bezier computation. */
484
598
  declare const cubicTools: {
485
599
  getCubicBBox: typeof getCubicBBox;
486
600
  getCubicLength: typeof getCubicLength;
@@ -523,6 +637,7 @@ declare const getPointAtLineLength: (x1: number, y1: number, x2: number, y2: num
523
637
  * @returns the bounding box for line segments
524
638
  */
525
639
  declare const getLineBBox: (x1: number, y1: number, x2: number, y2: number) => [number, number, number, number];
640
+ /** The tools for line segment computation. */
526
641
  declare const lineTools: {
527
642
  getLineBBox: typeof getLineBBox;
528
643
  getLineLength: typeof getLineLength;
@@ -590,6 +705,7 @@ declare const getPointAtQuadLength: (x1: number, y1: number, cx: number, cy: num
590
705
  * @returns the extrema of the QuadraticBezier segment
591
706
  */
592
707
  declare const getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => [number, number, number, number];
708
+ /** The tools for quadratic Bezier computation. */
593
709
  declare const quadTools: {
594
710
  getPointAtQuadLength: typeof getPointAtQuadLength;
595
711
  getPointAtQuadSegmentLength: typeof getPointAtQuadSegmentLength;
@@ -626,6 +742,7 @@ declare const polygonLength: (polygon: PointTuple[]) => number;
626
742
  * @returns [x, y] centroid
627
743
  */
628
744
  declare const polygonCentroid: (polygon: PointTuple[]) => PointTuple;
745
+ /** The tools for polygon computation. */
629
746
  declare const polygonTools: {
630
747
  polygonArea: typeof polygonArea;
631
748
  polygonLength: typeof polygonLength;
@@ -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":";;;;;;;KAEY;EACV,SAAS;EACT;EACA;EACA;;KAKU;EACV;IACE;IACA;;EAEF;EACA,UAAU;;KAGA;EACV;EACA;EACA;EACA;EACA;GACC;;KAES;EACV;EACA;GACC;;KAES;EACV;EACA;EACA;EACA;GACC;;KAES;EACV;EACA;EACA;EACA;EACA;GACC;;KAES;EACV;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;KAES;EACV;EACA;GACC;;KAGS;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;KAmBU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAsBU;EACV;EACA;EACA;EACA;EACA;;;;KCpHU;KA6BA;KAYA;KAaA;KACA;KAEA;KACA;KAEA;KACA;KAEA;KACA;KAEA;KACA;KAEA;KACA;KAEA;KACA;KAEA;KACA;KAEA;KACA;KAEA;KACA;KAEA,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA;KAEQ,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA;KAEQ,cAAc,kBAAkB;KAEhC,YAAY;KACZ,YAAY;KACZ,cAAc,WAAW;KAEzB,YAAY;KACZ,YAAY;KACZ,cAAc,WAAW;KAEzB,YAAY;KACZ,YAAY;KACZ,kBAAkB,WAAW;KAE7B,YAAY;KACZ,YAAY;KACZ,iBAAiB,WAAW;KAE5B,YAAY;KACZ,YAAY;KACZ,eAAe,WAAW;KAE1B,YACV;KAQU,YACV;KAQU,eAAe,WAAW;KAE1B,YAAY;KACZ,YAAY;KACZ,oBAAoB,WAAW;KAE/B,YAAY;KACZ,YAAY;KACZ,cAAc,WAAW;KAEzB,YAAY;KACZ,YAAY;KACZ,mBAAmB,WAAW;KAE9B,YACV;KASU,YACV;KASU,aAAa,WAAW;KAExB,cACR,cACA,cACA,kBACA,iBACA,eACA,eACA,oBACA,cACA,mBACA;KAEQ,eACR,kBACA,iBACA,oBACA,mBACA;KAEQ,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA;KAEQ,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA;KAEQ,gBACR,WACA,WACA,WACA,WACA,WACA;KAEQ,aAAa,WAAW,aAAa;KACrC,iBAAiB,aAAa;KAC9B,iBAAiB,aAAa;KAC9B,eAAe,aAAa;KAC5B,cAAc,aAAa;KAC3B,oBAAoB,aAAa,YAAY;KAC7C,gBAAgB,aAAa,YAAY;KACzC,iBAAiB,aAAa;KAC9B,iBACR,eACA,gBACA,aACA;KAEQ,aACR,qBACA,oBACA,iBACA,oBACA,mBACA;KAWQ,WACR,WACA,WACA,WACA,cACA,aACA,WACA;KAEQ,wBAAwB,QAAQ;EAC1C;;KAGU;EACV;EACA;;KAGU;KAEA,eAAe;EAAU;;KACzB,cAAc,OAAO,OAAO,OAAO,OAAO,OAAO;KACjD,eACV,OACA,OACA,OACA,OACA,OACA,OACA,OACA;KAEU,qBACV,cACA,cACA,cACA,cACA,cACA;KAEU,sBACV,cACA,cACA,cACA,cACA,cACA,cACA,cACA;KAEU;KACA;KAuBA,kBAAkB,cAAc;KAEhC,iBACV,UAAU,WACV,gBAAgB,eAEhB,SAAS,cAAc,EAAE,IACzB,eACA,eACA,kBACG,cAAc,EAAE;KAET,cACV,cACA,cACA,cACA;KAGU;EACV;EACA;EACA;EACA;;UAee;;EAEf;EACA;EACA;EACA;EACA;EACA;;;;;;;;;;;;;;;cC7XI,mBAAgB,YAAc,YAAY;;;;;;;;;cAoC1C,mBAAgB,YACV,YACA,cACE;;;;;;;;cAaR,YAAS,YAAc,YAAY;;;;;;;;;;;cAcnC,WAAQ,YACF,YACA,YACA,YACA,eACG,kBAEZ;;;;;;;cAkBG,eAAY,IAAQ,OAAK,IAAM;;;;;;;;;;;;;;;;cAwB/B,cAAW,YACL,YACA,YACA,YACA,eACG,aACF,YACD,WACD;EAGT;EACA;EACA;EACA;EACA;IAAU;IAAW;;;;;;;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W;;;;;;;;;;;;cCKD,iBAAc,SAChB,iBAAe,eACT,eAAa,QACpB,cAAY,aACP,gBACZ;;;;;;;;;;;;;;;;;cCNU,UAAW,UAAU,WAAS,WAAa;;;;;;;;;;;;;;;;;iBCDxC,kBACd,YACA,YACA,YACA,YACA,YACA,YACA,YACA,YACA,aACE,kBAAkB;;;;;;;;;;;;;;;;;;cCkBT,mBAAgB,OACpB,oBAAkB,OAClB,oBAAkB,aACb,yBACV,gBAAgB;;;;;;;;;;;;;;;;;;cCdP,gBAAa,qBACH,WAAS,qBACT,WAAS,qBAE5B,gBAAgB;;;;;;;;;;;;;;;;;;;cCjBP,oBAAqB,mBAAmB,WAAS,YAChD,GAAC,YACD,GAAC,iCAEH;;;;;;;;;;cCjBC,uBAAoB,GAAO,YAAU,GAAK;;;;;;;;;;cCF1C,oBAAiB,MACtB,aAAU,GAAA,IACR"}
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;EACV,SAAS;EACT;EACA;EACA;;;KAMU;EACV;IACE;IACA;;EAEF;EACA,UAAU;;;KAIA;EACV;EACA;EACA;EACA;EACA;GACC;;;KAGS;EACV;EACA;GACC;;;KAGS;EACV;EACA;EACA;EACA;GACC;;;KAGS;EACV;EACA;EACA;EACA;EACA;GACC;;;KAGS;EACV;EACA;EACA;EACA;EACA;EACA;EACA;GACC;;;KAGS;EACV;EACA;GACC;;;KAIS;EACV;EACA;EACA;EACA;EACA;EACA;EACA;;;KAsBU;EACV;EACA;EACA;E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kBAAkB;;;;;;;;;;;;;;;;;;cCkBT,mBAAgB,OACpB,oBAAkB,OAClB,oBAAkB,aACb,yBACV,gBAAgB;;;;;;;;;;;;;;;;;;cCdP,gBAAa,qBACH,WAAS,qBACT,WAAS,qBAE5B,gBAAgB;;;;;;;;;;;;;;;;;;;cCjBP,oBAAqB,mBAAmB,WAAS,YAChD,GAAC,YACD,GAAC,iCAEH;;;;;;;;;;cCjBC,uBAAoB,GAAO,YAAU,GAAK;;;;;;;;;;cCF1C,oBAAiB,MACtB,aAAU,GAAA,IACR"}
package/dist/util.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * SVGPathCommander v2.2.2 (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
  */
@@ -97,6 +97,7 @@ const getLineBBox = (x1, y1, x2, y2) => {
97
97
  max(y1, y2)
98
98
  ];
99
99
  };
100
+ /** The tools for line segment computation. */
100
101
  const lineTools = {
101
102
  getLineBBox,
102
103
  getLineLength,
@@ -134,6 +135,7 @@ const Tvalues = [
134
135
  -.9951872199970213,
135
136
  .9951872199970213
136
137
  ];
138
+ /** The weights for the 32-point Gauss-Legendre quadrature. */
137
139
  const Cvalues = [
138
140
  .12793819534675216,
139
141
  .12793819534675216,
@@ -234,11 +236,24 @@ const computeBezier = (points, t) => {
234
236
  t
235
237
  };
236
238
  };
239
+ /**
240
+ * Calculates the speed (derivative magnitude) of a Bezier curve at parameter `t`.
241
+ *
242
+ * @param derivativeFn the curve derivative function
243
+ * @param t the sampled point ratio in `[0-1]`
244
+ * @returns the curve speed at parameter `t`
245
+ */
237
246
  const calculateBezier = (derivativeFn, t) => {
238
247
  const d = derivativeFn(t);
239
248
  const l = d.x * d.x + d.y * d.y;
240
249
  return Math.sqrt(l);
241
250
  };
251
+ /**
252
+ * Returns the total arc length of a Bezier segment.
253
+ *
254
+ * @param derivativeFn the curve derivative function
255
+ * @returns the total arc length
256
+ */
242
257
  const bezierLength = (derivativeFn) => {
243
258
  return bezierLengthAtT(derivativeFn, 1);
244
259
  };
@@ -320,6 +335,7 @@ const getBezierLength = (curve) => {
320
335
  return computeBezier(dpoints[0], t);
321
336
  });
322
337
  };
338
+ /** The precision threshold to consider a cubic polynomial as quadratic. */
323
339
  const CBEZIER_MINMAX_EPSILON = 1e-8;
324
340
  /**
325
341
  * Returns the most extreme points in a Quad Bezier segment.
@@ -360,6 +376,7 @@ const minmaxC = ([v1, cp1, cp2, v2]) => {
360
376
  }
361
377
  return [min, max];
362
378
  };
379
+ /** The tools for Bezier curve computation. */
363
380
  const bezierTools = {
364
381
  bezierLength,
365
382
  bezierLengthAtT,
@@ -703,6 +720,7 @@ const getArcBBox = (x1, y1, RX, RY, angle, LAF, SF, x, y) => {
703
720
  yMax
704
721
  ];
705
722
  };
723
+ /** The tools for elliptical arc computation. */
706
724
  const arcTools = {
707
725
  angleBetween,
708
726
  arcLength,
@@ -839,6 +857,7 @@ const getCubicBBox = (x1, y1, c1x, c1y, c2x, c2y, x2, y2) => {
839
857
  cyMinMax[1]
840
858
  ];
841
859
  };
860
+ /** The tools for cubic Bezier computation. */
842
861
  const cubicTools = {
843
862
  getCubicBBox,
844
863
  getCubicLength,
@@ -959,6 +978,7 @@ const getQuadBBox = (x1, y1, cx, cy, x2, y2) => {
959
978
  cyMinMax[1]
960
979
  ];
961
980
  };
981
+ /** The tools for quadratic Bezier computation. */
962
982
  const quadTools = {
963
983
  getPointAtQuadLength,
964
984
  getPointAtQuadSegmentLength,
@@ -1022,6 +1042,7 @@ const polygonCentroid = (polygon) => {
1022
1042
  const count = polygon.length;
1023
1043
  return [sumX / count, sumY / count];
1024
1044
  };
1045
+ /** The tools for polygon computation. */
1025
1046
  const polygonTools = {
1026
1047
  polygonArea,
1027
1048
  polygonLength,
@@ -4221,6 +4242,14 @@ const intersect = (x1, y1, x2, y2, x3, y3, x4, y4) => {
4221
4242
  y: py
4222
4243
  };
4223
4244
  };
4245
+ /**
4246
+ * Returns the intersection point(s) of two cubic Bezier curves.
4247
+ *
4248
+ * @param bez1 the coordinates of the first cubic Bezier segment
4249
+ * @param bez2 the coordinates of the second cubic Bezier segment
4250
+ * @param config optional intersection options
4251
+ * @returns the intersection points, or `undefined` if the curves do not intersect
4252
+ */
4224
4253
  const interHelper = (bez1, bez2, config) => {
4225
4254
  const bbox1 = getCubicBBox(...bez1);
4226
4255
  const bbox2 = getCubicBBox(...bez2);