svg-path-simplify 0.4.4 → 0.4.6

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 (48) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +9 -1
  3. package/dist/svg-path-simplify.esm.js +1649 -1205
  4. package/dist/svg-path-simplify.esm.min.js +2 -2
  5. package/dist/svg-path-simplify.js +1649 -1204
  6. package/dist/svg-path-simplify.min.js +2 -2
  7. package/dist/svg-path-simplify.pathdata.esm.js +301 -637
  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 +13 -8
  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 +19 -21
  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 +267 -64
  20. package/src/pathSimplify-presets.js +1 -1
  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/svg-getAttributes.js +1 -1
  26. package/src/svgii/geometry.js +130 -27
  27. package/src/svgii/geometry_bbox.js +1 -1
  28. package/src/svgii/geometry_length.js +1 -1
  29. package/src/svgii/pathData_analyze.js +6 -28
  30. package/src/svgii/pathData_convert.js +63 -15
  31. package/src/svgii/pathData_remove_collinear.js +32 -36
  32. package/src/svgii/pathData_reorder.js +3 -2
  33. package/src/svgii/pathData_simplify_refineExtremes.js +1 -3
  34. package/src/svgii/pathData_stringify.js +132 -6
  35. package/src/svgii/pathData_toPolygon.js +33 -23
  36. package/src/svgii/poly_analyze.js +272 -125
  37. package/src/svgii/poly_analyze_cleanup.js +311 -0
  38. package/src/svgii/poly_analyze_getTangents.js +125 -0
  39. package/src/svgii/poly_analyze_get_chunks.js +3 -1
  40. package/src/svgii/poly_normalize.js +21 -8
  41. package/src/svgii/poly_to_pathdata.js +477 -8
  42. package/src/svgii/rounding.js +35 -14
  43. package/src/svgii/svg_cleanup.js +44 -51
  44. package/src/svgii/svg_cleanup_convertPathLength.js +5 -0
  45. package/src/svgii/svg_cleanup_normalize_transforms.js +2 -2
  46. package/src/svgii/visualize.js +33 -2
  47. package/v/0.4.5/index.html +1040 -0
  48. package/v/0.4.5/svg-path-simplify.js +13227 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.4.6] - 2026-04-03
4
+ ### Fixed
5
+ - better cubic to arc radii simplification
6
+ - autoAccuracy evaluation for arcs – it's always a pain-in-the-arc
7
+ - SVG attribute removal/inheritance
8
+ ### Added
9
+ - prototype methods for svg, polygon or d retrieval
10
+ - verbose and beautified pathdata output return true arc radii instead of minified
11
+
12
+ ## [0.4.5] - 2026-04-02
13
+ ### Fixed
14
+ - stroke-dash conversion must disable reordering of commands
15
+ - stroke-dashoffset missing in attribute scaling
16
+ - removeOffCanvas - fixed bbox calculation
17
+ - rounding bug in command reordering
18
+ ### Added
19
+ - better auto accuracy approximation
20
+
21
+
3
22
  ## [0.4.4] - 2026-04-01
4
23
  ### Fixed
5
24
  - shape attribute retrieval in node.js
package/README.md CHANGED
@@ -15,7 +15,7 @@ While this library reduces SVG markup sizes significantly by removing commands i
15
15
  Unlike most existing approaches (e.g in graphic applications), it checks where simplifications are suitable and stops simplification at the right »point« (literally).
16
16
 
17
17
  ![simplification](./demo/img/splash.png)
18
- *Fira Sans (based on truetype/glyph quadratic commands) converted to cubic Béziers. Right:Original; Left:optimized*
18
+ *Fira Sans (based on truetype/glyph quadratic commands) converted to cubic Béziers. Left:Original; Right:optimized*
19
19
 
20
20
  ## Features
21
21
  ### Path simplification
@@ -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: