@emasoft/svg-matrix 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/bin/svg-matrix.js +7 -6
  2. package/bin/svgm.js +109 -40
  3. package/dist/svg-matrix.min.js +7 -7
  4. package/dist/svg-toolbox.min.js +148 -228
  5. package/dist/svgm.min.js +152 -232
  6. package/dist/version.json +5 -5
  7. package/package.json +1 -1
  8. package/scripts/postinstall.js +72 -41
  9. package/scripts/test-postinstall.js +18 -16
  10. package/scripts/version-sync.js +78 -60
  11. package/src/animation-optimization.js +190 -98
  12. package/src/animation-references.js +11 -3
  13. package/src/arc-length.js +23 -20
  14. package/src/bezier-analysis.js +9 -13
  15. package/src/bezier-intersections.js +18 -4
  16. package/src/browser-verify.js +35 -8
  17. package/src/clip-path-resolver.js +285 -114
  18. package/src/convert-path-data.js +20 -8
  19. package/src/css-specificity.js +33 -9
  20. package/src/douglas-peucker.js +272 -141
  21. package/src/geometry-to-path.js +79 -22
  22. package/src/gjk-collision.js +287 -126
  23. package/src/index.js +56 -21
  24. package/src/inkscape-support.js +122 -101
  25. package/src/logger.js +43 -27
  26. package/src/marker-resolver.js +201 -121
  27. package/src/mask-resolver.js +231 -98
  28. package/src/matrix.js +9 -5
  29. package/src/mesh-gradient.js +22 -14
  30. package/src/off-canvas-detection.js +53 -17
  31. package/src/path-optimization.js +356 -171
  32. package/src/path-simplification.js +671 -256
  33. package/src/pattern-resolver.js +1 -3
  34. package/src/polygon-clip.js +396 -78
  35. package/src/svg-boolean-ops.js +90 -23
  36. package/src/svg-collections.js +1546 -667
  37. package/src/svg-flatten.js +152 -38
  38. package/src/svg-matrix-lib.js +2 -2
  39. package/src/svg-parser.js +5 -1
  40. package/src/svg-rendering-context.js +3 -1
  41. package/src/svg-toolbox-lib.js +2 -2
  42. package/src/svg-toolbox.js +99 -457
  43. package/src/svg-validation-data.js +513 -345
  44. package/src/svg2-polyfills.js +156 -93
  45. package/src/svgm-lib.js +8 -4
  46. package/src/transform-optimization.js +168 -51
  47. package/src/transforms2d.js +73 -40
  48. package/src/transforms3d.js +34 -27
  49. package/src/use-symbol-resolver.js +175 -76
  50. package/src/vector.js +80 -44
  51. package/src/vendor/inkscape-hatch-polyfill.js +143 -108
  52. package/src/vendor/inkscape-hatch-polyfill.min.js +291 -1
  53. package/src/vendor/inkscape-mesh-polyfill.js +953 -766
  54. package/src/vendor/inkscape-mesh-polyfill.min.js +896 -1
  55. package/src/verification.js +3 -4
@@ -5,134 +5,422 @@
5
5
  /**
6
6
  * Set of all valid SVG 1.1 element names (lowercase)
7
7
  */
8
- export const SVG11_ELEMENTS = new Set(["a","altglyph","altglyphdef","altglyphitem","animate","animatecolor","animatemotion","animatetransform","circle","clippath","color-profile","cursor","defs","desc","ellipse","feblend","fecolormatrix","fecomponenttransfer","fecomposite","feconvolvematrix","fediffuselighting","fedisplacementmap","fedistantlight","feflood","fefunca","fefuncb","fefuncg","fefuncr","fegaussianblur","feimage","femerge","femergenode","femorphology","feoffset","fepointlight","fespecularlighting","fespotlight","fetile","feturbulence","filter","font","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialgradient","rect","script","set","stop","style","svg","switch","symbol","text","textpath","title","tref","tspan","use","view","vkern"]);
8
+ export const SVG11_ELEMENTS = new Set([
9
+ "a",
10
+ "altglyph",
11
+ "altglyphdef",
12
+ "altglyphitem",
13
+ "animate",
14
+ "animatecolor",
15
+ "animatemotion",
16
+ "animatetransform",
17
+ "circle",
18
+ "clippath",
19
+ "color-profile",
20
+ "cursor",
21
+ "defs",
22
+ "desc",
23
+ "ellipse",
24
+ "feblend",
25
+ "fecolormatrix",
26
+ "fecomponenttransfer",
27
+ "fecomposite",
28
+ "feconvolvematrix",
29
+ "fediffuselighting",
30
+ "fedisplacementmap",
31
+ "fedistantlight",
32
+ "feflood",
33
+ "fefunca",
34
+ "fefuncb",
35
+ "fefuncg",
36
+ "fefuncr",
37
+ "fegaussianblur",
38
+ "feimage",
39
+ "femerge",
40
+ "femergenode",
41
+ "femorphology",
42
+ "feoffset",
43
+ "fepointlight",
44
+ "fespecularlighting",
45
+ "fespotlight",
46
+ "fetile",
47
+ "feturbulence",
48
+ "filter",
49
+ "font",
50
+ "font-face",
51
+ "font-face-format",
52
+ "font-face-name",
53
+ "font-face-src",
54
+ "font-face-uri",
55
+ "foreignobject",
56
+ "g",
57
+ "glyph",
58
+ "glyphref",
59
+ "hkern",
60
+ "image",
61
+ "line",
62
+ "lineargradient",
63
+ "marker",
64
+ "mask",
65
+ "metadata",
66
+ "missing-glyph",
67
+ "mpath",
68
+ "path",
69
+ "pattern",
70
+ "polygon",
71
+ "polyline",
72
+ "radialgradient",
73
+ "rect",
74
+ "script",
75
+ "set",
76
+ "stop",
77
+ "style",
78
+ "svg",
79
+ "switch",
80
+ "symbol",
81
+ "text",
82
+ "textpath",
83
+ "title",
84
+ "tref",
85
+ "tspan",
86
+ "use",
87
+ "view",
88
+ "vkern",
89
+ ]);
9
90
 
10
91
  /**
11
92
  * Set of all valid SVG 1.1 attribute names (lowercase)
12
93
  */
13
- export const SVG11_ATTRIBUTES = new Set(["accent-height","accumulate","actuate","additive","alignment-baseline","alphabetic","amplitude","arabic-form","arcrole","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","baseprofile","bbox","begin","bias","by","calcmode","cap-height","class","clip","clip-path","clip-rule","clippathunits","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","contentscripttype","contentstyletype","cursor","cx","cy","d","descent","diffuseconstant","direction","display","divisor","dominant-baseline","dur","dx","dy","edgemode","elevation","enable-background","end","exponent","externalresourcesrequired","fill","fill-opacity","fill-rule","filter","filterres","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","format","from","fx","fy","g1","g2","glyph-name","glyph-orientation-horizontal","glyph-orientation-vertical","glyphref","gradienttransform","gradientunits","hanging","height","horiz-adv-x","horiz-origin-x","horiz-origin-y","href","id","ideographic","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kernelmatrix","kernelunitlength","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","lighting-color","limitingconeangle","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","mask","maskcontentunits","maskunits","mathematical","max","media","method","min","mode","name","numoctaves","offset","onabort","onactivate","onbegin","onclick","onend","onerror","onfocusin","onfocusout","onload","onmousedown","onmousemove","onmouseout","onmouseover","onmouseup","onrepeat","onresize","onscroll","onunload","onzoom","opacity","operator","order","orient","orientation","origin","overflow","overline-position","overline-thickness","panose-1","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","pointsatx","pointsaty","pointsatz","preservealpha","preserveaspectratio","primitiveunits","r","radius","refx","refy","rendering-intent","repeatcount","repeatdur","requiredextensions","requiredfeatures","restart","result","role","rotate","rx","ry","scale","seed","shape-rendering","show","slope","spacing","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stemh","stemv","stitchtiles","stop-color","stop-opacity","strikethrough-position","strikethrough-thickness","string","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","style","surfacescale","systemlanguage","tablevalues","target","targetx","targety","text-anchor","text-decoration","text-rendering","textlength","title","to","transform","type","u1","u2","underline-position","underline-thickness","unicode","unicode-bidi","unicode-range","units-per-em","v-alphabetic","v-hanging","v-ideographic","v-mathematical","values","version","vert-adv-y","vert-origin-x","vert-origin-y","viewbox","viewtarget","visibility","width","widths","word-spacing","writing-mode","x","x-height","x1","x2","xchannelselector","xlink:actuate","xlink:arcrole","xlink:href","xlink:role","xlink:show","xlink:title","xlink:type","xml:base","xml:lang","xml:space","y","y1","y2","ychannelselector","z","zoomandpan"]);
94
+ export const SVG11_ATTRIBUTES = new Set([
95
+ "accent-height",
96
+ "accumulate",
97
+ "actuate",
98
+ "additive",
99
+ "alignment-baseline",
100
+ "alphabetic",
101
+ "amplitude",
102
+ "arabic-form",
103
+ "arcrole",
104
+ "ascent",
105
+ "attributename",
106
+ "attributetype",
107
+ "azimuth",
108
+ "basefrequency",
109
+ "baseline-shift",
110
+ "baseprofile",
111
+ "bbox",
112
+ "begin",
113
+ "bias",
114
+ "by",
115
+ "calcmode",
116
+ "cap-height",
117
+ "class",
118
+ "clip",
119
+ "clip-path",
120
+ "clip-rule",
121
+ "clippathunits",
122
+ "color",
123
+ "color-interpolation",
124
+ "color-interpolation-filters",
125
+ "color-profile",
126
+ "color-rendering",
127
+ "contentscripttype",
128
+ "contentstyletype",
129
+ "cursor",
130
+ "cx",
131
+ "cy",
132
+ "d",
133
+ "descent",
134
+ "diffuseconstant",
135
+ "direction",
136
+ "display",
137
+ "divisor",
138
+ "dominant-baseline",
139
+ "dur",
140
+ "dx",
141
+ "dy",
142
+ "edgemode",
143
+ "elevation",
144
+ "enable-background",
145
+ "end",
146
+ "exponent",
147
+ "externalresourcesrequired",
148
+ "fill",
149
+ "fill-opacity",
150
+ "fill-rule",
151
+ "filter",
152
+ "filterres",
153
+ "filterunits",
154
+ "flood-color",
155
+ "flood-opacity",
156
+ "font-family",
157
+ "font-size",
158
+ "font-size-adjust",
159
+ "font-stretch",
160
+ "font-style",
161
+ "font-variant",
162
+ "font-weight",
163
+ "format",
164
+ "from",
165
+ "fx",
166
+ "fy",
167
+ "g1",
168
+ "g2",
169
+ "glyph-name",
170
+ "glyph-orientation-horizontal",
171
+ "glyph-orientation-vertical",
172
+ "glyphref",
173
+ "gradienttransform",
174
+ "gradientunits",
175
+ "hanging",
176
+ "height",
177
+ "horiz-adv-x",
178
+ "horiz-origin-x",
179
+ "horiz-origin-y",
180
+ "href",
181
+ "id",
182
+ "ideographic",
183
+ "image-rendering",
184
+ "in",
185
+ "in2",
186
+ "intercept",
187
+ "k",
188
+ "k1",
189
+ "k2",
190
+ "k3",
191
+ "k4",
192
+ "kernelmatrix",
193
+ "kernelunitlength",
194
+ "kerning",
195
+ "keypoints",
196
+ "keysplines",
197
+ "keytimes",
198
+ "lang",
199
+ "lengthadjust",
200
+ "letter-spacing",
201
+ "lighting-color",
202
+ "limitingconeangle",
203
+ "local",
204
+ "marker-end",
205
+ "marker-mid",
206
+ "marker-start",
207
+ "markerheight",
208
+ "markerunits",
209
+ "markerwidth",
210
+ "mask",
211
+ "maskcontentunits",
212
+ "maskunits",
213
+ "mathematical",
214
+ "max",
215
+ "media",
216
+ "method",
217
+ "min",
218
+ "mode",
219
+ "name",
220
+ "numoctaves",
221
+ "offset",
222
+ "onabort",
223
+ "onactivate",
224
+ "onbegin",
225
+ "onclick",
226
+ "onend",
227
+ "onerror",
228
+ "onfocusin",
229
+ "onfocusout",
230
+ "onload",
231
+ "onmousedown",
232
+ "onmousemove",
233
+ "onmouseout",
234
+ "onmouseover",
235
+ "onmouseup",
236
+ "onrepeat",
237
+ "onresize",
238
+ "onscroll",
239
+ "onunload",
240
+ "onzoom",
241
+ "opacity",
242
+ "operator",
243
+ "order",
244
+ "orient",
245
+ "orientation",
246
+ "origin",
247
+ "overflow",
248
+ "overline-position",
249
+ "overline-thickness",
250
+ "panose-1",
251
+ "path",
252
+ "pathlength",
253
+ "patterncontentunits",
254
+ "patterntransform",
255
+ "patternunits",
256
+ "pointer-events",
257
+ "points",
258
+ "pointsatx",
259
+ "pointsaty",
260
+ "pointsatz",
261
+ "preservealpha",
262
+ "preserveaspectratio",
263
+ "primitiveunits",
264
+ "r",
265
+ "radius",
266
+ "refx",
267
+ "refy",
268
+ "rendering-intent",
269
+ "repeatcount",
270
+ "repeatdur",
271
+ "requiredextensions",
272
+ "requiredfeatures",
273
+ "restart",
274
+ "result",
275
+ "role",
276
+ "rotate",
277
+ "rx",
278
+ "ry",
279
+ "scale",
280
+ "seed",
281
+ "shape-rendering",
282
+ "show",
283
+ "slope",
284
+ "spacing",
285
+ "specularconstant",
286
+ "specularexponent",
287
+ "spreadmethod",
288
+ "startoffset",
289
+ "stddeviation",
290
+ "stemh",
291
+ "stemv",
292
+ "stitchtiles",
293
+ "stop-color",
294
+ "stop-opacity",
295
+ "strikethrough-position",
296
+ "strikethrough-thickness",
297
+ "string",
298
+ "stroke",
299
+ "stroke-dasharray",
300
+ "stroke-dashoffset",
301
+ "stroke-linecap",
302
+ "stroke-linejoin",
303
+ "stroke-miterlimit",
304
+ "stroke-opacity",
305
+ "stroke-width",
306
+ "style",
307
+ "surfacescale",
308
+ "systemlanguage",
309
+ "tablevalues",
310
+ "target",
311
+ "targetx",
312
+ "targety",
313
+ "text-anchor",
314
+ "text-decoration",
315
+ "text-rendering",
316
+ "textlength",
317
+ "title",
318
+ "to",
319
+ "transform",
320
+ "type",
321
+ "u1",
322
+ "u2",
323
+ "underline-position",
324
+ "underline-thickness",
325
+ "unicode",
326
+ "unicode-bidi",
327
+ "unicode-range",
328
+ "units-per-em",
329
+ "v-alphabetic",
330
+ "v-hanging",
331
+ "v-ideographic",
332
+ "v-mathematical",
333
+ "values",
334
+ "version",
335
+ "vert-adv-y",
336
+ "vert-origin-x",
337
+ "vert-origin-y",
338
+ "viewbox",
339
+ "viewtarget",
340
+ "visibility",
341
+ "width",
342
+ "widths",
343
+ "word-spacing",
344
+ "writing-mode",
345
+ "x",
346
+ "x-height",
347
+ "x1",
348
+ "x2",
349
+ "xchannelselector",
350
+ "xlink:actuate",
351
+ "xlink:arcrole",
352
+ "xlink:href",
353
+ "xlink:role",
354
+ "xlink:show",
355
+ "xlink:title",
356
+ "xlink:type",
357
+ "xml:base",
358
+ "xml:lang",
359
+ "xml:space",
360
+ "y",
361
+ "y1",
362
+ "y2",
363
+ "ychannelselector",
364
+ "z",
365
+ "zoomandpan",
366
+ ]);
14
367
 
15
368
  /**
16
369
  * Elements that are truly EMPTY (cannot have any children)
17
370
  * From DTD: font-face-format, font-face-name, glyphref, hkern, vkern
18
371
  */
19
- export const EMPTY_ELEMENTS = new Set(["font-face-format","font-face-name","glyphref","hkern","vkern"]);
372
+ export const EMPTY_ELEMENTS = new Set([
373
+ "font-face-format",
374
+ "font-face-name",
375
+ "glyphref",
376
+ "hkern",
377
+ "vkern",
378
+ ]);
20
379
 
21
380
  /**
22
381
  * Required attributes for each element
23
382
  */
24
383
  export const REQUIRED_ATTRIBUTES = {
25
- "animate": [
26
- "attributename"
27
- ],
28
- "animatecolor": [
29
- "attributename"
30
- ],
31
- "animatetransform": [
32
- "attributename"
33
- ],
34
- "circle": [
35
- "r"
36
- ],
37
- "color-profile": [
38
- "name"
39
- ],
40
- "cursor": [
41
- "href"
42
- ],
43
- "ellipse": [
44
- "rx",
45
- "ry"
46
- ],
47
- "feblend": [
48
- "in2"
49
- ],
50
- "fecomposite": [
51
- "in2"
52
- ],
53
- "feconvolvematrix": [
54
- "kernelmatrix"
55
- ],
56
- "fedisplacementmap": [
57
- "in2"
58
- ],
59
- "fefunca": [
60
- "type"
61
- ],
62
- "fefuncb": [
63
- "type"
64
- ],
65
- "fefuncg": [
66
- "type"
67
- ],
68
- "fefuncr": [
69
- "type"
70
- ],
71
- "feimage": [
72
- "href"
73
- ],
74
- "font": [
75
- "horiz-adv-x"
76
- ],
77
- "font-face-uri": [
78
- "href"
79
- ],
80
- "foreignobject": [
81
- "height",
82
- "width"
83
- ],
84
- "hkern": [
85
- "k"
86
- ],
87
- "image": [
88
- "height",
89
- "href",
90
- "width"
91
- ],
92
- "mpath": [
93
- "href"
94
- ],
95
- "polygon": [
96
- "points"
97
- ],
98
- "polyline": [
99
- "points"
100
- ],
101
- "rect": [
102
- "height",
103
- "width"
104
- ],
105
- "script": [
106
- "type"
107
- ],
108
- "set": [
109
- "attributename"
110
- ],
111
- "stop": [
112
- "offset"
113
- ],
114
- "style": [
115
- "type"
116
- ],
117
- "textpath": [
118
- "href"
119
- ],
120
- "tref": [
121
- "href"
122
- ],
123
- "use": [
124
- "href"
125
- ],
126
- "vkern": [
127
- "k"
128
- ]
384
+ animate: ["attributename"],
385
+ animatecolor: ["attributename"],
386
+ animatetransform: ["attributename"],
387
+ circle: ["r"],
388
+ "color-profile": ["name"],
389
+ cursor: ["href"],
390
+ ellipse: ["rx", "ry"],
391
+ feblend: ["in2"],
392
+ fecomposite: ["in2"],
393
+ feconvolvematrix: ["kernelmatrix"],
394
+ fedisplacementmap: ["in2"],
395
+ fefunca: ["type"],
396
+ fefuncb: ["type"],
397
+ fefuncg: ["type"],
398
+ fefuncr: ["type"],
399
+ feimage: ["href"],
400
+ font: ["horiz-adv-x"],
401
+ "font-face-uri": ["href"],
402
+ foreignobject: ["height", "width"],
403
+ hkern: ["k"],
404
+ image: ["height", "href", "width"],
405
+ mpath: ["href"],
406
+ polygon: ["points"],
407
+ polyline: ["points"],
408
+ rect: ["height", "width"],
409
+ script: ["type"],
410
+ set: ["attributename"],
411
+ stop: ["offset"],
412
+ style: ["type"],
413
+ textpath: ["href"],
414
+ tref: ["href"],
415
+ use: ["href"],
416
+ vkern: ["k"],
129
417
  };
130
418
 
131
419
  /**
132
420
  * Valid children for each element
133
421
  */
134
422
  export const VALID_CHILDREN = {
135
- "a": [
423
+ a: [
136
424
  "a",
137
425
  "altglyphdef",
138
426
  "animate",
@@ -169,37 +457,15 @@ export const VALID_CHILDREN = {
169
457
  "symbol",
170
458
  "text",
171
459
  "title",
172
- "view"
173
- ],
174
- "altglyphdef": [
175
- "altglyphitem",
176
- "glyphref"
177
- ],
178
- "altglyphitem": [
179
- "glyphref"
180
- ],
181
- "animate": [
182
- "desc",
183
- "metadata",
184
- "title"
185
- ],
186
- "animatecolor": [
187
- "desc",
188
- "metadata",
189
- "title"
190
- ],
191
- "animatemotion": [
192
- "desc",
193
- "metadata",
194
- "mpath",
195
- "title"
196
- ],
197
- "animatetransform": [
198
- "desc",
199
- "metadata",
200
- "title"
201
- ],
202
- "circle": [
460
+ "view",
461
+ ],
462
+ altglyphdef: ["altglyphitem", "glyphref"],
463
+ altglyphitem: ["glyphref"],
464
+ animate: ["desc", "metadata", "title"],
465
+ animatecolor: ["desc", "metadata", "title"],
466
+ animatemotion: ["desc", "metadata", "mpath", "title"],
467
+ animatetransform: ["desc", "metadata", "title"],
468
+ circle: [
203
469
  "animate",
204
470
  "animatecolor",
205
471
  "animatemotion",
@@ -207,9 +473,9 @@ export const VALID_CHILDREN = {
207
473
  "desc",
208
474
  "metadata",
209
475
  "set",
210
- "title"
476
+ "title",
211
477
  ],
212
- "clippath": [
478
+ clippath: [
213
479
  "animate",
214
480
  "animatecolor",
215
481
  "animatemotion",
@@ -226,19 +492,11 @@ export const VALID_CHILDREN = {
226
492
  "set",
227
493
  "text",
228
494
  "title",
229
- "use"
495
+ "use",
230
496
  ],
231
- "color-profile": [
232
- "desc",
233
- "metadata",
234
- "title"
235
- ],
236
- "cursor": [
237
- "desc",
238
- "metadata",
239
- "title"
240
- ],
241
- "defs": [
497
+ "color-profile": ["desc", "metadata", "title"],
498
+ cursor: ["desc", "metadata", "title"],
499
+ defs: [
242
500
  "a",
243
501
  "altglyphdef",
244
502
  "animate",
@@ -275,9 +533,9 @@ export const VALID_CHILDREN = {
275
533
  "symbol",
276
534
  "text",
277
535
  "title",
278
- "view"
536
+ "view",
279
537
  ],
280
- "ellipse": [
538
+ ellipse: [
281
539
  "animate",
282
540
  "animatecolor",
283
541
  "animatemotion",
@@ -285,116 +543,47 @@ export const VALID_CHILDREN = {
285
543
  "desc",
286
544
  "metadata",
287
545
  "set",
288
- "title"
289
- ],
290
- "feblend": [
291
- "animate",
292
- "set"
293
- ],
294
- "fecolormatrix": [
295
- "animate",
296
- "set"
297
- ],
298
- "fecomponenttransfer": [
299
- "fefunca",
300
- "fefuncb",
301
- "fefuncg",
302
- "fefuncr"
303
- ],
304
- "fecomposite": [
305
- "animate",
306
- "set"
307
- ],
308
- "feconvolvematrix": [
309
- "animate",
310
- "set"
546
+ "title",
311
547
  ],
312
- "fediffuselighting": [
548
+ feblend: ["animate", "set"],
549
+ fecolormatrix: ["animate", "set"],
550
+ fecomponenttransfer: ["fefunca", "fefuncb", "fefuncg", "fefuncr"],
551
+ fecomposite: ["animate", "set"],
552
+ feconvolvematrix: ["animate", "set"],
553
+ fediffuselighting: [
313
554
  "animate",
314
555
  "animatecolor",
315
556
  "fedistantlight",
316
557
  "fepointlight",
317
558
  "fespotlight",
318
- "set"
319
- ],
320
- "fedisplacementmap": [
321
- "animate",
322
- "set"
323
- ],
324
- "fedistantlight": [
325
- "animate",
326
- "set"
327
- ],
328
- "feflood": [
329
- "animate",
330
- "animatecolor",
331
- "set"
332
- ],
333
- "fefunca": [
334
- "animate",
335
- "set"
336
- ],
337
- "fefuncb": [
338
- "animate",
339
- "set"
340
- ],
341
- "fefuncg": [
342
- "animate",
343
- "set"
344
- ],
345
- "fefuncr": [
346
- "animate",
347
- "set"
348
- ],
349
- "fegaussianblur": [
350
- "animate",
351
- "set"
352
- ],
353
- "feimage": [
354
- "animate",
355
- "animatetransform",
356
- "set"
357
- ],
358
- "femerge": [
359
- "femergenode"
360
- ],
361
- "femergenode": [
362
- "animate",
363
- "set"
364
- ],
365
- "femorphology": [
366
- "animate",
367
- "set"
368
- ],
369
- "feoffset": [
370
- "animate",
371
- "set"
372
- ],
373
- "fepointlight": [
374
- "animate",
375
- "set"
559
+ "set",
376
560
  ],
377
- "fespecularlighting": [
561
+ fedisplacementmap: ["animate", "set"],
562
+ fedistantlight: ["animate", "set"],
563
+ feflood: ["animate", "animatecolor", "set"],
564
+ fefunca: ["animate", "set"],
565
+ fefuncb: ["animate", "set"],
566
+ fefuncg: ["animate", "set"],
567
+ fefuncr: ["animate", "set"],
568
+ fegaussianblur: ["animate", "set"],
569
+ feimage: ["animate", "animatetransform", "set"],
570
+ femerge: ["femergenode"],
571
+ femergenode: ["animate", "set"],
572
+ femorphology: ["animate", "set"],
573
+ feoffset: ["animate", "set"],
574
+ fepointlight: ["animate", "set"],
575
+ fespecularlighting: [
378
576
  "animate",
379
577
  "animatecolor",
380
578
  "fedistantlight",
381
579
  "fepointlight",
382
580
  "fespotlight",
383
- "set"
384
- ],
385
- "fespotlight": [
386
- "animate",
387
- "set"
388
- ],
389
- "fetile": [
390
- "animate",
391
- "set"
392
- ],
393
- "feturbulence": [
394
- "animate",
395
- "set"
581
+ "set",
396
582
  ],
397
- "filter": [
583
+ fespotlight: ["animate", "set"],
584
+ fetile: ["animate", "set"],
585
+ feturbulence: ["animate", "set"],
586
+ filter: [
398
587
  "animate",
399
588
  "desc",
400
589
  "feblend",
@@ -415,30 +604,13 @@ export const VALID_CHILDREN = {
415
604
  "feturbulence",
416
605
  "metadata",
417
606
  "set",
418
- "title"
419
- ],
420
- "font": [
421
- "desc",
422
- "glyph",
423
- "hkern",
424
- "metadata",
425
607
  "title",
426
- "vkern"
427
- ],
428
- "font-face": [
429
- "desc",
430
- "font-face-src",
431
- "metadata",
432
- "title"
433
608
  ],
434
- "font-face-src": [
435
- "font-face-name",
436
- "font-face-uri"
437
- ],
438
- "font-face-uri": [
439
- "font-face-format"
440
- ],
441
- "g": [
609
+ font: ["desc", "glyph", "hkern", "metadata", "title", "vkern"],
610
+ "font-face": ["desc", "font-face-src", "metadata", "title"],
611
+ "font-face-src": ["font-face-name", "font-face-uri"],
612
+ "font-face-uri": ["font-face-format"],
613
+ g: [
442
614
  "a",
443
615
  "altglyphdef",
444
616
  "animate",
@@ -475,9 +647,9 @@ export const VALID_CHILDREN = {
475
647
  "symbol",
476
648
  "text",
477
649
  "title",
478
- "view"
650
+ "view",
479
651
  ],
480
- "glyph": [
652
+ glyph: [
481
653
  "a",
482
654
  "altglyphdef",
483
655
  "animate",
@@ -514,9 +686,9 @@ export const VALID_CHILDREN = {
514
686
  "symbol",
515
687
  "text",
516
688
  "title",
517
- "view"
689
+ "view",
518
690
  ],
519
- "image": [
691
+ image: [
520
692
  "animate",
521
693
  "animatecolor",
522
694
  "animatemotion",
@@ -524,9 +696,9 @@ export const VALID_CHILDREN = {
524
696
  "desc",
525
697
  "metadata",
526
698
  "set",
527
- "title"
699
+ "title",
528
700
  ],
529
- "line": [
701
+ line: [
530
702
  "animate",
531
703
  "animatecolor",
532
704
  "animatemotion",
@@ -534,18 +706,18 @@ export const VALID_CHILDREN = {
534
706
  "desc",
535
707
  "metadata",
536
708
  "set",
537
- "title"
709
+ "title",
538
710
  ],
539
- "lineargradient": [
711
+ lineargradient: [
540
712
  "animate",
541
713
  "animatetransform",
542
714
  "desc",
543
715
  "metadata",
544
716
  "set",
545
717
  "stop",
546
- "title"
718
+ "title",
547
719
  ],
548
- "marker": [
720
+ marker: [
549
721
  "a",
550
722
  "altglyphdef",
551
723
  "animate",
@@ -582,9 +754,9 @@ export const VALID_CHILDREN = {
582
754
  "symbol",
583
755
  "text",
584
756
  "title",
585
- "view"
757
+ "view",
586
758
  ],
587
- "mask": [
759
+ mask: [
588
760
  "a",
589
761
  "altglyphdef",
590
762
  "animate",
@@ -621,7 +793,7 @@ export const VALID_CHILDREN = {
621
793
  "symbol",
622
794
  "text",
623
795
  "title",
624
- "view"
796
+ "view",
625
797
  ],
626
798
  "missing-glyph": [
627
799
  "a",
@@ -660,14 +832,10 @@ export const VALID_CHILDREN = {
660
832
  "symbol",
661
833
  "text",
662
834
  "title",
663
- "view"
664
- ],
665
- "mpath": [
666
- "desc",
667
- "metadata",
668
- "title"
835
+ "view",
669
836
  ],
670
- "path": [
837
+ mpath: ["desc", "metadata", "title"],
838
+ path: [
671
839
  "animate",
672
840
  "animatecolor",
673
841
  "animatemotion",
@@ -675,9 +843,9 @@ export const VALID_CHILDREN = {
675
843
  "desc",
676
844
  "metadata",
677
845
  "set",
678
- "title"
846
+ "title",
679
847
  ],
680
- "pattern": [
848
+ pattern: [
681
849
  "a",
682
850
  "altglyphdef",
683
851
  "animate",
@@ -714,9 +882,9 @@ export const VALID_CHILDREN = {
714
882
  "symbol",
715
883
  "text",
716
884
  "title",
717
- "view"
885
+ "view",
718
886
  ],
719
- "polygon": [
887
+ polygon: [
720
888
  "animate",
721
889
  "animatecolor",
722
890
  "animatemotion",
@@ -724,9 +892,9 @@ export const VALID_CHILDREN = {
724
892
  "desc",
725
893
  "metadata",
726
894
  "set",
727
- "title"
895
+ "title",
728
896
  ],
729
- "polyline": [
897
+ polyline: [
730
898
  "animate",
731
899
  "animatecolor",
732
900
  "animatemotion",
@@ -734,18 +902,18 @@ export const VALID_CHILDREN = {
734
902
  "desc",
735
903
  "metadata",
736
904
  "set",
737
- "title"
905
+ "title",
738
906
  ],
739
- "radialgradient": [
907
+ radialgradient: [
740
908
  "animate",
741
909
  "animatetransform",
742
910
  "desc",
743
911
  "metadata",
744
912
  "set",
745
913
  "stop",
746
- "title"
914
+ "title",
747
915
  ],
748
- "rect": [
916
+ rect: [
749
917
  "animate",
750
918
  "animatecolor",
751
919
  "animatemotion",
@@ -753,19 +921,11 @@ export const VALID_CHILDREN = {
753
921
  "desc",
754
922
  "metadata",
755
923
  "set",
756
- "title"
757
- ],
758
- "set": [
759
- "desc",
760
- "metadata",
761
- "title"
762
- ],
763
- "stop": [
764
- "animate",
765
- "animatecolor",
766
- "set"
924
+ "title",
767
925
  ],
768
- "svg": [
926
+ set: ["desc", "metadata", "title"],
927
+ stop: ["animate", "animatecolor", "set"],
928
+ svg: [
769
929
  "a",
770
930
  "altglyphdef",
771
931
  "animate",
@@ -802,9 +962,9 @@ export const VALID_CHILDREN = {
802
962
  "symbol",
803
963
  "text",
804
964
  "title",
805
- "view"
965
+ "view",
806
966
  ],
807
- "switch": [
967
+ switch: [
808
968
  "a",
809
969
  "animate",
810
970
  "animatecolor",
@@ -827,9 +987,9 @@ export const VALID_CHILDREN = {
827
987
  "switch",
828
988
  "text",
829
989
  "title",
830
- "use"
990
+ "use",
831
991
  ],
832
- "symbol": [
992
+ symbol: [
833
993
  "a",
834
994
  "altglyphdef",
835
995
  "animate",
@@ -866,9 +1026,9 @@ export const VALID_CHILDREN = {
866
1026
  "symbol",
867
1027
  "text",
868
1028
  "title",
869
- "view"
1029
+ "view",
870
1030
  ],
871
- "text": [
1031
+ text: [
872
1032
  "a",
873
1033
  "altglyph",
874
1034
  "animate",
@@ -881,9 +1041,9 @@ export const VALID_CHILDREN = {
881
1041
  "textpath",
882
1042
  "title",
883
1043
  "tref",
884
- "tspan"
1044
+ "tspan",
885
1045
  ],
886
- "textpath": [
1046
+ textpath: [
887
1047
  "a",
888
1048
  "altglyph",
889
1049
  "animate",
@@ -893,17 +1053,10 @@ export const VALID_CHILDREN = {
893
1053
  "set",
894
1054
  "title",
895
1055
  "tref",
896
- "tspan"
1056
+ "tspan",
897
1057
  ],
898
- "tref": [
899
- "animate",
900
- "animatecolor",
901
- "desc",
902
- "metadata",
903
- "set",
904
- "title"
905
- ],
906
- "tspan": [
1058
+ tref: ["animate", "animatecolor", "desc", "metadata", "set", "title"],
1059
+ tspan: [
907
1060
  "a",
908
1061
  "altglyph",
909
1062
  "animate",
@@ -913,9 +1066,9 @@ export const VALID_CHILDREN = {
913
1066
  "set",
914
1067
  "title",
915
1068
  "tref",
916
- "tspan"
1069
+ "tspan",
917
1070
  ],
918
- "use": [
1071
+ use: [
919
1072
  "animate",
920
1073
  "animatecolor",
921
1074
  "animatemotion",
@@ -923,24 +1076,39 @@ export const VALID_CHILDREN = {
923
1076
  "desc",
924
1077
  "metadata",
925
1078
  "set",
926
- "title"
1079
+ "title",
927
1080
  ],
928
- "view": [
929
- "desc",
930
- "metadata",
931
- "title"
932
- ]
1081
+ view: ["desc", "metadata", "title"],
933
1082
  };
934
1083
 
935
1084
  /**
936
1085
  * Elements with mixed content (can have text)
937
1086
  */
938
- export const MIXED_CONTENT_ELEMENTS = new Set(['text', 'tspan', 'tref', 'textpath', 'altglyph', 'a', 'title', 'desc', 'metadata', 'script', 'style']);
1087
+ export const MIXED_CONTENT_ELEMENTS = new Set([
1088
+ "text",
1089
+ "tspan",
1090
+ "tref",
1091
+ "textpath",
1092
+ "altglyph",
1093
+ "a",
1094
+ "title",
1095
+ "desc",
1096
+ "metadata",
1097
+ "script",
1098
+ "style",
1099
+ ]);
939
1100
 
940
1101
  /**
941
1102
  * SVG 2.0 elements (warn but don't auto-correct)
942
1103
  */
943
1104
  export const SVG2_ELEMENTS = new Set([
944
- 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'solidcolor',
945
- 'hatch', 'hatchpath', 'discard', 'unknown'
1105
+ "mesh",
1106
+ "meshgradient",
1107
+ "meshpatch",
1108
+ "meshrow",
1109
+ "solidcolor",
1110
+ "hatch",
1111
+ "hatchpath",
1112
+ "discard",
1113
+ "unknown",
946
1114
  ]);