svg-path-simplify 0.4.2 → 0.4.4
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.
- package/CHANGELOG.md +21 -0
- package/README.md +7 -4
- package/dist/svg-path-simplify.esm.js +3593 -1279
- package/dist/svg-path-simplify.esm.min.js +2 -2
- package/dist/svg-path-simplify.js +3594 -1278
- package/dist/svg-path-simplify.min.js +2 -2
- package/dist/svg-path-simplify.pathdata.esm.js +1017 -538
- package/dist/svg-path-simplify.pathdata.esm.min.js +2 -2
- package/dist/svg-path-simplify.poly.cjs +9 -8
- package/docs/privacy-webapp.md +24 -0
- package/index.html +331 -152
- package/package.json +1 -1
- package/src/constants.js +4 -0
- package/src/css_parse.js +317 -0
- package/src/detect_input.js +76 -28
- package/src/index.js +8 -0
- package/src/pathData_simplify_cubic.js +26 -16
- package/src/pathData_simplify_harmonize_cpts.js +77 -1
- package/src/pathData_simplify_revertToquadratics.js +0 -1
- package/src/pathSimplify-main.js +304 -276
- package/src/pathSimplify-only-pathdata.js +7 -2
- package/src/pathSimplify-presets.js +254 -0
- package/src/poly-fit-curve-schneider.js +14 -7
- package/src/simplify_poly_RC.js +102 -0
- package/src/simplify_poly_RDP.js +109 -1
- package/src/simplify_poly_radial_distance.js +3 -3
- package/src/string_helpers.js +130 -4
- package/src/svg-getAttributes.js +4 -2
- package/src/svgii/convert_units.js +1 -1
- package/src/svgii/geometry.js +322 -5
- package/src/svgii/geometry_bbox_element.js +1 -1
- package/src/svgii/geometry_deduceRadius.js +116 -27
- package/src/svgii/geometry_length.js +253 -0
- package/src/svgii/pathData_analyze.js +18 -0
- package/src/svgii/pathData_convert.js +193 -89
- package/src/svgii/pathData_fix_directions.js +12 -14
- package/src/svgii/pathData_fromPoly.js +3 -3
- package/src/svgii/pathData_getLength.js +86 -0
- package/src/svgii/pathData_parse.js +2 -0
- package/src/svgii/pathData_parse_els.js +66 -68
- package/src/svgii/pathData_reorder.js +122 -16
- package/src/svgii/pathData_simplify_refineCorners.js +130 -35
- package/src/svgii/pathData_simplify_refine_round.js +420 -0
- package/src/svgii/pathData_split_to_groups.js +168 -0
- package/src/svgii/pathData_stringify.js +26 -64
- package/src/svgii/pathData_toPolygon.js +3 -4
- package/src/svgii/poly_analyze.js +61 -0
- package/src/svgii/poly_normalize.js +11 -2
- package/src/svgii/poly_to_pathdata.js +85 -24
- package/src/svgii/rounding.js +80 -78
- package/src/svgii/svg_cleanup.js +421 -619
- package/src/svgii/svg_cleanup_convertPathLength.js +39 -0
- package/src/svgii/svg_cleanup_general_svg_atts.js +97 -0
- package/src/svgii/svg_cleanup_normalize_transforms.js +83 -0
- package/src/svgii/svg_cleanup_remove_els_and_atts.js +77 -0
- package/src/svgii/svg_cleanup_ungroup.js +36 -0
- package/src/svgii/svg_el_parse_style_props.js +72 -47
- package/src/svgii/svg_getElementLength.js +67 -0
- package/src/svgii/svg_validate.js +220 -0
- package/tests/testSVG.js +14 -1
- package/src/svgii/pathData_refine_round.js +0 -222
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.4] - 2026-04-01
|
|
4
|
+
### Fixed
|
|
5
|
+
- shape attribute retrieval in node.js
|
|
6
|
+
### Added
|
|
7
|
+
- convert relative dash lengths relying on `pathLength` attribute
|
|
8
|
+
- quantized rounding allowing for half decimal steps
|
|
9
|
+
- improved arc segment detection and simplification
|
|
10
|
+
- security warnings/sanitization e.g for billion laugh exploits
|
|
11
|
+
- webapp: recommendations for additional optimizations
|
|
12
|
+
|
|
13
|
+
## [0.4.3] - 2026-03-26
|
|
14
|
+
### Added
|
|
15
|
+
- presets: apply options from existing presets (allows custom overriding)
|
|
16
|
+
- addititional input formats: `<symbol>` (handy for sprite editing), stringified (polygon) point arrays
|
|
17
|
+
- compound path splitting: creates separate `<path>` elements from overlapping sub paths
|
|
18
|
+
- custom element and attribute removal
|
|
19
|
+
- "safe" mode for path data stringification – for better legacy application support
|
|
20
|
+
- webapp responds to keyboard shortcuts for saving, copying and pasting
|
|
21
|
+
- "keepSmaller" option: takes the original input if simplification failed – useful for batch processing
|
|
22
|
+
|
|
23
|
+
|
|
3
24
|
## [0.4.2] - 2026-03-18
|
|
4
25
|
### Fixed
|
|
5
26
|
- attribute retrieval and conversion in node
|
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
|
-

|
|
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
|
-
|
|
337
|
-
|
|
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.
|
|
@@ -368,4 +370,5 @@ You can also post in the [discussions](https://github.com/herrstrietzel/svg-path
|
|
|
368
370
|
* obviously, [Dmitry Baranovskiy](https://github.com/dmitrybaranovskiy) – a lot of these helper functions originate either from Raphaël or snap.svg – or are at least heavily inspired by some helpers from these libraries
|
|
369
371
|
* [Andrea Giammarchi a.k.a WebReflection](https://github.com/WebReflection) for [linkedom](https://github.com/WebReflection/linkedom) which helped to make this lib run also in node or a web worker
|
|
370
372
|
* [Photopea](https://github.com/photopea) for the fast [UZIP](https://github.com/photopea/UZIP.js) which is deployed in the webapp for batch file downloads.
|
|
373
|
+
* [mdpjs](https://github.com/UmemotoCtrl/mdpjs) for the great JS markdown parser (used in the web app)
|
|
371
374
|
|