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

18 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
8c593fab06 chore: bulk update all jsdoc and jsdoctypes (#2114) 2025-05-01 22:16:52 +01:00
Seth Falco
9eb3af59f2 chore: drop parentNode property (#2113) 2025-05-01 15:59:23 +01:00
Vlad Tansky
fea26379d2 fix: support -o-keyframes and -moz-keyframes (#2019) 2024-06-14 13:30:18 +01:00
Viktor Szépe
559b9ad068 chore: resolve typos 2024-05-09 10:09:31 +01:00
Jon Dufresne
2442f74239 chore: convert project to us ECMAScript modules (preserving CJS compatibility) (#1905) 2024-01-03 16:17:37 +00:00
Jon Dufresne
f6a2ca20d6 chore: improve jest tests with more precise assertions (#1912) 2023-12-28 19:14:47 +00:00
Seth Falco
22533f1ffe chore: update prettier and eslint (#1885) 2023-12-15 13:10:21 +00:00
Seth Falco
4c2cc1bbdb feat(inlineStyles): remove redundant presentation attrs (#1829)
SVGs can have the same presentation attribute declared redundantly in
both the node attributes and `<style>` tag.

This wouldn't break anything, but we can shave off a few more bytes by
dropping the attribute in this case.
2023-11-11 12:43:13 +00:00
Seth Falco
1df2e0fa39 fix(cleanupIds): skip generated ids for malformed references (#1817)
I also had some chores pending which were trivial individually, I opted
to incorporate them here as well.

* In JSDocs, use the nullable syntax as it's more concise and familiar
from TypeScript usage.
* discord → Discord (proper nouns should match capitalization)
* Use actions/checkout v4 instead of v2
2023-11-04 12:56:20 +00:00
Bogdan Chadkin
12272958db Upgrade csso and csstree 2022-10-08 14:57:57 +03:00
Bogdan Chadkin
6e23b9cf56 Cover svg parser with tsdoc (#1584)
Moved to lib/parser.js. The code will be slightly simpler
when JSAPI will be removed in v3.
2021-09-23 21:45:22 +03:00
Bogdan Chadkin
79ceb09daf Avoid node.parentNode in style manager (#1576)
node.parentNode will be removed in v3 along with JSAPI class wrapper on
each node.

Style manager uses it to find inherited styles. To workaround this
I collected all parents along with all styles. This constraints style
manager to work only with initial ast which should not be a problem as
each plagin execution is isolated.
2021-09-21 19:11:53 +03:00
Bogdan Chadkin
c3695ae533 Migrate to jest (#1520)
Mocha doesn't have a lot of features provided by jest.
There is a great assertion library out of the box.
And the most cool feature is inline snapshots.
Mocha also hides errors which makes debugging a nightmare sometimes.
2021-08-12 18:06:10 +03:00
Bogdan Chadkin
2c0c361074 Collect stylesheet once per plugin (#1456)
computeStyle(node) in isolation is quite slow utility because it
collects style elements across whole document, parses and sort them.

In this diff I splitted it into `collectStylesheet(root)` and
`computeStyle(stylesheet, node)` which are easy integrate with new
visitor plugin api.
2021-08-12 03:08:39 +03:00
Bogdan Chadkin
4cacd9e676 Migrate ast traversing into xast module (#1434)
Replaced JSAPI methods with new utilities

- querySelectorAll(node, selector)
- querySelector(node, selector)
- matches(node, selector)
- closestByName(node, elementName)
- traverse(node, fn)

New traverse replaced many in-place implementations.
2021-03-19 11:06:41 +03:00
Bogdan Chadkin
ddbd7046b2 Ignore keyframes in computeStyle
Ref https://github.com/svg/svgo/issues/1408
2021-03-09 01:47:56 +03:00
Bogdan Chadkin
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