svg-path-simplify 0.4.1 → 0.4.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.
Files changed (48) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +6 -4
  3. package/dist/svg-path-simplify.esm.js +2450 -888
  4. package/dist/svg-path-simplify.esm.min.js +2 -2
  5. package/dist/svg-path-simplify.js +2450 -888
  6. package/dist/svg-path-simplify.min.js +2 -2
  7. package/dist/svg-path-simplify.pathdata.esm.js +167 -85
  8. package/dist/svg-path-simplify.pathdata.esm.min.js +2 -2
  9. package/docs/privacy-webapp.md +24 -0
  10. package/index.html +333 -132
  11. package/package.json +5 -2
  12. package/src/css_parse.js +317 -0
  13. package/src/detect_input.js +34 -4
  14. package/src/pathData_simplify_harmonize_cpts.js +77 -1
  15. package/src/pathSimplify-main.js +246 -262
  16. package/src/pathSimplify-presets.js +243 -0
  17. package/src/poly-fit-curve-schneider.js +14 -7
  18. package/src/simplify_poly_RC.js +102 -0
  19. package/src/simplify_poly_RDP.js +109 -1
  20. package/src/simplify_poly_radial_distance.js +3 -3
  21. package/src/string_helpers.js +144 -0
  22. package/src/svgii/convert_units.js +8 -2
  23. package/src/svgii/geometry.js +182 -3
  24. package/src/svgii/geometry_length.js +237 -0
  25. package/src/svgii/pathData_convert.js +43 -1
  26. package/src/svgii/pathData_fix_directions.js +6 -0
  27. package/src/svgii/pathData_fromPoly.js +3 -3
  28. package/src/svgii/pathData_getLength.js +86 -0
  29. package/src/svgii/pathData_parse.js +2 -0
  30. package/src/svgii/pathData_parse_els.js +189 -189
  31. package/src/svgii/pathData_split_to_groups.js +168 -0
  32. package/src/svgii/pathData_stringify.js +26 -64
  33. package/src/svgii/pathData_toPolygon.js +3 -4
  34. package/src/svgii/poly_analyze.js +61 -0
  35. package/src/svgii/poly_normalize.js +11 -2
  36. package/src/svgii/poly_to_pathdata.js +85 -24
  37. package/src/svgii/rounding.js +8 -7
  38. package/src/svgii/svg-styles-to-attributes-const.js +1 -0
  39. package/src/svgii/svg_cleanup.js +467 -421
  40. package/src/svgii/svg_cleanup_convertPathLength.js +32 -0
  41. package/src/svgii/svg_cleanup_general_svg_atts.js +97 -0
  42. package/src/svgii/svg_cleanup_normalize_transforms.js +83 -0
  43. package/src/svgii/svg_cleanup_remove_els_and_atts.js +72 -0
  44. package/src/svgii/svg_cleanup_ungroup.js +36 -0
  45. package/src/svgii/svg_el_parse_style_props.js +76 -28
  46. package/src/svgii/svg_getElementLength.js +67 -0
  47. package/tests/testSVG_shape.js +59 -0
  48. package/tests/testSVG_transform.js +61 -0
package/CHANGELOG.md CHANGED
@@ -1,4 +1,23 @@
1
1
  # Changelog
2
+ ## [0.4.3] - 2026-03-26
3
+ ### Added
4
+ - presets: apply options from existing presets (allows custom overriding)
5
+ - addititional input formats: `<symbol>` (handy for sprite editing), stringified (polygon) point arrays
6
+ - compound path splitting: creates separate `<path>` elements from overlapping sub paths
7
+ - custom element and attribute removal
8
+ - "safe" mode for path data stringification – for better legacy application support
9
+ - webapp responds to keyboard shortcuts for saving, copying and pasting
10
+ - "keepSmaller" option: takes the original input if simplification failed – useful for batch processing
11
+
12
+
13
+ ## [0.4.2] - 2026-03-18
14
+ ### Fixed
15
+ - attribute retrieval and conversion in node
16
+ - transform conversions
17
+ ### Added
18
+ - mixed SVG path data: chooses between most compact commands – relative or absolute
19
+ - web UI features (e.g marker resizing, toggle original and optimized)
20
+
2
21
 
3
22
  ## [0.4.1] - 2026-03-16
4
23
  ### Fixed
package/README.md CHANGED
@@ -294,7 +294,7 @@ let pathDataOpt = simplifyPathData(pathDataString);
294
294
  ### Web app
295
295
  You can easily test this library via the [**webapp**](https://herrstrietzel.github.io/svg-path-simplify/) or by checking the demo folder.
296
296
 
297
- ![web app](./demo/img/screenshot.png)
297
+ ![svg-path-simplify web app](./demo/img/svg-path-simplify-webapp.png)
298
298
 
299
299
  #### Features
300
300
  * test all provided simplification option - export settings as JS object
@@ -311,6 +311,9 @@ You can easily test this library via the [**webapp**](https://herrstrietzel.gith
311
311
  * [simple setup esm](./demo/simple-esm.html)
312
312
  * [codepen](https://codepen.io/herrstrietzel/pen/PwzxpoE)
313
313
 
314
+ ### Webapp examples
315
+ * [font/glyph simplification](https://herrstrietzel.github.io/svg-path-simplify/?samples=fira_alegreya_opensans)
316
+
314
317
 
315
318
 
316
319
  ## Limitations
@@ -333,9 +336,8 @@ SVGs > 1 MB are most of the time not salvagable. At least if they contain 10K+ o
333
336
 
334
337
  ## Changelog, Updates and rollback
335
338
  ### Changelog
336
- * 0.3.0 webapp adds support for multi file batch optimizations, web worker support, drawing direction fix option (for fill rules)
337
- * 0.2.0 added features for polygon curve fitting
338
- * 0.1.0 fixed node support for complete svg files
339
+ See [changelog.md](https://github.com/herrstrietzel/svg-path-simplify/blob/main/CHANGELOG.md)
340
+
339
341
 
340
342
  ### Rollback
341
343
  If you encounter any issues with the recent versions you can rollback to a previous version.