1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00
Commit Graph

1315 Commits

Author SHA1 Message Date
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
9263d9ab90 Fix svg spec urls in plugins 2021-02-24 11:18:48 +03:00
355fb1ff24 2.1.0 v2.1.0 2021-02-24 01:44:44 +03:00
9de471a0f4 Handle nested textual tags
This bug was also catched by regression tests. Single state was
overriden in opentag/closetag callbacks. Using stack state solved the
problem with nested textual tags.

Now many whitespaces bugs should go away.
2021-02-24 00:58:11 +03:00
4b4259bc60 Fix parsing xml entities (#1371)
Ref https://github.com/svg/sax/releases/tag/v0.1.1

This fixes enother case in [regression tests](https://github.com/svg/svgo/pull/1357).
2021-02-23 22:49:28 +03:00
c1d5f0f7a9 Keep empty <g> when filter attributes is specified 2021-02-23 22:36:47 +03:00
776ec1e71b Fix incorrect xml:space default 2021-02-23 18:43:28 +03:00
9f084cc086 Preserve whitespace in elements containing text (#1220) 2021-02-23 18:25:30 +03:00
0021144d4e Fork sax (#1369)
There was a lot of PR with switching to another xml parser because sax
is not maintained for almost 4 years already.

Though switching parser to solve a few problems may introduce many new
bugs. This is why we decided to fork sax and maintain own version.

For initial release I removed node streams support which allows to get
rid from some magic in browser bundle build config and got rid from
String.fromCodePoint polyfill.

Forked package is here https://github.com/svg/sax
2021-02-23 16:44:35 +03:00
797a8e843d Fix npm install script typo (#1368) 2021-02-23 01:52:51 +03:00
a1fcd034fe Disable convertStyleToAttrs plugin by default (#1365)
Ref https://github.com/svg/svgo/issues/1362 https://github.com/svg/svgo/issues/1360

From the [spec](https://www.w3.org/TR/SVG11/styling.html#UsingPresentationAttributes):

> Presentation attributes have lower priority than other CSS style rules specified in author style sheets or ‘style’ attributes.

Though we replace inline styles with attributes without checking if
thare is any `<style>` element. This makes the plugin unsafe and it
should not be enabled by default.
2021-02-23 00:28:09 +03:00
a855b40ec5 Fail when specified config is wrong or json is specified 2021-02-22 23:50:42 +03:00
aa8e0bd3f6 Add Github Issue Templates (#1367)
* Path intersection was not checking paths with circles.

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.

* Add issue templates

We add issue templates for:

- Bug Reports
- Feature Requests
- Plugin Requests
- Pull Requests
- Questions

* Add Github issue templates

Fixes #1364, but is is missing the template for pull requests see
https://docs.github.com/en/github/building-a-strong-community/creating-a-pull-request-template-for-your-repository

* fix

* Use "New plugin" label

Co-authored-by: Bogdan Chadkin <trysound@yandex.ru>
2021-02-22 23:35:14 +03:00
9b97e06ef6 Fix empty <svg /> in cleanupIDs plugin 2021-02-21 14:50:55 +03:00
727646e6a7 convertTransform: remove unused assignment (#1354) 2021-02-20 22:31:56 +03:00
4ad91f2323 2.0.3 v2.0.3 2021-02-20 19:06:22 +03:00
c1edce4d2d Fix error message in addAttributesToSVGElement plugin
Ref https://github.com/svg/svgo/issues/1352
2021-02-20 19:04:46 +03:00
8d7cfa02c7 After ‘arcto’ path command(a or A) flags, spaces are no longer removed by default (#1353)
Co-authored-by: 壹丝 <jie.lijie@alibaba-inc.com>
2021-02-20 18:58:42 +03:00
26f5e323dd Switch to c8 for coverage (#1350) 2021-02-20 18:37:08 +03:00
6c0f8c5efb reusePaths: fix redundant variable assignment (#1349) 2021-02-20 17:31:34 +03:00
df14f37c48 test/coa/_index.js: Fix regex (#1347)
`.` means any character but we want to match the literal `.`
2021-02-20 17:05:04 +03:00
1b2c2625e3 CI: specify FORCE_COLOR: 2 (#1351) 2021-02-20 17:03:42 +03:00
d9f68d3be0 [removeElementsByAttr] fix removing elements when class is empty
Ref https://github.com/svg/svgo/issues/937

Regexp didn't not cover the case when class list is empty.
2021-02-20 16:54:46 +03:00
4490d62ee9 Add mask-type to the list of <mask> attributes
Ref https://github.com/svg/svgo/issues/1254
2021-02-20 13:59:21 +03:00
7f4e05297a [convertEllipseToCircle] fix ellipse without radius
Ref https://github.com/svg/svgo/issues/1264
2021-02-20 12:50:36 +03:00
ea82cc2880 Report parsing errors with filename 2021-02-20 00:59:54 +03:00
b9880491b5 [reusePaths] fix excessive defs tag (#1201) 2021-02-19 23:56:20 +03:00
82778c872d Reduce browser build size 1450kB -> 820kB 2021-02-19 15:34:37 +03:00
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