svg-path-simplify 0.4.5 → 0.4.7

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 (42) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +24 -14
  3. package/dist/svg-path-simplify.esm.js +1620 -1216
  4. package/dist/svg-path-simplify.esm.min.js +2 -2
  5. package/dist/svg-path-simplify.js +1620 -1215
  6. package/dist/svg-path-simplify.min.js +2 -2
  7. package/dist/svg-path-simplify.pathdata.esm.js +298 -665
  8. package/dist/svg-path-simplify.pathdata.esm.min.js +2 -2
  9. package/dist/svg-path-simplify.poly.cjs +8 -9
  10. package/drawing.svg +62 -0
  11. package/index.html +11 -5
  12. package/package.json +1 -1
  13. package/src/index.js +3 -1
  14. package/src/pathData_get_intersections.js +777 -0
  15. package/src/pathData_offset.js +201 -0
  16. package/src/pathData_simplify_cubic.js +14 -34
  17. package/src/pathData_simplify_cubic_extrapolate.js +147 -8
  18. package/src/pathData_simplify_cubicsToArcs.js +65 -21
  19. package/src/pathSimplify-main.js +259 -60
  20. package/src/pathSimplify-presets.js +1 -0
  21. package/src/poly-fit-curve-schneider.js +171 -132
  22. package/src/poly-fit-curve-schneider_check_bulge.js +131 -0
  23. package/src/poly-offset.js +133 -0
  24. package/src/simplify_poly_RC.js +29 -7
  25. package/src/svgii/geometry.js +130 -27
  26. package/src/svgii/geometry_bbox.js +1 -1
  27. package/src/svgii/pathData_analyze.js +6 -28
  28. package/src/svgii/pathData_convert.js +70 -15
  29. package/src/svgii/pathData_remove_collinear.js +32 -36
  30. package/src/svgii/pathData_simplify_refineExtremes.js +1 -3
  31. package/src/svgii/pathData_stringify.js +132 -6
  32. package/src/svgii/pathData_toPolygon.js +33 -23
  33. package/src/svgii/poly_analyze.js +272 -125
  34. package/src/svgii/poly_analyze_cleanup.js +311 -0
  35. package/src/svgii/poly_analyze_getTangents.js +125 -0
  36. package/src/svgii/poly_analyze_get_chunks.js +3 -1
  37. package/src/svgii/poly_normalize.js +12 -0
  38. package/src/svgii/poly_to_pathdata.js +477 -8
  39. package/src/svgii/rounding.js +29 -39
  40. package/src/svgii/svg_cleanup.js +42 -54
  41. package/src/svgii/svg_cleanup_normalize_transforms.js +1 -1
  42. package/src/svgii/visualize.js +33 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.7] - 2026-06-30
4
+ ### Fixed
5
+ - arc parsing for negative radii – force positive values
6
+
7
+
8
+ ## [0.4.6] - 2026-04-03
9
+ ### Fixed
10
+ - better cubic to arc radii simplification
11
+ - autoAccuracy evaluation for arcs – it's always a pain-in-the-arc
12
+ - SVG attribute removal/inheritance
13
+ ### Added
14
+ - prototype methods for svg, polygon or d retrieval
15
+ - verbose and beautified pathdata output return true arc radii instead of minified
16
+
3
17
  ## [0.4.5] - 2026-04-02
4
18
  ### Fixed
5
19
  - stroke-dash conversion must disable reordering of commands
package/README.md CHANGED
@@ -31,8 +31,16 @@ Unlike most existing approaches (e.g in graphic applications), it checks where s
31
31
  * cubics to quadratic Béziers (only 1 control point)
32
32
  * cubic arc-like segments to `A` (elliptic arc) and `rx`, `ry` radii optimization for semi-circle segments
33
33
 
34
+ ### Multiple input formats
35
+ For more convenience pretty much any vector input are supported:
36
+ * stringified `d` path data for single paths
37
+ * SVG2 pathData arrays (parsed via `getPathData()`)
38
+ * XML markup for complete SVG files
39
+ * polygon/polyline data provided as point object array, nested array or string
40
+
34
41
  ### Coordinate rounding
35
42
  * adaptive coordinate rounding: small or large details can be auto-detected to find a suitable floating point accuracy without guessing the decimal value (3 decimals may not be the silver bullet=)
43
+ * quantized half-decimal rounding
36
44
 
37
45
  ### SVG optimization
38
46
  Cleanup for:
@@ -95,6 +103,22 @@ Cleanup for:
95
103
 
96
104
  ## Usage
97
105
 
106
+ ### Web app
107
+ You can easily test this library via the [**webapp**](https://herrstrietzel.github.io/svg-path-simplify/) or by checking the demo folder.
108
+
109
+ [![svg-path-simplify web app](./demo/img/svg-path-simplify-webapp.png)](https://herrstrietzel.github.io/svg-path-simplify/)
110
+
111
+ #### Features
112
+ * test all provided simplification option - export settings as JS object
113
+ * preview different settings
114
+ * accepts SVG files
115
+ * path data strings
116
+ * supports multi file batch processing
117
+ * open results in codepen or svg-path-editor
118
+ * download self contained SVG
119
+
120
+
121
+
98
122
  ### Browser
99
123
 
100
124
  #### Example 1: parse and simplify (using defaults)
@@ -291,20 +315,6 @@ let pathDataOpt = simplifyPathData(pathDataString);
291
315
 
292
316
 
293
317
  ## Demos
294
- ### Web app
295
- You can easily test this library via the [**webapp**](https://herrstrietzel.github.io/svg-path-simplify/) or by checking the demo folder.
296
-
297
- ![svg-path-simplify web app](./demo/img/svg-path-simplify-webapp.png)
298
-
299
- #### Features
300
- * test all provided simplification option - export settings as JS object
301
- * preview different settings
302
- * accepts SVG files
303
- * path data strings
304
- * supports multi file batch processing
305
- * open results in codepen or svg-path-editor
306
- * download self contained SVG
307
-
308
318
 
309
319
  ### Demo files
310
320
  * [simple setup IIFE](./demo/simple-iife.html)