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/index.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 bounding box of a path, equivalent to the native `getBBox()` result. */
74
84
  type PathBBox = {
75
85
  width: number;
76
86
  height: number;
@@ -82,6 +92,7 @@ type PathBBox = {
82
92
  cy: number;
83
93
  cz: number;
84
94
  };
95
+ /** The minimum and maximum points of a segment bounding box. */
85
96
  type SegmentLimits = {
86
97
  min: {
87
98
  x: number;
@@ -92,6 +103,7 @@ type SegmentLimits = {
92
103
  y: number;
93
104
  };
94
105
  };
106
+ /** The current state tracked by the SVG path string parser. */
95
107
  type ParserParams = {
96
108
  mx: number;
97
109
  my: number;
@@ -104,6 +116,7 @@ type ParserParams = {
104
116
  qx: number | null;
105
117
  qy: number | null;
106
118
  };
119
+ /** The result of a length computation factory: length, point and segment limits. */
107
120
  type LengthFactory = {
108
121
  length: number;
109
122
  point: {
@@ -119,16 +132,19 @@ type LengthFactory = {
119
132
  y: number;
120
133
  };
121
134
  };
135
+ /** The `SVGPathCommander` instance options. */
122
136
  type Options = {
123
137
  round: "off" | number;
124
138
  origin: number[];
125
139
  };
140
+ /** A path segment and its transformation context (command letter and coordinates). */
126
141
  type PathTransform = {
127
142
  s: PathSegment;
128
143
  c: string;
129
144
  x: number;
130
145
  y: number;
131
146
  };
147
+ /** A transform function object with translate, rotate, scale, skew and origin. */
132
148
  type TransformObject = {
133
149
  translate: number | number[];
134
150
  rotate: number | number[];
@@ -136,120 +152,214 @@ type TransformObject = {
136
152
  skew: number | number[];
137
153
  origin: number[];
138
154
  };
155
+ /** The keys of a `TransformObject`. */
139
156
  type TransformProps = keyof TransformObject;
157
+ /** The entries of a `TransformObject` (key-value pairs). */
140
158
  type TransformEntries = [TransformProps, TransformObject[TransformProps]][];
141
159
  //#endregion
142
160
  //#region src/types.d.ts
161
+ /** Whitespace character codes recognized by the SVG path string tokenizer. */
143
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. */
144
164
  type PathCommandNumber = 0x6d | 0x7a | 0x6c | 0x68 | 0x76 | 0x63 | 0x73 | 0x71 | 0x74 | 0x61;
165
+ /** Character codes of the decimal digits 0-9. */
145
166
  type DigitNumber = 0x30 | 0x31 | 0x32 | 0x33 | 0x34 | 0x35 | 0x36 | 0x37 | 0x38 | 0x39;
167
+ /** The absolute moveto command letter. */
146
168
  type MCommand = "M";
169
+ /** The relative moveto command letter. */
147
170
  type mCommand = "m";
171
+ /** The absolute lineto command letter. */
148
172
  type LCommand = "L";
173
+ /** The relative lineto command letter. */
149
174
  type lCommand = "l";
175
+ /** The absolute vertical lineto command letter. */
150
176
  type VCommand = "V";
177
+ /** The relative vertical lineto command letter. */
151
178
  type vCommand = "v";
179
+ /** The absolute horizontal lineto command letter. */
152
180
  type HCommand = "H";
181
+ /** The relative horizontal lineto command letter. */
153
182
  type hCommand = "h";
183
+ /** The absolute closepath command letter. */
154
184
  type ZCommand = "Z";
185
+ /** The relative closepath command letter. */
155
186
  type zCommand = "z";
187
+ /** The absolute cubic Bezier command letter. */
156
188
  type CCommand = "C";
189
+ /** The relative cubic Bezier command letter. */
157
190
  type cCommand = "c";
191
+ /** The absolute smooth cubic Bezier command letter. */
158
192
  type SCommand = "S";
193
+ /** The relative smooth cubic Bezier command letter. */
159
194
  type sCommand = "s";
195
+ /** The absolute quadratic Bezier command letter. */
160
196
  type QCommand = "Q";
197
+ /** The relative quadratic Bezier command letter. */
161
198
  type qCommand = "q";
199
+ /** The absolute smooth quadratic Bezier command letter. */
162
200
  type TCommand = "T";
201
+ /** The relative smooth quadratic Bezier command letter. */
163
202
  type tCommand = "t";
203
+ /** The absolute elliptical arc command letter. */
164
204
  type ACommand = "A";
205
+ /** The relative elliptical arc command letter. */
165
206
  type aCommand = "a";
207
+ /** The union of all absolute path command letters. */
166
208
  type AbsoluteCommand = MCommand | LCommand | VCommand | HCommand | ZCommand | CCommand | SCommand | QCommand | TCommand | ACommand;
209
+ /** The union of all relative path command letters. */
167
210
  type RelativeCommand = mCommand | lCommand | vCommand | hCommand | zCommand | cCommand | sCommand | qCommand | tCommand | aCommand;
211
+ /** Any SVG path command letter, absolute or relative. */
168
212
  type PathCommand = AbsoluteCommand | RelativeCommand;
213
+ /** The absolute moveto segment tuple `[M, x, y]`. */
169
214
  type MSegment = [MCommand, number, number];
215
+ /** The relative moveto segment tuple `[m, dx, dy]`. */
170
216
  type mSegment = [mCommand, number, number];
217
+ /** The moveto segment, absolute or relative. */
171
218
  type MoveSegment = MSegment | mSegment;
219
+ /** The absolute lineto segment tuple `[L, x, y]`. */
172
220
  type LSegment = [LCommand, number, number];
221
+ /** The relative lineto segment tuple `[l, dx, dy]`. */
173
222
  type lSegment = [lCommand, number, number];
223
+ /** The lineto segment, absolute or relative. */
174
224
  type LineSegment = LSegment | lSegment;
225
+ /** The absolute vertical lineto segment tuple `[V, y]`. */
175
226
  type VSegment = [VCommand, number];
227
+ /** The relative vertical lineto segment tuple `[v, dy]`. */
176
228
  type vSegment = [vCommand, number];
229
+ /** The vertical lineto segment, absolute or relative. */
177
230
  type VertLineSegment = vSegment | VSegment;
231
+ /** The absolute horizontal lineto segment tuple `[H, x]`. */
178
232
  type HSegment = [HCommand, number];
233
+ /** The relative horizontal lineto segment tuple `[h, dx]`. */
179
234
  type hSegment = [hCommand, number];
235
+ /** The horizontal lineto segment, absolute or relative. */
180
236
  type HorLineSegment = HSegment | hSegment;
237
+ /** The absolute closepath segment tuple `[Z]`. */
181
238
  type ZSegment = [ZCommand];
239
+ /** The relative closepath segment tuple `[z]`. */
182
240
  type zSegment = [zCommand];
241
+ /** The closepath segment, absolute or relative. */
183
242
  type CloseSegment = ZSegment | zSegment;
243
+ /** The absolute cubic Bezier segment tuple `[C, x1, y1, x2, y2, x, y]`. */
184
244
  type CSegment = [CCommand, number, number, number, number, number, number];
245
+ /** The relative cubic Bezier segment tuple `[c, dx1, dy1, dx2, dy2, dx, dy]`. */
185
246
  type cSegment = [cCommand, number, number, number, number, number, number];
247
+ /** The cubic Bezier segment, absolute or relative. */
186
248
  type CubicSegment = CSegment | cSegment;
249
+ /** The absolute smooth cubic Bezier segment tuple `[S, x2, y2, x, y]`. */
187
250
  type SSegment = [SCommand, number, number, number, number];
251
+ /** The relative smooth cubic Bezier segment tuple `[s, dx2, dy2, dx, dy]`. */
188
252
  type sSegment = [sCommand, number, number, number, number];
253
+ /** The smooth cubic Bezier segment, absolute or relative. */
189
254
  type ShortCubicSegment = SSegment | sSegment;
255
+ /** The absolute quadratic Bezier segment tuple `[Q, x1, y1, x, y]`. */
190
256
  type QSegment = [QCommand, number, number, number, number];
257
+ /** The relative quadratic Bezier segment tuple `[q, dx1, dy1, dx, dy]`. */
191
258
  type qSegment = [qCommand, number, number, number, number];
259
+ /** The quadratic Bezier segment, absolute or relative. */
192
260
  type QuadSegment = QSegment | qSegment;
261
+ /** The absolute smooth quadratic Bezier segment tuple `[T, x, y]`. */
193
262
  type TSegment = [TCommand, number, number];
263
+ /** The relative smooth quadratic Bezier segment tuple `[t, dx, dy]`. */
194
264
  type tSegment = [tCommand, number, number];
265
+ /** The smooth quadratic Bezier segment, absolute or relative. */
195
266
  type ShortQuadSegment = TSegment | tSegment;
267
+ /** The absolute elliptical arc segment tuple `[A, rx, ry, xAxisRotation, largeArcFlag, sweepFlag, x, y]`. */
196
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]`. */
197
270
  type aSegment = [aCommand, number, number, number, number, number, number, number];
271
+ /** The elliptical arc segment, absolute or relative. */
198
272
  type ArcSegment = ASegment | aSegment;
273
+ /** Any SVG path command segment. */
199
274
  type PathSegment = MoveSegment | LineSegment | VertLineSegment | HorLineSegment | CloseSegment | CubicSegment | ShortCubicSegment | QuadSegment | ShortQuadSegment | ArcSegment;
275
+ /** Any shorthand or single-coordinate path segment. */
200
276
  type ShortSegment = VertLineSegment | HorLineSegment | ShortCubicSegment | ShortQuadSegment | CloseSegment;
277
+ /** Any absolute path command segment. */
201
278
  type AbsoluteSegment = MSegment | LSegment | VSegment | HSegment | CSegment | SSegment | QSegment | TSegment | ASegment | ZSegment;
279
+ /** Any relative path command segment. */
202
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). */
203
282
  type NormalSegment = MSegment | LSegment | CSegment | QSegment | ASegment | ZSegment;
283
+ /** A parsed SVG path string as an array of path segments. */
204
284
  type PathArray = [MSegment | mSegment, ...PathSegment[]];
285
+ /** A `PathArray` with only absolute path segments. */
205
286
  type AbsoluteArray = [MSegment, ...AbsoluteSegment[]];
287
+ /** A `PathArray` with only relative path segments. */
206
288
  type RelativeArray = [MSegment, ...RelativeSegment[]];
289
+ /** A `PathArray` with only normalized segments (no shorthand commands). */
207
290
  type NormalArray = [MSegment, ...NormalSegment[]];
291
+ /** A `PathArray` with only moveto and cubic Bezier segments. */
208
292
  type CurveArray = [MSegment, ...CSegment[]];
293
+ /** A `CurveArray` ending with a closepath segment. */
209
294
  type ClosedCurveArray = [MSegment, ...CSegment[], ZSegment];
295
+ /** A `PathArray` describing a closed polygon (moveto, lineto and closepath). */
210
296
  type PolygonArray = [MSegment, ...LSegment[], ZSegment];
297
+ /** A `PathArray` describing an open polyline (moveto and lineto). */
211
298
  type PolylineArray = [MSegment, ...LSegment[]];
299
+ /** The `PathArray` shapes supported by path morphing. */
212
300
  type MorphPathArray = PolygonArray | PolylineArray | CurveArray | ClosedCurveArray;
301
+ /** The SVG element types that can be converted to a path. */
213
302
  type ShapeTypes = SVGPolylineElement | SVGPolygonElement | SVGLineElement | SVGEllipseElement | SVGCircleElement | SVGRectElement;
303
+ /** The tag names of the SVG elements that can be converted to a path. */
214
304
  type ShapeTags = "line" | "polyline" | "polygon" | "ellipse" | "circle" | "rect" | "glyph";
305
+ /** The shape attributes mapped to each supported SVG element type. */
215
306
  type ShapeOps = LineAttr | PolyAttr | PolyAttr | EllipseAttr | CircleAttr | RectAttr | GlyphAttr;
307
+ /** A `TransformObject` with a required 3D origin. */
216
308
  type TransformObjectValues = Partial<TransformObject> & {
217
309
  origin: [number, number, number];
218
310
  };
311
+ /** A 2D point with `x` and `y` coordinates. */
219
312
  type Point = {
220
313
  x: number;
221
314
  y: number;
222
315
  };
316
+ /** A 2D point as a tuple `[x, y]`. */
223
317
  type PointTuple = [number, number];
318
+ /** A `Point` with a `t` parameter (a point on a curve at ratio `t`). */
224
319
  type DerivedPoint = Point & {
225
320
  t: number;
226
321
  };
322
+ /** The six points of a quadratic Bezier curve (on-curve and off-curve control points). */
227
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). */
228
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. */
229
327
  type DerivedQuadPoints = [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];
328
+ /** The eight derived points of a cubic Bezier curve, each with a `t` parameter. */
230
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]`. */
231
331
  type QuadCoordinates = [number, number, number, number, number, number];
332
+ /** The eight coordinates of a cubic Bezier segment. */
232
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). */
233
335
  type ArcCoordinates = [number, number, number, number, number, number, number, number, number];
336
+ /** The four coordinates of a line segment `[x1, y1, x2, y2]`. */
234
337
  type LineCoordinates = [number, number, number, number];
338
+ /** A function that derives a point on a curve at a given `t` ratio. */
235
339
  type DeriveCallback = (t: number) => Point;
340
+ /** A callback invoked for each segment while iterating over a `PathArray`. */
236
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]`. */
237
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. */
238
345
  type PointAtLength = {
239
346
  x: number;
240
347
  y: number;
241
348
  t: number;
242
349
  };
350
+ /** An intersection point between two curves, including both `t` ratios. */
243
351
  type IntersectionPoint = {
244
352
  x: number;
245
353
  y: number;
246
354
  t1: number;
247
355
  t2: number;
248
356
  };
357
+ /** Options for computing intersections between two curves. */
249
358
  interface IntersectionOptions {
250
359
  justCount?: boolean;
251
360
  epsilon?: number;
252
361
  }
362
+ /** Options for equalizing a single path to a given segment count. */
253
363
  interface PathEqualizationOptions {
254
364
  /** @default "auto" */
255
365
  mode?: "line" | "curve" | "auto";
@@ -257,6 +367,7 @@ interface PathEqualizationOptions {
257
367
  roundValues?: number;
258
368
  close?: boolean;
259
369
  }
370
+ /** Options for equalizing two paths for morphing. */
260
371
  interface EqualizationOptions {
261
372
  /** @default "auto" */
262
373
  mode?: "curve" | "auto";
@@ -266,7 +377,9 @@ interface EqualizationOptions {
266
377
  close?: boolean;
267
378
  target?: number;
268
379
  }
380
+ /** `EqualizationOptions` without `reverse` and `target`, used for path pairs. */
269
381
  type PathsEqualizationOptions = Omit<EqualizationOptions, "reverse" | "target">;
382
+ /** The geometric features of a path used for matching during morphing. */
270
383
  interface PathFeature {
271
384
  isPoly: boolean;
272
385
  path: NormalArray;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/interface.ts","../src/types.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/isArcCommand.ts","../src/parser/isDigit.ts","../src/parser/isDigitStart.ts","../src/parser/isMoveCommand.ts","../src/parser/isPathCommand.ts","../src/parser/isSpace.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/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/isPolygonArray.ts","../src/util/isCurveArray.ts","../src/util/isNormalizedArray.ts","../src/util/isPathArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/morph/samplePolygon.ts","../src/util/shapeToPath.ts","../src/util/shapeToPathArray.ts","../src/util/isMultiPath.ts","../src/util/isPolylineArray.ts","../src/util/isClosedPath.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","../src/main.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;;KAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAEU;EACV;IAAO;IAAW;;EAClB;IAAO;IAAW;;;KAGR;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;KAGU;EACV;EACA;IAAS;IAAW;;EACpB;IAAO;IAAW;;EAClB;IAAO;IAAW;;;KAGR;EACV;EACA;;KAGU;EACV,GAAG;EACH;EACA;EACA;;KAGU;EACV;EACA;EACA;EACA;EACA;;KAGU,uBAAuB;KACvB,oBACV,gBACA,gBAAgB;;;K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IO,SAAO;SACP,kBAAS;SACT;uBADS;;;;;;;;;;;;;;;;;;;;;;SAET;;;;;;;;;;;;;;;;SACA;;;;;;;;;;;;SACA;;;;;;;;SACA;;;;;SACA;;;;;;;;;;;;SAEA,uBAAc;SACd,uBAAc;SACd,oBAAW;SACX,qBAAY;SAEZ,2BAAkB;SAClB,iBAAQ;SACR,qBAAY;SACZ,gBAAO;SAEP,wBAAe;SACf,wBAAe;SACf;SAEA,qBAAY;SACZ,gBAAO;SACP,qBAAY;SACZ,sBAAa;SACb,sBAAa;SACb,gBAAO;SAEP;;;;;;;;;;;;;SACA,cAHO;SAIP,mBAAU;SACV,iBAAQ;SACR,kBAAS;SACT,oBAAW;SACX,mBAAU;SAEV;SAEA,gBAAO;SACP,wBAAe;SACf,yBAAgB;SAChB,oBAAW;SACX,oBAAW;SACX,yBAAgB;SAChB,8BAAqB;SACrB,6BAAoB;SACpB,2BAAkB;SAClB,0BAAiB;SACjB,uBAAc;SAEd,wBAAe;SACf,qBAAY;SACZ,uBAAc;SACd,0BAAiB;SACjB,oBAAW;SACX,wBAAe;SACf,wBAAe;SACf,oBAAW;SAEX,sBAAa;SACb,aADa;SAEb,oBAAW;SACX,yBAAgB;SAEhB,0BAAiB;SACjB,mBAAU;SACV,qBAAY;SACZ,gBAAO;SACP,oBAAW;SACX,sBAAa;SACb,yBAAgB;SAChB,qBAAY;SACZ,qBAAY;SACZ,oBAAW;SACX,0BAAiB;SACjB,qBAAY;SACZ,oBAAW;SACX,kBAAS;SACT,qBAAY;SACZ,uBAAc;SACd,uBAAc;SACd,kBAAS;SACT,sBAAa;SACb,yBAAgB;SAChB,0BAAiB;SACjB,sBAAa;SACb,0BAAiB;SACjB,0BAAiB;SACjB,6BAAoB;SACpB,oBAAW;SACX,qBAAY;SACZ,wBAAe;SACf"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/interface.ts","../src/types.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/isArcCommand.ts","../src/parser/isDigit.ts","../src/parser/isDigitStart.ts","../src/parser/isMoveCommand.ts","../src/parser/isPathCommand.ts","../src/parser/isSpace.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/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/isPolygonArray.ts","../src/util/isCurveArray.ts","../src/util/isNormalizedArray.ts","../src/util/isPathArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/morph/samplePolygon.ts","../src/util/shapeToPath.ts","../src/util/shapeToPathArray.ts","../src/util/isMultiPath.ts","../src/util/isPolylineArray.ts","../src/util/isClosedPath.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","../src/main.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;;;KAIU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;KAGU;EACV;IAAO;IAAW;;EAClB;IAAO;IAAW;;;;KAIR;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;KAIU;EACV;EACA;IAAS;IAAW;;EACpB;IAAO;IAAW;;EAClB;IAAO;IAAW;;;;KAIR;EACV;EACA;;;KAIU;EACV,GAAG;EACH;EACA;EACA;;;KAIU;EACV;EACA;EACA;EACA;EACA;;;KAIU,uBAAuB;;KAEvB,oBACV,gBACA,gBAAgB;;;;KC3IN;;KA8BA;;KAaA;;KAcA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA;;KAEA;;KAGA,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA;;KAGQ,kBACR,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA,WACA;;KAGQ,cAAc,kBAAkB;;KAGhC,YAAY;;KAEZ,YAAY;;KAEZ,cAAc,WAAW;;KAGzB,YAAY;;KAEZ,YAAY;;KAEZ,cAAc,WAAW;;KAGzB,YAAY;;KAEZ,YAAY;;KAEZ,kBAAkB,WAAW;;KAG7B,YAAY;;KAEZ,YAAY;;KA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BAAa;SACb,gBAAO;SAEP;;;;;;;;;;;;;SACA,cAHO;SAIP,mBAAU;SACV,iBAAQ;SACR,kBAAS;SACT,oBAAW;SACX,mBAAU;SAEV;SAEA,gBAAO;SACP,wBAAe;SACf,yBAAgB;SAChB,oBAAW;SACX,oBAAW;SACX,yBAAgB;SAChB,8BAAqB;SACrB,6BAAoB;SACpB,2BAAkB;SAClB,0BAAiB;SACjB,uBAAc;SAEd,wBAAe;SACf,qBAAY;SACZ,uBAAc;SACd,0BAAiB;SACjB,oBAAW;SACX,wBAAe;SACf,wBAAe;SACf,oBAAW;SAEX,sBAAa;SACb,aADa;SAEb,oBAAW;SACX,yBAAgB;SAEhB,0BAAiB;SACjB,mBAAU;SACV,qBAAY;SACZ,gBAAO;SACP,oBAAW;SACX,sBAAa;SACb,yBAAgB;SAChB,qBAAY;SACZ,qBAAY;SACZ,oBAAW;SACX,0BAAiB;SACjB,qBAAY;SACZ,oBAAW;SACX,kBAAS;SACT,qBAAY;SACZ,uBAAc;SACd,uBAAc;SACd,kBAAS;SACT,sBAAa;SACb,yBAAgB;SAChB,0BAAiB;SACjB,sBAAa;SACb,0BAAiB;SACjB,0BAAiB;SACjB,6BAAoB;SACpB,oBAAW;SACX,qBAAY;SACZ,wBAAe;SACf"}
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
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 package.json
8
- var version = "2.2.2";
8
+ var version = "2.2.3";
9
9
  //#endregion
10
10
  //#region src/math/midPoint.ts
11
11
  /**
@@ -100,6 +100,7 @@ const getLineBBox = (x1, y1, x2, y2) => {
100
100
  max(y1, y2)
101
101
  ];
102
102
  };
103
+ /** The tools for line segment computation. */
103
104
  const lineTools = {
104
105
  getLineBBox,
105
106
  getLineLength,
@@ -137,6 +138,7 @@ const Tvalues = [
137
138
  -.9951872199970213,
138
139
  .9951872199970213
139
140
  ];
141
+ /** The weights for the 32-point Gauss-Legendre quadrature. */
140
142
  const Cvalues = [
141
143
  .12793819534675216,
142
144
  .12793819534675216,
@@ -237,11 +239,24 @@ const computeBezier = (points, t) => {
237
239
  t
238
240
  };
239
241
  };
242
+ /**
243
+ * Calculates the speed (derivative magnitude) of a Bezier curve at parameter `t`.
244
+ *
245
+ * @param derivativeFn the curve derivative function
246
+ * @param t the sampled point ratio in `[0-1]`
247
+ * @returns the curve speed at parameter `t`
248
+ */
240
249
  const calculateBezier = (derivativeFn, t) => {
241
250
  const d = derivativeFn(t);
242
251
  const l = d.x * d.x + d.y * d.y;
243
252
  return Math.sqrt(l);
244
253
  };
254
+ /**
255
+ * Returns the total arc length of a Bezier segment.
256
+ *
257
+ * @param derivativeFn the curve derivative function
258
+ * @returns the total arc length
259
+ */
245
260
  const bezierLength = (derivativeFn) => {
246
261
  return bezierLengthAtT(derivativeFn, 1);
247
262
  };
@@ -323,6 +338,7 @@ const getBezierLength = (curve) => {
323
338
  return computeBezier(dpoints[0], t);
324
339
  });
325
340
  };
341
+ /** The precision threshold to consider a cubic polynomial as quadratic. */
326
342
  const CBEZIER_MINMAX_EPSILON = 1e-8;
327
343
  /**
328
344
  * Returns the most extreme points in a Quad Bezier segment.
@@ -363,6 +379,7 @@ const minmaxC = ([v1, cp1, cp2, v2]) => {
363
379
  }
364
380
  return [min, max];
365
381
  };
382
+ /** The tools for Bezier curve computation. */
366
383
  const bezierTools = {
367
384
  bezierLength,
368
385
  bezierLengthAtT,
@@ -706,6 +723,7 @@ const getArcBBox = (x1, y1, RX, RY, angle, LAF, SF, x, y) => {
706
723
  yMax
707
724
  ];
708
725
  };
726
+ /** The tools for elliptical arc computation. */
709
727
  const arcTools = {
710
728
  angleBetween,
711
729
  arcLength,
@@ -842,6 +860,7 @@ const getCubicBBox = (x1, y1, c1x, c1y, c2x, c2y, x2, y2) => {
842
860
  cyMinMax[1]
843
861
  ];
844
862
  };
863
+ /** The tools for cubic Bezier computation. */
845
864
  const cubicTools = {
846
865
  getCubicBBox,
847
866
  getCubicLength,
@@ -962,6 +981,7 @@ const getQuadBBox = (x1, y1, cx, cy, x2, y2) => {
962
981
  cyMinMax[1]
963
982
  ];
964
983
  };
984
+ /** The tools for quadratic Bezier computation. */
965
985
  const quadTools = {
966
986
  getPointAtQuadLength,
967
987
  getPointAtQuadSegmentLength,
@@ -1025,6 +1045,7 @@ const polygonCentroid = (polygon) => {
1025
1045
  const count = polygon.length;
1026
1046
  return [sumX / count, sumY / count];
1027
1047
  };
1048
+ /** The tools for polygon computation. */
1028
1049
  const polygonTools = {
1029
1050
  polygonArea,
1030
1051
  polygonLength,
@@ -4224,6 +4245,14 @@ const intersect = (x1, y1, x2, y2, x3, y3, x4, y4) => {
4224
4245
  y: py
4225
4246
  };
4226
4247
  };
4248
+ /**
4249
+ * Returns the intersection point(s) of two cubic Bezier curves.
4250
+ *
4251
+ * @param bez1 the coordinates of the first cubic Bezier segment
4252
+ * @param bez2 the coordinates of the second cubic Bezier segment
4253
+ * @param config optional intersection options
4254
+ * @returns the intersection points, or `undefined` if the curves do not intersect
4255
+ */
4227
4256
  const interHelper = (bez1, bez2, config) => {
4228
4257
  const bbox1 = getCubicBBox(...bez1);
4229
4258
  const bbox2 = getCubicBBox(...bez2);