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
5314c12c99 Convert element children to xast
Ref https://github.com/syntax-tree/xast

Renamed content to children to match xast spec.
2021-03-11 12:29:13 +03:00
b9a682443c Merge pull request #1419 from svg/xast-attributes
Convert attributes to xast with proxy fallback
2021-03-11 12:28:27 +03:00
bc87eea85e Fix lint 2021-03-10 23:15:29 +03:00
3e1bfd528d Convert attributes to xast with proxy fallback
There is a lot of attributes manipulation which is hard to remove at
once. In this diff I added `attributes` object and wrapped it as proxy
for `attrs` field.
2021-03-10 23:11:09 +03:00
cdcd265fb7 Merge pull request #1418 from svg/xast-element
Prepare root and element nodes for xast
2021-03-10 23:10:42 +03:00
685d9fa55e Fix lint 2021-03-10 18:51:50 +03:00
e82a672bbf Prepare root and element nodes for xast
Ref https://github.com/syntax-tree/xast

- added type: root | element
- renamed elem to name
- replaced "elem" property checks with check for correct type
2021-03-10 18:49:26 +03:00
54daf72d50 Merge pull request #1416 from svg/xast-text
Convert cdata and text nodes to xast
2021-03-10 18:49:12 +03:00
f369f24434 Merge pull request #1417 from omgovich/lighter-browser-bundle
Remove whitespaces and comments from the browser bundle
2021-03-10 18:42:09 +03:00
279962207e Remove whitespaces and comments from the browser bundle 2021-03-10 18:20:58 +03:00
73768cb65b Fix types 2021-03-10 17:36:36 +03:00
194058b9eb Clarify condition and add todo with new plugin 2021-03-10 16:22:37 +03:00
c50decb438 Convert cdata and text nodes to xast
Ref https://github.com/syntax-tree/xast

More consistent naming and distinction by type looks a bit cleaner.
2021-03-10 16:16:11 +03:00
10ac712282 Convert to xast doctype, instruction and comment nodes (#1415)
Here we add [xast](https://github.com/syntax-tree/xast) support
to three basic nodes: doctype, instruction and comment

Some tests are rewritten instead of checking each field to `.include`
assertion which is able to match shape of object.
2021-03-10 15:39:49 +03:00
5161156418 Fix types 2021-03-10 14:22:38 +03:00
8622a5f31b Convert to xast doctype, instruction and comment nodes
Here we add [xast](https://github.com/syntax-tree/xast) support
to three basic nodes: doctype, instruction and comment

Some tests are rewritten instead of checking each field to `.include`
assertion which is able to match shape of object.
2021-03-10 14:10:40 +03:00
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
2458b70f31 Remove licenses 2021-03-09 23:40:36 +03:00
cfb7c28bf6 Lint unformatted code 2021-03-09 20:18:19 +03:00
00ec0f71fe Format all plugins with prettier 2021-03-09 19:58:00 +03:00
1be0d0dba1 2.2.2 v2.2.2 2021-03-09 12:51:15 +03:00
ddbd7046b2 Ignore keyframes in computeStyle
Ref https://github.com/svg/svgo/issues/1408
2021-03-09 01:47:56 +03:00
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