svg-path-commander 0.1.5 → 0.1.9

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 (92) hide show
  1. package/README.md +1 -13
  2. package/dist/svg-path-commander.esm.js +1601 -872
  3. package/dist/svg-path-commander.esm.min.js +2 -2
  4. package/dist/svg-path-commander.js +1436 -690
  5. package/dist/svg-path-commander.min.js +2 -2
  6. package/package.json +8 -3
  7. package/src/class/svg-path-commander.js +179 -0
  8. package/src/class/version.js +9 -0
  9. package/src/convert/pathToAbsolute.js +18 -12
  10. package/src/convert/pathToCurve.js +23 -19
  11. package/src/convert/pathToRelative.js +19 -12
  12. package/src/convert/pathToString.js +13 -2
  13. package/src/index.js +6 -3
  14. package/src/math/distanceSquareRoot.js +8 -0
  15. package/src/math/epsilon.js +8 -1
  16. package/src/math/midPoint.js +10 -4
  17. package/src/math/polygonArea.js +9 -2
  18. package/src/math/polygonLength.js +13 -7
  19. package/src/math/rotateVector.js +13 -0
  20. package/src/options/options.js +5 -0
  21. package/src/parser/finalizeSegment.js +31 -0
  22. package/src/parser/invalidPathValue.js +2 -0
  23. package/src/parser/isArcCommand.js +10 -0
  24. package/src/parser/isDigit.js +9 -0
  25. package/src/{util → parser}/isDigitStart.js +7 -0
  26. package/src/{util → parser}/isPathCommand.js +7 -1
  27. package/src/parser/isSpace.js +16 -0
  28. package/src/parser/paramsCount.js +8 -0
  29. package/src/parser/parsePathString.js +40 -0
  30. package/src/parser/scanFlag.js +26 -0
  31. package/src/parser/scanParam.js +97 -0
  32. package/src/parser/scanSegment.js +70 -0
  33. package/src/parser/skipSpaces.js +15 -0
  34. package/src/parser/svgPathArray.js +23 -0
  35. package/src/process/arcToCubic.js +27 -12
  36. package/src/process/clonePath.js +8 -2
  37. package/src/process/fixArc.js +21 -0
  38. package/src/{util → process}/getSVGMatrix.js +14 -12
  39. package/src/process/lineToCubic.js +11 -2
  40. package/src/process/normalizePath.js +19 -12
  41. package/src/process/normalizeSegment.js +10 -2
  42. package/src/process/optimizePath.js +16 -5
  43. package/src/{util → process}/projection2d.js +13 -5
  44. package/src/process/quadToCubic.js +11 -0
  45. package/src/process/reverseCurve.js +11 -5
  46. package/src/process/reversePath.js +18 -11
  47. package/src/process/roundPath.js +16 -11
  48. package/src/process/segmentToCubic.js +10 -3
  49. package/src/process/shorthandToCubic.js +11 -1
  50. package/src/process/shorthandToQuad.js +11 -1
  51. package/src/process/splitCubic.js +9 -3
  52. package/src/process/splitPath.js +11 -2
  53. package/src/{util → process}/transformEllipse.js +9 -1
  54. package/src/process/transformPath.js +26 -17
  55. package/src/util/createPath.js +16 -7
  56. package/src/util/getCubicSize.js +14 -2
  57. package/src/util/getDrawDirection.js +11 -4
  58. package/src/util/getPathArea.js +30 -8
  59. package/src/util/getPathBBox.js +13 -7
  60. package/src/util/getPathLength.js +14 -8
  61. package/src/util/getPointAtLength.js +12 -7
  62. package/src/util/getPointAtSegLength.js +15 -1
  63. package/src/util/getSegArcLength.js +8 -5
  64. package/src/util/getSegCubicLength.js +14 -1
  65. package/src/util/getSegLineLength.js +10 -2
  66. package/src/util/getSegQuadLength.js +13 -1
  67. package/src/util/isAbsoluteArray.js +10 -3
  68. package/src/util/isCurveArray.js +10 -3
  69. package/src/util/isNormalizedArray.js +14 -5
  70. package/src/util/isPathArray.js +11 -5
  71. package/src/util/isRelativeArray.js +11 -4
  72. package/src/util/isValidPath.js +26 -0
  73. package/src/util/shapeToPath.js +169 -0
  74. package/src/util/util.js +36 -29
  75. package/types/index.d.ts +931 -0
  76. package/types/types.d.ts +69 -0
  77. package/src/class/SVGPathCommander.js +0 -107
  78. package/src/process/finalizeSegment.js +0 -26
  79. package/src/process/parsePathString.js +0 -36
  80. package/src/process/scanFlag.js +0 -20
  81. package/src/process/scanParam.js +0 -93
  82. package/src/process/scanSegment.js +0 -76
  83. package/src/process/skipSpaces.js +0 -7
  84. package/src/util/DOMMatrix.js +0 -5
  85. package/src/util/fixArc.js +0 -16
  86. package/src/util/invalidPathValue.js +0 -1
  87. package/src/util/isArcCommand.js +0 -4
  88. package/src/util/isDigit.js +0 -3
  89. package/src/util/isSpace.js +0 -9
  90. package/src/util/paramsCount.js +0 -3
  91. package/src/util/rotateVector.js +0 -5
  92. package/src/util/svgPathArray.js +0 -11
package/README.md CHANGED
@@ -1,13 +1,11 @@
1
1
  # SVG Path Commander
2
2
 
3
- [![SVG Path Commander](assets/apple-touch-icon.png)](https://thednp.github.io/svg-path-commander/)
4
-
5
3
  A modern set of ES6+ JavaScript tools for manipulating the `d` (description) attribute for *SVGPathElement* items, and is implementing modern JavaScript API to produce reusable path strings with lossless quality.
6
4
 
7
5
  While you may find familiar tools inside, this library brings ***new additions***:
8
6
  * a tool that can *reverse path draw direction* without altering path commands, even with specific shorthand path commands;
9
7
  * a unique tool that can *reverse path draw direction* for path strings with only 'C' path commands;
10
- * a new and unique tool to *apply transform functions to path commands* via the modern DOMMatrix API.
8
+ * a new and unique tool to *apply transform functions to path commands* via the modern *DOMMatrix* API.
11
9
 
12
10
  **The key differences with other libraries**:
13
11
  * ES6+ sourced with modernized codebase and build tools; all inherited codebase has been modernized as well;
@@ -59,16 +57,6 @@ For developer guidelines, head over to the [wiki pages](https://github.com/thedn
59
57
  * animators that work with SVGs and need tools for performing specific path command processing;
60
58
  * font-icon creators can use it in both Node.js and web applications to process and test their creations.
61
59
 
62
- # ESLint
63
- Some of the sources for the library recommend using the following ESLint rule:
64
-
65
- ```js
66
- rules: {
67
- // Disable bitwise for isArcCommand & isPathCommand
68
- "no-bitwise": 0,
69
- }
70
- ```
71
-
72
60
 
73
61
  # Technical Considerations
74
62