1
0
mirror of https://github.com/svg/svgo.git synced 2026-01-27 07:02:06 +03:00

63 Commits

Author SHA1 Message Date
Seth Falco
747cc722d9 chore: revamp how we export types (#2118) 2025-05-04 17:39:44 +01:00
Seth Falco
49954bc0d9 chores: various clean ups regardin ESM and TypeScript (#2117) 2025-05-03 09:42:29 +01:00
Seth Falco
a8a53dbd90 chore: apply more eslint rules (#2116) 2025-05-02 10:00:37 +01:00
Seth Falco
8c593fab06 chore: bulk update all jsdoc and jsdoctypes (#2114) 2025-05-01 22:16:52 +01:00
Seth Falco
dba60b3580 chore: migrate from ts-ignore to ts-expect-error (#2103) 2025-04-12 19:41:49 +01:00
Seth Falco
9c8768f64d ci: add spellcheck (#2101) 2025-04-12 16:47:32 +01:00
Nathan Baulch
0eccff2794 chore: fix various typos across the project 2025-03-22 11:49:01 +00:00
XhmikosR
4daaa4251f chore: update ESLint to v9 and switch to flat config (#2001) 2024-05-26 13:22:23 +01:00
Jon Dufresne
2442f74239 chore: convert project to us ECMAScript modules (preserving CJS compatibility) (#1905) 2024-01-03 16:17:37 +00:00
Seth Falco
c2cacc7060 chore: move health files to .github (#1906) 2023-12-27 12:54:30 +00:00
Seth Falco
22533f1ffe chore: update prettier and eslint (#1885) 2023-12-15 13:10:21 +00:00
Jon Dufresne
40544220e8 chore: tidy up eslint config and usage (#1883) 2023-12-15 12:32:20 +00:00
Bogdan Chadkin
74c383153e Cover mergePaths plugin with types (#1539)
- covered mergePaths plugin
- covered big path logic
2021-08-24 13:41:16 +03:00
Bogdan Chadkin
b359730219 Drop unused bézier utilities 2021-08-24 03:01:03 +03:00
Bogdan Chadkin
147d2dadd6 Refactor convertRelativeToAbsolute 2021-08-24 03:00:18 +03:00
Bogdan Chadkin
539237ce87 Normalize path data structure (#1538)
Use modern path data structure in all plugins.
Will be easier to cover with types.
2021-08-24 00:01:18 +03:00
Bogdan Chadkin
6f2f62c5ee Access attributes directly (#1433)
Got rid from `.attrs`, `.attr()` and `.addAttr()` usages
2021-03-18 18:53:20 +03:00
Bogdan Chadkin
61657433e1 Refactor apply transforms
- handle each command separately
- handle both relative and absolute commands
- moved into _applyTransforms.js to convert eventually into plugin
- apply transforms before converting into relative

These changes makes code independent and easy to work with.
2021-03-15 21:24:23 +03:00
Bogdan Chadkin
92053c7ed8 Remove broken optimisation 2021-03-15 15:07:28 +03:00
Bogdan Chadkin
a04b27a1df Refactor convertToRelative
Slight code simplification. Each command is processed exclusively
without assumtions. Removed moveto and closepath common coords
reference, handle in applyTransform instead. Rely on new path data
naming.
2021-03-15 13:41:12 +03:00
Bogdan Chadkin
d1d6e5efe8 Remove prefix/local support in elements and attributes (#1413)
These parts of element and attribute name are easy to extract.
Now we can easily replace attrs with xast attributes object.
2021-03-10 13:26:15 +03:00
Bogdan Chadkin
0e02fd9fde Fix noSpaceAfterFlags support 2021-03-04 13:15:36 +03:00
Bogdan Chadkin
a896d5de13 Format plugins utilities with prettier (#1394)
Note: review with hidden whitespaces
2021-03-03 01:33:44 +03:00
Bogdan Chadkin
04b2ae9a37 Implement path stringify (#1387)
Ref https://github.com/svg/svgo/issues/32

Added `stringifyPathData` utility to produce small as possible path by
- matching leading moveto and line to commands (m -> l, M -> L)
- combining moveto and lineto commands
- avoiding space before decimal numbers if possible
2021-03-02 01:07:26 +03:00
Bogdan Chadkin
4086e31334 Implement new path parser (#1378)
Regexps are quite leaky for complex parsing. Regression tests caught
a few issues related to path parser.

In this diff I implemented the new spec-compliant parser which solves
2 regression cases and covers many edge cases hard to handle with
regexps.
2021-02-28 22:10:57 +03:00
Bogdan Chadkin
79dbb4bf6e Prevent applyTransform when inline style present
Ref https://github.com/svg/svgo/issues/1385

With disabled convertStyleToAttrs applyTransform fails to transform
inline styles. They are considered as deoptimisation for now.
Future style manager should fix the problem.
2021-02-28 14:46:32 +03:00
XhmikosR
1310210d4e Use https when possible and fix an inactive domain (#1374) 2021-02-25 13:48:18 +03:00
Bogdan Chadkin
dd37fcfebb Apply scale to stroke-dasharray and stroke-dashoffset 2021-02-25 13:45:03 +03:00
Bogdan Chadkin
9263d9ab90 Fix svg spec urls in plugins 2021-02-24 11:18:48 +03:00
Bogdan Chadkin
a7cc20bb43 Setup recommended eslint preset (#1345)
This is usually enough to prevent silly mistakes.
Formatting will be done by prettier after merging pull requests.
2021-02-19 15:26:07 +03:00
Sebastian Kreft
c9a3aea858 Path intersection was not checking paths with circles. (#1229)
As an optimization the path intersection was checking the paths had three or more elements, caliming that otherwise there was nothing to fill. However a semi circle would actually contain 2 points.

Fixes #1048.

This adds a simplified test case for the 2 offending files reported in the issue.
2021-02-17 23:50:08 +03:00
GreLI
258fecfa6b Remove spaces after ‘arcto’ path command flags 2019-07-13 16:18:08 +03:00
GreLI
3c82fd7287 Correct parsing of arc flags without following comma/spaces
Fix #822
2018-09-15 16:38:34 +03:00
Alex Lockwood
50f4fed02b dont transform stroke width for non-scaling-strokes (#857) 2018-09-15 14:39:36 +03:00
Alex Lockwood
b182569c5f Fixes #218 2017-11-22 21:42:49 +03:00
Vasiliy Loginevskiy
4495a34f55 Remove unnecessary dependency 2017-03-22 09:03:51 +03:00
GreLI
a55dc255c2 Don't transform paths with id without stroke-width since it can be overrided.
Fixes #483
2016-03-08 19:14:24 +03:00
GreLI
a0616b0b82 Don't fail on empty transform. Fixes #394 2015-07-05 13:11:31 +03:00
Yoshiya Hinosawa
73c5a73900 Modify jshint rules 2015-06-13 18:32:19 +09:00
Yoshiya Hinosawa
3f8e6fd15c Fix lint 2015-06-12 00:25:32 +09:00
GreLI
c1bf5baf97 Proper arcs transforming with SVD 2015-05-24 20:50:49 +03:00
GreLI
ff5e89d5bf Reworked transform manipulation 2015-05-24 20:50:47 +03:00
Aidan Steele
dcab8e0c73 Small spelling typo in mergePaths 2015-05-18 11:59:54 +10:00
GreLI
d0c3355056 Separate property for transformations precision with the increased value by default. Resolves #334 2015-04-12 22:38:29 +03:00
GreLI
f651fd8de1 Fixed issues with multiple moveto coordinates on output. Fixes #338 2015-04-06 16:39:28 +03:00
GreLI
ae2981cdea Fixed support point function 2015-04-02 16:48:49 +03:00
GreLI
f68b310c1e Fix for transformations with arcs converted to curves 2015-03-30 20:32:24 +03:00
GreLI
e1060df7dc Check path intersection while merging.
Fixes #253, resolves #260, fixes #298.
2015-03-22 18:06:40 +03:00
GreLI
e220b6cad0 Path data processing improvements.
Improved path data saving.
Collapse repeated now works at writing path data and doesn't affect pathJS to make further processing easier.
Resolves #204.
2015-03-17 22:03:17 +03:00
GreLI
d3e4f63ae5 removeUselessStrokeAndFill is back. Checks for inherited attrs and references. 2015-02-23 23:06:18 +03:00