svg-path-commander 1.0.5 → 2.0.0-alpha2

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.
Files changed (131) hide show
  1. package/README.md +26 -4
  2. package/dist/svg-path-commander.cjs +2 -0
  3. package/dist/svg-path-commander.cjs.map +1 -0
  4. package/dist/svg-path-commander.d.ts +454 -0
  5. package/dist/svg-path-commander.js +2 -3762
  6. package/dist/svg-path-commander.js.map +1 -0
  7. package/dist/svg-path-commander.mjs +1194 -0
  8. package/dist/svg-path-commander.mjs.map +1 -0
  9. package/package.json +39 -42
  10. package/src/convert/pathToAbsolute.ts +101 -0
  11. package/src/convert/{pathToCurve.js → pathToCurve.ts} +12 -14
  12. package/src/convert/pathToRelative.ts +92 -0
  13. package/src/convert/pathToString.ts +17 -0
  14. package/src/{svg-path-commander.js → index.ts} +143 -66
  15. package/src/interface.ts +129 -0
  16. package/src/math/distanceSquareRoot.ts +13 -0
  17. package/src/math/midPoint.ts +16 -0
  18. package/src/math/{polygonArea.js → polygonArea.ts} +6 -4
  19. package/src/math/{polygonLength.js → polygonLength.ts} +5 -3
  20. package/src/math/rotateVector.ts +16 -0
  21. package/src/options/options.ts +9 -0
  22. package/src/parser/error.ts +2 -0
  23. package/src/parser/finalizeSegment.ts +31 -0
  24. package/src/parser/{invalidPathValue.js → invalidPathValue.ts} +0 -0
  25. package/src/parser/{isArcCommand.js → isArcCommand.ts} +5 -4
  26. package/src/parser/isDigit.ts +12 -0
  27. package/src/parser/isDigitStart.ts +14 -0
  28. package/src/parser/isPathCommand.ts +28 -0
  29. package/src/parser/isSpace.ts +23 -0
  30. package/src/parser/paramsCount.ts +16 -0
  31. package/src/parser/paramsParser.ts +14 -0
  32. package/src/parser/{parsePathString.js → parsePathString.ts} +13 -7
  33. package/src/parser/pathParser.ts +29 -0
  34. package/src/parser/{scanFlag.js → scanFlag.ts} +8 -5
  35. package/src/parser/{scanParam.js → scanParam.ts} +12 -11
  36. package/src/parser/{scanSegment.js → scanSegment.ts} +9 -5
  37. package/src/parser/{skipSpaces.js → skipSpaces.ts} +5 -3
  38. package/src/process/{arcToCubic.js → arcToCubic.ts} +42 -28
  39. package/src/process/fixArc.ts +23 -0
  40. package/src/process/getSVGMatrix.ts +70 -0
  41. package/src/process/lineToCubic.ts +17 -0
  42. package/src/process/{normalizePath.js → normalizePath.ts} +10 -10
  43. package/src/process/normalizeSegment.ts +47 -0
  44. package/src/process/{optimizePath.js → optimizePath.ts} +18 -21
  45. package/src/process/{projection2d.js → projection2d.ts} +16 -15
  46. package/src/process/quadToCubic.ts +31 -0
  47. package/src/process/reverseCurve.ts +21 -0
  48. package/src/process/reversePath.ts +101 -0
  49. package/src/process/roundPath.ts +29 -0
  50. package/src/process/segmentToCubic.ts +46 -0
  51. package/src/process/shortenSegment.ts +79 -0
  52. package/src/process/splitCubic.ts +28 -0
  53. package/src/process/{splitPath.js → splitPath.ts} +9 -8
  54. package/src/process/{transformPath.js → transformPath.ts} +55 -48
  55. package/src/types.ts +193 -0
  56. package/src/util/getClosestPoint.ts +15 -0
  57. package/src/util/{getDrawDirection.js → getDrawDirection.ts} +7 -4
  58. package/src/util/getPathArea.ts +70 -0
  59. package/src/util/{getPathBBox.js → getPathBBox.ts} +16 -5
  60. package/src/util/getPointAtLength.ts +14 -0
  61. package/src/util/{getPropertiesAtLength.js → getPropertiesAtLength.ts} +28 -19
  62. package/src/util/{getPropertiesAtPoint.js → getPropertiesAtPoint.ts} +16 -12
  63. package/src/util/getSegmentAtLength.ts +15 -0
  64. package/src/util/getSegmentOfPoint.ts +18 -0
  65. package/src/util/{getTotalLength.js → getTotalLength.ts} +6 -4
  66. package/src/util/isAbsoluteArray.ts +18 -0
  67. package/src/util/{isCurveArray.js → isCurveArray.ts} +6 -4
  68. package/src/util/{isNormalizedArray.js → isNormalizedArray.ts} +4 -2
  69. package/src/util/isPathArray.ts +19 -0
  70. package/src/util/isPointInStroke.ts +15 -0
  71. package/src/util/isRelativeArray.ts +18 -0
  72. package/src/util/{isValidPath.js → isValidPath.ts} +5 -4
  73. package/src/util/{pathLengthFactory.js → pathLengthFactory.ts} +38 -31
  74. package/src/util/{segmentArcFactory.js → segmentArcFactory.ts} +71 -55
  75. package/src/util/segmentCubicFactory.ts +114 -0
  76. package/src/util/{segmentLineFactory.js → segmentLineFactory.ts} +10 -8
  77. package/src/util/{segmentQuadFactory.js → segmentQuadFactory.ts} +47 -32
  78. package/src/util/shapeToPath.ts +214 -0
  79. package/dist/svg-path-commander.es5.js +0 -3875
  80. package/dist/svg-path-commander.es5.min.js +0 -2
  81. package/dist/svg-path-commander.esm.js +0 -3754
  82. package/dist/svg-path-commander.esm.min.js +0 -2
  83. package/dist/svg-path-commander.min.js +0 -2
  84. package/src/convert/pathToAbsolute.js +0 -86
  85. package/src/convert/pathToRelative.js +0 -84
  86. package/src/convert/pathToString.js +0 -14
  87. package/src/index.js +0 -10
  88. package/src/math/distanceSquareRoot.js +0 -14
  89. package/src/math/epsilon.js +0 -8
  90. package/src/math/midPoint.js +0 -13
  91. package/src/math/rotateVector.js +0 -14
  92. package/src/options/options.js +0 -10
  93. package/src/parser/error.js +0 -2
  94. package/src/parser/finalizeSegment.js +0 -28
  95. package/src/parser/isDigit.js +0 -9
  96. package/src/parser/isDigitStart.js +0 -13
  97. package/src/parser/isPathCommand.js +0 -25
  98. package/src/parser/isSpace.js +0 -16
  99. package/src/parser/paramsCount.js +0 -9
  100. package/src/parser/paramsParser.js +0 -8
  101. package/src/parser/pathParser.js +0 -24
  102. package/src/process/clonePath.js +0 -9
  103. package/src/process/fixArc.js +0 -21
  104. package/src/process/fixPath.js +0 -31
  105. package/src/process/getSVGMatrix.js +0 -61
  106. package/src/process/lineToCubic.js +0 -30
  107. package/src/process/normalizeSegment.js +0 -45
  108. package/src/process/quadToCubic.js +0 -22
  109. package/src/process/reverseCurve.js +0 -18
  110. package/src/process/reversePath.js +0 -89
  111. package/src/process/roundPath.js +0 -26
  112. package/src/process/segmentToCubic.js +0 -46
  113. package/src/process/shortenSegment.js +0 -58
  114. package/src/process/splitCubic.js +0 -26
  115. package/src/util/getClosestPoint.js +0 -12
  116. package/src/util/getPathArea.js +0 -47
  117. package/src/util/getPointAtLength.js +0 -12
  118. package/src/util/getSegmentAtLength.js +0 -11
  119. package/src/util/getSegmentOfPoint.js +0 -12
  120. package/src/util/isAbsoluteArray.js +0 -14
  121. package/src/util/isPathArray.js +0 -14
  122. package/src/util/isPointInStroke.js +0 -13
  123. package/src/util/isRelativeArray.js +0 -14
  124. package/src/util/segmentCubicFactory.js +0 -97
  125. package/src/util/shapeToPath.js +0 -204
  126. package/src/util/util.js +0 -82
  127. package/src/version.js +0 -8
  128. package/types/index.d.ts +0 -120
  129. package/types/more/modules.ts +0 -82
  130. package/types/more/svg.d.ts +0 -211
  131. package/types/svg-path-commander.d.ts +0 -1089
@@ -1,1089 +0,0 @@
1
- declare module "svg-path-commander/src/parser/paramsCount" {
2
- export default paramsCount;
3
- /**
4
- * Segment params length
5
- * @type {Record<string, number>}
6
- */
7
- const paramsCount: Record<string, number>;
8
- }
9
- declare module "svg-path-commander/src/parser/finalizeSegment" {
10
- /**
11
- * Breaks the parsing of a pathString once a segment is finalized.
12
- *
13
- * @param {SVGPath.PathParser} path the `PathParser` instance
14
- */
15
- export default function finalizeSegment(path: SVGPath.PathParser): void;
16
- }
17
- declare module "svg-path-commander/src/parser/error" {
18
- export default error;
19
- const error: "SVGPathCommander error";
20
- }
21
- declare module "svg-path-commander/src/parser/scanFlag" {
22
- /**
23
- * Validates an A (arc-to) specific path command value.
24
- * Usually a `large-arc-flag` or `sweep-flag`.
25
- *
26
- * @param {SVGPath.PathParser} path the `PathParser` instance
27
- */
28
- export default function scanFlag(path: SVGPath.PathParser): void;
29
- }
30
- declare module "svg-path-commander/src/parser/isDigit" {
31
- /**
32
- * Checks if a character is a digit.
33
- *
34
- * @param {number} code the character to check
35
- * @returns {boolean} check result
36
- */
37
- export default function isDigit(code: number): boolean;
38
- }
39
- declare module "svg-path-commander/src/parser/invalidPathValue" {
40
- export default invalidPathValue;
41
- const invalidPathValue: "Invalid path value";
42
- }
43
- declare module "svg-path-commander/src/parser/scanParam" {
44
- /**
45
- * Validates every character of the path string,
46
- * every path command, negative numbers or floating point numbers.
47
- *
48
- * @param {SVGPath.PathParser} path the `PathParser` instance
49
- */
50
- export default function scanParam(path: SVGPath.PathParser): void;
51
- }
52
- declare module "svg-path-commander/src/parser/isSpace" {
53
- /**
54
- * Checks if the character is a space.
55
- *
56
- * @param {number} ch the character to check
57
- * @returns {boolean} check result
58
- */
59
- export default function isSpace(ch: number): boolean;
60
- }
61
- declare module "svg-path-commander/src/parser/skipSpaces" {
62
- /**
63
- * Points the parser to the next character in the
64
- * path string every time it encounters any kind of
65
- * space character.
66
- *
67
- * @param {SVGPath.PathParser} path the `PathParser` instance
68
- */
69
- export default function skipSpaces(path: SVGPath.PathParser): void;
70
- }
71
- declare module "svg-path-commander/src/parser/isPathCommand" {
72
- /**
73
- * Checks if the character is a path command.
74
- *
75
- * @param {any} code the character to check
76
- * @returns {boolean} check result
77
- */
78
- export default function isPathCommand(code: any): boolean;
79
- }
80
- declare module "svg-path-commander/src/parser/isDigitStart" {
81
- /**
82
- * Checks if the character is or belongs to a number.
83
- * [0-9]|+|-|.
84
- *
85
- * @param {number} code the character to check
86
- * @returns {boolean} check result
87
- */
88
- export default function isDigitStart(code: number): boolean;
89
- }
90
- declare module "svg-path-commander/src/parser/isArcCommand" {
91
- /**
92
- * Checks if the character is an A (arc-to) path command.
93
- *
94
- * @param {number} code the character to check
95
- * @returns {boolean} check result
96
- */
97
- export default function isArcCommand(code: number): boolean;
98
- }
99
- declare module "svg-path-commander/src/parser/scanSegment" {
100
- /**
101
- * Scans every character in the path string to determine
102
- * where a segment starts and where it ends.
103
- *
104
- * @param {SVGPath.PathParser} path the `PathParser` instance
105
- */
106
- export default function scanSegment(path: SVGPath.PathParser): void;
107
- }
108
- declare module "svg-path-commander/src/process/clonePath" {
109
- /**
110
- * Returns a clone of an existing `pathArray`.
111
- *
112
- * @param {SVGPath.pathArray | SVGPath.pathSegment} path the source `pathArray`
113
- * @returns {any} the cloned `pathArray`
114
- */
115
- export default function clonePath(path: SVGPath.pathArray | SVGPath.pathSegment): any;
116
- }
117
- declare module "svg-path-commander/src/parser/pathParser" {
118
- /**
119
- * The `PathParser` is used by the `parsePathString` static method
120
- * to generate a `pathArray`.
121
- *
122
- * @param {string} pathString
123
- */
124
- export default function PathParser(pathString: string): void;
125
- export default class PathParser {
126
- /**
127
- * The `PathParser` is used by the `parsePathString` static method
128
- * to generate a `pathArray`.
129
- *
130
- * @param {string} pathString
131
- */
132
- constructor(pathString: string);
133
- /** @type {SVGPath.pathArray} */
134
- segments: SVGPath.pathArray;
135
- /** @type {string} */
136
- pathValue: string;
137
- /** @type {number} */
138
- max: number;
139
- /** @type {number} */
140
- index: number;
141
- /** @type {number} */
142
- param: number;
143
- /** @type {number} */
144
- segmentStart: number;
145
- /** @type {any} */
146
- data: any;
147
- /** @type {string} */
148
- err: string;
149
- }
150
- }
151
- declare module "svg-path-commander/src/util/isPathArray" {
152
- /**
153
- * Iterates an array to check if it's an actual `pathArray`.
154
- *
155
- * @param {string | SVGPath.pathArray} path the `pathArray` to be checked
156
- * @returns {boolean} iteration result
157
- */
158
- export default function isPathArray(path: string | SVGPath.pathArray): boolean;
159
- }
160
- declare module "svg-path-commander/src/parser/parsePathString" {
161
- /**
162
- * Parses a path string value and returns an array
163
- * of segments we like to call `pathArray`.
164
- *
165
- * @param {SVGPath.pathArray | string} pathInput the string to be parsed
166
- * @returns {SVGPath.pathArray | string} the resulted `pathArray`
167
- */
168
- export default function parsePathString(pathInput: SVGPath.pathArray | string): SVGPath.pathArray | string;
169
- }
170
- declare module "svg-path-commander/src/util/isAbsoluteArray" {
171
- /**
172
- * Iterates an array to check if it's a `pathArray`
173
- * with all absolute values.
174
- *
175
- * @param {string | SVGPath.pathArray} path the `pathArray` to be checked
176
- * @returns {boolean} iteration result
177
- */
178
- export default function isAbsoluteArray(path: string | SVGPath.pathArray): boolean;
179
- }
180
- declare module "svg-path-commander/src/convert/pathToAbsolute" {
181
- /**
182
- * Parses a path string value or object and returns an array
183
- * of segments, all converted to absolute values.
184
- *
185
- * @param {string | SVGPath.pathArray} pathInput the path string | object
186
- * @returns {SVGPath.absoluteArray} the resulted `pathArray` with absolute values
187
- */
188
- export default function pathToAbsolute(pathInput: string | SVGPath.pathArray): SVGPath.absoluteArray;
189
- }
190
- declare module "svg-path-commander/src/util/isRelativeArray" {
191
- /**
192
- * Iterates an array to check if it's a `pathArray`
193
- * with relative values.
194
- *
195
- * @param {string | SVGPath.pathArray} path the `pathArray` to be checked
196
- * @returns {boolean} iteration result
197
- */
198
- export default function isRelativeArray(path: string | SVGPath.pathArray): boolean;
199
- }
200
- declare module "svg-path-commander/src/convert/pathToRelative" {
201
- /**
202
- * Parses a path string value or object and returns an array
203
- * of segments, all converted to relative values.
204
- *
205
- * @param {string | SVGPath.pathArray} pathInput the path string | object
206
- * @returns {SVGPath.relativeArray} the resulted `pathArray` with relative values
207
- */
208
- export default function pathToRelative(pathInput: string | SVGPath.pathArray): SVGPath.relativeArray;
209
- }
210
- declare module "svg-path-commander/src/process/fixArc" {
211
- /**
212
- * Splits an extended A (arc-to) segment into two cubic-bezier segments.
213
- *
214
- * @param {SVGPath.pathArray} path the `pathArray` this segment belongs to
215
- * @param {string[]} allPathCommands all previous path commands
216
- * @param {number} i the segment index
217
- */
218
- export default function fixArc(path: SVGPath.pathArray, allPathCommands: string[], i: number): void;
219
- }
220
- declare module "svg-path-commander/src/process/shorthandToQuad" {
221
- /**
222
- * Returns the missing control point from an
223
- * T (shorthand quadratic bezier) segment.
224
- *
225
- * @param {number} x1 curve start x
226
- * @param {number} y1 curve start y
227
- * @param {number} qx control point x
228
- * @param {number} qy control point y
229
- * @param {string} prevCommand the previous path command
230
- * @returns {{qx: number, qy: number}}} the missing control point
231
- */
232
- export default function shorthandToQuad(x1: number, y1: number, qx: number, qy: number, prevCommand: string): {
233
- qx: number;
234
- qy: number;
235
- };
236
- }
237
- declare module "svg-path-commander/src/process/shorthandToCubic" {
238
- /**
239
- * Returns the missing control point from an
240
- * S (shorthand cubic bezier) segment.
241
- *
242
- * @param {number} x1 curve start x
243
- * @param {number} y1 curve start y
244
- * @param {number} x2 curve end x
245
- * @param {number} y2 curve end y
246
- * @param {string} prevCommand the previous path command
247
- * @returns {{x1: number, y1: number}}} the missing control point
248
- */
249
- export default function shorthandToCubic(x1: number, y1: number, x2: number, y2: number, prevCommand: string): {
250
- x1: number;
251
- y1: number;
252
- };
253
- }
254
- declare module "svg-path-commander/src/process/normalizeSegment" {
255
- /**
256
- * Normalizes a single segment of a `pathArray` object.
257
- *
258
- * @param {SVGPath.pathSegment} segment the segment object
259
- * @param {any} params the coordinates of the previous segment
260
- * @param {string} prevCommand the path command of the previous segment
261
- * @returns {SVGPath.normalSegment} the normalized segment
262
- */
263
- export default function normalizeSegment(segment: SVGPath.pathSegment, params: any, prevCommand: string): SVGPath.normalSegment;
264
- }
265
- declare module "svg-path-commander/src/util/isNormalizedArray" {
266
- /**
267
- * Iterates an array to check if it's a `pathArray`
268
- * with all segments are in non-shorthand notation
269
- * with absolute values.
270
- *
271
- * @param {string | SVGPath.pathArray} path the `pathArray` to be checked
272
- * @returns {boolean} iteration result
273
- */
274
- export default function isNormalizedArray(path: string | SVGPath.pathArray): boolean;
275
- }
276
- declare module "svg-path-commander/src/parser/paramsParser" {
277
- export default paramsParser;
278
- /**
279
- * @type {SVGPath.parserParams}
280
- */
281
- const paramsParser: SVGPath.parserParams;
282
- }
283
- declare module "svg-path-commander/src/process/normalizePath" {
284
- /**
285
- * Normalizes a `path` object for further processing:
286
- * * convert segments to absolute values
287
- * * convert shorthand path commands to their non-shorthand notation
288
- *
289
- * @param {string | SVGPath.pathArray} pathInput the string to be parsed or 'pathArray'
290
- * @returns {SVGPath.normalArray} the normalized `pathArray`
291
- */
292
- export default function normalizePath(pathInput: string | SVGPath.pathArray): SVGPath.normalArray;
293
- }
294
- declare module "svg-path-commander/src/process/fixPath" {
295
- /**
296
- * Checks a `pathArray` for an unnecessary `Z` segment
297
- * and returns a new `pathArray` without it.
298
- *
299
- * The `pathInput` must be a single path, without
300
- * sub-paths. For multi-path `<path>` elements,
301
- * use `splitPath` first and apply this utility on each
302
- * sub-path separately.
303
- *
304
- * @param {SVGPath.pathArray | string} pathInput the `pathArray` source
305
- * @return {SVGPath.pathArray} a fixed `pathArray`
306
- */
307
- export default function fixPath(pathInput: SVGPath.pathArray | string): SVGPath.pathArray;
308
- }
309
- declare module "svg-path-commander/src/util/isCurveArray" {
310
- /**
311
- * Iterates an array to check if it's a `pathArray`
312
- * with all C (cubic bezier) segments.
313
- *
314
- * @param {string | SVGPath.pathArray} path the `Array` to be checked
315
- * @returns {boolean} iteration result
316
- */
317
- export default function isCurveArray(path: string | SVGPath.pathArray): boolean;
318
- }
319
- declare module "svg-path-commander/src/math/rotateVector" {
320
- /**
321
- * Returns an {x,y} vector rotated by a given
322
- * angle in radian.
323
- *
324
- * @param {number} x the initial vector x
325
- * @param {number} y the initial vector y
326
- * @param {number} rad the radian vector angle
327
- * @returns {{x: number, y: number}} the rotated vector
328
- */
329
- export default function rotateVector(x: number, y: number, rad: number): {
330
- x: number;
331
- y: number;
332
- };
333
- }
334
- declare module "svg-path-commander/src/process/arcToCubic" {
335
- /**
336
- * Converts A (arc-to) segments to C (cubic-bezier-to).
337
- *
338
- * For more information of where this math came from visit:
339
- * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
340
- *
341
- * @param {number} X1 the starting x position
342
- * @param {number} Y1 the starting y position
343
- * @param {number} RX x-radius of the arc
344
- * @param {number} RY y-radius of the arc
345
- * @param {number} angle x-axis-rotation of the arc
346
- * @param {number} LAF large-arc-flag of the arc
347
- * @param {number} SF sweep-flag of the arc
348
- * @param {number} X2 the ending x position
349
- * @param {number} Y2 the ending y position
350
- * @param {number[]=} recursive the parameters needed to split arc into 2 segments
351
- * @return {number[]} the resulting cubic-bezier segment(s)
352
- */
353
- export default function arcToCubic(X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive?: number[] | undefined): number[];
354
- }
355
- declare module "svg-path-commander/src/process/quadToCubic" {
356
- /**
357
- * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).
358
- *
359
- * @param {number} x1 curve start x
360
- * @param {number} y1 curve start y
361
- * @param {number} qx control point x
362
- * @param {number} qy control point y
363
- * @param {number} x2 curve end x
364
- * @param {number} y2 curve end y
365
- * @returns {number[]} the cubic-bezier segment
366
- */
367
- export default function quadToCubic(x1: number, y1: number, qx: number, qy: number, x2: number, y2: number): number[];
368
- }
369
- declare module "svg-path-commander/src/math/midPoint" {
370
- /**
371
- * Returns the coordinates of a specified distance
372
- * ratio between two points.
373
- *
374
- * @param {[number, number]} a the first point coordinates
375
- * @param {[number, number]} b the second point coordinates
376
- * @param {number} t the ratio
377
- * @returns {[number, number]} the midpoint coordinates
378
- */
379
- export default function midPoint(a: [number, number], b: [number, number], t: number): [number, number];
380
- }
381
- declare module "svg-path-commander/src/math/distanceSquareRoot" {
382
- /**
383
- * Returns the square root of the distance
384
- * between two given points.
385
- *
386
- * @param {[number, number]} a the first point coordinates
387
- * @param {[number, number]} b the second point coordinates
388
- * @returns {number} the distance value
389
- */
390
- export default function distanceSquareRoot(a: [number, number], b: [number, number]): number;
391
- }
392
- declare module "svg-path-commander/src/util/segmentLineFactory" {
393
- /**
394
- * Returns a {x,y} point at a given length, the total length and
395
- * the minimum and maximum {x,y} coordinates of a line (L,V,H,Z) segment.
396
- *
397
- * @param {number} x1 the starting point X
398
- * @param {number} y1 the starting point Y
399
- * @param {number} x2 the ending point X
400
- * @param {number} y2 the ending point Y
401
- * @param {number=} distance the distance to point
402
- * @returns {SVGPath.lengthFactory} the segment length, point, min & max
403
- */
404
- export default function segmentLineFactory(x1: number, y1: number, x2: number, y2: number, distance?: number | undefined): SVGPath.lengthFactory;
405
- }
406
- declare module "svg-path-commander/src/process/lineToCubic" {
407
- /**
408
- * Converts an L (line-to) segment to C (cubic-bezier).
409
- *
410
- * @param {number} x1 line start x
411
- * @param {number} y1 line start y
412
- * @param {number} x2 line end x
413
- * @param {number} y2 line end y
414
- * @returns {number[]} the cubic-bezier segment
415
- */
416
- export default function lineToCubic(x1: number, y1: number, x2: number, y2: number): number[];
417
- }
418
- declare module "svg-path-commander/src/process/segmentToCubic" {
419
- /**
420
- * Converts any segment to C (cubic-bezier).
421
- *
422
- * @param {SVGPath.pathSegment} segment the source segment
423
- * @param {SVGPath.parserParams} params the source segment parameters
424
- * @returns {SVGPath.cubicSegment | SVGPath.MSegment} the cubic-bezier segment
425
- */
426
- export default function segmentToCubic(segment: SVGPath.pathSegment, params: SVGPath.parserParams): SVGPath.cubicSegment | SVGPath.MSegment;
427
- }
428
- declare module "svg-path-commander/src/convert/pathToCurve" {
429
- /**
430
- * Parses a path string value or 'pathArray' and returns a new one
431
- * in which all segments are converted to cubic-bezier.
432
- *
433
- * In addition, un-necessary `Z` segment is removed if previous segment
434
- * extends to the `M` segment.
435
- *
436
- * @param {string | SVGPath.pathArray} pathInput the string to be parsed or 'pathArray'
437
- * @returns {SVGPath.curveArray} the resulted `pathArray` converted to cubic-bezier
438
- */
439
- export default function pathToCurve(pathInput: string | SVGPath.pathArray): SVGPath.curveArray;
440
- }
441
- declare module "svg-path-commander/src/options/options" {
442
- export default defaultOptions;
443
- /**
444
- * SVGPathCommander default options
445
- * @type {SVGPath.options}
446
- */
447
- const defaultOptions: SVGPath.options;
448
- }
449
- declare module "svg-path-commander/src/process/roundPath" {
450
- /**
451
- * Rounds the values of a `pathArray` instance to
452
- * a specified amount of decimals and returns it.
453
- *
454
- * @param {SVGPath.pathArray} path the source `pathArray`
455
- * @param {number | 'off'} roundOption the amount of decimals to round numbers to
456
- * @returns {SVGPath.pathArray} the resulted `pathArray` with rounded values
457
- */
458
- export default function roundPath(path: SVGPath.pathArray, roundOption: number | 'off'): SVGPath.pathArray;
459
- }
460
- declare module "svg-path-commander/src/convert/pathToString" {
461
- /**
462
- * Returns a valid `d` attribute string value created
463
- * by rounding values and concatenating the `pathArray` segments.
464
- *
465
- * @param {SVGPath.pathArray} path the `pathArray` object
466
- * @param {number | 'off'} round amount of decimals to round values to
467
- * @returns {string} the concatenated path string
468
- */
469
- export default function pathToString(path: SVGPath.pathArray, round: number | 'off'): string;
470
- }
471
- declare module "svg-path-commander/src/math/epsilon" {
472
- export default epsilon;
473
- /**
474
- * A global namespace for epsilon.
475
- *
476
- * @type {number}
477
- */
478
- const epsilon: number;
479
- }
480
- declare module "svg-path-commander/src/math/polygonArea" {
481
- /**
482
- * d3-polygon-area
483
- * https://github.com/d3/d3-polygon
484
- *
485
- * Returns the area of a polygon.
486
- *
487
- * @param {number[][]} polygon an array of coordinates
488
- * @returns {number} the polygon area
489
- */
490
- export default function polygonArea(polygon: number[][]): number;
491
- }
492
- declare module "svg-path-commander/src/math/polygonLength" {
493
- /**
494
- * d3-polygon-length
495
- * https://github.com/d3/d3-polygon
496
- *
497
- * Returns the perimeter of a polygon.
498
- *
499
- * @param {[number,number][]} polygon an array of coordinates
500
- * @returns {number} the polygon length
501
- */
502
- export default function polygonLength(polygon: [number, number][]): number;
503
- }
504
- declare module "svg-path-commander/src/process/getSVGMatrix" {
505
- /**
506
- * Returns a transformation matrix to apply to `<path>` elements.
507
- *
508
- * @see SVGPath.transformObject
509
- *
510
- * @param {SVGPath.transformObject} transform the `transformObject`
511
- * @returns {CSSMatrix} a new transformation matrix
512
- */
513
- export default function getSVGMatrix(transform: SVGPath.transformObject): CSSMatrix;
514
- import CSSMatrix from "dommatrix";
515
- }
516
- declare module "svg-path-commander/src/process/shortenSegment" {
517
- /**
518
- * Shorten a single segment of a `pathArray` object.
519
- *
520
- * @param {SVGPath.absoluteSegment} segment the `absoluteSegment` object
521
- * @param {SVGPath.normalSegment} normalSegment the `normalSegment` object
522
- * @param {any} params the coordinates of the previous segment
523
- * @param {string} prevCommand the path command of the previous segment
524
- * @returns {SVGPath.shortSegment | SVGPath.pathSegment} the shortened segment
525
- */
526
- export default function shortenSegment(segment: SVGPath.absoluteSegment, normalSegment: SVGPath.normalSegment, params: any, prevCommand: string): SVGPath.shortSegment | SVGPath.pathSegment;
527
- }
528
- declare module "svg-path-commander/src/process/optimizePath" {
529
- /**
530
- * Optimizes a `pathArray` object:
531
- * * convert segments to shorthand if possible
532
- * * select shortest segments from absolute and relative `pathArray`s
533
- *
534
- * TO DO
535
- * * implement `auto` for rounding values based on pathBBox
536
- * * also revers path check if it's smaller string, maybe?
537
- *
538
- * @param {SVGPath.pathArray} pathInput a string or `pathArray`
539
- * @param {number | 'off'} round the amount of decimals to round values to
540
- * @returns {SVGPath.pathArray} the optimized `pathArray`
541
- */
542
- export default function optimizePath(pathInput: SVGPath.pathArray, round: number | 'off'): SVGPath.pathArray;
543
- }
544
- declare module "svg-path-commander/src/process/projection2d" {
545
- /**
546
- * Returns the [x,y] projected coordinates for a given an [x,y] point
547
- * and an [x,y,z] perspective origin point.
548
- *
549
- * Equation found here =>
550
- * http://en.wikipedia.org/wiki/3D_projection#Diagram
551
- * Details =>
552
- * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel
553
- *
554
- * @param {SVGPath.CSSMatrix} m the transformation matrix
555
- * @param {[number, number]} point2D the initial [x,y] coordinates
556
- * @param {number[]} origin the [x,y,z] transform origin
557
- * @returns {[number, number]} the projected [x,y] coordinates
558
- */
559
- export default function projection2d(m: SVGPath.CSSMatrix, point2D: [number, number], origin: number[]): [number, number];
560
- }
561
- declare module "svg-path-commander/src/process/reverseCurve" {
562
- /**
563
- * Reverses all segments of a `pathArray`
564
- * which consists of only C (cubic-bezier) path commands.
565
- *
566
- * @param {SVGPath.curveArray} path the source `pathArray`
567
- * @returns {SVGPath.curveArray} the reversed `pathArray`
568
- */
569
- export default function reverseCurve(path: SVGPath.curveArray): SVGPath.curveArray;
570
- }
571
- declare module "svg-path-commander/src/process/reversePath" {
572
- /**
573
- * Reverses all segments of a `pathArray` and returns a new `pathArray` instance.
574
- *
575
- * @param {SVGPath.pathArray} pathInput the source `pathArray`
576
- * @returns {SVGPath.pathArray} the reversed `pathArray`
577
- */
578
- export default function reversePath(pathInput: SVGPath.pathArray): SVGPath.pathArray;
579
- }
580
- declare module "svg-path-commander/src/process/splitCubic" {
581
- /**
582
- * Split a cubic-bezier segment into two.
583
- *
584
- * @param {number[]} pts the cubic-bezier parameters
585
- * @return {SVGPath.cubicSegment[]} two new cubic-bezier segments
586
- */
587
- export default function splitCubic(pts: number[]): SVGPath.cubicSegment[];
588
- }
589
- declare module "svg-path-commander/src/process/splitPath" {
590
- /**
591
- * Split a path into an `Array` of sub-path strings.
592
- *
593
- * In the process, values are converted to absolute
594
- * for visual consistency.
595
- *
596
- * @param {SVGPath.pathArray} pathInput the source `pathArray`
597
- * @return {SVGPath.pathArray[]} an array with all sub-path strings
598
- */
599
- export default function splitPath(pathInput: SVGPath.pathArray): SVGPath.pathArray[];
600
- }
601
- declare module "svg-path-commander/src/process/transformEllipse" {
602
- /**
603
- * Apply a 2D transformation matrix to an ellipse.
604
- *
605
- * @param {number[]} m the 2D transformation matrix
606
- * @param {number} rx ellipse radius X
607
- * @param {number} ry ellipse radius Y
608
- * @param {number} ax ellipse rotation angle
609
- */
610
- export default function transformEllipse(m: number[], rx: number, ry: number, ax: number): {
611
- rx: number;
612
- ry: number;
613
- ax: number;
614
- };
615
- }
616
- declare module "svg-path-commander/src/process/transformPath" {
617
- /**
618
- * Apply a 2D / 3D transformation to a `pathArray` instance.
619
- *
620
- * Since *SVGElement* doesn't support 3D transformation, this function
621
- * creates a 2D projection of the <path> element.
622
- *
623
- * @param {SVGPath.pathArray} path the `pathArray` to apply transformation
624
- * @param {SVGPath.transformObject} transform the transform functions `Object`
625
- * @returns {SVGPath.pathArray} the resulted `pathArray`
626
- */
627
- export default function transformPath(path: SVGPath.pathArray, transform: SVGPath.transformObject): SVGPath.pathArray;
628
- }
629
- declare module "svg-path-commander/src/util/getPathArea" {
630
- /**
631
- * Returns the area of a shape.
632
- * @author Jürg Lehni & Jonathan Puckey
633
- *
634
- * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js
635
- *
636
- * @param {SVGPath.pathArray} path the shape `pathArray`
637
- * @returns {number} the length of the cubic-bezier segment
638
- */
639
- export default function getPathArea(path: SVGPath.pathArray): number;
640
- }
641
- declare module "svg-path-commander/src/util/getDrawDirection" {
642
- /**
643
- * Check if a path is drawn clockwise and returns true if so,
644
- * false otherwise.
645
- *
646
- * @param {SVGPath.pathArray} path the path string or `pathArray`
647
- * @returns {boolean} true when clockwise or false if not
648
- */
649
- export default function getDrawDirection(path: SVGPath.pathArray): boolean;
650
- }
651
- declare module "svg-path-commander/src/util/segmentCubicFactory" {
652
- /**
653
- * Returns the length of a C (cubic-bezier) segment
654
- * or an {x,y} point at a given length.
655
- *
656
- * @param {number} x1 the starting point X
657
- * @param {number} y1 the starting point Y
658
- * @param {number} c1x the first control point X
659
- * @param {number} c1y the first control point Y
660
- * @param {number} c2x the second control point X
661
- * @param {number} c2y the second control point Y
662
- * @param {number} x2 the ending point X
663
- * @param {number} y2 the ending point Y
664
- * @param {number=} distance the point distance
665
- * @returns {SVGPath.lengthFactory} the segment length, point, min & max
666
- */
667
- export default function segmentCubicFactory(x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number, distance?: number | undefined): SVGPath.lengthFactory;
668
- }
669
- declare module "svg-path-commander/src/util/segmentArcFactory" {
670
- /**
671
- * Returns a {x,y} point at a given length, the total length and
672
- * the shape minimum and maximum {x,y} coordinates of an A (arc-to) segment.
673
- *
674
- * @param {number} X1 the starting x position
675
- * @param {number} Y1 the starting y position
676
- * @param {number} RX x-radius of the arc
677
- * @param {number} RY y-radius of the arc
678
- * @param {number} angle x-axis-rotation of the arc
679
- * @param {number} LAF large-arc-flag of the arc
680
- * @param {number} SF sweep-flag of the arc
681
- * @param {number} X2 the ending x position
682
- * @param {number} Y2 the ending y position
683
- * @param {number} distance the point distance
684
- * @returns {SVGPath.lengthFactory} the segment length, point, min & max
685
- */
686
- export default function segmentArcFactory(X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, distance: number): SVGPath.lengthFactory;
687
- }
688
- declare module "svg-path-commander/src/util/segmentQuadFactory" {
689
- /**
690
- * Returns a {x,y} point at a given length, the total length and
691
- * the minimum and maximum {x,y} coordinates of a Q (quadratic-bezier) segment.
692
- *
693
- * @param {number} x1 the starting point X
694
- * @param {number} y1 the starting point Y
695
- * @param {number} qx the control point X
696
- * @param {number} qy the control point Y
697
- * @param {number} x2 the ending point X
698
- * @param {number} y2 the ending point Y
699
- * @param {number=} distance the distance to point
700
- * @returns {SVGPath.lengthFactory} the segment length, point, min & max
701
- */
702
- export default function segmentQuadFactory(x1: number, y1: number, qx: number, qy: number, x2: number, y2: number, distance?: number | undefined): SVGPath.lengthFactory;
703
- }
704
- declare module "svg-path-commander/src/util/pathLengthFactory" {
705
- /**
706
- * Returns a {x,y} point at a given length
707
- * of a shape, the shape total length and
708
- * the shape minimum and maximum {x,y} coordinates.
709
- *
710
- * @param {string | SVGPath.pathArray} pathInput the `pathArray` to look into
711
- * @param {number=} distance the length of the shape to look at
712
- * @returns {SVGPath.lengthFactory} the path length, point, min & max
713
- */
714
- export default function pathLengthFactory(pathInput: string | SVGPath.pathArray, distance?: number | undefined): SVGPath.lengthFactory;
715
- }
716
- declare module "svg-path-commander/src/util/getPathBBox" {
717
- /**
718
- * Returns the bounding box of a shape.
719
- *
720
- * @param {SVGPath.pathArray=} path the shape `pathArray`
721
- * @returns {SVGPath.pathBBox} the length of the cubic-bezier segment
722
- */
723
- export default function getPathBBox(path?: SVGPath.pathArray | undefined): SVGPath.pathBBox;
724
- }
725
- declare module "svg-path-commander/src/util/getTotalLength" {
726
- /**
727
- * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.
728
- *
729
- * The `normalizePath` version is lighter, faster, more efficient and more accurate
730
- * with paths that are not `curveArray`.
731
- *
732
- * @param {string | SVGPath.pathArray} pathInput the target `pathArray`
733
- * @returns {number} the shape total length
734
- */
735
- export default function getTotalLength(pathInput: string | SVGPath.pathArray): number;
736
- }
737
- declare module "svg-path-commander/src/util/getPointAtLength" {
738
- /**
739
- * Returns [x,y] coordinates of a point at a given length of a shape.
740
- *
741
- * @param {string | SVGPath.pathArray} pathInput the `pathArray` to look into
742
- * @param {number} distance the length of the shape to look at
743
- * @returns {{x: number, y: number}} the requested {x, y} point coordinates
744
- */
745
- export default function getPointAtLength(pathInput: string | SVGPath.pathArray, distance: number): {
746
- x: number;
747
- y: number;
748
- };
749
- }
750
- declare module "svg-path-commander/src/util/getPropertiesAtLength" {
751
- /**
752
- * Returns the segment, its index and length as well as
753
- * the length to that segment at a given length in a path.
754
- *
755
- * @param {string | SVGPath.pathArray} pathInput target `pathArray`
756
- * @param {number=} distance the given length
757
- * @returns {SVGPath.segmentProperties=} the requested properties
758
- */
759
- export default function getPropertiesAtLength(pathInput: string | SVGPath.pathArray, distance?: number | undefined): SVGPath.segmentProperties | undefined;
760
- }
761
- declare module "svg-path-commander/src/util/getPropertiesAtPoint" {
762
- /**
763
- * Returns the point and segment in path closest to a given point as well as
764
- * the distance to the path stroke.
765
- * @see https://bl.ocks.org/mbostock/8027637
766
- *
767
- * @param {string | SVGPath.pathArray} pathInput target `pathArray`
768
- * @param {{x: number, y: number}} point the given point
769
- * @returns {SVGPath.pointProperties} the requested properties
770
- */
771
- export default function getPropertiesAtPoint(pathInput: string | SVGPath.pathArray, point: {
772
- x: number;
773
- y: number;
774
- }): SVGPath.pointProperties;
775
- }
776
- declare module "svg-path-commander/src/util/getClosestPoint" {
777
- /**
778
- * Returns the point in path closest to a given point.
779
- *
780
- * @param {string | SVGPath.pathArray} pathInput target `pathArray`
781
- * @param {{x: number, y: number}} point the given point
782
- * @returns {{x: number, y: number}} the best match
783
- */
784
- export default function getClosestPoint(pathInput: string | SVGPath.pathArray, point: {
785
- x: number;
786
- y: number;
787
- }): {
788
- x: number;
789
- y: number;
790
- };
791
- }
792
- declare module "svg-path-commander/src/util/getSegmentAtLength" {
793
- /**
794
- * Returns the segment at a given length.
795
- * @param {string | SVGPath.pathArray} pathInput the target `pathArray`
796
- * @param {number} distance the distance in path to look at
797
- * @returns {SVGPath.pathSegment?} the requested segment
798
- */
799
- export default function getSegmentAtLength(pathInput: string | SVGPath.pathArray, distance: number): SVGPath.pathSegment | null;
800
- }
801
- declare module "svg-path-commander/src/util/getSegmentOfPoint" {
802
- /**
803
- * Returns the path segment which contains a given point.
804
- *
805
- * @param {string | SVGPath.pathArray} path the `pathArray` to look into
806
- * @param {{x: number, y: number}} point the point of the shape to look for
807
- * @returns {SVGPath.pathSegment?} the requested segment
808
- */
809
- export default function getSegmentOfPoint(path: string | SVGPath.pathArray, point: {
810
- x: number;
811
- y: number;
812
- }): SVGPath.pathSegment | null;
813
- }
814
- declare module "svg-path-commander/src/util/isPointInStroke" {
815
- /**
816
- * Checks if a given point is in the stroke of a path.
817
- *
818
- * @param {string | SVGPath.pathArray} pathInput target path
819
- * @param {{x: number, y: number}} point the given `{x,y}` point
820
- * @returns {boolean} the query result
821
- */
822
- export default function isPointInStroke(pathInput: string | SVGPath.pathArray, point: {
823
- x: number;
824
- y: number;
825
- }): boolean;
826
- }
827
- declare module "svg-path-commander/src/util/isValidPath" {
828
- /**
829
- * Parses a path string value to determine its validity
830
- * then returns true if it's valid or false otherwise.
831
- *
832
- * @param {string} pathString the path string to be parsed
833
- * @returns {boolean} the path string validity
834
- */
835
- export default function isValidPath(pathString: string): boolean;
836
- }
837
- declare module "svg-path-commander/src/util/shapeToPath" {
838
- /**
839
- * Returns a new `pathArray` from line attributes.
840
- *
841
- * @param {SVGPath.lineAttr} attr shape configuration
842
- * @returns {SVGPath.pathArray} a new line `pathArray`
843
- */
844
- export function getLinePath(attr: SVGPath.lineAttr): SVGPath.pathArray;
845
- /**
846
- * Returns a new `pathArray` like from polyline/polygon attributes.
847
- *
848
- * @param {SVGPath.polyAttr} attr shape configuration
849
- * @return {SVGPath.pathArray} a new polygon/polyline `pathArray`
850
- */
851
- export function getPolyPath(attr: SVGPath.polyAttr): SVGPath.pathArray;
852
- /**
853
- * Returns a new `pathArray` from circle attributes.
854
- *
855
- * @param {SVGPath.circleAttr} attr shape configuration
856
- * @return {SVGPath.pathArray} a circle `pathArray`
857
- */
858
- export function getCirclePath(attr: SVGPath.circleAttr): SVGPath.pathArray;
859
- /**
860
- * Returns a new `pathArray` from ellipse attributes.
861
- *
862
- * @param {SVGPath.ellipseAttr} attr shape configuration
863
- * @return {SVGPath.pathArray} an ellipse `pathArray`
864
- */
865
- export function getEllipsePath(attr: SVGPath.ellipseAttr): SVGPath.pathArray;
866
- /**
867
- * Returns a new `pathArray` like from rect attributes.
868
- *
869
- * @param {SVGPath.rectAttr} attr object with properties above
870
- * @return {SVGPath.pathArray} a new `pathArray` from `<rect>` attributes
871
- */
872
- export function getRectanglePath(attr: SVGPath.rectAttr): SVGPath.pathArray;
873
- /**
874
- * Returns a new `<path>` element created from attributes of a `<line>`, `<polyline>`,
875
- * `<polygon>`, `<rect>`, `<ellipse>`, `<circle>` or `<glyph>`. If `replace` parameter
876
- * is `true`, it will replace the target.
877
- *
878
- * It can also work with an options object,
879
- * @see SVGPath.shapeOps
880
- *
881
- * The newly created `<path>` element keeps all non-specific
882
- * attributes like `class`, `fill`, etc.
883
- *
884
- * @param {SVGPath.shapeTypes | SVGPath.shapeOps} element target shape
885
- * @param {boolean=} replace option to replace target
886
- * @return {SVGPathElement | boolean} the newly created `<path>` element
887
- */
888
- export default function shapeToPath(element: SVGPath.shapeTypes | SVGPath.shapeOps, replace?: boolean | undefined): SVGPathElement | boolean;
889
- }
890
- declare module "svg-path-commander/src/version" {
891
- export default Version;
892
- /**
893
- * A global namespace for library version.
894
- * @type {string}
895
- */
896
- const Version: string;
897
- }
898
- declare module "svg-path-commander/src/svg-path-commander" {
899
- export default SVGPathCommander;
900
- /**
901
- * Creates a new SVGPathCommander instance with the following properties:
902
- * * segments: `pathArray`
903
- * * round: number
904
- * * origin: [number, number, number?]
905
- *
906
- * @class
907
- * @author thednp <https://github.com/thednp/svg-path-commander>
908
- * @returns {SVGPathCommander} a new SVGPathCommander instance
909
- */
910
- class SVGPathCommander {
911
- /**
912
- * @constructor
913
- * @param {string} pathValue the path string
914
- * @param {any} config instance options
915
- */
916
- constructor(pathValue: string, config: any);
917
- /**
918
- * @type {SVGPath.pathArray}
919
- */
920
- segments: SVGPath.pathArray;
921
- /**
922
- * @type {number | 'off'}
923
- */
924
- round: number | 'off';
925
- origin: number[];
926
- /**
927
- * Returns the path bounding box, equivalent to native `path.getBBox()`.
928
- * @public
929
- * @returns {SVGPath.pathBBox}
930
- */
931
- public getBBox(): SVGPath.pathBBox;
932
- /**
933
- * Returns the total path length, equivalent to native `path.getTotalLength()`.
934
- * @public
935
- * @returns {number}
936
- */
937
- public getTotalLength(): number;
938
- /**
939
- * Returns an `{x,y}` point in the path stroke at a given length,
940
- * equivalent to the native `path.getPointAtLength()`.
941
- *
942
- * @public
943
- * @param {number} length the length
944
- * @returns {{x: number, y:number}} the requested point
945
- */
946
- public getPointAtLength(length: number): {
947
- x: number;
948
- y: number;
949
- };
950
- /**
951
- * Convert path to absolute values
952
- * @public
953
- */
954
- public toAbsolute(): SVGPathCommander;
955
- /**
956
- * Convert path to relative values
957
- * @public
958
- */
959
- public toRelative(): SVGPathCommander;
960
- /**
961
- * Convert path to cubic-bezier values. In addition, un-necessary `Z`
962
- * segment is removed if previous segment extends to the `M` segment.
963
- *
964
- * @public
965
- */
966
- public toCurve(): SVGPathCommander;
967
- /**
968
- * Reverse the order of the segments and their values.
969
- * @param {boolean} onlySubpath option to reverse all sub-paths except first
970
- * @public
971
- */
972
- public reverse(onlySubpath: boolean): SVGPathCommander;
973
- /**
974
- * Normalize path in 2 steps:
975
- * * convert `pathArray`(s) to absolute values
976
- * * convert shorthand notation to standard notation
977
- * @public
978
- */
979
- public normalize(): SVGPathCommander;
980
- /**
981
- * Optimize `pathArray` values:
982
- * * convert segments to absolute and/or relative values
983
- * * select segments with shortest resulted string
984
- * * round values to the specified `decimals` option value
985
- * @public
986
- */
987
- public optimize(): SVGPathCommander;
988
- /**
989
- * Transform path using values from an `Object` defined as `transformObject`.
990
- * @see SVGPath.transformObject for a quick refference
991
- *
992
- * @param {SVGPath.transformObject} source a `transformObject`as described above
993
- * @public
994
- */
995
- public transform(source: SVGPath.transformObject): SVGPathCommander;
996
- /**
997
- * Rotate path 180deg horizontally
998
- * @public
999
- */
1000
- public flipX(): SVGPathCommander;
1001
- /**
1002
- * Rotate path 180deg vertically
1003
- * @public
1004
- */
1005
- public flipY(): SVGPathCommander;
1006
- /**
1007
- * Export the current path to be used
1008
- * for the `d` (description) attribute.
1009
- * @public
1010
- * @return {String} the path string
1011
- */
1012
- public toString(): string;
1013
- }
1014
- }
1015
- declare module "svg-path-commander/types/more/modules" {
1016
- export { default as pathToAbsolute } from "svg-path-commander/src/convert/pathToAbsolute";
1017
- export { default as pathToRelative } from "svg-path-commander/src/convert/pathToRelative";
1018
- export { default as pathToCurve } from "svg-path-commander/src/convert/pathToCurve";
1019
- export { default as pathToString } from "svg-path-commander/src/convert/pathToString";
1020
- export { default as distanceSquareRoot } from "svg-path-commander/src/math/distanceSquareRoot";
1021
- export { default as epsilon } from "svg-path-commander/src/math/epsilon";
1022
- export { default as midPoint } from "svg-path-commander/src/math/midPoint";
1023
- export { default as polygonArea } from "svg-path-commander/src/math/polygonArea";
1024
- export { default as polygonLength } from "svg-path-commander/src/math/polygonLength";
1025
- export { default as rotateVector } from "svg-path-commander/src/math/rotateVector";
1026
- export { default as defaultOptions } from "svg-path-commander/src/options/options";
1027
- export { default as finalizeSegment } from "svg-path-commander/src/parser/finalizeSegment";
1028
- export { default as invalidPathValue } from "svg-path-commander/src/parser/invalidPathValue";
1029
- export { default as isArcCommand } from "svg-path-commander/src/parser/isArcCommand";
1030
- export { default as isDigit } from "svg-path-commander/src/parser/isDigit";
1031
- export { default as isDigitStart } from "svg-path-commander/src/parser/isDigitStart";
1032
- export { default as isPathCommand } from "svg-path-commander/src/parser/isPathCommand";
1033
- export { default as isSpace } from "svg-path-commander/src/parser/isSpace";
1034
- export { default as paramsCount } from "svg-path-commander/src/parser/paramsCount";
1035
- export { default as paramsParser } from "svg-path-commander/src/parser/paramsParser";
1036
- export { default as parsePathString } from "svg-path-commander/src/parser/parsePathString";
1037
- export { default as PathParser } from "svg-path-commander/src/parser/pathParser";
1038
- export { default as scanFlag } from "svg-path-commander/src/parser/scanFlag";
1039
- export { default as scanParam } from "svg-path-commander/src/parser/scanParam";
1040
- export { default as scanSegment } from "svg-path-commander/src/parser/scanSegment";
1041
- export { default as skipSpaces } from "svg-path-commander/src/parser/skipSpaces";
1042
- export { default as arcToCubic } from "svg-path-commander/src/process/arcToCubic";
1043
- export { default as clonePath } from "svg-path-commander/src/process/clonePath";
1044
- export { default as fixArc } from "svg-path-commander/src/process/fixArc";
1045
- export { default as fixPath } from "svg-path-commander/src/process/fixPath";
1046
- export { default as getSVGMatrix } from "svg-path-commander/src/process/getSVGMatrix";
1047
- export { default as lineToCubic } from "svg-path-commander/src/process/lineToCubic";
1048
- export { default as normalizePath } from "svg-path-commander/src/process/normalizePath";
1049
- export { default as normalizeSegment } from "svg-path-commander/src/process/normalizeSegment";
1050
- export { default as optimizePath } from "svg-path-commander/src/process/optimizePath";
1051
- export { default as projection2d } from "svg-path-commander/src/process/projection2d";
1052
- export { default as quadToCubic } from "svg-path-commander/src/process/quadToCubic";
1053
- export { default as reverseCurve } from "svg-path-commander/src/process/reverseCurve";
1054
- export { default as reversePath } from "svg-path-commander/src/process/reversePath";
1055
- export { default as roundPath } from "svg-path-commander/src/process/roundPath";
1056
- export { default as segmentToCubic } from "svg-path-commander/src/process/segmentToCubic";
1057
- export { default as shortenSegment } from "svg-path-commander/src/process/shortenSegment";
1058
- export { default as shorthandToCubic } from "svg-path-commander/src/process/shorthandToCubic";
1059
- export { default as shorthandToQuad } from "svg-path-commander/src/process/shorthandToQuad";
1060
- export { default as splitCubic } from "svg-path-commander/src/process/splitCubic";
1061
- export { default as splitPath } from "svg-path-commander/src/process/splitPath";
1062
- export { default as transformEllipse } from "svg-path-commander/src/process/transformEllipse";
1063
- export { default as transformPath } from "svg-path-commander/src/process/transformPath";
1064
- export { default as getDrawDirection } from "svg-path-commander/src/util/getDrawDirection";
1065
- export { default as getPathArea } from "svg-path-commander/src/util/getPathArea";
1066
- export { default as getPathBBox } from "svg-path-commander/src/util/getPathBBox";
1067
- export { default as pathLengthFactory } from "svg-path-commander/src/util/pathLengthFactory";
1068
- export { default as getTotalLength } from "svg-path-commander/src/util/getTotalLength";
1069
- export { default as segmentLineFactory } from "svg-path-commander/src/util/segmentLineFactory";
1070
- export { default as segmentArcFactory } from "svg-path-commander/src/util/segmentArcFactory";
1071
- export { default as segmentCubicFactory } from "svg-path-commander/src/util/segmentCubicFactory";
1072
- export { default as segmentQuadFactory } from "svg-path-commander/src/util/segmentQuadFactory";
1073
- export { default as getPointAtLength } from "svg-path-commander/src/util/getPointAtLength";
1074
- export { default as getPropertiesAtPoint } from "svg-path-commander/src/util/getPropertiesAtPoint";
1075
- export { default as getPropertiesAtLength } from "svg-path-commander/src/util/getPropertiesAtLength";
1076
- export { default as getClosestPoint } from "svg-path-commander/src/util/getClosestPoint";
1077
- export { default as getSegmentAtLength } from "svg-path-commander/src/util/getSegmentAtLength";
1078
- export { default as getSegmentOfPoint } from "svg-path-commander/src/util/getSegmentOfPoint";
1079
- export { default as isPointInStroke } from "svg-path-commander/src/util/isPointInStroke";
1080
- export { default as isAbsoluteArray } from "svg-path-commander/src/util/isAbsoluteArray";
1081
- export { default as isCurveArray } from "svg-path-commander/src/util/isCurveArray";
1082
- export { default as isNormalizedArray } from "svg-path-commander/src/util/isNormalizedArray";
1083
- export { default as isPathArray } from "svg-path-commander/src/util/isPathArray";
1084
- export { default as isRelativeArray } from "svg-path-commander/src/util/isRelativeArray";
1085
- export { default as isValidPath } from "svg-path-commander/src/util/isValidPath";
1086
- export { default as shapeToPath } from "svg-path-commander/src/util/shapeToPath";
1087
- export { default as Version } from "svg-path-commander/src/version";
1088
- export { default as SVGPathCommander } from "svg-path-commander/src/svg-path-commander";
1089
- }