1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-31 07:44:22 +03:00
Commit Graph

1243 Commits

Author SHA1 Message Date
aa803bc889 2.2.1 v2.2.1 2021-03-06 14:35:06 +03:00
28c01cfe65 Preverve viewBox in nested <svg> 2021-03-06 13:39:31 +03:00
a2b0e73767 Preserve conditional processing attributes 2021-03-06 13:18:53 +03:00
d3e3726ac4 Keep markers with display: none 2021-03-06 11:21:47 +03:00
0e6b0c4a01 Allow empty pattern when any attribute is present 2021-03-06 02:33:19 +03:00
ba7e9bdc0d Fix collapsing repeated with marker-mid in style rule 2021-03-06 01:36:18 +03:00
21c04e4d8a Keep single point path for markers 2021-03-06 01:01:32 +03:00
de4fd79b57 Prevent merging path when marker-end style is specified
Ref https://github.com/svg/svgo/issues/1217 https://github.com/svg/svgo/issues/958 https://github.com/svg/svgo/issues/872
2021-03-06 00:37:03 +03:00
555a9619db Remove incorrect filter region assumption
Ref https://www.w3.org/TR/SVG11/filters.html

Spec says filter region is not always 100% 100% by default
2021-03-05 21:31:41 +03:00
c21fef54e1 Remove useless path commands considering static styles 2021-03-05 18:08:02 +03:00
d58a7e6089 Pass floatPrecision to implemented plugin 2021-03-05 17:48:19 +03:00
76c7719604 chore: Improve TS config (#1405)
Changed the TS config file to include all relevant folders and explicitly exclude those files that fail the type checks. In this way new files will be automatically type checked and we can see the list of files that need types improvements.

In this pass I also fixed some js files.
2021-03-05 01:17:44 +03:00
e2ec7e8bd2 [convertShapeToPath] round path numbers with precision (#1404)
Ref https://github.com/svg/svgo/issues/1051

Note: review with hidden whitespaces
2021-03-05 01:12:50 +03:00
4d0ee0c330 Test regressions with W3C SVG 1.1 Test Suite (#1357)
Visual regressions tests will give us more confidence in SVGO stability.
Test cases are downloaded from w3.org, screenshooted with playwright and
compared with pixelmatch.
2021-03-04 18:00:15 +03:00
6842b47cc7 Add TS support (#1370)
Added Typescript support via JSDoc comments for some files.

The code has really outdated type signatures, so in order to fully type the codebase the changes need to be incremental.

To check the types run:
npx tsc
2021-03-04 16:30:28 +03:00
0e02fd9fde Fix noSpaceAfterFlags support 2021-03-04 13:15:36 +03:00
be28d65d78 Implement style computing (#1399)
Ref https://github.com/svg/svgo/issues/777

Currently a lot of optimisations are attributes specific and may be
broken because of inline or shared styles.

In this diff I'm trying to solve the problem with getComputedStyle
analog.

`computeStyle` collects attributes, shared css rules, inline styles
and inherited styles and checks whether they can be statically optimised
or left as deoptimisation.
2021-03-04 13:13:44 +03:00
f3a6cf259a Update example for removeAttrs (#1401)
Old example didn't work with `removeAttrs` plugin. This worked for me and also validated here:
https://github.com/svg/svgo/issues/1344
2021-03-03 16:58:06 +03:00
318bd5b8fa Forbid invalid <style> type attribute (#1400)
This fixes one more case in regression tests.
Also I added support for description in test cases.
This will let make tests more atomic.
2021-03-03 13:20:55 +03:00
66bb0fb2ad Commit fixtures 2021-03-03 12:32:43 +03:00
2f3c35d52e Host css-select adapter (#1395)
This is necessary for better control while implementing new style
manager.
2021-03-03 01:33:57 +03:00
a896d5de13 Format plugins utilities with prettier (#1394)
Note: review with hidden whitespaces
2021-03-03 01:33:44 +03:00
93a5db197c Update CI config (#1397)
* separate lint step to a new job and run it only once
* add caching
2021-03-02 17:03:10 +03:00
3cdb14c427 Fix typo in README.md (#1396) 2021-03-02 16:12:50 +03:00
d6f972c970 Fix scientific notation parsing in paths 2021-03-02 11:49:54 +03:00
c1b8c3e261 Enforce LF (#1393)
On Windows `autocrlf` is true by default
2021-03-02 11:01:46 +03:00
a2947e33b5 2.2.0 v2.2.0 2021-03-02 01:08:37 +03:00
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
cf807fbe34 New logo (#1389)
Ref https://github.com/svg/svgo/issues/1336

Big thanks to @DerianAndre
2021-03-01 17:04:48 +03:00
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
7901588a9f Fix path optimisation with stroke-linecap round
Ref https://github.com/svg/svgo/issues/890
2021-02-28 15:22:27 +03:00
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
71e47370bd Format lib with prettier (#1386)
Note: review with hidden whitespaces
2021-02-28 10:56:16 +03:00
a99cc08e4f Format tests with prettier (#1380)
Will format the code with prettier in a few commits.
2021-02-27 23:17:47 +03:00
0394bf0ea6 refactor: replace uses of for in (#1382)
Replace the uses of `for in` with `for of` and `Object.entries`/`Object.values`/`Object.keys`.

One case was further simplified by using a spread.
2021-02-27 23:17:30 +03:00
ed89fbe881 Replaced stackoverflow with discord 2021-02-27 14:55:14 +03:00
42d75b1f81 Add discord badge (#1379)
Chatting would help with communication.
2021-02-27 14:52:19 +03:00
0a11dadc6b Backers -> Donators 2021-02-25 22:30:33 +03:00
62257487a7 Update FUNDING.yml 2021-02-25 19:13:16 +03:00
d74d3ac2b9 Create FUNDING.yml 2021-02-25 17:07:03 +01:00
f92f7dec86 Remove "donations" section 2021-02-25 17:53:32 +03:00
1310210d4e Use https when possible and fix an inactive domain (#1374) 2021-02-25 13:48:18 +03:00
dd37fcfebb Apply scale to stroke-dasharray and stroke-dashoffset 2021-02-25 13:45:03 +03:00
83a03ecb8e Tweak README.md (#1375) 2021-02-25 13:18:42 +03:00
d06747abca Keep hidden elements if any descendant enables visibility 2021-02-25 00:05:26 +03:00
9d67586787 Keep transparent elements inside <clipPath> 2021-02-24 22:58:00 +03:00
d14315b68f Keep empty <mask> which can hide element by id 2021-02-24 21:13:30 +03:00
36391564f2 Preserve stroke-width when marker-end is specified 2021-02-24 17:29:29 +03:00
51f12d1f4f Remove convertStyleToAttrs from defaults in readme 2021-02-24 16:33:44 +03:00
091172a392 Fix <tspan> inside of <a> 2021-02-24 14:10:33 +03:00