data icon indicating copy to clipboard operation
data copied to clipboard

Add SVG data

Open strarsis opened this issue 7 years ago • 15 comments

It would be helpful to have also SVG related data.

Optimizers like svgo heavily use such data, see https://github.com/svg/svgo/blob/master/plugins/_collections.js .

Some svgo plugins also define extra data:

  • https://github.com/svg/svgo/blob/master/plugins/removeUselessStrokeAndFill.js
  • https://github.com/svg/svgo/blob/master/plugins/removeUnusedNS.js
  • https://github.com/svg/svgo/blob/master/plugins/removeUnknownsAndDefaults.js
  • https://github.com/svg/svgo/blob/master/plugins/_path.js
  • https://github.com/svg/svgo/blob/master/plugins/_transforms.js
  • https://github.com/svg/svgo/blob/master/plugins/convertStyleToAttrs.js
  • https://github.com/svg/svgo/blob/master/plugins/cleanupNumericValues.js
  • https://github.com/svg/svgo/blob/master/plugins/cleanupListOfValues.js

Further interesting data for SVG: Which attributes allow color-, dimension-, number-, string-, url-values? This avoids blindly iterating over all values and trying to match them with multiple regexps for example.

strarsis avatar Apr 06 '17 17:04 strarsis

Relevant Bugzilla discussions: https://bugzilla.mozilla.org/show_bug.cgi?id=1214725 https://bugzilla.mozilla.org/show_bug.cgi?id=1212826

Elchi3 avatar Nov 09 '17 14:11 Elchi3

Just wanted to mention that csstype is a project which generates CSS type definition files for TypeScript and Flow from the MDN data. It's now being used in the typings for React as well as a growing number of CSS-in-JS libraries. So it would benefit a lot of high-profile libraries and their many users if the MDN data were complete 😄

pelotom avatar Apr 04 '18 16:04 pelotom

I could work on this, but not sure how to start. @lahmatiy any suggestions?

Would this be a good source for start: https://www.w3.org/TR/SVGTiny12/index.html ?

pkuczynski avatar Apr 05 '18 11:04 pkuczynski

I added https://github.com/frenic/csstype/blob/master/src/data/svg.ts based on https://svgwg.org/svg2-draft/propidx.html as a temporarily solution until this is solved.

frenic avatar Apr 05 '18 11:04 frenic

@pkuczynski I think https://www.w3.org/TR/SVG2/ should be a source of truth. But that spec is huge and property definitions aren't located in one place. I can suggest to add properties in parts.

lahmatiy avatar Apr 05 '18 11:04 lahmatiy

Oh, I forgot about property index appendix. Thank you @frenic for pointing out. @pkuczynski I think that link https://www.w3.org/TR/SVG2/propidx.html can be used too

lahmatiy avatar Apr 05 '18 11:04 lahmatiy

And here one problem: some SVG styling property names intersect with regular one and have differ syntax. We need to decide what to do with that issue.

lahmatiy avatar Apr 05 '18 11:04 lahmatiy

@lahmatiy I think the last comment relates to #144, requesting the ability to specify attribute support by tag. This is not currently supported, isn't it?

pkuczynski avatar Apr 05 '18 12:04 pkuczynski

Also please note that @JeremiePat is working on improving the SVG docs on MDN at the moment, and as part of that is looking into moving SVG data (that's currently embedded in MDN macros) into this repository. So he might be able to help :).

https://discourse.mozilla.org/t/time-to-lift-up-the-svg-documentation-to-the-next-level/25529 https://discourse.mozilla.org/t/cleaning-svg-macro/27192

wbamberg avatar Apr 05 '18 16:04 wbamberg

Yes, and I'm following that discussion very closely. At that point and based on the feed back I got so far I do not plan to do any hard change in where the data are hosted at the moment.

That said, rationalizing MDN data about SVG is definitely in my scope for the next months. At that point, the only thing I know for sure is that the SVG2 spec is the source of truth regarding SVG specification. But even like that the spec is still in flux on some points so there is no rush on my side.

JeremiePat avatar Apr 05 '18 16:04 JeremiePat

@JeremiePat should I then not work on this for now?

pkuczynski avatar Apr 05 '18 22:04 pkuczynski

@pkuczynski Actually, it's quite the opposite. As I do not plan to do any big change in the short term, I would love to assist you with the ongoing work here. Please feel free to lead and I'll assist as much as I can.

JeremiePat avatar Apr 06 '18 09:04 JeremiePat

An additional reference: https://github.com/Fyrd/caniuse/issues/3 ("SVG feature coverage").

waldyrious avatar May 03 '18 14:05 waldyrious

What's the word on this?

jcready avatar Jul 12 '19 10:07 jcready

would love an update on this

g-a-v-i-n avatar Aug 15 '22 21:08 g-a-v-i-n